Recent Comments
Archives
Visitors
  • 51678This month:
  • 1837Today:
  • 15Currently online:



LeaseWeb CDN

“Beware of programmers carrying screwdrivers.”

programmers_screwdrivers

Every now and then I run into the programmer proverb “Beware of programmers carrying screwdrivers.” I’m intrigued by it and I want to know: Who said that and what does it mean? Two names showed up on my Google searches to the origin of the quote: Leonard Brandwein and Chip Salzenberg. I’ve got absolutely no evidence to claim that either one of them said it, let alone said it first. Maybe they’ve both said it independently.

What does it mean?

Despite my searching, I am not sure what the quote means. I feel the most obvious meaning is that, since programming normally does not involve screwdrivers, you should stick to your specialism. Sort of the same meaning as: “Jack of all trades, master of none”. It could also mean that programmers with screwdrivers are the ones building computers. They might be hardware enthusiasts that are overly obsessed with getting every last Mhz of performance out of the machine and are likely to be guilty of “premature optimization“. Or it could mean that people that have screwdrivers might be the ones that will be replacing parts, when things don’t work. They may be the “blame the hardware” or overly pragmatic type. Last explanation I could come up with is that it is about programmers in the 70’s that were building their own computers like the Apple I DIY kit. You probably need to be aware that their level of experience and reputation is unparalleled and arguing with their ideas is pointless. But let’s assume it is about specialism vs. generalism as that seems most likely.

Specialists vs. generalists

Nobody argues in favor of being a generalist like Tim Ferriss on his fourhourworkweek blog:

“Was Steve Jobs a better programmer than top coders at Apple? No, but he had a broad range of skills and saw the unseen interconnectedness. As technology becomes a commodity with the democratization of information, it’s the big-picture generalists who will predict, innovate, and rise to power fastest.”

So was Steve Jobs a programmer carrying a screwdriver? And what about specialists?

“The specialist who imprisons himself in self-inflicted one-dimensionality — pursuing and impossible perfection — spends decades stagnant or making imperceptible incremental improvements while the curious generalist consistently measures improvement in quantum leaps. It is only the latter who enjoys the process of pursuing excellence.”

I tend to agree, but I guess I just overly romanticize the idea of being a Renaissance man. :-)

Finding bad RAM with memtest86

Lately Firefox started to crash randomly without an apparent reason. Also other software on my computer started acting weird. It took me a while to found the cause of the problems. It turned out one of my memory modules has gone bad. Finding that out was not exactly easy. Normally I would run memtest86+ from an Ubuntu live CD. That was not possible as I have an UEFI BIOS (without legacy support) and memtest86+ is lacking UEFI support.

memtest_splashscreen

I was able to create a virtual machine (with KVM or VirtualBox) with reserved RAM and run memtest86+ in there. That actually showed the problem. Another trick to detect the problem is to run memtest86 (without the plus) as it has support for booting using UEFI since version 5. It can be downloaded from memtest86.com (choose CD image) and put it on an USB stick using UNetbootin (install using apt-get).

ram_modules

When I found the problem there was no other way than to try to add and remove memory modules and run the test again to find out which one was broken. It took some time, but eventually I succeeded. It wasn’t a pretty process and it took way too long. Somebody should write a memory testing program in user-space that also reports the slot of the broken RAM module. In the end the broken module turned out to be the one closest to the CPU (see picture), maybe it got too hot.

Suggested tools:

  1. MemTest86 from: memtest86.com
  2. Memtest86+ from: memtest.org
  3. Windows Memory Diagnostic from: microsoft.com

I hope it will help you.

About Frank, our fantastic handyman

johnny-automatic-electric-drillAt home, we have a handyman. His name is Frank. He is very experienced and all-round and was able to take on every construction or repair job we gave him in the past years. Frank is easy going, never stressed out and often takes a break to smoke a cigarette and enjoy the weather. Although we pay him by the hour, we do not complain about his smoking as he asks a reasonable fee and works quite efficiently. Also, my wife really likes the guy, as she feels he can be trusted and always understands her really well.

For instance, last year he redid our kitchen, which turned out really nice. And although we wanted to go for a four ring gas hob he convinced us to take a five-ring hob with a central wok burner. He argued this would hardly take any extra space and would be very convenient in case we needed to use a bigger pan. Every time we have visitors over, my wife refers to Frank and how happy she is about the choice we made.

This year we were getting the bathroom done, but since we only have one shower in our apartment I asked Frank: “When will the bathroom be done?”. He answered “that depends”, “why are you asking?”. I told him about my concern of using the shower and he smiled. “I can make sure the shower can be used every time I leave as long as you don’t mind the mess.” he replied. Well… that solved one of my worries, but I was not completely satisfied, so I kept asking.

