Archive for the 'Uncategorized' Category



23
Jun
08

Create TinyURL like URLs in Ruby

Some Ruby on Rails side-project hacking I’ve been doing led me to need to generate shortened URLs.  The ShortURL gem is fine if you want to use TinyURL, Snurl, or some other external service to generate and manage your URLs, but in my case, I need to host the URLs so I can track usage statistics and redirect to a URL determined at request-time.

I wanted to avoid generating curse words, or any words for that matter, so I opted not to use vowels rather than try and figure out something more clever.  I also had no requirement to obfuscate the sequential nature of the generated value.  The result essentially converts a number to a base 54 string suitable for use as a URL parameter.

URL_CHARS = ('0'..'9').to_a + %w(b c d f g h j k l m n p q r s t v w x y z) + %w(B C D F G H J K L M N P Q R S T V W X Y Z - _)
URL_BASE = URL_CHARS.size

def generateUrl idNumber
localCount = idNumber
result = ”;
while localCount != 0
rem = localCount % URL_BASE
localCount = (localCount – rem) / URL_BASE
result = URL_CHARS[rem] + result
end
return result
end

My usage will be to convert the numeric primary key of my model objects to this hash, so that Person #1174229 could be referenced as the short url http://app.com/p?i=7sH_

Obviously, the straightforward business of inserting this value into your table, performing lookups on it, etc is omitted and should be fairly straightforward to a seasoned developer.  The function can fit almost a half-billion values into 5 characters, and doesn’t experience the stack overflow issues of some recursive implementations I found, so I think it’s pretty useful.  (7 characters give you 1.3 trillion possibilities… nice!)

I can see a pretty cool plugin being built to solve this problem… maybe I’ll get around to writing short_url_fu one of these days.

27
Mar
08

Amazon Content Delivery Network Web Service?

Content Delivery Networks (CDN) such as Akamai and Atlanta’s own Internap handle the problem of delivering content (especially large content), handling all of the scalability and geographical delivery optimization. This market has become fairly commoditized, and since it requires huge investment in hardware in many locations and software to glue it together, new competition in this market would seem unlikely.

Amazon Web Services just announced the innocuously named Elastic IP Addresses and EC2 Availability Zones.  Elastic IP lets you associate a static IP address with an individual EC2 instance – slick.  “Availability Zones” effectively let you deploy your apps into different “zones” (probably different physical data centers) to protect against outages in a single “zone” or the internet around that “zone”.  This feature also supports regions, currently only us-east is available.

Where this gets interesting is when they add some more regions.  Amazon promises faster performance between servers in the same zone, so it seems necessary that at some point,  they’ll ensure that you can load your S3 content from the same zone your server’s in.  So now you have a geographically distributed network of servers that can delivery large amounts of content and handle any spikes in server or bandwidth demand.  Hmm… sounds like a CDN.  You can imagine someone building an entirely new CDN based entirely on Amazon Web Services (or should we call it SkyNet?).  Or is this the beginning of Amazon exposing the internal plumbing they’re putting in place to make S3 itself behave more like a CDN?

SkyNet (AWS) just keeps getting more interesting.  At least until it becomes sentient and sends an army of giant robot dogs after us.

09
Feb
08

SoCon08 – 5 Events That Changed Our Lives Since SoCon07

Jeff Haynie is kicking off the day at SoCon08 with a quick hit talk on the mega events that have transpired since the last SoCon

  • Facebook Platform  – the critical mass on Facebook and the explosion of apps on the Facebook platform have changed the internet dramatically.  As I mentioned before, I think this is more interesting as an idea than as a direct advantage for Facebook.  Facebook will struggle with democratization of social applications across the web, someone else will embrace this and out-innovate Facebook on the distributed social app and platform front.
  •  iPhone – The iPhone has taken the lead in the smartphone market at a remarkable pace.  I don’t fully understand the phenomenon, but that doesn’t mean I can’t observe it.  Much like the iPod, there are tons of pre-existing competing products that had a superior installed base last year, but the iPhone, like the iPod before it, has been the rock star that can attract peripherals and applications at a rate other, more “open” (install an app vs. Jailbreak), platforms have not.
  • Radiohead – released their album digitally on a “name your price” basis.  Thisis a potential tracer bullet in the modernization of the music industry.
  • Guitar Hero – Guitar Hero III was the largest game product launch ever.  The game industry is growing, the definition of who is a gamer is growing.  Wii is probably a big factor, possibly a bigger factor than Guitar Hero.  But Jeff’s folks play Guitar Hero on a Wii on Fridays anyhow, so it’s easy to mention both in the same breath.
  • MySQL – Sun bought MySQL for $1 billion.  To me, this is an ongoing validation of the open source business model.  The valuation is the big game-changer here.

