Friday, March 27, 2009

Hacking a Linksys NSLU2



I bought a Linksys NSLU2 a while back, which is a low cost (about $99) appliance for turning two USB disk drives into a Network Attached Share (NAS) system. This lets me set up file storage centrally located on my LAN (as opposed to attaching it to one computer on the LAN and setting up a share).

What's inside is a small Linux computer mounted on a single circuitboard. And that's where the fun comes in. As the device's Wikipedia page points out, since the internal Linux is licensed with a GNU General Public License, Linksys was required to release their source code. This has enabled third parties to develop firmware upgrades to the device. One popular upgrade is the Unlung SlugOS, which among various things, enables the device to accept telnet connections.

Here is my network cabinet at home. From left is my DSL modem, a 360 GB USB disk drive, the NSLU2, and my Linksys WRT54G Wireless router. If you know this router, you can see by the size that the NSLU2 is not much bigger than a deck of cards.

Like a router, an NSLU2 hooked up to your LAN will have its own web administration page, which is reachable by http://192.168.1.77.

Upgrading to the Unslung firmware went exactly as the directions described it. After restarting, the NSLU2's admin page had a few additions, as you can see in the screen grab below. It added an unslung logo on the upper left, and a "Manage Telnet" link on the right. Once I enabled telnet I was able to log in and get a prompt by telnetting to 192.168.1.77.



















A short tour of what is inside the box is shown in the telnet session below. There's cool stuff inside! A nice handful of basic unix commands, the web server that serves up the admin site (above), and even a wget command (which I demonstrate by getting the yahoo.com homepage HTML.

The next thing I wanted to do is to "de-underclock" the device. The CPU is 266 mHz but for unknown reasons, Linksys clocked it down by half with a tiny little resistor. Here's the board:
Simply removing the resistor clocks it up to 266 mHz. Following the helpful instructions on the Unslung site, I geared myself up with some needle nose pliers, a static wrist guard and gloves, a magnifying glass and a geeky miner's light (see pic at left). All I had to do was get a grip on that tiny, tiny resistor (about 1/4 the size of a grain of rice)...and I crunched it! After all, I wasn't going to need it again.

When I put the card back inside the case, reconnected it and restarted it...it worked! And I got the proof the the clock speed doubled in my telnet session:


Whoa, it says it is 2.22 mHz short of 266 Hz, I wonder why? Such are the mysteries of computer hardware.

Tuesday, March 17, 2009

Apple iPhone OS 3.0 Announcement summary

Here are highlights of what was announced for the iPhone OS 3.0 release early this afternoon from Apple:
  • Cut and paste: it was worth the wait, the touch interaction to do this looks very cool (see picture at right). Works across applications and does undo.
  • Multimedia messaging: you can attach a picture to a text message
  • Ability to choose a group of photos and send them in a single email
  • Push email notification
  • Landscape mode text entry (so what)
  • Turn-by-turn GPS navigation.
  • Available in the summer. That's as detailed as it gets. No doubt will be linked to the new iPhone model coming out in July.
  • Virtually all of the new features will work with the original, pre-3G iPhone (exceptions: multimedia messaging and stereo bluetooth)
  • Peer-to-peer linkups between individual iPhones for games, file sharing, etc. This exists now with things like AirSharing and Holdem, but those companies probably rolled their own; now it's part of the API
  • API support for applications that connect to external devices. Demonstrations with medical devices were given (see pic at right). Medical applications of new technology are always a big win in corporate presentations; the real news here is that this will open up remoting of all sorts of sophisticated devices for music, video, information systems, anything you can imagine.
  • Ability to search in your emails on the server side, and search in your calendar items
  • Search your iPhone contents with Spotlight (well-known to Mac users)
  • The Sims 3 will run on the iPhone (see pic at right)

Monday, March 16, 2009

iPhone SDK Presentation at CJUG 2/17/09

Our local Java User's Group chapter, CJUG recently hosted a presentation by Rakesh Vidyadharan titled iPhone SDK: Java Developers Perspective (link to PDF). It wasn't so much an immersion in iPhone development per se, but an introduction to development in Objective C.

Some of the things I found interesting:

  • The SDK requires an Intel-based Mac
  • The MVC approach is pretty much baked into the framework. Not everyone likes that.
  • Development with an emulator is a breeze, but pushing an app to a real iPhone is time consuming
  • Getting apps considered for inclusion in the app store is well-documented, but a convoluted process
Some things about Objective C:
  • Very similar to TCL scripting
  • Weak typing and dynamically-bound variables like javascript, ruby and php
  • There's no namespaces or packages, which means every class has to have a complete unique name. To group variables, developers adopt precursors, like CUreader, CUwriter, CUcreator, etc. And the language has several precursors reserved for the language core. For example, you can't define any classes or variables beginning with NS, IB, or UI.
  • Parameter names are part of the signature of a method. For example, foo(first_name: "Greg", last_name: "Sandell")
  • The code is visibly very different from Java, or even C and C++. Many lines start with a plus or minus sign.
Object-Oriented characteristics of Objective C:
  • Much less a "real" Objected Oriented language than C++
  • Objects don't automatically inherit a base Object as in java. You have to explicitly extend NSObject
  • Objects automatically have setters and getters, like ruby
  • Like C, you completely manage your own memory. OsX since Tiger has a garbage collector, but Objective C doesn't use it
  • Memory is managed by a incremental counting approach called refcount. Each alloc increments refcount, each release decrements it
  • Dealloc is like finalize in java
  • Messaging is a big part of the language. For example, methods are invoked via messages.

Friday, March 13, 2009

More ways to lose Twitter followers

I read an article today called How to lose Twitter followers in 10 steps. I've probably read about 20 such Twitter Ettiquette articles, and most are pretty good. They don't even all say the same things, which means there are many, many ways to be an obnoxious Twit. Twitterer. Ahem.

And yet there are still more ways to lose followers, because they have yet to cover MY list. Here are things you can do to get me to stop following you:
  1. Tweet long sentences over multiple tweets. Listen, it's a 140-character medium okay? Don't try to bypass it with a continuation.
  2. Be a celebrity-turned-Twitterholic. Hey I love your movies, and hearing about your glorious life was fun for a while, but now you twitter every tiny thought and movement you make as if I have nothing else to do but follow your 140-character fanzine.
  3. Tweet a link without information. People do this...a naked link, its identity obscured by a tinyurl, and you think we worship you so much to follow you into a blind alley.
  4. Tweet linkless information that needs a link. The other day someone announced a really cool sounding conference but gave no link.
  5. Make your followers listen to your side of the one-on-one conversation you're having with a friend. Hey get a room. A chat room. This is Twitter.
  6. Twitter using a context that only a tiny number of your followers know about. Recently I stopped following a colleague who kept tweeting things like "is excited about the new website" and "posted my first article to the new site. Can't wait for the reactions." What website would that be?
  7. Tweet with the same hyped-up, caffeine fueled excitement and optimism day after day. You got tickets to SXSW, FTW! You ate at a new five star on Randolph, FTW! You got tickets to Coldplay, FTW! Okay, okay I give up, I hate myself and I want to be you!
  8. DM everyone on your list with generic messages. People tend to have their twitter set up to get emails when they are DM'd. How out of it can you be about Twitter that you immediately turn it into a vehicle for spam?
Read on Twitter today from someone at SXSW: "Everyone starts out on the internet as a douchebag. Then you do something to move above or below that line."