I am mikek’s Blog

I R Developer

Snow Leopard low down – my first days with 10.6

I’ve been eagerly awaiting the release of Snow Leopard – the new upgrade to Apples 10.* operating system. Now its released I’m curious about what hoops i’ll need to get my LAMP stack working again when i upgrade.

Below is a list of resources i’ve found from what others have said.

PowerbookMedic’s Snow Leopard review
http://www.powerbookmedic.com/wordpress/snow-leopard-review

Engadgets review
http://www.engadget.com/2009/08/26/snow-leopard-review/

Computer Shopper review
http://computershopper.com/software/reviews/mac-os-x-snow-leopard

PHP 5.3
http://www.brandonsavage.net/first-glance-apples-snow-leopard/

Installing macports under snow Leopard
http://forums.macrumors.com/showthread.php?t=720035

Snow Leopard Vs Windows 7 review
http://www.telegraph.co.uk/technology/microsoft/6087271/Microsoft-Windows-7-vs-Apple-Snow-Leopard.html

Getting Snow Leopards PHP 5.3 to play with CakePHP 1.3
http://dustinboling.com/blog/2009/09/cakephp-and-php-5-3-snow-leopard/

I’m heading off to our local Apple Store in Bristol today so will more than likely have a live install on my Mac by teatime.

Updated:

So I’ve run the backup onto Time Machine and also ensured that everything else got safely copied onto my usb drive. I did this just on the offchance i’d have to do a clean install. Remember to back up items you’ve told Time Machine to ignore (thanks @tomgidden). Also deregister your iTunes.

Installer has run and brought me through to the registration screen. I can’t tell you about any introduction screens as I was away from the mac when i ran it.

Things I’ve discovered about 10.6

  1. Terminal is now able to split panes so you can read what you’ve typed previously in the top pane whilst you continue to type at the bottom.
  2. I’ve got a bit of hard drive space back. Not sure how much but i’ve definitely got a few more GB back as promised.
  3. My Address Book is now working. Its been broken since 10.5.6 or so and was crashing everytime I tried to open it.
  4. Holding a Click down on Dashboard items now brings up Expose. Clicking on individual applications tiles their open windows. Pressing spacebar on a tile brings it full screen. Very nice.
  5. Time Machine is backing up quicker. I’ve shifted a GB over wireless in the last 10mins which is much faster. When i did the first 70GB backup on 10.5 i recall it took nearly a day.
  6. Mail has now got means to connect to Exchange. This means hooking up to Google Apps will be a treat which should also bring in shared Calendars for iCal.
  7. QuickTime has jumped from 7.6.* to 10.*. I’m sure this is to keep the revision in line with Windows Media Player numbers. The interface has been improved and there is no longer a distinction between Pro and non Pro versions. Apparently QuickTime 7 Pro can also be installed alongside it which is nice for those who export from it (and had paid for the upgrade). The Trim functionality is much improved and resembles the video trim interface on the iPhone 3GS which is super simple to use.

Big Win!

  1. The upgrade from 10.5.* -> 10.6 appears to have left my MacPorts intact. I’ve rebooted Apache and started my Mysql server locally and my previously working apps still do. Fantastic.

Filed under: development , , , , , ,

A better like for searching

I’ve been using LIKE for ages which is a useful way to search for part of a word or phrase in a db field.
$conditions = array( 'TABLE.field LIKE'=>'%'.$search_term.'%');

Now i didn’t realise that this wasn’t case sensitive meaning that ‘Ultra’ returned results but ‘ultra’ didn’t.

So to make it case insensitive you can do the following:

$conditions = array('UPPER(TABLE.field) LIKE'=>'%'.strtoupper($search_term).'%');

Not much different but now a useful(UPPER) addition to the sql arsenal.

Filed under: development , , , ,

Exporting to a text file in mysql

Getting data out of a mysql database into a text file is pretty straight forward using mysqldump

