Controlling X10 Appliances with the iPhone

Last week I ordered some X10 gear off Amazon to play with. Included was a CM17A Firecracker X10 controller. It plugs into a serial port and transmits X10 signals to a receiver hooked up to your power lines. I found a neat little open source program called Heyu that lets you control the CM17A. Of course, controlling your X10 stuff from a command line isn’t cool enough for me, so I started on a Ruby on Rails app that lets me control everything from my iPhone. After adding some iUI styling it works pretty well. The Firecracker can only transmit, not receive data, so I had to store appliance state in the database. Besides that minor annoyance, everything worked out pretty well. I added iUI styling and I’m pretty happy with what I’ve got so far.

Anyone who wants to can check out the source here. It’s nowhere near done. There is no way to add houses or units short of making a migration or modifying the database directly. Also it requires that you have Heyu installed and in your path. Turning stuff on and off works though, as demonstrated by me in this video:

You can download it here if for some reason you want to.

My favorite thing to do so far is to turn off my air conditioner in the morning and then turn it on an hour before I come home in the evening. Since my schedule is so unscheduled, a cron job just doesn’t cut it.

Computers
Videos

Comments (2)

Permalink

iBloglines 2.0

Now with search, bitches.

Honestly, no other readers besides Bloglines have a decent iPhone site. NewsGator is an example. After using it for approximately 30 seconds on my iPhone, I noticed the following:

  • Formatting is terrible. It looks exactly like NewsGator designed and tested their iPhone site on a full-blown Mac in Safari. Every feed title takes up approximately three times as much vertical space as it should. Site names wrap, but only the first line indents. Even the default packs have this problem. If you’re going to waste space indenting stuff, at least be consistent and indent all of it.
  • Timestamps are below item text. You know, so you can try to guess when an article was published based on its content.

  • iUI’s JavaScript animations are enabled. Although they look cool on a PC, the iPhone animates them at about three frames per second. This means pages take at least an extra second to load, because you have to taste the bitter eye candy. Again, this is probably because nobody at NewsGator tried to use their site on an iPhone.

  • NewsGator shows 20 items per page, meaning pretty much any feed worth reading (and many that aren’t, such as Digg) force you to scroll like crazy. This wouldn’t be so bad except for…

  • …marking unread/read sucks. There’s no way to mark all items on the current page as read. Items default to unread and you must manually mark each one or press the “All Read” button. Instead of marking everything on the current page read, All Read marks all unread items in the feed, including ones you could not have possibly seen yet. Larger items are collapsed, but if you expand them they are not marked read. So if you’re actually reading any feed with more than a few sentences of text, you have to click twice for every item.

    Scrolling all the way to the bottom (which takes a while, see above) and clicking next doesn’t mark anything read. The three main problems…

    1. Items default to unread.
    2. Going to the next page does not mark the last page read.
    3. Clicking All Read marks every unread item in the feed.

    …create a trifecta of unusability. I have no clue what they were thinking when they made this– actually I do. It was, “Deploy an iPhone version of our site so we can get press.”

  • There are no site favicons. This is a big one for me as many of my favorite feeds have their own favicons. Why even put the syndication icon there if every feed has it?

  • No sharing/e-mailing items. The iPhone has an e-mail client and understands mailto: just fine. It would be so easy to add this.

  • No blog search.

For some reason NewsGator thought this was worth a press release. A lot of companies wouldn’t even deploy something this bad.

Computers

Comments (0)

Permalink

iBloglines

At the start of the week one of my coworkers got an iPhone and started tinkering with iUI. It didn’t take long for an iPhone version of Bloglines to come about. Over the next few days the team polished it up and deployed it. You can try iBloglines out here. It should work alright in Firefox and Safari, but it really shines on the iPhone. I’d say it’s better than the current mobile Bloglines, but of course iSafari can do XMLHttpRequests. Not bad for rapid application development in C++.

The following screenshots were taken in iPhoney, so they don’t get rid of the tool bar like on the iPhone:

iBloglines Feed List

iBloglines Items

iBloglines End of Item List

Computers

Comments (0)

Permalink

Nike++

I got tired of Nike’s flash-based UI and I wanted to learn Ruby on Rails, so I’ve started work on a little RoR web app that allows people to create accounts, upload Nike+ XML files, and view their runs. To view an example, just log in as geoff with the password geoff. This thing is definitely a work in progress, but if you want to screw around with the code you can download it here. The easiest way to deploy and test everything would probably be to just generate a generic Rails app and then copy the app directory over. If you want to try uploading runs but you don’t have an iPod sport kit, use the XML files here for testing.

Computers

Comments (0)

Permalink

XML Parsing in Ruby

