Plus One for Red Laser

I found myself at a Best Buy about three weeks ago, looking around for things to go back home and buy over the internet.  What I was doing was my annual adventure into real world Christmas shopping.  I hate the real world honestly, mostly because of shopping…at a mall.  Anyway, I found this hard drive I’d never seen before, so I pull out my iPhone, and start searching the intrawebz for some reviews.  I don’t see anything favorable, so I move on.

Next item, a flat panel TV.  Samsung.  Nice, so again I go about trying to find the model number and such, type it into Google, find some reviews.  Onto another site to check for prices. Rinse, repeat.  Boring, really, and somewhat embarrassing.  You look like a toolbag standing there hunting items on your iPhone only to walk out of the store an hour later with nothing in hand.  How is Best Buy supposed to keep their brick and mortar operation going?

I’ll tell you how, and they need to thank the folks at Occipital Inc for writing the application Red Laser. This handy application costs at present $1.99, and is worth ten times as much in my opinion. It scans UPC’s of products using your iPhone’s camera.  Then it searches the web for the item, returning web prices, local prices (by GPS if you choose to turn it on), nutritional info, and more.

So if you’re in Best Buy, you can show them that Wal-Mart has the same TV for less, price match it right there and buy it hassle free for the best price. Sweet. I have been using this at places like Borders and Barnes and Noble, where it is tremendously helpful with books and pricing. Try it out, trust me you’ll use it!

Occipital also makes some other apps, which I’m probably going to check out since Red Laser rocks so hard. Keep up the good work guys, truly genius.

Clearing Safari on iPhone

Safari on the iPhone is pretty straightforward.  Open it, and you can search Google.  You can open a new page while keeping your current page, or clear out the url and open another page right in the one you are viewing.  Sometimes, though, that nagging buddy or family member wants to jump on your iPhone because they are stuck with a dumbphone, or worse–they are on Verizon.

You want to show off your technology, so of course you oblige.  However, reliquishing your phone will let them see your browsing history and the last page you had open.  Maybe the last page you had open was the site you ordered their holiday gifts from.  Maybe it was worse, perhaps the site you thought about ordering them something from but then didn’t–you stingy son of a…

Well, fear not, clearing the history is simple enough.  Click the little book icon on the lower toolbar, and it brings up the Bookmarks page.  There you’ll see a link for your History.  Click on that, and your History page opens.  On the lower toolbar, on the left, is the Clear button.  Click that, click confirm, and done.  Simple enough.

If you don’t want them to see the last page you opened, that’s easy enough as well.  Just open Safari, click the new page icon on the lower right, but don’t type in an address or a search.  Click the new page button again, and close the page you don’t want them to see.  This way, when they open Safari, it simply opens a blank page.  This should be done regardless if you expect someone to use your phone or not.  When I am finished browsing the web on my iPhone, I make it a habit to clear my recent pages.  If they would only add this as an option to open blank windows by default, I’d be much happier.

You can also do the following from the Settings application on your home screen:

  • Purge Cookies
  • Choose How to Handle Cookies (Always accept, Accept from Visited, or Never Accept)
  • Turn JavaScript on/off
  • Enable/Disable Pop Up Blocking
  • Clear Your Cache
  • Clear Your History
  • Turn on Autofill

Unfortunately, I haven’t found a way to clear single items from your history like you can do in big boy Safari.  Hopefully that feature is coming down the line!  The cache is something you may want to clear out once in a while, although there is no definitive way to find out its size on a stock iPhone.  Or, at least they don’t make it obvious.

Moving Around in Vim

I’ve written a couple of beginning UNIX for OS X entries, such as creating a .bash_profile and .bashrc file using vim.  Here is another vim tutorial for moving around in the screen editor, so you can see just how powerful it’s commands can be.

This post will deal with mostly command mode, the default mode when you open vim (or an existing file with it.)  To move the command marker around the file without entering INSERT mode consists of four basic keys.  Moving to the next/previous word, to the beginning of a paragraph, etc. will require a bit more memorization.

