Amazon Elestice MapReduce

A new service by Amazon has surfaced. It combines their computing cloud with their storage surface to bring the power of super computers into your backyard. It is meant for heavy and intensive jobs like web indexing, log analyzing, or even scientific simulation. It is basically an automatic interface that will create your computing cloud instance, allocate the proper resources, do the job, then remove the computing cloud instance. You only pay for the resources you use.


http://aws.amazon.com/elasticmapreduce/

A Developer’s Furniture

I recently had someone at work call me a furniture expert. I don’t know if I’m an expert, but I sure am very particular about my work space and with good reason. For someone that spends as much time as I do in front of a computer, I need to take care of myself so that I remain efficient, comfortable, and durable. It starts with the chair. You should never get a cushy chair, this will only promote slouching and will lead to back problems. Get a chair that is firm, put it up as high as it will go, and lock the tilt mechanism. Uncomfortable? Maybe a little, but your back will thank you.

Since I’m a developer, my stress ball mouse and keyboard get the most action at my desk. Don’t EVER get a wireless mouse or keyboard. I have tried almost 20 different models, and every wireless device that I tried had some delay, or simply didn’t register my key strokes. Maybe I just type faster than electrical impulses travel… Get a mouse with a high DPI setting, this will typically be a gaming mouse. However, DON’T get a gaming keyboard. Be sure to get a smooth, cute EXPENSIVE mouse pad as well. To top it off, get a wrist rest (with beads) for your mouse wrist, and use an ergonomic keyboard that will keep your wrists straight with your forearms.

AMember Cancellation Script

This script is a basic API to expire a membership in AMember. It will look up an AMember account based on AMember ID, or email, or first and last name. It will then set the expired date for a subscription to a date in the past. The effectively cancels the subscription, but it keeps
all of the data intact in the database. This script does nothing to cancel payments, it just expires
the subscription.

This script is absolutely free to use! I hope that others can find this script helpful. If you have
any feedback or problems with it, please email me at tim@golen.net and I will try to help you out.

FEATURES
- Looks up an amember account by amember id, or email, or first and last name
- variables can be passed as GET or POST
- password protected
- expires accounts so all data is left in tact
- can be used by payment gateways to expire a membership if the payment subscription is cancelled
(see advanced use section)
- debug features
- sends an email on success and failure

amembercancel.zip

STANDARD USE

Expire a subscription by amember id

http://www.example.com/cancel.php?PW=scriptPassword&AmemberId=1

Expire a subscription by email

http://www.example.com/cancel.php?PW=scriptPassword&Email=test@example.com

Expire a subscription by first and last name

http://www.example.com/cancel.php?PW=scriptPassword&Email=test@example.com&FirstName=test&LastName=test

Some simple rules to follow:
- The password ALWAYS needs to be passed as a GET variable
- The other variables can be passed as GET or POST variables
- AMemberId OR Email must be passed
if it can’t locate the account by the email address it will attempt to lookup the account using the first and last name

ADVANCED USE

We use InfusionSoft for our CMS and have an action sequence once a credit card hits max retrys for
payments. At that point we use the HTTP POST feature to http://www.example.com/cancel.php?PW=scriptPassword
InfusionSoft will pass all of the contact fields through as POST variables, so we can grab the email
address and attempt to do a match on that. If we can’t find a match we move to matching with the
first and last name.

- 2009-11-28 Update: there was an error in the cancel.php file that wasn’t allowing the script password to work properly.

Amazon s3 Storage

Amazon has began offering a new service that many businesses are beginning to utilize. Unfortunately the brains behind the service didn’t put much thought into good documentation. I’m going to write some of the things that I have learned in using this service in hopes that someone out there won’t have to go through the mess that I did.

 Concept: The general concept behind their storage service is that you can host stuff on their servers for a price. Let’s say that you have a site that gets lots of traffic, and you store lots of images and videos. Since the amount of bandwidth caused by the images and videos strongly outweighs the simple amount of bandwidth from the visitors alone, if you move your images and videos to Amazon s3, then the bandwidth will be on their tab. This situation might not be feasible for everyone, but for others it is a great way to save a lot of bandwidth costs.

Overview: When you setup your storage, you create a “bucket”. Your bucket must be a unique name, and it’s used to identify your storage space. Once you have a bucket, then you can upload files to that bucket. You can then access those files anywhere on the net simply by a url like so: http://bucketname.s3.amazon.com/filename.txt

Sounds simple enough, right? Well, what if you want to control the access to your files because you don’t want them publicly available? There are a couple of solutions.

  1. Encrypt your files before you upload them to Amazon and decrypt them when you retrieve the files. If you encode it properly, then even though the files are public, no one else can decrypt them.
  2. Use Amazon’s built-in security access methods.

