* PhoneGap IPhone App Approval

Posted on June 13th, 2009 by Dave Johnson. Filed under mobile, phonegap.


The guys over at Rhomobile posted about IPhone App Store rejection issues the other day - I can only assume due to the recent problems that some users of PhoneGap have been having. Rhomobile and PhoneGap are similar in that they are frameworks that enable developers to build native mobile apps in a language they are familiar with, Ruby and JavaScript respectively.

I think that they are pretty much spot on in terms of their interpretation of the App Store rule 3.2.2 that states:

An Application may not itself install or launch other executable code by any means, including without limitation through the use of a plug-in architecture, calling other frameworks, other APIs or otherwise. No interpreted code may be downloaded and used in an Application except for code that is interpreted and run by Apple’s Published APIs and built-in interpreter(s).

The two key points in this App Store rule are where it says an app “may not itself install or launch other executable code by any means” and this is exactly what users of PhoneGap are doing if their apps are downloading JavaScript over the network rather than including it in the application www folder. By downloading JavaScript over the network at runtime the application is downloading and running interpreted code that Apple has not control over during their app approval process.

So if any of you PhoneGap developers are worried about Apple rejecting your app just make sure that you don’t download any JavaScript at runtime and instead include it in the application. Having said that, also make sure that you apps don’t look like you just took a shit and emailed it to Apple :)

That is just my thoughts on the issue, whether or not that is the *real* reason that Apple is rejecting PhoneGap apps we may never know but that is certainly one reason that they would do it I think. It could just be because they feel like it

Tags: , , , .



* Where 2.0 Slides

Posted on June 7th, 2009 by Dave Johnson. Filed under Conference, mobile.


Here are my slides from my workshop at the recent O’Reilly Where 2.0 conference down in San Jose.

Tags: , , , , .



* Where 2.0 Workshop

Posted on May 17th, 2009 by Dave Johnson. Filed under Conference, mobile.


I am going to be running a workshop down at the O’Reilly Where 2.0 conference on Tuesday called Giving Your Mobile Apps a Sense of Place.

I am going to cover Geo related features and issues of IPhone 2.2.1, Android 1.5 (aka Cupcake), RIM OS 4.7, and, most importantly, PhoneGap. I will be sure to post the slides once I am done them as well as put all the sample projects up on my GitHub.

If you are in San Jose Monday night then you will probably find me in the bar, whether I am done my slides or not!

Tags: , , , , , .



* Windows Compilation Problems

Posted on May 5th, 2009 by Dave Johnson. Filed under Uncategorized.


If you are trying to use midl.exe but have not before or do not have Visual Studio installed, you may come across a few different errors.

One such error that I had was the following:

“command line error MIDL1001 : cannot open input file oaidl.idl”

So I figured out that I had to get the Windows Platform SDK installed but had a hard time finding it. There is a helpful page on MSDN I found that helps you to choose the right SDK. The link never came up in my search results for some reason and I was only able to find it linked from the Windows SDK blog.

I figured that I would just add that to the PATH environment variable as you may expect to be the case but alas it was not. After a long while of trial and error (mostly error really) I found that you can specify certain paths to be included manually as a command line switch http://msdn.microsoft.com/en-us/library/aa367328(VS.85).aspx

Tags: , .



* JavaScript Pub Sub

Posted on April 28th, 2009 by Dave Johnson. Filed under JavaScript, Uncategorized.


I was talking to someone the other day about the observer pattern in JavaScript and I was reminded about this JavaScript method that is part of Complete UI.

nitobi.Event.prototype.subscribeOnce = function(method, context) {
  var guid = null;
  var _this = this;
  var func1 = function() {
    method.apply(context || null, arguments);
    _this.unSubscribe(guid);
  }
  guid = this.subscribe(func1);
  return guid;
}

subscribeOnce is a special sort of event subscription that rather than being being executed every time the event fires, the handler function is only executed once and then automatically unsubscribed from the event. It is obviously most useful for initialization stuff in JavaScript. There is some more info on JavaScript pub sub over on Ajaxian too.

Tags: , , , .



* Eclipse Plugin Q&A

Posted on March 25th, 2009 by Dave Johnson. Filed under Web, phonegap, programming.


If you are one of the unfortunate few that has decided to, for profit or insanity, write an Eclipse plugin here are a few of the questions that I had during my ordeal and the answer or closest thing to an answer that I can come up with.

