WPTouch

February 14th, 2010

Credit to Jaap A. Haitsma’s WPTouch blog entry for first mentioning this plugin (at least, the first place I saw it, since it seems to be making rounds on other blogs as well). With the simple activation of this plugin, your blog gets automatic formatting on mobile devices. Once it was installed I took a quick peek on my iPhone and it looks awesome. Very cool stuff for such a simple installation.

Cool for the sake of coolness

August 31st, 2009

I was making coffee earlier and I overheard my wife on the phone.

“English”
5 seconds later
“En-glish.”
5 seconds later
“ENGLISH”

It didn’t take long to figure out she was on the phone with her cell phone carrier. I won’t say which one, but let’s be honest, in the United States they are all pretty much equally bad.

That’s not the worst part. She then recited the phone number of the account she’s trying to work with. Recited, as in spoke out loud.

I’m not a user interface designer. I don’t claim to be. But I can’t find a single reason why someone would think it’s better for customers to speak the phone number rather than simply using the keypad like we’ve been doing for decades now.

Yes, voice recognition may be cool. But cool isn’t always the best option.

Graduation day has arrived. You’ve learned enough sorting algorithms to make you more than mildly annoying at boring parties, giggled every time you misheard your professor say “sets”, and have come to hate the traveling salesman. You are ready to step out into the real world and make your mark.

Right?

There’s only so much time over the course of four years in which students are awake, sober, and mentally alert enough to be taught. It’s impossible for us to cover everything before unleashing you out into the wild. So after a bit of thinking back to my own trial by fire in the real world, I came up with a list of things any self-respecting geek should do before graduation.

SSH (or telnet) into another machine and do something

I’m not trying to scare you, but chances are, you’re going to find yourself working on a machine without the comfort of a GUI available. As the mouse sits there uselessly taunting you, you’ll be left with a blinking cursor and no idea what to do next.

At some point before graduation, develop some command line proficiency. Learn the basic commands for navigating between directories (cd), listing files (dir on Windows, ls on Linux/Unix), and a few other commands to make you reasonably comfortable on the occasions where you need to connect to a remote machine. Everyone from a system admin managing multiple offices to a developer who needs to work on a QA or production box will at some point need to connect to a machine over the network and get something done..

Learn Vi or Emacs

The premise here is simple: learn a real text editor. No, Wordpad doesn’t count. Anyone who suggested Notepad, please sit down and keep reading.

There is a long standing religious feud between vi and emacs, much like Coke v. Pepsi, Yankees v. Mets, and “Tastes Great” v. “Less Filling” (I’m afraid that last one may have just showed my age). Most people fall in love with one and consequently adamantly hate everyone from the other camp. I personally tend towards emacs, but in a pinch I know how to navigate around vi to get the job done.

There are a bunch of reasons this is important. Both editors are powerful, providing users with a number of speed enhancing features. I know developers who use these in place of full blown IDEs. Both offer text-only versions, which will come in handy in the above scenario of working on a remote machine from a command line. Both (or at least vi) will be available on pretty much any Linux/Unix machine you find and can also be installed on Windows. Both also have very active communities, so finding tutorials on the internet should be simple.

Oh, and for the record, vi is pronounced as the two letters that make up it’s name (“vee-eye”). Don’t call it “six” thinking you’re being cute and reading it as a Roman numeral. Best case, you get laughed at. Worst case, someone throws something heavy at you.

Set up a LAMP server

A LAMP server refers to a machine running a suite of the following open source software:

  • Linux – Operating system
  • Apache – Web server
  • MySQL – Database
  • PHP – Programming language

The configuration has become so popular that the term “LAMP” has arisen to describe the four aspects (the first letter of each of them if It’s not clear).

Why? It’s a great introduction to a ton of different things you’ll likely need in the real world. If you’re reading this, I don’t need to explain to you why learning the fundamental blocks of building a web server are important. A LAMP server provides all of these pieces. It will also give you experience in dealing with configuring and connecting to databases, which will come in handy on, well, pretty much every project you’ll ever work on.

On top of that, there are some really cool open source apps written in PHP to install and dork around with. Wordpress (blogging software; used for this site), Gallery (photo sharing site), and phpbb (forums) are just a few of the open source applications you can download, install on your LAMP server, and tweak as much as you want. Bonus points if you check out the source code for these applications from their respective repositories.

