Misc Linux things: PATA or SATA, mutt and mailcap, tarsnap backup

The other day, I wondered whether the drive in my laptop was PATA or SATA. Fortunately, I didn’t have to tear it apart to find out. I simply wandered over to stackexchange.com and asked the question. Here’s the answer:

lspci -d $(cat /sys/block/sda/device/../../../vendor):$(cat /sys/block/sda/device/../../../device)
readlink -f /sys/block/sda/device/../../../driver

I’m a long time user of the mutt email client (as well as Thunderbird). At some point, viewing the HTML attachment (with the ‘v’ key) stopped invoking ‘lynx’ via my mailcap file. It turns out that the developers of mutt added an internal viewer, and moved mailcap support to the “m” key. I took the time to switch from using ‘lynx’ to using ‘links’. Here’s the entry from my $HOME/.mailcap file:

text/html; /usr/bin/links -dump -force-html %s; copiousoutput; nametemplate=%s.html

I’ve been gradually looking for an online, off-site Linux backup tool for  the past few years. I tried spideroak, but wasn’t pleased with the giant log files it kept in my home directory, and it wasn’t designed to back up files outside of my user account. Lately, I stumbled on another promising tool: tarsnap. I haven’t tried it yet, but I will. Pricing looks reasonable, and since it “deduplicates” storage, it means that I shouldn’t be backing up the same thing repeatedly. Here’s how one person configures tarsnap to keep up to X daily backups, Y weekly, and Z monthly.

Fedora 14, SSH ports and SELinux

SELinux in Fedora 14 is configured to constrain the ports on which SSH can listen (see the bug report). The solution:

setsebool -P sshd_forward_ports 1

This allows SSH to listen on ports besides 22, and to forward ports. Reading the bug report is interesting. In my opinion, OpenSSH has an outstanding security track record, and we probably don’t need additional SELinux policy to constrain it. It’s probably wise to practice security in-depth (to have more than one line of defense), but it creates a large road bump for most SSH power users. From what I read, it sounds like most people still disable SELinux.

Teriffic Linux Books

One of my QA coworkers had The Linux Phrasebook sitting on his desk. I noticed it was by Scott Granneman, and immediately thought, “if it’s by him, it’s got to be good.” As I thumbed through the pages of the book, I was impressed at the practical coverage of command line utilities including yum and rpm, apt and deb, etc. I highly recommend this book. It’s small so it’s easy to keep on hand.

For anyone wishing to write applications that take advantage of all that Linux has to offer, I recommend The Linux Programming Interface (also available from Amazon), aka TLPI. I used to recommend Stevens’ Advanced Programming in the UNIX Environment, but now I recommend TLPI because it is more comprehensive and just as readable. It’s not a small book, so a PDF makes it easier to keep on hand. I purchased my copy through the publisher, NoStarch with the coupon code “Mamaku” that gave me 30% off and a free PDF. The order total came to $80.00, including shipping.

Awesome Linux profiling tools: top -H and pstack

When I needed to figure out where the performance bottlenecks were in some Linux software, I found helpful answers at http://stackoverflow.com in the form of two tools: 1. naming threads in combination with “top -Hp <pid>” and 2. “pstack <pid>”. The first was helpful in watching which threads were consuming the most CPU. The second was useful in sampling the application over time to find the hot spots and their stack traces.

  • How to name a thread in Linux (or a process) — use prctl().
  • How to use stack sampling to find performance problems — use pstack.

Preventing laptop hard drive from overheating

Six months ago, I replaced the failing hard drive in my Linux laptop, and already, the SMART tools are telling me that I should back up and replace the hard drive — a high number of sectors have gone bad.

Hmmm. What’s this? SMART also reported that the hard drive had reached “overheating” temperature ranges. Why would that be? I did some Google searching, and came up with the following advice:

  1. Don’t close the laptop lid while it is powered up! This is how I had normally run my Linux laptop — it’s a server, and I leave the lid closed. Oops! I’ve changed the power settings so that when the laptop lid is closed, it sleeps.
  2. Edit /etc/grub.conf and add acpi_osi=Linux or try acpi=off to seee if apm (automatic hardware control) will take over. I’ve just started trying the former. UPDATE 8 Feb 2011: Using this prevented my laptop from waking up from sleep, so I stopped using it.
  3. Vacuum the dust off the fan screen (to prevent airflow blockage)
  4. Monitor the temperature with ‘smartclt’

