Wednesday, February 27, 2008

Life is too short to idle away in a cube...

Not much is getting done in my office cube today. I like my job; I hate my cubicle. (I hate *all* Cubicles).

I've got some serious mental blocks happening right now. I'm not feeling 100% healthy, so that is definitely a contributor.

I'm going home to hang with my son.

Inspiration... Knuth & TeX

My interests are odd (for a computer geek). I don't think I'm retro, but I've learned Ruby, Lua, Erlang, ML, OCaml and a bit of haskell in the the past 7-8 years (yep, I first picked up on Ruby in 2000). I really haven't learned a new language (or done any real programming in the above languages) in the past 4 years.

I'm interested in [La]TeX again. A couple of posts ago I mentioned working on AFT. That could be fun, but (if I had the CFT) I'd rather hack around with TeX. In particular, I am interested in learning MetaPost (look it up). There is a nice $50 LaTeX graphics book that covers MetaPost.

So, I am thinking to myself, wouldn't it be fun to do some hardcore typesetting? (Remember, my interests are odd.)

Fundamentally, I love the idea of TeX (and LaTeX). The end result is very tangible: A (potentially) beautiful typeset document. Maybe make a book out of my kids' artwork or something. TeX (and LaTeX) is a complex enough system that it would be fun just to get lost hacking in it.

Emacs is a large hackable system too, but the end result is some editing tools.

Unix is a large hackable system, but the end result is doing some process/text manipulation.

With TeX, the end result is a piece of paper. A well typeset piece of paper.

Quote for the day

Twenty years from now
you will be more disappointed
by the things that you didn't do
than by the ones you did do.

So throw off the bowlines.
Sail away from the safe harbor.
Catch the trade winds in your sails.

Explore, Dream, Discover

-- Mark Twain

Tuesday, February 26, 2008

AFT Stuff

It's been a couple of years since I've done anything with AFT. I have a few ideas I've wanted to implement for a while, but I am tiring with mucking with the core of AFT and causing distress with any of my (few) users who wonder if they should upgrade. Sometimes a new feature may break old stuff or sometimes I roll in fixes with the new features.

As far as I can tell, AFT users install the version of AFT current to when they discovered it, use it and then resist upgrading (why upgrade when the tool does what you want)?

So, I am going to freeze AFT against any new features and add features by way of AFT add-ons.
These add-ons will be separately download-able and work with the AFT you have installed.

Here are some of the potential AFT add-ons:
  • aft-indexer -- Create an index on an AFT file against words in a separate document, write out a new AFT file that includes AFT markup for an index and run AFT against that.
  • aft-fixtabs -- Take an AFT document and smartly fix any tabstop errors. Output a new AFT document with tabs or N spaces for tabs.
  • aft-ft -- Convert "free text" (somewhat intelligently) to AFT format.
  • aft-simple -- A newer, simpler markup format (influenced by lessons learned) that produce standard AFT output.
The add-ons will be written in Perl or C and conform to AFT's current policy of not requiring any additional Perl modules outside of a standard 5.x distribution.

Tuesday, February 19, 2008

Idea of the week #1: Scramble Box

This would be a small handheld device powered by a AAA battery that has 1 SD slot, two buttons and 1 tri-color LED.

Let's say you've just taken some prize-winning pictures and want to "secure" the SD card from copyright thieves.

You just pop in the SD card, press the "scramble" button and all content on the SD card is encrypted (in place) using AES-256. The LED lights yellow while this is happening and then turns green when done.

(The key was crafted by you and programmed into the device earlier by putting it into a file called "CFG/KEY.CFG" on a blank SD card).

When you want to unscramble the SD, you pop it in and press the "descramble" button. The LED lights yellow while this is happening and then turns green when done.

