Author: <span class="vcard">Chris Tybur</span>

This is part 1 in a series of posts about creating a web-based replacement for the Firefox Home iOS app.

I installed the Firefox Home iOS app shortly after I got an iPhone 4S in late 2011. It provided access to my 1500+ bookmarks from my phone, and it has a nice feature where it can be set to use Safari as the browser rather than a UIWebView. However, that version, and still the current one as of this writing, has some sort of bug which is horribly annoying.

Occasionally I would add a new bookmark from my desktop, Firefox Home would refresh its data, and then its ordering of bookmarks would get messed up. It was most prevalent in the Bookmark Toolbar directory, in which I have subdirectories and individual bookmarks. I have all of the subdirs positioned at the far left end of the toolbar in Firefox itself, and they are shown at the top of the main UI in Firefox Home. But when this problem occurred, they would get shuffled around in the UI with no apparent rhyme or reason. It would even happen if I didn’t explicitly add something to the toolbar directory. I haven’t been able to figure out the exact circumstances that cause it, but it has happened enough that I decided to create a replacement, as a personal project.

Unfortunately I don’t own a Mac or know Objective-C, so I decided to create a mobile web app using ASP.NET, C# and jQuery Mobile, and to document the process. My first goal was to successfully get data out of my own Sync account. Sadly, the Sync API is not as well documented as it could be. What documentation does exists is fairly spread out, and there aren’t any canonical examples of how to write clients for it. Plus it has a complex security design; a specific series of decryption steps are needed to read data from a Sync account.

Through some Google searching I stumbled upon a sample program a guy had written in Python that did all the proper encryption stuff and was able to retrieve bookmarks. I managed to duplicate the process in C# after some trial and error, to the point where I could see decrypted data from my own account. It was then that I decided, on a lark really, to search the web to see if anybody had written any .NET wrappers for the Sync API. And wouldn’t you know, Pieter De Rycke had. In fact, he had written a complete Windows Phone version of Firefox Home. So I decided that reinventing the wheel wasn’t necessary, and I used the class in his project that wrapped the essential calls to the Sync API (thanks Pieter).

My goal for the front end of my app was to mimic the Firefox Home UI as much as possible. Initially I figured I would do most of the processing on the server then simply use JQM to make the UI mobile-friendly. But there was more to it than that.

Coding

In 2004 I was working at a job which involved projects that made heavy use of VBA; from an Access application that would literally build an entire PowerPoint presentation from scratch, to Excel workbooks that would do all sorts of things that Excel was probably never designed to do. None of them would have been possible without the very thorough and extensive COM-based API that Microsoft makes available for all its Office applications.

The one place where the Office API falls down though is in web applications. Being single threaded, the code does not play nice in that kind of environment, and it is not officially supported by Microsoft (though it is not strictly impossible to use it that way). Recently I needed to have an ASP.NET web application of mine open an Excel template and add some data. I figured I would need to do something like build a separate web service to handle the Excel processing, using the same API I know and sort of love. Then I discovered Microsoft had published an SDK specifically for interacting with the XML-based default file formats introduced in Office 2007. And to my delight, they provided a managed DLL that would integrate nicely with ASP.NET. Life was good.

Or so I thought. Turns out the new API is not as nice as the COM-based original. The main issue I had is it takes a very XML-centric approach to doing things, which made it hard to implement the specific Excel things I wanted, like cell formatting, copying rows, etc. The old API was much more closely aligned with the individual Office apps, making it fairly straightforward to utilize whatever document features you wanted via code. Fortunately I wasn’t the first to feel like the new way was harder than it had to be. I recently came across ClosedXML, which is a .NET wrapper around the new API that makes doing Excel-specific things so much easier. Many thanks to MDeLeon for his excellent creation.

Musing

There are a million to-do list applications out there, both rich client and web-based. I never found one that did everything I wanted it to, which led me to consider writing my own. But then I discovered Todoist and now life is so very good.

