How My Desktop Follows Me

In my last post, I mentioned that I have been transitioning out of a single machine mindset into having everything at hand with terminals where I go. I have largely stuck with it for the last month and a half, and it works very well. My backpack is oddly out of balance now that I’m mostly carrying around little items like my iPod Touch without the monster.

In any case, I promised a follow-up post where I discuss how I’m managing to do it. Here’s the list of computing tasks and needs that I have and the services that have me covered:

  1. stickies, random text documents, and other notes: Evernote. Until recently, I was very dependent on the stickies on my computer. It had my todo list, various details of interest, important addresses, and anything else I needed off-hand. I couldn’t survive without it. As evidence, when my motherboard got fried and I didn’t have a computer for a few days, the most important thing I needed to get off my external backup was my stickies: all other documents, music, code, etc were secondary. Beyond that, my “Documents” folder on my computer was also largely random notes and lists. All of these transferred cleanly into notes in Evernote, which syncs these to the cloud and offers desktop, mobile, and web integration. Now, without my stickies, I can’t live without it.
  2. music, podcasts: Pandora, Spotify, iTunes syncing. There are too many good services online nowadays to stream music, and since their libraries are mostly bigger and better than mine, it works. Podcasts are still dependent on having my one iTunes account on my machine to keep track of which ones I have listened to, but since I can sync it to my iPod, they’re with me everywhere. Recently, I put a pair of speakers in my kitchen and have been listening to podcasts while doing dishes and cooking. So, this is even more portable than the setup I was fixed in before.
  3. movies/media: Netflix. I never did have many movies or TV shows, so netflix streaming is another improvement. I like to think it’s not completely down the drain paying for the service, since it is saving me from buying another season of 30 Rock on DVD every year.
  4. documents: Dropbox. But to be honest, I don’t really use documents anymore and haven’t really used dropbox. Weird.
  5. bookmarks: Chrome syncing. Without this, I could have never made the switch, but between the computers I use regularly, I’m largely in exactly the same state since I spend so much time in the browser. This, along with Google+ (as discussed here), stopped my delicious usage almost entirely. Instead, I can keep a “To Read” folder on my bookmarks toolbar and leaves interesting but long sites in there.
  6. calendar: iCal. Someday, I might switch to Google Calendar, but since it syncs up to my iPod, this has worked out fine.
  7. email: gmail. I haven’t used a desktop mail client since getting my gmail account 7 years ago.
  8. video games: no solution needed. My games are only on my home machine, but that’s fine. I don’t need them anywhere else anyways. This also happens to be the only thing that I do that requires my computer to have any juice whatsoever. Since I usually manage to keep the number of open browser tabs relatively low, everything else runs fine and could on much less hardware.
  9. software development: ssh. I don’t do any development on my local machine: everything I do is on servers that I log into.
  10. homework: none. This largely sits on my home machine since this is where I do my homework, though I could just as easily copy them into my dropbox folder. The only downside would be that I wouldn’t have them appear on my desktop, so this is probably another relic.

Even for all these changes, however, I actually have been moving my computer pretty regularly. In my school year housing, my room and the common room are separate, so I end up carrying my computer downstairs to plug it into the TV whenever I want to stream any movies or sports games.

I don’t necessarily have any problems or need my life more fragmented, but let me know if you have any suggestions for other services that might be useful. I’m definitely interested to hear how others have transitioned with more cloud services or have compelling reasons for not changing.

My Desktop Everywhere

Back in my high school days, I wondered why computing wasn’t more portable than it was. Although laptops were popular, they still weren’t that convenient. I myself had a 64MB flash drive that I carried in my backpack that I used to sneak prohibited files onto school computers. It got most of the work done, but it wouldn’t be too much worse to carry around an entire hard drive with me if it could maintain the total state of computer between home and school. This clearly seemed like the dream setup to have: carry around, say, a 1 lbs device that could be plugged into any terminal and give you the exact same setup on any hardware.

In between then and now, I found a pretty good substitute in my Macbook Pro. Coming in at 5.4 pounds, I could carry my life around with me between my dorm room, home, class, library, and wherever else I needed it. It was pretty ideal, and for awhile, I believed that the best way to live was with a single machine. No hassle with trying to sync multiple devices or reconfigure anything: just pick it up and go. My dad insisted that I have a laptop for when I went off to college, and I still agree that this was the easiest way to do things.

Having finished my 4 undergraduate years, though, I’m thinking that this is no longer such a good setup. First, it actually isn’t as wonderfully portable as it could be. When I travel, I have to switch out to use my laptop backpack, and it and peripherals dominate what i can carry. Second, it isn’t very comfortable to use. My current setup has it linked up to an external keyboard and mouse with the actual laptop perched on a board game so that the screen is closer to a comfortable viewing angle. Even better would be a larger external display, but at that point, I’m not using any of the built-in input or output functionality of the laptop.

