ruby-mp3info gem

Posted by greg Sun, 28 Sep 2008 04:18:00 GMT

While working on the first rev of isfuckingawesome.me I needed some code to help me read the duration of an mp3 file. I came across ruby-mp3info and decided to use it. This little nugget of a library reads all the id3 info baked into your audio files. My design was simple (or so I thought): serialize the mp3info object for each post saved with an audio file.

Everything was working fine until that one user decided to upload too large of a file. The webserver upload threshold is set to 50MB. This is pretty large and I know I tested it locally uploading at least a couple of different 40MB+ files without discovering this problem. I’m not surprised because that’s usually how it works.

It turns out the mp3info object stores the binary blob in the db when serialized. And what do you know? MySQL has a a defalult upper limit on how much data is allowed per column. And what do you know, again? MySQL chokes if the size of the binary text exceeds the limit of the column. Whoops :) I can adjust this but I’m not going to futz around with default column limit right now.

Without monkey patching (which isn’t really something I want to spend an elaborate amount of time on), it doesn’t appear removing the blob before writing to the DB is an option. So, I’m going to cut my loses on this one and only save the values I really need access to (duration) and nothing else (like genres, title, track, etc). Sometimes, you need to know when to fold them. My gambling is done.

Rev 2 coming in the next few days…

Are you Fucking Awesome

Posted by greg Fri, 12 Sep 2008 15:31:00 GMT

One of the projects I’ve been cranking on lately is a little mixtape meets micro-blog service.

Rev1 is up now and ready for consumption. It’s called isfuckingaweso.me. Right now, Jeremy and I are officially spreading the awesomeness. With any luck maybe more will realize their lifelong dream of being awesome, too.

I’m not sure what the future holds for this project. The current goal is to keep it absolutely simple. Register and you’ll get a subdomain with your username. Upload mp3 and images and create short but sweet blog posts. Feedback welcomed, so let it flow!

Ruby Gem Upgrade to 1.2

Posted by greg Wed, 03 Sep 2008 00:33:00 GMT

I have a 256slice running on Slicehost. Over the weekend I tried to install the neat little gem, cheat. Why is it the simplest things never go as smoothly as planned? I issued the command ‘sudo gem install cheat’ and sat there waiting while it tried to bulk update my local gem repository. After about five minutes, I noticed it wasn’t updating like it normally does. In that time, my swap usage went through the roof, err a, I mean stack.

It turns out there’s a nasty memory leak in gem release 1.0.1 (I was a few point releases behind). No problem, I thought. I’ll simply update to gem version 1.2 which addresses a lot of the problems I was experiencing. Before doing this, I received an email from Slicehost support telling me I went way over my alloted swap usage. I replied back telling them my situation and promptly received an email from their support crew. And yet another reason why I love my Slice!

I thought I could simply perform a ‘sudo gem update –system’ and have it automatically bump my gem version to latest rev. Nope. It still tries to bulk update, first. So, now what? Another problem I’ve been experiencing with my Ubuntu slices: My local shell times out after a few minutes of inactivity. This is the kind of sheer madness ones grows accustomed to if you aren’t trying to perform long running tasks. Slicehost support was kind enough to point me to a fix for this problem. A few ssh_config tweaks later and everything seems to be all good.