Based on a tip from my father (a long time Linux expert), I ran “smartctl -H /dev/sda”, and it says “SMART overall-health self-assessment test result: PASSED”. I assume it means the hard drive is still okay, but I had better not forget to make regular backups, and monitor the status of the hard drive.

iPod Touch: what’s great, and what’s not

Janice gave me an iPod Touch, 4th generation, for my birthday. Here’s my take on it, compared to a Palm T|X and a Nexus One.

I’m going to take a list of features that I claimed I wanted, and recast it in terms of the iPod Touch. Next, I’m going to describe what pleases me about the iPod Touch, followed by what is annoying.

  1. Quick access. For some reason, I can forgive this omission with the iPod Touch, while I couldn’t with the Nexus One. Maybe the Nexus One prepared me so that I wasn’t disappointed.
  2. Bluetooth Keyboard support. Excellent. My Palm Bluetooth keyboard (3245ww) works like a charm with iOS 4. No Android devices do, that I know of.  This is a “killer feature” for me. Taking notes on a touch screen is vastly inferior to using a real keyboard.
  3. CalenGoo Calendar. Apple’s default calendar isn’t too bad, but CalenGoo is vastly superior, and worth more than the $6.99 that the author charges for the application. CalenGoo includes local alarms (on iOS 4), and snooze buttons. It lets me integrate my Google tasks into my calendar. CalenGoo isn’t quite as good as DateBk5 for Palm, but it’s close.
  4. Configurable alarm snooze length. With CalenGoo, I can configure the snooze length. Hooray!
  5. Contacts. With iOS, I can configure it to sort by last name, then by first name — unlike Android. I find that I usually use the search feature to look up contacts.
  6. Copy-and-paste in email, etc. Copy and paste on iOS 4 is outstanding, and works in nearly every app including email and the web browser. Copy and paste is better than on Android, and far superior to Palm, where I was limited to, at most, copying two paragraphs of text.
  7. Camera with good auto focus. I don’t particularly care about the camera in the iPod Touch, but it does do a good job with auto-focus.
  8. Standard headphone jack that isn’t finicky. What a relief! The iPod Touch headphone jack works as expected when I connect it to a variety of headphone jacks (my stereo), whereas the Nexus One would go into random shuffle preview mode.
  9. Record audio to a standard, ubiquitous format such as wav, ogg vorbis or mp3. Nope. Oh well. That’s what my Sansa Clip is for, I suppose.
  10. Full backup and restore. iTunes reportedly backs up my device.
  11. FM radio receiver. Nope. Good thing I have a Sansa Clip.

Things I love about the iPod Touch:

  1. Cost effective. It’s more cost effective than iPhone and Android because there’s no expensive monthly plan.
  2. The Retina display is outstanding and pleasing to look at, far better and more crisp than either the Nexus One or the Palm TX.
  3. The Safari web browser works very well. The browser on my Palm TX barely hobbled along, and often, that was too much, and it would crash, rebooting the Palm. So I never used that feature. Android’s browser is also excellent. It’s based on the same code: WebKit.
  4. When apps crash, it doesn’t take down the entire OS like on Palm.
  5. Slim and small. It fits in my pocket much better than my Palm TX.
  6. The Note Pad app lets me email notes to others. It also syncs the notes to my Google email.
  7. Availability. Purchase it from any Wal Mart, Target, or other department store.
  8. Accessories. The local Wal Mart had dozens of protector cases, alarm clocks, stereos, and other gear designed for iPod Touch. Try finding accessories for an Android device. They’re going to be sparse, and available online only. In its heyday, Palm had a variety of accessories (not nearly as much), but Palm is history.