I've recently started learning Ruby (and Rails) after seeing a coworker use RoR to quickly throw together a web app with all the goodies: AJAX, MySQL backend, pretty Web 2.0 theme, etc. I've gotten rather tired of Nike's flash-based web app for their iPod sport kit, so I decided parsing the XML files on my iPod Nano would be good Ruby practice and familiarize me with Nike's XML. I threw together a quick script that parses the Nike+iPod data and prints it out. You can get it here. If you're too lazy to copy one of the XML files off your iPod (or too lazy to run, or too poor/nonconformist to buy an iPod, etc), I've also got a test file. I haven't tried XML parsing in too many other languages, but Ruby makes it pretty easy. Iterating over a bunch of the same kind of elements is very handy. I'm working on turning this into a full web app that lets you upload XML files and track your runs (basically a version of Nike's website without the suck), but I don't think it's ready yet. When I get it closer to done I'll make the SVN repo public and set up a production copy.

Computers

Comments (0)

Permalink

Keep it simple, stupid.

I was asked to write a linked list in C++ at a job interview today. Immediately I started working on classes and methods and whatnot, but I didn’t have enough time to get it fully working. I gave a poor impression and had to explain inserting into and deleting from linked lists on paper. Afterwards, I realized my interviewer didn’t want a heavy object-oriented linked list. He wanted to make sure I knew the concept (and pointers in C++). A simple struct node and a couple of loops would have done the job.

When I got home, I was compelled to finish what I started. I made the linked list anyway to prove to myself I could do it. Here’s the Xcode project and everything else that’s necessary. Obviously you don’t need Xcode. Compiling main.cpp should do the trick on pretty much any system.

The linked list only has an AddToFront, DeleteFromFront, Next, and GoBackToFront methods, since that’s about all you can do with a singly linked list. I used templates so the thing could actually be useful if not for the total lack of documentation and testing. (Not to mention the fact that everyone writes one of these.) It does have an educational purpose though: Since I made it spit output when nodes are added and deleted, you can see how the destructor is implicitly called once the test object is out of scope. (In this case it’s when the program ends.) Writing this really took me back to my data structures class. I guess I’ve become soft since most languages come with nice data structures.

Computers

Comments (2)

Permalink

Wget isn’t as Evil as Hawaiian Airlines

While I was waiting to board the plane from Hawaii to Seattle, I noticed an open wifi network. Of course it was your typical $5 for 2 hours deal that a lot of airports have, so I opened up snort to find a MAC address I could spoof to get free access. After about two minutes some traffic went by that made me do a double-take: I thought I saw my name fly by in plain text. Luckily I was logging all traffic to my hard drive, so I replayed the data and ran in through grep. Lo and behold, my name WAS in there. Hawaiian Airlines was using the open wireless network to transfer passenger information. What’s worse is that their protocol was extremely simple. Passengers on flights are listed as last name, first name, followed by seat number. I searched for some nearby seat numbers and then asked the people if their names were X.

I didn’t have much time to log data and go through it, but stuff like this makes me wonder just how much more information Hawaiian Airlines is sending out on the airwaves. If anyone wants to sift through the logs, you can get them (in tcpdump format) here. Oh, and I also noticed one of the computers on the network was running MSSQL, but I didn’t have time to check it out.

It’s just sad how many people (and companies) are totally clueless about computer security.

Computers

Comments (0)

Permalink

Minesweeper… for OS X

Some guy on The Awful Forums made a JavaScript clone of Windows Minesweeper a while back. It didn’t detect right-clicks properly and had some bugs in Safari, but I fixed it and made it into a widget (yet another instance of me standing on some else’s shoulders). Anyway anyone who wants it can click here.

Since the original Windows graphics are used, there’s probably some copyright infringement going on. Oh well, this screenshot makes it worth it.

Computers

Comments (0)

Permalink

Evil wget isn’t as evil as regular wget

Compiling wget for Windows is not a difficult task, but there is almost no good documentation out there to help. This guy has a decent guide. I use Visual Studio 2005, but Microsoft gives away a free version that will work just as well for this purpose. Wget depends on openssl (to connect to secure http servers) and openssl requires perl to build. You can skip the whole installing ActivePerl step and grab a pre-compiled version. (You’ll want to get the zipped precompiled copy of OpenSSL linked to on that page.)

After figuring this out, I compiled evil wget for Windows. You’ll need the OpenSSL DLLs in the same directory. Also, evil wget is improved. Now it fakes its User Agent to pretend to be IE 6. This means that clever admins who block by user agent are out of luck. Blocking by IP is always an option though. Source is here. There are also binaries for OS X and Linux. Both depend on OpenSSL.

By the way, anyone using wget to retrieve files from a web server with password authentication should be careful. Wget tries using basic authentication, then digest auth if that fails. Even if your web server is properly configured to use digest authentication, wget will send your password out base64 encoded first. Most sniffers will recognize the string is base64 encoded and automatically decode the username and password. Think first before telling wget to use authentication as your credentials will be sent out for anyone to sniff. Use something like curl (http://curl.haxx.se/) instead.

Computers

Comments (0)

Permalink

LSCOLORS=ExFxCxDxBxegedabagacad

By default OS X Terminal doesn’t have colored output enabled for ls. Some people love colors in ls (me), others hate them. I like them, but the default colors aren’t very useful. Directories are blue, meaning they blend in very well with a black terminal background. It’s even worse if you’re using a blue background (such as the default Aqua background) and a translucent terminal. OS X uses a different format for its LSCOLORS environment variable than Linux, so it’s hard to figure out how to change the default colors and googling doesn’t help much. I threw together a JavaScript LSCOLORS generator as an exercise. It probably works on most modern browsers (I’ve tested it in Safari and IE 7) but I make no guarantees. I included a preview of what the colors will look like in a terminal. The colors aren’t perfect, but it’s not bad for toying around. Also, a note about why I have a bold checkbox for background colors: bolding the background causes the color to be lighter (bold brown is yellow in most terminals). This is not reflected in the preview, mostly because I don’t know all the quirks about bold backgrounds.

If I’m particularly interested, I might add Linux LS_COLORS to this also. The options are much more complicated (colors for any file extension, blinking, underlining, and other formatting options) so it would probably take me longer.

Oh yeah, here’s a link to the thing.

Computers

Comments (1)

Permalink