FreeNAS and ZFS
I was moving data to ZFS on a FreeNAS machine last night. I didn’t realize not following the ZFS Tuning Guide means your machine will randomly reboot whenever you start doing intensive I/O…
I was moving data to ZFS on a FreeNAS machine last night. I didn’t realize not following the ZFS Tuning Guide means your machine will randomly reboot whenever you start doing intensive I/O…
I’ve had a handful of drafts in my queue for a while now…two about Wine, one about OpenSolaris, and one about data in the cloud. They’re all half-finished (if that). And, that doesn’t begin to include the other handful of posts I decided I’d never get to and deleted.
The most likely way these will get finished is if I write them down as goals. So, my goal is to crank out one of these posts each weekend for the next four weekends.
FYI.
Terminal.app’s default color scheme isn’t that bad, save for the unreadable blue-over-black text. But it could be better. A lot better.
I recently stumbled upon a theme called ir_black for Terminal.app that’s super easy on the eyes. Plus, it comes with an accompanying ir_black Vim color scheme.
Mac OS sleep isn’t really sleep. It’s write out an image of memory, then sleep. Useful when you want to swap batteries without shutting down, but not much otherwise. I found out about SmartSleep a couple of weeks ago and it has one dead simple rule: just sleep if the battery is above a threshold and do sleep+hibernate otherwise. Now I’ll no longer have to stick my ear by the disk to listen for it spin down before throwing my portable in a bag
Fink works almost all of the time, and if something’s missing, it’s surprisingly easy to write a package description. But when Fink breaks, it makes for an unpleasant user experience. Granted, I work off the “unstable” tree, but it’s not my fault that’s the only place to get anything remotely recent.
The build error I ran across was reported over a month ago, and it’s a little riling that it wasn’t yet fixed and that the suggested solution I found was to install a third-party update (XQuartz) to an Apple package (X11). Details below the fold…
Spotify is an online music service with a slick Mac client. I had a coworker briefly show me the Windows client over the summer, and I can’t figure out why I wasn’t more impressed then. It has a dead simple, iTunes-like interface: search for songs, queue them up and they play immediately.
The “Artist radio” feature is promising, but limited to songs by (manually?) pre-selected, related artists. The other radio feature only lets you pick decades and genres. Spotify could really use a sprinkle of some of that Music Genome magic that Pandora uses. Browsing the music catalog, they show you exactly the information you want, and don’t skimp on listing full discography on one page, which is pretty cool. Though, if only the play queue and history persisted across app restarts…
What I really appreciate is that it feels like care was taken in the design of the app. While it’s nice to read that Spotify does aggressive caching on the client and uses P2P distribution, it’s a completely different, blown-away feeling when it actually works smoothly and nearly instantaneously. (Okay, granted, music is relatively low bit rate.) The UI is equally slick: “Top 10″ lists are presented as a gridview with the top 3 items showing album art, a song’s popularity is always shown next to a song, there’s song de-duplication in search results and everything (searches, albums, artists, songs) can be grabbed as a link.
Just throwing up a quick post in the same vein as this gentleman who also lacked the Google-fu to quickly find it using the obvious search.
There are probably a bazillion of these posts out there, but I wanted to play with DTrace and Wine in OS X (post on this to come) and had to get the thing built first. This is mainly a “here’s what I did” post, with some “and this is why” sprinkled in.
I grabbed the dependency I was missing (you might need others, like libjpeg and libpng3 that I already had around) and the latest source from git
sudo fink install fontforge git
git clone git://source.winehq.org/git/wine.git \
wine-git
Of course, it’s good practice not to muddy up your source tree, so build in a separate directory
mkdir bwine-git
cd bwine-git
Running just `configure` generates complaints about missing libxslt, libpng, and libjpeg. For libpng and libjpeg, I just needed to point to Fink’s libraries and headers under /sw. It took a little digging to figure out pkg-config had been installed by Fink, but since I wanted to use the system libxml and libxslt under /usr, I had to point pkg-config to the .pc files in /usr/lib/pkgconfig[1].
PKG_CONFIG_PATH=/usr/lib/pkgconfig \
CPPFLAGS=-I/sw/include \
LDFLAGS=-L/sw/lib ../wine-git/configure
I’m directed by configure to `make depend && make`; I purposely leave out a -j2 since 1) it’s a hot day and I don’t want to kill my poor MacBook Pro, and 2) I don’t remember if it works correctly
make depend && make
And finally, test it works
./wine notepad.exe
Unfortunately, I get the message that “Wine cannot find the FreeType font library. To enable Wine to use TrueType fonts please install a version of FreeType greater than or equal to 2.0.5.” Let’s point dyld to our X11 libs (where FreeType lives), and try again
DYLD_FALLBACK_LIBRARY_PATH=/usr/X11/lib \
./wine notepad.exe
Success!
[1] It seems that Wine’s autoconf script takes the value returned from pkg-config, if pkg-config exists, without trying the alternative (values from xslt-config and xml2-config, in this case), even if pkg-config returns an empty string. I might get around to submitting a patch.
750GB hard disks have been at the $/GB sweet spot for a while now, and now that they’ve hit $100, I decided to upgrade my home directory RAID-1 from 250GB to 750GB. I really dread these upgrades, as there’s always a chance you can really screw things up. So, for when I upgrade to 2TB or whatever in two years, I wrote up some notes.
In my configuration, sdb1 and sdc1 are the partitions currently part of my RAID-1 md0. sdd is one of the 750GB disks. I’m adding one 750GB disk at a time, because 1) I want at least two copies of my data to be available at all times and 2) I only have one free drive bay and don’t want disks dangling next to the machine for hours.
mdadm -G /dev/md0 -n 3
badblocks -svw -t random -p 2 /dev/sdd
mdadm /dev/md0 --add /dev/sdd1
mdadm /dev/md0 -f /dev/sdc1 -r /dev/sdc1
shred -v -n 2 -z /dev/sdc
mdadm -G /dev/md0 -n 2
sudo mdadm -G /dev/md0 --size=max
umount /home
resize_reiserfs /dev/md0
mount /home
shred -v -n 2 -z /dev/sdb
…and we’re done! The one annoying thing is that with testing and a couple of resyncs, you end up with loads of down time between really short and simple tasks. So it’s possible (and I speak from experience) to stretch this weekend project out over a whole week.
I ran across this nine-month old post at cavemonkey50.com and I’m kind of left wondering where I was when this idea made its round on the blogs. Basically, PayPal will sell you a SecurID-like fob that can be OpenID-enabled using VeriSign as the OpenID provider (eh, VeriSign…sketchy? maybe.) The two key observations:
While PayPal is providing the Security Key, the key is actually a VeriSign Identity Protection (VIP) device … VeriSign is actually an OpenID provider and allows you to link your Security Key to your OpenID.
So give PayPal $5, get one of these SecurID-like devices in the mail 10 days later, link it to VeriSign’s OpenID provider, and boom you get two-factor OpenID authentication. Assuming your email, blog, photo sharing site, etc are hooked into OpenID, you have a little less to worry about when you’re on the road using some random internet cafe terminal.
I use a Mac probably 90% of the time, so I wanted to share some tips for OS X I picked up that (I hope) are really helpful to the Mandarin Chinese learner.
As a bit of background, let me tell you where I’m coming from: I went to Chinese school for years as a kid and didn’t really learn much of anything. I was never fluent, never really learned enough characters to sufficiently read (let alone write), and then I just stopped caring for some amount of time. Now, I’m back for more learning.
So, here are the tips:
I haven’t really used Windows in years, but last time I tried, I don’t think it had the pervasive Unicode support to even display Chinese characters in most apps. That said, I was nicely surprised when I found OS X 10.5 comes with a slew of Traditional and Simplified Chinese Input Methods built in. The one I use, ITABC, is dead simple. You just enter pinyin without tones and choose from candidate matches. There are plenty of places online (here’s one at Yale) that can walk you through setting it up.
Apple includes a dictionary application in OS X. No big deal, right? Well, it’s actually pretty cool, because you can add your own custom dictionaries that integrate as seamlessly as the built-in dictionaries. CEDICT is a Chinese-English dictionary project (here’s an online dictionary based on CEDICT) that’s available as a user dictionary for Dictionary.app. Even better, it also has pronunciations (little sound bites you can play) embedded in dictionary entries.
Here’s CEDICT for Apple Dictionary at Apple Downloads. Just download it and drop it into your /Library/Dictionaries (or ~/Library/Dictionaries).
I mentioned seamless integration in that last bullet point. Well, in the Apple way, the dictionary is integrated throughout the system. Hover over some text, hit a hotkey (defaults to Cmd-Ctrl-D, but might I suggest F1), and a little panel pop up (inline, in your application) with the definition.
This hint at Mac OS X Hints reminds us that we can hold down the dictionary hotkey to continuously get the definition of whatever word is currently under the cursor. Say you’re scanning news.google.cn and there are a handful of words you don’t know. Just hit that hotkey, the dictionary entry panel pops up in Safari, and it moves with you as you move the cursor across the sentence.
If the default popup panel is too small for your tastes, this post has a link to a modified DictionaryPanel.app (drop it in /Applications/Dictionary.app/Contents/SharedSupport) that enlarges the popup panel window. Alternatively, you can open up DictionaryPanel.app/Contents/Resources/English.lproj/PopupWindow.nib in Interface Builder and just need to change the size of both the popup window and its content. Be sure to make a backup first!
Alright, so this last one might be a strech, but I found out about ChinesePod, which is a podcast with lessons in spoken Mandarin. It helps that the podcasters are pretty amusing. How does this tie in? Well, iTunes is setup to scrape the newest lessons and syncs them automatically with my iPod, so I can listen on my way to work. Zero effort necessary!
Alright. That’s it for now. If you know of any other tips, please do share!
Note: This might seem like one big rave for OS X, but I tried really hard to keep that to a minimum. Apple’s just too cool
I’ve been eating at Subway pretty often recently. They have a sub-of-the-day deal, $2.99 for a 6-inch, and also have any footlong sub for $5. Incredible, I know. It’s pretty much the cheapest meal option, cheaper than anything I could cook or microwave that has any semblance to real food.
Today, I had a footlong club for lunch (where, oddly enough, I ran into my roommate). Fast forward a couple hours to dinner time, and my roommate tells me he’s going back to Subway and convinces me to go back again too. Two feet of club sandwiches in one day.
Anyway, what I wanted to share is this: I always walk to Subway, and this map shows how far Subway is from my apartment. It’s less than two blocks, probably two minutes to walk. But my roommate offered to drive there. And we drove there. We drove two blocks to go to Subway.
Just wanted to share.
Sounds simple, you’d think doing drive burn-in for reliability is something people do everyday on Macs, but either my Google-foo is off or there’s just not an easy way to stress test disks. A drive just died from under two weeks use (note to self: don’t buy Iomega), so I’m forcing myself to put the replacement I received this morning through its paces before committing any data to it.
This external drive, for reasons of compatibility and account restrictions, needs to eventually be formatted on my Mac to ext2, using ext2fsx (another post on the bugginess of ext2fsx later). Below is a list of ways I ran across to stress the disk.
Ideas for stressing a disk on OS X:
I started with the first, but realized badblocks is probably a better tool for the job (is there a native BSD equivalent?) save for the fact that you don’t get much seeking going on. The second one might address that, or maybe reading the disk’s block device while doing something else might induce the contention to give you the necessary seeking.
*A side gripe: since disk capacities (I have a 500GB external drive) have been growing faster than disk bandwidth (perhaps my fault for using 480Mbps USB2), reading or writing an entire drive takes on the order of HOURS (over two hours twenty minutes best case for my setup, and easily twice that from my experience today). It just never really affected me until now, and I’m kind of annoyed.
I started this entry before leaving on a two week trip to China, as a reminder to rave about American Express. I thought I should at least post it, even without the happy ending I was expecting.
The day before leaving for China, I browsed some travel websites and found out that an American Express card will get you personal check cashing services at some Bank of China branches. Of course, the internet didn’t yield much information, so I gave American Express’s Global Assist line a call. I was floored that the lady offered to call their China offices and the Bank of China to determine if my cards would work for cashing personal checks.
So, wow. The intent was great. All this nice service. I think I called on a Saturday, expected a call back Sunday night (Monday morning in China). Unfortunately, that call never came and I left on my trip.
I’m a diehard OS X user, but keep around a desktop for nightly jobs and file storage. I’m rather unlucky with disk drives (killed one just yesterday), so I’ve been meaning to move to ZFS. FUSE on Linux doesn’t feel too trustworthy right now (right, I’ll trust drivers not in the mainline kernel), and having finally gotten used to BSDisms, I’m not sure starting fresh with Solaris is the right path.
Long story short, I decided to try FreeBSD 7.0 (ZFS built in!). The last time I used FreeBSD was to shape traffic in a network testbed. This time, I’m looking for dead-simple usability. I want my WinPrinter to work plug and play, X to start outta the box in high res, and all that jazz.
First step, downloading the cd images and making a dvd image from that.
More later…
See: https://www.acm.org/studentoffer4
Seriously, they’ve got to be kidding. Maybe ACM isn’t familiar with their target audience, but a four-function flip-top calculator (granted it looks like it also has clock and calendar functions in its awkward display) is just not the way to incentivize students to join.
Please, stop with this branded junk.
I login daily to servers with names like xx.xxxxxxxxxx.berkeley.edu* or xxxxxx.xxxx.berkeley.edu, and it annoys me to no end that in 2007, there’s no standard mechanism for personal namespaces. I want shorthands like q and r6 that allow me to name this small set of machines from whatever terminal I may be using.
Alas, here’s how I solved it:
I have a relatively short domain name (tkho.net), and my dirt cheap webhost (NearlyFreeSpeech.NET) lets me create virtually unlimited CNAME records, allowing me to creating mappings from x.tkho.net, xx.tkho.net, etc to the names of servers that I frequently use. I add tkho.net. to the list of search domains that my DNS resolver checks (if it can’t find the record q., it’ll try q.tkho.net.), and now, `ssh tkho@q` works perfectly, across all my machines, and `ssh tkho@q.tkho.net` when I’m not on my machine.
* names removed to protect the innocent.
The Intel x86 Function-call Conventions – Assembly View page has saved my ass a countless number of times. Thank you, Steve Friedl.
I wanted to get a post in for the month. I recall starting a couple of entries, topics including the amount of energy used by the standyby light on a MacBook Pro (idea scratched because it’s nearly insignificant) and others that escape me at the moment.
It’s crunch time, and I have one project+paper and two survey papers to complete in the next two weeks.
/insert witty closing here/
I probably should be grateful that Berkeley lets you telnet into a machine and renew your library books. Unfortunately, I couldn’t stand to waste 45 seconds every two weeks doing this manually, so I instead spent 20 minutes writing a small script [txt] that renews books checked out from the UC Berkeley library. It’s easy to use: just plugin your CalNet ID and pin (birthday) and you’re all set. It probably needs a recent Python with the pexpect library.
In about a year, I’ll have saved time on this endeavor.