Archive for 2010

MySQL for Python

Monday, December 27th, 2010

I am always for using the right tool for the right job. A lot of time, that tool is Python. I have always had trouble finding solid documentation on using MySQL with Python. There was generally enough to get by, but the more the merrier. Enter MySQL for Python by Albert Lukaszewski. (more…)

Benchmarking in jRuby NYC.RB Talk

Wednesday, November 10th, 2010

Here are the slides from my presentation on jRuby during the NYC.rb talk on 11/9.

NYC.rb – Nov 2010 – Benchmarking jRuby

JSON Benchmarks in jRuby

Monday, October 25th, 2010

I am in the process of switching a major application from MRI Ruby (specifically 1.8.7-p302) using many C extensions to jRuby (currently trying 1.5.3-master). In my application, performance is extremely important. It is so important in fact, that I will be writing about some of my experiences in troubleshooting the speed and getting those important milliseconds back. When I am trying to keep an entire transaction from start to finish under 40ms and just the decoding of a JSON object into a Ruby object in jRuby takes roughly 30ms using json_pure, we may have to explore other avenues.
(more…)

Hash Autovivification in Ruby

Wednesday, October 6th, 2010

One of the features that I miss most from my Perl days (and to be honest, there isn’t a whole lot I miss from my Perl days) is autovivification. For more information on what it is, read the wikipedia page on it here.
(more…)

Interesting Object Methods in Ruby

Monday, September 27th, 2010

This little Rubyism is something that I use frequently for debugging my objects. I add a method to every object to show only the interesting methods. What do I mean by interesting methods?
(more…)

Culture of Product vs. Culture of Code

Tuesday, September 21st, 2010

I was talking to Luke Melia of Weplay.com about various cultures of startup companies. We compared two ideas that we referred to as a culture of product and a culture of code. They similar in concept but require defining.
(more…)

Counting Frequencies of Frequencies

Monday, August 16th, 2010

Lots of people forget about the usefulness of the core utilities (the tools available in Bash). I am even pretty guilty of it at times with such quick and easy things like Perl, Ruby, or Python that allow you to process items from the command line. However, they load up an entire interpreter. It is usually better to use the coreutils.
(more…)

Getting a Random Record From a MongoDB Collection

Monday, August 9th, 2010

One of my issues with MongoDB is that, as of this writing, there is no way to retrieve a random record. In SQL, you can simply do something similar to “ORDER BY 1” (this varies depending on your flavor) and you can retrieve random records (at a slightly expensive query cost). There is not yet an equivalent in MongoDB because of its sequential access nature. There is a purely Javascript method in the MongoDB cookbook here. If you are really interested, I would also read the Jira ticket thread #533 on this issue.
(more…)

Sharing a Screen Session

Friday, July 23rd, 2010

Anyone who has spent any time in a shell and has been cut off while working should know about screen. If not, then I recommend reading up on it (here or here). But I’m not here to tell you about screen as a general tool, I want to show you how to use it for screen sharing. I found a couple of forum posts and other scattered information, so here’s a little centralizing of information.
(more…)

Stopping Curb From Segfaulting

Thursday, July 8th, 2010

While trying to get the curb gem up and running using Ruby 1.8.7p174, I kept getting segmentation faults. I Google’d around and really wasn’t able to come up with much other than lots of people saying not to use ports here. Since I don’t use Mac Ports, I use Homebrew, I figured this wasn’t an issue. I had also recently installed the latest XCode so I incorrectly assumed there was no issue there either. (Note: I am running on a freshly upgraded version of Mac OS X Snow Leopard).
(more…)

Creating Configuration Files With Ruby Templates

Wednesday, June 30th, 2010

I recently had a very repetitive configuration file that needed creating. There were approximately 50 config blocks of 10 lines each with only the host name changing with each block. So I decided to take a shortcut and do it in Ruby using ERB templates. This is so easy and literally save me hours worth of work.
(more…)

Random Tech Notes And Buzz Updates

Monday, June 28th, 2010

