kdmurray.blog

The crossroads of life and tech

Adobe Air on Ubuntu 11.04 x64

I was having a devil of a time trying to get TweetDeck to even install under Ubuntu 11.04 until I came across this fantastic tutorial by deepok1968 on YouTube. The problem boils down to the Adobe Air installer not being all that happy with x64 systems in its native state.

If you visit the video page you can get a copy of the commands that he uses. I stuck them in a bash script so that I can re-use them if I need to do the install again.

Now I just need to figure out how he got that wicked looking OSX style dock…

Leaking Tokens: Time to Change Your Facebook Password

I don’t do this kind of thing lightly, but it might be a good idea to post this on your wall:

  • Facebook found a problem in the way that it was authenticating applications.
  • Any time you used an application a token was created that would allow the application to do it’s thing — including posting on your wall, accessing photos or whatever other permissions it requested.
  • The tokens did not expire and were being “leaked” through normal operation on Facebook.
  • Anyone who found a token would be able to use it to do the same things that you allowed the application to do — including posting on your wall, accessing photos or whatever other permissions it requested.

It is important to note that Facebook has said there is no evidence that this has been exploited — yet.

The problem has now been fixed, but all the old tokens could still be usable until September 2011. You can re-secure your account by simply changing your Facebook password. This will invalidate any of the existing tokens.

Information Week has an article with more detail.

C# IsNumeric implementation

Here’s a quick and dirty implementation of “IsNumeric” in C#. This is one of those methods that just seems to be missing from C# which appears in so many other languages.

UPDATE 12-Apr-2011: After some fantastic discussion elsewhere I’ve modified the code to handle a number of additional scenarios. A point was also raised that a combination of Int64.TryParse() and Decimal.TryParse() would accomplish the same thing. They would, almost, but those methods test for valid 64-bit integers and valid 64-bit decimals — they don’t test whether a string is numeric. Feed them a long enough string of numbers and they’ll return false. It’s a pretty fine distinction, I grant that, but I figured since I was writing the code I might as well make it as robust as possible.

        public static bool IsNumeric(string s)
        {
            return IsNumeric(s, false);
        }

        public static bool IsNumeric(string s, bool allowDecimal)
        {
            bool result = true;
            if (String.IsNullOrEmpty(s))
            {
                return false;
            }

            if (s.StartsWith("-"))
            {
                s = s.Substring(1);
            }

            char[] chars = s.ToCharArray();

            if (allowDecimal)
            {
                bool decimalFound = false;
                foreach (char c in chars)
                {
                    if (c == '.' && !decimalFound)
                    {
                        decimalFound = true;
                    }
                    else
                    {
                        result = result & (char.IsNumber(c));
                    }
                }
            }
            else
            {
                foreach (char c in chars)
                {
                    result = result & char.IsNumber(c);
                }
            }

            return result;
        }

I built 14 39 unit tests for this on the project I built it for throwing all sorts of weird and null data at it, and it seems to run fairly well and reasonably quickly. Any comments/suggestions are welcome.

FeedPublisher – A History

One of the things that has slowed the recent publication of episodes of blog posts (among other things) has been a desire to spend a good chunk of my on-the-computer time writing code. I’ve done a few little projects which I’ve put to use, started a half-dozen others which died on the drawing board, and have managed to get a couple working just the way I want them to help me with something that I actually want to get done.

It seems to me that some of the best pieces of code I’ve ever written are the ones I wrote to solve a problem that I had. The two WordPress plugins I wrote (Random Image Selector and Admin Links Widget) have met with far more success and way more downloads than I ever would have thought possible.

In that same vein of ‘solving my own problems with code’ I bring you FeedPublisher. This does only one thing, and it does it reasonably well: It downloads the contents of an RSS feed and creates an EPUB book out of it, suitable for transferring to your favourite eBook reader.

The bulk of the idea for this project came from my experiences with an application called Calibre which was shown to me by Knightwise. I’m paraphrasing a bit, but he had said it was the best application to come along for dealing with eBooks that he’d ever used. High praise coming from someone who prides himself on finding and using the best free cross-platform software that the Internet has to offer.

So I tried it out and really did like most of what it did. It can manage conversions to and from a number of different formats, it deals with PDFs like nobody’s business, and it had a really cool feature: download and convert blogs to eBooks.

The first thing I thought was that this would be a brilliant way to handle eBooks. But as I used it, a couple of things that just weren’t quite what I wanted. The created eBooks were a bit on the ugly side (and had notices that they’d been created with Calibre). But the larger problem was that it wasn’t really possible to schedule the download of the feeds. Calibre had to be running all the time for you to pick them up. This scheduling problem proved to be the final push I needed to get off my butt and create FeedPublisher.

FeedPublisher itself is a command-line app (for Windows only at the moment) which downloads the contents of a selected list of RSS (or Atom) feeds. Each feed becomes its own ePUB book containing the contents of the blog posts. This first version works quite well and rarely crashes but it’s definitely ‘beta’ quality software. Chances are it will work for you. :)

The project is still in its infancy, but if you’re interested, check it out!

Star in Motion

An amazing image of a star (Zeta Oph) plowing its way through interstellar space at 24 km/s. The stellar wind it creates as is pushing the interstellar dust and compressing it into something akin to a shockwave.

Zeta Oph punching through the interstellar medium. Image credit: APOD

Windows Phone 7 – First Impressions

LG Optimus 7The Redmond-based software giant’s previous offering in the mobile space (the much maligned Windows Mobile) has taken a lot of flack in recent years over the quality and features (or lack thereof) in their mobile operating systems. One of the biggest challenges was the fact that Microsoft did not control the hardware stack. Vendors could essentially build anything they wanted with “compatible” hardware with little or no enforceable guidance from the software maker. All that has changed in 2010. Microsoft has provided a minimum specification for Windows Phone 7 devices which seems to be providing a more consistent experience across devices, and overall better performance than in years past.