At first glance it might seem that the second option is the easiest route to go. HOLD ON! It actually turns out to be quite the ordeal to use their security access method. I will try to detail the security process as best as I can understand it. The security method can be handled in a couple of different ways (POST or GET), I’m going to focus on the GET method. This involves passing the necessary security information in the same url that you use to access the file and has the following format:

http://$bucket.s3.amazonaws.com/$filename?AWSAccessKeyId=$keyId&Expires=$expirationdate&Signature=$signature

That url is referencing the following variables:

  • $bucket – the name of your unique bucket
  • $filename – the name of the file you’re trying to access
  • $keyId – the access key that you obtained when you signed up for the service
  • $expirationdate – a date in the future when that link expires. This is kind of cool. It means that even if someone is able to intercept this link, they can’t access the file after the expiration date (Amazon sends back an XML error saying the link has expired).
  • $signature – this is what gave me the most trouble and I will go into detail on next (you really need to pay attention to this)

A couple resources that were very instrumental in me breaking through was a PHP class designed to interact with Amazon s3 using REST and CURL (as apposed to Pear which usually don’t come with the standard installation of PHP), and also a tool to help debug your signature.

Signature Tester
PHP Class

Amazon Developer Resource Center

Amazon s3 Getting Started

Amazon s3 Detailed Documentation

Authentication Overview

Query String Authentication

The $signature variable is an encrypted string that helps Amazon determine your request a little more accurately. It contains the following pieces of information:

  •  request method (“GET”)
  • expiration date (unix time stamp)
  • bucket name
  • file name

Each variable should be seperated with a new line “\n” character, and I have left out some variables that don’t need to be used. So, this is the signature string BEFORE it gets encrypted (with variables for bucket name and file name):

GET\n\n\n1325376000\n/$bucket/$filename

Once you have that string, then it needs to be encrypted using a 64bit sha1 algorythm. It must be encrypted using the secret key that you recieved when you signed up for the service.

So, that’s how you can get access to your files if they are secured by Amazon (and you’ve setup the security properly, which I’m not going to go into).

One question that I was asked is if you had 100 sites, how could you convert all audio and video over to Amazon s3 and have it be protected?

Well, the easy short answer is, it’s going to have to be done manually, it’s going to take a lot of man hours, and it’s going to be painful. The biggest problem lies with the “protected” issue. There are two solutions:

  1. Create the encrypted file URL by using a one-time script, and have the expiration date set to several years in the future. You can then use this link with a static html page and never have to update it again. Of course this does present somewhat of a problem because you expose your access key as well as the rest of the link which people can grab, so you’re no better off than if your files were publicly available to begin with.
  2. Each time that the webpage requests that file it has to dynamically create the encrypted URL. This requires that your server must have some server technology running on it like ASP, PHP, Java, etc..

So, there really is no easy answer. Although, if all of those websites simply had the audio and video stored on them, then people already had the ability to grab them, so there is no reason why they would need to be protected through Amazon.

Zune Firmeware 2.5 Upgrade Mistake

I tried to upgrade my Zune’s firmware to the new 2.5 version a couple of days ago and really messed things up. Everything was going fine until my Zune froze for 8 hours on a screen saying “Please wait. Do not disconnect device”. Well, I know the dangers of interrupting a firmware update, but I decided that if it had been at that screen for so long, then I could simply disconnect the device, reset it, and then try the upgrade again.

After disconnecting it, the Zune stayed on that screen. Plugging it back into the computer wasn’t working either because now it wasn’t even recognizing the device. I tried doing a reset (holding down the back and up buttons), but it just stayed stuck on that screen. I thought that letting the battery run down would help to reset it, so I ran the battery out and plugged it in last night… Same screen, same response from the device.

I did some research on the internet and think I know where I went wrong. When my Zune first stuck on that screen it was waiting for me to accept a user agreement in the Zune software. The idiots that designed that software put in two vertical scroll bars, and I used one of them to read the user agreement, but there was another scroll bar that had to be used to make the “Next” button visible. Due to that poor design, I screwed up the update.

I called Microsoft this morning and talked to them about it. The woman was very helpful until it came to the part where they needed to repair my Zune and it wasn’t under warranty. She said it would cost $195!!! That’s nearly the price of one brand new. I politely ended the call with her and proceeded to search the net for a place that would repair it for a reasonable cost.

I found a site called rapidrepair.com that claims to be fast, and they will do a free diagnostic on your device if you ship it to them ($8.00). Now that is a good deal! Since I don’t think there are any hardware problems, the firmware just needs to be flashed I think it should be a simple repair. I’ll ship it to them today and then wait to see how much they want to charge me to repair it. If I don’t like their quote, they will ship it back to me at no additional charge.

How the Internet Has Made My Life Better