Now, onto to the more pressing matter. It turns out every Gem release also has an incremental update version you can download and install directly without using gem to manage it for you. Outlined here, all you need to do is this:

  1. Download the update version to your machine somewhere. (command: ‘wget http://rubyforge.org/frs/download.php/38844/rubygems-update-1.2.0.gem’)
  2. From that same directory: ‘sudo gem install rubygems-update-1.2.0.gem’
  3. Issue command: ‘sudo update_rubygems’
  4. Clean up after yourself by removing the rubygems-update-1.2.0.gem package you just downloaded
  5. Better living through Gems is just like it used to be!

Party on Interwebs…

Holy Shrine of Awesomeness!

Posted by greg Fri, 18 Jul 2008 04:50:00 GMT

I started a Ning network today called, I’m So Fucking Awesome. All awesome humanoids are welcomed to join. Contributors welcomed.

National Awesome Awareness Day is coming up. Please pass the good word along to anyone you feel is awesome. If you’re awesome, please share it with as many people as possible.

Flash AS3 Packages

Posted by greg Tue, 08 Jul 2008 14:53:00 GMT

I’ve been futzing around with Flash lately. This application is the main reason I ditched my abacus and started down the path of web development almost 10 years ago. Alot has changed since Flash 4, though. One of the changes in Flash 9 and AS3 is how you define packages.

A package is nothing more then a namespace which contains a class or multiple classes. In the following example, I have a package of ‘com’ and class inside it called Example. Typically, you name packages with lowercase and classes in CamelCase.

package com {
// import statements go here...

 public class Example extends MovieClip {
           // declare instance variables here....

            // constructor
    public function Example() {}

        //methods go here...
     }
}

OK, great. You’ve created a simple package and class, now what? Well, a package namespace is nothing more then logical representation of your filesystem.

Inside your next flash project, create a folder called ‘com’, and copy and paste the above code into a file called, ‘Example.as’.

/flashproject/com/Example.as

Now, from your actionscript, you can import this class by calling:

import com.Example

Let’s say you create another class called, ‘ExampleToEndAllExamples’ and want to include it an the ‘Example’ class above, just do this:

import com.*

The ‘*’ tells the import statement to include all the classes it finds inside the com namespace.

Now, what to you do if your packages aren’t located inside your flash project folders?

Well, you can always add a classpath to the packages by creating a new entry:

File > Publish Settings > Flash > Settings > Click the Target icon to browse to your packages.

There you go. I hope this helps.

Google Apps For Your Domain

Posted by greg Tue, 24 Jun 2008 20:08:00 GMT

I use Google Apps for Your Domain on a few of my sites. Mainly, to send email through Gmail from my RoR applications. (See my earlier post for help with this.)

Most recently, I discovered a nasty gotcha with using GAFYD a few days back. The basic problem for me started when my application began returning messages like, “The daily quota has been reached,” or something to the effect.

GigaOM has a nice post about the crappiness and general unhappiness his team is starting to feel since switching over to GAFYD. I actually commented on his post which was the inspiration for sharing it here with all my esteemed readers ;)

Well, I don’t share Om’s same sentiments. Partly, because I’m sure the volume of email I send through GAFYD hails in comparison to the great crew over at GigaOM. I do feel that there’s something missing from all the documentation Google provides to sell you on this service, though.

After digging around, I discovered each mail account is limited to 500 emails a days (free accounts) or 2000 a day (premium users). Now, is 500 or even 2000 emails a day fair? I think 500 a day is fair for a free service but I have a problem with a cap of 2000 if I’m a paying customer. This is ridiculous.

I’ve also read Gmail filters potential spam messages by monitoring the number of recipients for each email you send. There seems to be a general acceptance the number of recipients you can send a message to is around 50. So, make sure to avoid adding your entire address book next time compose an email.

In general, this is a good rule of thumb anyway. I can’t fault them for this, just not sharing this anywhere (I can find) in the GMail FAQ’s. One last ‘feature’ are BCC recipients could also raise a flag somewhere in its system. I haven’t confirmed this with them – just reiterating what I happened upon in a google group thread discussing this same topic.

Knowing is half the battle.

Who Knew?

Posted by greg Wed, 14 May 2008 17:44:00 GMT

Alright, I was a founding member of the now defunct, steamy, boy band, eMale.

Those were the days. I recall our first gig. I came home with more panties (even 1 pair of manties, thanks Leo!) then I knew what to do with. So, I donated them to Goodwill and got a little tax relief that year. I needed it, ‘cause we made a killing after playing the Konacti Harbor in late 2000.

I really don’t have too much to show for my time in the most ultimate boy band, ever. I mean, our vocals were even replaced with two pastie white guys, whom they told us knew how to ‘sing’ better then we could. I mean, come on, who were we kidding? We were just accoutrements to launch Marty’s insanely awesome, career all along.

We might have a reunion tour in the works. Hell, if New Kid’s can do it, why can’t we?

XOXOXOX, Duke of URL

Google App Engine: Templates

Posted by greg Thu, 08 May 2008 17:51:00 GMT

Google App Engine comes with Django templates support built-into the framework. All I can say is, WTF? Fundamentally, I believe in clean separation between display and logic. But what I have a problem with is the Django philosophy that python has no business inside the template. What? I can understand this thinking if you hired a bunch of retards to code your application. Bad things can happen to kids with no supervision. But come on! This is fascist. I believe your framework should work for you and not the other way around.

After digging into Django templates for a few weeks, I decided it wasn’t for me. Too much of my time was being devoted to writing custom tags which eventually would be replaced with python during the template compilation. I surveyed what else was out there. Right now, I’ve chosen to use Mako templates for the one simple fact: life is too short to deal with an extra layer of bullshit.

It appears using mako’s template caching with GAE is a no go, too. But this is a GAE thang since it doesn’t allow writing to disk. However, you can write python in your templates. I use Cheetah for building pages at my work. It’s pretty good, too. It has its quirks and from what I’ve read, it also works with GAE with minimal monkey patching.

