Verbose Logging

software development with some really amazing hair

T + G I F R

Software Articles

The Philosophy of Naming Variables

· Posted in Software
Russ Cox made a good comment on the golang-dev mailing list about the philosophy of naming variables. He links to his original short post on the subject as well. A TL;DR version is that i makes more sense than index when you're looking at a small loop. For local variables that are only relevant for a short number of lines, having long verbose names actually makes them less efficient. As the context or reach of a variable increases, having longer…

Custom Scout Plugins For Lonely Sysadmins

· Posted in Software
When you run servers, there are certain things you need to know. When you're the only one running the servers, there are a few more things you need to know. One is the loneliest number Since I'm basically the only person running the servers keeping Yardstick Measure alive, I need to know as much as I can about them. More than that, I need to know things you might not really care about if you have a team of dedicated people managing the servers. …

NewRelic with Rails 2.3.x and Sinatra Metal Controllers

· Posted in Software
Our application at Yardstick is Rails 2.3.x, and we use some Sinatra based metal controllers. We also use NewRelic to monitor things. Get Low Something got updated somewhere, maybe the NewRelic gem, maybe something else. Our Apdex hit 0.3 or something stupid and stayed there. After a long debugging period going back and forth with the NewRelic folks, we figured it out. Problem, meet Solution The way a metal controller in Rails 2.3 works is that …

Do You Even Load Balance?

· Posted in Software
Recently at Yardstick, I completely rebuilt the server infrastructure for our high stakes online testing platform, Yardstick Measure. We need our data in Canada, so we have some physical servers running VMWare ESXi. I set up five front-end servers to run the actual exams on, and other servers that do other things: handle the database, the admin interface, search, redis etc. The front-end servers are load balanced behind a pair of firewalls confi…

Bash Brace Expansion For Less Typing

· Posted in Software
Named a file wrong? Need to move it to another directory? No big deal. What if you named a view file foo.haml instead of the proper foo.html.haml? mv app/views/widgets/foo.{haml,html.haml} Does exactly what you think it does. It expands to: mv app/views/widgets/foo.haml app/views/widgets/foo.html.haml Since it's just bash, it also works with git: git mv app/views/widgets/foo.{haml,html.haml} Works within the path too: git mv app/views/{widget,wh…

IE7 Eats Babies

