Archives for

Simple async file access using Windows 8, part 2

In the previous article I presented a helper library for reading and writing to the file system using the new Windows Runtime asynchronous file APIs.

One downside of the code I presented is that the actual reading and writing was still happening on the main UI thread. While this may not be a problem in a simple application, it is undesirable for complex documents.

The challenge is that we still need to be on the UI thread when we collect the data we want to save, but the writing itself could be on a background thread.

In this article I will cover a way to extend the API I presented previously, to allowing reading and writing via a background thread.

Read More

Simple async file access using Windows 8

This article refers to pre-release software. Some or all of what is presented could change between now and release.

This week at the Build Windows conference, Microsoft announced Windows 8 and introduced the new Windows Runtime APIs for the developers.

As a C# developer, one of the defining features of the Runtime is that a lot of the .NET Framework is “gone”, or moved to new namespaces. Nowhere is this more true than in System.IO, which is now fairly barren. The reason is that most of the file I/O APIs in the Windows Runtime are designed to be asynchronous, and as these new APIs are in the Runtime, they’ve moved into the Windows.* namespace.

As it turns out, reading and writing files using the new asynchronous APIs is a little convoluted. OK, its a lot convoluted, but I’ve put together some code that should simplify it for you, while also taking you through the steps involved.

Read More

My Daily submitted to the App Store

I have just submitted a new app to the App Store called My Daily.

The purpose of the My Daily is to simplify entry into the Calendar for situations where you are given a daily schedule of back-to-back tasks.

My Daily main screen

The app allows you to set a daily start time. When you add an event, you pick the name from a list of names you define. Each name can be associated with a color swatch, allowing you to classify similar names with the same color.

Your first event will start at the daily start time, and subsequent events will start right after the previous event. Now you can add an event to your calendar by simply picking a name and clicking Save!

My Daily edit screen

The neat thing is: if you delete an event, change its duration, or re-order the event, the start/end times are automatically updated. And the whole time, all of your changes are being synced into your iPhone’s Calendar, so you get all the same automatic alerts you expect.

And because My Daily syncs to your iPhone’s Calendar, each event can also have a reminder alert a few minutes before it is due to start. Reminders are also picked with a single click (no more navigating between screens).

* Update – My Daily is now live in the App Store.

iPad HD… let it be true

Strictly one from the rumor mill, but I’m pretty pumped about the rumors of an upcoming iPad HD (or whatever they decide to call it).

The short version is: a pro-sumer iPad intended for users of Apple’s pro-sumer apps such as Final Cut Pro. The device is rumored to have a 2048×1536 Retina display (around 300dpi). I’d also expect to see 128GB of storage and LTE to store and move those big media files around.

Less sure is what it will look like. There were some rumors a few weeks ago that Apple was testing a black powder coat treatment for the MacBook Air, but then an alleged Apple engineer claimed it had been abandoned because of fingerprints. I guess I’m expecting the case to be black or dark grey to match the look of the pro-sumer apps, and to distinguish it from the regular (and much cheaper!) iPad 2. Apple even has an agreement to use LiquidMetal, which is darker than the aluminum on the “2″.

In other news, there was a rumor that Apple was looking to add a second manufacturer for the iPad alongside Foxconn, but this was quickly rebuffed with a statement to the effect of “Foxconn is still the exclusive manufacturer”. But what if what is happening is: Foxconn will start building the iPad HD at their Chengdu plant, while the existing Shenzen plant continues to build the iPad. So in that regard, the original rumor and the rebuff are both true.

Whatever it turns out to be, I know I’m going to want one.

Sharing a Mac screen via Live Meeting

For those of you using a Mac in a largely Windows-based company, you may have times where you need to present content on your Mac from a PC running Live Meeting.

One fairly simple way to achieve this is by enabling Screen Sharing via System Preferences:

Once Screen Sharing is enabled, you can run UltraVNC on your PC to connect to your Mac using the URL shown in the Screen Sharing window.

Now in Live Meeting, share your Desktop (or just share the UltraVNC window).

Note: it is also possible to do this from inside a virtual machine on your Mac using VMWare Fusion or Parallels. However, the Mac Screen Sharing feature will share all of your screens, including the one where VMWare is running, meaning once you get VNC running in your virtual machine, you will want to use Cmd-H to immediately hide the virtual machine or get an infinitely recursing window tunnel!

Alternatively, Simon Guest informs me that RealVNC Server for the Mac will let you specify which monitor is shared. You would want to use RealVNC Server in place of Mac Screen Sharing if you are going to try it this way. (You’ll get errors trying to use both on the same Mac as they would both be trying to use the same ports.

If you are doing this using a separate PC talking to your Mac, don’t forget you are simply sharing your Mac screen, so the Mac keyboard and mouse can be used to control the action, making it more responsive than trying to use the PC keyboard and mouse via VNC.

You can download UltraVNC here: http://www.ultravnc.com/

Location-aware mobile web testing in iOS5

One cool addition to Xcode 4.2 with iOS5 is the ability to test your location-aware application directly from inside Xcode through the same Edit Scheme screen you use to set up Environment Variables and command line arguments.

One current limitation is you can’t directly leverage this to test your mobile web sites, although the Simulator does provide some boilerplate locations built in.

A workaround is to create a small Universal iOS app in Xcode, and tell it to load your mobile web site’s URL during applicationDidFinishLaunching.

- (BOOL)application:(UIApplication *)application
        didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    NSURL* url = [NSURL URLWithString:@"http://www.google.com/"];
    [application openURL:url];
 
    exit(0); // remove this to keep the debugger running!
 
    return YES;
}

I can now use Edit Scheme to set my location, or create multiple schemes each for a different location. When I run this application, the GPS will be initialized with my prescribed location, then Safari will be invoked to open the URL I provided.

(Notice how in the second image Google is providing the “See Places Near” using the London location I provided).

By removing the exit(0) statement, it should even be possible to leverage the GPS automation capabilities provided by the new version of Instruments to automate the location over time and have Safari pick that up, though I haven’t had time to test this.

ContentBundle demo updated

I’ve updated the demo app for the ContentBundle application. The application now presents a UIWebView showing HTML from the ZIP file.

An Update button causes the app to reach out to the server and reload the page.

The screenshots below show the app before and after updating:

Read More

We love you, Grand Rapids, MI

What a great rebuttal to being put on Newsweek’s list of “dying cities”…

window.external.Notify in iOS UIWebView

I recently ran into an interesting problem working on putting support for the Windows Azure Access Control Service (ACS) into the Windows Azure iOS Toolkit.

It turns out that once you’ve gone through all of the ACS authentication process, a security token is generated. You need this token to authenticate yourself against ACS-bound web sites. However the ACS web site passes the token to you by calling window.external.Notify()

window.external.Notify("security-token-here");

While window.external.Notify is supported in Internet Explorer on the desktop and also in Windows Phone, it is not supported in iOS. Worse, while the WebView control on the Mac can call your Objective C code from JavaScript, the iOS UIWebView does not support this.

Another mechanism was needed. Here is how I solved it.

Read More

Web updates of content in iOS apps

One common use for mobile apps is to expose a company’s repertoire of content.

Perhaps your app will present cooking recipes, or First Aid information for folks that hurt themselves hiking far from cell tower coverage.

One challenge often faced in these types of apps is how to keep the content up to date. Of course you could simply ship an update to your app, but your customers may get annoying having to update your app every few weeks.

A better way is to have a means to update the content as it changes. The code I am presenting here is designed to do just that.

Read More
Page 1 of 212»