Third, I don’t actually need to be that portable nowadays. Most of my work is done at desks, and I don’t need a laptop to work at a desk. I don’t go home that often, and the only other time I can think of that I really need a laptop is when I’m working with someone else on, say, a group project. Continuing on that note, my fourth reason is that I probably shouldn’t be carrying my laptop around with me anyways. For the first 2 years of college, I almost never moved my computer from my desk. I don’t think it’s unreasonable to say it was less than once a month. It was fine because I wasn’t distracted while I was in class. Beginning my junior year, I started lugging it around, thinking that I would be able to do some work at various times. Inevitably, though, I would find another good distraction and never get around to what I meant to do. And fifth and finally, the specs are very good for the price.

Even though the laptop doesn’t seem to fit my needs as well anymore, it’s okay because my original dream has been accomplished, though perhaps in a form I wasn’t expecting: the cloud. It’s a buzzword, but simply, that complete setup on any hardware exists and is even lighter than I thought it would be. Now, I can sit down at a computer, pull up a few online services, and have access to all of my music, documents, applications, files, and everything else I typically use on a computer. And thanks to Google Chrome syncing, my effective “desktop” is the same everywhere as my bookmarks, extensions, and other browser configuration follow me around.

I’ll get to describing the suite of services I use to do that in another post, but the conclusion that I’ve drawn from this is that I don’t need to carry around a physical object with me to make my computer use portable: I just need the internet, and other than airlines and fancy hotels (the cheap ones always offer free wifi; go figure), wifi is pretty much everywhere I would sit down to use my computer.

Still, there are situations where I would like to carry around a device with me, such as plane rides or trips home, and I’m thinking about getting myself a tablet (specifically, an iPad) to cover my bases there. In many ways, it doesn’t have good features that a PC would have, but I don’t think it needs it. My conception is that using a tablet is a fundamentally different method of computing, and I think I’m willing to take the plunge and see if it works when I get one.

In the meantime, I have stopped carrying my computer back and forth to work, instead leaving it at home as my “desktop” here and using another box at work. I couldn’t quite get away from the convenience of UNIX for development and am learning how to use Ubuntu on it, but in spite of a different operating system, I’m using it in almost the exact same way as my MacBook Pro sitting at home. As for portability, I’m carrying my iPod Touch around with me at all times now after basically leaving it untouched for the past 3 years. It’s limited, but it’s unnoticeable to carry and comes in handy in a few spots.

My transformation isn’t complete, but I’m excited to see how I adapt to this new setup over the next few months while I wait for another round of better hardware to come out. It may not be instantiated exactly as I imagined, but it looks like technology has snaked past the road bump of laptops and passed my dream of portability.

Fresh Server Install

Due to some very poor decisions earlier, I managed to completely screw up the OS on this server, resulting in some downtime. Since then, I have decided to use a clean install, especially since my server was horribly configured anyways and probably needed a clean slate.

I tried hard to get everything put back together, but I probably missed something. Email/contact me if you notice any strangeness or problems with services from this server, and I’ll try to address them as soon as possible.

Installing Django on Snow Leopard (and MySQL and PIL)

UPDATE 11/3/12: If you’re now on Mountain Lion, life has gotten much easier. Read my new post on it

UPDATE 8/4/11: The instructions here are a little dated and difficult, probably from my own ignorance. With Lion out, too, things have changed enough that you should probably use the instructions here instead.

I recently needed to port a Django app off of our Linux server onto my Macbook Pro, which was slightly more involved than I thought it would be. I don’t remember having nearly so much difficulty with it when I initially set it up on my old Leopard partition, but times change. In any case, I figured it would be a common enough task that I would offer instructions on how to make it work. If you’re looking to just install Django fresh, you’ll notice there are a few steps specific to importing parts from another Django app, but it’ll mostly apply. So let’s go.

Here’s exactly what we’ll be putting together:

  • MySQL
  • Django
  • MySQLdb – a python package to communicate with MySQL
  • libjpeg – necessary for PIL
  • Python Imaging Library – a pretty useful library for drawing and more

If you’re more slick from Terminal than I am, there are a lot of steps here that you can do out of that. If that’s you, then you can translate those operations yourself. If you’re like me and still like GUIs for some tasks, maybe this will work better for you. I’ll also leave a trail of links to the references I used to figure it out myself so you can read the real reference

1) Installing and setting up MySQL

Download MySQL. Particularly, I ended up getting the 32-bit version for reasons that are not clear to me, though the 64-bit version might have been the correct call. I at least know it works with the 32-bit version. There’s a .dmg version that apparently fast-tracks the installation, but I ended up not using that either because it didn’t download properly. So here’s what you do to do it manually from the tarball.

and unzip it by just double-clicking on it in Finder. From Terminal, run the following

cd /usr/local
sudo mv (copy path) ./
sudo ln -s full-path-to-mysql-VERSION-OS mysql
cd mysql

Here’s a nice trick I learned recently. You’ll notice the code above has (copy path) in it for the path to the mysql folder you just unzipped. Instead of typing it in, you can click and drag the folder from Finder to Terminal, and it’ll fill in the whole path for you.

So if you want to do things properly, you’ll create a separate mysql user, apparently, and let everything run through that. In my case, I’m not planning on ever using MySQL locally for actual production, so I lazily just have everything running from my user account. To complete setup

scripts/mysql_install_db
bin/mysqld_safe &
mysqladmin -u root password NEWPASSWORD

