Mac


12/29/2009: 5:17 pm: RobertMac, MySQL, Python

I just updated an old post on using Python with MySQL on OS X. The good news is that you don’t need to create an extra directory of symbolic links anymore. The not really bad news is that you have to be careful about 32-bit versus 64-bit.

Ideally, you’ll first upgrade to a 64-bit version of MySQL 5.1 or later, unless you already have. Then, follow Geert’s simple instructions for building the MySQL Python connector.

8/4/2009: 8:20 pm: RobertMac, Music

I helped my brother set up his HP MediaSmart Server tonight. It runs on Windows Home Server, and allegedly the initial install has to be done from another machine running Windows. Since he didn’t have Windows installed anywhere, I used a Windows XP virtual machine that I had running on VMWare Fusion on my MacBook Pro. It provided the traditional painful Windows experience of installing many, many updates just to get to a functional point, but I was pleased that I had to reboot Windows only once. Still a terrible experience compared to a server software install on Linux, but better than the misery I had expected.

First, simplify your network setup as much as possible before the install. My laptop was initially on a wireless LAN with the server on an Airport Express that had been setup to join that network. No luck. I ended up hooking up my laptop and the server directly to a switch.

The next key step if you are using a VM is to configure networking as bridged rather than NAT’d. In VMWare Fusion, choose Virtual Machine -> Settings. Then click on Network. In the radio buttons, make sure “Connect directly to the physical network (Bridged)” is selected. I think then you have to restart the VM. Once it restarts, the VM will get an IP address on the same LAN as the server, assuming you are using a simple network config like I described above.

After playing around with the server for a while, I can’t really recommend it for a Mac only user. You get access only to a basic set of features that you can find on a less expensive NAS, although the hardware is pretty nice. It’s certainly not a bad choice.

11/6/2008: 3:51 pm: RobertJava, Mac

After using the built-in self upgrade feature of Eclipse to go from 3.4 to 3.4.1, I was no longer able to launch Eclipse. Instead of the happy Ganymede splash screen, I got a poorly formatted dialog saying “The Eclipse executable launcher was unable to locate its companion shared library.” I discovered that the problem was that eclipse.ini had not been updated to point to the updated launcher library. Here’s how to fix it.

  1. Open a Finder Window to the Applications directory, or wherever you installed Eclipse
  2. Expand the plugins directory
  3. Scroll down to the directory starting with the name “org.eclipse.equinox.launcher.carbon.macosx_”
  4. Copy the text of the name following “carbon.”. After the update, mine was 1.0.101.R34x_v20080731.
  5. Right click Eclipse.app and select Show Package Contents
  6. Expand the Contents and MacOS directories
  7. Open eclipse.ini in a text editor
  8. Look for two lines that look like
  9. --launcher.library
    ../../../plugins/org.eclipse.equinox.launcher.carbon.macosx_1.0.100.v20080509-1800
  10. Change the part after “_” to the text you copied above
  11. Close and save changes to eclipse.ini
  12. Restart Eclipse

In case you weren’t aware of this, you can also edit eclipse.ini to change the vmargs Java will use when launching Eclipse. For example, if Eclipse itself is running out of heap, you might want to boost the min and max heap size with something like:

-Xms64m
-Xmx512m

Of course, you should also click “Show heap status” in the General section of the Preferences dialog so you can monitor how much heap is being used and can force a GC before a big compile. You shouldn’t boost the min heap size from the default, though, unless you blow past it pretty quick and experience initial sluggishness as the heap keeps getting expanded.

7/8/2008: 9:22 am: RobertLinux, Mac

Now, if that name doesn’t make a product just sell itself, I don’t know what would. Anyway, I bought a D-Link DNS-323 NAS from a friend who I trust to do all the necessary research. He bought it, but because he is really picky and it didn’t do exactly what he wanted, he built up his own NAS.

I put two Seagate 750GB ST3750330AS SATA drives in it in a RAID 1 configuration. He recommended the drives and a D-Link DGS-2205 Gigabit switch. Like I said, he does the necessary research. So far, I’m mostly loving it all. You should be able to get the NAS for a little under $200, the drives for about $120 each, and the switch for around $30. Having a GB switch is nice, since it greatly speeds up file copies, assuming your computers have Gigabit Ethernet interfaces.

In addition to acting like a file server on my home network, the D-Link NAS has an iTunes server, USB print server, FTP server and a few other goodies running on its Linux operating system. Even better, since it’s running Linux, the community was able to build add-on utilities.

Though the rating on Amazon is only 3.5 stars, this is one of those times you have to read the reviews. A lot of the negative comments refer to issues that have been fixed in newer firmware versions. Though, I have to admit that the user and group permissions design is mediocre and the administration UI for permissions even worse.