mysqldump5 -u USERNAME -p DATABASE_NAME TABLE_NAMES > /PATH/TO/FILENAME

TABLE_NAMES are optional and need to separated by a space if you are exporting a couple.

Filed under: development , , ,

Named arguments vs cakephp sessions

Trying to capture named arguments and store them into a session in CakePHP was returning some unexpected results when I subsequently printed the session data.

My code simplified is as follows:

if( !empty($this->data)){
$params = $this->Session->read('Media.params');
pr($params);
} else {
$named = $this->params['named'];
$this->Session->write('Media.params',$named);
}

If i feed it a url as such http://testApp.com/controller/action/named1:value1/named:value2

I would expect the pr($params) to return an array as such:

array(
[named1]=>[value1]
[named2]=>[value2]
)

Except it was only returning:

array(
[named1]=>[value1]
)

Funny eh?

After a bit of fiddling, I managed to get it to work by adding an additional slash as such:

http://testApp.com/controller/action/named1:value1/named:value2/

which gave me the full named argument array.

For more about Sessions in CakePHP, visit http://book.cakephp.org/view/173/Sessions
and http://justkez.com/understanding-cakephp-sessions.

There are a few issues affecting this still, specifically if i add a namedArg to the end of a
$html->link() .

I have compensated for that as follows:
echo $html->link(__('Upload Media', true), array('controller'=> 'media', 'action'=>'upload','/article_id:'.$article['Article']['id']."/ "));
Note hacky ."/ "

When i establish whats up, I’ll post a reply here. If you know more than me, please leave a comment below.

Follow up:

The correct way to do this would be:

echo $html->link(__('Upload Media', true), array('controller'=> 'media', 'action'=>'upload','article_id:'=>$article['Article']['id']));

(thanks jon)

Filed under: development , , ,

where am i?

Occasionally i need to capture the url of the a current view page in cakephp which i would do by

echo $this->params['url']['url']

A bit of googling today, now gives me a nicer way to do it.

echo $this->here;

sweet eh?

Filed under: development , , ,

Cake and eat it -> Release: 1.2.1.8004

After a fantastic christmas present of a stable release of cakephp 1.2, I’ve now found via the blogosphere, that there is new release to play with, cakephp release 1.2.1.8004.

You can read the announcement here or go get yourself a new download from cakeforge
. Which is where i am off to now.

Filed under: development , ,

PHP: Parsing HTML to find Links

From blogging to log analysis and search engine optimisation (SEO) people are looking for scripts that can parse web pages and RSS feeds from other websites – to see where their traffic is coming from among other things.

Parsing your own HTML should be no problem – assuming that you use consistent formatting – but once you set your sights at parsing other people’s HTML the frustration really sets in. This article at Art of Web presents some regular expressions and a commentary that will hopefully point you in the right direction.

Filed under: development , ,

Converting sql from latin to utf-8

a useful tip from andygale to convert sql from latin to utf-8

iconv -f ISO-8859-1 -t UTF-8 dump.sql > dump_utf8.sql

Filed under: development , ,

Final cakephp 1.2 now here

The much anticipated cakephp 1.2 development framework is now stable.

The history of the CakePHP grows stronger. December 25, 2008 will be remembered as one of the most important points in this history. After exactly 2 yrs from the first development release, we can happily say we have the most stable and powerful web framework available. Please enjoy our big present to you, CakePHP 1.2 stable [1].

See the release notes here

Fantastic news.

Filed under: development , , , ,

Cakephp 1.2 RC4 Released

It won’t be long now until my favorite php framework becomes a full release, and todays announcement that the RC4 candidate is out fills me full of festive joy.

Well done to all the devs who made this possible. I look forward to trying out the improvements in this release and the imminent arrival of the full release.

You can read the announcement here.

Filed under: development , , ,

what's hot

Flickr Photos



Lego ernie

pattern #3

More Photos

Sponsor Mike run the Bath Half marathon

mikek on twitter