You want to first familiarize yourself with the h, j, k, and l keys.  The outer two (on a standard keyboard) move your cursor left or right one-character;  h, to the left, and l to the right.  j will move your cursor up to the next line, while k moves it down one line.  The fact that you are in command mode means no changes are made to your text at this point.  You can use the arrow keys for the same functionality, but getting used to the keys will help you keep your hands where they belong–typing and editing text.

Moving to the beginning of the current line is done by pressing O (zero).  To move to the end of the current line press $+ moves your cursor to the beginning of the next line, and – moves you to the beginning of the previous line.

Next are some basic ideas for commands.  Some will take a number argument, followed by a command.  Some can be written with a number argument followed by another command.  For example, x in command mode means delete a character.  To delete a word, or the rest of a word if you are in the middle of one, you type dw.  If you precede x with a number, n, vim will delete the following n characters from the line.  The command to delete the next four characters would be written, simply, as 4x. To delete the next four words, you would type 4dw.

Vim is a very capable text editor once you learn more about its commands, and get used to bouncing between INSERT and command modes.  Below you can find a table of common commands and their function, at least enough to get you on your way as a skilled vim user.

Movement Command

Function

h

Move Left One Character

j

Move Down One Line

k

Move Up One Line

l

Move Right One Character

0

Move to First Character Of Current Line

$

Move to Last Character Of Current Line

+

Move to First Character Of Next Line

w

Move to Next Word or Punctuation Mark

W

Move to Next Word

e

Move to End of Current Word

E

Move to End of Next Word

b

Move Back to Beginning of Word or Closest Punctuation

B

Move Back to Beginning of Word

)

Move to End of Current Sentence

(

Move to Beginning of Current Sentence

}

Move to Start if Next Paragraph

{

Move to Start of Previous Paragraph

Delete Command

Function

x

Delete Current Character

X

Delete Character Immediately Left Of Cursor

dw

Delete Current Word

10dw

Delete Ten Words

D

Delete To End of Current Line (also d$)

dd

Deletes Current Line

20dd

Deletes Twenty Lines

dG

Deletes From Cursor to End

u

Undo (doesn’t work for single character deletion)

Cron Jobs on OS X

Since OS X Tiger, cron has been replaced by a utility called launchd, and three separate launch daemons. Rather than having to run crontab  to manipulate scripts, they are run by launchd according to three separate directories inside of /etc/periodic.
The scripts contained in these folders are run at specified intervals by three preference files, in XML format, found in the /System/Library/LaunchDaemons folder. You can manipulate the .plist files with a text editor or Apple’s Property List Editor (if you’ve installed Developer Tools.) They are named, simply enough, com.apple.periodic-daily.plist, com.apple.periodic-weekly.plist, andcom.apple.periodic-monthly.plist. They are, by default, set to run at the same time as the old cron jobs, in the middle of the night. If you happen to shut down your Mac, it might be a good idea to change these intervals to a time when you’re sure the computer will not be shut down, as these jobs are important.

You will find a script in each of these folders called 999.local.  This file is set to read-ony by default, and is for  ”backwards compatibility  with the old /etc/daily.local” according to the comments in the file.  (I’m running Snow Leopard.)  I’d recommend not modifying the scripts in the /etc/periodic folders, and creating a /etc/daily.local, /etc/weekly.local, and /etc/monthly.local file for your cron jobs, as you have the 999.local script in each of the daily, weekly, and monthly sub-directories of /etc/periodic to tell your scripts to run.  Any future system updates could change the default files in those three directories, so if you modify those you may end up losing your scripts. Avoid that by setting up your own.

If you are running aTiger, the 999.local file may not exist, and you will have 500.daily, 500.weekly, and 500.monthly files inside their appropriate /etc/periodic directories.  You should still create a daily.local, weekly.local, and monthly.local script file and place them in the /etc directory, and they will be called  from the respective 500.* file.