There is an especially annoying permission issue if you are using Windows. When you connect to the NAS, you can’t edit the username in the login dialog. So, you have to create a user with the same name on the NAS. This is especially bad if you have multiple Windows boxes on which you use different usernames. At least, this is what happened on my neighbor’s Windows boxes. When I connected to a file share on the NAS from my Fedora Linux desktop, I could change the username. Same for my Macbook Pro.

One of the biggest negatives for me is that the iTunes server won’t serve up Ogg Vorbis encoded music files, and I’ve encoded most of my collection that way. Grrr. I’ll have to look at other community built software for streaming audio or hack the GPL’d source from D-Link, since the iTunes server is also GPL’d. It’s based on mt-daapd by Ron Pedde. I’m kind of puzzled, since the ogg.c file in the src I downloaded makes it look like it should work. It’s successor, Firefly, definitely supports transcoding ogg files.

7/3/2008: 4:31 pm: RobertMac, Soccer

Not realizing there was a surfeit of newline characters in a largish mysqldump file I was analyzing, I tried to open it in TextMate. After a few minutes of listening to the hard drive in my Mac thrash away, I had to kill TextMate. One obvious solution was to split it into multiple lines, but obviously I couldn’t use TextMate for that.

Fortunately, the Unix utility sed is a great tool for problems like this. My file had the character string “\n” between all the parts that were reasonable to split into separate lines. The following command did the trick:

$ cat source.txt | sed 's:\\n:\
:g' > dest.txt

First, I used the cat utility to pipe the contents of source.txt into sed. Then, I used the substitute command to replace \n (the extra backslash is needed to escape the special treatment of backslashes) with a carriage return. The \ at the end of the first line escapes the literal new line character that causes the shell to go to the next line. The g tells sed to make this substitute globally throughout the file. I then redirected the output into dest.txt.

Sweet, sweet, Unix.

2/19/2008: 12:23 am: RobertMac, MySQL, Python

It was more work than it should have been, but you can get access to a MySQL database from Python on OS X 10.5 by following the instructions at this blog post.

If you’re using Pydev in Eclipse, be sure /Library/Python/2.5/site-packages is in the System PYTHONPATH. Bring up the Preferences dialog, open Pydev in the tree, click on Interpreter – Python, click New Folder to the right of System PYTHONPATH, and then add the directory, if necessary.

Update 12/27/2009: With MySQL 5.1.41 and Snow Leopard (OS X 10.6), you no longer need to create the lib/mysql directory with symbolic links as described in the above article. Also, since Snow Leopard comes with Python 2.6, the path above for Eclipse should be /Library/Python/2.6/site-packages. I found Geert’s instructions to be quite helpful for Snow Leopard. There’s also a lot of useful info here.

One problem I ran into is that I initially built the MySQL Python connector with a 32-bit version of MySQL 5.1 installed. After upgrading, I forgot to delete the build directory to force the connector to completely rebuild. When I then tried to run “import MySQLdb” in the interpreter, I got the cryptic message “ImportError: dynamic module does not define init function (init_mysql)”. If I had read all of the comments in that last article before figuring this out, I might have gotten a hint from the comment mentioning that not even “setup.py clean” would delete the build directory if you left off the 64-bit architecture flags.

3/21/2006: 12:20 am: RobertMac, Software

Two engineers (Eric, a.k.a., Narf, and Jesús, a.k.a., Blanka) with whom I work at Voxify won a prize of nearly $14,000 from contributors at OnMac.net for being the first people to publicly get Windows XP running on an Intel-based Macintosh. I was kind of surprised when the Mac showed up in Jesus’s office a few weeks ago, and I certainly didn’t guess that this was what he was working on. It doesn’t surprise me, though, that he and Eric would have been the ones to figure this out first. More proof that Voxify engineers rock.

Update 4/5: On top of all the many other mentions in the press, Eric and Jesús got mentioned in an article by David Pogue in the New York Times.

10/26/2004: 12:32 am: RobertMac, Reviews

When I bought my wife a Titanium PowerBook nearly two years ago, I knew in advance that WiFi range was a significant drawback. The Apple Airport card sits below the keyboard and the Titanium shell acts entirely too much like a Faraday cage. After suffering through some Linksys-induced misery, I bought a NetGear wireless router. That made things significantly better, but the reception in the living room left a lot to be desired and the transfer speed still sucked.

One NetGear WG511T 108 Mbps Wireless PC Card (purchased on sale at Amazon for $50) and one copy of OrangeWare Wireless Driver for Mac ($15) later, I’m in heaven.

The range with the NetGear card is vastly improved over the Apple Airport card, and the speed boost is amazing. Not only was I able to switch my NetGear router from 802.11b to 802.11g, but I was also able to take advantage of the TurboG feature of the Atheros chips in the router and the card. Of course, most of the speed boost is just from having decent signal strength in the living room.

