Everything In Between

The brutally honest, first-person account of Meitar Moscovitz’s life.

Archive for the ‘Geeky’ Category

Using Calendars from the Command Line

2 comments

If you’re anything like me, you always have a terminal window open. One of the reasons I do this, of course, is because it’s fast. If I want to know anything at all about my computer, all I need do is type the question. The answer, because it’s always text-based, comes back immediately. I don’t have to wait for a window to open or for a pane to scroll. Everything comes at me from a single visual direction, the bottom of my terminal window.

However, there are some occasions when a text-based response to a complicated question isn’t very helpful because it requires so much extra work to understand. For me, the most common example of this sort of issue has always been in looking at time-based information, and more specifically, calendars. Whenever I’m on my machine, I almost always need to look at a calendar.

In the past, I used to go all the way over to iCal. Sure, I can do this using keyboard shortcuts only, but sometimes all I want is a quick answer to “what date is this upcoming Friday?” In situations like that, I’ve lately begun using the cal command, and my oh my, what a timesaver.

cal is kind of like man for dates. Of course, you can get more info by saying man cal to your prompt. The cal program, installed by default on almost all UNIX-based systems (including Mac OS X), has a ton of useful options. However, most of the time, I don’t need more than a few.

For instance, let’s say I just want a calendar of the current month. I can get get a compact, simple month view instead of going to iCal by saying just cal at the command line:

Perseus:~ maymay$ cal
     April 2008
Su Mo Tu We Th Fr Sa
       1  2  3  4  5
 6  7  8  9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30

Other options let me ask other questions of cal. Easy, simple, fast. I like it.

Written by Meitar

April 18th, 2008 at 8:47 pm

Sharing your Windows XP Virtual Machine’s Internet connection with your Mac OS X host operating system using VMware Fusion

5 comments

In some situations, like the odd one I now find myself in, the only way to get Internet connectivity is to use a solution that requires a fair bit of maneuvering. In my situation, I have temporarily obtained a Vodafone 3G mobile card. Unfortunately, the Vodafone Mobile Connect software for Mac OS X as of this writing is obscenely poor. Of course, Vodafone’s software for Windows works without a hitch.

The only way I could get my Vodafone 3G card to work was to fire up a Windows XP guest inside of my MacBook Pro, using VMware Fusion. Connecting to the Internet with the 3G card using the Windows guest was smooth sailing, but that only provided the Internet connection to the Windows virtual machine. I wanted my Mac to be directly connected.

The solution is obvious, but a few gotchas really bit me hard. To get the Windows guest to share its Internet connection from the 3G card to my Mac, I would need to bridge VMware’s virtual ethernet adapter from the Windows guest to the Mac OS X host. Once bridged, both the Windows guest and the Mac OS X host would logically be on the same ethernet network segment. At this point, I can enable Windows XP’s built-in Internet Connection Sharing (stupidly dubbed “ICS” because everything needs a TLA) on the 3G connection so that Windows NATs it through to the bridged virtual ethernet card. Finally, I can connect to Vodafone’s 3G network, and all should be well.

Here’s the gotchas.

First, in order for VMware to actually initiate the network bridge when it starts up, it must detect that a physical link is active on your Mac. In other words, Mac OS X’s Network System Preferences pane must show you a yellow dot next to at least one physical networking device (probably either your “Built-in Ethernet” or your “AirPort” ports). VMware Fusion will give you no errors or warnings that a bridge is unavailable until you try to connect your virtual machine’s network while set to bridge, in which case VMware Fusion will complain with an error that reads: “The device on /dev/vmnet0 is not running.”

Obviously, if you have no other devices to connect to, you need to fake one. The easiest way to do this is to set up a Computer-to-Computer network using AirPort. Just go to your AirPort menu bar item and select “Create Network…” and create the network (preferably encrypted). If you check System Preferences now, you should see a that AirPort has a yellow dot next to it and reads as having a “Self-Assigned IP Address.” Now that you have a physical link on your AirPort card, you should be able to start the VMware Fusion virtual machine with bridged networking mode without incident.

