Archive for the ‘Macintosh’ Category

Man, sometimes I feel really dumb.

Wednesday, July 16th, 2008

So I’m trying to fix a bug in some old C code, where I want to add the ability to bind to a specific IP instead of INADDR_ANY. This is on my Apple laptop, which has the latest Apple Xcode (3.1) build on it. Oddly, the C compiler starts spewing bizarro error messages on code that I’m pretty sure is valid. So I backtrack, download Xcode 3.0 (gigs!), and that compiles it OK.

But the binary segfaults when you run it! So now I don’t have a working compiler. This is a problem for a code monkey…

Today, I tried again:

  • Code builds and runs on Linux
  • Download latest Xcode 3.1 from Apple, install.
  • Compile fails.
  • Go digging around hard drive, find copy of hello.c I have parked. (Yes, real nerds keep ‘hello world’ saved, in several languages, for just such occasions as this!)
  • Compile hello.c:

cc hello.c
/var/folders/Sw/SwEOWKQ7FdihT03Yr5CBOU+++TI/-Tmp-//ccNBFXHP.s:15:section difference divide by two expression, "LC0" minus "L00000000001$pb" divide by 2 will not produce an assembly time constant

Well. Same errors as my code, though only one of them. It’s not (prolly) libraries, so WTF? Guess I’m off to flog the DSL downloading Xcode 3.0. Man, this sucks. Fink? Something else I’ve installed? No luck googling the error, oddly. Since I’m pretty sure others would’ve noticed a broken C compiler, it’s probably my problem. Crap.

Update 8/18/08: See Per Mildner’s comment - the secret is MallocScribble. 

Well, that’s damned clever

Monday, June 23rd, 2008

I was reading about Google Gears, and discovered that Firefox 3 on OSX is supported. It’s a quick install, and once you do so check out Google Reader - you’ll find ‘offline mode,’ where Reader will slurp down data for use offline and re-sync fast when you’re back to civilization.

Another reason to love Reader! It makes a compelling case for Gears, too. Highly recommended.

Progress…

Thursday, May 29th, 2008

More progress on the Cocoa/Omron front…

It still just walks the USB tree and looks for the device, but now it’s a Cocoa GUI!

Cool. Easier to mix C and objective-C than I thought…

Secure websurfing via SSH and SOCKS

Thursday, May 1st, 2008

It’s often handy to be able to surf from a monitored network. Perhaps you want to job-search Monster from work, view (cough) inappropriate comment on your lunch break, check your bank balance in a open-wifi coffeeshop, whatever. For it to really be secure, all parts of the channel must be encrypted, including the DNS lookups. Here’s a free way to do it. (If you have the money, you can also run a VPN; this is a simpler way of building a private HTTP-only VPN.)

You need an SSH account on a server that you trust, and a copy of Firefox. That’s it! An SSH agent such as SSHKeychain is nice for not having to re-enter passwords every time, but not required.

For this example, I’m going to use my server, usul.phfactor.net, so change accordingly for your setup.

There are two parts of this: The first part is to setup an encrypted connection, which has what’s called a SOCKS proxy. This forwards your HTTP requests over the SSH connection to the remote server, which does the DNS query, HTTP fetch and returns the results to you via SSH. It turns out that SSH itself has a SOCKS proxy in it, you just have to enable it.

The second part is to tell your web browser to use the proxy, and how to find it.

Here’s the first part:

 ssh -C -D 8119 pfh@usul.phfactor.net

That connects me to my account (pfh@phfactor.net). The -C asks for gzip compression, which speeds things up a bit over slow connections. The -D 8119 sets up the SOCKS proxy, and establishes port 8119 on the local machine as the proxy connection. You’ll see a prompt after this, as the SOCKS part is invisible:
screenshot
Next, you have to tell your browser about it. I’ll use Firefox, as its common and easy to use. Open up preferences, and go to Advanced/Network:
screenshot
Then go to Settings:
screenshot
Put in localhost/8119 for the SOCKS proxy, and use SOCKS4 and not the SOCKS5.

That’s it! Now, every web page you surf travels over SSH to the remote host and is encrypted from you to there. (In my case, until it hits usul.phfactor.net) You still have to trust the server and sysadmin who runs it, but that’s easier sometimes.

Enjoy!

Sources: This page had the key bits, before I found it I had tried twice and failed. Thanks, interweb!

Might have to go back to Safari for a bit

Wednesday, March 26th, 2008

Via Anarchia, an excellent post of hidden abilities inside Safari:

  1. Browsing and Search Snapback
  2. URL Path Navigation
  3. Web Inspector
  4. Activity Window
  5. Inline Dictionary
  6. Selection to Speech
  7. Quick Notes
  8. Email Page Link

The ‘make sticky from text’ and ‘email link to page hotkey’ are particularly compelling, and I suspect Chris’d like the CSS viewer.

Might be time to upgrade the wireless

Friday, February 29th, 2008

