May 30, 2010

QuickConnect 1.6 beta 17 now available

Posted in mac development tagged , , , , , , , at 1:02 am by tetontech

Exciting new features have been added in this beta with matching examples.   They include:

  • Camera Access – display the camera from JavaScript
  • Activating and deactivating the application activity indicator from JavaScript
  • Activating and deactivating the network activity indicator from JavaScript
  • Custom Extension support including a template for your new BCOs, VCOs, ValCOs, etc. that inherit from QCCommandObject.

The custom extension support has made it very easy to create custom Objective-C behavior and run it from within the QC framework.  JavaScript custom extensions are still done the same way as before.  Just add your .js files and make your calls.

To create an Objective-C extension do the following:

  1. In your application project select New->File and pick the Mac OS X -> QuickConnect-> QCCommandObject subclass option.
  2. Repeat this until you have created your BCOs, VCOs, etc.
  3. Open the app delegate .m file in the Classes group and map commands to your new Control Objects ( see the Objective-C Extension example for code you can copy and paste).
  4. Create JavaScript functions to trigger your control stacks (see the Objective-C Extension main.js file for example code you can copy and paste).

To those of you who are creating custom behavior.  If the behavior is generic enough to be used by others please submit it for review and let’s get it in the base framework.

Lee

Advertisement

May 28, 2010

Server Side PHP for Image Upload Feature

Posted in iPhone development, PHP, Uncategorized tagged , , , , , , , , , , at 5:58 am by tetontech

I have received a request for sample PHP source code that could receive and save the uploaded file.  You MUST understand that this is NOT code I would put into production.  I always use QuickConnectPHP on the server side since it allows me to apply Validation Control Functions, Business Control Functions, View Control Functions, and Error Control Functions in PHP.  This dramatically increases the security of my applications.

This being understood, the code you see below should be viewed as an example of how to get the POST key/value pairs associated with an upload of an image from the QCiPhone implementation.  Additionally it shows you how to store the uploaded image file in a directory on the PHP server machine called upload.

The file name length check is one security feature.  Some machines are unable to handle file names longer than 254 characters.  If a hacker sent you a file name that was longer than that it can cause you not to be able to delete the file.  If the file they uploaded had PHP in it they could call it and execute it.  You would not be able to delete the file because of the overly long file name.

Another security issue is that you should store the files in a directory located such that the PHP engine can not interpret any file uploaded as PHP.  This example does NOT follow this advice since there is no way for me to know the structure of your PHP server.

<?php

//echo ‘post values’;

if($_POST[“uname”] != “someUser” || $_POST[“pword”] != “somePass”){

echo “invalid user name or password”;

}

else if (($_FILES[“fileContents”][“type”] == “image/png”)

|| ($_FILES[“fileContents”][“type”] == “video/mp4”)){

if ($_FILES[“fileContents”][“error”] > 0)

{

echo “Return Code: “ . $_FILES[“fileContents”][“error”] . “<br />”;

}

else

{

if (file_exists(“upload/” . $_FILES[“fileContents”][“name”])){

echo $_FILES[“fileContents”][“name”] . ” already exists. “;

}

else if(strlen($_FILES[“fileContents”][“name”]) >= 255){

echo “The file name you have chosen is too long.”;

}

else{

move_uploaded_file($_FILES[“fileContents”][“tmp_name”],

“upload/” . $_FILES[“fileContents”][“name”]);

echo “File stored in: “ . “upload/” . $_FILES[“fileContents”][“name”];

}

}

}

else{

echo “Invalid file<br/>”;

}

?>

May 23, 2010

Image Library Access Added to QuickConnect

Posted in iPhone development, Uncategorized tagged , , , , , , , at 5:12 am by tetontech

1.6 beta 16 has been uploaded.  You can now display the image library picker from JavaScript and let your user select an Image.  If you want to do image uploading combine this new functionality with the file upload feature and you are ready to go.  The new UploadImage example shows you how.

In addition, for the iPhone, beta 16 has added :

  • support for renaming the uploaded file
  • and complete support for UTF8 characters in debug messages.

Testing work is ongoing for the in app purchase behavior.  That should be completed next week.

May 15, 2010

Blackberry Template Added to QuickConnectFamily

Posted in Blackberry development tagged , , , , , , at 10:38 pm by tetontech

A template for development of Blackberry hybrid applications has been added to the QuickConnectFamily 1.6 beta 15.  Instructions on how to install the Blackberry SDK, use the template, compile, and run your app in the Blackberry simulator can be found on the wiki.

Developing for Blackberry requires large amounts of RAM.  It is suggested that you have 4 and preferably 8 Gig.

May 13, 2010

File Upload Feature Added to QuickConnect

Posted in iPhone development, Uncategorized tagged , , , , , , , , , , at 3:30 pm by tetontech

In response to a long time request I have added a file upload feature to QuickConnect.  It works for the iPhone/touch/iPad combination.

Now you can upload any file that you have recorded, or any other file in your applications writable directory, to a web server of your choice.  I have also included an example in the iPhone example directory of the download.

Here is the API for the Javascript method to call:

uploadFile(fileName, URL, userName, password, optionalMimeType, optionalURLArgumentsMap)

fileName – the name of the file to upload.  Example: myAudio.caf.  REQUIRED

URL – the URL of the server to which the file is to be sent.  REQUIRED

userName, password – the credentials, declared on the server, for allowing upload.  OPTIONAL but you should never allow uploads to your server without checking credentials.

optionalMimeType – the mime type for any file you want to upload.  OPTIONAL you only need this parameter if you are uploading a file who’s name does NOT end in .caf, .png, .mp4

optionalURLArgumentsMap – a set of key-value pairs to be sent with the upload request.  These represent the portion of the URL after the ?.  For example http://<some url>>?color=blue&size=15

May 5, 2010

DHML, Firefox Strangeness

Posted in Uncategorized tagged , , , , , , at 6:30 pm by tetontech

Among other things that I’ve been working on for the QuickConnectFamily 1.6 beta I have been creating the new QuickConnectFamily web site.  The site, as it is designed now, accumulates information from this blog, the wiki, and the Google group.

One of the items I wanted to accumulate dynamically is the roadmap for each of the supported platforms.  I wanted to do this in such a way that when a change to the roadmap was made in the wiki that it would automatically be seen in the new web site.

To do this I decided to apply DHTML techniques as I have in the past.  So what I did was to make an AJAX call to the Web App Server running on the site host.  The PHP code there made a call to the wiki page and returned the code for the page to the browser.  The browser then created a temporary div and inserted the HTML string it got back.

I have done this before with no issues but this time the link tags in the head became active.  This caused my pages CSS to be modified when run inside of Firefox.  The solution was to remove the link nodes.  Then all was displayed as it should be.

May 3, 2010

QuickConnect beta 13 revision 2

Posted in iPhone development, Uncategorized tagged at 1:59 pm by tetontech

It appears that the iPad template was not included in beta 13 as I had intended.  Also some users had issues with building the QCLib support library.  I have fixed both of these issues in beta 13 rev 2.

It should be noted that the in app purchase feature is still untested due to issues I’m having with iTunes Connect.  Apple is still working on the issue.  Any help in debugging this feature would be helpful so we can get it out and working as soon as possible.

Here is a code modification to make in the com.js file for testing in-app purchase.  Replace the existing checkCanPurchase function with the following.

function checkCanPurchase(){

var dataArray = new Array();

var callBackParameters = generatePassThroughParameters();

dataArray.push(callBackParameters);

makeCall(“canMakePaymentsCheck”,JSON.stringify(dataArray));

}

%d bloggers like this: