Archive

Posts Tagged ‘mac’

Unzip KMZ Files on a Mac using Springy

May 6, 2011 2 comments

I’m learning about KML/KMZ files, where KMZ is basically a .zip file renamed as .kmz.  The problem is that these .kmz files cannot be opened using the default Mac unzip utility.  When you try to open the .zip file, it creates a new file called <originalfile>.zip.cpgz.  Opening the .cpgz file yields a copy of the original zip.

Mac OSX cannot handle unzipping the file

The solution is to use Springy, a zip utility for Mac (free trial, ~$20 to buy).  It handles the file perfectly:

Open with Springy

Open with Springy

Springy handles KMZ fine

Springy handles KMZ fine

Edit: Found an alternative approach here.  Basically, rename the file .rar instead of .zip and the Unix unzip utility can handle it.

I’ve written a script to incorporate this; find it as a gist here.

Categories: Uncategorized Tags: , , , , , ,

Visor – Mac OSX shortcut to launch Terminal

May 5, 2011 Leave a comment

My friend Paul showed me a very nice application to quickly launch Terminal.  It’s called Visor, and it’s very useful if you’re a programmer.

Visor screenshot

Visor allows you to pop up your terminal window at any time

After installing it, your terminal hides until being summoned via a keyboard hotkey.  At that point, it pops into view from the top of the screen (though this can be customized if you desire).  I find it really declutters my desktop, as I no longer need to devote screen real estate to the terminal.  Instead, it’s hidden until I need it.

Due to the way it’s packaged (as a SIMBL plugin that modifies the Terminal app itself), it is unobtrusive, incorporating its settings into the Terminal app itself as opposed to requiring a separate app in your dock or quick launch bar.  It’s simple and works flawlessly.  Can’t ask for much more in a piece of free software.

Visor preferences

Visor preferences

TextMate Grammar Editing Tip – “Edit in TextMate”

April 12, 2011 Leave a comment

I wrote previously about creating language grammars in TextMate and I’ve been doing a bit more of this lately. One thing that makes this process a lot less painful is following the advice from the official Textmate book and installing the “Edit in TextMate” bundle.  Do this by going to Bundles->TextMate->Install “Edit in TextMate”, and follow the instructions.  After rebooting TextMate, you can press ⌃⌘E while within the Edit Grammar file to open a live copy of the document in a syntax highlighted textmate window.  Every time you hit Save, the changes are pushed back to the unstyled document pane.  This drastically speeds up development, as you no longer have to copy and paste text between the windows, but instead can hit save any time you want to try your changes out.

Live updating, syntax highlighted language grammar

Live updating, syntax highlighted language grammar

Excel 2008 for Mac’s CSV export bug

December 6, 2010 7 comments
I ran into this at work a few weeks ago and thought I’d share.

Excel 2008’s CSV export feature is broken.  For instance, enter the following fake data into Excel:

Row Name Age
0 Nick 23
1 Bill 48
Save as -> CSV file

Full list of choices

When you use standard unix commands to view the output, the results are all garbled.

[Documents]$ cat Workbook1.csv
1,Bill,48[Documents]$
$ wc -l Workbook1.csv
0 Workbook1.csv
What is the issue?  The file command reveals the problem:
$ file Workbook1.csv
Workbook1.csv: ASCII text, with CR line terminators
CR stands for Carriage return, the ‘\r’ control sequence which, along with the newline character (‘\n’), is used to break up lines on Windows.  Unix OSes like Mac OS expect a single ‘\n’ new line character to terminate lines.
How can we fix this?

dos2unix.

# convert the Workbook1.csv file into a Unix appropriate file
dos2unix Workbook1.csv WithUnixLineEndings.csv
If you don’t have dos2unix on your Mac, and you don’t want to install it, you can fake it with the tr command:
tr '\15' '\n' < Workbook1.csv # remove the carriage returns, replace with a newline
Row,Name,Age
0,Nick,23
1,Bill,48
Very annoying that the Mac Excel doesn’t respect Unix line terminators.  Interestingly, I found a post that talks about ensuring that you choose a CSV file encoded for Mac, but that option seems missing from the Mac version itself.
If I’m missing something obvious, please correct me.

Divvy

June 10, 2010 1 comment

If you’re using a Mac, you owe it to yourself to try a great program called Divvy.

In a nutshell, Divvy lets you divide up your workstation as you see fit, without having to manually resize all the windows yourself.  For instance, at work I have two workspaces; one for Mail and Calendar split 50/50, and one for Terminal, NetBeans, TextMate, and FireFox, with Terminal and FireFox taking the largest space.  Manually positioning four windows without leaving gaps is nigh impossible, and time consuming to boot.  I bind Divvy to Ctrl + Shift + Spacebar, and can position all 4 windows just how I like in just seconds.

Protip: Hold down the command key while dragging to get a finer grid.

Protip #2: You can set keyboard shortcuts for different divisions of the space.  Press the little gear icon in the top right of the program and go to the Shortcuts tab.

Categories: Apple, UI Tags: , , ,

My ten essential Mac programs

March 24, 2010 3 comments
I recently had the good fortune of getting a new Macbook Pro at work and kept track of the first programs I downloaded and installed.  Here are the first ten applications I installed, as well as descriptions as to why they are so essential to my everyday work.

Firefox

Firefox is my browser of choice.  No big surprise there.  Not much to say except tabbed browsing is great.

Quicksilver

Quicksilver, if you are unfamiliar, is an application launcher for Mac OSX.  If you’re a fan of analogies:
Spotlight : Documents :: Quicksilver : Applications

That’s a bit simplistic, as Quicksilver can do more than just launch applications, but that’s 99% of what I use it for, so the analogy stands.