One other thing I find odd with python web development is having to explicitly render a template and bind all your variables to in the first place. But this is also just me getting used to the pythonic way of life. This is just something I’ve taken for granted with .NET and Rails. There’s got to be a way to remove this extra step for every python controller action I code from here to eternity.

So there you go my devoted faithful… Learn it, live it, code it.

Google App Engine is GAE

Posted by greg Tue, 22 Apr 2008 20:23:00 GMT

I’m sure you’re aware of the recent release of Google App Engine? Yeah, it’s GAE. I signed up and received a free developer account the minute the ‘open for business’ sign went up. I’ve been tinkering with it ever since.

Google App Engine makes prototyping and hosting a spray-and-pray website (you know where you throw some shit(es) at the wall to see if they stick?) super easy. Currently the limitations on the service while they continue to fine-tune the gears and cogs are adequate enough to see if you have a hit on your hands. The integration with the existing Google user-base is worth it to me alone. If this eventually works with OpenID then I’ll take two.

On the other hand, I’m also a little skeptical about giving Google all the keys to your castle. You know? If they managed to rip campfire off to showcase App Engine’s potential, what’s stopping them from taking your code and slapping a beta sticker and ‘g’ in front of the name?

App Engine supports Django templates and form submissions. I’ll let some Django-istas talk about how well this works or doesn’t since this isn’t a framework I’m super familiar with. My Python skills (or lack of) are currently only at best a yellow belt level. I know, I hear you saying, ‘Sweep the leg Johnny! Sweep the leg!’ I’m working up to that part.

One of the first things I’ve started to play around with is adding Rails-style routes. ‘Uh, why don’t you just use Django and be done with it?’ On one hand, I’m not looking to reinvent the wheel but just adding this feature ultimately led to me digging into most of the source code. Can you say link_to(‘home’) in python? I can :)

I even added the ability to ad layouts similar to rails. Actually, I did this as my first little project. But then I found out you could base-class Django-templates. DOH! Oh well.

Now what? I’m not sure yet. Let me know if you’re interested in the routes source and I’ll post it for the 4 spammers who read this blog. Earlier today, I discovered this open source project for porting the major pieces of GAE to the Amazon Cloud. Hilarious! Check it out here.

This is starting to become really interesting. Cloud computing is one area I believe Yahoo! entirely missed the boat on. The rumor-mill also says Microsoft could also be getting into this game, too. I say the more the merrier. All this competition will keep costs down and give me more things to play with.

Goblr Lives!!! 2

Posted by greg Tue, 26 Feb 2008 17:24:00 GMT

Alright, I admit I learned my lesson about serving a rails site in a shared hosting environment. The biggest takeaway is to make sure and freeze your gems and rails itself. This way your site will continue to run when changes are made to the shared hosting environment.

Case-in-point…

Goblr is ugly as sin but it served as my first attempt at coding a rails site. It was the perfect vehicle for me to learn about all the nuts and bolts which were part of rails 1.2.3, unix admin, and mysql. I put zero emphasis on the UI and concentrated more on the back-end development and feature sets. One of these days, I will contract with a designer to sizzle up the GUI. It’s flat out embarrassing, I know. But sacrifices must be made. It would still be on my dev machine if I sought perfection.

The problem started back in December when rails went version 2.0.x. My hosting company OCS Solutions automatically upgraded to the new and improved version. This wasn’t a huge deal, I suppose, except Goblr went down instantly. I ended up freezing rails to the last version I knew it worked with and the problem didn’t go away. This site gets relatively zero traffic – except for hordes of Muslims trying to sneak a peak at burka wearing belly dancers. So, I didn’t mind it was down at the time. But I also didn’t want it to go to the deadpool.

Last night, I was looking at some traffic reports and Goblr hadn’t flat-lined like I thought it did. WOW! I’m not sure where the magic happened but I don’t care. It lives in all it’s hideous glory. Now, I say this half-jokingly of course. If the site had any sort of traction I would’ve fixed it instantly. All of this just happened at the same time I was trying to finish the first version of Squabl so it was the last thing I wanted to deal with at the time.

I’ve since moved on to a different hosting provider (Slicehost). Some of my earlier iterations of the Goblr video feeder were huge memory hawgs. And I mean huge. It wasn’t uncommon for it to use up 250-300MB of memory while it was running. OCS would manually kill these processes if they ran too long. Some of the bigger feeder jobs would take 6-8 hours. Anyway, OCS is a great hosting provider if you’re looking to cut your teeth in a shared hosting environment. I’ve never once had any of the same problems I had with my brief stint on Dreamhost. OUCH! That was painful. Big ups to the OCS team for putting up with my newbie on rails shenanigans!

Older posts: 1 2