This also makes for great resume padding, since it shows enthusiasm, curiosity, and technical ability.

Ok, ok, I’ll even bend a little bit. If this seems too daunting, take out the Linux part and do it on Windows. Just know that I’ll be disappointed in you.

Dual boot your system

Ok, I lied about bending. Given the size of hard drives these days, there’s no reason you can’t spare a few gigs to install a second operating system. The Linux installer is extremely friendly towards these types of setups. It will even go so far as to set up a menu when you boot to let you pick which operating system you want to boot into.

Dual booting allows you to hold on to a Windows installation while still giving the option to play around and learn Linux. And using Linux will make you a bad ass.

Install new hardware into a desktop computer

When I was 10, my dad showed me how to install a memory stick into a computer. He then informed me that the 4 seconds it took me to do it would have cost upwards of $30-$50 per stick at any local computer store. That’s not a bad rate for something that takes the same dexterity as putting bread into a toaster.

I’d like to have made this point “build a computer”, but I realize I’m talking to college students who can barely afford Ramen, much less the parts necessary for a desktop. But I do realize that at some point, you’re going to have an upgrade that needs installing. Do it yourself. It’s not as scary as it sounds and you’ll save a ton of money.

And while you’re in there, air dust it. If you’ve never done it I guarantee you’ll find a small furry creature has set up camp in one of your fans.

Student Blogging

July 28th, 2009

There’s been a discussion going around the blogs on the teachingopensource.org planet blogs about teacher/student blogging that’s really gotten some interesting ideas going. It started out with a great post by Matt Jadud outlining some basic tenants of a blog in a guide for students. It also got picked up by David Humphrey which highlighted that it’s important for teachers to serve as a model for this sort of learning reflection as well.

My blog (as in, the one I’m writing this on) started out as an experiment to give students some outside information I thought they could use but couldn’t fit into class time. It’s since evolved (and continues to do so) into the sort of technical blog that I’ve found helpful in the past when looking for an answer to a specific question.

That evolution has proven to be important. Using a blog as the medium allows me to introduce a lot more of my personality into the entries than if I were to write a formal academic textbook. I think that’s a really important concept that I’ve seen unfortunately get lost on a number of professors. I’ve always found it easier to keep interested in a more conversational tone than when reading a preachy lecture.

My blog also gives a good insight into my tech-related projects and interests. I know many professors are looking for students to get involved in their research and projects. Often, the students either don’t know about the projects or are first presented with an ominous (read: cold, formal, dull) white paper describing the research. A blog is a natural marketing tool (not my word, I think Matt used it, but it’s a great term) for driving interest in these projects.

Meanwhile, a student authored blog is, among other things, a resume-padder. When I interview candidates, one of the most important factors I look for is enthusiasm. I want people who enjoy doing this stuff. A blog, even if it’s not 100% technically focused, shows the level of interest I’m looking for. Bonus points if you installed and administer the blog software yourself. Extreme bonus points if you contributed back to the blog software you used. :)

It’s also practice. I had one particular CSC professor stress the ability to write. I didn’t fully understand it at the time; I was going to be a coder and wouldn’t need to write. I’ve since told her, on a number of occasions, how much I came to appreciate the experience. The English/History/Philosophy papers students are writing for other classes are a very different voice than trying to explain to someone else why a project is a good idea or how you got around a particular bottleneck. Getting a feel for how to do that early on will be a tremendous advantage when students find themselves on team projects.

And like Matt said, it can even help propagate the awesomeness of keyboard cat.

Repost: This happened back in Feburary 2009 and was posted as “Disaster Averted” mainly to annoy my students with the fact that class was *almost* cancelled that night. I’m reposting it with a more accurate title for searching purposes (read: I needed to find this again but couldn’t because of my annoying title).

When I got to campus today and turned on my laptop, I was greeted with an all black screen and just the word “GRUB”.

Shit.

Some quick background for my students… GRUB is one of the bootloaders available for Fedora. In short, a bootloader is what takes control from the BIOS at boot time and passes it to the operating system. No bootloader = no operating system. So here I found myself, on campus needing my laptop for class tonight, without anything to help me.

