Category Archives: Tech

I’m a programmer by trade. Thoughts, tips and general mayhem from the programming world go here.

Git missing in OSX Mountain Lion

Quick one today to remind others and perhaps my future self. After my upgrade to Mountain Lion, git was missing. Surprise!

Easy fix for me, obtained via https://answers.atlassian.com/questions/72981/error-after-upgrading-to-mountain-lion-os-git-svn …  (Thanks!)

In Xcode, we just go to Preferences > Downloads and click install next to “Command Line
Tools”:

Re-installing command line tools, git included!

Hope this helps! It certainly easier to git push when you actually have git ;)

TurnKey Linux LAMP Appliance – phpMyAdmin crashes/ won’t load

Frustration this evening updating my TurnKey Linux  LAMP appliance. Couldn’t get phpMyAdmin to load after update. Server error. Couldn’t track the darn thing down.

After a step by step “echo ‘here i am’” campaign, it came down to this: in /usr/share/phpmyadmin/config.inc.php, it was trying to “Load autoconf local config” from /var/lib/phpmyadmin/config.inc.php. Problem was /var/lib/phpmyadmin/config.inc.php was set to no read permission! Probably a result of some failed upgrade or something. I just don’t have time for this right now! Arg!

Anyway, chmod a+r (sudo or as root, etc) on /var/lib/phpmyadmin/config.inc.php did the trick.

UPDATE 2012-Aug-9: Doing some maintenance work on yet another virtual appliance, and not only was config.inc.php thus afflicted, so was blowfish_secret.inc.php. The above command plus this command fixed it:

sudo chmod a+r /var/lib/phpmyadmin/blowfish_secret.inc.php

Now, back to work.

X11 for OS X Mountain Lion

I love trying new stuff, so I went ahead and installed OS X Mountain Lion Developer Preview 4. Of note, X11 isn’t included any more. But that’s actually a good thing – you’ll be using the latest and greatest XQuartz by the time you’re finished. If you’re like me, you’re in a rush to fix some program (like Gimp, for example, which is why I wanted to get this fixed right away), here’s the short story.

X11 Doesn’t Live Here Any More

This is the message you’ll get when you try to run an X11 program, but don’t have X11 because you’re on OS X Mountain Lion. It says you can Continue on to an Apple Knowledge Base Article to get yourself sorted, but all I got was a 404 (and an apology).

You’re sorry? Me, too.

The long and short of it is that you now need XQuartz, which was actually the X11 that we in use in OS X to begin with, but now you’ll have to get directly from the XQuartz site. Download and install and *poof* off you go.

Magento Image Information via SOAP API

Here’s a little snippet that’ll dump out image information for … well, as written here, every active SKU in your Magento Installation.

The reason for the for loop breaking SKUs down based on the first letter is to keep from blowing up my PHP memory with too many products. Your mileage may vary.

try {
    $proxy = new SoapClient('http://magento.store.url/index.php/api/?wsdl');
    $sid = $proxy->login('username', '********');
}
catch( Exception $e ) {
    echo "Can't establish connection: " . $e->getMessage() . "\n";
    exit(-3);
}
 
for( $cat = 'A', $i=0; $i < 26; $i++, $cat++ ) {     $filter = array(         'status' => array( '='=>'1' ),
        'sku' => array( 'like' => $cat.'%' )
    );
    echo $cat.".";
    try {
        $productList = $proxy->call( $sid, 'product.list', array($filter) );
    }
    catch( Exception $e ) {
        echo "Can't retrieve product listing: " . $e->getMessage() . "\n";
        exit(-4);
    }
    foreach( $productList as $prodInfo ) {
        echo $prodInfo['sku'] . "\t" . $prodInfo['name'] . "\n";
        $media = $proxy->call($sid, 'product_media.list', $prodInfo['sku']);
        print_r($media);
    }
}
exit(0);