Posts Tagged ‘Mac’

Downloading the Squeak VM

June 16th, 2010 No comments

I wanted to download a the latest Squeak Mac virtual machine from  I knew that I had to connect as a guest via FTP, but it took a while for me to figure out how to accomplish this (seemingly simple) task.

From what I gathered from forums, Finder is not a good option to get files via FTP (although there seem to be workarounds).  When I tried Terminal, I kept getting a mysterious error (are there any other kinds with computers, lol): “bind: Invalid command `rl_complete’.”  In addition to being totally useless in telling me what was going on, there wasn’t any info online.  Thanks to the fickle gods, the error disappeared just as mysteriously.  The command ended up being:

ftp -a



With the second option, you enter your email address when prompted for a password (this seems to happen automatically with the first one).

The remaining steps were (at the ftp command prompt):

  1. binary
  2. get “Squeak”

And that was that, the file was downloaded into my home directory!

Categories: Mac, Squeak Tags: , ,

Adding Quicklook support for Ruby files with different/no extensions (e.g. rake files)

March 4th, 2010 No comments

1. Download the excellent qlcolorcode bundle from Google Code

2. Add the following line to QLColorCode.qlgenerator/Contents/Info.plist:

So that it looks like this:
3. In QLColorCode.qlgenerator/Contents/Resources/, add (and customize) the highlighted code, which you can get at github:
4. Oops!  Forgot, you may have to sudo touch /path/to/QLColorCode.qlgenerator for changes to take effect
Categories: Mac, Ruby Tags: , ,

Quicklook any plain-text file e.g. HAML or ERB

March 3rd, 2010 No comments

I’m often jumping from file to file in Rails, so I really wanted Quicklook support for my template files.  Unfortunately, the suggestions I found online were confusing and incomplete.

Here’s a really easy way to get it done – but no syntax highlighting :(

1. Show the contents of TextEdit’s package

2. Open Info.plist in a text editor… like TextEdit, perhaps… hmm…
3. Anyway, add the following snippet (find the code on github):

Put it just before the following section:

4. Customize
  • UTTypeDescription - put in description of your choice (although you probably don’t need to)
  • UTTypeIdentifier – apparently (and this is what was missing from other descriptions), you just make something up here
  • public.filename-extension – add as many extensions as you want to map to this file type
5. Gloat

Categories: Mac, Rails, Uncategorized Tags: , , ,

Quickbooks for Mac 2010 Time Activity Bug

October 28th, 2009 No comments

I’ve run into a bug which is discussed here.  In summary, after entering a single time activity, hitting “next” or “previous” causes problems.

With the following Applescript, when you’re finished entering a time activity, you hit ctrl+n (or whatever shortcut you choose), and voilà:

  • you have a saved entry
  • a new blank form
  • you can scroll to previous and next to your heart’s content!

That is – it works the way it’s supposed to, lol

Here’s the code:

tell application “System Events”

tell process “QuickBooks 2010″

click button “OK” of window “Enter Single Activity”

perform action “AXPress” of menu item “Enter Single Activity” of menu 1 of menu item “Time Tracking” of menu 1 of menu bar item “Employees” of menu bar 1

end tell

end tell

Here’s what you do:

  1. Paste the above script into AppleScript Editor
  2. Save the file (as a script) to: /[your user folder here]/Library/Scripts/Applications/QuickBooks/Save time activity and create new.scpt
  3. If you have an script menu app (FastScripts is the absolute best!), you can assign a shortcut to it, like ctrl+n)
Categories: Applescript Tags: , , ,

Only running unit tests in Xcode if the build was successful

August 14th, 2009 2 comments

My workflow in Xcode is typical TDD – write a test, run the tests, write some code, run the tests…  I set up a “Run Script” build phase, so that every time I build the tests, they are automatically run.  The only problem is that the “Run Script” happens whether the build was successful or not.  So, I try to build and fail, and then the same exact tests that I already ran, automatically run again – while I sit there and wait.

The solution turned out to be very simple.  “Run Script” build phases in Xcode can have input files and output files.  The phase is only run if some input files were more recently modified than some output files.  Thus, if we set the input file to be the test executable, and the output files to be all the source files, then the tests will only run if the build is successful.  It will look something like this when set up:

Conditional Run Script Phase

Applescript to safely open links from Apple Mail

July 27th, 2009 No comments

I’m (justifiably) nervous about following links from emails.  I wrote an applescript that sets my mind at ease.  It works like this:

  1. I copy the link to the clipboard (right-click on it)
  2. I run the script
  3. it automatically finds the site name e.g. “orbitz” from “” and opens up a new google search in Safari.
  4. When I click on the hit that’s the real site, the script inserts the domain name of the real site into the link from the email
  5. The valid link comes up in Safari

I just thought about searching my Safari bookmarks, but this got the process down from manually editing the URL to three mouse clicks, so I’m happy :)

set link_to_scrub to (get the clipboard)

set text item delimiters to "/"
set tokens_to_scrub to text items of link_to_scrub

set domain_name_to_scrub to (get item 3 of tokens_to_scrub)

set text item delimiters to "."
set url_labels_to_scrub to text items of domain_name_to_scrub

tell application "Safari"
make new document with properties {URL:"" & (item 2 of url_labels_to_scrub)}

set current_url to a reference to URL of document 1

repeat until current_url starts with ""
delay 0.1
end repeat

repeat while current_url starts with ""
delay 0.1
end repeat
end tell

set text item delimiters to "/"
set real_tokens to text items of (current_url as string)

set real_domain_name to (get item 3 of real_tokens)

set text item delimiters to "."
set real_url_labels to text items of real_domain_name

repeat with current_label_index from -2 to -1
set item current_label_index of url_labels_to_scrub to item current_label_index of real_url_labels
end repeat

set real_domain_name to url_labels_to_scrub as string
set item 3 of tokens_to_scrub to real_domain_name

set text item delimiters to "/"
set real_link to (tokens_to_scrub as string)

tell application "Safari"
set URL of document 1 to real_link
end tell

Categories: Applescript, Mac Tags: , , ,

Getting the process ID of a Mac App

July 15th, 2009 No comments

It seems like a common-enough problem, yet after striking out on the mailing list archives, coding sites, and Apple Developer Connection, I wrote this little Cocoa snippet to find the process ID of a particular app:

// Just replace this first string with your app name
NSString* target_app_name = @"Finder";
NSWorkspace* workspace = [NSWorkspace sharedWorkspace];
NSArray* active_apps = [workspace launchedApplications];
NSNumber* process_id = nil;

for (int i = 0; i < [active_apps count]; ++i) {
  NSDictionary* current_app = [active_apps objectAtIndex:i];
  NSString* app_name = [current_app valueForKey:@"NSApplicationName"];

  if ([app_name isEqualToString:target_app_name])
  process_id = [current_app valueForKey:@"NSApplicationProcessIdentifier"];
Categories: Mac, Programming Tags: ,

Hippomocks 2.0 on Mac OS X

April 22nd, 2009 No comments

I’m exploring Hippomocks, a C++ mock library.


The library supplies a test suite for compilers not known to be supported.  GCC is listed, but I think Apple’s version is a little different than standard GCC, so I’ll run that.  Pretty easy in Terminal:

  1. “cd /path/to/Hippoocks/HippoMocksTest/”
  2. “make test” (there’s also a test0x, but it requires >= GCC 4.3, which is confirmed when my Mac doesn’t recognize “-std=c++0x”)

And… errors :(  But easy ones to fix…

cc1plus: warnings being treated as errors

../HippoMocks/hippomocks.h:139: warning: ‘class func_index’ has virtual functions but non-virtual destructor

is_virtual.cpp:4: warning: ‘class IL’ has virtual functions but non-virtual destructor

test_class_mock.cpp:24: warning: ‘class IG’ has virtual functions but non-virtual destructor
n.b. the above errors were over several compiles, but I showed them together for brevity.
Picking up where we left off… “make test” now succeeds, and ./test reports:
The final step, per the installation instructions, is to copy the single header file, hippomocks.h, into a system directory.  I’m putting it in /usr/local/include.
That’s it!  The library is ready for use in all my C++ projects.  All I have to do is #include <hippomocks.h> and go to town.
Categories: Mac, Programming Tags: , , , , ,

C++ XML Parser Library wrapper Part 2: expatmm

April 1st, 2009 No comments

After my expatpp adventure, I took a sharp turn and switched to expatmm.  It too is a C++ wrapper to expat, but it seems more up-to-date (working with the latest version of the expat library) and has replaced expatpp on the expat 3rd party links.

It works great out of the box on Mac OS X 10.5.6.  It built and installed (using configure and make) with only one small problem – I had to change ExpatMM-version.cpp to hardwire the version # in.  Once that change was made, I included and linked to the lib from Xcode with no problem.

Categories: Programming Tags: , , , ,

Keep Boost Libraries in the standard install location for Mac – if you know what’s good for you!

March 11th, 2009 No comments


Love Boost, hate Boost.  You can’t imagine how much time I spent on this.

Ok, much better.  If you install the Boost libraries to an alternate directory (other than usr/local/lib), you will have to jump through hoops to link to the shared versions.

Option #1: Keep Boost in /usr/local/libs.  To link to shared libs, drag them into Xcode.  Done.  (Tip: put a symlink in a visible directory if you can’t see /usr/local/libs)

Option #2: Keep Boost wherever you want and copy the dynamic libs you use into the executable’s directory before linking.  This approach is not recommended.  Your program will only work when the current directory is the directory of the executable.

Categories: Mac, Programming Tags: , , ,

windows 7 product key

windows 7 product key

windows 7 key generator

windows 7 key generator

free winrar download

free winrar download

winzip activation code

winzip activation code

free winrar

free winrar

winzip free download

winzip free download

winrar free download

winrar free download

winrar download free

winrar download free

winzip free download full version

winzip free download full version

windows 7 activation crack

windows7 activation crack

windows 7 crack

windows 7 crack

free winzip

free winzip