OS X Memory Issues

With Activity Monitor and the Finder open, and, a few background apps (Remote Buddy, Proxi, and PTHPasteboard). I had just closed all other apps: Mail, FireFox, iTunes, PandoraBoy, Adium, iCal, probably a few others.

With 3GB Physical RAM in this system, I was left with 750MB free:

This, is no good.

Update (12/29/09): I finally googled this, no idea why I waited so long. Anyway, Mac OS X: Reading system memory usage in Activity Monitor.

MacBook Pro Riser

For about $8 I made the equivalent to the Griffin iCurve/Elevator with PVC pipe.

Original idea was from Instructables. I adjusted for size of the MacBook Pro, and used 1/2″ instead of 3/4″ PVC. 3/4″ seemed far too heavy duty for this.

If you want to make one for your 15″ MacBook Pro I recommend using 1/2″ PVC.

You’ll need the following pieces:

  • 2x 11″
  • 4x 5 1/2″
  • 2x 3″
  • 4x Elbow Joints
  • 4x T-Joints

Assembly is pretty simple. I actually did it right in Home Depot in about 10 minutes.



Make Everyday The Middle Of The Week in iCal

I prefer using iCal in “Weekly” view mode. My problem with this mode though is that once you get towards the end of the week, you will not see what is coming up the next day(s) without explicitly switching to the next week – surely we can fix this?

What I wanted was to be able to see today, maybe the day before, and the next 5 days. After all, the past 6 days is seldom useful, but it’s nice to know what is happening the next 3-5 days.

This script will do this for you. It does so by changing the “Start Week On” preference in iCal everyday at midnight.

To reiterate, my preferred setting is to have the SECOND day of the week be TODAY. If you’d prefer another day, change the number 5 in the script below(4 = 1st day, 5 = 2nd day, etc).

The Applescript to perform this is:

-- Quit iCal if it is open
tell application "System Events" to set isiCalOpen to count ¬
	(every process whose creator type is "wrbt")
if (isiCalOpen is 1) then tell application "iCal" to quit

-- Make the change
do shell script ¬
	"defaults write com.apple.ical \"first day of week\" -int " & ((((weekday of (current date)) as integer) + 5) mod 7)
delay 2
-- Open iCal
tell application "iCal" to activate

Open in Script Editor

If you’d like to have this script run everyday, you may want to check out the excellent Launchd editor, Lingon. My LaunchAgent file can be downloaded here: iCal LaunchAgent.

‘batch’ broken in Mac OS 10.5 (Leopard) – SOLVED

Give it a try and let me know if you agree… Quick test:
$ batch now
> ls
job 1 at Wed May 14 14:02:27 2008

$ atq
778240 Fri Jan 18 09:03:00 2002


$ batch 17:00
> ls
job 5 at Wed May 14 17:00:00 2008
$ atq
778240 Sat Jul 17 12:39:44 1993

Update: 10.5.3
This doesn’t seem to happen anymore in 10.5.3, but it doesn’t quite seem to work either:

$ at 3:00
> touch /TEST.TEST
job 10 at Sun Jun 1 03:00:00 2008

This was ran at 2:59:30(or so) and as of 3:45:
$ atq
10 Sun Jun 1 03:00:00 2008

Yet, the command did not execute.

Update 9/21/09:

I don’t know how I missed this before, but in the man page for at on OS X, there is the following comment:

Note that at is implemented through the launchd(8) daemon periodically
invoking atrun(8), which is disabled by default.  See atrun(8)
for information about enabling atrun.

Going over to the atrun page shows that you can enable a launch daemon to periodically run queued at and batch jobs. The executiable that does this should be run with root permissions and is located at /usr/libexec/atrun

Calculating Actual Hard Disk Space…

If under 1TB in size simply calculate: (Advertised size in GB) * 0.931
Or, to be exact: (Advertised size in GB * 10^9)/1024^3 should do the trick…

Over one TB you can not just assume 1TB = 1,024GB since the advertising calculation is in base 10, and this crazy device in front of you prefers base 2… So:
Over 1TB calculate: (Advertised size in TB) * 0.909
Once again, to be precise: (Advertised size in TB * 10^12)/1024^4.

Move All Windows To Your Main Screen…

ApplescriptSo, you’ve got more than one screen? Life is good with all that wonderful screen real estate, then BAM… You end up back with just your main screen, but your applications have left their windows on those other displays, far out of your reach…

Let’s fix that. This little script simply goes and tells all of your applications to get their act together, to move their window’s to the main display.

You’ll need access for assistive devices turned on, which you can do by going in to System Preferences, Universal Access. At the bottom check the box for “Enable access for assistive devices”.

As it is, the script will tell all applications currently running, that if they have a window that is entirely on the main display – to move it to the top left of the screen.

You may have some applications which keep windows off screen on purpose, if you experience any strange behavior with these applications you can exclude them from the applications which get checked by adding their name to the “processesToIgnore” list at the top of the script. There is an example to show how the list should look in the comment right above it. Be sure to use the exact name of the application.

Lastly, if you have more then one display attached when this script is ran it will basically do the same thing, but windows on other screens will not be moved to the main display, only windows outside the range of all current displays.