Shane Duffy

Archive for the ‘os x’ Category

After getting a CurrentCost energy monitor a week ago I decided it was time to get some useful data out of it. I have 3 phase power so I wanted a tool which would create graphs for each of the phases along with combined total data. The solution to my problems would have to be custom coded and I also wanted an application which could be used cross platform as I regularly use both Windows and OSX.

My choice was to use Adobe Flex as it can provide some nice looking graphs and I have been meaning to do more work using the Flex in flash player or using Adobe Air technology to create a desktop application.

CurrentCost Application

CurrentCost Application

Im creating an application which I can give back to the community which have been developing applications already for the CurrentCost meter. So I decided to use a very simple architecture for this first demo application which uses a simple client server model.


So this morning I was doing some work with one of my webservers and adding new sub hosts to some of the domains and to see the changes on my MacBook pro laptop I knew I would need to flush the DNS cache so I wouldnt have to wait for the cache to expire.

So for anyone else who needs to know the commands here they are:

OS X <= 10.5.1

lookupd -flushcache

OS X >= 10.5.2

dscacheutil -flushcache

Hope that will help anyone out there who needs to flush their dns cache and has just upgraded to 10.5.2

Recently I have been having a lot of issues with my macbook pro and connecting to my home network, Airport on mac osx would seem to be connecting to find to the network, but the computer would never get an address from the dhcp server on the network, and manually setting the ip address would still result in no joy.

The network setup is WPA (AES CCMP + TKIP), multiple channels, and multiple access points to give full coverage.

The laptop has the latest firmware including the AirPort Extreme 802.11n* Enabler for Mac.

Having searched for solutions none of which really solved my problems.
Wifi (airport) solutions
Airport macbook pro problems
Apple support – Discussions

There seems to be some issues with the Macbook pro airport and using WPA with AES CCMP encryption. My solution for now is to configure the access points on the network to use TKIP encryption.

I have a macbook pro and sometimes I need to connect to the console port on some of the cisco networks I do work on.

Today I went out and bought a USB to Serial converter from maplin, the driver disk that comes with the product is one of the small CDs which would get stuck in the drive and the link from the maplin website for drivers is for very old versions of mac os 8/9. Quick search on google lead to prolifics website which manufactures the usb to serial chipset. (mac os x driver download here)

So once thats all installed and the laptop has been rebooted, its time to test it all out and start connecting to routers, problem is what program should you use?


I chose to use a less know command using screen which is installed and included by default on OS X which makes it very handy to use.

 screen /dev/tty.usbserial 9600

Screen provides your normal clean terminal interface inside a new process shell.

I often get given laptops and computers by friends to sort out because the see me as the “computer whiz”. This time even I had to think about the problem for a while, I was given a Macbook laptop that keep saying it had no free space left on the hard drive anymore, The user had deleted everything the could and did all the usual emptying the trash can to no avail. The only thing I noticed as been different on the laptop was the Home directory was encrypted with File Vault. File Vault is ment to run a clean up agent when you logout to free up the disk space that was used by deleted files on the encrypted file system, The trick however is that this will only run if the laptop is plugged into the power supply at the time.

The other problem is to turn file vault off your require 5x or more free space than what is been used by file vault at the time, So if you have 20GB in your Home directory, and want to turn it off you will need 100GB of free space.

File Vault

So unless your really paranoid about your files and security don’t turn on file vault, as in the end it will be more hassle than its worth.

Ok, so in my last post about showing the hidden files in finder I talked about the terminal commands but thats not always convenient for fast switching.

Below is some applescript that I wrote to do the job.

-- Shane Duffy

display dialog "Show hidden files in Finder" buttons {"Show", "Hide","Cancel"} default button 1
copy the result as list to {buttonpressed}

if the buttonpressed is "Show" then
my ToggleVis("ON")
else if the buttonpressed is "Hide" then
my ToggleVis("OFF")
end if

on ToggleVis(FileVis)
tell application "Finder" to quit
do shell script "defaults write AppleShowAllFiles " &amp; FileVis
delay 0.4
tell application "Finder" to activate
end ToggleVis

A great update has been developed by Tim over at . He took the script I have written and made it super useful for everyone by creating a small application which can be embedded into the finder toolbar at the top of every finder window.
This makes the script very accessible and much more user friendly. Check it out here.

One annoying thing about my MacBook pro and OS X is not easily been able to show hidden files.

Showing hidden files

defaults write AppleShowAllFiles TRUE

killall Finder

killall Finder TRUE

Hide the files again

defaults write AppleShowAllFiles FALSE

killall Finder

killall finder FALSE

Thanks to Matt for pointing out an error in my screen shots

AppleScript: The Definitive Guide, 2nd Edition provides a great resource for anyone who wants to build some of there own scripts or learn how to modify others work to extend functionality for yourself and automate some of the routine jobs on your Mac.

Subscribe to this blog now!

Top Clicks

  • None
July 2018
« Feb