Q: How should I get started with Eclipse plug-ins?

A: Read a book. I did not do this and really regret it now I think. There are few different ones available that I assume explain all the intricacies. The Google can only help so much. Having said that, the approach that I took was to look at the code of another Eclipse plug-in and borrow from that :) Some of the better links I put up on Delicious.

Q: How do I make my plugin show up in the new project list?

A: This one seems like it should be easy to find out how to do but it actually wasn’t that easy. So it is pretty easy to get started using one of the samples in Eclipse like the file editor sample that creates a “New file” wizard. While that wizard does not launch from the “New project” menu it can be augmented to be a project creation wizard pretty easily. The important bit is setting project=”true” on your wizard in the plugin.xml file for the Eclipse newWizards extension.

<extension point="org.eclipse.ui.newWizards">
  <wizard
    project="true" ... />

Q: Now that I have a new project wizard how do I know that a project was created using that wizard or is that type of project so that you can create debug or run configurations accordingly?

A: This is where project “Natures” come in. A project can have different natures associated with it to support different functionality in Eclipse. You need to create a class that implements the IProjectNature interface.

public class PhoneGapProjectNature implements IProjectNature

You can reference that project Nature from the plugin.xml through the org.eclipse.core.resources.natures extension point.

<extension id="com.phonegap.phonegapnature" name="PhoneGap Nature"
  point="org.eclipse.core.resources.natures">
  <runtime>
    <run class="com.phonegap.project.PhoneGapProjectNature"/>
  </runtime>
  <builder id="com.phonegap.phonegapbuilder"></builder>
</extension>

This enables one to connect certain builders to a nature - in the case of PhoneGap we don’t actually use a builder since it is just HTML and JavaScript but we do set and read the nature from the plug-in code.

To set the nature of the project when it is created in the new project wizard we can set the project nature(s) on the project description like this:

IWorkspace workspace = ResourcesPlugin.getWorkspace();
final IProjectDescription description =
  workspace.newProjectDescription(newProjectHandle.getName());
description.setNatureIds(new String[] { PhoneGapPlugin.PHONEGAP_NATURE_ID });

In the case of PhoneGap, we use this project nature information in the properties of the Run and Debug configurations such that a developer can create configurations and choose the project that the configuration should launch when they click Run or Debug. In the configuration we iterate over the projects collection of the workspace and check if each project has the PhoneGap nature, if it does we add it to a combo box.

boolean bb = projects[i].hasNature(PhoneGapPlugin.PHONEGAP_NATURE_ID);
if (projects[i].hasNature(PhoneGapPlugin.PHONEGAP_NATURE_ID)) {
  projectCombo.add(projects[i].getName());
}

Q: How do I store preferences and configuration default values?

A: In your AddLaunch method of the LaunchAdder, which you call from the createProject method of your NewProjecWizard class like this:

SimulatorLaunchAdder.addSimulatorLaunch(projectHandle.getName(),
  projectHandle.getName(), "");

you will need have some code like this:

ILaunchConfigurationWorkingCopy wc = DebugPlugin.getDefault()
.getLaunchManager().getLaunchConfigurationType(
  "com.phonegap.debug.SimulatorLaunchConfigurationType")
.newInstance(null, DebugPlugin.getDefault()
.getLaunchManager().generateUniqueLaunchConfigurationNameFrom(projectName));
wc.setAttribute("KEY", "value");
final ILaunchConfiguration config = wc.doSave();

Q: How do I access resources like files to populate a new project with?

A: Put any files that you will want to copy to a project into a namespace like com.phonegap.resources then you can access it like this:

String rootContent = StreamUtils.readContent(
this.getClass().getResourceAsStream("/com/phonegap/resources/root.html"), null
);

Where StreamUtils is just a wrapper for doing the stream reading.

Q: I am getting a “class not found” error when I debug what should I do?

A: Get Eclipse 3.4 if you don’t already have it.

Q: I want to support the debug / run menus but to do that I need org.eclipse.debug.ui/core references - where do I find those?

A: Add them to the dependcies list in the plugin.xml visual editor. First add core then the ui one will be available.

That’s about all I can muster for the moment but will try to put up some more tips later!

Tags: , , , , , .



* PhoneGap Project

Posted on March 24th, 2009 by Dave Johnson. Filed under phonegap, programming.


