Me, my mac and I. (A web-programmer experience of moving from windows to a mac)

Introduction…

So I thought it might be nice to share my experiences (the first weeks) having made the leap over to mac from windows after all these years.

My top-end sony vaio laptop decided to go belly up on me, forcing me to consider the change. I went for a 17” macbook pro (default spec so I’d get it asap), I decided to phone up and the nice saleman knocked off just over £100 quid off and even put me on priority shipping as my other computer was broken so I got it the next day (always ring up and tell them its for business and they might just do you a deal)!

So having got my macbook the next day and got through all the umm’ing and ahh’ing opening it all up I got to grips with it right away.

I won’t bore you with all the details but I will say that the transition has been very smooth indeed and the learning curve, minimal.

Basic Setup…

Hardware: Standard spec 17” Macbook Pro running Leopard (4GiB ram, 500GiB HDD)

Other Notable Hardware: Firewire 800 500GiB Seagate external drive for Time Machine

Software currently installed (bought programs marked in red):

  • Adium (Multi-network messaging app)

  • Adobe Reader 9

  • Amazon MP3 Downloader

  • Booksmart (A book creation tool)

  • Carbon Copy Cloner (Disk image cloner)

  • Cornerstone (Commercial SVN client)

  • Countdown (Widget for counting down for things like when I see my girlfriend again!)

  • Drobo Dashboard (Dashboard software for my Drobo drive)

  • Duplicate Annihilator (Very cheap proper checksum based de-duper for iPhoto ‘09, took my initial collection of 16k down to just over 12k)

  • Enigmo 2 (Fun game)

  • Fanurio (Time tracking/billing, windows licence worked fine with mac version)

  • Filezilla (FTP client)

  • Firefox

  • Gimp (Image editing software)

  • Google Earth

  • GrowlTunes (Very useful for notifying what tune is playing)

  • Inkscape (Vector/SVG art editor)

  • iStatNano (Widget for showing system temperatures, network usage etc.)

  • Open Office

  • Opera (For browser testing)

  • Skype (Free video calls/cheaper SMS’s to my girlfriend)

  • TechTool Deluxe (Hardware debugging, included with Apple Care that I bought with the laptop)

  • TextMate (Good commercial text editor)

  • Text Wrangler (Free text editor, bit redundant now with TextMate)

  • The Unarchiver (Unpacks more compressed file types)

  • Things (Commercial GTD-style application, i.e., a fancy todo list, I love lists)

  • Thumbnail Annihilator (Comes included with Duplicate Annihilator, not used it)

  • Thunderbird (Email, moved all my mail in it from Windows)

  • Transmission (Good minimalist bit torrent application)

  • VLC (Super video player for all sorts of video/audio files)

  • VMWare Fusion (Decent virtualisation, everything I read was that it kicks parallels out of the water and it should being such a mature product, use it for running Debian (stable) linux, Windows XP and a few other test linux’s)

Software Installed and removed:

  • Vuse (Replaced with Transmission, much less fluff, I’m not a “power user” when it comes to torrents)

  • iGTD (Stable version of this kept crashing on the most basic functions, replaced with Things, much more slicker interface)

  • Superduper! (Replaced with Carbon Copy Cloner as it allows disk image files to be created and is free)

  • Versions (Replaced with Cornerstone as it seemed to have featured I needed, better layout and didn’t crash as I had with Versions a few times)

  • Netbeans (Not uninstalled but pushed aside now I have TextMate, it kept crashing with subversion support on all projects when scanning them, using TextMate+Cornerstone now, TextMate lacks function/method auto-complete but worth giving up for stability and I prefer the interface)

A bit about my desktop setup (some simple tricks included):

I got rid of my 2nd monitor on my desk, I just use my laptop display with 4 x 2 spaces, assigning applications to spaces and using CTRL+[1-8] is much easier for me (Firefox = space 1, TextMate = space 2, Thunderbird = space 8 etc.)

Hot corner setup: (Top-left = Go to spaces useful for quick switching when you can’t remember where you put something. Top-right = Start screensaver, which prompts for password so it basically locks my computer for me, useful for keeping apps/system secure when on-site with clients).

