Mon, 27 Aug 2007

Lunar Eclipse

In a matter of a few hours, areas bordering the Pacific Ocean will experience a partial-to-total eclipse of the Moon.

Tonight around 1:50am (PST) the moon will begin to enter the shadow of the Earth. Since the Moon is nearly entirely lit by illumination from the Sun (not entirely, as light reflecting from Earth also illuminates the Moon), the moon will slowly and gradually begin to dim.

By 2:50am, the Moon will have entirely entered the shadow cast by the Earth, resulting in a total lunar eclipse. At this point, no direct sunlight will be able to reach the moon. Rather, light that strikes the moon will be coming in diffused by the atmosphere of the Earth, resulting in a orange/red glow of the moon.

The nice thing about observing the moon is that any amateur astronomer can enjoy it without any complicated equipment. You don't need any filters, or glasses, telescopes, nor do you need to go to a really dark area of town without light pollution.

Instead, you can simply walk right outside your house, and look right up at the moon. Of course, if you have binoculars or a telescope, or a nice zoom lens and a high megapixel camera, you'll be able to see it up close, or even take some decent photographs.

Set your alarm as not all lunar eclipses are visible from the Western United States, and the next total eclipse isn't until February 21st.





Sun, 05 Aug 2007

Fix the Annoying Broken Flash Video Player in Firefox

I upgraded Firefox to 2.0.0.6 today, and in the release notes, I found:
Some users have reported problems viewing Macromedia Flash content on Intel Mac computers. To work around this problem, users can remove or move the PowerPC version of "Flash Player Enabler.plugin from /Library/Internet Plug-Ins.
Aha, so that's the problem? Unfortunately, the release notes are a little vague on the details. Never fear, unix-geek is here!

Open Terminal, and type the following commands to produce an Intel-only version of your flash player plugin.

1. Change directory to the proper location (% is the Unix prompt, do not type it in)
% cd '/Library/Internet Plug-Ins/Flash Player.plugin/Contents/MacOS/'

2. Let's take a look what's in this directory.
% ls -la
total 29976
drwxrwxr-x 4 khan admin 136 Aug 5 13:01 .
drwxrwxr-x 5 khan admin 170 May 9 19:53 ..
-rwxr-xr-x 1 khan admin 9527552 Feb 20 17:10 Flash Player


3. Verify that it's a Universal binary:
% file 'Flash Player'
Flash Player: Mach-O universal binary with 2 architectures
Flash Player (for architecture ppc): Mach-O bundle ppc
Flash Player (for architecture i386): Mach-O bundle i386


4. Looks good. Let's make a backup copy of Flash Player in case we need it.
% cp 'Flash Player' '.old_Flash Player'

5. Great. Now, let's liposuction the PowerPC fat out of the Universal binary.
% lipo -thin i386 -output 'Flash Player' .old_Flash\ Player

6. Let's see if the file sizes changed:
% ls -la
total 29976
drwxrwxr-x 4 khan admin 136 Aug 5 13:01 .
drwxrwxr-x 5 khan admin 170 May 9 19:53 ..
-rwxr-xr-x 1 khan admin 9527552 Feb 20 17:10 .old_Flash Player
-rwxr-xr-x 1 khan admin 5812480 Feb 20 17:10 Flash Player


7. And let's check to see if the new Flash Player is a i386 binary:
% file 'Flash Player'
Flash Player: Mach-O bundle i386

8. Perfect! And just to make sure nothing is using our backup, let's remove all permissions from it (or delete it using 'rm' if you want):
% chmod 000 '.old_Flash Player'

What you're left with is:
% ls -la
total 29976
drwxrwxr-x 4 khan admin 136 Aug 5 13:01 .
drwxrwxr-x 5 khan admin 170 May 9 19:53 ..
---------- 1 khan admin 9527552 Feb 20 17:10 .old_Flash Player
-rwxr-xr-x 1 khan admin 5812480 Feb 20 17:10 Flash Player


This technique can be used to lipo out the PPC executables of all of your Universal binaries if you need the space on your hard disk and you're certain you'll never need to run those binaries on a PPC Mac.

I'll leave this as an exercise to the reader, but you can find all of your Universal binaries using System Profiler (Apple Menu.. About This Mac.. More Info.. Software.. Applications), and use 'cd' to change directory in to /Applications/Application Name.app/Contents/MacOS and 'lipo' the PPC portion of the Universal binary away.

Because Unix treats spaces as argument separators, either single quote all of your files, or precede your space characters with a \ (backslash). You can also use filename completion in your shell by using the TAB key to complete typing in the files.




Khan Klatt

Khan Klatt's photo