Josh Peck - Nerdlog »

Amazon FPS SigHelper for Ruby

I spent a little more time hacking on Amazon FPS today. Ended up needing a signature helper that worked, and after a couple hours of messing with the one provided on the website, I ended up building my own.

The old one attempted to implement the raw RFC in the library itself. I opted out and used the openssl libraries. Sure, it doesn’t work on windows without some effort, but I don’t need it to.

require 'openssl' require 'base64' require 'uri' require 'cgi' # Provides a simpler signature helper than the one currently provided # by the community. # # Dependencies: # * OpenSSL # * Base64 # * URI # * CGI # # Usage: # SigHelper::get_encoded_url('http://example.com?a=1&b=2&c=3', 'AWS_SECRET_KEY') # module SigHelper def self.get_encoded_url(url, key) # Parse URL and set up vars uri = URI.parse(url) t = String.new q = CGI::parse(uri.query) # Sort and re-form sorted query string t = q.keys.sort.collect{|k| "#{k}=#{CGI::escape(q[k].shift)}" }.join('&') uri.query = t t = uri.path + '?' + uri.query # Generate signatures hmac = OpenSSL::HMAC.digest(OpenSSL::Digest::Digest.new('sha1'), key, t) sig = Base64.encode64(hmac) # URL-encode signature and return new url sig = CGI.escape(sig.strip) uri.query = uri.query + "&awsSignature=#{sig}" uri.to_s end end

Of course, this allows you to say something like this:

uri = URI::parse(SOME_URL) signed_url = SigHelper::get_encoded_url(uri.to_s, AWS_SECRET_ACCESS_KEY)

amazon-fps-ruby 0.1.0 Released

amazon-fps-ruby version 0.1.0 has been released!

http://code.google.com/p/amazon-fps-ruby/

Provides a simple wrapper around the Amazon FPS SOAP web service.

DESCRIPTION

Supports all features in the WSDL from Amazon:

http://developer.amazonwebservices.com/connect/kbcategory.jspa?categoryID=125

CHANGELOG

0.1.0 / 2008-11-07

  • Initial Release
  • Publish as a gem

http://code.google.com/p/amazon-fps-ruby/

Stupid Pointless Patents

It all started innocuously enough. I was talking to a colleague recently and
through no fault of our own, the conversation turned to intellectual property.

He boldly stated:

“What you really need to do is to apply for a patent for your [software]
technology”

It’s too bad really, I used to think he was smart…

For me, patents have always been a tradition of a bygone era, almost like a
land-line telephone or dial-up internet. Patents addressed a problem that
doesn’t exist in software and most of modern technology. Sure everyone wants
to patent their invention because it seems like the thing to do, but is it
really?

Three things happen when you apply for a patent and two of them are bad.

  • Someone reads you patent documents, makes a trivial modification to it and
    uses it in a way that’s virtually impossible to prove. (50% probability)
  • Your legal fees eat all your profits for the next 5 years. (60% probability)
  • Everyone respects your patent, thinks you are a genius, and throws money at
    you to use your technology. (0% probability)

Read more »

The MySpace Spamularity

It’s finally happened. MySpace has reached a point where it now defies all
laws of physics and creates matter (SPAM actually). Recently, for reasons that
are beyond explanation, I logged into my MySpace account. This would normally
be a non-event, since I have only a few links in my MySpace profile, but this
time I noticed a strange occurrence.

During the time that I was logged in on my MySpace site, I receive about 10
SPAM messages from MySpace users advertising various websites (mostly porn).
So I logged in the next day to delete the SPAM and while I was logged in, I
received another 20 messages that were porn-SPAM.

When users are punished for using your software, but they still use it, that’s great Web 2.0.

Ok, this is hilarious. The amount of MySpace SPAM I receive is directly
correlated with the amount of time I spend logged into the system. The more I
log into the system to delete the SPAM, the more SPAM I receive. Their system
actually provides a disincentive to use their site. Awesome!

Here, in a highly scientific graph, I display the effect.

MySpace Spamularity Graph

As you can see, as the number of users of a site increases, the level of SPAM
sent to those users eventually reaches a SPAMularity, where the entire system
exists for the purposes of SPAM and SPAM alone. The site becomes completely
unusable for anyone other than a SPAM-bot and over time, SPAM-bots become the
site’s only users. But here’s my question…

When only SPAM-bots use MySpace, will advertisers still advertise there?

If so, I should be able to design the ultimate Web3.0 application that skips
the troublesome middle part of _being useful to users_ and _gaining traction_
and just write my own SPAM-bots. If I can feed the system enough SPAM-bots, I
should never have to have a single living, breathing user on the system, but I
should still be able to generate advertising revenue based upon the number of
users and page hits per day, right?

Ok, that’s it, I have to build this thing, but what should I call it? MySpam?
SpamBook? SpamSpace? Spamster? Email?

Border Rivalries and Team Dynamics

Against my best instincts, I recently began using Facebook. While on the site, I managed to stumble into a message board where there was some discussion of where the best hamburger in Kansas City could be obtained. My interest was piqued immediately, since I do love a tasty burger. I prepared my saliva ducts and began reading the comments, foolishly expecting that the discussion would center on the finer attributes of culinary delight that can be received when the Chef du jour is an acne-ridden 16 year old.

However, within 5 comments, the thread had completely devolved into a discussion of the cultural heritage of the commenter. When reading this, it became clear that there was a major rift between the people who live in Kansas City, Kansas versus those who live in Kansas City, Missouri. By the time the thread reached about 20 comments, the discussion had completely devolved into a discussion of who was the worst driver.

Apparently, all Kansas drivers believed that Missouri drivers were the worst and all Missouri drivers believed Kansas drivers were the worst. Now, we all know that Oklahoma drivers are the worst drivers in the known universe, but they were ignoring this simple fact and critiquing each other’s driving habits ad nauseam. So, here’ my question…

Why does someone’s driving acumen have anything to do with their taste in hamburgers? Even more importantly, why is it that everyone believes that their neighbors are the worst drivers in the world?

Read more »

© 2008 Josh Peck - Nerdlog is powered by WordPress