However, if you do encounter the above error anyway, you need to restart the VMware network bridge. You can do this either by shutting down VMware completely (turn off your guest operating systems, and quit the VMware Fusion application), or you can run the following commands as an administrator in Terminal, which will stop any bridge currently running (or do nothing if no bridge is running) and then restart it, providing the output as shown:

sudo killall vmnet-bridge
sudo "/Library/Application Support/VMware Fusion/vmnet-bridge" -D vmnet0 ''
Entering event loop...
Examining network configuration...
Turning on bridge with host network interface en1...

Obviously, you may be asked for your password as you perform this procedure. Note that the trailing two apostrophes are single quotes with no space. This is (almost) how the VMware Fusion boot.sh script starts and stops the network bridge. Specifically, you’re telling the vmnet-bridge application to run in Debug mode and to bridge vmnet0 to whatever is the current primary networking interface. In the example output shown above, this is en1, or my AirPort card connected to the computer-to-computer network I created in the previous step.

Hopefully you won’t have to mess with the vmnet-bridge application, as this should happen on its own when you start up VMware Fusion if you have any physical link on a network device. Nevertheless, I’ve found this is sometimes unreliable, so just in case it doesn’t now you know how to bring up the bridge on your own. (Tip: once it’s up, you can CTRL-Z to pause it, re-start it with fg %1 and then quit Terminal if you like. The bridge will still be up.)

Now that the AirPort card has a physical link, and the VMware network bridge is running, the next step is to configure your virtual machine to use bridged networking. Just go to Virtual Machine → Network → Bridged as normal. Make sure Connected is also selected. Now start up your Windows guest.

Once Windows boots, go to the Network Connections window by selecting Start → Connections → Show all connections. At this point, your “Local Area Connection” in Windows probably has a warning sign on it and reads as having “Little or no connectivity.” It probably has a self-assigned IP address just like your AirPort card. That’s fine—as long as it’s not “unplugged,” we’re in good shape.

Next, select whatever other connection you want to share the Internet from (in my case, the 3G modem, but it could also just be any other connection in the window), right-click it and select Properties. Go to the Advanced tab and make sure “Allow other network users to connect through this computer’s Internet connection” is checked. The other boxes won’t matter.

What this does is turns on Windows’ own NAT service that configures the one connection (the one your sharing) as the WAN side of (yet another) virtual networking device and the Local Area Connection (the one we’ve bridged to our AirPort or Built-in Ethernet card on our Mac) as the LAN side. Hit OK as many times as is necessary to close the network connection properties windows and wait a few moments. Sometimes this can take up to 30 seconds or so, but eventually you’ll see Windows announce that “Local Area Connection is now connected.” If you inspect it, you’ll see that the IP address configuration has been automatically assigned as a “Manual Configuration” with the address of 192.168.0.1, a subnet mask of 255.255.255.0, and no default gateway.

As a last step, now we can actually connect to the Internet using whatever service we have. In my case, this is when I hit the “connect” button on my Vodafone Mobile Connect software. Once the connection is established and the Windows XP virtual machine can see Internet, it takes up to another minute or two (or three) for the Mac’s connection to get an IP address from the Windows guest, but it invariably works.

If the Windows side of things is giving you any trouble, the most reliable solution I’ve found is to simply disable, then re-enable whatever connection isn’t behaving as desired. If after all of this your Mac still doesn’t get an IP address from the Windows XP guest, disconnect and then re-connect the virtual machine’s ethernet card (by toggling the “Connected” menu item in the Virtual Machine → Network menu). Also, of course, be doubly sure that your AirPort is set to “Use DHCP.”

Phew! So simple…and yet so much harder than it had to be. I found the following two PDF documents very helpful in understanding all of this. You might too:

  1. VMware Fusion Network Settings — a super-brief, but excellent introduction to VMware’s network setting internals. It’s also a PDF download attached to the linked forum thread.
  2. Share Windows XP Guest Internet Connection with OS X Host HOWTO — This basically describes the same thing this post does, but it does so using absolute step-by-step instructions. It’s also a PDF download attached to the linked forum thread.

Written by Meitar

March 31st, 2008 at 4:06 am

Steven Pinker’s ‘The Stuff of Thought’

one comment