The device holds onto the "key" in flash memory. You can use a different key anytime by placing CFG/KEY.CFG on either the enrypted or yet-to-be-encrypted SD card. At the end of encryption/decryption the CFG/KEY.CFG is securely deleted (don't want to store keys in the clear, now do we?). If the CFG/KEY.CFG is supplied on a blank SD card, the flashed key is changed.

This is less secure (if someone steals your Scramble Box AND your encrypted SD cards then they can decrypt the cards so as long as they were encrypted with the currently flashed key). However, this at least allows encryption/decryption to occur without creating the key file
(so you can go directly from camera to Scramble Box).

Now, photos are probably not the best use case here. A better, although less dramatic, example would be to put a bunch of "important" documents on the SD card and run it through the Scrambler.

However, since we are just using a fairly standard AES-256 technique (CBC w/ CTS), you could always do the encryption/decryption on a PC (with the right software).

In this case, the Scramble Box can be used for batch encryption/decryption.

Oh, and for usability, the key is a simple password/passphrase that is run through a hash function, so you don't have to memorize a 32 bit key ;-)

Lambda the Ultimate links to some of my old ideas

These links are mainly here for my own bookmarking purposes, but they expound ideas I can't seem to let go of:


In the second link, Luke Gorrie ported his "untar" program from scheme shell to bash. I tried to make it more beautiful (or perhaps just more obfuscated). Here is his ported script, and here is my rewrite.

Wednesday, February 13, 2008

The End of the Analog Television Era: Sad...

The end of an era is coming. On Feb 17, 2009 analog television broadcast is supposed to come to an end. The US government has mandated that all over the air broadcasts will be digital. They are giving away coupons for free converters for analog TVs. After March 1, 2009 all newly manufactured TVs must be digital.

Since 1941, the analog broadcast standard has pretty much remained the same. The same signal broadcast then can be received now. For over the air broadcasts, the era of NTSC will end after a 68 year run.

Children in a post 2009 world will never know about "snowy" pictures. With poorly received digital, you get frame drops, stutters and pixelation.

The days of hacking analog TV signals are also gone. This is not quite as dramatic as the (eventual?) loss of analog AM/FM radio, where with just a crystal and a few parts any kid can tune in a grainy signal and thrill to the discovery of turning inaudible radio signals into sound!

I haven't figured out yet what the plan will be regarding "emergency broadcasting". When the next flood or tornado hits what do folk who didn't get the "free voucher" upgrade (or are just too far away to get a decent signal) do? In the middle of swampy Lousiana, or in a remote farmhouse in Kansas you may be able to currently get a grainy noisy signal warning you of disaster. Come 2009, how well will the same tower broadcast digital? Will you be able to make out the news when the digital stalls and drops?

None of this affects us cable/satellite users. But, I want to tune in when the moment comes and we witness the silence of the analog signal. I wonder how many uninformed people will take the silence to mean an invasion from space or Armageddon?

Monday, February 11, 2008

Cutting Code in a Coffee House

I need to remind myself that its all about creative problem solving. The Web and internet is all just a facade. Software is all about a manifestation of concepts. It's a tool for creative thinking. If you can web-enable it then you are trendy.

While doing embedded development, I am limited by what can be physically rendered. I can only get things smaller up to a point. I can only do what physics deem possible (for today at least). I can be creative, but I can't fly.

Current thinking in Web technology threaten to clip my wings too. I left IT development for the embedded world because I felt bogged down by XML, HTML and the Web programming juggernauts (Java, Javascript, Ruby, etc).

The effort of putting things on the Web didn't seem all that sexy anymore.

The effort of building complicated backend servers was no longer appealing.

Building embedded thingies gives me some immediate satisfaction. People use the stuff I build. I can measure the impact. It's real. It is physical. It has a form.

But, I kinda miss pure software. Coding in coffee houses is fun. Developing something useful while sipping on coffee and eating sweet breads (doughnuts, danishes, pie, oh my) is heaven. I just need an idea.

At times, when I got wrapped up in just hacking for the sake of hacking (e.g. getting awk/ksh/bash to do things they really weren't meant to do), I didn't feel like I was contributing much. Hey, I was a member of the language-of-the-week club (Erlang, Haskell, ML, etc)!

In reality, the languages I am the most productive in has been (in no particular order): C, Tcl, Awk and Perl. I've built production systems in Tcl/C and have written my only contribution to open source in Perl (see AFT). So, why do I insist on learning new languages? Why can't I just cut code in what I know best?

I need to take the time to visit a coffee house. Just me, my laptop and some ideas.

Pure Software vs Embedded Hybrid

Visions of purchasing the Asus EEE has grabbed me lately. It would probably be useless for embedded development, but if I imagine myself somewhere on an island (or in a mountain cabin) hacking away at my latest ideas. There wouldn't be much embedded work done there.

At the minimum, embedded work would take a PC, some sort of JTAG interface and a target board (and maybe a power supply). To do embedded I am chained to my house (or the lab/cube at work). With a nice portable, I could be sitting in a coffee shop or in an airport terminal, jamming to tunes while I hack away.

This is a different kind of development, though. As much as the embedded devices I hack during the day will impact people (I design pagers, satellite based trackers, etc), writing pure software (that either runs on a server or someone's PC) has the potential to impact far more people (and hopefully for good, not evil!).

Thursday, February 07, 2008

(Simple) Single Wire Protocols

My current favorite MCU is the MSP430. In particular, I like the ones that stretch the longest lifetime out of small batteries (like a CR2032 coin cell). Unfortunately, there aren't a lot of "communication" options for such a low power design (think: how do we get logged data out of a tiny low power processor?). RS-232 is too heavy, SPI/I2C is too complex, Bluetooth and other RF is too expensive (money and power-wise).

How about a simple single wire protocol?

Dallas/Maxim has such a protocol (called One-Wire) that is very interesting, but its very proprietary (you can't legally create a slave -- they reserve the right to be the sole provider of slaves that are compliant to the protocol). Among other things, this protocol supports multiple slaves and can even be used to power them. You just need a single wire (normally pulled up) and a common ground. The single wire is used for *all* communication (bi-directional).

I'm looking at doing something similiar to this, but greatly simplified: Only one slave supported.

(Random) Copious Free Ideas

A few random ideas for someone's Copious Free Time: (All of these projects involve very low power circuits -- the idea is that these things will run a long, long time without changing batteries).

Cold Bot

Augment a Roomba (or iRobot Create) with a temperature sensing parasite that navigates the Roomba to the coldest spot(s) in a room. If the temperature sensor was mounted on a small probe/arm, then you could pin point insulation leaks. The parasite also controls the power to the roomba thereby extending runtime by shutting the roomba off when the coldest spot has been reached.

For extra credit, make it a warm bot, place a gold fish bowl on top and let it take the fish to the warmest part of the room ;-)


Temperature Throwies



Tape a MSP430F2012 to a coin cell battery and use the internal temperature sensor to log temperature data to its internal flash. Make a bunch of them and place them in parts of the room or house that you are interested in monitoring for temperature trends. Create a single wire interface (data) to transfer data to a collector. The collector has two probes (ground and data) that you touch against the sensor in order to transfer logged data (along with an associated sensor ID).

Plot collected data on a PC.

Mom, my little sisters are messing with my stuff!

Couple a tilt sensor (accelerometer) with an MSP (or AVR) to make a small alarm. Use a piezo buzzer and coin cell battery. Make it small enough not to be easily noticed. Put on top of (or inside of) the item you want to monitor. If someone moves the item, the piezo screams.... for a long time.

Alternatively: Remove buzzer and use a watch crystal to build a fairly accurate RTC. Silently log the time the item was jostled. Collect this info later with single wire interface.