“But, when will the bathroom be done? I mean.. how much money is it going to cost?”. “Those are two different questions” Frank answered, “The first one depends on how often and how long I will be here and the second thing depends on what the bathroom should look like and what other more important jobs you have around the house”. “Hmmm… I understand”, I mumbled, but had the unpleasant feeling that he was dodging the question.

My wife has a very busy and responsible job, but she is also the one that decides on the interior related things in our house. Not that I do not care, but we both know that she has “feeling” for these things and I (an IT guy) do not. I told my wife that I could let Frank in and pour him his coffee, but that I did not see how we would organize this bathroom rebuild. She had an easy solution: She asked Frank to promise to work 3 days a week for at least 2 months. He worked on Monday, Tuesday and Thursday, since he had another job going on Wednesday and Friday. Every Thursday evening he would leave late, so he could meet my wife to show what he did and discuss with her what he was going to work on next week.

I would not have taken that route and would have probably asked an interior designer to draw the bathroom in 3D. Then I would have asked several building contractors to quote me with a price and a delivery date. I’m sure my wife would not have been as pleased as she is now with our new bathroom. The bathroom turned out exactly as we wanted, she even feels she has built it herself. Another good thing is that we only paid Frank for the work he actually did and the materials he needed. Of course not everything went flawlessly: Frank had to reroute a sewer pipe because we wanted the toilet in a different position. That was a lot of hassle, but my wife really wanted it like that, so it was our own choice in the end.

I’m glad I’m in IT doing agile projects, because construction work is not my cup-of-tea. ;-)

Simple video calling from Firefox using “Hello”

firefox_hello

https://support.mozilla.org/en-US/kb/firefox-hello-video-and-voice-conversations-online

Today my Firefox was updated and it contained some great new functionality: video calling! There is not much to say about it.. click the above link, read how to do it and go and try it!

firefox_hello_video

It is beta, but it works great.. :-)

 

 

Analyzing text protocols with a TCP proxy

To debug the Memcache server (memcached) on my localhost I needed an application that would log the in and output to a specific port on my local machine. In  the config in PHP I changed the memcache port (from 11211) to 11212. Then I ran the TCP proxy software to forward all connections on port 11212 to 11211. I know I could have used wireshark (and/or tcpdump) to just look at the traffic, but I felt like trying a more light-weight tool. I ran into two nice little TCP proxy programs: One written in Perl and one written in C++ with the Boost library.

Perl based TCP proxy

Torsten Raudssus wrote an application that has the following output:

tcpproxy

With the following commands you can run the TCP proxy:

git clone git@github.com:Getty/p5-app-tcpproxy.git
cd p5-app-tcpproxy/
sudo apt-get install cpanminus
sudo cpanm --installdeps .
perl bin/tcpproxy.pl 11212 127.0.0.1 11211

It is a lovely little project that definitely serves a niche. The only downside I see is that is has two CPAN dependencies. Perl is always available on Linux, but the dependencies certainly not. This makes it maybe a little harder to run when you are on a random machine debugging a nasty problem. If it would not have those it would become my next favorite (text) protocol analyzer.


C++ (Boost) based TCP proxy

Arash Partow also wrote a TCP proxy application in C++. It originally had no output, but I changed that. After my modifications the output looks like this:

...
56258 ==> delete memc.sess.key.lock.s5p5eh8fhvfe6iq06ot6nuim66

56258 <== DELETED

56258 ==> quit

56276 ==> add memc.sess.key.lock.s5p5eh8fhvfe6iq06ot6nuim66 0 1421275851 1
1

56276 <== STORED

56276 ==> get memc.sess.key.s5p5eh8fhvfe6iq06ot6nuim66

56276 <== END

56276 ==> set memc.sess.key.s5p5eh8fhvfe6iq06ot6nuim66 0 4 1331
debugger|a:1:{i:0;a:12:{s:3:"log";a:0:{}s:7:"queries";a:0:{}s:7:"session";a:2:{s:6:"before";
...

With the following commands you can run the TCP proxy:

git clone git@github.com:mevdschee/proxy.git
cd proxy/
sudo apt-get install build-essential
sudo apt-get install libboost-all-dev
make
./tcpproxy_server 127.0.0.1 11212 127.0.0.1 11211

As you can see I forked the original Github project to add some logging:

tcpproxy_cpp

It works like a charm, but I prefer the colored and smarter output of the Perl application. If I find some time I might copy the way the Perl proxy shows the output to C++. If you feel like it and you think you know how to do that, than I would be very happy with a PR!

NB: Arash Partow also wrote a variation to the code that does logging, it is on Google Code.

What is your favorite TCP proxy for analyzing text protocols? Let us know in the comments!