This video, which is one of the recent TED Talk videos, is of Steven Pinker’s talk called The Stuff of Thought. This is simply brilliant. So brilliant, in fact, that those who know me well are about to be utterly astounded by what I am going to say:

I now understand the value of indirect communication. And it is immense.

I also understand why I never saw it before: the benefits are reaped solely through language’s social applications, not its analytical ones. See for yourself by watching the video.

An incredible interview with this Harvard professor is available on Google Video.

Written by Meitar

December 28th, 2007 at 4:21 am

We should re-instate that old USENET warning

leave a comment

From the everything-you-say-can-and-will-be-used-against-you department:

I’ve been doing this for years, and my solution is pretty simple: no regrets.

As an aside, these days when you punch in “privacy concern” into Googlepedia, you get the Wikipedia entry for Facebook. I was kind of expecting the entry for “US Government,” but whatever.

Written by Meitar

November 27th, 2007 at 3:31 pm

The Map Of The Internet, Circa 2007

leave a comment

This map of the Internet is pretty neat. It even gives you a “you are here” signpost when you first arrive.

More information on the map is available from the ISI ANT Census home page.

Written by Meitar

October 9th, 2007 at 5:23 pm

Moving personal data from one Mac to another

8 comments

I recently purchased a new iMac. It’s aluminum. And glass. And shiny. And it’s so much faster than my old G4 workstation I feel a little bit like I’ve just come out of the stone age.

Anyway, the experience of moving one’s data from one machine to another is always a bit of a hassle. There are so many little things you’re sure you’ve forgotten, preferences you don’t want to have to recreate, and small gotchas that, if you’re not careful, will mean you’ve lost something like your old email or your contacts—sometimes for good.

Thankfully, with a remarkably few easy planning steps, a lot of this trouble can be avoided all together. Much of this is thanks to the brilliant architecture of Mac OS X, which does a superb (though not perfect) job of separating data from applications. The other major benefactor of this kind of easy transition is server-based data stores, or hosted services (even if those services are ones I’ve hosted myself).

So here’s what I wanted to move over from my old mac to my new one:

  • Personal documents, pictures, movies, and music, etc.
  • Preferences for all applications, such as my dock layout, the Finder’s and Mail’s toolbar button arrangements, and so on.
  • PIM databases, such as my Address Book contacts, iCal calendars, my email, and the like.

This could really be a much longer list, especially if I were going to name every single item of personal importance. Nevertheless, each item falls into one of these three main categories of stuff that I want to move.

The first time you turn on a new Mac it will ask if you want to transfer your data from your old computer to your new computer. It does this using the Migration Assistant application located in your Mac’s /Applications/Utilities folder. While this works well for the most part, I’ve seen this program fail one too many times—especially for cross-architecture, PPC to Intel, transfers—that I’m simply not a fan of using it. Besides, as you’ll see in a moment, it’s trivially easy to do all of that yourself.

Of course, all of your personal information should be somewhere in your Home folder. You could just copy the entire directory from one Mac to the other, but you’ll probably end up deleting some (albeit probably non-critical) items from your new machine. When you drag-and-drop in the Finder, the Finder first removes anything of the same name on the destination as the source of the transfer. This is not what you want.

So here’s how I dealt with moving each type of item, after ensuring I had a good backup:

Transferring personal documents

rsync is a godsend for any situation where you want to ensure that you’re copying files from one location to another. It compares the contents of folders and, by default, only adds missing items to the destination while leaving everything else alone. It also overwrites identically-named files on the destination with files from the source.

To use rsync, I first needed to turn on the destination Mac’s “Remote Login” feature; this turns on the SSH server. (Find this in System Preferences → Sharing → Services.) Next, simply issue this relatively simple command at the command line, from your home directory:

rsync -aEve ssh Documents UserShortName@DestinationMac:Documents

This tells rsync to copy files from the local machine’s Documents directory to the DestinationMac’s Documents directory in archive mode (the -a option), which preserves numerous file meta-data such as its modification times and access permissions, along with the file’s extended attributes and resource forks, if any exist (-E), reporting verbosely (-v) as it does so, executing over SSH (-e ssh). The UserShortName is the DestinationMac’s user short name, obviously, and the DestinationMac is either its hostname (such as mynewmacintosh.local) or its IP address (such as 192.168.0.2).