That last part needs some elaboration. Fedora added a really cool feature where the Fedora installation can be installed to a USB drive. While I was at Red Hat Summit last year, I got Fedora 9 installed to the USB drive they gave out as swag. That doesn’t really help much since I kept forgetting to swap out the USB drive on my keys with my newly pimped out Fedora install stick.

My forgetfulness came back to bite me, since when I needed it most, what should have been an extremely conveniently located live Fedora install is sitting in my office at home, a few feet away from half a dozen Live CDs of various Linux distros that also would have been helpful to have around.

That aside, this was actually sort of cool in a way. While studying for my RHCE, I found new and creative ways to destroy a Red Hat installation to practice for the exam. I had managed to run into this exact issue and knew how to fix it, I just needed some form of rescue CD to do it.

The first half of that was easy, I logged into a machine in the lab and downloaded the Fedora 10 ISO from fedoraproject.org (insert generic “Try that with Windows” comment here). Thankfully, the lab machines have CD burners. However, I needed to find a CD first. Having no luck digging around the lab, I went downstairs to the university IT department’s tech helpdesk.

“Are you a student?”

Ok, so it was a fair question to ask me. It’s the last class before Spring Break and I’m not feeling well, so I’m here in a Villanova sweatshirt, jeans, and sneakers.

“No, I’m a professor. I need the CD for class tonight.”
“Really?”
“I assure you, I’m not a student.”

Thankfully, one of my students last semester had introduced me to one of the IT guys in the room who recognized me and vouched for my employment. I can’t really fault them for asking; I’d get annoyed too if a student bust in the helpdesk asking for free stuff.

One burnt CD later and I was into the Live CD. A few commands after that, I rebooted sans CD and was up and running.

Which brings me to the meat of this post, how to reinstall GRUB from a Live CD. It’s actually pretty simple. After booting into rescue mode, run:

grub

That’ll bring you into the interactive GRUB shell (notice the prompt changes to “grub>”).

grub> find /grub/grub.conf
(hd0,0)
grub> root (hd0,0)
grub> setup (hd0)

The find command was just to verify the hard drive where the boot files are located. The setup command completed almost instantly, which actually had me a bit worried that it did nothing. But the output looked pretty convincing:

Checking if "/boot/grub/stage1" exists... no
Checking if "/grub/stage1" exists... yes
Checking if "/grub/stage2" exists... yes
Checking if "/grub/e2fs_stage1_5" exists... yes
Running "embed /grub/e2fs_stage1_5 (hd0)"... 16 sectors are embedded... succeeded
Running "install /grub/stage1 (hd0) (hd0)1+16 p (hd0,0)/grub/stage2 /grub/grub.conf"... succeeded
Done.

After that, it was as simple as rebooting without the CD. I’ll still need to look around to make sure nothing else is messed up, and even more disconcerting is what caused this in the first place. But for now, at least I’m not stranded on campus with a dead laptop.

In the meantime, hopefully now I’ll remember to put the damn bootable USB stick on my keys… (Update: I put it on my keys that night when I got home from class)

I can’t help but think of this xkcd comic which feels kinda relevant right now.

I came to the realization that I have too many computers constantly running in my house. It’s not so much a “go green” thing to use less electricity as it is me being cheap and wanting to lower our bill. It’d also be nice to walk in a room and hear silence rather than whirring computer fans or have to clean dead spiders from multiple desktops. After reading an article in Linux Journal about hacking the MyBook (external network drive that runs linux under the covers), it looked like it could serve a lot of uses, starting off with being the house file server and backup system.

So far, I’m off to a good start. To begin with, the Linux Journal article is already somewhat obsolete as there’s no need to hack it anymore. The latest firmware flat out gives you the option to enable SSH on the device; once you’re in you can do pretty much whatever you want. One click in the web UI and one terminal later, I was logged directly into the system.

The MyBook runs BusyBox linux. I’ve never worked on a stripped down linux install like this, but other than missing a few commands I’ve come to love (I continue to type less; my brain just refuses to acknowledge that it’s not there) it’s pretty easy to navigate if you’re comfortable on linux.

Initial Setup


The instructions tell you to install the included software which only runs on Windows, at which point I promptly said f-that and tossed the guides. Once you plug the box into the network, it will use DHCP by default to get an IP. Use your preferred means for figuring out that IP, such as checking your router logs for the lease information. I went a different route and just port scanned my network looking for an IP I didn’t recognize.

