Sunday, April 26, 2009

Hate On Your Job

Those around me and following me on twitter are likely already have heard me rambling on and on about my new site, Hate On Your Job. For those of you that haven't, I'll explain the premise, as if it's not blatantly apparent. The idea cam from being frustrated at work one night, and generally, I vent my frustrations out on Twitter. However, I quickly recalled all of those stories you hear about people getting fired for saying something absolutely stupid on Twitter. Wanting to keep my job that night, I opted to just not tweet my frustrations on that particular topic. After all, it was a fleeting moment not really worth the words, and customers of Contegix, along with co-workers (And my boss), follow me on Twitter. It wouldn't have been very intelligent to make such a stupid tweet. Then I thought about how nice it would be if there was a place to make the same tweet, but without the consequences. Thus yet another site was born.

To keep things "tweet-like" I forced a character limit of 200, because 140 didn't seem like enough to really say what you had to say. I had to be able to link the hates to something, so we obviously have the companies that our hateful entries belong to. Finally, each company belongs in a category, allowing for somewhat easier browsing. A full listing of companies is probably still going to be necessary at some point, which is something I'm looking into. Obviously, implementing it isn't difficult at all, thanks to our wonderful friend Django. I guess I'm more or less looking for a graceful way to present all the companies in one giant (paginated) list that doesn't look ridiculous. Between the recent company list, the search feature, and the categories, finding companies isn't too problematic though.

I do owe some major props to a few people. First and foremost, Mike Bishop of The Able Few for the amazing design he whipped up for the site. It loads with the quickness, it's easy to read, and just looks fantastic. Definitely better than the original design that I haphazardly slapped together :). I also leveraged a few Django add ons as well that saved me ample amounts of time. I knew I was going to need some form of CAPTCHA to prevent bots from owning my site, so I checked the glorious Interwebs to see what I could find. I figured it wouldn't be too hard to leverage PIL to come up with something on my own, but what's the point if someone's done it already, right? I opted for Django Simple Captcha. It had decent enough of documentation, appeared bug free in my testing, and has been pretty solid thus far. I had to make a few manual edits to the app itself in order for it to work fine in Python 2.4, and to extend the string length. Basically, time spent messing with captcha was reduced to about 25-30 minutes. No complaints here!

Then I decided I'd like to have some form of voting system, but at the same time I didn't want user accounts. After all, this is anonymous, so user accounts are the wrong way to go. Since I didn't have a session, that made voting incredibly exploitable. At first, I thought "Maybe the honor system will work", and just had the most basic vote system in place. Basically, you could sit there and vote all day if you wanted to, over and over and over again. I didn't think it'd be a problem, until a friend of mine thought it'd be funny to setup a curl in an infinite loop, and watched the votes sky rocket. Obviously, the honor system is flawed, and I knew it would be. Call it wishful thinking I suppose. Hence, I dug around a bit to see what my options were. I didn't want to tie votes to IP addresses, since that's going to have a problem for people behind NATs. I didn't want to create a situation where a whole office gets to vote all of once, didn't seem fair. That's when I found Django Secret Ballot. It creates a hash based off of the user's user agent, and injects that to the cookie. All votes by that user are then tied to that. So far that's been working quite while, and has been curl proof thus far.

Lastly, I also leverage the python-twitter package as well in order to push new hate entries off to Twitter. Why create an RSS Feed system when Twitter can basically serve as an RSS feed for me? Besides, I think people use Twitter more than RSS feeds nowadays. If you're interested, follow @hateonyourjob. It was kinda fun putting that in place though, since Twitter was down during my testing. Of course the very last thing I checked was for Twitter being functional and instead hacked my code to pieces four or five times first. Way to go me, eh?

Anyways, I really just wanted to document the "making of" the new site. Hope you enjoyed it, and hope you enjoy the new site.

Saturday, April 11, 2009

All Quiet on Some Front

I think it's the western front, but I really can't remember the quote/name of the movie or wherever that line came from exactly. Does remind me though... How do you determine what the western or eastern front is in a fully global war? Is a war with Japan the eastern front until they encroach enough to officially be on the western side of a flat map? Wait, I think I had things I actually wanted to talk about, and this whole front thing is just a distraction. Which reminds me, I've been using the term 'red herring' a lot lately (and correctly I might add). Wonder what that's all about. Shit, I'm doing it again...

So yeah, a lot of things going on lately. New people at work, new customers, but not really anything Earth shattering in regards to new tech, or crazy fun stuff to play with really. I think 1st and 3rd shifts get all the fun tickets because it seems like I mainly get the "Oh crap" tickets. Not that I don't like those, or that they aren't valid tickets, because they are. I just don't get too many "fun" curve balls anymore. I still get curve balls, but not of the fun variety lately. Then again, April's always a bad month for me. My birthday's in May, and I always try to have something cool planned for that. Then on top of that it seems like cool things occur in May. For instance, I should be going to San Francisco for that Atlassian Summit. We might also have our new offices finished in May as well. I suppose the excitement of May just makes April a chore to push through.

In regards to the Atlassian Summit though I'm pretty excited. I'll be giving a presentation there about an internal project I participated in to automate documentation of servers. At least, that's the game plan. The presentation's supposed to be like 20 minutes long though, and honestly, I'm not sure if I've done anything interesting enough in my life to talk about for 20 full minutes. I'm going try to make it happen though, because the project is pretty sweet. Magically having documentation for some 500 servers without lifting a finger is sweet. It's helped billing, sales, and support in the end, so it's been a well received project thus far. Anyways, I don't have a segue (btw, whoever decided that's how that word should be spelt, I hope your dead, and the death was painful) to my next topic really... so I guess, we'll just jump to the next topic or something. Alright, let's go.

I've been working on another site built with Django lately. It's not quite finished, and still needs a bit more work before I share it with the world though. All I can say thus far is that it's my answer to the problem of people getting fired via Twitter. I'm fairly excited about it mainly due to the fact that I learned significantly more about Django with this application than I did with my blog. My blog here is nice, but I cheated in some aspects to get it up and running the way I wanted. Going in now to add new features and such is a bit more painful due to some silly moves I made in hammering this out. Most of my silliness has been in the templates at least, so I haven't made a mockery of proper database design or anything crazy. The next aspect of the new site I want to work on is leveraging caching with memcached. It won't really be necessary for this site (I can only dream it'd be busy enough to warrant it), but it's something I'll need to learn someday.

Anyways, that pretty much sums it up for this post. Nothing too interesting or fancy I guess. I do plan on dropping some more Python tutorials at some point, but I'm still working on them. I'd kinda like to open source and explain the Deployment Django app that I previously blogged about, but I think licenses firmly remove that option. Not sure... Besides, I'd have to finish the application in order to do that anyways, and I haven't found hardly anytime at work to actually dig into it. Ah well, another scrapped project frollicks in the dust :)