Every so often I have the need to execute a command line application from a Ruby application/script. And every single time I fail to remember what the different command-executing methods Ruby provides us with do.
This post is primarily a brain dump to aid my failing memory, and it was triggered by an issue with my Redmine Github Hook plugin where STDERR messages were not being logged.
The goal of this exercise is basically to figure out how to run a command and capture all its output - both STDOUT and STDERR - so that the output can be used in the calling script.
When I founded Substance Lab I knew I wanted to build a virtual business - or at least as much as it could be. Why should petty details like physical locations decide whether I can help my clients?
From the get go, I chose primarily web applications to run my business on. Also, it kind of makes sense because that’s what I am building, and there is no better way to learn about good and bad web applications than using them yourself.
Let me give you a rundown of the most important ones.
8 years ago, I posted this to mentalized.net:
I have always promised myself that I would not fall prey to the blogging-fever that has been going around, and for a long time the title of my website actually was “This is not a weblog”…
Well, nothing lasts forever - neither did my opinion on weblogs. Welcome to my journal.
8 years later, I am still going strong (albeit not as strong as 4 years ago) who’d have thunk?
Back then, mentalized.net looked like this:

So very, very blog-like :)
Webkit - and Safari in particular - have been really aggressive in adding support for upcoming CSS 3 features - and some CSS features not yet part of any spec.
As much of this is still Webkit-specific it isn’t really something I get to use much on client work, but not being one to shy away from new, shiny things, I though it would be fun to dig into this.
I decided to recreate an interface familiar to Xbox players, namely the Xbox Dashboard. It seemed like a good candidate to try out techniques like CSS animations, font-face, multiple backgrounds, gradients, RGBA colors, drop shadows, and custom scrollbars to name a few.
Browsers, Technology, Webdesign , Read the full entry , 1 comments
A long time ago (one day short of exactly 4 years) I posted a super simple - and to be honest - pointless Hello World example using Ruby on Rails. Back then the Rails version was 1.0.
Today marks the first beta release of the coming version of Rails, version 3.0 and I figured it’d be fun revisiting that post.
A long long time ago, I quit my great job at BiQ to live primarily of my freelance Ruby on Rails development work.
It’s one of the best decisions I’ve ever made.
Being directly responsible for my own income has been fun, empowering, fulfilling, and pretty damn scary. I’ve met lots of great people, worked with great customers on great projects, and I’ve learned a lot of lessons in the process. Allow me to share a few of those lessons with you.
I am a geek. I am not particularly outgoing. Small talk is not a forté of mine.
However, as a freelancer, entrepreneur, or anyone running a business you cannot isolate yourself in a dark basement producing high quality work. You need to get out of your chair and meet people - partly in order to stay sane and get outside influences, but definitely also because your network is very important to your business.
I have gotten the majority of my customers through my network. If you provide a great service, your previous customers will happily recommend you and your coworkers will happily refer clients you. If you’re a great person, your friends are going to talk about you.
Leverage your network, and don’t forget to make yourself available for them as well.
One of the things I have been most surprised by, is how much I think about the company.
There are always a ton of things to think about; processes that could be improved, ideas that might be worth pursuing, people to get in touch with.
Whenever I have some downtime; doing the dishes, walking the dog, watching television or in some other way allow my mind to wander, it tends to wander towards Substance Lab.
Many other people have written about this point in length, but it is important enough to bear repeating.
If you plan on working reasonable hours - and you should - you cannot expect to work 8 billable hours per day. There are so many other tasks that you need to take care of, that a part of running the business. Admin, taxes, sales, marketing - Jon Hicks have a longer list.
I have, on rare occasions been able to work 6-7 billable hours in a day, but more realistically, I count on around 3-4 billable hours on any given day.
Things will take longer than you think. Period. Couple that with the fact that you probably won’t be able to work as many hours as you figure, and you have a scheduling problem on your hands.
You want to minimize the amount of time without client work. But at the same time you need to leave buffers in place for when your estimates are flat out wrong or when something goes wrong and needs to be dealt with.
I wish I had any words of wisdom to dish out that would instantly transform you - well, myself - into a scheduling demi-god. Unfortunately, I don’t. For now, I am relying on optimism and a lot of running really fast when things get tight - hardly optimal.
That’s just a few of the lessons I’ve learned over the last years of freelancing. If you do any freelancing or run your own business, what have you learned? What would you tell someone who’s thinking about starting out on their own?
Yesterday I got bit by this fairly obscure behavior in ActiveRecord:
>> person = Person.first
=> #<Person id: 1, name: "Jakob", height: 170, created_at: "2010-01-22 08:57:02", updated_at: "2010-01-22 08:58:57">
>> person.height = 169,5
=> [169, 5]
>> person.height
=> 1
Uhm, huh? The above is from Rails 2.3.5 using SQLite, but I originally saw the issue running on PostgreSQL.
It turns out, that if the object you assign to an integer attribute/column does not respond to to_i, the attribute will be set to 1 - unless the object evaluates to false in which case the attribute will be set to 0.
My best guess is that ActiveRecord is trying to work around the lack of boolean columns in MySQL with this. So even though I am not using MySQL I still have to suffer its ineptitude. One just can’t win.
Generally speaking, I am always late to memes - this one is no different.
The concept is simple, started by Tim van Damme:
A simple game: Go to the address bar in your favorite browser, and type one letter. Start with “a”, end with “z”.
Funny how some sites I’ve rarely visited still appear. Neither live.xbox.com, eizo.dk, nor quotagio.us are particularly common destinations for me, but I guess not many domains have z, x, or q in them.
There you are, sitting at your desk. Your thoughts are coming alive on the glowing display in front of you, brought into existence by your fingers effortlessly running across the keyboard. The outside world has become a distant memory - even the music flowing into your ears from your headphones has grown muffled and removed.
You are in flow.
Suddenly an unexpected idea spawns in your head. This idea must be preserved and dealt with, but you can’t risk losing your flow, so you quickly launch your favorite notes application to jot the idea down before it escapes the grasp of your mind.
A new version of UberNotesMaster is available, would you like to download it now?
Stumped, you try to gauge whether the update is quick enough that you won’t lose your flow, but you have already lost. Your flow is interrupted, the idea is escaping, and your application is still not updated.
Typically, when an application announces that it has a new version available, you have two options:
While I like upgrading my software as much as the next person, I launch an application for a reason; to use it - instead the application forces me to choose between performing the task at hand or get the latest version of the software. You know what, I want both!
Instead of asking me to update an application when I am actually trying to use it, how about dealing with the update after I am is done using the application?
This way, the upgrade dialog could appear when I quit the application, and the update would take place while I am doing my work in another application. A much smoother experience whose only interruption is easily dealt with.
It might, however, prove to be quite frustrating when you attempt to shut down your computer and all running applications want to update themselves. Also, OS X users are known to never actually shut down applications and also never restart their machines, so they would end up never updating.
A variation of the above would be to still ask me, the user, when I launch the application, but allow me to say “Yes, I want to update, please download and update in the background while I continue with my task at hand”. The actual update then happens after I quit the application, making the entire process almost invisible to me.
We could also move the application update process out of the actual applications themselves. This strategy is known from the iTunes App store, where updates to all installed applications happen in the background while you’re doing other stuff. Smooth and seamless and allows you to maintain your installed software when /you/ are ready for it.
The process in itself is probably the smoothest offered, but it also bears the penalty of centralization. This software updater application somehow needs to know about all independent and unique applications you have installed and be able to update them.
Larger software vendors like Adobe have taken this approach and created their own - usually pretty crappy - updater applications. I would love to see something kickass here - preferably from the ISV community, but it could also be interesting seeing Apple build this into their own Software Updater app (or in the Windows equivalent if one exists).
Now, excuse me, I have to update my blogging application…
A new year has arrived — what better time is there to look back at the year that passed?
The number of visitors to mentalized.net keeps declining. This is hardly surprising; I don’t write as much as I used to here (I have a feeling Twitter is eating up a bunch of potential articles), and a lot of content is probably being consumed off the site in news readers and other aggregators.
Still, I am quite happy having more than 125000 people visit my humble website and I owe each one of you my thanks.
My collection of totally free, animated GIFs for showing Ajax activity continues to reign supreme as the most popular content on mentalized.net. It is followed by my satirical web 2.0 webdesign tutorial.
Both of those were published back in 2005 over 4 years ago, yet they still continue to draw readers to the website. The only article on the content top 10 that’s actually published in 2009 is my response to a Java developer spreading some FUD (which unfortunately detoriated into more FUD and mud-slinging).
Google is still, hands down, the biggest source of traffic for mentalized.net. Almost half of all visits have been referred by Google. For comparison, the next search engine on the list is Bing with less than 1% of Googles referrals.
Social media sites like Digg, Twitter, and Facebook still aren’t providing me with a lot of traffic. I must be “old media” - or perhaps my content simply isn’t the kind of content that cries out for immediate attention.
The only post I’ve made in 2009 that was in relation to “current events” (link) did in fact get some traction on the social sites with roughly half the visitors coming from various social sites.
I am looking forward to redoing the above stats for mentalized.net when 2010 is over. I signed up for Project52 fully intent on accomplishing the goal (“to write at least 1 new article per week for 1 year”). Hopefully, getting back into the thrill of writing regular content should provide for better content that can at least break the decline of visits. Time will tell.