So I started putting together some wireframes for my first real PhoneGap project tonight. I have become sort of bored playing with BlackBerry and Android native development and figured it was about time to actually build something on top of the platform. The only problem I am having is that I can’t currently do offline apps on BlackBerry so am really looking forward to the next version of the RIM OS as I hear they may have fixed some of my gripes.

In the mean time I have been working on the PhoneGap simulator and Eclipse plugin as well that should be ready very soon - I actually have the simulator launching from my Eclipse PhoneGap project which is pretty cool.

Tags: , , .



* Global Recession and the Web

Posted on March 17th, 2009 by Dave Johnson. Filed under Web.


Doug Crockford says:

“So now that under-regulated Free Market Capitalism and Globalization are plunging the whole wide world into a deep depression, the central question has to be: How will this affect web developers?

That is obviously the first thing that comes to my mind! Hilarious.

Tags: , , .



* On Dell and Social Media

Posted on March 14th, 2009 by Dave Johnson. Filed under Uncategorized.


Yes Twitter can be good for your company. There are of course soon to be urban legends about companies like Dell that made over $1 million during the recent holiday season by using Twitter but what about the sales they lost because of Twitter? I would wager that it could easily be north of $1 million.

Just a quick search on Twitter reveals tweets like this one:

dell laptop locked up two or three times in the last half hour, only button that responded was the powerbutton. Maybe I should send it back

While there may be some good coming from Twitter through marketing opportunities, there is clearly some bad along with that. I think that this is the double edge sword of social media that one must be careful with.

Then there are companies like Mozilla and VMWare or, more specifically, products like Firefox, VMWare Fusion and Harvest that have teams of people constantly watching Twitter and actually responding to your tweets. One time when I was having some VMWare problems @vmwarefusion responded to me almost immediately:

@davejohnson It’s easy enough to find the real culprit. Go to Activity Monitor, and click “Show All Processes.”

not that it ultimately helped much but it’s the thought that counts. To properly take advantage of social media tools like Twitter and get the most out of them this is an important step; it’s about the community engagement rather than leaving them to their own devices. Even though Firefox still crashes on an almost daily basis it does make me feel better when someone reaches out to help. Companies like Dell should be doing the same if they want to see a net benefit from tools like Twitter.

This type of involvement on Twitter really makes sense and it makes the tool more useful even just socially. However, I can see a future in which Twitter could be taken over by people using it more for business relationships using their Twitter network to mine data rather be social. It would get pretty annoying if your Twitter friends starting asking you questions on a daily basis about this product or that, or if companies engage you in a Twitter conversation as a sales tool.

So companies should get out there and engage but don’t be phony about it and be careful not to inundate people with messages.

And, for the record, I am very happy with Dell :)

Tags: , , , , .



* Complete UI Goes Open Source

Posted on March 10th, 2009 by Dave Johnson. Filed under Uncategorized, completeui.


I spent a large part of the past couple of years working on Complete UI - an Ajax user interface framework - and it has officially been released as an open source project under the GPL V3 License!

All of the Javascript as well as the server code for Classic ASP, PHP and Cold Fusion are open for all to see and use in their applications. All of this code and build tools are publicly available on Google Code and GitHub.

More details from the press release:

Why the change? We strongly believe open sourcing Complete UI will benefit our developer ecosystem in several ways:

  • You’ll be able to see all the source code.
  • The code base will get better faster with input from you and the rest of the community.
  • You will benefit from other developers’ bug fixes and enhancements
  • Better security–no more security by obscurity.
  • It’s FREE if you don’t want to purchase support or special server libraries.

If you’re currently a Complete UI customer, you automatically get upgraded to the following:

  • If you bought a single developer Complete UI license, you will be upgraded to Nitobi’s Basic Support Package plus a commercial license, which means you can include Complete UI in enterprise development projects.
  • If you bought an enterprise license, you will be automatically upgraded to our Advanced Support Package, plus a commercial license.
  • If you bought Java, .NET or Dreamweaver versions of Complete UI, it’s business as usual. You have your full license, plus you get a commercial license to the JavaScript and the appropriate support package.

This is our first foray into open source and so we’re hoping you’ll enlighten us with feedback, advice and suggestions. If you’re not sure how this change affects you, we want to answer your questions.

This is pretty exciting since it means that many more developers will be able to use Complete UI and hopefully it will grow and get better through the involvement of the community.

Tags: , , , , , .