08.29.09
QuickConnectiPhone 1.5.0 is now available
QCiPhone 1.5.0 has just been uploaded to sourceForge. They are saying that it may take about 15 minutes to become visible as the default download for OS X machines.
A note to 3.0 API users. The dashcode QC template no longer appears as an option. I am looking for ways to get it to show up again.End
Because of the 3.0 Dashcode changes I have not been able to update the Dashcode examples to the latest QC source. All of the Xcode examples are updated.
The release includes examples of how to use the video and audio tags in booth QCiPhone and QCMac applications.
QuickConnectMac 1.0 is also included in this release. It allows you to create hybrid applications that run on Mac machines just like you do for the iPhone and iPod touch.
QuickConnectPHP 1.0 is another template that can be used on the Mac side. It isn’t used to create hybrid applications but is used to create PHP web applications.
Also included, for those interested, is QCErlang 1.0. It is an updated version of an Xcode template for developing erlang applications. It includes auto-completes for most of the commonly used functions.
Defect fixes in this release include:
1. UIWebView no longer ends up with a black background after re-displaying the Default.png file while the page loads.
2. DataAccessObject in-browser database use fixed and updated to new methodology for the retention of which BCF in the stack is to be called next.
3. Updated the embedded map code to use the current data passing scheme from and to Objective-C
4. HTML Elements with touch events inside of Elements made scrollable no longer react to ontouchstart, ontouchmove, and ontouchend unless the event is not due to scrolling
07.01.09
The book is shipping
My latest book, Developing Hybrid Applications for the iPhone: Using HTML, CSS, and JavaScript to Build Dynamic Apps for the iPhone is now available and seems to be doing pretty well.
It covers using QuickConnectiPhone and PhoneGap to create applications for the iPhone.
Hopefully it will be helpful.
06.05.09
QuickConnect Defect Tracking System
A new defect tracking system is now available for the QuickConnect family of products.
When you post a defect please include a simple example code set that illustrates the issue.
05.01.09
Scrolling individual elements in hybrid or web applications
A request has been made to show how individual elements in a hybrid or web application can be scrolled on the iPhone. I have included some code below that has all of the JavaScript requried to accomplish this. It comes from the QCUtilities.js file of QuickConnect iPhone 1.5 release that will be posted within a couple of days.
Because it is from QuickConnect it includes the ability to add request handling for when the user touches the screen in preparation for scrolling, as well as each time the finger is moved and when the scroll action is complete. If you want to use this code outside of QuickConnect then remove everything regarding the startDragCmd, dragCmd, and dropCmd parameters.
If you want to use this within an older version of QuickConnectiPhone place the code in your version of the QCUtilities.js file and it works.
This approach uses the CSS transitions, proposed for HTML 5, available in WebKit instead of the standard JavaScript approach since that approach is much to slow for both the iPhone and iPod touch devices.
To make an element scrollable call the makeScrollable function and pass the element you want to be scrollable as the first parameter. If you want the element to not be scrollable below its original y axis location pass true as the second parameter of makeScrollable. Here is the onload event code from the scrollingElements example of the upcoming QuickConnectiPhone 1.5 release that sets three views in a view stack to be scrollable.
Making elements scrollable
function load()
{
dashcode.setupParts();
makeScrollable(document.getElementById(‘view1′));
makeScrollable(document.getElementById(‘view2′));
makeScrollable(document.getElementById(‘view3′));
}
Scrolling Functions to Add
/*
* Pass any DOM element to this function to make it scroll
* The *Cmd parameters are optional commands to be handled for
* scroll events.
*/
function makeScrollable(anElement, scrollBothUpAndDown, startDragCmd, dragCmd, dropCmd){
anElement.ontouchstart = prepareScroll;
anElement.ontouchmove = scrollIt;
anElement.ontouchend = scrollDone;
anElement.scrollBothUpAndDown = scrollBothUpAndDown;
//do not set or reset the commands if none are passed in.
if(startDragCmd){
anElement.startDragCmd = startDragCmd;
}
if(dragCmd){
anElement.dragCmd = dragCmd;
}
if(dropCmd){
anElement.dropCmd = dropCmd;
}
}
/*
* This function is triggered each time an ontouchmove event is
* fired for an element that has been passed to makeDraggable.
*/
function scrollIt(event)
{
stopDefault(event);
this.y = event.targetTouches[0].clientY – this.offsetY;
if(this.lastY){
this.y += this.lastY;
}
if(this.scrollBothUpAndDown || this.y < 0){
this.style.webkitTransform = ‘translate(0px, ‘ + this.y + ‘px)’;
}
else if(this.y >= 0){
this.style.webkitTransform = ‘translate(0px, 0px)’;
}
if(this.dragCmd){
var params = new Array();
params.push(event);
params.push(this);
handleRequest(this.dragCmd, params);
}
}
/*
* This function is triggered every time an ontouchstart event is
* fired for an element that has been passed to makeDraggable.
*/
function prepareScroll(event)
{
stopDefault(event);
//store off any timing and duration set anywhere else in the app
//and turn them off so they don’t interfere with the scrolling
this.timing = this.style.webkitTransitionTimingFunction;
this.style.webkitTransitionTimingFunction = null;
this.duration = this.style.webkitTransitionDuration;
this.style.webkitTransitionDuration = null;
this.touches = event.targetTouches;
this.offsetY = event.targetTouches[0].clientY;
if(this.startDragCmd){
var params = new Array();
params.push(event);
params.push(this);
handleRequest(this.startDragCmd, params);
}
}
/*
* This function is triggered every time an ontouchend event is
* fired for an element that has been passed to makeDraggable.
*/
function scrollDone(event)
{
//this.ontouchmove = null;
//this.ontouchend = null;
if(this.scrollBothUpAndDown || this.y < 0){
this.lastY = this.y;
}
else{
this.lastY = 0;
}
//restore any timing or duration that was set anywhere else in the app
this.style.webkitTransitionTimingFunction = this.timing;
this.style.webkitTransitionDuration = this.duration;
if(this.dropCmd){
var params = new Array();
params.push(event);
params.push(this);
handleRequest(this.dropCmd, params);
}
}
04.16.09
QuickConnectiPhone 1.5 beta 7 available
Beta 7 includes:
- A fix to a defect that didn’t allow any control functions to be called if the DataAccessObject or ServerAccessObject was used.
- Added the ability to set a timeout value for the ServerAccessObject when it is used to make an AJAX call. The default value is 10 seconds.
- Added AJAXErrorExample to show how to handle web server errors.
- Fixed the DeviceDescription example so that it includes the necessary support files.
It looks like we are getting close to a release version!
03.17.09
QuickConnectiPhone and iPhone OS 3.0
Apple is currently giving a presentation on what new API’s will be available in the new 3.0 version of iPhone OS.
I’m looking forward to implementing these new features for QuickConnectiPhone.
1. google maps. I can now replace the current Objective-C implementation with a standard one. The JavaScript side functions that currently exist won’t change but there may be new additions.
2. Bluetooth networking. Since the current QuickConnect Ad hoc networking implementation already uses Bonjour this capability may already be included in QC. I’ll have to check it out.
3. Streaming Audio and Video. A good addition to QCiPhone’s playAudio functionality. I can hardly wait.
4. Push notificaitons. Great to finally be able to add this to QC.
5. In app email.
6. proximity sensor.
7. iPod library access.
It looks like there are many more. It will be great to add as many of these as possible to QuickConnectiPhone.
03.10.09
Playing looping audio files
QuickConnectiPhone 1.5 Beta 3 is going to include the playing of audio files using the new AVAudioPlayer made available in recent releases of the iPhone OS. This will allow easy looping and greatly reduce the amount of code required in the QCiPhone framework. All good. I am including in this post the code that will be in Beta 3 so that those of you using 1.1.3 can put the code in the applications you are creating.
The code can also be used as an example of how to use the AVAudioPlayer Objective-C class.
Be aware that looping compressed files such as mp3’s will leave a ‘plop’ or gap in playing between loops. If you want to avoid this you can use uncompressed files such as wav files or follow the advice onthis page.
The changes to com.js. Replace the record, stopRecording, play, and stopPlaying functions with the following code.
function record(aFileName){
if(aFileName){
var params = new Array();
if(aFileName.indexOf(‘.’) == -1){
aFileName = aFileName+“.caf”;
}
params[0] = aFileName;
params[1] = “start”;
makeCall(“rec”, JSON.stringify(params));
}
}
function stopRecording(aFileName){
if(aFileName){
var params = new Array();
if(aFileName.indexOf(‘.’) == -1){
aFileName = aFileName+“.caf”;
}
params[0] = aFileName;
params[1] = “stop”;
makeCall(“rec”, JSON.stringify(params));
}
}
//set loop count to a number of loops or -1 for continuous looping
function play(aFileName, loopCount){
if(aFileName){
var params = new Array();
if(aFileName.indexOf(‘.’) == -1){
aFileName = aFileName+“.caf”;
}
params[0] = aFileName;
params[1] = “start”;
params[2] = 0;
if(loopCount){
params[2] = loopCount;
}
makeCall(“play”, JSON.stringify(params));
}
}
/*
* Pause is removed for now since the standard apple Objective-C
* class fails to play an audio file that is paused.
*
function pausePlaying(aFileName){
if(aFileName){
var params = new Array();
if(aFileName.indexOf(‘.’) == -1){
aFileName = aFileName+”.caf”;
}
params[0] = aFileName;
params[1] = “pause”;
makeCall(“play”, JSON.stringify(params));
}
}
*/
function stopPlaying(aFileName){
if(aFileName){
var params = new Array();
if(aFileName.indexOf(‘.’) == -1){
aFileName = aFileName+“.caf”;
}
params[0] = aFileName;
params[1] = “stop”;
makeCall(“play”, JSON.stringify(params));
}
}
// PlayAudioVCO.m
//
/*
Copyright 2009 Lee S. Barney
This file is part of QuickConnectiPhone.
QuickConnectiPhone is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QuickConnectiPhone is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with QuickConnectiPhone. If not, see <http://www.gnu.org/licenses/>.
*/
#import <AVFoundation/AVFoundation.h>
#import “PlayAudioVCO.h”
#import “QuickConnectViewController.h”
@implementation PlayAudioVCO
+ (id) doCommand:(NSArray*) parameters{
NSString *flag = [parameters objectAtIndex:2];
QuickConnectViewController *aController = [parameters objectAtIndex:0];
if([flag compare:@"start"] == NSOrderedSame){
NSString *fileName = [parameters objectAtIndex:1];
NSArray *split = [fileName componentsSeparatedByString:@"."];
NSString *audioFilePath = [[NSBundle mainBundle] pathForResource:[split objectAtIndex:0] ofType:[split objectAtIndex:1]];
if(audioFilePath == nil){
//recorded file.
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
audioFilePath = [documentsDirectory stringByAppendingPathComponent:fileName];
}
AVAudioPlayer *audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:audioFilePath] error:NULL];
aController.audioPlayer = audioPlayer;
[audioPlayer release];
aController.audioPlayer.numberOfLoops = [parameters objectAtIndex:3];
[audioPlayer prepareToPlay];
BOOL plays = [audioPlayer play];
if(plays){
MESSAGE(@”done playing”);
}
else{
MESSAGE(@”play failed”);
}
}
else if([flag compare:@"pause"] == NSOrderedSame){
MESSAGE(@”pausing”);
[aController.audioPlayer pause];
}
else{
[aController.audioPlayer stop];
}
MESSAGE(@”done with PlayAudioVCO”);
return nil;
}
@end
03.05.09
Creating Line Graphs on the iPhone
I have finally been able to complete the line graphs(charts) portion of the Charting and Graphing QuickConnect library and am working on getting a final bug out of the Bar and Pie charts.
I plan on producing a video on how these are used and how to create them in your code but thought that a quick view of what is coming in V 1.5 beta 2 would be of interest.
I have put a few images here for you to see. The first is a line graph showing two separate data series being displayed. If you touch the data points, either directly or by moving your finger over them, the value and description of the point is displayed in the display area of the chart. You can also cycle through the values of a series by using the forward and backward arrows or by moving your finger across the color display bar.