Since Google Buzz is Twitterish in the sense that you can post a quick note, but different in the sense that (amongst other things), it can be longer than 140 characters. So in that vein, I’m starting to try to make a habit of a quick post (a couple per week) of things I do to make my life easier. This goes both for SysAdmins and for Programmers.
(more…)

Using Unique Keys and Key Groups with Background Jobs in Gearman::Client

Wednesday, June 16th, 2010

While diving into Gearman using Gearman::Client with MySQL and libdrizzle (I know, a mouthful), I ran into what I thought was a bug. I was only able to add 1 background job of any type at a particular time. The launchpad “bug note,” which is available in its entirety here, is rightly labeled won’t fix.
(more…)

My First Drobo Experience

Wednesday, June 2nd, 2010

The Drobo is supposed to be one of those solutions that essentially pops out of the box and with very little effort, just works. I ordered my Drobo FS through an Amazon retailer. What I wasn’t expecting was an experience…
(more…)

Multiple Input Locations From Bash Into Ruby

Thursday, May 13th, 2010

I have been trying to figure out how, while using OptionParser to be able to check for files being input on the command line and if they don’t exist, check other input streams (like Bash). This initially wasn’t very easy since input streams are blocking. So with a little help from friends (thanks roberto), I was able to use his method of non-blocking IO and wrap it in a begin/rescue block. I also took a little advice given in this Stack Overflow question called Best Practices with STDIN in Ruby.
(more…)

Nagios notify-by-campfire Plugin

Thursday, May 6th, 2010

Since one of the core communication methods for my company amongst engineers is 37Signals Campfire and Nagios is one of our main monitoring tools for all of our applications and services, I thought it would be a good idea to combine the two. So with a few simple additions to the Nagios configuration and a Ruby Campfire script, you can get this up and running.
(more…)

Creating Dummy Packages On Debian

Tuesday, May 4th, 2010

One of my favorite things about Debian is its awesome package management system. Apt is one of the reasons I have used Debian for servers for so many years and eased my initial transition to Ubuntu (which as most people know was initially a Debian fork). Apt is a great tool as long as you aren’t building packages from source (and not making debs out of them). I have packaged a whole bunch of debs, but sometimes it just isn’t necessary. So if you haven’t used equivs, then you need to check it out.
(more…)

New Massachusetts Security Law Passed For Databases

Tuesday, April 27th, 2010

In case you haven’t heard about the new Massachusetts state law regarding consumer or client information in databases, you can read about it here, at Information Week, or just Google for “Massachusetts data security law”. And if you haven’t read about, then I strongly suggest you do. This is one of those instances where I believe their heart is in the right place, even if the execution/implementation wasn’t perfect.
(more…)

Should I Mock Kernel#exit

Monday, April 26th, 2010

I don’t know what the right answer is, so any insight would be appreciated. From Googling around, I came across this thread on StackOverflow which talks about Validating exits and aborts in Rspec. I have a few issues with this, namely that I am using shoulda and I don’t want to validate the exit, I want to stop it from happening inside of the test.
(more…)

ColorTail Gem

Tuesday, April 20th, 2010

One of the best ways to learn something new is to find a project in that realm and do it. I wanted to learn Ruby on Rails, so I wrote a web site. I wanted to learn Python, so I did a project in it for work. Now I want to get better at Ruby, so I wrote a gem. It’s usually not as simple as just picking a project though. It’s much easier to pick and complete a project if you are filling a need. So that’s what I did, I filled a need.
(more…)

A Few Words About Setting Up Postfix Multi Instance

Monday, April 12th, 2010

I work with email and Postfix. On every mailing machine I have Postfix setup on, I have at least 2 instances, sometimes more (in fact, sometimes its as many as 6 instances). I was recently setting up a new set of mailers and decided to give Postfix multi-instance seutp a try. It was excellent. There really isn’t too many complex setups that have a simple installation. And to that end, I give Postfix credit where credit is due. It usually takes a little more than just following the README.
(more…)

Monitoring Services with Nagios::Plugin

Wednesday, April 7th, 2010

