Archive for the 'Geek' Category

Domain Silliness

August 7, 2008 12:49 am by brian

So Chris and I talked a bit more tonight about domain registrations and how we’re going to add that feature to our billing software. Trick is, it’s going to be a lot of coding so it may be a but. We promise that we’re hauling ass trying to get stuff working asap.

<3 brian

So I still hate the iphone…

August 1, 2008 3:33 pm by brian

But the addition of the app store makes it slightly more bearable. Mainly I can say (after a year of hacking and various use) that I can’t wait for the blackberry bold.

CNBC Has Let Me Down

July 25, 2008 4:36 pm by brian

I admit it. I like CNBC.

I like to keep track of how the investments I made for my mother are going (she’s in retirement and with the recent passing of my father, we invested some money to ensure security in her golden years). I spent the better part of the day yesterday trying to figure out how I could get CNBC in the office free and/or cheap. First, I spent hours and hours searching trying to find an online feed. Nada (at least with non-windows media player support). Then it was trying to figure out ways to get it from my house to the office. Slingbox seemed a good choice at first. After all, thats exactly what it’s designed to do. No linux support though. In the end, I have a feeling I will be going the route of mythtv to give this a shot.

Sed vs Tail Showdown

February 28, 2008 1:36 pm by brian

Today I was presented with a problem. A colleague of mine did a MySQL dump on a database. The resulting MySQL dump file was 40GB. Problem is, he forgot to tell mysqldump to leave out the drop/create table statements. Here’s the rub:

What is the most efficient way to remove the first 43 lines of text from a 40GB text file?

“Surely there must be a simple *nix utility to do this.” we thought. My first guess was simple:

me: “Just use sed and tell it to delete the first 43 lines. Simple.”

colleague 1: “But won’t the regex engine be very inefficient for that?”

colleague 2: “Meh, I think sed is the right tool for the job.”

Now at this point we have a square off. Colleague 2 feels that the inclusion of the regex engine is simply too much overhead and is like bringing a bazooka to a knife fight. So they start to look around and I start doing some tests with a 1.5GB MySQL dump from Killoggs. Immediately, I see that it’s trying to create a temp file. If it’s creating a temp file, then that means it’s going to either create the temp file and rename it or create the temp file and copy it. Neither of those are especially good solutions because it will result in (at least) a lot of CPU utilization and even after the basic operation is done, there is still more to do in the way of a copy, move, etc.

So the next thought is doing the inverse. Rather than trying to delete the data, maybe we simply don’t want to output it. This logic seems to bear more fruit and the result is the following two potential solutions:

  • a) sed -n ’43,$p’ filename | mysql
  • b) tail -n +43 filename | mysql

Now, the real question? Which is faster? To test this i created a 200MB dummy text file comprised of log data. I then took this and ran the following commands repeatedly. The result? Both sed and tail were about the same as far as both real and system time. They both fluctuated and both came out roughly neck and neck. The real key was user time. Sed was always an order of magnitude slower as far as user time. In the end, this would lead me to concede my initial suggestion and go with tail.

Got thoughts on this? email me at brian …at… logjamming.com!

[bharrington@berstuk tmp]$ time `tail -n +41 test.log > /tmp/file1.test `

real 0m6.479s
user 0m0.077s
sys 0m1.145s
[bharrington@berstuk tmp]$ time `tail -n +41 test.log > /tmp/file1.test `

real 0m4.454s
user 0m0.061s
sys 0m1.091s
[bharrington@berstuk tmp]$ time `tail -n +41 test.log > /tmp/file1.test `

real 0m4.498s
user 0m0.049s
sys 0m1.058s
[bharrington@berstuk tmp]$ time `sed -n ’41,$p’ test.log > /tmp/file2.test `

real 0m5.025s
user 0m1.434s
sys 0m1.063s
[bharrington@berstuk tmp]$ time `sed -n ’41,$p’ test.log > /tmp/file2.test `

real 0m4.862s
user 0m1.351s
sys 0m1.091s
[bharrington@berstuk tmp]$ time `sed -n ’41,$p’ test.log > /tmp/file2.test `