The internet was a marvelous invention. I remember in high school when we first started using the internet, the one question I kept having was “If all those websites exist out there, how are you supposed to find them?” It’s come a long way since then. Here are some ways that the internet made my life better.

  1. It gave me a job building websites.
    I’ve been developing sites for about the last 5 years. I first taught myself while working the weekend graveyard shift at IBM. There was a lot of time to spare.
  2. I no longer have to take the salesman’s word for it.
    If I want to buy something, I can do my own research. I can read hundreds of other consumer reviews, find newer/better products, and find the cheapest prices. Get thou behind me salesman!
  3. I can get directions to anyplace easily.
    Mapquest was one of the first, but now Google Maps is amazing. Now they have street view… It’s kinda scary that not only can people find my house, they can see it too.
  4. I can throw away my yellow pages.
    I still have people dropping off phone books at my front door. What a waste of paper! What’s even funnier though is that when my parents come and stay with me, they ask for a phonebook.
  5. I can look busy at work when there is nothing to do.
    Sometimes when I have downtime at work, I just surf the internet… play games, read comics, post blog articles. The nice thing is that without looking at my screen, my activity looks just like it always does.
  6. I can give away my junk for free on Craigslist.
    A couple of weeks ago we cleaned out some stuff in our house. I didn’t know how in the world we would get rid of all that stuff, but I posted it for free on Craigslist. Within 2 hours everything was gone. I didn’t even have to worry about recycling that old CRT computer monitor! It’s like free trash collecting.
  7. I finally found a date.
    I used to do a lot of internet dating. I had some dates that were really awful. Fortunately though, I wouldn’t have met my wife if it hadn’t been for a blind internet date (no, I didn’t meet my wife on the internet, I was introduced to her through the person I dated from the internet).
  8. I was able to break-up without a face-to-face conversation.
    Email is an amazing way to communicate. I can tell someone whatever I want and don’t have to worry about being slapped for it (at least immediatly). Warning: Consequences for telling someone whatever you want might not happen immediately, but they will happen. People still have feelings.
  9. I can buy things without leaving my house.
    Online shopping is a must for today’s busy lifestyles. I can do an afternoon of shopping without putting my pants on! In the meantime my wife has to primp herself for an afternoon at the mall. I think we know who’s having more fun.
  10. I can share my opinions with others.
    You’re reading it… what can I say?

Trying to find freelance work

During the last several weeks I have found myself fervently trying to find some freelance work to fill in the gaps when my regular schedule dropped to part time. Here are some of the resources I used and some information about each one of them.

  1. ScriptLance (www.scriptlance.com) – at first glance I figured this was a winner. There was a lot of activity, it was FREE, and it was stuff I knew how to do. At second glance reality began to sink in. Think of this site as the internet version of a brothel. PHP developers sit around waiting to be used at the cheapest possible price. Not only are the quotes ridiculously cheap, but the people looking to hire a developer are equally as desperate. I do not want to get paid pennies on the dollar of what I’m worth, and I wouldn’t even want to waste my time copying another site. Development should be about creating a relationship with a company and producing something that they need and is useful. It shouldn’t only be about what the customer thinks they want. ScriptLance, I give you an F.
  2. PHP Freelancers (http://www.php-freelancers.com/) – Hey, let’s do the same thing that ScriptLance does, only not as attractive. I give you an F-.
  3. ContractedWork (http://www.contractedwork.com/) – They doing the same thing and they are charging for it. Also an F-.
  4. CraigsList (http://www.craigslist.org) – Ok, here I thought I was going to be able to find something worth while. Since I wasn’t willing to whore myself out to someone who doesn’t care what they are getting, I thought I would have better luck here. I started to search the job boards and noticed a problem right away. You can only search job boards per regional city. Since development can be done remotely, this meant I would have to manually search each cities job boards. Yikes! However, I found a lot of quality job postings, but this revealed another problem. No matter how many replies I sent to job postings (close to 20-30 in the past couple of weeks) I didn’t hear back from a single one of them. I give you a D.
  5. Face-to-Face Networking – I went to several tech meetings here in Boulder last week, and while they were fun, they were a big challenge. You have to be able to impress people immediately, and when you have a bunch of techie-geeks you can imagine the hilarity that ensues. I made several good contacts, but no real leads. I give you a C.
  6. Friends and Family – While the jobs do exist they are very rarely followed through. Plus you also have the problem of having to provide your skills at a discount. I give you a C.

Conclusion:

I was unable to find any good sources for freelance work that were acceptable to me. As a developer with 5 years of professional experience I am worth the money that I charge. When it comes to the type of companies that are looking for freelance work, they are very rarely an established business needing legitimate work. Freelance work in general, I give you a D.

Object Overloading

The most fascinating thing that I read in this article was about being able to dynamically create getter and setter methods. Over the years some of my class files have really gotten bogged down with having getter setter methods for every property. Now, using a single function, you can accomplish this. The author points out a couple of drawbacks however, the biggest one being that documentation doesn’t pick up on what’s happening when you use the __call() function.