There are a lot of people who say, “if it isn’t monitored, then it isn’t a service.” The problem is that I don’t think enough people outside of the systems world believe that or even understand why its said. I think the primary offenders here are developers. It isn’t because they don’t know better, but typically developers just want to get the application up and running and then move on to developing the next thing. I also think there is some fault on the side of the administrators and the managers not insisting that part of the completed version of a project includes monitoring. But I don’t want to harp on this as much as I would like to show just how easy it is to compensate here by taking advantage of Nagios::Plugin.
(more…)

Capistrano Hangs on Mac OS X Leopard

Monday, April 5th, 2010

I use Capistrano to deploy my webapps and have been for a while. I also deploy right from my laptop quite frequently. So I was a little taken aback when I could deploy in one place and not in another. It turned out that Capistrano was having issues with deploying to multiple servers. In fact, it turned out that the problem had the appearance of being Capistrano, but in actuality, it was Net-SSH. The whole issue can be tracked via the Lighthouse ticket here. I’m going to show you how to diagnose if you have this problem faster and how to fix it.
(more…)

DNS Staying With The Times

Wednesday, March 31st, 2010

My company signed a contract for a provider that uses TZO as their DNS provider. Now I have used TZO before (circa 2006-2007) and although their interface was archaic and there was no API, I accepted it because I was told they were reliable. As it happens, the service was fantastic and they are very reliable. I don’t think the service went down once the entire time I was using them. I ended up leaving the company and never saw the API or new interface come to fruition.
(more…)

Cluster SSH with cSSHx

Monday, March 29th, 2010

I am in the middle of building out a group of about 25 machines in a data center for my company. I hadn’t really dove into it on a micro level until a few days ago. I was moving around on individual machines that others were working on. When I had gotten to one of the “untouched” machines, I found that vim wasn’t installed. There was about 15 machines that were “untouched” and therefore were missing vim (along with other stuff). And seriously who wants to install a bunch of the same software on every machine after they’ve already been kickstarted?
(more…)

Setting Up daemontools on CentOS 5

Friday, March 26th, 2010

I recently had to setup daemontools on a CentOS system. I had set it up before but it had been a while. So I Google’d around and found very little and what little I did find wasn’t very helpful. So here is a quick and dirty on setting up daemontools. I even included the CentOS fix that I came across to make it compile. There is also a patch version (if you were building an RPM), but I prefer just making the change in this case; it’s much simpler.
(more…)

Count Instead of Sequence

Friday, March 26th, 2010

I use Bash one liners a lot. I think they are an important part of any programmers and sysadmins toolkit. If you can’t write a bash one liner, even a simple iterator, then you really need to learn. I promise it will make your life infinitely more pleasant.

Frequently I find myself writing things that require a loop or an increment of numbers. A good example would be like something that would walk over my web servers and check their uptime, load averages, etc. Using seq, that’s easy. But since Mac OS X doesn’t come with the seq command, I would previously improvise.
(more…)

Goodmail Adds Microsoft Domains

Wednesday, March 24th, 2010

On the same day that Goodmail removed Yahoo! from its pool, it added the vastness of Microsoft domains. These domains include hotmail.com, live.* and msn.com.

The addition of Microsoft to the Goodmail community is a good thing because it means that Microsoft is starting to play ball in the email community. However it comes as bittersweet with the loss of Yahoo!.
(more…)

Yahoo and Goodmail Cut the Cord (Temporarily)

Wednesday, March 24th, 2010

So as of today, Yahoo! will no longer be accepting Goodmail imprinted messages. There is currently no press release from Goodmail, but I am sure one will be forthcoming. The latest reference to the on goings is listed here in one of their recent blog posts.

Goodmail claims that they are doing everything possible to bring the relationship back to it previous state and it hopes it will be there shortly. I know that from the customer side. But as I said above, I am sure that will be in some form of an announcement coming out at some time today.
(more…)

Community Participation

Thursday, March 18th, 2010

The more I branch out my interests (or skill sets), the more I find myself joining communities. I am a part of Yelp (food/restaurants), StackOverflow (programming questions), Codaset (social coding), Facebook, LinkedIn (professional networking), Disqus (blog comment system), and the list goes on and on for many of my interests. There are lots of communities for almost all imaginable interests. The key thing here is not just that I am a part of these networks or communities that I am interested in, but that I am a contributor.
(more…)