Where you can fill in the root password. Next, for convenience, let’s add the mysql commands to our path so we don’t have to type them every time. Open up your bash profile and add this line (if it doesn’t already exist, just create it at ~/.bash_profile)

export PATH=./:/usr/local/mysql/bin:$PATH

Of course, if you already have a path there, you only need to append the bit about mysql from it. For convenience in the rest of this setup, copy the same line into normal Terminal and run it to update your PATH variable in session.

Right now, the mysql database is running because of “bin/mysqld_safe &” above. In general, from now on, the command to start it is

mysqld_safe &

and the command to shut it down is

mysqladmin -u root -p shutdown

where you’ll need to type in the root password you defined above. Go ahead and start the MySQL database again. The next little bit is for porting the contents of a web server database to your local machine.

mysql -u root -p
create database DBNAME;
exit;
ssh username@server.com
mysqldump -u root -p DBNAME > ~/DBNAME.out
exit
scp username@server.com:~/DBNAME.out LOCALPATH
mysql -u root -p DBNAME < LOCALPATH/db-name.out

Reference:

  • http://dev.mysql.com/doc/refman/5.1/en/mac-os-x-installation.html
  • http://dev.mysql.com/doc/refman/5.1/en/installing-binary.html
  • http://www.cyberciti.biz/tips/howto-copy-mysql-database-remote-server.html

2) Installing Django

This part is thankfully very easy. Download Django from here and unzip it. I myself ended up using the 1.0 to avoid compatibility issues with our web server, but I’m guessing the latest version is the greatest. cd to the folder you just extracted and execute

sudo python setup.py install

Boom, done. Thanks Django!

3) MySQLdb

Okay, so this is going to let us tie the 2 pieces we’ve put down together. Download MySQLdb from here, unzip, and navigate to that folder. In Terminal, execute the following:

 

ARCHFLAGS='-arch x86_64' python setup.py build
ARCHFLAGS='-arch x86_64' python setup.py install
defaults write com.apple.versioner.python Prefer-32-Bit -bool yes

To check to see if it worked, execute this:

python
import MySQLdb
exit();

So if you didn’t get icky output, then that worked. If it didn’t, I’m not the person to ask.

If that worked for you and you’re not using PIL, then you’re done. Head on over to the Django tutorial if you want to try it. If you’re doing drawing stuff, then you’re not out of the woods yet.

Reference:

  • http://yousefourabi.com/blog/2008/06/django-on-leopard/
  • http://cd34.com/blog/programming/python/mysql-python-and-snow-leopard/
  • http://www.jaharmi.com/2009/08/29/python_32_bit_execution_on_snow_leopard

4) Installing libjpeg and Python Imaging Library

First, you’re going to need to have Xcode installed so you can compile lipjpeg. If that’s not already installed, you can find it on your Snow Leopard installation dvd under “Optional Installs” or from the Apple website.

We’ll start with libjpeg. Download it from here. You’ll probably want one that is of the form jpegsrc.v7.tar.gz, where the version might be different. Again, extract, navigate in, and execute this

export CC=/usr/bin/gcc-4.0
cp /usr/share/libtool/config/config.sub .
cp /usr/share/libtool/config/config.guess .
./configure --enable-shared --enable-static
make
sudo mkdir -p /usr/local/include
sudo mkdir -p /usr/local/lib
sudo mkdir -p /usr/local/man/man1
sudo make install
sudo ranlib /usr/local/lib/libjpeg.a

Don’t ask me what a lot of that means. I just copy what people tell me to do.

Finally, we can install the PIL. Download it from here, extract, and navigate it. The last Terminal commands are

python setup.py clean
python setup.py build
sudo python setup.py install

And that should be it.

Reference

  • http://stackoverflow.com/questions/1438270/installing-python-imaging-library-pil-on-snow-leopard-with-updated-python-2-6-2
  • http://jetfar.com/libjpeg-and-python-imaging-pil-on-snow-leopard/
  • http://snippets.dzone.com/posts/show/38
  • http://stackoverflow.com/questions/1398701/problems-with-snow-leopard-django-pil

Wrapping Up

So there you go. To get your apache server running to make your Django app go, go to System Preferences->Sharing->check “Web Sharing”. Your Django app can live where it is, but if you need to drop media files somewhere, the www root for Mac OS is /Library/WebServer/Documents/

Have fun!

Don’t rsync /var with –delete

About 10 minutes ago, I learned an important lesson: make sure you fully qualify the folder you want to sync. And don’t use the delete option if you’re not entirely sure how to use it. The bad news is that I accidentally deleted this website and panicked for a second.

But I like to look at it on the bright side. For about 10 minutes of downtime, the good news is:

  • There’s a reason why people don’t just use root all the time. I need to be better about this, because it paid off majorly this time to not have permissions
  • my laziness in working on my website template means that I didn’t accidentally erase a bunch of work
  • I now know how rsync works a bit better
  • It caused me to backup my blog database so that the next time there’s a disaster, I’ll only be partially screwed
  • I didn’t need to upgrade wordpress because a fresh install does that, too

Wow. That could’ve been a lot worse.