Todoist is a web app that gives you a standard list of projects and tasks. Projects can be color-coded, and tasks can have a priority, labels, notes, a due date, etc. Both can be reordered manually or in the case of tasks by priority. You can further query by label or due date, and move tasks easily between projects. The killer feature for me was you can create subtasks below a main task, which show as indented and can be marked as completed individually while keeping the main task active.

They decided to use very a Gmail-like approach to the user interface. Clicking on one of the gear icons next to each project and task activates a context menu similar to the ones in Gmail. It’s fairly minimalistic in the overall layout of the page, making it feel very snappy. Plus it has a bunch of keyboard shortcuts and there is not only an iOS app but a Firefox extension for it as well.

They offer a base set of features for free, or you can get the premium version for $3 a month or $24 for a year, which gives you the advanced query capabilities and some other stuff. It was well worth it.

Musing

Recently I was trolling through my collection of lesser-read developer blogs when I came across this September, 2010 post from James Senior on jQuery templates, and from there to this one by Stephen Walther. The big news at the time was that Microsoft was going to start contributing code to the jQuery project.

One their first projects was a templating plugin. The idea is you can embed a chunk of markup in a page that contains placeholders for data. Then you call the plugin, pass it some data, and it merges everything into the template, producing markup that is ready for rendering. It looked like just the kind of thing I’d want to start using in production, today. Turns out that would have been a bad idea.

After I downloaded the code and some samples, I surfed around a bit more on the subject and learned that they are no longer actively maintaining the jQuery template plugin. They have decided to go in a new direction. Which is fine, but woe are the people who decided to invest heavily in the plugin during those first few months and are now stuck with a dead-end tool.

The rate of change of web technologies and tools is getting scary fast, and it makes me subconsciously shy away from the latest new stuff because it could all be replaced in 6 months. That might not be the best approach for a professional developer to take, but neither is having such instability in the LOB applications you have to write and maintain.

Musing

Over the last couple of years there’s been a lot of debate over how web authentication should work. On the one hand you have traditional web sites where you have to register before you can use them, which involve selecting a user name and password, and then you have recent open standards for authentication like OpenID that allow you to authenticate using a common, predefined set of credentials.

The OpenID approach never really excited me like some others. I have never had a problem with multiple web site accounts, since I have a scheme for selecting user names and passwords that seems to work fairly well. The problem is for some sites it’s not feasible to outsource the authentication to a third party provider. Things like the site for managing your retirement account, or your bank’s web site. Unfortunately the biggest issue I keep seeing with these types of sites is most of them have very strange, very bad password requirements.

Case in point: forcing you to select a password that is no more than 8 characters, or cannot contain non-alphanumerics. That’s just insane. The best way to create a strong password is to make it long and include a variety of characters types (letters, numbers, symbols, etc). I find it hard to believe these institutions are so strapped for space on their database server/mainframe that they can’t afford a few more characters per password. Likewise, what modern RDBMS doesn’t support the standard non-alphas that people tend to use?

It boggles the mind.

Musing

I’ve been a fan of Google since 1999 or so, back when nobody knew who they were. I loved the simplicity of their site and how well their search techniques worked. And while they are still my go-to search engine, they recently added a feature that can only be described as horrible. I’m talking ‘I completely hate this, do I need to switch to Blekko now?’ kind of horrible.

I’m talking about instant preview, the snapshot of a given search result that pops up when you hover the mouse over it, or click the magnifying glass next to it. I didn’t mind the instant search feature they rolled out earlier this year. I used it for a couple of weeks until the constant screen updates as I edited the search box got annoying. And then I simply turned it off. For instant preview it’s not so simple. Oh you can sort of turn it off by closing the popup box, but as soon as you (inadvertently) click the screen near a search result, the popup returns.

I did some cursory searching and lots of people don’t like this feature, and they all wanted to know how to turn it off permanently. Google apparently hasn’t given users a clear way to do that, which makes me wonder what the heck is going on over there.

But there is hope if you are a Firefox user and have AdBlock Plus installed. You can add these three filters to stop instant preview for good:

google.com##.vspi
google.com##.vspib
google.com###vspb

They are working well so far. I shudder to think what new stuff is in the works.

