September 10, 2011
At Last!!!
At long last (big sigh of relief here by me) QuickConnectFamily 2.1 is finally available for download. It involved a lot of work by many people and has come together well. There are some big changes for both the iOS and Android platforms. These enhancements and changes have been driven by requests from developers like you.
Both:
- This one is BIG. The JavaScript functions now exist inside the qc name space. In other words where you would have used the handleRequest method it is now the qc.handleRequest method. The old behavior is deprecated.
- Another BIG one. In order to make the Control Function code more readable and more easily comprehended for those new to the framework all Control Functions MUST return one of the following three values (see the documentation for more information):
- qc.STACK_CONTINUE – This instructs the framework to execute the next control function in the stack.
- qc.STACK_EXIT – This instructs the framework to terminate all further stack execution.
- qc.WAIT_FOR_DATA – This instructs the framework that a call to database or remote data has been made or a call to device specific behavior such as showing a map, displaying the camera, email editor or other native behaviors.
- Work has been done to improve the asynchronous call stability in the underlying framework. (Thank you to the team at affinityAmp).
- Miscellaneous bug fixes and enhancements.
Android:
- Bug fixes
- Expanded database support and fixes
- A major rework of the underlying Android Java code to make it match the design changes in iOS. This is in preparation for QC Plugins and some new features such as ‘window-in-window’ that will be part of the next release as a Plugin. The ‘window-in-window’ code is in there now but not official until it is converted to a plugin and the same behavior is available for iOS.
- Added a hybrid sqlite database example
iOS:
- Bug fixes
- Removed the native footer code since libraries for scrolling and others such as Sencha, JQTouch, etc. are now of good quality.
- QC Family Hybrid Plugin API and design spec completed. There is an example of how you can add to QC on your own. If you thing these additions could be useful to others you are free to charge for them, or not, host them yourself, notify me and I will add them to the plugin list on the QC plugin site. If you are willing to donate them to the QC community send them to me for review and I will put them into the git repository and list them on the QC plugin site.
- Updated all the examples to use the new return values and the new qc name space.
August 16, 2011
QC DBSync version 1.3 available
For those of you needing a native database synchronization tool version 1.3 of QC DBSync is now available. It includes minor functionality and API upgrades on the iOS side, an example service written in PHP is included in the download.
February 17, 2011
Android SQLite Library Example Code
I have just uploaded QCDBAccess. It is a SQLite wrapper for Android that is easy to use, thread-safe, and allows you to use transactions if you choose. It is the same code that has been available for QCAndroid hybrid application developers for a few years. I thought I would pull it out and give it its own life for those that want to use it on their own.
You can download it from SourceForge and find out more about it, including the API, at the QuickConnectFamily site.
As with all of the things I’m making available I have tried to make this as easy to use, highly functional, and small as possible.
The jar file is only 8k in size but the library doesn’t restrict your use of the databases in any way.
Here is a simple example of how to use the library to do a query against a SQLite database file included in your applications’ assets directory. Notice that I’m checking to see if the user has entered a name to query against in an EditText object from the user interface. If they have then I’m going to use a prepared statement. The EditText object in this example has been passed into the method in which this code exists.
String sql = “SELECT * FROM user”;
String[] statementParams = null;
EditText nameInput = (EditText)methodParameters.get(1);
String name = nameInput.getEditableText().toString().trim();
if(name.length() > 0){
sql += ” WHERE name = ?”;
statementParams = new String[1];
statementParams[0] = name;
}
try {
retVal = DataAccessObject.getData(theActivity, “demo.sqlite”, sql, statementParams);
} catch (DataAccessException e) {
e.printStackTrace();
}
The DataAccessResult variable retVal is going to be returned from this method later. This DataAccessResult is a Bean that contains resultant field names, the records returned from the query, and a database error description if and only if a database error happened.
the getData method is passed the Activity with which the database is associated with. This is usually the main Activity in an Android Application. The second parameter is the name of the SQLite database file to be used. The third parameter is SQLite SQL assembled either as a standard or prepared statement. The last parameter is an array of Objects that are to be bound to the ? characters if the SQL is a prepared statement or null if it is not a prepared statement.
Inserting data is done in very much the same fashion. Once again I have an EditText object in the UI from which I’m getting the name to be inserted into the table. I’m also generating a unique identifier just to make this a little more interesting. You could do an auto incremented id in your table if you want.
EditText nameInput = (EditText)parameters.get(1);
String nameToAdd = nameInput.getEditableText().toString().trim();
String[]statementParams = {UUID.randomUUID().toString(), nameToAdd};
DataAccessResult aResult = null;
try {
aResult = DataAccessObject.setData(theActivity, “demo.sqlite”,
“INSERT INTO user VALUES(?,?)”,
statementParams);
return aResult;
} catch (Exception e) {
e.printStackTrace();
}
Notice that once again I have chosen to use a prepared statement. I’m doing this to avoid SQL insertion attacks. It never hurts to avoid those.
If you are going to do several insertions you should use transactions to make sure you data stays clean. There is a startTransaction method and an endTransaction method in the DataAccessObject. Use those before and after multiple setData calls and you will be safe.
December 30, 2010
Pre-Threaded Android and iOS Apps now in QC 1.6.5
All User Interface libraries, regardless of platform, require that the UI components start their updates from the ‘main’ thread. Sometimes this is referred to as the UI thread but it is actually the main thread of the application.
What most people that are creating mobile apps don’t realize is that if they are using the main thread to do significant computation such as remote server access, XML parsing, database access, number crunching, etc. is that this makes their User Interface slow and chunky. The ywill notice the unresponsiveness of their UI but will not know why it isn’t smooth. They generally tend to come to believe that the problem is that the processors are not fast enough to do what they want to do. This is generally not the case.
What they really need to do is move the computational portions of their apps into background (worker) threads and let the UI thread remain responsive to the user. This can be a challenge that they are unwilling to attempt due to the perceived difficulty of implementing threading.
Starting with QuickConnect 1.6.5 I have made the native iOS and Android application templates pre-threaded for both iOS and Android apps. This means that you, as a developer, no longer need to worry about creating the background threads and then executing UI updates on the main thread for your mobile apps.
When you use one of the mobile native templates in QC all of your validation and computation code is automatically executed on a background thread. When this portion of your application is complete and you make a UI update the framework automatically causes your update to use the main thread. You won’t even be aware of the change.
All of this is triggered every time you use the QC framework handleRequest method. This is in addition to linearizing your asynchronous HTTP remote access calls and an easy to use SQLite wrapper. With this kind of a head start it becomes much easier for you to create highly responsive, high quality apps in a much shorter time.
I will soon be making this multi-threading available to all of you using the hybrid iOS and Android templates as well. It should make a huge difference in your execution speeds.
December 23, 2010
QuickConnect 1.6.4 Now Available
I have just posted the 1.6.4 version of QC on SourceForge. It includes some defect fixes and some minor additions, and a few big changes. QC 1.6.4 requires the iOS 4.2 SDK.
The big changes are regarding the native application templates. You can now use the same design to create Objective-C iPhone, iPad, and Universal iPhone/iPad apps that you have been using to create your hybrid applications.
These native iOS apps come ‘pre-threaded’. Every time you call handleRequest your command stack is executed on a worker thread. Any of your ViewControlObjects that you create for your control Stack are executed in the main thread since it is the only one that is allowed to update the User Interface. All other behavior is done on a worker thread and you don’t have to worry about how to set it up, make it go, or make it stop.
Just as with the hybrid apps you’ve been creating with QC all of your async calls to HTTP servers, portals, etc. are linearized for you. You never need to write another callback function!
In addition to making your remote HTTP calls easier all of the templates for native QuickConnect applications also include support for both direct SQLite access and CoreData.
With a little time working in Interface Builder and putting together some CoreData objects your app is up and running.
Examples are already in the download for all of these native iOS templates. Check them out and see how easy native iOS apps can be.
The next release will have native multi-threaded Android applications as well.
One other change is that the PHP template has been updated. Take a look at the example in the download.
Lee
August 22, 2010
QuickConnectFamily 1.6.3 is now available
I am uploading to sourceForge the latest version of QuickConnect right now.
This new version of QC is a maintenance version and has two fixes in it.
The first is a fix to the display of iAdds. Previously the iAdd seemed to disappear but was still taking up screen space and masking the area it was covering.
The second fix regarded a crash when using native databases with null values in fields.
Both of these defects have been fixed.
January 26, 2010
QuickConnectFamily 1.6 beta 11 Now Available!
We are getting closer to build once and launch all all platforms! The Android template is much more functional now and prepares the way.
This beta 11 of QCFamily 1.6 has some important features
- Enterprise Sync supports synchronization with all remote databases.
- Stabilization of the iPhone enterprise synchronization for native and in-browser databases
- Enterprise synchronization is now available for Android devices. Unfortunately Google is not supporting in-browser HTML 5 databases at this time. This means that if you want to use this feature you will need to use a native database (include a .sqlite file)
- Google doesn’t support the XMLHttpRequest object in their WebView class. Therefore I have written a simple replacement. It is not fully featured but works in support of the Enterprise data sync ability.
- The QC Android template now includes the ability to build and run on a connected Android device in addition to the build for release and build for simulator functionality it already had.
Target features for the next beta:
- iPhone in-app purchase
- Enterprise data sync for Palm WebOS
- First Blackberry template
- Enterprise data sync for Blackberry
- One click build and run on all platforms
November 17, 2009
QCiPhone 1.6 beta 4 is now available.
A new beta of QC 1.6, beta 4, is now available on sourceforge. I has the following fixes and changes
- DBScript can now be used with native databases.
- All examples shipping in the download of the beta are now converted to the 1.6 file structure. A few of the examples have not been ported yet and so I have not included them yet. I’ll put them in the next beta.
- ServerAccessObject timeout defect fixed that triggered multiple calls to VCO’s
- Cleaned up DataAccessObject batch method (a support method for DBScript. Don’t use it directly). Simplified batch completion checking.
- Fixed DataAccessObject transaction handling that caused transactions not to appear to fail if database constraints were violated.
- SQLite updated to version 3.6.20 with support for FTS3 query syntax added
- Added missing NativeFooter Example
- Fixed failure to hide native footer defect
- Added new JQTouch example showing the JQTouch developer demo
October 31, 2009
QuickConnectiPhone 1.6 beta 3 now available
QCiPhone 1.6 beta 3 includes:
- All new Xcode apps created using the 1.6 beta 2 or later Xcode template will auto-update to a new version of QCiPhone when you run the QCFamily installer
- A fix for the permission build error in beta 2
- In application maps. This feature allows you to drop any number of pins as well as show the current location of the device.
- A new object, DBScript, that allows you to do bulk updates to the SQLite database in a transactionally safe fashion (in-browser only for now. Will work for native databases in the next beta.
Examples for both the in-app maps (MapExample) and DBScript (BrowserDBScript) exist in the iPhone Examples directory of the download.
The post just previous to this one shows how to use the DBScript object.
SQLite bulk data update or insert
I just added SQLite bulk updates for in-browser databases (native databases coming soon) to the QuickConnect iPhone framework (1.6 beta 3). I did this by creating and adding to the framework an object called DBScript. It is transactionally safe. If one of your updates in the script fails all changes are rolled back.
It is also easy to use. The code below comes from the databaseDefinition.js file of the new BrowserDBScript dashcode example. In it a link to the database is established using the DataAccessObject. Then the DBScript object is created and a series of SQL statements are added to the script. Lastly, the script is executed. Notice that the script object works for both standard and prepared statements.
If you are using this after a data pull from a network resource or after querying the user for information to insert, make sure you use a prepared statement type call to avoid SQL insertion attacks.
/*
* An example of how to use the DBScript object to populate a database.
* This will be done as a single transaction and is transactionally safe.
* This means that all changes will be rolled back if any
* database error happens.
*/
//create or connect to the in-UIWebView database
var database = new DataAccessObject(“WelcomeExample”, “1.0″, “Welcome example”, 20);
//create the script object
var bulkInsertScript = new DBScript(database);
//add all statements to the script object
bulkInsertScript.addStatement(“CREATE TABLE IF NOT EXISTS names (id INTEGER UNIQUE, name TEXT)”);
bulkInsertScript.addStatement(“INSERT INTO names VALUES(1,’Bob’)”);
bulkInsertScript.addStatement(“INSERT INTO names VALUES(2,’Sue’)”);
//and example of using a prepared statement
bulkInsertScript.addStatement(“INSERT INTO names VALUES(?,?)”,[3,"Jose"]);
bulkInsertScript.addStatement(“INSERT INTO names VALUES(4,’Bjorn’)”);
bulkInsertScript.addStatement(“INSERT INTO names VALUES(5,’Jean’)”);
bulkInsertScript.addStatement(“INSERT INTO names VALUES(6,’Gustav’)”);
//execute all statements within a transaction
bulkInsertScript.executeSetDataScript();