Mulitplatform web apps with PhoneGap

In my last post I started looking into writing mobile web apps with HTML5. While I was hunting around I found PhoneGap which allows you to create an app using HTML, CSS, and JavaScript but rather than hosting those files as a website it wraps them up into a platform specific app that runs on phone locally. They support iPhone, Android, Windows Phone, Blackberry, WebOS, and Symbian so it seems you can develop your app once and install it onto any of these decides. It also extends what you can do with HTML5 by adding support for the camera and notifications.

They also have a cloud based build service called PhoneGap Build which can take your HTML, CSS, and JavaScript and produce an app for each platform without you having to have any platform specific SDKs installed. According to the website, it doesn’t quite remove the need for a Mac to do an iOS build. You still need one to create the signing certificate and provisioning file. Buying a computer to produce two files is hard to justify. Luckily, someone has figured out how to do it on a Windows machine. So I’m all set right?

I’m going to have to ramp up my HTML knowledge. I’ve only ever played around with it. I’m going to start with a simple HTML5 website. Then I’ll look at porting it into PhoneGap to make a downloadable app for the iPhone, Android, and Windows Phone.

I think a good place to start would be to mimic an existing app so I’m going to write a calculator. It’s not very exciting but there’s not too much logic so the JavaScript won’t get out of control and it should be able to respond to the accelerometer to change between portrait and landscape orientations as I rotate the phone. The landscape orientation will be a scientific calculator and portrait will be a standard one like the iPhone calculator does.

Posted in Uncategorized | Tagged , , | Leave a comment

Launching into mobile web apps with HTML5

I’ve been curious about writing an iPhone app lately. I’ve had a couple of simple ideas but nothing I think would sell or that wasn’t already done better someone else.

One of the limiting factors to getting started is that I don’t know Objective-C. Not that I couldn’t learn but I also lack a Mac which is necessary. I’ve spoken to people about MonoTouch which sounds good because it’s based on .NET which is my platform of choice but even that is $399 USD per year.

Because of these limitations, I’m going to explore HTML5 with the idea of creating a web app. A web app is really just a web site that uses a combination of HTML, CSS, and JavaScript. It runs in the browser but with the address bar and status bar hidden so it looks like a normal app. They can make use of local storage and can run offline. They can also have an icon on the home screen making them pretty indistinguishable from regular apps. This could be the way into mobile development I’ve been looking for.

Continue reading

Posted in Uncategorized | Tagged , | 2 Comments

Why you should never use MSBuild

I’ve had one of those weeks. You know the ones. You spend entire days tracking down one stupid little problem and when you fix it you just dump straight up against the next problem. After spending hours searching for solutions to problems you’re reduced to guessing. Changing a parameter value here, and xml tag there and hope for the best. This is when you know you’re going to be doing this for a very long time. Admittedly, many of the problems I’ve had this week with the building and deploying of my current project haven’t been the fault of MSBuild but I did learn one very valuable thing about MSBuild this week that I’ll keep locked into my memory for a very long time – never, ever use MSBuild again.

Continue reading

Posted in Uncategorized | Leave a comment

iPhone tip: Emailing multiple photos

I’ve had an iPhone for about 6 months or so now and it’s always bothered me that I couldn’t attach multiple photos to an email. From the email app there is no obvious way to attach files of any kind. From the Photos app you can browse to a photo, open the menu and select Email Photo but that creates an email with just the selected photo attached. I have always sent one email for each photo.

Just the other day, though, I had a bit of a face palm. You can simply copy & paste any number of photos into a single email message as you want. Open the Photos app, go to a photo you want to send, hold your finger down on it until Copy pops up. Tap Copy. Switch to the email app (start a new message) and paste the photo into the body of the message. You can keep switching between Photos and Email by double tapping the home key. Copy & paste as many photos into a single message as you like.

Posted in Uncategorized | Leave a comment

Automatically build Silverlight projects when publishing the web project

In a previous post I talked about digitally signing Silverlight Xap files. I came across a problem while deploying the solution which is the topic for this post. I was deploying the solution from Visual Studio 2010 by right clicking on the web project and selecting Publish from he menu. The problem was that when I made a change to the Silverlight project and republished, the change didn’t come through.

Solution Explorer showing Xap filePublishing a web project from Visual Studio builds the web site and deploys the relevant files. The files can be copied to a local folder, sent to an FTP server, or deployed to the web server via HTTP. When it’s a web project for a Silverlight application, some of this files are Xap files that live in the ClientBin folder.

The problem I had was that I assumed that publishing the web project would cause the Silverlight project be rebuilt. The VS status bar told me it was building but it turns out that publishing a web site only causes that project and its dependencies to be built. It turns out that the web project doesn’t reference the Silverlight project. This makes sense actually because the web project is acting only as a container for the Silverlight app.

Project menu with Dependencies selectedOne solution is to always build the Silverlight project before publishing the web project. Another solution is to get Visual Studio to build the Silverlight project automatically when ever the web project is built. This can be done by telling Visual Studio that the Silverlight project is a dependency of the web project. This is done by right clicking on the web project and selecting Project Dependencies. This will open a dialog that allows you to add the Silverlight project as a dependency. This doesn’t create a reference. It only tells the compiler the order to build the projects. This way, when ever you publish the web project the the Silverlight project will be built too.

Posted in Uncategorized | Leave a comment

Signing a Xap file with VS 2010

I’ve been looking around the web today trying to find out how to digitally sign a Silverlight Xap file. Signing is necessary for so an out of browser application can auto download newer versions of the Xap file. I’ve found an number of posts including this stackoverflow question and this post from John Papa that detail how to do it by using a number of command-line tools like certutil, makecert, pvk2pfx, and signtool. I thought there must be an easier way so I went poking around in the Project Properties page. There I found a simpler solution.

Continue reading

Posted in Uncategorized | 6 Comments

Castle DynamicProxy

Castle DynamicProxy can be used to extend any .NET object without making changes to its code. It allows you to intercept any call to any member so you can extend it. This is an introductory post to get you started. There is a more detailed tutorial on Krzysztof Koźmic’s blog.

According to the DynamicProxy article on the CastleProject website –

Proxy objects can assist in building a flexible application architecture because it allows functionality to be transparently added to code without modifying it. For example, a class could be proxied to add logging or security checking without making the code aware this functionality has been added.

I’m going to work through a logging example to demonstrate the sort of power this tool provides. DymanicProxy is part of the Castle Core project and can be downloaded here. I’m using version 2.5.2.

Continue reading

Posted in Uncategorized | 1 Comment