Archive for the 'Tech Talk' Category

Installing PEAR Spreadsheet_Excel_Writer

Saturday, 16th May, 2009

Quick post to consolidate information around the net. Installing this package is not as straight forward as most, as it’s in the beta channel.

Failed to download pear/Spreadsheet_Excel_Writer within preferred
state "stable", latest release is version 0.9.1, stability "beta", use
"channel://pear.php.net/Spreadsheet_Excel_Writer-0.9.1" to install
Cannot initialize 'channel://pear.php.net/Spreadsheet_Excel_Writer',
invalid or missing package file
Package "channel://pear.php.net/Spreadsheet_Excel_Writer" is not valid
install failed

Behold:

pear config-set preferred_state beta
sudo pear install ---onlyreqdeps Spreadsheet_Excel_Writer

Include the onlyreqdeps switch so that the dependency package PEAR OLE is installed.

Tuning Eclipse IDE on Mac OS X

Friday, 6th February, 2009

Tuning Eclipse is pretty straight forward, passing the commonly documented command line arguments when running Eclipse on Mac OS X is not. At least not as easy as it would be in Windows. Like Windows shortcuts we have OS X ‘aliases’ but these do not allow us to specify additional arguments.

You can create a bash file to launch Eclipse with the extra parmeters but then we can’t place this on the Dock. Fortunately you can place these settings in the eclipse.ini - but where the hell is it?

Show package contents context menu in OS X

Finder will then present a new folder window:

eclipse.ini

Voila! You can enter your VM args into eclipse.ini

Scriptaculous opacity flicker

Thursday, 5th February, 2009

Update: A better solution, which enables more than one effect to be used is Effect.Queues.

I recently used scriptaculous at work to provide some animation effects in a product. Specifically using Effect.Opacity(). However I ran into a problem in all browsers, on both Windows and Mac OS X, where the page element would flicker during the opacity change. My code went something like this:

changeItem: function(container, item) {

	var html = '<div>' + item['title'] + '</div>';

	new Effect.Opacity(
		container,
		{ from: 1, to: 0, duration: 0.5 }
	);
	container.innerHTML = html;
	new Effect.Opacity(
		container,
		{ from: 0, to: 1, duration: 1 }
	);

},

After reading about bugs in Firefox where I had to set the opacity to 0.99 instead of 1; or setting the background color, width and height to the elements that I was applying these effects on, I eventually solved it doing this:

changeItem: function(container, item) {

	var html = '<div>' + item['title'] + '</div>';

	container.setStyle({opacity: 0});
	container.innerHTML = html;
	new Effect.Opacity(
		container,
		{ from: 0, to: 1, duration: 1 }
	);

},

The first effect I was applying was not running in sequence - I mistaken assumed it would. These two effects either side of the innerHTML statement were fighting one another. Removing the first didn’t change the visual effect much and cured the flickering! Pass it on.

iWork ‘09 OS X Trojan Horse

Friday, 23rd January, 2009

For those people who have been infected by the OSX.Trojan.iServices.A Trojan horse (shame on you!) here are some removal instructions (credit to Aaron):

Open Terminal:

$ sudo su [enter password]
$ rm -r /System/Library/StartupItems/iWorkServices
$ rm /private/tmp/.iWorkServices
$ rm /usr/bin/iWorkServices
$ rm -r /Library/Receipts/iWorkServices.pkg
$ killall -9 iWorkServices

Apple offers a 30 day trial of iWork ‘09, it’s only £69 to purchase - a far cry from the £350 price tag for Office 2008 for Mac (unless you opt for the Home & Student Edition).

Mounting shared folders in Mac OS X Leopard

Wednesday, 12th November, 2008

Having recently switched to Mac OS X, I stumbled upon issues when mounting shared folders on my Macbook Pro from our Linux development server. Previously, both Windows Vista and Ubuntu have had no trouble sharing a directory then mounting it from the dev server via smbfs. This enables me (and other developers) to edit files locally which then also appear as a local files to our development server, where we run Apache / MySQL etc.

After sniffing around System Preferences in Leopard, and juggling some account credentials so SMB login details pair up, I could successfully mount my workspace folder. Make sure the appropriate permissions are set on your shared folder, then click options and disable AFP, and enable SMB.

System Preferences > Sharing
Sharing options

Unfortunately, some minutes later it unmounted itself. After some Googling, I found others with the same issue.

I read (unfortunately I’ve since lost the link) that changing from smbfs to cifs helps remedy this problem. I gave it a shot and it sure enough it cured the dropping issue.

However, when using cifs I would get permissions problems if I ran a script that manipulated / generated files in my workspace. My OS X uid and gid do not match those of the development server (Ubuntu); Mac uids start at 501 and Ubuntu creates users starting above 1000.

Fortunately simply telling the mount to ignore permissions seem to solve the problem. This is the mount entry in the development server’s /etc/fstab:

//192.168.0.1/workspace /home/greg/workspace cifs
      noperm,credentials=/home/greg/workspace.smb,rw 0 0

That should be all on one line but is broken over two for formatting purposes. Of course you substitute 192.168.0.1 with your Macbook’s UNC name or IP address. You should substitute ‘workspace’ with the name of your shared folder and change the mount point on the local server accordingly too.

The username and password specified in your credentials file will have to match your OS X user and password you set up when modifying the sharing options earlier.

You are currently browsing Greg’s blog (software development and operating systems) archives in the Tech Talk category.

Categories

My Bookshelf

PHP in Action: Modern software practices for PHP Agile Web Development with Rails
xhtml 1.1 compliant   xhtml 1.1 compliant