Via TidBits, news that the new Apple Time Capsule is shipping. Its a combination device with a WiFi router and internal hard drive. The WiFi is the new 2.4/5GHz 802.11n, which increases both the speed and the range of the network. According to the Wikipedia page, going from 802.11g (which most computers made in the past 3-4 years have), you go from 38m to 70m in range and 19 to 74 megabits of usable throughput.

I’ll pause so that the nerds reading this can cease drooling. That’s a big jump in range and speed, which naturally leads to the question of ‘What do I do with that much bandwidth? I mean, my internet connection is much slower than that.’

In a word: Backups. OSX 10.5 introduced TimeMachine, integrated backup software of stunning polish and elegance. I’ve spent years with software of varying capability, so trust me when I say that stunning is not an exaggeration. cpio, tar, rsync, unison, windows backup (shudder), ufsdump, Retrospect… it’s a long list. I still use cron and rsync for Debian on this server, but it’s got serious limitations and my main defense is to replace the hard drive every two years. TimeMachine solves all these, in an automatic fashion that’s tied into the operating system itself.

Let me explain. If you use a third-party backup program, consider what happens when the drive fails. You have to reinstall the operating system itself, usually a manner of hours, then install the backup/restore program, then restore the backups. With OSX, you boot the install DVD and select the ‘Restore from TimeMachine backup’ option. Vive la difference, baby.

So, motivation established, you consider 802.11n routers. However, if you’re like me you have older machines that don’t have 802.11n and can’t afford to upgrade them all. You’re then faced with the hassle of running two wireless networks, one slow and one fast. Double the fun it ain’t.

Time Capsule (seemingly) solves a lot of these. And some others. Right now, I use an older Airport Express (802.11g) plus a LaCie NAS drive. It mostly works, but since the LaCie is RAID0 I’m actually more at risk; if either drive in the NAS fails I lose all my backups. And it’s slow as well, even over gigabit. In contrast, the Time Capsule uses a single drive, which is server-grade:

Chulani clarified that the “server-grade” drives in a Time Capsule are the same 7200 rpm drives used for Apple’s Xserve servers, and that they have a higher mean time between failure (MTBF) rating than consumer drives. The MTBF for server-grade drives is often 1 million hours (114 years), which is a measure of probability; in this case, that out of a set of drives with similar properties, an extremely high percentage will still be fully functional after several years.

(That’s from the TidBits article)

The phrase from TidBits that got me really interested was this:

AirPort Utility 5.3 also adds setup features that enable you to migrate settings from an existing base station into the Time Capsule; to set up a dual-band network, with an older base station operating at 2.4 GHz and the Time Capsule set to 5 GHz; and to set up a roaming network with multiple base stations connected over Ethernet.

If I’m reading that correctly, it sounds like the TC can run somehow with another WiFi router? Hmm. I don’t have Airport Util 5.3 and can’t find a download URL, so this is hard to verify.

The TimeCapsule costs $299 for 500GB and $499 for 1TB, which is quite good. If I can get it to replace or complement my Airport Express, it’d be fabulous.

Update: Nice review and walk-through on Gizmodo.

Free VMWare/Parallels, open source even!

Friday, February 15th, 2008


Via ArsTechnica, news of a free open-source PC emulator for OSX called VirtualBox.

Right now, it only runs on Intel-based macs, but I gave it a quick test with DamnSmallLinux and it runs quite well. I’m impressed, and will experiment more with it. It’s really amazingly polished for OSS, professional as hell.

Excellent news, this. Screenshot of DSL running with Firefox:

iBook drive upgrade

Monday, November 19th, 2007

P1010024.jpg

P1010022.jpg

P1010020.jpg

P1010012.jpg

P1010011.jpg

P1010004.jpg

I just upgraded the 80GB drive in Chris’s iBook to a 250. Unlike my MacBookPro upgrade, it was quite difficult. Note the five pieces of paper with screws on them - those were the spatial maps for each layer. Total time around 4 hours, whew.

Working very well now, but set aside an afternoon for this one. I got instructions from this page and this one too. Both are nice and pictorial.

Macbook pro hard drive upgrade

Saturday, November 10th, 2007

Not too bad. I’m now sporting a 250GB drive (!!), quite easy to do. Lots of Torx and Phillips screws, but not bad with patience and help from a co-worker.

Data transfer was via rsync:

  sudo rsync -axvE --progress / /Volumes/New

(Actually, the volume name is Rex Tremendae, a hat tip to Berlioz’s Requiem. Good stuff, that.)

After that, just go into Prefs and select the new drive as the boot volume. Almost too easy.

Big dang disk

What amazing times we live in. 250 (marketing) gigabytes for two hundred and nine dollars!

BTW, the Hitachi appears to be quieter than the stock 120G it replaced. Speed seems about the same in casual use so far.

Kill the glass dock!

Wednesday, November 7th, 2007

Much better


defaults write com.apple.dock no-glass -boolean YES
killall Dock

Worked!