Apps I love:

  1. Pandora music. I love being able to pick a music genre, and have it play excellent music that I’m not familiar with. http://www.pandora.com/
  2. LDS Gospel Library.
  3. LDS Hymns and LDS Children’s Songbook.
  4. Dictionary.com free dictionary.
  5. CoderCalc RPN calculator with four lines of stack on the display. With a clumsy touch screen, I find it vital to know that what I entered was correct, and with the four lines of stack, the problem is solved. A calculator with real, physical keys still beats a touch screen calculator.
  6. Mint.com app to keep me up to date on my finances.
  7. AIM Free, for when I need to send free SMS messages. Yes, AIM supports SMS.
  8. Kindle. The Kindle reader includes the New Oxford American dictionary.  Simply tap on a word in a book, and a definition pops up.
  9. iBooks. iBooks also supports pop-up definitions of words.
  10. Google. This app launches various Google services online. Google has made its web apps customized to work very well on iPhone. The google email web app is better than the iOS email app.
  11. Password Manager. I’ve chosen MyKeePass, not because it’s the best, but because it allows me to manage, store, and retrieve my passwords on Linux, Windows and the iPod Touch. I also figured out how to translate my Palm GNU Keyring password database into a format that Linux keepassx could import.

Annoyances:

  1. No standard menu button in apps. Both Palm and Android got it right.
  2. Apple’s email configuration wizard misled me to sync with Google Mail instead of Exchange. This meant that I didn’t get my Google Contacts synchronized to my iPod Touch until coworkers told me that Google supports an exchange connector. Instructions for setting it up are at http://www.google.com/mobile/sync/
  3. The music app didn’t show me a “seek in track” option. A friend helpfully showed me that by single-tapping on the (non-existent) album art, it would pop up a previously-hidden slider.
  4. No ogg vorbis support. I know this thing is billed as an iPod, but in my opinion, the Sansa Clip is a far better iPod. My music collection is in ogg vorbis format. The Clip supports vorbis, and it has an FM radio tuner, clips to my shirt, and is more convenient for outdoor activities.  For me, the iPod Touch is a Personal Digital Assistant, not an iPod. On the other hand, the Sansa Clip doesn’t have Pandora.
  5. Tethered to iTunes. When first unpackaged, it won’t do anything without first being connected to iTunes on Windows or Mac. I’m not sure whether Linux gtkpod would do the trick or not.
  6. Touch screen interfaces are inferior to stylus interfaces. The stylus on Palm was far more precise for selecting text, tapping on hyperlinks in Plucker e-books, etc. On the other hand, with a fat-finger interface, there’s no stylus to misplace. I love pinch-and-zoom.
  7. No way to send contacts to other devices via bluetooth. Palm had peer-to-peer networking down ten or more years ago, first with InfraRed, and then with Bluetooth. I suppose that in an always-connected iPhone world, people email things to each other. I’m not always connected.

I’ve never owned an Apple device until now. They’ve created an excellent device with the iPod Touch. It’s not perfect, but it’s adequate to replace my Palm TX as a personal digital assistant, and in many ways, it’s far superior.

“In 1976, the basic computational power of a $200 iPod would have cost one billion dollars, while the full set of capabilities would have been impossible at any price, much less in a shirt pocket.”  — Erik Brynjolfsson, Paul Hofmann, and John Jordan, Communications of the ACM, May 2010, p 33.

UTOSC: Small scale outsourcing

In early October, I attended the Utah Open Source Conference. I’m not sure what outsourcing has to do with Open Source, but it was one of the more interesting presentations I attended.

Outsourcing, by Scott Lemon of HumanXtensions L.L.C.

Scott worked for Novell, and they had a development center in India, which is what got him into outsourcing. That was back in 2000. Since then, he’s refined his personal model of outsourcing.

Q: You suck! Are you taking our jobs offshore?
A: No. You are in control of your own destiny. You are in control of the value you create in an organization. People in other countries want the American dream that we’ve “pimped” to them. Those people are educated, hard working, etc.

Leveraging…

  • Multiply your value by building a team
  • Multiply productivity and output
  • Increase your capabilities and income.
  • Scott + 3 locale developers and 7 offshore developers.
  • They run 2-3 projects in parallel.
  • They do $500K of revenue per year.

Communications…

  • are the most critical aspect of a distributed team. Most people “suck” at communicating.
  • to make outsourcing work, you have to communicate daily or more.
  • they use Basecamp, Acunote, SVN and Skype group chat.

Email isn’t any good. You have to use good project and task management tools. There are delays in email. You can’t track tasks via email.

Acunote is good for larger scale projects than Basecamp, but they do use Basecamp for smaller projects. Their projects are anywhere between $20K to $150K.