TinyGrab

TinyGrab is an amazingly simple screen shot app for both Windows and Mac OS X (I use it on both platforms and it works better on Mac).  After registering for an account, you keep the app running in the background.  Any time you take a screenshot via Command Shift 3 (full screen capture) or Command Shift 4 (area of screen or window capture), the picture is automatically uploaded to the service, and a small url to the picture is copied to your clipboard.  All of the icons you see here are hosted on TinyGrab’s servers and were uploaded near instantaneously.  I say it works better on Mac than Windows because the Mac one merely hooks onto the act of capturing a screenshot using the already excellent Mac tools; when you press the hotkey to take a picture on Windows, it has to use its own “clip this area of the screen” feature, and it doesn’t work quite as seamlessly as on the Mac.

R

You may have already seen my previous R posts; R is a programming language intended for statistics.  It has dozens of high-quality open source code modules from mathematicians and scientists from around the world.  It is a great tool for doing exploratory data analysis.

R can be used both interactively through the R Console program, as well as through scripts.

Omnigraffle

Omnigraffle is a great program for creating vector graphics on the Mac.  It’s intended for use as a diagramming and charting tool, but it’s very versatile and I could imagine uses far outside those domains.  The interface is extremely slick, and the quality of the output is second to none; you can instantly tell when something has been created by Omnigraffle by its extensive use of drop shadows. I used it frequently in college to create diagrams for embedding within computer science and math problem sets.  For instance, I illustrated linked lists and other data structures, saved the output as PNGs, and then included the PNGs within my documents.

Netbeans

If you’re programming in Java and you’re not using an IDE, you are wasting your time.  Netbeans and Eclipse are the two biggies in the Java world; I prefer Netbeans due to its great built-in keyboard macros.  By memorizing a few keyboard shortcuts, you can save dozens of keystrokes from commonly typed phrases.  For instance, declaring constants is usually quite verbose in Java:

public static final int BUFFER_SIZE = 1024;

With netbeans you can shorten the 24 characters before the variable name to five: Psfi -> TAB.  There are a whole raft of such shortcuts, and they are indispensable for easing the pain of Java’s verbosity.

Other great and essential features include the ability to automatically determine which modules need to be imported; this feature alone makes an IDE superior to a dumb text editor.  The other feature that immediately springs to mind is the ability to easily refactor code; you can change the name of a variable in one file and have it propagate to all files that reference it, rather than having to find and replace the string in all the files.

MacPorts

Unlike the other tools in this post, MacPorts is a command line utility.  I use it when I need to install some open source library or project and there is no installer available for my platform.  If there’s a port version of the software available, it handles all the dependency management, installs the libraries where they need to go, and updates all the necessary environment variables.

Textmate

Textmate is my text editor of choice for all things non-Java.  It makes it very easy to open a directory as a project and then jump around between files within it (with a very smart, intuitive search feature).  Just as netbeans has tab code completions, so does Textmate.  Common shortcuts (“snippets”) are bundled up and distributed with the software; it is also easy to add your own.  It seems to be the de facto standard for web development (every Ruby on Rails developer I’ve ever met uses it).

Two main complaints:

  • Some strange default behavior: If I select a bunch of text and hit tab, I would expect that to indent the text rather than delete the contents of it.  Similarly for shift tab.  Instead, you must hit option tab and option shift tab (that’s a bit of a finger stretcher)
  • You cannot split a window and look at two sections of it at the same time.

WriteRoom

WriteRoom is the antithesis of Microsoft Word, or any modern text editor.  Whereas most programs throw feature after feature at you, WriteRoom strips it down to the barest of feature sets.  The minimalist nature extends to the presentation as well; when you boot it up you begin by staring at a full screen blank picture.  Text is monochrome green by default, though both the background and foreground colors can be changed.  By stripping all user interface elements out of the view, you are free to focus on the task of writing without any distractions.

Obviously this is not well suited to all tasks; if you are doing any sort of work in which you need to simultaneously reference other materials (e.g. look at a website or excel spreadsheet at the same time), this is not for you.  But if you need to brainstorm something and get some thoughts down onto paper, this is a great choice.

There is a free Windows clone called Dark Room, and there is a similar product for the Mac in beta called Ommwriter.

MacTex LaTeX distribution

LaTeX (unfortunately named for Google searching) is a typesetting language/program.  It’s used extensively by college professors and others looking for beautifully typeset text and equations.  Unlike Microsoft Word, composing a document using LaTeX is most certainly not WYSIWYG, but its creators see that as a feature and not a bug.  They claim that people waste an inordinate time fiddling with fonts and presentation rather than content.  By formatting your work as a Latex document, you can render it in multiple different ways just by changing a template.

The MacTeX package includes LaTeXIt, TeXShop, and BibDesk, as well as a few other programs I never touch.

LaTeXiT is a small program for creating equations and other snippets to embed in other sources.

TeXShop is a full fledged editor of LaTeX documents; if you’re doing any sort of serious document creation, you’re probably going to do it in TeXShop.  There’s nothing stopping you from composing your documents in any plaintext editor, but you will have to manually run the scripts that convert your text into PDF; TeXShop automates some of that hassle.

BibDesk is a program for managing bibliographic entries.

Adium

An excellent chat/IM client for Mac that supports all the big formats.  Recognize your favorite protocol from the icons it supports?

Why install a chat program on a work computer?  IM and chat is a big part of collaborative software development.

Conclusion

Some of these programs are fairly well known (Firefox, Adium, Netbeans), but I hope I have exposed you to some new programs.

Categories: Apple, Uncategorized Tags: , , , ,