Cool fact: When you have a full-screened Windows VM up you can still use hot-corners. Really useful for dipping in/out of windows when you need, (move pointer to top-left, click into full-screened Windows VM, do what I need to do, move pointer to top-left select another space and back to the mac, simple!)

Dragged the applications shortcut from the finder into the stack area (right side of the dock), useful for quickly getting to the rest of your apps quickly).

Dragged the downloads stack into the finder “Places” as I found I needed that quite a lot (saves time from having to navigate all the time).

Kept a folder of installed (and uninstalled) apps as some applications I’ve heard require you to have the original dmg/installer!

Created a folder called not backed up for files I don’t want Time Machine to backup (usually large files which I don’t need backed up like large downloads/torrents etc.)

Its worth going through all the system preferences (especially the mouse section) to turn on things like right mouse button on lower right of track pad, tap to left click etc.

More interesting stuff…

So my development environment primarily consists of a LAMP setup with some bits on.

Firstly I recognise that there are apps like MAMP out there and if you do simple LAMP development then maybe this is best for you, I tend to prefer mirroring my target environments as closely as possible so the idea was to basically get my code to reside locally on my mac so it’s not in the VM (although executed in the VM) and backed up with time machine and editable with local mac apps like TextMate so I’m not sitting on SSH sessions and VIM like I was with my windows setup.

First I setup my debian stable VM instance in VMWare fusion with a net install iso, setup the relevant LAMP software and got a basic host up.

Next I NFS exported my main projects directory on my mac and made it available to the VMWare network.

Edit /etc/exports on your Mac (I should note all of this stuff applies to Leopard only as I understand pre-Leopard people have to do potentially do different things when it comes to NFS!)

Mine looks something like this…

/Users/yourusername/Documents/Projects -maproot=yourusername -network=172.16.182.0 -mask=255.255.255.0

The network option specifies to what network it should be exported to, in this case to vmnet8, running /sbin/ifconfig in the terminal will show you a list which includes the details for the vmnet8 interface, here’s mine…

vmnet8: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500

inet 172.16.182.1 netmask 0xffffff00 broadcast 172.16.182.255

ether xx:xx:xx:xx:xx:xx

To get this NFS mount up and running you then need to sudo and execute:

sudo nfsd enable (to enable the nfsd service)

sudo nfsd update (worth doing to ensure the current /etc/exports is picked up)

sudo nfsd checkexports (this will check that you mount looks valid)

So once this is up you can then try and mount it in your linux vm.

In your VM edit your /etc/fstab, here’s what mine NFS mount entry looked like:

172.16.182.1:/Users/yourusername/Documents/Projects /data/www nfs user,rw,exec,actimeo=1 0 0

So this basically says mount the path “/Users/yourusername/Documents/Projects” on the host “172.16.182.1” in the “/data/www” dir locally.

The mount options are explained as follows:-

user: normal user can mount the filesystem

rw: read-write access

exec: allow execution of binaries/scripts

actimeo=1: Very important as this will tell NFS to only cache attributes for 1 second (as it stands the NFS caching timeouts would have you scratching your head as to why sometimes things update and sometimes not. NOTE: do not be tempted to use the “noac” option thinking that no caching is better than a little caching as your performance will take a huge nose dive as the system does a stat *everytime* is reads something).

After having it successfully mount on boot etc. I noticed that the user id mappings between my mac user and the debian linux user were not the same, unfortunately unlike the linux nfs server as I read there is no option to map user ids from one system to another so I ended up just doing a simple “usermod -u INSERTMACUIDHERE yourdebianusername”, on debian linux at least this changed the files/dirs inside my home dir and I just needed then to chown a few things outside of that.

After remounting I had transparent user access from mac to my debian vm.

NOTE: You can also suspend/resume your debian vm without issue to your NFS mount (no unmounting/remounting required) which is cool.

After tweaking apache to look to my new NFS mount etc. I had my code running off my NFS mount, log files generated to my NFS mount, all was well. I didn’t see any point in going any further (re-pointing /var to NFS etc.), I also have a script that mysql dumps compressed databases to my NFS mount as well so I run that every now and again so they get backed up properly.

