09.20.09

On Second Thought – The Avatar Will Stay

Posted in Uncategorized, musings at 10:04 pm by JohnB

I’ve now reconsidered my earlier plan to get rid of my avatar. Why? I’m so glad you asked. Three reasons:

I’m now identified with the avatar. I recently contacted a guy that I hadn’t corresponded with in a while and he said “Oh yeah – I remember you. The guy with the big rock man thing”. So if I get rid of the avatar, I might lose some of the people that would otherwise “recognize” me online.

The Games will blow over but the avatar is still, in my opinion, pretty darn cool. Ya don’t see huge multi-ton monoliths every day.

Time and inertia. I have very little “spare” time in my life and my plan for changing the avatar would likely have taken some time to get right (a series of ~10 images shifting from the rock man to my own smiling face). This is time that would take away from whatever projects I’d otherwise be working on.

So, I hope you like it – you’ll keep seeing it on twitter and other places.

05.28.09

The Avatar Must Die

Posted in Uncategorized, musings at 1:24 am by JohnB

A few years back, we took a trip from the Bay Area all the way to British Colombia. Near the apex of our journey we saw the most incredible sights. Orca whales, swimming at and under our boat. Brown-colored Black bears (yes, the distinction matters) by the side of the road. And on a mountain near Whistler – the place where I really learned to ski many years ago (such as a boy from San Diego can actually learn to ski) – we saw a huge totem called an Anukshuk. Built of huge Stonehenge-style rocks, it was perched  far up the mountain. I liked it so much that I started using it as my avatar on a number of sites.

Avatar used on twitter, chess.com and others

Yes, I know that it is one of the mascots of the 2010 Olympic games. I thought it would be so cool to make use it, long before the rest of the world associated it with anything other than me. But now, as the date (February 2010) approaches, I wonder when – or if – I should replace it. I’d like it to be a gradual process – but that is not usually the way these things work. You replace one image with another. Whoosh. Done.

And so I ponder. But as I ponder, the Games come closer. And with the date getting closer, it impacts The Locals more and more. To house and feed and transport that abrupt influx of humanity that is The Games, there must be changes. A streamlining of transport. A building of hotel rooms. A “regooding” of the now-deemed-blighted sections of the city. A streamlining of the food establishments, to cater to the oh-hey-theres-a-Starbucks-right-there crowd. Consistency is chosen, time and again, over flavorful melange.

But these Locals speak our language – by gosh they’re almost ‘mericans! Some, like the quirky observer William Gibson, use a delicate turn of phrase to create new words for the process that is unfolding. Others, like Tim Bray of the Urban Geek persuasion (no, I don’t know what that phrase means either) point us toward articles detailing the decline of the locals under an onslaught of progress and, later, of the fights and Pyrrhic victories. How soon until we see articles about the replacement of family owned businesses with multinational conglomerates? And do I want to be associated with all that through my avatar?

Stay tuned!

10.01.08

Last of a Generation

Posted in Uncategorized at 10:02 pm by JohnB

My aunt Barbara passed away yesterday. We were never close, but she was the last of her siblings to pass on, even though she was the oldest. I know that was hard on her. Now its finally her turn. May she find rest.

She played a pivotal role in my life, long before I was even conceived. After her mother, my grandmother, had passed away, Barb took it upon herself to put my mother through college. I doubt she ever understood this nuclear engineering thing my mother studied, but she supported it. And eventually my mother met another engineer and here I am today.

It wasn’t unexpected – she had been declining for a while – but I’m surprised at how choked up I am about her passing. Outspoken, disapproving, warm and alive – often in the same sentence.

I remember a message she once left on our answering machine. Her voice sounded so similar to my dead mother’s voice, with the same Pennsylvania accent, that it sent chills up my spine.

Thanks Barb, for all you’ve done and all you were – you’ll be missed – and in the end, what more is there, than to be missed?

03.20.08

Its Official – My Old Product is Dead

Posted in Uncategorized at 4:22 pm by JohnB

Pay By Touch To Shut Down All Biometric Services Immediately

Biometric authentication transactions to cease at 11:59:59PM March 19, 2008

SAN FRANCISCO – (March 19, 2008) – Solidus Networks, Inc., dba Pay By Touch, regretfully announced today that it will no longer process biometric transactions on behalf of its merchant customers and consumer membership base, as of 11:59:59PM March 19, 2008.

On December 14, 2007, Solidus Networks filed for U.S. bankruptcy protection under Chapter 11. As part of the company’s restructuring, it was determined that the enterprise could no longer support the biometric authentication and payment system as it currently exists, based on lack of funding and current market conditions.