I repeated the above step for the Desktop, Movies, Music, Pictures, Public, and Sites folders. Most of my music is actually on an external hard drive, so that was of course a cinch, and rsync took care of the rest.

Transferring preferences

Mac OS X stores its user-specific preferences in each user’s home Library/Preferences folder. The set up is elegant and beautifully implemented. Just like the folders above, I could have simply rsync‘ed my preferences over, but I wanted to be more selective. So I simply scrolled through the list finding the preference files for the applications I still use and copied them over. I used the Finder’s drag-and-drop, but you could use whatever method you want.

These files are named in reverse-DNS style notation, so for instance, my Mail preferences were stored in the file com.apple.mail.plist.

This was a super-simple step.

Transferring PIM databases

Like preferences, user-specific data is often stored in that user’s home Library/Application Support folder. Inside that folder is a folder for each application that has some data to store. All of iCal’s information, for example, is thus stored in your home Library/Application Support/iCal folder.

rsync to the rescue again:

rsync -aEve ssh Library/Application\ Support/iCal "UserShortName@DestinationMac:Library/Application\ Support/iCal"

In this case, because of the space in the Application Support folder’s name, the quotations and the backslashes are required to help rsync find the proper folders. Other than that, the command is the same as before.

I selectively copied over all the data from the applications I wanted to keep and, voila, the next time I opened iCal or Address Book, my data was there.

The Mail application and Safari both have special ways of handling their information, however, so their datastores couldn’t be found in the Application Support folder. Instead, they keep their folders directly inside the Library folder named (predictably) Mail and Safari, respectively.

Also, since I use IMAP for email and shared calendars in the form of .ics subscriptions whenever possible, the natural sync process for these databases saved a lot of time.

Most other programs in non-standard locations could be found with a little digging inside my Library folder.

It should be noted that for this to work reliably, you should always move all the preference files along with the Application Support directory for any program whose Application Support directory you’re grabbing!

Cleaning up

All told, the whole thing took maybe two hours and most of that time was spent transferring data. It was really quite painless. Because this was a surgical transfer, instead of a full “migration,” there’s very little to clean up.

However, for some reason, Apple’s .Mac Sync service had quite a bit of trouble keeping up with my new Mac’s new additions. The fix was simple enough: unregister every sync’ed computer, then reset all of the .Mac Sync data with the data on the new Mac. Then, re-sync each device either merging its data during its syncing process or replacing the data on it with the new, known-good data on .Mac. (Again, make sure your backup works before you do this.)

And that’s pretty much it. Now I have a new iMac, but it looks exactly like my old one on the screen. :)

Written by Meitar

September 13th, 2007 at 1:26 pm

Stay awake and dream

leave a comment

Wow. I’m having an incredible amount of trouble staying awake today. Yesterday, too. I’m not sure what’s up exactly but I’m going to take the obvious assumption as fact right now in that I am very, very tired. It’s been weeks (literally) since I’ve gotten a single night’s rest with more than 5 hours of sleep. I definitely need a chunk of restful time to get some of my energy back.

I have a number of personal projects that I’m working on and would love to have the energy for, so feeling like I’m exhausted all the time is beginning to wear thin. Yesterday I had a lot of fun going rock climbing at the City Climber’s Club with Sara and another couple of friends but it completely wore me out. I’m still feeling the exhaustion today. On the flip side, however, it feels so good to experience that kind of fun (and social!) work out at a gym again. I forgot how much I missed that.

The job craziness and apathy things might also be contributing to my lack of energy, because I find myself spending time searching job boards and talking to recruiters rather than focusing my downtime on things like adding features to my programs.

Just a bit earlier today actually, I was speaking to a colleague of mine about exactly that. He’s interested in moving away from the IT industry because, he says, he’s not interested in using computers for the sake of computing but rather using computers as tools to create something else. I wholeheartedly agree. There’s very little interesting things about computers themselves. The reason they’re attractive to me is how good they are at enabling other things to come into existence, and what makes me passionate about them is the fact that I can be extremely expressive through the medium (ala, web development and design).