· Posted in Software
But you already knew that, right? These days, in fancy AJAX applications, you frequently want a link on a page to just do asynchronous things. You don't actually want the link to go anywhere. Let's just ignore the fact that this goes against progressive enhancement okay? Can I see your ID please? So sometimes the link is important enough, and you throw an id on it and you can do this in jQuery. $('#important-link").click(function() { alert('trol…

Import Delicious To Google Bookmarks

· Posted in Software
You may have heard, but Delicious is getting the boot. I left Delicious long ago, because it never did anything for me. Yeah I could bookmark things, share them, whatever. I never went back to the bookmarks though. I wanted my bookmarks to work seamlessly with how I used the web. That means, it had to work with Google. Back in the day I used Google Bookmarks back when I was evaluating bookmarking apps in 2008 (when I settled on Delicious) and it…

kindlebility Open To The World

· Posted in Software
In my previous post, I talked about kindlebility, my little nodejs application for sending articles to your Kindle. It was initially just built for one person, but then I was like “screw it”, and opened it up to the world. I gave it a nice(ish) front page, an explanation, and a builder for the bookmarklet. I used zepto for the Javascript stuff, and the Google Font Directory for some nice fonts. All you need to do is drop either of your Kindle em…

Instant NoSQL Cluster With Chef, Cassandra, And Your Favorite Cloud Hosting Provider

· Posted in Software
Hi everybody! Okay, so don't worry, I'm not Dr. Nick Riviera, I'm not going to take your liver out. Well, not unless you need to sell it! I am going to tell how to get your NoSQL on with a little bit of Cassandra, a little bit of Chef, and a little bit of sensual.. NO NO NO! Nevermind, none of that. Seriously No really, we're going to get some /dev/null web scale up in this bitch But not with MongoDB. This setup is more suited to a Dynamo style …

Deploying Your Ruby App With Mongrel2

· Posted in Software
If you're in the ruby world, and specifically the web side of the ruby world (Rails, Sinatra, etc), you should probably know who Zed Shaw is. I mean, he only wrote mongrel, which you're probably using as your application server. Well, he's been hard at work on Mongrel2, and it's a big change from the original mongrel. Mongrel2 isn't a ruby web server. It's (and I'm going to borrow straight from the site): Mongrel2 is an application, language, an…

Restore Deleted Files In Git

· Posted in Software
Ever been working on a project for a while, then go work on something else, then come back after a few weeks? Sure you have. Ever come back and somebody deleted your nice nginx config file you had in there for your local dev server? Ever wonder where the hell it went? Well wonder no more! I had this happen a couple days ago. Somebody deleted my nginx.conf file. It was just gone. Find it! First things first, I had to find the file. A little bit o…

rack-gist - THE GISTS ARE NOW DIAMONDS!

· Posted in Software
Hello developers, how are you? Fantastic. Does your code look like mine? No. Could it load like mine? Yes. Should you use rack-gist to load your gists? I don’t know… Do you like not blocking your users while you page loads another Javascript file? Do you want code that looks like it could write your app for you in the dream computer it built for you with its own DWORDS? Of course you do. Recursive Hasselhoff! Into the best gisting of your life. …

sinatra-bundles 0.3.0 Is Out

· Posted in Software
Version 0.3.0 of sinatra-bundles is out and powering the blog for a week or so. It's cold out there, so bundle up: % gem install sinatra-bundles require 'sinatra/bundles' Version 0.3.0 has a new feature and a slight API change. Custom path prefixes Yeah, I know, not everybody is as awesome as I am with their stylesheets and javascript files in the stylesheets and javascripts directories, but now you can control where they live on the disk. docun…

sinatra-bundles 0.2.0 Is Out

· Posted in Software
I pushed up a new version of sinatra-bundles and it's running smoothly on my blog here, so I best tell you about it. First, get your bundle on: % gem install sinatra-bundles require 'sinatra/bundles' Version 0.2.0 has a couple fun things. The sinatra dependency is bumped up to 1.0, since it's out (yay!), it's more awesome, and I'm not quite sure if the bug that prevented me from using earlier sinatra was fixed or not in the 0.9.6 release. etag s…

Code Bubbles

· Posted in Software
This is seriously cool, and makes me want to write Java code. I'd at least like to try it out. Read up on it at codebubbles.org.

My Watch List, Into 2010

· Posted in Software
Lots of interesting things are afoot, and I try to keep track of them. Here's what I'm watching. Rails 3 Lots of new changes are coming with Rails 3, and it's pretty exciting. I wrote about some of the cool ones here. Rails is shaping up to be faster, more modular, and generally better and easier to work with. With all the smart people working on it, you don't have to look very hard to realize this is going to be a big release, and is only going…

Rails 3 Release Notes: What Does It Mean To You?

· Posted in Software
The Rails 3 Beta got dropped a few days ago, and the release notes for Rails were put out a bit before that. The list of changes is long; this is a big release. There's a lot to sift through, a lot to change to upgrade your existing application, and a lot to learn whether you are upgrading or starting a new app. The big question is: WTF does all this mean to me? Don't worry, I'm going to tell you. If you want to read the full release notes, go f…

What Todo Indeed

· Posted in Software
You’d think the todo list problem was solved by now. Email is solved. Google solved it. Srsly. If you aren’t using Gmail, what’s really stopping you? No, Yahoo! and Microsoft aren’t doing it better. Google wins. Spam is pretty much solved. Google once again solved it by sheer volume, you throw millions of emails at a Bayesian filter with crowd sourcing (that little button in Gmail? that’s crowd sourcing) and it gets pretty damn smart. Okay maybe…

Rewrite Git History For Make Benefit Of Glorious Internet Tubes Of The World

· Posted in Software
Sometimes you do silly things. Like check big binary files into source control. Ones that shouldn't be in source control. This causes problems. Okay, well not really problems, but it has some effects. Cloning the repository takes longer, of course, since there are big files, and other operations can take longer too. But fret not! If you need to purge files from Git, you can. Now, you can't just remove the file, since it's still technically in th…

Heroku Backup With Single Bundle

· Posted in Software
In case you missed it, the Coding Horror, Stack Overflow and Haacked blogs died in almost a literal fire. Well I don't think there was an actual fire, but basically they all hosted their blogs in virtual machines on the same physical server, and the backup process never backed up the virtual machine files since they were always in use. The backup process was managed by the hosting company and silently failed on these files. Oops. While I'm fairl…

Debugging Ruby By Aman Gupta

· Posted in Software
I wish I could see this guy speak. I learn so much just reading his slides and other writings, I can't even imagine what I'd learn if I was actually there. Debugging Ruby from Aman Gupta

swfobject, Meet jQuery

· Posted in Software
I was getting sick and tired of just blindly copying and pasting embed code for videos and every other flash thing I post. Naturally, being a programmer I had to do something about it. Enter jQuery and swfobject Check this out: Some embed tags that are provided are only of one type: either object or embed. This is no good since that means some browsers are excluded and it won't work. Lame! Swfobject solves the problem by using JavaScript to inse…

Unescape HTML With Javascript

· Posted in Software
I'm just passing this on, as I didn't do it, I just found it. Over here is a pretty slick way to unescape HTML. I ran into the need for this when I was working on some inline-editing code. I wanted to reset the contents of the textarea to the contents of a pre tag. The contents of the tag are of course escaped, but I want them to be proper HTML in the textarea. Using this trick allowed me unescape the contents easily and stuff it back in the tex…

Screen Scraping With Ruby

· Posted in Software
Scripting languages are the bomb. I pretty much live in them right now. Ruby is my current (and probably will be for a long time) favourite scripting language, and it has a library for everything. Even if there isn't a library for what you want, it's super easy to write your own. I ran into a problem a while back that ruby solved nicely for me. I was downloading wallpapers from a website, but it was getting annoying. Really, I just wanted to gra…

Programming With A Guitar

· Posted in Software
The Devexpress folks apparently have a little competition once in a while to show that their software kicks ass. The last one (as stated in the video) was a guy with a keyboard and no Devexpress vs the guy with chopsticks and a keyboard, but using Devexpress. Cool! Now they step it up and they have a Guitar Hero controller to write code. Badass! flowplayer('devexpress-movie', { src: '/swf/flowplayer.swf', wmode: 'opqaue' }, { clip: { url: 'http:…

My Tools Of The Trade

· Posted in Software
Well I figured since everybody else is doing it, why not hop on the bandwagon. These are my tools of the trade: Hardware 2009 Apple MacBook Pro 13" running OS X 10.6 Snow Leopard. I got this not too long ago, and it completed my operating system trilogy. Dell Inspiron 6400 running Ubuntu 9.04. My lifeblood in university and still a solid laptop. Custom Intel Core 2 Quad desktop w/ 8 GB DDR2 RAM and EVGA nVIDIA 295 GTX video card running Windows …

Web Syntax Highlighters

· Posted in Software
Anybody who blogs about programming related topics needs to post code at times. When I was on Wordpress, I used the WP-CodeBox plugin. It worked quite well, but it was server side. This is fine if you intend to stay with your software forever, but when I moved off Wordpress to my custom solution, it became a problem. syntaxhighlighter syntaxhighlighter is a fairly popular solution, and for good reason. It is entirely javascript based so there is…

Blogging System Shootout

· Posted in Software
So I have this blog. You might have one, but odds are, we aren't using the same system. Well, actually since I run my own system, there is probably no way in hell we are running the same system. Anyway. There are a few other systems out there, I'm thinking of moving my other blog off my own server, and want to do some other stuff, so naturally I want to find out about some of these other systems out there. I'm only doing hosted services, since t…

Google Sets

· Posted in Software
Have you check out Google Sets? It's great. I really don't know how long it's been around, but it's pretty slick. If you were looking for server names, like in this serverfault question, you'll realize the power of Google Sets. Go there, and try out a few things, like characters from Star Wars. Enter in Luke Skywalker and Han Solo. Oh look, the rest of the cast, and even some obscure ones! So the next time you need a set of things, like for a ne…

AuthSMTP

· Posted in Software
Need to send email from your web app? Don't want to use Gmail because of limits? Okay I'm not about to break into a marketing campaign, because I just found the website, but it looks like AuthSMTP solves the problem. I literally just discovered this place, but you can send up to 1000 emails a month (100MB data), for $24USD a year. Not too bad. You can send with your own from address, etc, etc, and all the things you'd expect (at first glance any…

Post Twitter To identi.ca

· Posted in Software
So I signed up at identi.ca a while ago, but never really did anything with it. I also found Yahoo Pipes a while ago, and put it on my Todo List to look at, but that was about it. I don't know why I didn't think to look at it to do this. Anyway. Pipes lets you manipulate pretty much anything, RSS feeds being one of them. You can feed things around, or pipe them, and alter contents, do whatever. After a little Google work, I found this pipe that …

Cookies For The Forgetful

· Posted in Software
When the going gets tough, the tough mess with cookies! Well sort of. I started using Chromium from the Chromium Daily Build PPA yesterday at work. I remembered most of my passwords for things, but one eluded me. The wiki. The wiki system we use is WikkaWiki and while it does the job, it’s not something that would be my first choice. Or second choice. Anyway. The weird thing is, it does something stupid and as a result, Firefox can’t remember th…

Drastically Speed Up Web Browsing

· Posted in Software
Uninstall Firefox Install Chrome There is no step 3 I'm seriously getting sick and tired of Firefox. Chrome for Linux can't come any faster. When even with only 5 tabs open, it eats over 600 MB, and frequently fades out to the standard "application not responding" state. It can't even switch tabs without lagging. If I have a video playing in one tab, it frequently hangs when I switch tab, or open a new tab. Pain. Chrome is just better, and once …

Get Chromium Running On Linux (Specifically Ubuntu)

· Posted in Software
So what I have here is nothing fancy. It's basically cut and paste from the Chromium site, but if you don't want to think, just download and run, and have Chromium on your Ubuntu setup. So, on with the script: The comments speak for themselves. Basically, get prerequisites, get tools, get source, build away. This process will take awhile, so once it starts go flirt with your significant other for a bit :) The first thing you see when you start u…

LaTex And Fonts

· Posted in Software
I found this page when trying to figure out how to get LaTeX to use Helvetica. Proved quite useful and insightful. One of the most interesting bits was this note: The dirty little secret here is that when you do this, you might not be getting the true Helvetica but rather it's very close cousin Nimbus Sans. That might depend on your system, and LaTex setup though. Nevertheless, Nimbus is still far better font type than Arial. My question is can …

ufw And xen - Make Them Play Nice

· Posted in Software
I was setting up ufw on my server and noticed my xen instances couldn't do anything. Simple fix, and if you Google that, you'll find this link at the top. Solves the problem straight up. Xen and UFW on Ubuntu

Supercharge Wordpress

· Posted in Software
Wordpress is pretty much the blogging engine of choice. It's used by so many people, and has so many plugins and an amazing following, you'd wonder why anybody would use anything else (well there are a number of reasons, but we can talk about that later). Some problems that come with Wordpress, with all that power, is sometimes it's slow. Combine php, lots of plugins, and everything else, and your blog can come to a crawl, especially if you writ…

Self Signed SSL Certificates

· Posted in Software
I don't really care, I just want a certificate. Gimme! For my stuff, I just want the SSL for my own personal use. It's not for a variety of random people I don't know, just me, so I don't care. How? openssl req -new -x509 -days 365 -nodes -out out.pem -keyout out.pem

intoDNS, A DNS Tools Replacement

· Posted in Software
intoDNS replaces DNS Tools, which used to be free, then became pay for, but now looks like it's back to being free, but whatever. intoDNS provides a bunch of nice information, and seems quite useful. Check it out. intoDNS

Make Eclipse Not Suck On Ubuntu 8.10

· Posted in Software
I don't know if this is a problem on Jaunty anymore, but whatever. I had to do this on 8.10 to get Eclipse to actually run and function properly. In a word: printing. In more words: disable it. Who prints from Eclipse anyway? Add this as a vmarg in your eclipse.ini -Dorg.eclipse.swt.internal.gtk.disablePrinting The long story: When I was at school, my Eclipse instance just would not start. Well, scratch that. A blank workspace would start fine, …

POP Moved To Heroku

· Posted in Software
Adam Wiggins hooked me up with the Heroku stuff (and by hooked up, I mean I emailed Heroku support and he enabled the services for me), and so I moved my professional online presence to be hosted on Heroku. The URL is the same as before (http://www.darkhax.com), but now it should be just a bit snappier, and easier for me to deploy to. If you haven't at least checked out Heroku by visiting the site, do so now.

Scribes, An Editor For Gnome

· Posted in Software
I checked out Scribes this week, and I must say it has potential. It has a slick yet simple interface and look, and a few nice features. It has word completion and template support, so you can setup snippets, and tell the cursor to tab through sections, so for example, you can have a ruby snippet to make a do end block, which will create the code, put the cursor in the block variable section, then a tab puts you in the block so you can write the…

Git On Windows

· Posted in Software
Speaking of git, you can get it on Windows, using msysgit. It works pretty well, in that I haven't had any problems with it, except some minor line ending things. msysgit Getting Started with Git and GitHub on Windows - Kyle Cordes

Slow And Expensive Please

· Posted in Software
I was looking around for an Amazon S3 browser and cam across digital inspiration talking about CloudBerry Explorer. The first thing that caught my eye was this screenshot. If you read around it, you can see you have two options of moving files between S3 instances. While options are nice, I'm not sure why anybody in their right mind would want to select the slow and expensive way. If you move between S3 instances on S3, it costs zero dollars. If…

Emacs And Termcap

· Posted in Software
I've had this problem before, but never wrote down how I fixed it. emacs would whine about not being able to open a termcap database file, and wouldn't start on the console. The X version worked fine, but using the -nw option resulted it in dying. The fix! infocmp -C rxvt-unicode | sudo tee /etc/termcap If you strace emacs when you start it, you'll see it tries to open that file, which doesn't exist on Ubuntu by default. I tried everything else,…

TurnKey Linux

· Posted in Software
I discovered TurnKey Linux while I was running around on the web, and found it quite interesting. From the site: TurnKey Linux is a new open source project that aims to develop high quality software appliances that are easy to use, easy to deploy, and free. The appliances are based on Ubuntu 8.04.2 which is an LTS release, so updates are supported until sometime in 2011. They even provide a base setup of either plain JeOS or the the basic stack.…

Borland C++ Builder 5, How I Hate Thee

· Posted in Software
I'm pretty sure Borland's C++ Builder 5 is the worst IDE ever. It's slow. If you try to use tooltips or code completion, it takes a good 5 seconds before anything shows up. On top of that, since they didn't put the tooltip activity in a separate thread , the entire application is frozen and you get the hourglass while it's looking for something to display. Super. Not only does it take forever to get a tooltip, but the default timeout is too shor…

Renaming SharePoint Sites With stsadm

· Posted in Software
I needed this when I worked back at Matrikon. I don't imagine the process has changed since then. It's kind of sketchy when you have to delete, then restore, but whatever, it worked for me. Your mileage may vary! Don't blame me if your entire site gets deleted :) Matthew Cosier's Blog: How to rename a WSS site