So all in all the only stuff I would lose if my VM went belly up would be any database data that wasn’t backed up, log files of no importance and the minor apache/system config which you need to do with every system.

I’m pretty please with how it all works, performance is fine and the only extra thing I need to do is ensure that my hosts files on my mac, debian vm and windows vm is in sync so I can access sites on my mac and windows (for browser testing).

Lastly I shared my projects directory also to my windows vm (using VMware shared folders) so I can do any image editing in photoshop in windows (I have a windows licence for my creative suite so I have to use in my windows vm).

I should also note that I turned off time machine backup also for my Virtual Machines directory as it wanted to back this up frequently. (Backups made of this directory isn’t useful as I’ve heard a backup of a running VM is not at all reliable [as you'd expect], if you do need to backup your Vms I guess you should halt them all and then copy/backup the files to ensure they’re going to be ok).

I hope this article helps some of you out there, all in all I’m very happy with my new mac and will no doubt write another article again in the future soon when I find some more cool stuff out! ^_^

Mosso PHP itk upgrade fail!

Mosso have been sending numerous emails warning everyone that a big PHP update is on its way. I’m cautious enough so I read all the information in the email and their helpful article here:  http://help.mosso.com/article.php?id=362

I relax safe in the knowledge that the upgrade changes will not affect any of my sites that I host… right? wrong. *sigh*

One of my customer’s hosted websites suddenly goes down with a failed php file inclusion for PEAR.php, turns out that Mosso have decided to silently remove Pear support without letting their customers know, thanks Mosso(!)

He told me I should have checked the itk test url… pfft, fair enough I guess (the proof is in the pudding), but upon testing it with another site which I guess has not been migrated yet and should break… it doesn’t break! *rolls eyes*

The customer support person got most of my rant but it didn’t really wash with me when his reply was that “some things would be missed”, I mean if you’re talking about a PHP upgrade, Pear support (even basic Pear support) is something that needs to be looked at and checked and noted if its suddenly going to disappear one day.

Don’t get me wrong, I like Mosso, I think they do good work, but I wish they’d be a bit more thorough and consistent with things as I’ve had similar “glitches” in the past, nothing major but still what you’d call human error.

Anyway, enough rant, more solutions…

If you do find yourself with a site giving you a PHP fatal error with a non-existent PEAR.php file then you’ve most likely got the same issue.

You need to build yourself a Pear directory with all the modules you need (I copied mine from a unix development instance I use), I have demanded that Mosso need to provide customers with a zipped download of what was in /usr/share/php before it was taken out of commission and put it on the support url above, whether they’ll follow through I’m not sure.

Once you’ve done that, then you need to append or add a line in an .htaccess file inside your main “content” dir that defines where your new pear dir resides, like so:

php_value include_path /mnt/targetXX/XXXXXX/XXXXXX/www.domain.com/path/to/pear:/any/other/dirs/you/need

And hopefully that should solve your problems.

Oh well…

</rant>

Zend Framework: Sessions Expire With Quick Successive HTTP Requests

Hi Everyone,

I hope this helps you too, I noticed that opening up a pages quickly (via say middle clicking a link to open tabs) in Zend Framework when you have a valid session can cause your session to prematurely expire.

So anyway, I found the problem to be caused [inpart] by PHP’s session_regenerate_id() which is used by Zend Framework to stop session fixation security issues, unfortunately I have to disable this line in Zend/Session.php as it’s causing me problems.

I have read some comments that people think it’s the browser not picking up the new session id for whatever reason?! (although I don’t have the time to look into it further yet).

As of Zend Framework 1.7.0 it’s Zend/Session.php:279

session_regenerate_id(true);

Commenting out this line doesn’t seem to have any ill effects, of course you could alternatively use:

session_regenerate_id(false);

But with a public website you would find yourself quickly with a lot of stale session files and on top of that requests that have the expired session issue would potentially have old session data information which would make for even more baffling debugging type situations!

I understand the security implications of a static session id (session hijacking etc.), and have shortened the session lifetime accordingly as a result.

In the world of ever-increasing AJAX requests, I can imagine more and more people will also have problems with this.

If I get some time to look into this further I will of course post my findings.

Thanks,

– Dan.

Next Page »