real 0m4.606s
user 0m1.440s
sys 0m1.124s

Eclipse IDE

February 20, 2008 6:27 pm by brian

Eclipse is a pretty common development too familiar to Java developers. I’m starting to get into the swing of Java development and decided that I would give it a try. I’d tried installing it in the past and it was a bit of a bugbear. Recently, I noticed that it is available in the yum repository for Fedora. I like package repositories so I figured i’d give it a shot. What followed was a path filled with some ups and downs. To make things easier for you, I’m writing up a cheatsheet as to how to get it running as fast as possible with as little headache as possible.

First and foremost, you’ll want to install the following packages in Fedora with yum:

yum install eclipse-platform eclipse-emf-xsd-sdk eclipse-emf-sdo eclipse-ecj eclipse-emf-xsd eclipse-jdt eclipse-emf-sdo-sdk eclipse-rcp eclipse-emf eclipse-gef eclipse-subclipse eclipse-phpeclipse

That will do much of the heavy lifting and should get you going with doing PHP, Java, etc development.

Your next step (if you dare) will be to use Eclipse’s “update manager”. Now the update manager in eclipse is not nearly as friendly as yum, apt, etc. It does the work of telling you “yo, you’re missing XXX dependency” but not much else. You’re going to have to dig, and it’s not always friendly. Googling to find the package name (and sometimes package name + eclipse & “update manager”) will normally give you some pretty good links to add to the update manager.

To get you started, here’s a copy of my exported sites. You can easily import this by saving it as an XML file and then using the “import sites” utility in the update manager.

Eclipse Bookmarks

Good luck!

$14 Steadycam (The Poor Mans Steadicam)

January 4, 2008 4:43 pm by brian

Maybe some of you folks got a totally sweet camcorder for X-mas. If so, check this out. I’m a big fan.

$14 Steadycam The Poor Mans Steadicam

Storage storage storage!

November 15, 2007 1:33 am by brian

So it looks like we’re going to be rolling out our new storage array soon. I’m going to be buying the hardware this week. It’s going to be a 2TB monster which we’re setting up to expand all the way to 14TB. If that doesn’t keep our backups in good working order, ain’t nothing going to keep our backups in good working order!

On Sun, NetApp, & ZFS.

November 6, 2007 5:32 pm by brian

I’ll join the bandwagon. ZFS is the best thing since sliced bread. After seeing a presentation on it at USENIX `07 in San Jose back in June, I must admit. I’m impressed. It seems that Sun is on to something here. Even better, due to the CDDL it’s been included in FreeBSD & Mac OS X. That means that you can expect to see it being deployed more widely here soon once people learn to use it and realize exactly whats up. Here at Logjamming / Alticon we’re going to be rolling out a new backup system based on FreeBSD / ZFS here before the end of the year. The effect? Better backups and more space for them. Yay!

Open source imaging

November 27, 2006 1:24 am by brian

So by all accounts, i’m most assuredly the most obstinate of us over here at logjamming. Sometimes it’s my choice of disks in servers (seagate all the way. after dealing with another maxtor failure today i vow… never again) or the fact that i am vehement in my use of linux for my desktop, in the end, i’m just that brand of pain in the ass.

Which brings me to my rant of the day…. open source imaging.

For quite some time this has been a sore spot. Some times it’s josh & his “there’s no pantone in GiMP rant”. Other times it’s the annoyance of needing to convert file types. Well, today i found my holy grail for the latter.

pstoedit

This utility rules hard. Recently one of the designers we work with passed me files in eps and illustrator format. The tricky part, is that illustrator didn’t close some of the strokes properly and i was left with a version of “mr log” with half his mouth chopped off every time i rendered it to bitmap. Pstoedit to the rescue. Fixing this was as simple as typing the following command:

pstoedit -f plot-svg text_logo.ai text_logo2.svg

That did the job quite nicely, except that the g’s o’s and a’s looked jacked up. It didn’t do the knockouts in the center of the letters. This was easily fixed by adding the “-ssp” flag to the command leaving me with:

pstoedit -f plot-svg -ssp text_logo.ai text_logo2.svg

Try it out. Works like a charm.