Where to outsource…

  • Scott stopped using India because the people there do a ton of job jumping. Training goes out the window. No notice. No notification. They simply vanish and are gone.
  • Now he uses people from the Philippines for many reasons: 0. Based on the recommendation of people he knew — people that were familiar with the country 1. They’re fluent in English and don’t have heavy accents. 2. Their education system is excellent. Sun Microsystems took over their educational system by giving schools a ton of Computer Science curriculum. The students have a C/Java background, and they can convert easily to PHP, Ruby, etc. The people are very smart. However, they don’t understand the American social context as well as we do. E.g. they don’t do coupon clipping like we do. E.g. they don’t have loyalty cards.
  • Their wages: minimum wage is $1.11/hour. He starts his trainees at $1.30/hour. Then he bumps it up for the next six months. If they stay on longer than 6 months, he pays them double minimum wage. He tells his people he will increase their wages by 10 percent per year, or more if they really excel.

An audience member said: One thing to remember is that some countries devalue their currency. So, if you an overseas employee $1 per hour, that dollar has more buying power than we realize, in their own country, compared to our own.

Scott met with attorneys in the Philippines to write up legal contracts, and because he wants not to be arrested — he wants to abide by the law. He hires his people as contractors, because it’s so difficult to fire employees.

He found a real deal with Wells Fargo that makes it free for him to transfer payroll to a bank in the Philippines — because he already has a bank account and a mortgage through Wells Fargo. He uses WF for payroll as well.

He’s not saying that you have to outsource to the Philippines. Pick a place that works for you.

Who does he hire?

He picks recent graduates. He didn’t want the rent-a-coder model, but someone that works for him, and is committed to him or his company. He hires people outside of major cities! It’s far cheaper that way, and easier to find people. He has a lot less risk of losing that employee. Recent graduates are trainable.

He recently hired 5 guys. He told the candidates what tech he was hiring for. The candidates went out and learned the tech, and wrote demo programs in the technology that they could show up at the interview.

With recent graduate new hires, he can lay out a wage growth plan over ten years.

How did he do it?

He didn’t sit on Google trying to figure it out. He flew to the Philippines. He listed jobs in local job boards two weeks in advance. While there, he met with university professors, scheduled interviews and made offers.

Standardized tools…

  • Specific tools (he’s flexible about programming editors), and instructions on how to install them.
  • Coding style document. They enforce this.
  • Specific frameworks and languages.
  • Process is defined for writing and testing code in a specific test environment.
  • They define communication channels. This is critical.

Patterns of operation…

  • He pairs 2-3 offshore developers with one local developer.
  • He points his developers to past consulting projects to learn from — as templates.
  • Most of his new hires are productive in 6 to 12 months — meaning that they can get much of the work done without him having to architect the initial setup — because the devs are familiar with the pattern from previous projects.

A day in his life…

  • Wake up, code review
  • Respond, new tasks
  • Client meetings, coding
  • Write tasks
  • Dinner break
  • On line interaction
  • Go to sleep around midnight

He takes breaks on weekends. He does do things Sunday night, because that’s Monday morning in the Philippines.

His business doesn’t do the graphic design of websites — just the system and the infrastructure.

Scott seemed to think that Objective-C is a dead-end one-trick pony. He leverages Titanium to let his guys do JavaScript to develop iPhone and Android apps.

They do the testing of the apps. Customers pay for new features and maintenance. Customers get to hammer on a test server as well before deployment.

His contractors have to do their own taxes. He reminds them of this.

Q: What about the Philippine employees ripping off his intellectual property?

A: He worries about it just as much as he would with American employees. This is what contracts are for, and the legal system.

He uses Balsamic to prototype things. His offshore devs build his prototype into a product, and make it far better than his mockup. His devs are very capable and skilled.

Linux rdesktop, sound and Fedora

I use ‘rdesktop’ from my Linux box to connect to a Windows machine. rdesktop can forward sound using the “-r sound” option, but it stopped working in Fedora 11, when PulseAudio made its appearance.

The reason is because:

  1. rdesktop uses the obsolete OSS sound device /dev/dsp
  2. Fedora/RedHat disables OSS sound support so that it doesn’t conflict with PulseAudio

The workaround, for now, is to, run this, as root:

sudo modprobe snd-pcm-oss