In trying to describe it over the past couple of days I keep finding myself referring to it as ‘not an iPhone’. Though it shares many of the same features and capabilities of its iOS brethren, it doesn’t follow the lead in OS design. The overall feel of the UI is very fluid. Screen transitions both in the OS and within many if the applications are smooth and scrollong through long lists of data or

The main screen of the WP7 interface is the set of configurable ‘Live Tiles’. These are in essence large icons which can also be updated by the apps they belong to. Messaging and email applications, for example, display the number of new message and the Marketplace app shows the number of apps you have which are waiting for an update.

The second panel on the main screen is the application list. All of the applications are displayed on a single scrollable list. This alone is a break with the now traditional layout of iOS and Android devices displaying screens and screens if icons. This difference provides an instant differentiation for the new Windows devices.

The one class of applications that is treated differently is games. Games are all listed from within the XBox Live hub isolating them a bit from the rest of the applications.

In the last sentence I mentioned a hub. This is the second major concept that the OS introduces. The hubs are, for want of a better term, points of convergence that bring together disparate sources of similar information. The best and most cited sample of this is the ‘peope hub’. the people hub allows you to merge in your contacts from your (multiple) email accounts and join it to contact information in your MSN messenger account and even your Facebook friends. The people hub uses all of that information to create a single list of contacts each of which contains information from the various sources.

The convergence of the people hub is nice. I’ll be happier once the OS can expand beyond Facebook and Windows Live to incorporate the services I actually use on a regular basis like Twitter, GoogleTalk, Tumblr and Flickr.

So far so good for the newest mobile OS. I’ll have more posts coming in the next few weeks getting into some of these features in more detail, covering other aspects of the Windows Phone 7 ecosystem, and hopefully touching on the developer story for WP7.

LG Optimus 7 — Unboxing

LG Optimus 7Last week I picked up an LG Optimus 7 as I begin my journey down the Windows Phone 7 path. The selection of this particular handset was driven partially by the carrier I am with, which is turn heavily influenced by where I work. Nonetheless I certainly had many other options for choice of handset and mobile OS and decided to go down the Windows Phone 7 route.

At first blush it seems as though LG has taken a cue fro Apple when it comes to the packaging of the phone. The exterior box, as well as the majority of the inner packaging material were very high-end (as far as paper products go anyway). The handset was nestled onto a form fitting tray with all the miscellany tucked beneath.

In the package was all the pieces that one would expect to find in a modern smartphone package; battery, USB cable, manual, “getting started” guide, wall-wart and of course, the handset. The wall wart is just a wall plug that takes a USB cable, so there’s really only one charging cable. A bit disappointing since that means I can’t leave one at work, and one at home. I’m a bit disappointed that LG didn’t throw in a second ten-cent cable considering that this is supposed to be a relatively high-end smartphone.

The device also came bundled with a SIM card for my provider, so I popped in the battery and the device came to life and — oh wait, removed the battery, popped in the SIM card, replaced the battery and the device came to life.

The Windows Phone 7 OS was very visually appealing right off the bat. I found it easy to navigate and find what I was looking for. The visual styling of the menus and titles (running off the edges of the screen) takes some getting used to, but I didn’t find it too much of a distraction.

I’m looking forward to digging into the device more, learning the ins and outs of the product and figuring out its hidden dark secrets.

Enabling AutoComplete Excel 2007

This is far from ground-breaking information, but it took me 20 minutes of searching to figure out how to (re-)enable this feature in Excel.

When you’re filling in data on a spreadsheet Excel will (by default) offer auto-complete suggestions based on previous values in a column back to the last white-space (empty) column.

For some reason my Excel decided to turn off this feature. While I’m not entirely sure why, I’m just glad I was able to get it turned back on.

Click on the Office button:

Click on Excel Options…

Click on  Advanced and check the box marked Enable Autocomplete for cell values

Security for Client Applications: OAuth

Recently I was listening to Security Now when the topic of OAuth keys being hacked out of Android applications came up. There was some discussion on how services that require OAuth for authentication (as Twitter now does) cause problems for client applications. (NB: In this post I’m referring to client applications specifically as something that the end user downloads to their PC or other device.) The case was made that the problem is that OAuth was not written for client development, and is really only secure when running from a web-server.

The key to the “vulnerability” with OAuth is that each application is given its own key. That key ties any request made to the service (Twitter for example) to the application which owns the key. The concern was that if the key falls into the wrong hands users’ personal information could be put at risk. With the key needing to reside somewhere that the application can read it, they’re typically stored within the application code which makes finding the key a trivial matter for a hacker.

The thought occurred to me that if you need to access a web-based service which requires OAuth, it might be helpful to have an intermediary service handle that authentication for you. By adding a service tier which authenticates a specific user of your application and performs all of the direct interaction with the service there’s no need to keep the OAuth keys on the client which makes them much more difficult to compromise.

Admin Links Plugin Updated to 1.4.0

It’s been a good long while since I’ve had the time to make any changes to the two WordPress plugins I’m supporting. In fact if WP 3.0 hadn’t broken one of my plugins there’s a good chance I wouldn’t have made this change either.

That said, there’s a fresh version of the Admin Links plugin available and this one is compatible with WP 3.0.

In case you’re not familiar with the plugin, it provides access to common admin features from the public side of the site. Visible to logged-in admins, and completely invisible to the great unwashed masses of the interwebs.

Download it directly from WordPress.org.