Musing

I recently had to modify a Basic MSI installer created with InstallShield so it behaved differently if a certain value was passed in via the command line. That part was easy. What I needed to do next was figure out how to alter the UI if that value was present, specifically to hide certain controls on a custom dialog.

You would think such a thing would be common and therefore it would be easy to deduce how to do it in InstallShield. Well, yes and no. After some web searching that didn’t get me very far, I was browsing around the Dialogs view in InstallShield 2010 and noticed that in the Behavior section for my custom dialog were three tabs at the bottom of the screen. They were labeled Events, Subscriptions, and Conditions, and though they didn’t *look* like tabs that is what they were. It turns out the Conditions tab was what I was after. From there I could specify the Hide action on my controls when a certain MSI property had a specific value. Not terribly intuitive, but I did find it eventually.

The trick will be remembering how I did it a year from now if I’m asked to modify the installer like that again.

Musing

I have written a number of WinForms applications over the years and while I think they’re pretty great, it’s hard to showcase them to the world at large. It occurred to me that it would be fantastic if there was a way to somehow run one of these programs within a web browser. The research I did lead me to WPF XAML browser applications, which it turns out are a nifty way of doing just that.

My first and so far only attempt was a simple hosting application that had a single page with an iframe. Inside that iframe I loaded the XBAP file that referred to my WinForm app. The only real tricky part was retrofitting the app to be able to mostly do its thing in a restricted environment. But still, I’m fairly impressed that Microsoft makes this possible. It seems I should pay closer attention to WPF and what it can do.

Coding

Jeff Atwood had a post on his blog the other day about the overall awesomeness of netbooks, and how they signal a new era of open computing. I’m not sure I agree.

I like the idea of an ultra-small laptop that is used primarily for running applications over the Internet. When I was shopping for a laptop last summer, I checked out the current crop of netbooks and seriously considered going in that direction. The problem is devices that size have limitations, which eventually made me go with a traditional, albeit small, laptop.

The biggest issues for me with netbooks are the too-small screen and the fact that they are still somewhat underpowered. I know the early EE, Dell, and Acer machines had screens around 10 inches. I guess Acer is now making one that’s slightly above 11, but that’s still tiny. I was afraid I’d be squinting to see details.

The Intel Atom seemed very cool, but I wanted the ability to run some heavyweight local applications if desired (think Visual Studio), and I worried the system would end up having sub-optimal performance. I hadn’t heard about Intel’s newest netbook CPUs, but dual-core certainly is an improvement. Still, for only a slightly larger form factor, I got a 2.6 GHz Core 2 Duo in my Dell Latitude.

As small as they are, they still aren’t as easy to take with you as a smartphone. Jeff considered having an inexpensive netbook and access to the Internet, without being chained to a wireless provider, to be a boon to computer users everywhere. But since wireless hotspots don’t exist everywhere yet, I don’t see how you can truly have the freedom to access the Internet wherever you want without going through one of the big wireless providers. I’ve been in lots of places without a hotspot but that did have T-Mobile coverage, and I’ve often wished I had a broadband modem to connect.

Even though they are neat computers, truly, they aren’t going to be for everyone.

Musing

So I bought a Dell Latitude E4300 laptop in June of 2009, the first laptop I’ve ever owned. It’s a beautiful machine, but a few months after I got it the keyboard started acting weird. Certain keys wouldn’t work right away after the system booted. They would start to work after a few minutes of endless tapping, as if there was some kind of short in the keyboard assembly. It slowly got worse and worse, to the point where I couldn’t log in any more.

It was still under warranty so I called Dell and figured I’d have to take it some place local or they would send a technician. Much to my surprise, they said I would be sent a new keyboard assembly and I could replace it myself. I have no problem with swapping out hardware components, I was just surprised that doing so has gotten so easy. Back in the day it could be a serious pain in the neck to replace certain parts on a laptop.

They had an online manual for removing the keyboard assembly and installing a new one. It took all of 2 minutes, and the new keyboard works great.

So thank you Dell, for making module parts that are easy to replace.

Musing