Archive for the 'Apple' CategoryPage 3 of 4

MagUnsafe

The magic smoke came out of my MacBook’s power connector about 10 minutes ago. I’m surprised it broke so quickly. I just got my Mac in November.

broken Apple MagSafe connector

Apparently, this happens to a lot of people. Take a look at the comments at the Apple Store.

Update: Just got back from the Bellevue Apple Store where I got a free replacement. Apparently this is covered under AppleCare so long as the damage is from normal use. In other words: if your gerbil gnaws through your cable, you’re on your own.

AirTunes Interoperability

My Airport Expresses have merely whet my appetite — now I want to stream music to and from everything in my house. Apparently, I’m not the only one. Here’s a cool thread over at CocoaDev with a bunch more info.

Scriptable Growl with growlnotify

So you just installed Growl, eh? Wait! Before you unmount that .dmg, don’t forget to install growlnotify from the Extras directory.


     cd /Volumes/Growl/Extras/growlnotify
     sudo install.sh

If you get a permission denied error you might also need to do this:


     sudo ln -s /usr/local/share/man /usr/local/man

Ok but why am I doing all of this? Check it out:


     growlnotify --appIcon Xcode
          -m "growlnotify has finished building" Build Complete

Growl Notification

Fast SSE Select Operation

Some SIMD architectures have a select instruction which combines two vector registers based on a third vector mask. I lust for such an instruction, but silly little two-operand SSE cannot currently support it.

Of course, people build it out of more primitive ops. For example, here’s what Apple suggests when porting to SSE from Altivec (which supports select):

(Note: this has been translated into Microsoft syntax)

__m128
_mm_sel_ps_apple(const __m128& a, const __m128& b, const __m128& mask)
{
    // (b & mask) | (a & ~mask)
    return _mm_or_ps( _mm_and_ps( b, mask ), _mm_andnot_ps( mask, a ) );
}

We mask b, inverse-mask a, and slam the result together with an or. This is the easy and obvious solution — and the one I used for years.

Here’s a better way:

__m128
_mm_sel_ps_xor(const __m128& a, const __m128& b, const __m128& mask)
{
    // (((b ^ a) & mask)^a)
    return _mm_xor_ps( a, _mm_and_ps( mask, _mm_xor_ps( b, a ) ) );
}

Witness the amazing power of xor! Here we calculate the bitwise difference between a and b. Then we mask and selectively apply this difference to convert some of the a’s into b’s. This is freaking genius. (I wish I could claim to have invented it.)

Here’s the assembly that my compiler generates for the two sequences. First, the naive way:

 movaps      xmm2, XMMWORD PTR [r8] ; mask
 movaps      xmm1, XMMWORD PTR [rdx] ; b
 andps       xmm1, xmm2
 movaps      xmm0, xmm2
 andnps      xmm0, XMMWORD PTR [rcx] ; a
 orps        xmm0, xmm1

Go-go gadget bit-twiddler:

 movaps      xmm1, XMMWORD PTR [rcx] ; a
 movaps      xmm0, XMMWORD PTR [rdx] ; b
 xorps	      xmm0, xmm1
 andps	      xmm0, XMMWORD PTR [r8] ; mask
 xorps	      xmm0, xmm1

It may not be obvious, but the 2nd sequence is much better because all it’s operations are commutative. Once this little select routine is inlined, a good register allocator will arrange to kill whatever operand may happen to be dead-out. By comparison, the first sequence constrains register allocation with that pesky noncommutative andnps instruction — which has to destroy the mask.

(credit to Jim Conyngham and the MD5 Wikipedia page)

MacBook WiFi Craps Out Near Antenna

My black MacBook has the strangest WiFi problem. It works great all over my house, except in my office — where the access point itself is! I’ve never heard of a WiFi signal that was too strong.

Anyone else have this problem?

Firefox Uses 100% CPU on OSX

When I leave Google Reader running for a while, Firefox eventually enters some kind of crazy Javascript spin loop which eats 100% of one core until I kill the tab. This is an Intel-based OSX machine, and Firefox 2.0.0.1.

Has anyone else experienced this? Is there a solution?

Update: It seems like Google Toolbar might be the cuplrit. See this bug report for details. I’ll disable the toolbar and see how things go.

Update 2: Well that wasn’t it. I’m running no plugins at all now, and the problem persists. There must be some kind of bug in the Javascript interpreter.

Macworld 2007 on IRC

Connect to irc.freenode.org and join channel #mwsf2007 for live reporting of the event. There are currently 900+ people in the channel. Holy crap.

Switched

Forgive me, Hector, for I have sinned.

Mark's MacBook

ZFS FTW!

If you haven’t heard of Sun’s ZFS file system, here are the two important summary bullets:

For slightly more info, check out these screencasts, this slide deck, or this set of vids.

I can’t even begin to describe how much I lust for Linux support (currently difficult due to CDDL incompatibility with GPL). With a little effort, one could combine ZFS and something like S3 or rsync.net to get easy off-site backup on the cheap.

Update:
Much of the power behind ZFS comes from its copy-on-write philosophy. The parallels with software transactional memory are stark. One outstanding question re transaction size: are they limited by free disk space? Traditional file systems use in-place modification, but it sounds as though ZFS may require additional free storage proportional to the size of the change.

Update 2:
I just learned about the clone ability in ZFS and my eyes just about fell out of my head. I mean seriously, this is constant time file copying. I’d have half a mind to alias cp zfs clone.

Update 3:
Man the ZFS hits just keep on coming. I’ve got a RAID-5 at home, but I’d never heard of the “RAID-5 write hole” until I read Jeff Bonwick’s blog article. Don’t miss this war story featuring ZFS’s end-to-end checksumming.

Good Old-Fashioned Flame War

Wil Shipley and Larry Bodine argue Mac vs PC. This exchange totally LOL’d me:

Larry: For me the killer was the Web browser. Safari simply cannot read Flash. It is, quite simply, a second-rate browser.
Wil: It simply can and does read Flash, and you are, quite simply, a big stupid.




Creative Commons Attribution-NonCommercial 3.0 United States
Creative Commons Attribution-NonCommercial 3.0 United States