Certainly, however, it is important and infinitely helpful to have operational skill with the tool you use to create something in order to enable you to create something better. Case in point, in web development, it is my designer friends who are constantly asking me operations questions like “How do I create a redirect on Apache for all but one file,” or things like that. The fact that I have had the administration experience to be able to do this means I can create a better-implemented web site than most of them, however we are both driven by the same interests: to express our creativity using chosen medium.

So, y’know…I’d like to be able to find some way of making that desire self-sustaining and financially viable. Here’s hoping this upcoming trip to Seattle proves fruitful in that regard.

Written by Meitar

March 15th, 2007 at 12:39 pm

Data lives forever; so does geekery!

one comment

A long, long time ago, on a server far, far away, I started my very first web site. It’s since moved through various places, and it’s funny that each step in the redirect process still exists. What’s even funnier is that not only do the redirects exist, but so too do my old geeky writings.

Written by Meitar

February 20th, 2007 at 9:54 am

Posted in Geeky, General, Personal

So Much More Hardcore

2 comments

Once again, writing from the Apple Store down in SoHo. There’s a crowd around me, people playing with computers, with iPods, with a number of little gizmos. The ambiance here is nice—in that trendy sort of way with everyone screaming, silently, how much cooler they are than everyone else. Honestly, most of them don’t know what they’re doing or what they’re saying.

I came down for the MetroMac meeting on “Taming Tiger,” a presentation by Deb Shadovitz about ways to use the new version of Mac OS X (“Tiger”) to increase one’s productivity and organization. Unfortunately, most of the meeting was taken up by a show-and-tell of various very, very basic features of the Finder. Customizing icons, how to use the dock, what smart folders and labels are, and other Mac fundamentals were given the most attention.

Spotlight was touched upon, burn folders were too, and nothing at all felt like it needed to be tamed. I’m actually sorely disappointed, especially considering that I’ve recently installed Tiger and felt like there was a lot of new things for me to learn. I’ll bet there really is a lot to learn, but I suppose I’m better off learning it all the same way I always do; I’ll play around with it myself.

I got way too bored sitting in the crowd, playing with my cube, so I got up and ran through the mental checklist of things I need to get for home. Among them, that damned PS/2-to-USB converter. I found a salesperson and asked if they carried one. Amazingly, he looked me square in the face and asked me what a PS/2 six-pin mini-DIN connector was. I pulled him over to a computer and showed him the Wikipedia entry so I wouldn’t have to explain.

You know you’re a geek when the answer to every question is a web address.

I walked in to the store listening to my iPod, and bounded straight up the stairs to head to the MetroMac presentation. I spoke with the organizers, who asked about the times for my Mac Meetings group. I pulled out my iPod and checked the schedules for the meetings on the synchronized calendar. They told me they’d attend.

After that quick bout of Mac geekiness, I couldn’t help but feel the explicable recurrance of I am so much more hardcore than you throughout the presentation. That, and, of course, the fact that I met with Blaise earlier in the day and showed off marks.

Update: Deb is a really nice woman. After the meeting, and after I finished blogging just now, I went back upstairs to ask her a question that came to mind. A friend of mine is considering buying a new computer, but she said that she’s unsure of getting a Mac because, she said, it’s not as customizeable as Windows. I asked Deb what she’d say in response to that. She laughed, as I did, and answered: ResExcellence.com!

Written by Meitar

June 9th, 2005 at 7:00 pm

Posted in Geeky, Personal

A Long Time Ago

4 comments

I like the way events in the present and plans for the future often connect to events in my past. One of the themes in my life is the notion of coming “full-circle,” of interconnectedness, connections of unexpected and delightful things. I am a paradox of sorts to myself in many ways, such as the fact that I have a strong and weak sense of history at the same time.

The other day, Sara met my father and her observations created that sense of coming “full-circle” in me. Over breakfast today, “eggs” with cumin and cheese wrapped in a flour tortilla, I showed her some of the very, very old writings for RPG simulations I created with friends of mine.

It was a blast from the past to read these myself, and I’m still floating somewhere off in space because of it.

Written by Meitar

June 2nd, 2005 at 5:24 pm

Posted in Geeky, Personal