All posts by Everett - TipsFor.us

A Reference for the VI Text Editor (aka VIM)

If you’ve done any programming at all on the command line (in Linux or OS X, or using Cygwin on Windows), you have probably heard of VI and the other powerhouse command-line editor, eMacs, and the epic battle between them long, long ago in a galaxy far, far away… The goal of this article is to give you a functional overview of the VI text editor and give you a useful reference of its commands. I spent a lot of time putting these notes together, so I hope they’re helpful.

Right off the bat, some purists will snipe me for saying “vi” when I really mean “vim” — the latter being the IMproved version. But pretty much everyone uses vim and they call it vi… most of the time when you type “vi” on the command line, it opens up vim anyway.

Open a file with vi just like with other editors: vi [filename] . If the file doesn’t exist, it will be created. And then you will have entered the realm…

There are 2 Modes: Insert and Command

The insert mode is the “normal” typing mode that you would normally think of when using a word processor. The command mode is when you are typing in commands to operate on the text (in lieu of menus, you’ve got to type in all commands). vi starts in command mode, but if you’ve gone to the edit mode, pressing Esc gets you back into command mode. Entering Insert mode is actually a command. Enter insert mode by pressing i (preceded by the Esc key if necessary): Esc to enter command mode. i to enter Insert mode.

How to Type Commands in Command Mode

The command mode commands are normally in this format: (Optional arguments are given in the brackets)

[count] command [where]

Count is the number of times to run the command (e.g. delete 7 lines), and where is the destination of the action, e.g. save this file as xxx.txt.

I’ve grouped the commands here loosely into groups, some of them corresponding to traditional menu names.

Modes

i – enter insert mode (you can also type ‘a’)

Esc – enter command mode

File (the colon commands, mostly)

:n create a new file (not common).

:e [filename] – Edit (open) a file.

:w – save. :w [filename] acts as “Save As”.

:wq – save and quit. Also ZZ (in caps).

:w [filename] – save as filename.

:set xxx – sets option xxx. See Preferences section below.

:q – quit.

:q! – quit without any prompts (i.e. quit without saving).

Edit

u – undo the last change (or redo it).

U – undo the changes to the current line.

ctrl r – Redo. This redoes whatever you undid.

. – Repeat last command.

x – deletes the character under the cursor (Del).

X – deletes the character before the cursor (Backspace).

d – delete (i.e. cut). Usage is dw, d$, d^, dd. to delete a word, delete till the end of the line delete to the beg. of the line, repeat delete, respectively.

y – yank (i.e. copy).

– clipboard. See “Multiple Buffers” below.

p – paste.

r – replace the character under the cursor (specify count).

/ – Find (searches from the current position towards the end)

? – Find (searches from the current position towards the beginning).

:s[regular expression] – Substitute (find and replace). See below.

View

:set nu – show line numbers (:set nu! to remove)