A two series line chart
The next image is of the same data but drawn as a filled line chart.

A two data series filled line chart
If you touch any of the data points the series that contains that value is brought to the front as you can see in this next image.

A two series filled line chart showing the second series in front.
I have tried to make this as easy to use as I can. Here is the code to create the filled chart.
var fill = false;
var shadow = true;
lineDisplay.chart = new QCLineChart(document.getElementById(‘lineChartDisplay’), ‘Animals’, shadow, fill);
lineDisplay.chart.addSeries(‘Some Animals’,[['cats',15], ['hipos',2], ['fish',7], ['dogs',4]
, ['bears',20], ['mice',3], ['elephants',7], ['dogs',10], ['kangaroo',18]]);
lineDisplay.chart.addSeries(‘Other Animals’,[['gorillas',10], ['snakes',5], ['robins',3],['rats',4], ['moose',15], ['deer',14], ['tigers',0 ], ['jaguar',9], ['emu',9]]);
lineDisplay.chart.display();
To change it to a standard non-filled chart just change the fill variable to false.
02.28.09
QuickConnectFamily Development and porting RoadMap
I have created a page for the official QuickConnectFamily development and porting roadmap. It can be found on the wiki here. I will keep it updated as Beta and release versions are shipped.
Feedback about priorities for development or additional functionality is appreciated.
02.04.09
QuickConnectLinux Beta 1 is Now available
It took longer than expected, but it is here. QuickConnectLinux 1.0 beta 1 uses the 4.5 version of QT as the support for JavaScript application creation. Since the QT 4.5 library license is LGPL just like QuickConnectLinux, when the release of QT 4.5 is shipped by Nokia your applications can be created for free or you can charge for them without any payments or royalties.
The framework access to SQLite databases shipped with the application or created at runtime are both supported in this first beta.
I used Qt creator from Nokia to write the C++/QT back end code.

The nativeDBAccess example application running on Linux
Just like the other members of the QCFamily you write your application in JavaScript, compile it, and ship it. You users can then install the application and run it without access to the internet. QWebView is the class in QT that contains the WebKit engine and makes all of this possible. I have attached an image of the exact same HTML, CSS, and JavaScript used in the QuickConnectiPhone nativeDBAccess example application running on top of the QT port of the native framework.
I’ll put the Qt Creator project up on SourceForge as QuickConnectLinux 1.0 Beta 1.
I can now move back to working more heavily on QCiPhone 1.5 beta and then moving the QCAndroid and Mac versions from Beta to release. After than I will port QCLinux to Symbian. That should be easy since the Linux Beta now exists.
Progress is being made.