-> nmap -sP 192.168.0.1/24
 
Starting Nmap 4.76 ( http://nmap.org ) at 2009-06-16 17:42 EDT
Host 192.168.0.1 appears to be up.
...
Host 192.168.0.112 appears to be up.
...

I snipped out the rest the results, but you get the idea. I only have a handful of non-static IPs internally so it wasn’t too hard to figure out which one was new. The box runs lighttpd and has a pretty slick (albeit a bit slow) interface to most of its guts, so after digging the included CD out of the trash to look up the default password, I was able to connect to it and start dorking around.

The MyBook comes with a lot of features, with the small caveat that I don’t actually need most of them. So the first thing I did was run around disabling things. It’s very cool that the device supports Samba and AFP, but frankly, I just don’t need them (I’ve had the wife running linux for years now, she rocks). I also killed FTP and the Mionet software. It wasn’t all slash and burn; I enabled SSH and NFS and made a new user for myself. Ultimately I’ll turn off the daemon that controls the slick white light on the front of it, but the novelty is still there and it looks damn cool at night (and really creeps my wife out since the light pulsates).

At that point, I was able to SSH into the box and (potentially) really get myself in trouble.

Enabling Cron


The file sharing aspect of the box is very handy, but part of wanting a device I could hack away at is to have it do more than just be a dumb file server. To start with, I want it to run out and backup my web sites (this blog included) nightly. I have a series of scripts on the system this is replacing that already do the task, it was just a matter of getting the MyBook to do them.

Cron is on the system, but it doesn’t work out of the box. I had to make one small change: creating the directory in which it’s going to store the schedules.

mkdir /var/spool/cron/crontabs

Here’s where I got lazy. I just set the permissions on the cron and crontabs directories to 777 to make my life easier. It’s far from secure, but I’ll work on that later. For now, I just wanted to get my non-root user to be able to schedule things.

The other change that needed to be made was to start the crond daemon. I didn’t find anything in the web UI to support this, but given the rate at which the firmware is exposing functionality I wouldn’t be surprised to find it there in the near future. I hacked up a pretty rudimentary init.d script so it would auto-start on reboot and was on my way.

SSH


Once I had the ability to schedule tasks, I needed the MyBook to be able to log into my web server. The ssh client is already installed, however it took a bit of hacking to get to a point where I could generate public/private keys to automate the login.

The main issue is that the home directory for all created users is simply defaulted to /shares. That directory serves as the root of all of shared files. Not that I’m expecting to create a ton of users, but I didn’t like the idea of a single .ssh directory for all users. I didn’t find any user mod tools on the install, so I just changed the /etc/passwd file to give my user a different (read: private) home directory. After that, it was as simple as running ssh-keygen like any other linux system (I won’t get into those details here, but it’s pretty easy to google around for generating SSH keys).

After installing the public key on my webserver, I was good to go for automatically logging in.

Rsync


I was happy to find rsync was installed and working out of box. Between that and scp, I was pretty set for my current backup needs.

Profit


The rest of my backup automation fell into place. I had to edit my scripts a bit since the MyBook doesn’t come with bash, but otherwise the rest of the process was painless. Nightly, my MyBook runs out to my webserver, backups a snapshot of the database, and copies over any changed files. All of this from a 6 inch by 6 inch little box on my desk. The desktop that previously did this has been powered down since the weekend. Awesome.

I’ve also copied over the “family” shared files to the MyBook, such as music and pictures. It was done simply through NFS so I won’t go into details here other than to say that there were no unexpected hiccups in the process.

There’s more I want to tinker with on the box. The web UI is in PHP and after a bit of looking around, I was able to find and start editing the web UI site. I’m thinking of adding my own section that will at very least report on the previous night’s backups. I’ll get to that eventually, for now I’m happy to have replaced one of the desktops in my house. :)

MyBook Bitch Slaps Desktop

Statement of Purpose

June 15th, 2009

A friend of mine just got accepted to a grad program at Cornell. He wrote up a good blog entry on the statement of purpose essay he had to write that might come in handy for any of my students who are applying for various grad and research programs.

The entry can be found here. Take a look around the rest of the site while you’re there, the dude is brilliant and posts about some interesting projects he’s into.