zc – folds Closed a section of code, delineated by {{{ # code here }}} #

zo – folds Open a section of code, delineated by {{{ # code here }}} #

Format

> – indent highlighted text (like tab)

< – shift tab.

Insert

O – open the line above the line the cursor is on.

o – open the line below the line the cursor is on.

R – enters Replace (overwrite) mode until Esc is pressed to exit.

Navigation

h – move the cursor left

j – move cursor down

k – move the cursor up.

l – move the cursor right.

control F – move forward one screen (i.e. page down)

control B – move back one screen.

H – home window line (top of visible)

L – last window line.

]] – next section/function

[[ – previous section/function

0 – Move to start of line (zero)

$ – move to end of line.

shift g – move to end of document.

gg – move to start of document

ctrl g – returns the current line number.

123 shift g – go to line 123.

Tools

% – when the cursor is on a (,),[,],{, or } this will locate its matching pair.

Window

:split – split screen horizontally

:vsplit – split screen vertically.

ctrl w [up/down/left/right] – jump to new portion of split screen.

ctrl z – move vi to background (recess to the Terminal)

fg – brings the process back to the ForeGround (type this in the shell after you’ve done a “ctrl z”).

Help

:h – help

crtl ] – follow a link in the help file.

:q – closes the help file (it’s actually a separate text file), so you quit it.

Search Commands (Find)

These commands let you search the current file looking for a given string. When you press the ‘/’ or ‘?’ key, the cursor will move to the bottom of the screen, where you will enter the string you wish to search for. Pressing the [RETURN] key will signal the end of the string, and cause the search to take place.

To include a ‘/’ or ‘?’ as part of the search string, you must “escape” any of these characters with the backslash character (\).

==> /search string[RETURN]

This command will let you search forward through the file looking for the string. The search will wrap around to the start of the file.

==> ?search string[RETURN]

This command will let you search backward through the file looking for the string. The search will wrap around to the end of the file.

Press n (n) to move to the next result. Press shift n (N) to move back to the previous.

Mnemonics:

The ‘/’ is a forward slash, and is used to search forward. The ‘?’ is the shifted ‘/’ key, and you can think of the act of shifting as reversing the command direction.

To repeat the search, press ‘/’ or ‘?’ depending on whether you want to search forward or backward for the next occurrence. When the cursor moves to the bottom of the screen, press [RETURN] without entering anything. Vi will use the last search string entered as its target.

Substitute (Find and Replace)

To substitute new for the first old on a line type :s/old/new

To substitute new for all ‘old’s on a line type :s/old/new/g

To substitute phrases between two line #’s type :#,#s/old/new/g

To substitute all occurrences in the file type :%s/old/new/g

To ask for confirmation each time add ‘c’ :%s/old/new/gc

Multiple Buffers ” : Frequently Used Text

Most users just use the general buffer, but you can cut and paste text from/to multiple buffers. There are 36, specified by all letters (a-z) and all digits (0-9). The buffer is specified using the command (the mnemonic here might be to QUOTE something). For example, the command: “mdd uses the buffer m, and the last two characters stand for delete current line. Similarly, text can be pasted in with the p or P command. “mp pastes the contents of buffer m after the current cursor position. For any of the commands used in the next two sections, these buffers can be specified for temporary storage of words or paragraphs.

These buffers remain in memory after vi has closed (for a while, at least… I’m not banking on these buffers being 100% persistent). So you can use them to store frequently used bits of text. For example, you may want to use:

“i to contain the block code for an if statement.

“h to contain basic html tags.

Copy, Cut, and Pasting

(i.e. Yanking, Deleting, and Pasting)

The command commonly used command for cutting is d. This command deletes text from the file. The command is preceded by an optional count and followed by a movement specification. If you double the command by typing dd, it deletes the current line. Here are some combinations of these:

d^ cuts (deletes) from current cursor position to the beginning of the line.

d$ cuts (deletes) from current cursor position to the end of the line.

dw deletes from current cursor position to the end of the word.

3dd deletes three lines from current cursor position downwards.

There is also the y command which operates similarly to the d command which take text from the file without deleting the text.

The commands to paste are p and P. They only differ in the position relative to the cursor where they paste. p pastes the specified or general buffer after the cursor position, while P pastes before the cursor position. Specifying count before the paste command pastes text the specified number of times.

Keep in mind that the targeting of the pasting actions isn’t where you’d expect from working with traditional word processors.

Execute External Commands

Type :! followed by an external command.

:! perl -d % launches the current (perl) script in debugging mode (very useful!).
:! php -l % if you’re editing a php file, this checks syntax.

Highlighting Text

v – enters visual mode so you can highlight a visual block. You can highlight entire lines AND columns. Very cool.

To highlight several lines: ctrl v, then hold shift and use the arrow keys and the Home and End keys as you would do normally in commercial word processor (or the j,k,l… equivalents). E.g., pressing d after highlighting a block would delete it (cut it).

Shift g moves to the end of the document.

Alternatively, with most terminals you can use the mouse to highlight a block of text, then move the cursor to where you would like to paste it. A right-click will paste the text. However, this method is a bit awkward because of the keyboard/mouse/keyboard interaction.

Setting Preferences using :set (Pimping Your Ride)

You can set a number of preferences in vi including text and highlight color. Many of these options can be set using :set. Notice than anything you can set, you can unset by using the same command followed by ! – the exclamation point is the universal program code for NOT.

:set ic – ignore case (for searches)

:set hls– sets highlighting for a search

:set is – include search

:set nohlsearch – remove highlighting (or use :set hls!)

:set ai – sets autoindent

:set nu – adds line numbers. (:set nu! to remove)

Edit your ~/.vimrc file to add preferences to this file to make them permanent. E.g. I have the following in my ~/.vimrc file:

highlight Comment ctermfg=lightblue
highlight Search ctermfg=0 ctermbg=3*
set tabstop=4

Other Useful Functions

To push a vi window (or any window, really, to the background) press ctrl z. To bring it back, press fg (for ForeGround). There is fg1, fg2, fg3, etc.

Conclusion

Well, there’s my reference for you fine folks. I may grow some more hair on my chest if I ever do the counterpart for eMacs… but I’m not holding my breath. As of Sunday, this article represents the knowledge gleaned from 2 years spent editing scripts on the command-line. In parting, I’ll share one little tidbit of wisdom: don’t worry too much about the navigation shortcuts: although some shells don’t support the standard arrow keys and Page-Up/Page-Down key bindings, most of them do. Whew!

Please feel free to add corrections or additions to the comments!

Content Management Systems (Prelude to MODx): Part I

Introduction to Web Sites, CMS’s, and MODx

MODx lets you take control...
MODx lets you take control...

Some of you may remember the little article I wrote a while ago about content management systems where I shared a bit about MODx. What is MODx? (pronounced like “modular”… and it’s eXtendable… get it?) It’s a content management system (CMS), and it’s used to help you manage and publish web sites easily. It’s very cool, and it is very flexible… but I’m getting ahead of myself. I want to spend some time with our readers and talk a bit about web sites and CMS’s and use that discussion to segue into an upcoming video series about MODx. If you already know what MODx is and you want to learn about it, stay tuned for the upcoming videos… if you want to read a nice walk-through, check out NetTuts recent article.

Web Sites 101

If you’re reading this, you should have some idea of how this is happening… in the interest of the stringent word count limitations imposed by… uh… Brian (?)… I’m going to assume that you understand the concepts of a domain name, a web server, and how a traditional request such as “http://www.tipsfor.us/some_page.html” is handled and a page is read and returned to your browser. You with me? Great.

Higher Education: Dynamic Web Sites

A static site grabs a file from a folder and displays it to the browser, whereas a dynamic site operates a bit more like the “printing on demand” technology. Many sites (including this one) rely on dynamic technology to serve up a page… the page that you are requesting may not even exist until you request it. The “page” that you end up reading is often assembled on the fly from a series of scripts and bits of text from the file system and/or from a database.

Making Web Sites: The Perils of Static Sites

Coding Sites by Hand is Perilous
Coding Sites by Hand is Perilous

We all start out bald and naked, filling diapers and making static web sites. As you get older, you learn a little more HTML, and your “<h1>Hello World</h1>” progresses to animated GIFs and maybe some CSS and Javascript, but some people take a long time to mature out of static web development. And not unlike growing up and leaving home, there’s a profound turning point in your web education that propels you out of static land. Let’s say you want to change the name of one of your pages from “articles/cool-stuff.html” to “articles/archive/cool-stuph.html”. You have to move the document and change its file name, then you have to wade through all the pages on your site and update any links or menus. It’s only palatable if you have a few pages. If you have more than 10 or so, this scenario quickly becomes cumbersome and prone to error… you’ll be wanting to ask mom to do your laundry.

Another not-so-hypothetical situation arises when you want to change the look and feel of your static site. If you’ve followed the rules of semantic web development, you’ve separated your content from its formatting using CSS files and well formed HTML (check out CSS Zen Garden), but it can still be tricky if you’ve got to change Javascript files to make menus work. And you still have to know a lot about HTML and FTP logins to make these changes.

Enter Content Management Systems

If your own learning curve of web site development has roughly followed the previous descriptions, then you can appreciate that someone found a better way to do things. You can have your cake and eat it too.

Benefits to using a CMS

  • — Isolates content from formatting (it’s much easier to search content and update templates)
  • — Editing content is easily done via a GUI
  • — Roles and permissions can be established: e.g. an editor, an admin, a blogger all can be allowed to do certain things to a site.
  • — Links between documents can update automatically (with most CMS’s)

A CMS allows you to forgo the FTP client and use a front-end interface so that users can edit documents and templates. A CMS usually has editing tools built right in, so you don’t even need to know HTML to edit the content of a page — this is great if you’ve built a site for someone else. You can be the HTML genius, but you can give them the key to the CMS and they can edit and add content all day long. Finally, a CMS provides the ultimate separation between content and its formatting. This means that the text of an article can be fully isolated from the template used to display that article, and then the task of switching layouts for an entire site of thousands of pages becomes a trivial affair. Changing the “location” of a file or its name is also dynamically rendered so it can be done in an instant. These are the benefits to running a site using a CMS.

Down Sides to CMS

  • — Complicated to set up. Math is hard! Let’s go to the mall!
  • — It’s more resource intensive. Serving up flat files is much easier for the web server.
  • — More complicated server requirements: not all hosts will have a scripting language and database available to you.
  • — More bandwidth is required.

A site running a CMS is almost never as responsive as a site simply serving up static files. A CMS has many more moving parts, so it’s more likely to break or be attacked. You can’t do much to thwart the display of a simple HTML file, but you can experience all kinds of malicious attacks on a database an your scripting language of choice.

In my opinion, in most circumstances, the benefits often far outweigh the drawbacks. You make some extra backups, you take a few extra precautions, and bamm… you can be pimping out your web site in CMS style, and once you’ve done it that way, you’ll never go back.

So now you know why you might want to use a CMS for web site development. In the next article, I’ll discuss why you might want to choose MODx over some of many other systems available. Lots of systems will alleviate some of the pain and stress of static development, but not all Content Management Systems are created equally. The dudes working hard on MODx have made a really cool application that makes life so much easier for developers and content editors, and one of the founders asked me to upload some high resolution videos about it. Thanks guys. Stay tuned…

Printing in OS X: Parallel Ports, Drivers, and Mayem

Don't Buy One of These! They Don't Work!
Don

This is a quick tip. In a word, do not buy the USB to Parallel conversion cables. They SOMETIMES work, which is worse than not working, because then you start believing that they might work, but when it comes time to print something serious (like a 100 page document), you will go insane… you’ll print 3 pages, then the print queue will jam, you’ll have to reset it, and it will take 4 or 5 minutes to get the next 3 pages into the queue, then it will jam again, and again and again. It’s nuts. You will have wasted $10 or $20 bucks and you won’t be able to print anything reliably.

Using Parallel Printers with OS X

So how do you use a parallel printer with an OS X computer? Macs haven’t had parallel ports on them for years, but there are still plenty of printers out there that do. Here’s my hot tip: get a dedicated print server and hook this into your network. This works, it works well, AND it’s scalable. If you get another USB printer, this option will cover you. If you have multiple computers in your house that need to share a printer, boom, you’re in luck.

This guy is a good friend to OS X
This little guy is a good friend to OS X

I recommend the
TRENDnet TEW-P21G
($110) because I’ve been using it for about 2 years and I haven’t had any problems with it. I simply plugged it into my router, plugged in the printer, and poof… OS X was able to find it. I’m not using the wireless option on this device, but it is there if I ever need it — if you don’t need the wireless option, TRENDnet has cheaper models. It has two USB 2.0 and one Parallel printer port. I’m sure there are other similar products out there, but the point is to let this little “computer” handle the printing instead of trying to make OS X do the difficult (?) job of translating printing to a parallel port. Check out a print server like this if you need to interface with a parallel port printer on OS X. It’s well worth the money.

Changing your iPhone’s Battery and 10 tips for Longer Battery Life

iPhone
iPhone

I mentioned in a previous post that the iPhone’s battery needs more attention than simpler phones. And you can’t change the battery yourself! That thing is soldered into place… so unless you are REALLY good with a soldering iron or if you don’t care much about the very real possibility of frying your phone, then changing the batter requires a trip to the Apple store.

Changing your iPhone Battery

Take the phone to an Apple store. The charge for replacing the battery is $79 plus shipping and handling, and just like a laptop repair, it usually takes 3 days. The store can loan you a phone for a fee.

I DO NOT RECOMMEND TRYING TO REPLACE THE BATTERY YOURSELF. If you were looking for a DIY article, then let me try to talk some sense into you. This is a DELICATE device. It was not soldered by a human… it was soldered together with very precise robotic machinery. Don’t kid yourself… you are much more likely to kill your phone than you are to successfully replace the battery.

If you are concerned about battery life, there are a couple products available that can extend or augment battery life, e.g. Backup iPhone Battery, Juice Pack, or check out the recommendations below.

10 Tips for Extending your iPhone’s Battery Life

  1. Lock It — Just turn off the display.
  2. Turn Off Bluetooth — If you don’t have any Bluetooth devices (or if you aren’t using any), disable this in the Settings.
  3. Disable Wi-Fi — This isn’t as much of an energy saver as Airplane Mode, but if you don’t need to join any networks (e.g. if there aren’t any or if you’re happy using the 3G network), then just turn off the Wi-Fi searching under Settings –> Wi-Fi
  4. Turn on Airplane Mode — yes, you can do this on the ground, and it basically makes your iPhone into an iPod… you can’t use the internet or BlueTooth and you can’t make or receive calls. But it really extends the battery life.
  5. Turn off Location Services — Settings –> General. Some applications (like Locly) use your phone’s current location to do stuff, but your battery pays the price when you’re phone is repeatedly asking the world “Where am I?”
  6. Turn Off 3G — If you’re traveling where you’re only ever seeing the Edge network (the tiny E in your status bar), then you can probably loose the 3G functionality. Go to Settings –> General –> Network
  7. Turn off Sound Check and EQ— sound enhancement requires more processing and often more amplification. I also recommend using small earphones (e.g. the white earbuds) because they require less power than a big set of headphones. Yes, louder volume drains the batter faster, so keep the volume down. Settings –> iPod
  8. Fetch Mail Less Often — Settings –> Fetch New Data. Try checking email manually (i.e. when you launch the application).
  9. Store it at Room Temperature — don’t subject your phone (and its battery) to extreme temperatures. The basic rule of thumb is that it’ll be comfortable where you are comfortable, so don’t leave it in a hot car or in a freezer. Extremes will shorten the battery life.
  10. Plug it In — Yes, the iPhone works perfectly when it’s plugged in. It’s good to take it out and use it now and then to make sure the battery gets its exercise, though.

10 Great OS X Applications for the Web Developer

One of the things I think of every single working day is how great a platform OS X is for software development. Now, take that with a grain of salt… I do development in a LAMP dev shop running Linux, Apache, MySQL and Perl/PHP, but we’re running some enormous sites (LowFares.com, IdentityTheft.com, and Low.com). All of those technologies are open-source, and (in my opinion) very well suited for serious commercial sites. Java is fine if you need to send a man to the moon, but it you just need to say “Hello World!”, you’re still might be dealing with a rocket launch…

Peanut Gallery Java Pot-Shots

.NET isn’t any better… every .NET shop I’ve dealt with has had horrible down-times and massive release delays… but I digress…

Why is OS X Awesome for Software Development?

  1. Exposé — this feature saves me 30 to 45 minutes per day (yes, I’ve timed it). It’s unbelievable how much time you can save if you can quickly get between documents and apps.
  2. The BSD Subsystem — if you’re working with Linux/PHP/Perl/MySQL, it saves so much time to have OS X’s Terminal right there with a Unix variant under its hood. No need to emulate with Cygwin or go remote with Putty. You can test your Apache config or database queries without ever having to connect to the network.
  3. My Mac Runs Windows! — I can test my web pages in all major browsers by flipping between OS X and Parallels Desktop running Windows, or by using VirtualBox.
  4. It’s Not Windows — ha ha… I had to slip that one in. Sorry if you’re suffering through XP. I mean Vista. I mean the NT kernel.

Top 10 Applications for Software Developers on OS X

Ok, on to the main event. Here are ten great applications for a software developer working in OS X. These are the applications that have found an integral place in my workflow. Not all of them are free, but I have tried to list a free alternative when appropriate. I’m not recommending you get ALL of these, but depending on what exactly you’re doing, you might want to try out a handful of them.

iTerm: A Better Terminal

1. iTerm (Free)

Link – iTerm

This is to the command line what Firefox is to browsers: if the Terminal is IE, iTerm is like Firefox. It is simply a better Terminal. It allows tabs and bookmarks for those of you who log into multiple servers.

TextMate: a powerful interface and editor2. TextMate ($57)

Link –TextMate

I do like Smultron a lot (it’s free), but TextMate’s interface is preferable to me. It’s similar to a full-featured IDE such as Eclipse (which is also free) because it gives you a full folder-structure view in its document drawer (something that Smultron or TextWranger do not).

One thing – unlike Eclipse, TextMate is lightweight and fast without ump-teen Preference pages. If you need an IDE, give NetBeans (free) a try.

Transmit: a Powerful FTP/SFTP client with a great interface3. Transmit ($30)

Link –Transmit

Although there are free FTP clients out there, Transmit has one of the best interfaces because it incorporates Mac OS X’s column view. To be fair, I have had some problems connecting to certain servers when using Transmit, but I don’t know enough of the firewall internals to know why one client performed better than another.

If you prefer a free alternative, my recommendation is Cyberduck (free).

Sequel Pro is the sequel to CocoaMySQL4. Sequel Pro (Free)

Link –Sequel Pro (Free)

There are only a couple of choices when it comes to GUI MySQL interfaces for OS X, the other big one being Navicat (they have a lite version that’s free). The other popular choice for a long time was CocoaMySQL, which is still available for 10.4 users, but development on it has been abandoned and the project has moved over to Sequel Pro (the sequel… get it?) Sequel Pro offers an improved interface for 10.5 users (I prefer it to Navicat).

OmniGraffle: graphing, flowcharts, and designs5. Omnigraffle (Bundled with OS X, or $100, or $200 – Pro)

Link – OmniGraffle

Imagine Microsoft Visio, but clean and not bloated and well… not Microsoft. If you have to diagram databases or put together product requirements for documentation, this is a beautiful little product that may have come bundled with your Mac. The Standard version can almost get you through the medium and large projects. I haven’t seen anything on the Mac that comes close to what this application offers, and even though I get the feeling that the high price tag is getting validated by riding Visio’s bandwagon, I still think this is a good bit of software.

6. PhotoDrop (Free)

Link – PhotoDrop

This is a very simple app that lets you create droplets for bulk image processing. Each droplet can do things like convert images between formats, perform scaling and cropping, even watermarking. If you are doing web development, this is just a simple (and much cheaper) alternative to running Photoshop’s Save for Web feature over and over and over again. Very, very handy.

unArchiver: never type a weird command-line un-tar statement again.7. The Unarchiver (Free)

Link – The Unarchiver

This is handy if you’re frequently dealing with Zip, Tar, GZip, BZip2, Rar, 7-zip, LhA, and StuffIt files. Yes, you can handle many of these on the command line, but if you’d rather deal with a GUI, this tool is handy.

8. Nvu (Free)

Link – Nvu

This is a complete Web Authoring System for Linux, Windows and OS X. It’s like a free version of Dreamweaver (which maybe you’ve already outgrown?).

It has good support for style sheets and a Javascript console, but one irk is that the tabs that show multiple open documents seem to disappear if you are viewing the HTML source for the document (instead of the “Normal” WYSIWYG view). If you’re beyond the integrated WYSIWYG type of thing, have a good look at Eclipse (Free)… it’s a big framework that does a lot of things, but a number of web developers I know use it for its convenient browsing and previewing capabilities. Eclipse also integrates with versioning software (like SVN), but because it’s heavy-hitting, I only recommend it for more mature users. NetBeans looks to be a lighter alternative to Eclipse, but I haven’t tried it myself.

9. Seashore (Free)

Link – Seashore

This is a lightweight photo-editing application. It’s got all the things in Photoshop that I use frequently (layers, brushes, and exporting for web). It’s got some handy keyboard short-cuts, but it’s missing others.

SuperDuper: Elegant and Powerful Backups10. SuperDuper! (Shareware, $28)

Link – SuperDuper!

This is a popular backup utility. If you’re serious about doing development work, you know there is a lot of effort put into maintaining your valuable code and prior versions of it. You can use SuperDuper to create bootable clones of a drive, too. Hot stuff.

You can use SuperDuper! for free (forever), but the advanced features are available for a $28 fee.


Honorable Mention: Fluid (Free)

I mention this little app because I’ve found it extremely handy over the past couple days. If you compile a site into its own app, you can take advantage of the built-in Apple-tab shortcut to get to it. Another really helpful thing about working within the application-switching workflow is that you can assign the application(s) its own icon. That’s REALLY helpful when you’re working with a dev and a production version of a site… honestly, those simple little things can prevent disaster.

But the real reason I was compelled to mention Fluid is its inspector. It breaks a page down into the html tags, images, and style sheets ridiculously well. In my opinion, the layout of this program is sickly good… IMHO it’s better than the revered debugging plugin Firebug for Firefox. Wow. Yes, really. I’ve never had an easier time tracking down problematic HTML or a goofed up CSS declaration. However, the Fluid-compiled web site seems to have some weird behavior with its caching… you know the drill: make your edits, clear the cache, refresh the page. But sometimes the Fluid version doesn’t refresh correctly. I don’t know if this is something I can configure or if its an artifact of compilation, but I really hope it’s the former. The DOM inspector is just too slick to overlook. For more information, check out Brian’s post about Fluid.

Summary

I hope you’ve benefited from my sharing of this short list. I don’t recommend that you rush out to get all of these programs: some of them may be more relevant than others. If you think one looks interesting or practical, give it a try and see if you like it. Feel free to post your own suggestions about helpful OS X applications for software and web development.

Feature image credit: Guillermo Esteves

An Overview of Free Online Invoice Software

I got tired of tracking invoices for clients using an Excel spreadsheet. I knew there must be some good solutions for on-line invoices, so here’s what I found. All of these had a paid counterpart, and some of the free versions were too limited for all but experimental use. E.g. when they say there’s a limit of managing only 2 clients, that means you have to delete one and create a new client (entering name and address) each time you have to send an invoice to someone new.

Billing Manager lets you easily create invoices
Billing Manager lets you easily create invoices

Billing Manager

Link – https://billingmanager.intuit.com

This is the only service I found that offered unlimited invoices and unlimited clients for free. They are iPhone compatible, which means their site is iPhone friendly (it’s relatively fast), but they don’t have a standalone app yet. I had some serious problems importing my OS X Address Book contacts (see below), and their documentation didn’t help, but they responded promptly to my emails. In order to use Credit Cards and Electronic Checks, you have to set up an account with QuickBooks merchant service, which will run $15/month. One other irk with this software is that it requires you to disable your pop-up blocker for the preview functions to work.

Freshbooks

Link – http://www.freshbooks.com

The free version gives you one login and lets you manage only 3 clients. They have auto-bill gateways so you can charge credit cards using Paypal (yes, even using a basic Paypal account). This looks to be a nice and professional service… they even sent me a nice snail-mail sample invoice welcoming me to my trial account.

Lite Accounting

Link – http://liteaccounting.com

With the free account, you cannot use a custom logo on invoices, and you are limited to 5 invoices per month. They boast the “most affordable” solution, and yes, their full membership is almost as cheap as some of the others’ entry level membership.

Invotrak

Link – http://invotrak.com

They actually have an iPhone app and an OS X Dashboard widget. The free service limits you to 2 invoices per month and 2 clients per month.

Greener Billing

Link – http://www.greenerbilling.com

Their free (dirt cheap) plan offers you 3 invoices per month. Unlimited clients and unlimited staff access is nice… but you can’t send unbranded emails to clients (in other words, when you send an email invoice, it’ll somehow reference Greener Billing… which isn’t necessarily a bad thing).

In summary, I thought that Billing Manager was the best deal out there for those users who need a basic service (and who aren’t simply evaluating). Billing Manager was the only one that offered unlimited invoices and unlimited clients.

Outlook Address Book CSV Fields

As I mentioned, I had trouble working with Billing Manager’s address book importer. It worked fine for my Outlook address book, but it did not work well with with my OS X Address Book. This is probably because I’ve got it synced with my 10 year old Yahoo! address book (yikes!), and there are some real messy fields in there. So here are the steps you can use to get your address book into Billing Manager’s format:

  1. 1. Unfortunately, OS X’s Address Book Application does not allow for you to export your addresses into a CSV format. There is an Address Book to CSV Exporter linked on the Apple web site, but it won’t work for this task. You need a program that enables you to export a header row. Download the Address Book Exporter by David Martin & Gwenhiver.net. It allows for far greater flexibility. Download it.
  2. Once inside the Address Book Exporter, click on the “Configure Settings”. Check the “Write column titles as first line” — this is your header row.
  3. Check most of the fields (see image). Outlook doesn’t seem to have columns for any Instant Message addresses, so I left those out of my export.
  4. Open the resulting file in Excel (I know I know… groan… I don’t know another way to do this). Open another blank workbook and paste Outlook’s Header Row values (below) into the first row. Two tips here: first remove the commas. Also have a look at Excel’s “Paste Special…” feature. There’s a checkbox in there to “transpose” the paste. This will paste rows into columns or columns into rows.
  5. Copy the columns from your OS X Address Book Export into the matching columns in the Outlook-friendly workbook.
  6. Save the workbook as a CSV file.
OS X Address Book Exporter
OS X Address Book Exporter

Outlook’s Header Row

For the record, when you export your Outlook contacts, these are the fields that show up in your header row:

Title, First Name,Middle Name, Last Name,Suffix,
Company,Department, Job Title,Business Street,Business Street 2,
Business Street 3, Business City, Business State, Business Postal Code,
Business Country, Home Street, Home Street 2, Home Street 3,
Home City, Home State, Home Postal Code, Home Country,
Other Street, Other Street 2, Other Street 3, Other City,
Other State, Other Postal Code, Other Country, Assistant's Phone,
Business Fax, Business Phone, Business Phone 2, Callback,
Car Phone, Company Main Phone, Home Fax, Home Phone,
Home Phone 2, ISDN, Mobile Phone, Other Fax, Other Phone,
Pager, Primary Phone, Radio Phone, TTY/TDD Phone,
Telex, Account, Anniversary, Assistant's Name,
Billing Information, Birthday, Business Address PO Box, Categories,
Children, Directory Server, E-mail Address, E-mail Type,
E-mail Display Name, E-mail 2 Address, E-mail 2 Type, E-mail 2 Display Name,
E-mail 3 Address, E-mail 3 Type, E-mail 3 Display Name, Gender,
Government ID Number, Hobby, Home Address PO Box, Initials,
Internet Free Busy, Keywords, Language, Location,
Manager's Name, Mileage, Notes, Office Location, Organizational ID Number,
Other Address PO Box, Priority, Private, Profession,
Referred By, Sensitivity, Spouse, User 1,
User 2, User 3, User 4, Web Page

Did I miss any free invoicing products? Let me know in the comments.

Introduction to Bash Scripting

Here’s a great tutorial for bash scripting: http://www.linuxconfig.org/Bash_scripting_Tutorial

Linux and OS X: Harness the Power of Bash
Linux and OS X: Harness the Power of Bash

If you’re doing any work with Linux or OS X computers, knowing even a little bit of bash can save you a whole lot of work. You can write automated backup scripts, you can scan for faulty permissions… the list is endless. You’ll end up building a toolbox of common scripts that you will use in multiple places.

Only one thing wasn’t given much attention on that page, so I thought I’d point it out:

for next Loop

Usually, your programming syntax is cleaner if you avoid the for next construct and stick to the for each construct instead, however, with bash scripting you often need to work with that crazy little numerical iterator for changing things like file names (e.g. backup1, backup2, …). So you should get familiar with the seq command. It creates an array, going either forwards or backwards, and then bash’s for next loop iterates over that array.

Here’s the seq syntax:

seq [OPTION]... FIRST LAST
seq [OPTION]... FIRST INCREMENT LAST

And here’s how you might iterate backwards over an array:

LIST=`seq $NUMBER_OF_ROLLBACK_FILES_TO_PRESERVE -1 1`;
for I in $LIST; do
echo "I is $I";
done

Now get over to http://www.linuxconfig.org/Bash_scripting_Tutorial and start learning.