The OrangeWare Wireless Driver for Mac was everything it was advertised to be. Within five minutes of starting the download, I had installed the software, configured it and was browsing the web from the living room at speeds indistinguishable from the wired connection on my PC back in the office. After confirming that everything was working, I gladly clicked the Register button and paid for it.

Using the Speed Meter at 2wire.com, I was averaging 2.81 Mbps on the PowerBook when in the room with the router and 2.77 Mbps from the living room. We’ll have to see what happens once I add the new laptop, which has an Intel PRO/Wireless 2200 card, to the network.

7/5/2004: 11:29 pm: RobertMac

I downloaded the amusing video short Office Space Wars (found via Boing Boing) recently and I wanted to show it to my wife on her PowerBook. The video played fine under Fedora Core 1 with Xine, but the playback had lots of stutters and glitches under Windows Media Player on Mac OS X. The movie is a wmv file, as in Windows Media Video. I’ve never had a problem playing back a QuickTime movie on Windows, but Windows Media Player for OS X has been nothing but problems and poor quality, even with files in Microsoft file formats.

Since Xine was a no-show in Fink Commander and it was already getting late, I checked out VLC (sometimes known as VideoLAN Client), which I had always been happy with on Linux. VLC played Office Space Wars flawlessly.

Given my luck with the wmv file, I decided to try an AVI file that had not played properly in QuickTime Player. Windows Media Player refused to play it all, claiming it was in an illegal file format. With the free version of QuickTime Player, the audio was unlistenable and the video didn’t appear at all. I downloaded the 3ivx MPEG-4 toolkit, which got the video working in QuickTime Player, but didn’t fix the audio problem. VLC played the AVI file flawlessly.

12/28/2003: 11:07 am: RobertLinux, Mac

I set up a NetGear WGR614 wireless router (802.11 b and g) on my home network yesterday. So far, things have gone very smoothly. The biggest problem was reacquiring valid IP addresses on the Mac, Linux, and Windows boxes. I previously used a Linksys BEFSR41 as a router and a DHCP server. It uses a 192.168.1.x subnet, while the NetGear router uses a 192.168.0.x subnet. Therefore, when I switched out the routers, I had to force all my computers to release their previous IP addresses and request new ones.

In hindsight, I now wonder why I wasted so much time and money on Linksys gear before. When all I had was the Linksys BEFSR41, a Power Mac G3 desktop, and an IBM ThinkPad T23, everything was fine. Then I added a Dell Dimension PC running Windows XP. If the Dell and the Mac were connected to the Linksys router (not necessarily even turned on; just connected by Ethernet cables), then in anywhere from a few seconds to about thirty minutes, the Linksys router would lockup. Even after powering it off and back on, it might take 20-30 minutes before the router would respond. I could use the ThinkPad and the Mac together with no problem. I could use the Dell and the ThinkPad together with no problem. But, if the Dell and the Mac were connected at the same time, the Linksys router would try to commit suicide.

I sent email to Linksys customer support describing the problem in great detail. No response. I tried again. no response. I guess that’s their strategy for saving money on customer support.

Despite this painful experience, I bought a Linksys WAP11 access point. When used with the ThinkPad, it worked great. Then, we bought a Powerbook G4. After hours and hours of tweaking the network configuration for the PowerBook, I finally got it to connect to the WAP11.

But, the signal strength sucked. Our house isn’t very big, but I couldn’t even sit in the living room (about 40 feet, albeit through lath and plaster walls) from the WAP11. Sure, the titanium cased Powerbook is known for poor wireless range, but this was ridiculous. Even worse, the WAP11 would randomly lock up after anywhere from a few minutes to a few days after using the Powerbook. Fixing it required unplugging and replugging the power cable for the WAP11.

Then I read about the Linksys Wireless Signal Booster. Despite my nightmarish experiences so far with Linksys networking gear, I foolishly bought the Linksys WSB24. Of the three pieces of Linksys gear, this one was actually the most reliable. That is, it didn’t crash several times per week. However, it added only about 15 feet to the distance I could wirelessly roam from the WAP11. That additional distance was definitely not worth the $80 I paid for it.

The NetGear WGR614 is an absolute dream compared to my pile of Linksys junk. Not only is it far more reliable, but the signal strength is as good or better than the combo of the WAP11 and the signal booster. Also, web browsing with the Powerbook is 2-3 times faster. I always wondered why the PowerBook was so slow when connected wirelessly instead of wired. I thought it was a problem with the Airport card. No, as I should have known all along, it was yet another indication of how crappy the Linksys products are. Also, instead of hours of fighting with the Linksys and Mac OS X networking configurations to get the Powerbook to connect to the WAP11, it took me less than a minute to get the Powerbook to connect reliably and securely to the WGR614.

Reminder for later: to get a new DHCP allocated IP address on Red Hat 9 Linux (assuming eth0 is the primary network interface) without having to reboot, do the following as root:

#killall dhcpd
#/sbin/dhclient eth0

Next Page »