A decent rundown, recognizing that not everyone in the room is neck-deep in technology every day.

Leonard Witt is following up with things he has learned in the passed year:

  • Pay attention to the frivolous – things like Twitter seem silly at first, but once they find their place, they can be tremendously powerful.  Given my recent adoption of Twitter, I totally understand this point.  So what’s frivolous right now?
  • “Free Revealing” – Give your ideas away. Len mentions that he blogged an idea he didn’t have time or money to pursue, and someone pursued him to give $50k to make the idea happen.

I’ll cut it off here – we’re about to get into some crowd-driven conversation about “what will be your big event for 2008″, and how far we’ve come from 2007?  I don’t think my blog fu will be able to keep up.

04
Jan
08

Fearless Presidential Predictions

With the Iowa Caucuses concluding tonight, Republican Mike Huckabee and Democrat Barack Obama securing their respective parties’ convention votes for the presidency, it seems to be as good a time as any to give my own prognostication on how all of this is going to shake out.

On the Republican side, I see it coming down to the wire between Huckabee and Rudy Giuliani.  Huckabee is the candidate the religious right has been looking for.  He’s the candidate some people hoped they were getting in Fred Thompson, but Fred is reputedly either lazy or health-hampered.  Most of Fred’s supporters will defect to Huckabee after Super Tuesday, if not sooner.  Romney was the early frontrunner to carry the banner of social conservatives in this race, and it is only a matter of awareness that keeps many of them from defecting to Huckabee.  If being Catholic was a large challenge for JFK, being Mormon is a gargantuan challenge for Mitt.  Once the social conservatives leave his camp, Mitt ceases to be viable numbers-wise, and much of his New England and business-minded support would probably fall to Rudy.  John McCain polled acceptably in Iowa, but he is damaged goods.  It’s very hard to imagine a scenario where he regains the broad support he had 8 years ago, and easier to imagine that he drops out before February 5th with dwindling numbers in the next few states.  Giuliani is the politically spiritual successor to George W. Bush, and as much as that may alienate some, it appeals to a large portion of the GOP base and his perceived electability in a general election makes him a favorite for Republicans most concerned with retaining the presidency.  Although I personally appreciate the ideas and person of Ron Paul, the GOP seems more concerned with legislating morality at the national level than the constitutionally federalist approach to fiscal and social policy which Paul espouses.

On the Democrat side, the quick answer is not-Edwards.  I continue to find Hillary Clinton’s wide support to be fairly inexplicable in that I have yet to meet a staunch Hillary supporter, much less one that can provide a logical explanation of why she is appealing as a prospective President.  I suspect her key supporters are the establishment-minded members of the Democratic Party and people who believe strongly that we need to elect a female president.  Obama is the rock-star candidate of the party, and throws around big yet vague ideas and speaks about hope.  Most non-political-establishment people I encounter who are left-leaning seem to favor Obama.  If ever there was a time where we could elect a President based on style rather than substance, it is now, and this has the potential to benefit Obama greatly.  Obama has the better shot at becoming President.  Hillary has horrendously high negative numbers in a general election – the GOP would have a field day getting the vote out to vote against her.  If Obama is willing to bring on some serious advisors to turn his audacity of hope/hype into detailed policy that he can articulately describe, the presidency is his for the taking.  Without this, he risks annihilation in the general election because his current policy initiatives are high on hyperbole and low on detail.

Guess at the final outcome?  Giuliani over Clinton in the general.  Huckabee over Obama is also easily imaginable.

01
Dec
07

Startup Weekend Part 3 – Testing my Skribit Widget

Go ahead and make a suggestion:

Skribit: Social Suggestions

01
Apr
07

April Fools Curmudgeon

I’m an April Fools curmudgeon.  I’d rather the day didn’t exist at all.  Not that I don’t mind a good joke, and not that I tend to get fooled by anything – I just don’t like spending March 31st through April 2nd debating whether any of the news I’m reading has ANY basis in reality.  I thrive on new information, new and interesting happenings, and so having to ignore blogs, social news sites, and pretty much anything involving the internet for these days is information withdrawal.  Bah humbug.





Follow

Get every new post delivered to your Inbox.