Other non-biometric Solidus Networks business units will continue on their current business paths.

Solidus Networks extends its sincere gratitude to the shoppers, merchants, vendors, investors, partners, and employees who have been supporting the company’s vision since its first biometric payment transaction in 2002.

02.27.08

unpack!

Posted in Uncategorized, ruby at 12:54 am by JohnB

[Update 10/11/2009: I just found a better tool, bindata, to do what I'm describing in this post. It also lists, at the bottom of the page, many links to yet other implementations of binary data packing/unpacking. Worth checking out if this is what you need.]

[Update: presentation from the 4/15/2008 Ruby Meetup is now available here.]

I like reading code. Its like a novel and I want to read it cover-to-cover. Some, such as Why’s Camping framework, I struggle to comprehend. But most code that I read comes up slightly short. Like a novel with some mis-spellings, awkward phrasing or repeated analogies, I mentally mark it as “could be better”. And sometimes I really do sit down and write something better – maybe just for my own amusement but often for a useful purpose.

I recently had the experience of reading some code that parsed a variable-length binary data structure. This sort of thing comes up often when parsing a file format or communications protocol. Most of the code looks fairly similar because it does similar stuff: ignore one byte, read the next four as the length of the following junk, read two important bytes, ignore two more, read another four-byte length and skip past the following N bytes – ad nauseum.

I’ve written it in C, and it looks something like this (ignoring error conditions like getting to the end of the buffer):

ptr = &data;                  // start at the beginning of our data
ptr++;                        // skip junk we don't care about
UInt32 len = *(UInt32 *) ptr; // get the 4-byte length
len = ntohl(len);             // convert from network byte ordering
ptr += sizeof(UInt32);        // skip past the length we just read
ptr += len;                   // skip past the data we don't care about
UInt16 cost = *(UInt16 *)ptr; // read our important two bytes
cost = ntohs(cost);           // convert to the correct byte ordering

In Ruby, this tends to be shorter due to the handy String.unpack() routine, which takes a concise format string to define how many bytes to read and what to do with them. “a3″ reads 3 bytes as a string, “N” reads 4 bytes in network order, “n” reads 2 bytes in network order, etc. The code above could be rewritten in Ruby like this:

array = data.unpack( "a1N")        # read the junk and the 4 length bytes
len = array[1]                     # only get the length value we care about
data = data[5..-1]                 # throw away the stuff we just read
array =  data.unpack( "a#{len}n" ) # define the length to read on the fly
cost = array[1]                    # get our data in its correct ordering
data = data[(len+2)..-1]           # again, throw away what we just read

This code works fine, but its not much more readable than the C code. A first step would be do define a string.unpack!() routine, where the ‘!’ exclamation clues us in that it modifies the object we’re working with. In this case, the modification is to eat (discard) the data we just read. This shortens the code to:

array = data.unpack!( "a1N")       # read the junk and the 4 length bytes
len = array[1]                     # only get the length value we care about
array =  data.unpack!("a#{len}n")  # define the length to read on the fly
cost = array[1]                    # get our data in its correct ordering

But again, this isn’t much more readable (in my opinion) than the C code. Additionally, it doesn’t help us understand the code much better in the case where our format string is “a3Nna5″ and we need to remember which item in ‘array’ corresponds to the ‘n’ in the string (in this case, it is array[2]). After a test iteration or two, what I finally hit upon was to encapsulate the behavior we want in a separare Unpacker class, that automatically eats the data it reads and stores the results in an internal Hash object, to map the name ‘len’ or ‘cost’ to the data. I also combined the format string and the resulting variable so we can clearly see the relationships. The result looks like this:

u = Unpacker.new(data)
u.u! "a1        => unused
      N         => len"
u.u! "a#{u.len} => unused
      n         => cost"

Now we can clearly see which values are ignored, which are given meaningful names, and how the format codes relate to the meaning of the data. Changing it to reflect a better understanding of the underlying data will be very easy. Note that the only reason its in two statements is to define a value for u.len before we use it – blocks of fixed-length data can be one statement.

The code to implement the Unpacker class is only about 30 lines of Ruby – including the string.unpack!() routine that can be reused separately.

class String
  def unpack! format
     array = self.unpack(format+"a*")
    self.replace array.pop
     return array
   end
end
class Unpacker < Hash
   attr_reader :data
 def initialize string
     @data = string
    super
  end
  # format string is expected to have whitespace between each
  # "unpackCode=>variableName" pairing (which can have whitespace
  # around the "=>").  u! was picked to be short so it would
  # look nice, and to connote a destructive "unpack!" operation.
  def u! format
    format.gsub(/\s*=>\s*/,'=>').strip.split(/\s+/).each do |segment|
    src,dst = segment.split(/=>/)
    self[dst] = @data.unpack!("#{src}")[0]
 end
end
# Hash_with_Attrs - For the simplicity of using either u.len or u['len'],
# makes a hash appear to have members for each hash entry. Many thanks
# to Why_ for collecting this handy routine on his a href= RedHanded blog.
# Note of Caution: 'len' is fine but 'length' would not be since u.length
# would give the number of entries in the hash, not the just-parsed value.
def method_missing(meth,*args)
  meth = meth.id2name
  if meth =~ /=$/
    self[meth[0..-2]] = (args.length<2 ? args[0] : args)
  else
    self[meth]
  end
end
end

Update: An even cleaner and shorter way would be to implement a DSL as a module so the code above could look like this:

a 1,    :unused
N       :len
a :len, :unused
n       :cost

(and yes, this is valid Ruby code)

01.29.08

Book Recommendation: The Rails Way

Posted in Uncategorized at 12:53 pm by JohnB

The Rails Way is a Ruby on Rails reference book that I bought on Josh Susser’s recommendation.  I’ve actually, to my family’s dismay, been reading the darn thing instead of just referring to it like one would a, well, reference book.  A lot of Rails’isms that I had a vague idea about I now understand with much more clarity.  It will definitely come in handy soon.

01.25.08

Using Ubuntu

Posted in Uncategorized at 3:18 pm by JohnB

I’ve heard that dual-booting Ubuntu linux was easy but its really true. I’m now running Ubuntu and it was as easy as various blog posts have said. The longest step in the process was defragmenting the drive before repartitioning with Ubuntu. There are a few issues remaining around using the data on the Windows partition from Linux, but on the whole I’m very happy with the switch.

[Update 1/29/2008: the network is inconsistent.  Upon a boot or un-hibernate it may be completely incapable of finding my router - but then later it is fine. I'll continue trying to track it down... using the Windows OS!] 

12.17.07

Another High-Traffic Rails Site: catalogchoice.org

Posted in Uncategorized at 6:12 pm by JohnB

Its getting a lot of traffic and seems pretty snappy:

http://www.catalogchoice.org/

So yes, Virginia, Ruby and Rails do scale.

11.28.07

Even More Rapid Development

Posted in Uncategorized at 1:41 pm by JohnB

The success of the Ruby on Rails web framework is somewhat based on its  ability to soothe the pain caused by the not-so-rapid development process of other, so-called “enterprise-ready” frameworks.  But Rails is not the only Ruby web framework, and not the fastest one for initial prototyping(*).  The faster (more rabid?) ones I’ve looked at:

  • Camping.  From the the quirky mind of why-the-luck-stiff (no other name given) it inspires absurdly fast development (and absurdity!).
  • Sinatra.  Some people who have tried Camping have moved on to Sinatra – it has a clean syntax and a simple metaphor (Sinatra attends events) and is supported by a larger team.

Its hard to imagine what faster development would look like – maybe a web interface for defining Camping or Sinatra event handlers?  Code the app directly from the browser!

(*) Footnote: Note that I use the word “prototype” because that is all I have done with them – I see no reason they couldn’t scale as well as Rails or any other web framework.

09.10.07

We Are All Outsourcees

Posted in Uncategorized at 11:30 pm by JohnB

Last night’s Tech Nation program had an interview with Rob Levy of BEA.  He had some deep insights into dealing with outsourcing companies.  In essence, either make them as peers or at least treat them as peers.  This is a refreshing change to what I’ve seen, not only when outsourcing, but when purchasing companies outright to be “business units” within the greater company.  In the words of one friend who works at one of these subsidiaries, they feel like the “red-headed step child”.  It definitely puts the sub in subsidiary!

Rob Levy made the point that once these places become free-standing entities, with enough work and resources to work independently, then its perfectly normal for them to treat the company headquarters as an outsourcee instead of a parent.  I can’t imagine a lot of C-level executives (especially in my company) giving this type of free rein.

Whether you agree with him or not, its worth a listen…

[editor's note: when jotting down my initial notes for this post I found myself writing that they were treated "as if they were peers" - which just goes to show how deeply engrained this sort of thinking is.  The headquarters has the illusion of control, but its only a offering from the employees - if you make the company too difficult or unstable to work at you just may find you've lost all your employees.]

« Previous entries Next Page » Next Page »