Archive for the ‘Unix/Linux/Macintosh’ Category.

Google API’s and Mac

I have an old iMac that I’ve been using as a server. Because I like Linux, and because it was easier to configure LAMP (Linux, Apache, MySql, PHP) than the similar components in OS X, I installed Kubuntu 6.06 on it (I’ve always liked the KDE desktop better than the Gnome desktop, which is the default for Ubuntu). Everything was fine until I decided I wanted to try out a Google API.

Google APIs require PHP 5.1.4 or higher (actually it was needed for the Zend engine, which is required for the Google API). But Ubuntu 6.06 (and Kubuntu 6.06) didn’t have upgrades to PHP 5.1.4. After a lot of trials and failures, I decided to fall back on Apple’s OS X and install MAMP (Mac, Apache, MySql, PHP). This particular machine could only take OS 10.3.* on it, which limited the MAMP I could use. But it included PHP 5.1.6, so I was happy. For a while.

I got everything up and running again, and even figured out how to get local network access working. Then I got back to the Google API. The first step, with MAMP, however, was to secure it, since the default install is with user “root” and password “root.” So far, that wasn’t a problem since MAMP on this computer was only accessible on the local network, firewalled from the Internet. But using a Google API requires access to and from the web.

The MAMP application has a FAQ page, accessible from the start page, that looks really helpful, but isn’t. You can get there by clicking in the FAQ button at the start page:

MAMP start page

Of course, the part about which versions of the included programs are installed is helpful. But I had already checked that before I downloaded MAMP. It’s the part right below that, under the “How can I change the password for the MySQL database?” that is unhelpful.

MAMP FAQ page

 

 

 

 

 

 

 

 

First of all, mysqladmin is not in that location (/Applications/MAMP/bin/mysql4/bin/mysqladmin). It’s in /Applications/MAMP/Library/bin. The php config file location is closer to what’s listed: /Applications/MAMP/bin/phpMyAdmin/config.inc.php

Second, trying to run the suggested command in tcsh got me nowhere. It turns out the default shell was changed to bash in OS 10.3, but upgrades (which this is) keep tcsh as the default. Fortunately, bash is available, but the default has to be changed in the terminal preferences.

So, just to make sure bash is really there, go to the /bin directory in the terminal (using the Finder will just show the documentation):

bash in the Finder

Change the directory to root level by typing “cd /.” Then type “cd /bin” to get to the /bin directory. Then type “ls” to list everything in that directory (see bash listed in the screenshot):

While the terminal is open, go to the Terminal preferences:

Preferences

Notice the path listed is for tcsh:

tcsh set

Change it to /bin/bash:

bash path

Close the Preferences window, quit the Terminal application, and relaunch it. bash will be at the top of the Terminal window instead of tcsh now.

Now running the command listed in the FAQ page (with the path modification) will change the password in MySQL.  But before you actually press the Enter key to run the command, highlight the new password and copy it using the edit menu at the top of the screen.

/Applications/MAMP/Library/bin/mysqladmin -u root -p password NEWPASSWORD

(where NEWPASSWORD is the password it is to be changed to). The php config file will also need to be edited. I have eMacs on this machine, which worked nicely.  Don’t try to do it in Text Edit.  That will not work nicely at all.  Open the config.inc.php file (in MAMP’s phpmyadmin folder) in a code editor like bbedit or emacs. Find the lines

$cfg['Servers'][$i]['user']           =   'root';          //MySQL user
$cfg['Servers'][$i]['password']       =   'root';         //MySQL password

Replace ‘root’ in the password line with the one you copied. Save the file and close it.

Now, according to the MAMP faq page, it’s finished. Not.

It turns out there’s also a couple scripts to change in MAMP, documented over on network0.  There’s also a handy section on securing MAMP itself by password protecting the htaccess folder using an online .htaccess password tool (http://www.tools.dynamicdrive.com/password/).  So now that I’ve got it locked down it’s time to figure out how to open it up for Gdata on that Google API.  🙂

Network printing

Somewhat off-topic, but one of the issues going on here.

I have 3 Epson printers here. I’ve spent about $100 on ink for them, and none of them will work. I’ve since found out that Epson printers are so bad there’s a class action lawsuit. Meanwhile, we needed something more than the Canon photo printer that’s left. So I figured I’d get (1) a laser printer and (2) a wireless print server so we can all use the same printer. Staples had a great deal on a Samsung laser printer, and a Netgear wireless print server on sale as well. Together they cost about what I’d spend on Epson ink in a year.

We’ve got a Linksys wireless network, with an iMac connected by ethernet (doesn’t have a wireless card in it) and a Windows machine connected wirelessly. There’s also an Apple Powerbook and an Apple G3 without wireless cards. Both have OS X and Linux on them, but only the laptop, being portable, can be connected to the router, via ethernet.

The print server has extra ethernet ports so computers like the Apple G3 can get a wireless connection through the print server. Seemed like a good idea to me: set up the printer and print server where the Apple G3 is and get networked printing with a bonus wireless connection for one of the Apples. The Samsung has drivers for Windows, OS X, and Linux. The Netgear print server only has a Windows setup option. Of course, once it’s set up, it doesn’t matter where it’s connected.

I almost succeeded in getting the Netgear print server set up on my own. I ended up spending about 4 hours on the phone with tech support before we figured out what the problem was: the MAC address listed on the back of the box is for the ethernet connection. The wireless MAC address is different, and can only be found by accessing the print server after it’s set up. Once that was cleared up, the networks talked nicely to each other (I have restrictions on the wireless network by MAC address, as well as WPA).

Next was getting the Apple G3 connected. No problem there, except that, even though the computer had a wired connection to the print server, and had the Samsung drivers installed, it couldn’t find the printer. I found instructions at Netgear for connecting on Apple OSX version 10.4 (Tiger), and got the iMac printing, but the other two Apples are running OSX version 10.3, and the printer setup is different. I booted the notebook into Linux, popped in the Samsung CD, and started the “Autorun” I found on it. It installed all the drivers and asked if I wanted to set up a printer. So I went through its setup wizard, which was easier than the Mac setup, and printed a test page! (Cheers for Samsung!)

I’ll get the printer set up in Linux on the other Apple. I’m not sure I want to take the time any more to get it working on the older Apple OS. Samsung made it so easy on Linux, but Netgear can barely accommodate one Mac OS version, much less Linux. So kudos for Samsung, and black marks for Netgear! If you’re looking for a print server for a mixed network like mine, you should probably investigate other brands, even if Netgear does have a better price. And if you’re looking for a basic laser printer, you should definitely look at Samsung.

Update (Sept.9, 2007):

After almost a year with the setup, the biggest problem has been the Netgear device arbitrarily deciding when to accept connections. It seems almost random. Print jobs will fail to go through (and sit in a queue on the computer). I try connecting directly to the Netgear device, but when it’s “down” it doesn’t respond to anything, even from the computer that is connected via an ethernet cable. But then a new print job will go through successfully and everything works fine (including printing the backed up print jobs), for a few days, anyway. Then it’s back to trying to figure out a way to wake up the printserver.