instructions

You are currently browsing the archive for the instructions category.

Securely delete files on Mac OS X in the Terminal by using srm:

srm <filename>

This will delete the file, then rewrite random data over the spot on the hard disk where the file was previous stored several times to prevent any file recovery attempts.

A regular delete using rm in the Terminal will only remove any pointers to the file itself, but this information can be recovered using file recovery and undelete tools.  This is similar to erasing an entry in the telephone book for someone’s house and phone number; the house is still standing and telephone number is still valid.  Using srm would send a bulldozer to the house to tear it down and break it into bits so small, it would be difficult to tell that a house ever stood there.

Securely deleting files is useful when you need to destroy a password file.  For example, I keep a file that is pgp encrypted with all my passwords within it.  When I need to add new passwords, I decrypt the file, add the new username/passwords, then re-encrypt the file.  Afterwards, I need to securely destroy the text file that I updated.  For that, I use srm.

Read more about srm at Wikipedia.

Here’s how to attach the iPod Touch/iPhone screen film from iSkin without bubbles (and avoiding the seven layers of hell while doing so).

  • Wear polyester based clothing (which doesn’t produce dust).
  • Start the process in a room that is the most dust free in your house.  Perhaps your kitchen.
  • Have the screen film, the anti-static alcohol wipe, and a small bit of saran wrap handy.
  • Wipe down the screen well with the alcohol wipe and hold the iPod touch screen up to the light to check for remaining dust.  If there’s any you can see, keep wiping.
  • When the screen is dust free, hold your iPod vertically, either on its side or standing up.  This prevents new dust from falling on the screen while you get ready with the screen film.
  • Peel away layer A of the screen film and quickly start to apply the bottom edge of the film, holding the film like a playing card, touching only the edges (the film is quite stiff, allowing you to hold it like a card).
  • The film will quickly start sticking or tacking onto the super clean iPod touch screen and will turn dark as it does, allowing you to easily see where the film has stuck or is still free or heaven forbid, has trapped some dust which will create a bubble.  Don’t try to apply the film all in one go.  Start from one corner and slowly work your way to the opposite corner.
  • Rub the film with your thumb from one side to the other along the “tack front” as you slowly move up the screen.  I recommend doing it not in a straight line but slighly diagonally like a guillotine blade.
  • Before reaching to the final upper corner, place the saran wrap in the corner where the film will finish.  This allows you to easily lift the film up to repeat if you messed up the alignment or if dust has gotten between the film & screen.
  • If you’ve managed to trap dust between the film and the screen, air bubbles will be glaringly obvious.  Don’t bother typing to wipe the dust off the film with your fingers or to squeeze out the air bubble with a credit card… it’s futile.  Remove the entire film and go to the sink.  Using a slow smooth stream of warm water, rinse the tacky side of the film.  Don’t worry, there’s no glue to be washed away so this is safe.  Shake the excess water off when finished.  Use the alcohol wipe (which is likely dry by now) to soak up any remaining water droplets since it is lint & dust free.
  • Repeat until you apply the film without dust and without bubbles.

(photo courtesy of iSkin)

Quick Tip for a longer MacBook Pro battery life (with LED backlit screens): Make a Hot Corner for turning off the screen and use it whenever you’re not actually looking at the screen. (System Preferences -> Desktop & Screen Saver -> Hot Corners… [button])MacBook Sleep Display Hot Corner

If you’re like me and do multiple things while working with your MacBook, there are times when you’re not actually looking at the screen.  Quickly swipe your mouse to the Hot Corner you’ve setup for Sleep Display and you’ll reap instant power savings with very little cost in terms of downtime/wake time.

Fluorescent tube backlit screens unfortunately have a warm-up/cool-down time that causes the screen to appear dark when first lit and slowly increase in brightness as the backlighting tube warms up.  LED backlit screens brighten instantly to their preset level, so take advantage of it.

Instead of installing Flip4Mac you can use VLC to watch streaming videos, particularly Windows Media (wmv) streams on Mac.

Here’s how:

Download VLC for Mac OS X here. Install and Launch VLC Player.

A Windows Media stream that cannot be played in Firefox will only show a lego brick and a blank area.

WMV Plugin needed Firefox Mac

To find the media stream in Firefox, go to Tools -> Page Info (Cmd + I).

Firefox Page Info

On the Page Info pop-up window, click on the Media tab.

firefox_wmv_media_stream

One of media items in the list will use a different protocol than http, in this case, mms with the Type as Embed.  In the Location information just below the list you’ll see the mms media stream Internet address. In this case mms://live.france24.com/election-en.wsx.  Highlight this address with your mouse and Cmd + C to copy it.

Now it’s time to open that Windows Media stream in VLC Player. Click on File and Open Network.

VLC Open Network

Paste the Windows Media stream that you copied earlier into Media Resource Locator field. Then click on HTTP/FTP/MMS/RTSP radio button on the left hand side of the Open Source window.

Open WMV Stream in VLC

Click OK. VLC will begin loading the stream and will play the WMV stream shortly.

VLC Playing WMV media stream on Mac

Enjoy your coverage of Obama defeating John McCain on France 24 live media stream.

To download old or previous versions of Firefox, such as 3.0.2 or earlier, try this (official Mozilla) address: http://releases.mozilla.org/pub/mozilla.org/firefox/releases/

This site makes available for download Firefox 2(.0.0.6) up to the latest official release (3.0.3 as of Oct 2008) and nightly builds which contain fixes to bugs up until the previous night.

Firefox Old Versions at Mozilla.org

I’m currently having a problem with Firefox 3.0.3 not showing/processing stylesheets (CSS) from web pages upon first load, requiring multiple reloads pressing Cmd + R (Ctrl + R for you Windows folks) in order for the page to be displayed properly.  Otherwise, the page loads with text only, hyper-ugly, 1994 style web page

To get back disk space on your Time Machine Backup drive you can delete or remove backed up items from Time Machine permanently.

First, go into Time Machine by clicking on the clock arrow icon in the Dock (top right hand corner beside your clock).

How to enter Time Machine from Dock

Then in Finder (with all the files and folders listed), click and highlight the item that you want to remove from your Time Machine backups.

Next, click on the Gear icon at the top center of the window.

Finder Gear Button

And choose Delete All Backups of …

Time Machine will then proceed to remove all traces of the item from your backups.  It’s a good idea to exclude this item from Time Machine before you perform this removal.  If you don’t, the next time Time Machine runs, you’ll end up with this item again in your backups.  Within the Preferences for Time Machine, click on the Options button.  That will open a window with a list of “Do not back up” items.  Clicking the Plus (+) button allows you to select files or folders that you wish to exclude from Time Machine.

When connecting to a remote mysql server, the login/user must have rights to connect to the mysql server from outside of the local server, i.e. localhost. You need to edit the user record within the mysql.user table or add a new record for this user, giving it access to connect to the mysql server from a host other than localhost.

Login to the mysql server add run the following command:
grant all privileges on *.* to 'user'@'192.168.25.1' identified by 'password' with GRANT OPTION;
Replace “user” and “password” and “192.168.25.1″ with your mysql username, password, and the IP address of your computer that you’re connecting (to the mysql server) from.

Remember that your mysql server must also allow connections from remote hosts.

By default mysql does not allow connects to itself from any host besides localhost, for security reasons.

When you get an error “Can’t connect to mysql server on [remote server]” when trying to connect to the remote SQL server via the mysql command line tool, log into the server running the mysql server and edit the /etc/mysql/my.cnf config file.

In particular, comment out the following line:
bind-address           = 127.0.0.1
This allows for connections from any host.

Next, update the mysql user to allow it access from a host other than ‘localhost’.

To have Apple Front Row show and play videos inside of an iso file, first mount the iso file then make links to the video files inside of the iso, within your Movies folder. This can be useful for example when you have a season of television episodes of House MD in a single ISO disc image somewhere on your Mac.

step 1: mount iso file

First mount the iso file by double clicking on it (within Finder, on your desktop, wherever it may be). The ISO file will be mounted like a drive and will show up within Finder under Devices and look like this:

In my case the iso file disc image was named 20071107_170514 when it was created. Your mounted iso volume will be named differently.

step 2: link to video files in iso

Create symbolic links to the video files within your Movies folder using the Terminal. Afterwards the videos will show up in Front Row like any other video or movie and you don’t have to copy the files out, saving disk space.

Before that, I’m going to create a folder within ~/Movies with a descriptive name (since 20071107_170514 is meaningless to me). In the Terminal window I would enter:
mkdir ~/Movies/HouseSeason4

Now create symbolic links to the videos with the the “ln” program:
ln -s /Volumes/20071107_170514/*.avi ~/Movies/HouseSeason4

ln is the link program
-s tells the link program to make symbolic links (like detour signs to real files)
/Volumes/20071107_170514 is the mounted iso volume. Change 20071107_170514 to whatever your iso volume is named.
*.avi In my case the video files were AVI files and I wanted all of them (*) to be linked. Change this to whatever format the videos happen to be for you, for example: *.mpg *.mkv
~/Movies/HouseSeason4 is the directory where the videos will appear in Front Row. Since Apple Front Row automatically searches through your Movies folder for videos, making a subdirectory underneath Movies is an ideal spot. These symbolic links will appear like any other video file and Front Row will browse and play these files as if they were actually located in your Movies folder.

step 3: Watch iso videos in Front Row

Start Front Row by hitting ⌘+⎋ (Command Key and Escape) or hitting the Menu button on your Apple remote.

Go into the Movies folder and you should see the folder you created in Step 2. Go into that folder and you should see the video files that were inside the iso disc image file. From here you should be able to play the video files that are inside the iso, without having to copy the files out to your Movies folder and taking up twice the disk space.

Notes

Any volumes that you mount will be unmounted automatically when you reboot. Since the symbolic links within your Movies folder aren’t the actual video files themselves, they need the mounted iso volume to work. After rebooting, remember to remount your iso disc image by double clicking on it before looking for videos inside it within Front Row.

How to fix Slow Web Browsing and Slow Internet in Leopard (10.5.x)

Symptoms

  • Web pages load slowly in Safari or Firefox in Leopard.
  • Web sites won’t load, only load partially, stop loading after a few hours.
  • Slow DNS (domain name) lookup in Leopard. First load of web site is slow with “looking up domain” in browser status bar.
  • Once website is loaded, browsing to that site is fast.
  • AirPort wireless strength drops, then Internet connection is lost (see related post).
  • Email programs are slow in connecting to servers.
  • SSH sessions are slow to connect to remote servers.

Possible Causes of Slow Internet under Leopard

  • Your ISP’s DNS servers are (sometimes) slow to respond due to high traffic.
  • Firefox, Camino, Safari is requesting domain name lookups in IPv6 format (2001:db8::1428:57ab), but your DSL router/cable modem answers with IPv4 addresses (192.0.2.235) (references: mozillazine.org, mozilla.org bug, arstechnica.com). Safari may not be affected by this as WebKit is said to use IPv4 domain lookups first, then uses IPv6 if IPv4 fails.
  • Your router, acting as a DNS Proxy, doesn’t recognize nor forward IPv6 domain name lookup requests.
  • Leopard is now requesting SRV (service) records for domain name lookups. Your router does not recognize nor forward to SRV requests.
  • Your ISP’s DNS servers don’t recognize or doesn’t respond to SRV queries or respond with NXDOMAIN.
  • [Added 080618] Poor wireless router performance in general (references: entropy.ch). To test this, try connecting directly to your DSL router/modem if you are using an intermediate router such as an Apple AirPort Base Station, or NetGear/Linksys wireless router and seeing if web and internet speeds increase.

Fixes/Solutions/Workarounds

Details

After upgrading to Leopard, plenty of Mac OS X users have complained of “slow internet” when browsing the web, yet Windows PCs or Macs with Tiger (10.4) on the same network are much faster.

DNS Lookups

A domain name lookup or DNS lookup is done every time you visit a web page, say “apple.com”, as you’re actually visiting “17.149.160.49″. A DNS Resolver on your computer sends a request to a DNS Server that handles this lookup or translation from names (easy to remember) to numbers (hard to remember). Once your browser has this numerical IP address it can start loading the web pages at that server location.

Domain Name System Lookups in Leopard

With Leopard, a major change occurred in DNS lookups. Any program in Leopard that can use version 6 IP addresses (IPv6 explained below) will send out a new type of DNS lookup request - the SRV Record. In Tiger and previous OS X versions, DNS lookups were A record requests.

SRV records are new (sadly, 8 years old is new in the DNS world), provide more information than A records, but have terrible support in terms of hardware (your DSL router or cable modem) and DNS servers that answer with SRV information. For every SRV request that Leopard sends it must wait for a valid reply. If the request fails, Leopard must try again. If it fails again, Leopard will finally ask for an A record. This is one reason why Mac users are experiencing slow Internet on new Macs with Leopard or after upgrading to Leopard from Tiger.

Domain Name Lookup Chain

Diagnosing slow Internet problems under Leopard is difficult due to the many different slowdowns that can occur along the domain name lookup chain when connecting to the Internet in OS X. For an application like Firefox or Safari to find a domain name, this is roughly what happens:

  1. Firefox/Safari is asked to load a web page at a domain name (example: “apple.com”).
  2. Browser starts work on getting an IP address for that domain (a domain name lookup).
  3. Browser checks for recently translated domain names in its own internal “cache” and thus already has the IP address.
  4. If “apple.com” is not found in cache, Firefox/Safari then asks Directory Services (an OS X program that does DNS lookups) for the answer.
  5. Directory Services (DS) searches for the domain in its own DS cache (view the DS cache using Terminal: dscacheutil -cachedump -entries).
  6. If domain is not found in cache, DS checks flat (text) files such as /etc/hosts for the domain name (see the file using Terminal: cat /etc/hosts).
  7. If domain is still not found then DS sends a domain name lookup request to the first DNS server listed for your AirPort wireless card or your Ethernet card (your network interfaces). The first (and usually only) DNS server is often your router (often listed as 192.168.1.1 in System Preferences => Network => Advanced => DNS tab).
  8. If the router doesn’t recognize the name lookup request (SRV/IPv6), the request will be either ignored, returned without result, returned with error. If the router does recognize the DNS request, it checks its own DNS cache for a matching domain lookup.
  9. If domain name is not found in cache, the router forwards the request to the ISP’s DNS server.
  10. If the first ISP DNS server doesn’t respond or doesn’t have the record, the router sends a second lookup request to the next DNS server listed in its configuration. Continue until all DNS servers are exhausted.
  11. When name lookup result is received by router, it saves the result to cache, then forwards the domain name record back to the requesting computer.
  12. Directory Services on Leopard, receives the answer, places it in cache, then returns the results to the requesting application: your browser.
  13. Firefox/Safari receives the DNS record, with IP address, stores it in cache, then starts to retrieve the web page at that location.

(Illustration by Lion Kimbro on Wikipedia - Domain Name Systems article)

Any one of the links in the chain can be a potential source of slow Internet speeds when browsing or retrieving mail, etc. The difficulty lies is finding out where the problem exists and how it can be fix. Compound this complexity with the number of different DSL routers in use in homes, the number of different firmware (software inside the router), number of different ISP DNS servers

Caches

Caches store recent domain name lookup results in order to save time when the domain is requested again. Each time a domain name lookup is made, caches are checked to see if the lookup has occurred recently and if so, use the cache result. If no result is found in cache, the domain name lookup has failed and the DNS lookup request continues down the chain. A domain lookup may fail all the way down the chain until it’s finally resolved with the second or third DNS server listed, taking maybe 15 seconds to finally succeed. But, once domain lookup has been successfully performed, this domain request “answer” is cached all the way back up the chain, for varying amounts of time. Browsers like Safari and Firefox normally cache domain name lookups for 1 minute (30 minutes if you’re Internet Explorer in Vista). Leopard’s Directory Services program caches lookups for one hour (3600 seconds) by default.

Once a successful domain lookup has occurred, web pages from the same site will load very quickly, since the domain and its IP address are known and cached in memory. When the cached domain lookup result expires, the vicious cycle of slow domain lookups restarts. This often leads to the confusing pattern of fast Internet / slow Internet performance that can be seen sporadically throughout a browsing session.

IPv6

IPv6, the new way of addressing all things on the Internet, is important and necessary as we’ll eventually run out of IPv4 addresses (like 17.149.160.49). But part of the issue with slow browsing and slow Internet on Leopard is the combination of how IPv6 is used in Mac OS X and the current state of DSL routers and cable modems.

Whenever a program on Leopard can use IPv6 addressing, such as Firefox, it will request IP addresses for domains in IPv6 and if that fails, Firefox will then try IPv4 domain lookups. The reason this adds to the slow Internet problem is that many routers and DSL or cable modems in peoples homes are not capable of handling/routing IPv6 domain name queries (properly). This can cause repeated, failed DNS queries in IPv6 format, with the requesting application eventually falling back to sending IPv4 domain lookup requests that are successfully answered. The unfortunate problem with this “IPv6 then IPv4″ order of domain lookups is users end up with delays of 5 to 10 seconds “looking up” a domain name, which is not a very long time to wait, but suffering short delays every time you visit a different website can be extremely frustrating.

SRV (Service Record) Requests

Part of the issue may be related to Apple’s decision to follow the Internet Engineering Task Force’s recommendation of using SRV queries instead of “A record” queries when looking up domain names in Leopard.

The problem with Leopard asking for SRV records from DNS servers is that many DNS servers still don’t recognize or respond to SRV type DNS requests, or respond with a non-existent domain (NXDOMAIN) error code. This is not exactly Apple’s fault for asking, it’s actually the fault of DNS server owners who are not updating their servers to the latest standards. Regardless, whenever a program like a web browser requests a DNS record and gets failed responses, or no response at all, the program retries its requests, but only after a certain delay. Each failed SRV request and subsequent retry adds time the user must wait before the browser or application eventually gives up on the SRV requests and tries an old-school basic A record request in an attempt to get the IP address of the domain name. And all DNS servers answer to A record requests, even the old dingy ones not following the latest IETF standards. You, the user, sees this request — no response — retry dance as the browser taking a long time “Looking up domain.com….”, often seen as such on the browser status bar at the bottom left hand corner of the window. Only when the browser or application has received a valid IP address from a domain lookup can it contact the web server and start to download the HTML and display the page.

Timeouts

The delay between lookup retries is important to prevent overloading DNS servers, DNS resolvers (like Directory Services on your Mac) and simply makes sense. It’s similar to walking up to someone’s house and knocking on the door: Normally you wait a few moments for a response before trying again. If you don’t wait, you don’t know whether no one’s home, or whether they’re just taking a few seconds to respond. Continued knocking doesn’t help you. (And perhaps will earn you a stern look if not make you the target of a hissy fit).

Hammering a DNS server with domain lookups without pause is not very productive since the DNS server will simply drop (not answer) requests that it cannot handle within a timely fashion, based on its current load and worse, may get you blocked from the DNS server.

Next we’ll see how we can solve or workaround the issues discussed above that could be slowing down Leopard’s Internet speed.

Solutions

Direct DNS / Better DNS

Update 080606: Leopard 10.5.3 may have changed the order in which DNS Servers are used.

Update 080606: DNS servers entered on a DHCP configured setup are used in reverse order. I.e. the last server entered is the first to be used. If you’ve manually configured a network location, DNS servers are used in the order that you’ve entered them/see them.

New 080606: If you wish to save your current network setup and have the option of returning to it easily, follow the instructions for Creating a New Network Location. Otherwise, follow the instructions immediately below to quickly add new DNS servers.

Add DNS servers to Current Network Configuration

This is the quickest & easiest way to use new DNS servers, which is to simply add them to the DNS tab found in System Preferences => Network => Advanced => click on DNS tab.

Click on the + sign at the bottom left hand corner near IPv6 or IPv6 addresses and type in the addresses of the DNS servers you wish, in reverse priority order. (Recommended: OpenDNS servers at 208.67.220.220 and 208.67.222.222). I.e. the server that you want to use first, enter it last. Afterwards, click Ok. Then in the Network pane, click Apply to make your changes active. If you’re using an AirPort wireless connection, wait a few moments for the connection to be re-established

Creating a New Network Location

The advantage of creating a new network location is the ease of which you can move back and forth between different network setups. By creating and using a new network location, you can always revert your changes by simply selecting your original (Automatic) network location from the Location drop down list.

In Leopard, open System Preferences => Network => click the Advanced button (bottom right corner)


Click TCP/IP tab (top left).
Write down on a piece of paper (or in TextEdit) the IPv4 Address, Subnet Mask (255.255.255.0), Router, and Configure IPv6 setting. Click Cancel.

Find the Location drop down at top of the Network preferences pane. Click it and choose Edit Locations.


Highlight “Automatic” if not already
Click the Gear icon on the bottom center, choose Duplicate Location


Choose a name, I used “Home”.
Change the Location drop down box by clicking on “Automatic” and then switch it to “Home” (or the name you chose in the last step)
You’ll see the following:


Select Airport on the left (or Ethernet if you’re not using a wireless connection).
Click Advanced at the bottom right.
Click on the TCP/IP tab-button.
Change the Configure IPv4 drop down box to “Manually”.
Here’s where you use the values you saved in Step 2. Fill out IPv4 address, subnet mask, router, configure IPv6 settings. Do not click OK, instead click on DNS near the top.
Click the + button, bottom left hand corner. This creates a blue outline under DNS Servers on the left half of this window.

Enter in the DNS server of your choice. I recommend OpenDNS at 208.67.222.222. (Don’t include a period at the end). Add a second OpenDNS server by clicking again on the + button and entering 208.67.220.220. These DNS servers will automatically redirect you to the closest / best server for you, regardless of whether you’re in France (like me) or in North America. Click OK. You should be returned to the Network preferences pane and see something like the following:

At this point you’ve created a new Location called “Home”, having setup AirPort or Ethernet with the correct settings and “Services” (i.e. DNS), but none of these changes have been made active. Let’s make a backup of the configuration file that will be updated before you apply your changes. In Finder, click on the hard disk icon at the top left corner (usually Macintosh HD), then navigate to this directory: /Library/Preferences/SystemConfiguration and find this file: preferences.plist. Simply copy the file to your Documents folder or to a spot of your choice. If you have to rollback the applied changes, you can copy this file back to the above location. If you’re using Time Machine, this file should be backed up already. Now you know where this file is, so replacing it with a Time Machine version should be straightforward.

Before we make our changes effective, we’re going to check how DNS requests are handled now, before the changes, and after to make sure we’ve changed our Network Settings properly.

Leave the Network window open as is and open up a Terminal window. We’re going to be using the tcpdump program to listen to DNS traffic between your computer and your DNS server.

Type this command and hit Enter: sudo tcpdump -i en1 -s 128 port 53

(If you’re using Ethernet with a cable, use en0 instead of en1, which is the AirPort wireless interface).

Supply your password when asked to do so.

You should see something like the following:

tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on en1, link-type EN10MB (Ethernet), capture size 96 bytes

tcpdump should now be running.

Open up another Terminal window and type the following command: curl http://www.csu.edu

This uses the curl program to read the web page located at www.csu.edu.

Going back to your tcpdump window you should see something similar to this:

00:31:37.026520 IP 192.168.1.132.56645 > WANADOO-D310.domain: 19279+ SRV? _http._tcp.www.csu.edu. (40)
00:31:37.029352 IP WANADOO-D310.domain > 192.168.1.132.56645: 19279* 0/0/0 (40)
00:31:37.029849 IP 192.168.1.132.56646 > WANADOO-D310.domain: 49549+ SRV? _http._tcp.www.csu.edu. (40)
00:31:37.032657 IP WANADOO-D310.domain > 192.168.1.132.56646: 49549* 0/0/0 (40)
00:31:37.034345 IP 192.168.1.132.56647 > WANADOO-D310.domain: 46004+ A? www.csu.edu. (29)
00:31:37.279043 IP WANADOO-D310.domain > 192.168.1.132.56647: 46004 1/0/0 A www.csu.edu (45)

Notice 192.168.1.132. That’s me, or really, my MacBook Pro’s AirPort wireless card. Then there’s a greater than sign (>) showing the direction of DNS traffic. WANADOO-D310 is my DNS server, which is actually the DSL modem/router, a.k.a. 192.168.1.1, which is passing domain name lookups to the real DNS servers at my Internet Service Provider (WANADOO, yeah I know goofy name). Remember the network settings we wrote down before starting all this? You’ll notice that the DNS server is 192.168.1.1.

OK, we’ve got a baseline of what our Mac is doing when looking up domain names, let’s apply our new network location “Home” that we created and see the difference.

Back on the Network preference pane, notice the Apply button on the bottom right hand corner. Once you apply your changes, your Mac will begin using the new Location you’ve created.

Take the plunge and click on Apply.

For AirPort wireless connections, you may have to click the Turn AirPort Off button, wait fifteen seconds, then click Turn AirPort On again in order for the new DNS settings to be used.

Going back to the Terminal window where we executed the curl command, and with our changes set, let’s execute another: curl http://www.unc.edu

Results will look like the following:

00:32:33.562589 IP 192.168.1.132.56663 > resolver1.opendns.com.domain: 39356+ SRV? _http._tcp.www.unc.edu. (40)
00:32:33.767237 IP resolver1.opendns.com.domain > 192.168.1.132.56663: 39356 NXDomain 0/0/0 (40)
00:32:33.767856 IP 192.168.1.132.56664 > resolver1.opendns.com.domain: 62833+ SRV? _http._tcp.www.unc.edu. (40)
00:32:33.809161 IP resolver1.opendns.com.domain > 192.168.1.132.56664: 62833 NXDomain 0/0/0 (40)
00:32:33.811130 IP 192.168.1.132.56665 > resolver1.opendns.com.domain: 45293+ A? www.unc.edu. (29)
00:32:33.853070 IP resolver1.opendns.com.domain > 192.168.1.132.56665: 45293 1/0/0 A www.unc.edu (45)

Notice what’s changed? WANADOO-D310.doman has changed to resolver1.opendns.com.domain. This is OpenDNS’ name for the DNS server we started using, 208.67.222.222, which we entered as our DNS for the “Home” location. Also, note how instead of just getting a 0/0/0 response, we’re getting NXDOMAIN 0/0/0? That’s at least the DNS server responding saying: that domain doesn’t exist (not exactly true, since the domain does exist, but it just doesn’t have an SRV record), rather than the DNS server sending back nothing, not even an error code. Also, notice how our Mac tried twice on asking for SRV records, and the DNS server responded twice, that no record exists for that domain, and then finally our Mac asks for an A record (A?) and gets one answer record back (1/0/0 A ww.unc.edu).

If you want to see a domain that actually has a proper SRV record, try this in the curl terminal window: curl http://s3.amazonaws.com

Results should be something like this:

09:36:56.440037 IP 192.168.1.132.61010 > resolver1.opendns.com.domain: 34536+ SRV? _http._tcp.s3.amazonaws.com. (45)
09:36:56.671881 IP resolver1.opendns.com.domain > 192.168.1.132.61010: 34536 2/0/0 CNAME s3-directional-w.amazonaws.com., (97)
09:36:56.673894 IP 192.168.1.132.61011 > resolver1.opendns.com.domain: 18143+ A? s3.amazonaws.com. (34)
09:36:56.715913 IP resolver1.opendns.com.domain > 192.168.1.132.61011: 18143 2/0/0 CNAME s3-1.amazonaws.com., A s3.amazonaws.com (69)
09:36:57.263186 IP 192.168.1.132.61012 > resolver1.opendns.com.domain: 32069+ PTR? 171.206.21.72.in-addr.arpa. (44)
09:36:57.306060 IP resolver1.opendns.com.domain > 192.168.1.132.61012: 32069 1/0/0 PTR s3.amazonaws.com. (74)

Here we’re getting 2 answer records (the “2″ in 2/0/0) on the SRV requests, which are CNAME records, first being s3-directional-w.amazonaws.com, second being s3-1.amazonaws.com. CNAME records are “nickname” records, which point to true name, or A Record. Right after that our Mac asks for an A record on the first CNAME that was returned to us (s3-directional-w.amazonaws.com) to get back the actual IP address (72.21.207.246), which you can verify by using the dig program.

This fix alone has made my Internet connection much faster since my ISP’s DNS servers were sometimes under heavy load and slow to respond to DNS queries. Most of the time, I’d get name requests done in 200-400ms. Not noticeably slow. But, on occasion domain name lookups would timeout after 7 seconds, multiple times, resulting in up to 21 seconds of waiting for a single name lookup request to occur. This is excruciatingly long when I often open up multiple different websites one right after another when starting a browsing session. To make matters worse, many websites are getting into the practice of placing different parts of the web page on different domain names. Let’s take CNN.com for example. To load this single page of President Obama… oh, I mean senator Obama, waving to the crowd, tcpdump showed name lookups for the following domains:

  1. www.cnn.com
  2. edition.cnn.com
  3. i.cdn.turner.com
  4. i2.cdn.turner.com
  5. svcs.cnn.com
  6. ads.cnn.com
  7. i.cnn.net
  8. ad.doubleclick.net
  9. metrics.cnn.com
  10. m1.2mdn.net

One Page. Ten domains. Ten DNS lookups. Ouch. And I’m not including PTR/Reverse Lookups for each domain, making it really 20 DNS queries.

And does anyone wonder why problematic DNS performance in Leopard would slow web browsing to a crawl?

Disable IPv6 DNS Lookups

Firefox and Camino by default do DNS lookups using IPv6 addresses by default, reverting to IPv4 if that fails. This can be a problem when the router that we are using to connect to the Internet doesn’t work with IPv6 DNS requests properly, if at all.

To disable IPv6 DNS lookups in Firefox and Camino, type the following into the browser address bar:
about:config
If you see a large “Be Careful” warning, simply click on “I understand and I wish to continue”. Next, you will see a long list of Preference Name, Status, Type and Value columns. Above all that is a bar in which you can filter which preferences to view. In the Filter bar type: ipv6
You should see something like the following:

To change the value for this preference simply double-click the name “network.dns.disableIPv6″. The value you want is “true”, which means that IPv6 DNS requests are disabled. If this value is already “true”, don’t double-click this preference.

To make the preference change active, close the browser and Quit Firefox completely (Apple Key + Q), then restart Firefox. You may have to repeat this Quitting and Restarting to have the change take effect.

After making this change, Firefox (or Camino if that’s what you’re using) will use IPv4 only when performing DNS requests.

Update DNS Servers on Router

If you have access to your router’s administration web page, you may be able to set its DNS servers manually, avoiding the buggy DNS servers located at your ISP. Refer the manual that came with your router, or speak with your service provider about how to access the router’s administration page. Often this page can be accessed at http://192.168.1.1, so simply type that address into your browser’s address bar and press Enter. With any luck you’ll have access to the Administration login page. Many router administration sites don’t have passwords, don’t have usernames, or use very simple standard passwords such as “admin”, leaving it up to the owner to change it to something more secure. Visit the router manufacturer’s web site for more information about accessing the administration features of the router.

Keep in mind that updating the router’s DNS servers will not avoid problems you may be encountering with the router’s poor DNS Proxying/Forwarding support. If your router can’t handle IPv6 or SRV requests coming from your Mac, these DNS requests will stop here at the router and will not be forwarded onto the new DNS servers you’ve just specified, making this fix completely ineffective. DNS requests that your router cannot understand will likely be ignored or returned without answer results. DNS Proxy/Forwarding issues are discussed further in the next section.

Update Router Firmware

For those who need to continue making DNS requests through their router, rather than directly against DNS servers, due to VPN or tunneling requirements, your fix may lie in upgrading your router’s firmware. Routers are in effect “the” DNS server for the majority of home broadband Internet connections since it acts as the DNS Proxy, taking domain name lookup requests from your computer, passes them to the ISP’s DNS servers for resolution, receives the results, and finally passes the name lookup results back to your Mac, all transparently in the background. This is why your DNS server address is the same as your “Gateway” which is a fancy name for your router, since all traffic passes through this “gate” of sorts. Thus the Gateway address is often 192.168.1.1, which in turn is also the address of the DNS server for the “Automatic” network Location in Leopard.

Be aware that DNS Proxying is a common failure point in the domain name resolution chain. If the router is not compliant with the latest Internet Task Force standards, it may not know what to do with SRV requests (which Leopard now uses) and may simply ignore them, return empty results, or return NXDOMAIN (non-existent) errors. Again, a firmware update may bring your router up to the latest standards for DNS servers.

If the router is a DSL Cable modem/router, contact your ISP and ask whether there is updated firmware for the model of router you’re using. If you’re more of a do-it-yourself person you can attempt to find the manufacturer of the router/modem and find the latest firmware from their website, if available. Disclaimer: updating the firmware of your router with the wrong firmware, or not completing the firmware update due to power loss, will render your router useless. Do not attempt to update the firmware if you are not confident of what you’re doing.

New Information


Update 080606: As per a discussion on Macosxhints forums, Apple may have changed the order in which DNS servers are used. In the screenshot, the listed DNS servers are used in the order they are seen, under Leopard 10.5.2. This is true for a manually configured Network Location. In 10.5.3, users are seeing the opposite order, i.e. In a DCHP configured Network Location (automatically done by your DSL router and ISP), the DNS servers listed are used in reverse order. (Bottom server is used first, then moves up the list as needed). Thus adding a new Network Location to use a given DNS server would be unnecessary.

Update 080614: Airport Wireless Connection Drops - This is a common problem for Leopard users after upgrading to 10.5.2. This isn’t exactly a slow Internet problem, but rather, a “no Internet” problem. See this related post on wireless problems on Apple AirPort connections.

The Beginning

This is not the end, but rather, the beginning of an article that I hope will continue to grow in scope to cover more problems and offer more solutions to slow Internet problems in Leopard. Please leave a comment if you’re experiencing a problem not discussed here and we’ll get working on diagnosing the issue and searching for a cure.

If you’re having troubles implementing a fix listed above, leave a comment and I’ll try to expand on the topic or reword it so that it is understandable to you and to everyone else I’ve confused.

Keep in the Loop

- Ben

Need to debug a slow Internet connection in OS X? Or simply have a desire to watch incoming and outgoing DNS (domain name service) queries in Leopard? Then tcpdump is your friend.

Open a terminal window and use the following command:

sudo tcpdump -i en1 -s 128 port 53

-i Sets which interface to listen to. en1 for me is the AirPort wifi card. en0 would be the ethernet card.
-s sets the number of bytes to “sniff” or “snarf” per call that goes through this interface. 128 gives us a bit better coverage than the default 68 bytes. If you find that tcpdump requests are showing up simply as [|domain], that means that the request is longer than 68 bytes and is truncated. To prevent truncation, increase -s.
port 53 is simply the network port for DNS communcation

Learn more about tcpdump at developer.apple.com

To play divx videos or movies in QuickTime / Front Row on Mac OS X, you need to install a divx codec. If you open an .avi file and see only black, you likely don’t have a divx codec installed.

Download a free divx codec for Mac here then following these walkthrough instructions on how to play divx videos on Mac.

Say you have different keyboard layouts cause you’re bilingual and need access to accents or different alphabets. The normal way to switch between these two keyboards would be to show the keyboard icon on the top Menu bar and simply click on the icon and choose the keyboard layout you wish to use.

Although this works, it’s a bit annoying to mess with the mouse in search of a tiny keyboard layout icon when you just want to hop in to a keyboard layout to get an accented character, then return back to the original that you were just using.

To the rescue: Input Menu, hidden deep within System Preferences => Keyboard & Mouse => Keyboard Shortcuts => Input Menu (greyed out)

The reason Input Menu is disabled by default is that its historic keyboard shortcut has been taken over by Spotlights: Apple Key + Spacebar.

Keyboard and Mouse Preferences - Keyboard Shortcuts - Input Menu

For me, I hardly ever use Spotlight, since I’m on the Quicksilver launcher train, which pretty much circumvents my need of Spotlight, so I’m happy to give up Command + Spacebar to be able to toggle back and forth nearly instantaneously between keyboards (French AZERTY and English QWERTY). (See the great things you can do with Quicksilver here).

If you’re hot on Spotlight, simply choose a different keyboard shortcut for either Spotlight or Input Menu => Select the Previous Input Source. You can do this by double clicking on the shortcut in question and pressing the new keyboard combination to replace it with.

Fix for “caution: filename not matched” error when trying to unzip multiple files at once in Terminal.

Solution for unzipping multiple zip files with a single command.

Open up a Terminal window on OS X, go to the directory containing the zip files and enter this command:

unzip \*.zip

The forward slash escapes (prevents) the wildcard character (the “*”) from being expanded by bash shell interpreter. In English: the files in the directory are the filenames “unzip” is trying to extract from the first file it finds when using “*”.

Example:

/myzips directory contains zip files: first.zip second.zip third.zip

Trying to run: “unzip *.zip” will cause the unzip program to take “first.zip” as the archive to play with, and will look for files “second.zip” and “third.zip” within “first.zip” to expand/extract. Obviously not what you want to do.

Not escaping the * character will result in errors like: “caution: filename not matched”.

First find your current sleep setting by opening Terminal in OS X and entering this at the prompt:

pmset -g | grep hibernatemode

That should return you something like “hibernatemode 3″. Remember this number, send an email to yourself, write it down on a scratch pad, whatever it takes to remember your default mode. Mode 3 keeps your RAM powered during sleep to allow super fast wake-up, but also writes an image file of all memory onto disk in case power is lost.

To change the hibernate safe sleep setting to not create an image file on the disk, i.e. mode 0 (mode zero, not the letter ‘o’), enter the following in a Terminal window:

sudo pmset -a hibernatemode 0

Enter your password when asked to do so. This prevents Safe Sleep from saving your memory contents to disk, in large part the cause of not being able to wake MacBook’s from sleep.

If you’d like to get back about a gigabyte or more of disk space, delete the memory image file with the following Terminal command:

sudo rm /var/vm/sleepimage

Macworld has a great article with more information about safe sleep and hibernation on MacBooks.

Open the lid and nothing? Tap keys, change brightness, close and re-open lid and your MacBook still in sleep mode?

Solution: Turn off Safe Sleep. Or use Smart Sleep.

If you open your MacBook lid and notice that you can’t wake your MacBook from sleep, it’s because of the Safe Sleep system Apple designed. This system puts all your current memory (your RAM) onto the disk, so that it can power down the RAM, save energy, and keep the current working state of your computer, even if you ran out of battery power, changed batteries, etc.

Problem is, it’s slow. And buggy. Often when waking from sleep by opening the lid, the MacBook will remain in sleep.

My solution to this: don’t use Safe Sleep. Unless you’re constantly working on battery power and hate plugging in, you likely won’t ever notice you’re not using Safe Sleep’s hibernate to disk mode.

Here are some instructions on how to turn off Safe Sleep on a MacBook Pro Leopard or Tiger to avoid wake-up problems.

If you still want to use Safe Sleep with disk caching of RAM, use Smart Sleep by Patrick Stein. This software adds a preference pane to your Mac, allowing you to not use disk hibernation until you reach a low battery level, say 20% remaining battery.

Find Terminal in Leopard or Tiger

Open Finder

Go to Applications => Utilities

Double click on Terminal or highlight Terminal and Apple/Command Key + Arrow Down.

To reduce the temperature of my MacBook Pro I use smcFanControl by Hendrik Holtmann.  Normally my MacBook Pro would run somewhere close the 55-60C mark without doing anything intensive, say a 10-15% average CPU utilization.  I found this somewhat hot for my tastes, especially when using the built in keyboard where it would be uncomfortably hot to touch the speaker/heat dissipation grilles on either site of the keyboard.

I generally run the two internal MacBook Pro fans at 2600rpm each to keep the temperature 50C or below, depending on ambient temperature.  The cost is a little fan noise which is noticeable in a dead quiet room.  If you’ve got any music or background noise, you won’t notice it.  Either way, it’ll blend into the background quickly since it’s “white” noise anyways.

I’m unsure which version is the latest for smcFanControl so here’s another link to smc Fan Control version 2.1.2 in case it’s more recent than the above link.

This post was due to a comments discussion on how to turn off the macbook pro display when using an external display for Front Row.

To use an external display only when watching a movie on an external TV or projector it’s nice to not show the video on your Mac’s main display since it’s distracting. Closing the lid on a MacBook Pro makes it go to sleep and the only way to prevent the MacBook from sleeping with the lid closed is through some serious kernel hacks.

Apple’s Front Row has a feature that makes the secondary screen will go blank and dark when the Front Row is started. The trick to make your main MacBook display go blank when outputting Front Row to the secondary screen is to make your secondary screen the primary display. This is done through System Preferences => Display Preferences.

When you have the DVI to Video Adapter connected to your MacBook Pro and connected to a TV or other type of external display, open up Display Preferences. Within Display Preferences, choose Arrangement. You should see two blue squares that represent each display, main and secondary. On the main display you’ll notice a bar along the top. Simply click and drag this bar from the Main Display (usually on the left and large) to the secondary display, to make it the Primary or Main display. Close Display Preferences. Launch Front Row by hitting Apple key + Esc or by hitting the Menu on your Apple Remote. Front Row will launch and turn off the MacBook main display so that you can enjoy a distraction free viewing experience for your movies and videos on an external display.

Enjoy.

This will be painfully obvious to the old school Mac crew, but having been a recent convert from twenty years of PC’ing, I recently discovered how cool it is to play movies and videos from my Macbook Pro.  It’s like having a digital entertainment suite in your computer, complete with remote control that wows the crowd.

Front Row

Pressing Apple key + Escape key will fade out your screen to black and then Front Row will show up with selections such as Movies, which lists all video files in your Movies folder within Finder. If you’ve got your remote handy you can navigate this menu using the + and - buttons to go up and down the list, using Play/Pause to make a menu item selection. To go back or Up a menu selection you can either press the Escape key on the keyboard or the circular small Menu button on the remote.

If you haven’t already, consider install a DivX decoder and Perian so that you get great video format playback capabilities on your Mac.  Otherwise you may run into the situation where videos you’ve saved on your Mac play without sound and possibly without video either.

If you’ve noticed that your Macbook or Macbook Pro purchased in 2006 or 2007 is losing its battery life at an alarming rate, you’re not alone. Apple has had a very large batch of Sony lithium-ion polymer batteries for their laptops that are losing their maximum charge capacity very quickly.

System Profiler - Power

If you’ve noticed that your 4 hour battery life dropping to just over 2 hours recently, check your System Profiler for some information about your laptop battery power system.

System Profile can be found in Finder => Applications => Utilities => System Profiler.

Once you have System Profiler open, find Power underneath Hardware. Click on that item and on the right side of the window, scroll down until you find the Battery Information heading.

The three values we’re interested in are Full charge capacity (mAh), Cycle count, and Battery health.

A normal reading for Full charge capacity is about 5200-5400 mAh (milliamp hours). That translates into just over 4 hours battery life. Cycle count is how many times the battery has been used to capacity and recharged. Battery health is a word describing overall life expectancy and condition of the battery.

Remember that Apple has published on its Apple Support site that their laptop batteries are designed to hold 80% of its original charge capacity after 300 cycles (see the footnotes).

Doing the math, that means the Full charge capacity should be around 4160 to 4320 mAh after 300 cycles. If your Macbook battery is failing, like mine, it should read less than 3250 mAh, with a Health of “Fair” after far less than 300 cycles.

But, don’t despair. With that juicy price paid for the best laptop available on the market comes pretty good customer service. Bring your Macbook into an authorized service center, an Apple flagship store, or call up Apple support hotline and explain the situation. Also note that there are several support forum threads on Apple.com about users describing the same situation and what Apple has done for them:

http://discussions.apple.com/thread.jspa?threadID=1227431&tstart=0

http://discussions.apple.com/thread.jspa?threadID=1300374&tstart=0

For Macbook users experience battery life problems as described above the warranty coverage is being extended to two years, so even if your Macbook is out of warranty, your battery may still be in warranty.

I currently have a battery being sent to me and we’ll see how things turn out.

Good luck.

Blocked Flash AdBlocking Flash in Camino has been an On/Off affair until recently. Camino browser had implemented the FlashBlock software directly into its browser, but unfortunately, it didn’t have a whitelist where you can specify sites to allow Flash to run. So you either blocked Flash from all sites or no sites.

Although this is still the case, there is a hack that allows you to create a whitelist of sites where Flash should still be enabled. The hack is reproduced here:

Create a userContent.css file within the Camino Application Support “chrome” directory. Open up a Terminal window (found under Applications/Utilities) and enter:

cd ~/Library/Application Support/Camino/chrome
touch userContent.css

If you’ve got Textmate

mate userContent.css

If not, go into Finder, find the above “chrome” directory underneath your “Home” directory (usually your login name) and open the userContent.css file by Cmd-Clicking or two finger tap “right clicking”, Open With > Other > TextEdit.

Paste in the following code:

@-moz-document domain(youtube.com), domain(google.com)
{
object[classid*=":D27CDB6E-AE6D-11cf-96B8-444553540000"],
object[codebase*="swflash.cab"],
object[data*=".swf"],
embed[type="application/x-shockwave-flash"],
embed[src*=".swf"],
object[type="application/x-shockwave-flash"],
object[src*=".swf"]
{ -moz-binding: none !important; }
}

Notice the YouTube.com and Google.com domains within “domain()”. Add more of those with the domain of sites you want to allow Flash to run. This is your whitelist of sites where Flash is permitted to run.

After this, save the userContent.css file and shut down Camino completely (Cmd-Q) and restart it. Then go into Camino Preferences > Web Features > Block Flash animations, check this tick box.

Now try opening up YouTube.com and you should see the page working as normal. All Flash based videos should still work. Now try out a site with an obscene amount of Flash Advertisements like http://bloomberg.com. Where the Flash ads would be normally you should see the Adobe “f” instead.

If this doesn’t work for you, make sure you named the file correctly “userContent.css”, put it in the right directory “~/Library/Application Support/Camino/chrome”, and have completely shut down Camino (not just its windows, but truly Quit the program), and restarted, and that you’ve turned on the Block Flash animations option under Web Features in Preferences.

The above hack was kindly provided by Camino at http://caminobrowser.org/documentation/annoyances/

 My solution to keep Mac OS X protected from trojans and other nasty Internet virus related problems is an easy to use, easy to understand firewall software: Little Snitch.

Little Snitch FirewallHaving a virus attack your computer and render it useless is annoying. Having a trojan install itself on your computer and send out your sensitive personal information is catastrophic. What sensitive information could be that important you ask? How about Internet banking and online stock trading accounts, usernames and passwords? You don’t even need to have that information written down somewhere on your computer for it to be stolen. Keylogger programs can capture your login and passwords as you use them on your favorite sites and send them off to eagerly awaiting crackers in some far off foreign land. This actually happened to me back in 2004. Without the help of a firewall, I would never have known. More on this later.

How do we prevent our sensitive information from being beamed out to cyberspace? Setup a gate around our computer and hire a guard to watch all the traffic coming and going. Well, in a digital sense. The digital version is known as Little Snitch from Objective Development, Germany.

Little Snitch works by checking with you, a human, whenever a new program on your Mac tries to connect to the Internet. Each time a new program that tries to send information out to the Internet, Little Snitch asks you whether you want to allow this to happen and if it should remember your decision for the next time. This is really not as intrusive or bothersome as it may sound. After a day of using your computer as per normal, you’ll have just about all the programs you use normally setup with Little Snitch and the questions will stop. After this point, any time Little Snitch asks you about new outbound Internet traffic, you should pay attention: this is possibly information being sent out without your knowledge nor consent.

With Version 2 of Little Snitch, ObjDev came out with a great feature: Network Monitor. This feature unobtrusively pops up a window in the top right hand corner (by default, but moveable) with the name of the program and the Internet address it is trying to reach, every time data is sent out over the Internet. This is the ultimate in keeping a watchful eye on your system. You’ll quickly get to know which Internet addresses your Mac normally talks to on a regular basis and which addresses should set off alarm bells.

Little Snitch Network Monitor

So how is all this useful? Let me provide an example.

In 2004, I was trying to figure out some network issue with a game or what not so I popped up my firewall’s network monitor. I noticed something funny: an outgoing email connection was being attempted every minute from my computer to an email server that was completely foreign to me. I thought this somewhat odd, so I tried to load up the server address in a web browser. It was a Lycos free email account. I had no Lycos email accounts. At this point I could see the alarm bell in my head, but the ringing wasn’t too loud yet. Next I inspected what program was trying to make this Internet connection. It was a program that I had never heard of, installed in my windows directory. Looking at the compiled source code of this program it was referencing a file named “password” something or other. Returning to the directory I found this file and opened it up in a text editor. To my horror this file contained my usernames and passwords for web sites I used normally. This is when the five alarm signal started screaming in my head. In a panic I tried to delete the program, but it was constantly “in use”, making connections out to this Lycos email server, and monitoring Internet Explorer for logins that I was performing. Somehow this trojan program made it into my system, had collected all my usernames and passwords for web sites that I normally use and was trying to email them to an anonymous email account that the cracker/trojan author obviously had access to. This trojan was so successful that the email box at Lycos had hit its size limit and was rejecting incoming emails. Luckily for me, the emails with my credentials were being bounced, not delivered. The only thing that saved me was the firewall network monitor showing me the outbound connections. Had I not seen this unusual Internet traffic coming from my computer and stopped it, the cracker would have cleared out his email box, allowing new stolen passwords to arrive and I would have been compromised. I was extremely lucky.

Little Snitch 2 with Network Monitor can help you prevent this type of nightmare. If you’re interested in keeping your banking and other sensitive personal information safe, I’d certainly recommend it.

You can try Little Snitch before buying. The default install allows you to run the firewall for three hours at a time before it will switch off automatically. This will give you a flavour of how it works and what to expect. At that point you can decide whether its worth the $24.95 or not. For the piece of mind I get from knowing what information is being sent out of my computer, Little Snitch is well worth it.

What features could be improved?

  • A list of addresses or programs to not show in Network Monitor. There are a bunch of Internet addresses that my programs talk to on a regular basis. I don’t need to see these constantly in the Monitor. Example: GMail connects to its servers every few seconds to check for new mail. Obviously an allowed action, but, very repetitive and not interesting from a security standpoint. Being able to setup a “whitelist” of addresses with programs for Network Monitor to ignore would be nice. UPDATE 080207: After writing this review, Karl from Objective Development was kind enough to let me know that this feature is already available and I had simply missed it.  To not show a program within Network Monitor simply select the program  within Network Monitor you wish to exclude then click on the “gear” symbol within the pop-up monitor window.  One of the choices from the pop-up menu is “Don’t show [program] within Network Monitor”.
  • Opacity of the Network Monitor window. I’d like to adjust the transparency so it doesn’t affect the visibility of the programs I’m using below the Network Monitor when it pops up.
  • The purchase clearing house Objective Development has chosen for North America: Plimus. These guys are slow, unresponsive, and annoying. Why?
  1. It takes them 12+ hours to complete an order.
  2. No one answers their phones PLUS its very difficult to find the number for customer service reps (they ask you to repeat the order and choose “Pay by Phone” in order to get the customer service number. I’m not kidding). I phoned in multiple times at the 12 hour mark trying to get the order completed, to be greeted only with recorded messages asking me to leave a message (as no one was answering) and someone would call me back. I finally stumbled upon the correct phone menu choices which allowed me to confirm and complete my order without having to talk to anyone. In my opinion, what’s the point of having an automated system that forces order confirmation by a service representative, when the original person ordering can enter the system and confirm the order themselves? Doesn’t that defeat the purpose of having a third party verify and check for fraud?!?
  3. They lie about having tried to contact you to confirm the order. After about 8 hours I received an email from them saying “your order couldn’t be confirmed because your phone number was incorrect or you could not be reached”. Since I have a Skype number which records all incoming call attempts, I know when someone has dialed my number. No one had dialed my number. To make sure I didn’t enter my phone number incorrectly on the order form I found my order on their website. Sure enough, I had listed the correct phone number. Thus, they were lying when they sent the email saying they had tried to contact me. Why would they do this? It allows them to be slow in confirming orders and it maintains their “claimed” service response times by asking the purchaser to “correct” their phone number. In most cases it takes a few hours for users to read and respond to such emails, giving Plimus extra time to get around to processing the order. This is weak. And it pisses people off, laying the blame on the customer in order to justify their slow turnaround time. Whether this practice is employed by the line employees without management knowledge, or whether it is an accepted practice at Plimus, it’s poor customer service. I would encourage Objective Development to find a better service provider for North America. If I had had the choice to cancel and refund my order, I likely would have, all due to Plimus’ poor service. This is unfortunate, considering that Little Snitch is a great a program.

Enough complaining. Little Snitch rocks. Danke ObjDev!

Update: This post has been superseded by How to Fix Ajax Error: permission denied to call method XMLHttpRequest.open.

For anyone developing S-controls and applications for use in Salesforce.com, developing directly within their platform is a bit of a hurdle. Using their Ajax Tools Development Environment for quick changes is fine. But, developing a serious piece of code purely using that tool is far from a pleasant reality today. Hence its natural to develop on a local machine then upload to Salesforce.com when a piece of software is ready for testing within the platform.

When trying to use the Ajax Toolkit connection.js library locally, you’ll encounter a cross domain scripting error:

“Permission denied to call method XMLHttpRequest.open”

Cross domain scripting is not allowed by default in Mozilla based browsers (Firefox, Camino, etc.).

To override this security feature you need to add the following line to your XMLHttpRequest code before issuing an open() call:

netscape.security.PrivilegeManager.enablePrivilege(“UniversalBrowserRead”);

This allows the user agent (browser) to ignore cross-domain scripting warnings, which are a major source of cracking attacks.

There are one or two more steps required to make this work depending on whether you’re using Firefox or Camino. The following step is the same for any Mozilla borwser, be it Firefox, Camino, or any other Mozilla based web browser agent.

In the browser address window type:

about:config

This opens the Mozilla configuration file which you can filter using the field at the top of the screen and edit items by double clicking on them.

Find signed.applets.codebase_principal_support
Top Secret!
By default it should be set to false. Double clicking it should set it to true.

For Firefox users, this next step is also necessary: adding a capability.policy line to the user.js config file which contains all user preference settings for the browser. Regardless of which operating system you’re using, user.js does not exist by default. Therefore, you must create this file, then add the appropriate settings into it. The settings from user.js get copied to prefs.js, which is the actual file read by Firefox.

On Mac OS X the correct directory to create this file within is:

~/Library/Application\ Support/Firefox/Profiles/[alphanums].default/

On Win XP or 200:
C:\Documents and Settings\[User Name]\Application Data\Mozilla\Firefox\Profiles\

See this Mozilla page on Editing config settings for more details and examples on locations for this file.

Note that [alphanums].default is a jumble of letters and numbers “dot” default and it is a directory. For example “o3dfi34z.default”. Within this directory create a file named “user.js”. Within this file add the following three lines:


user_pref("capability.policy.XMLHttpRequestToAnySite.XMLHttpRequest.open", "allAccess");
user_pref("capability.policy.XMLHttpRequestToAnySite.sites", "http://localhost.com:3000");
user_pref("capability.policy.policynames", "XMLHttpRequestToAnySite");

Now note that “http://localhost.com:3000″ is only in my case. Whatever your local development location is, use that, be it “http://localhost”, “http://192.168.1.1″, etc. etc., use that. Be exact with this site address. It matters. For me, that port number was required for Firefox to allow me to send XMLHttpRequests to another domain without being denied.

Try running the XMLHttpRequest again and hopefully your Permission denied to call method XMLHttpRequest.open error has disappeared.

For those of you trying to use the Salesforce.com connection.js Ajax library locally, these are the following edits I made to make this happen. The following line numbers relate to version 11.1 of connection.js.

Find the definition of sforce.Transport, which should be around line 565.
Find the line: this.connection.open("POST", this.url, async); around line 591.
Add the following line before the previous line:

netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");

Change the relative URL paths for the Salesforce API from “/services/Soap/u/11.0″ to the following:

"https://www.salesforce.com/services/Soap/u/11.1"

A nice way to do this is simply add a constant at the top of connection.js and just replace all occurrences of the relative path with this constant:

const sforce_api_url = "https://www.salesforce.com/services/Soap/u/11.1"

After that, fire up your trusty browser and try making your Ajax Toolkit call again.

You may find it helpful to use a Javascript development environment like Jesse Ruderman’s Javascript Development Environment 2.0.1 when playing around with Javascript. [Jesse, you're the man]. Install it as a bookmarklet for the best user experience. It allows you to access all the javascript code and the document model in your current browser window through this development environment (which opens up in a new window).

Don’t forget the about:config stuff with the browser up above.

And finally, this is for debugging purposes on your local machine. Don’t publish code which disables security settings (which are there for a good reason) to a live deployment environment, such as Salesforce.com. Normally you’ll be installing the code you’re building as an S-control anyways, within the Salesforce.com platform, which will be exempt from any cross-site cross-domain scripting issues.

Have an .mkv movie file? Wondering what the heck it is and how to play it?

High Definition movies in 720 or 1080 pixel width format are often encoded and packaged as a Matroska format video with a .mkv file extension.

Apple QuickTime doesn’t handle this format natively so you have to add a package handler for mkv files to QuickTime to play .mkv files.

A quick and easy solution to how to play .mkv files is to install Perian, which makes QuickTime play .avi, .flv, and .mkv files and handles many different and popular encoding formats for video.

Perian for QuickTime

Remember to fully quit and re-launch QuickTime after installing Perian (don’t just close the QuickTime window, it’s still running until you Quit the program). This allows QuickTime to reload its list of handled formats and encodings.

When double clicking on an .mkv file to play it, you may have to wait until the entire film is buffered in QuickTime before it will play smoothly. You can tell the progress of the buffering by looking at the grey timeline bar that is inching across the bottom left of the QuickTime window, starting near the 00:00 time marker. This is one of the oddities of the .mkv Matroska video package format. Don’t ask me why this happens, just keep this in mind next time you want to watch an mkv video on your Mac use Perian.

Debugging Flash / Adobe Flex 2 / ActionScript 3 code using fdb on Mac or Windows is not exactly a straightforward affair. The following are instructions on how to get fdb running for debugging flash files and how to debug flex through the command line tools.

Preamble:

  • Verify that you have a debug capable version of Flash Player 9 (or more recent) on your Mac or Windows machine. You normally get this by default if you’ve installed the Adobe Flex SDK 2 or Adobe Flex Builder 2 / 3 (and have not installed/updated Flash Player since then). All web browsers that you had installed at the time of your Flex Builder / SDK installation should be updated with the Debugger versions of Flash Player 9. To check that your version of Flash Player is debug enabled, just open up any web page that has a flash component within it such as Google Finance and right click on the flash component within the browser window. You should see a context menu pop up with a “Debugger” menu item, which may or may not be greyed out. Adobe Flash Player Debugger
  • Verify that you have Adobe Flex SDK 2 installed or Adobe Flex Builder 2 / 3 installed (which contains the SDK as part of the Flex Builder install). If you’re on a Mac, the Adobe Flex SDK 2 is installed into /Applications/Adobe Flex Builder 2/Flex SDK 2, so open up Finder and check that you’ve got this Folder/directory available in /Applications.
  • create a symbolic link to the fdb program:

sudo ln -s /Applications/Adobe\ Flex\ Builder\ 2/Flex\ SDK\ 2/lib/fdb.jar /usr/local/lib/fdb.jar
sudo ln -s /Applications/Adobe\ Flex\ Builder\ 2/Flex\ SDK\ 2/bin/fdb /usr/local/bin/fdb

The following example debugs a flash file named salesforce-debug.swf. Note that you don’t debug your regular production compiled flash file, you debug, the “debug” version, which is automatically created for you when you compile your flash file or project. These files are normally located within the /bin directory of your Flex project.
If the following example, when you see prompts such as ‘$’ or ‘(fdb)’, do not mistake them for commands, those are my prompts and you should be typing what follows those prompts. Lines not preceded by either a bullet or prompts are output from the fdb program.

To debug a Flash .swf using fdb on a Mac:

  • launch the Terminal program (from /Applications/Utilities/Terminal)
  • change directories / folders until you’re in the same directory as the .swf file you want to debug
  • launch fdb

$ fdb

  • when you start up fdb you should see an fdb prompt: (fdb)
  • you need to specify the .swf file you want fdb to hook into and debug

(fdb) file salesforce-debug.swf
(fdb) run
Attempting to launch and connect to Player using URL
salesforce-debug.swf
Player connected; session starting.
Set breakpoints and then type ‘continue’ to resume the session.
[SWF] Users:ben:Documents:Flex Builder 2:salesforce:bin:salesforce-debug.swf - 1,101,498 bytes after decompression

  • At this point a browser window should pop-up and begin to load your flash .swf file, but it will not finish loading until you’ve set your breakpoints and tell fdb to ‘continue‘. Setup your breakpoints now by using the ‘break’ keyword followed by a function name or a line number. In the following I set a breakpoint in my function ’sfquery’ which will stop the Flash .swf when it hits this function and you’ll get a prompt in fdb debugger.

(fdb) break sfquery
Breakpoint 1 created, but not yet resolved.
The breakpoint will be resolved when the corresponding file or function is loaded.

  • At this point the browser window with the half-loaded Flash file is still hung at “Loading…”. Repeat with as many breakpoints as you need. When done with breakpoints, you must issue a ‘continue’ command to get Flash to continue loading the .swf for debugging.

(fdb) continue
Additional ActionScript code has been loaded from a SWF or a frame.
To see all currently loaded files, type ‘info files’.
Resolved breakpoint 1 to salesforce.mxml:64

  • Ok, this step is key to the debugging setup in Flex… you have to hit Return/Enter at an empty fdb prompt in order to get the your Flash file / Flex project to actually finish loading and to run in the browser window when in debug mode. No, there are no instructions for this, you just have to figure this out on your own through trial and error. Before this the browser window should have the Flash file running but frozen and “loading” until you hit the Enter key while in the fdb debugger, which is the next step:

(fdb) [hit the Enter button here at this blank prompt]

  • Finally at this point your browser should finishing loading up the Flash file you’ve just set up for debugging and it should be ready for action. If you see a blank page that is still “loading”, go back into the Terminal and spank the Enter / Return button a few more times and see if the browser page responds by loading up your Flash debug file. Hopefully it does. And if it doesn’t, you’re back to square one. If you are reading this and have found other solutions to get fdb to actually work, please submit a comment and I’ll add it to this posting.
  • Now when you use your .swf file and hit the function that you’ve set a breakpoint for as mentioned previously, the Flash program will freeze and when you go back to fdb in the Terminal window you should see something like the following:

[trace] Method name is: login
[trace] Method name is: login
Breakpoint 1, salesforce.mxml:64
64 private function sfquery():void {
(fdb)

  • This is where you’ve hit paydirt. At this (fdb) prompt you can now start inspecting variables using ‘p’ <var_name>, step over lines using ‘n’, list lines of code with ‘l’, list previous lines of code with ‘l -’, get help by typing ‘help’, step out of the current function with ‘finish’, and continue executing the program with ‘continue’.
  • After you’re finished debugging the function you’re in, type ‘continue’ to return focus back to your web browser that is running your Flash program and this will return you back into normal running mode.
  • To quit debugging just go into the Terminal running fdb and type ‘quit’

quit
Do you want to attempt to halt execution? (y or n)

  • Enter ‘y’

Attempting to halt.
To help out, try nudging the Player (e.g. press a button)
Execution halted 00041994at 0xExecution halted 00041994 (268692)

  • Just enter ‘quit’ again

The program is running. Exit anyway? (y or n)

  • Enter ‘y’ again and you should be returned back to your Terminal prompt

That’s about it for getting the Flash Debugger to work in Mac OS X.

Here’s a useful page of fdb debugger commands to use while debugging Flex or debugging Flash .swf files.

Common errors when trying to debug Flash and Flex:

  • A common error message with an incorrectly setup fdb flash debug session is the following: “A connection to the Debugger or Flash Player could not be established by Adobe Flash Player 9″. This happens when you simply start the debug version of a flash file, load up fdb, issue a ‘run’ command in fdb, then right click the Flash file and choose “Debugger” from the context menu. Although this would make a lot of sense in how to setup the command line debugger… it simply does not work this way.
  • Another common error to see within fdb command line debugger itself is: “WARNING: The Player that you are using does not support all fdb commands.”. This is not the reason why you cannot debug in fdb. This warning message is only issued when you’ve setup an fdb debugging session incorrectly, like in the previous example.
  • “Where is the debugger or host application running? Localhost or Other Machine” This is another question you should never see if you’ve setup your Flex debugging session correctly. Following the above step by step instructions for debugging a Flash / Flex project or file should avoid this error.Flash Debugger Pop-up question

Good luck and let me know if you have any tips to add to this.

Quicktime under Mac OS X Leopard can’t play movie or video files saved in .avi format encoded with DivX format without a little help. Also if you get no sound from avi files on your Mac, the following avi audio codec will solve that problem for you.

Here’s what you need to make Quicktime on Mac OS X Leopard (10.5) play .avi movie files:

Quicktime Video Codec - Free Xvid Quicktime Component for DivX codec avi files

Quicktime Audio Codec - A52 avi audio codec for Quicktime

Download both of these disk image files (.dmg) and double click them to mount these files (make them visible and accessible through Finder as another Device (top left hand corner of Finder) on your Mac.

Next we need to put these components into the right folders. Within Finder, click on the Xvid Alpha device. Within this Finder window, you should see a file named Xvid_Codec 1.0 alpha.component. You need to copy and paste this item into /Library/QuickTime/ folder on your Mac. The easiest way to find this folder is click on the first device (looks like a metal hard disk) within Finder (mine is called Leopard), then find the folder named Library, and within that, another folder named QuickTime. Paste the Xvid Alpha file into this folder (or drag and drop it if you have two Finder windows open).

QuickTime Codecs avi divx

For the audio part of playing .avi files in QuickTime you need to place the A52 codec component into /Library/Audio/Plug-ins/Components/ folder. Luckily the author of the A52 audio codec for playing avi files in Mac made shortcuts right within the .dmg file for A52 Codec. When you double click the A52Codec .dmg file you’ll see two huge arrows pointing from the codec files to the folders they should be dropped into so simply drag and drop the two files into the folders (which are actually shortcuts to the correct folders on your Mac machine).

If you want QuickTime to recognize and play Dolby AC3 encoded audio from movies, copy the AC3MovieImport component into the /Library/QuickTime folder as well. This definitely won’t hurt and you’ll probably enjoy it later.

After this if you already have QuickTime running, Quit QuickTime (Command + Q), don’t just Close it, since QuickTime will still be running in the background. You need to fully quit QuickTime and restart it for the codecs to be loaded by QuickTime, so this step is necessary.

After all this try double-clicking your .avi movie file again and see if both audio and video are now being displayed by QuickTime.

Enjoy your movies

Ever wake your Mac from screensaver and find a bizarre blue tint or blueish tint to the display screen? The blue tinge can be fixed or removed by opening up Display Preferences (from System Preferences Panel, Second Row [Hardware] => Displays). Simply opening the Displays preference window reverts the color profile to the last good color profile, effectively removing the blue tinge.

UPDATE: This permanent fix does not appear to work once you’ve changed your screensaver (or perhaps at all.  The above solution still works.) A more permanent fix to the sporadic blue tint, which may or may not work for you , is to change the file permissions on the color profiles located in /Library/ColorSync/Profiles/Displays. Note that this directory is not within your home directory, but the “root” of your volume or hard disk. You won’t normally be able to get to this directory through Finder alone so it’s time to use the Terminal to fix this.

UPDATE 2: Permanent Workaround - Sleep Display.  I haven’t seen a blue tint on my Macbook Pro screen for over a year now.  Then again, I no longer use a screen saver, rather, I sleep my display after a few minutes of idle time.  This is done in System Preferences -> Energy Saver -> adjust the slider for “Put the display to sleep when the computer is inactive for: ” 10 minutes or whatever time you like.  Although I no longer have beautiful screensavers dancing across my screen, I also never have to open up Display Preferences to get rid of the annoying blue tint after waking from a screen saver.  Note: I use a “Santa Rosa” MacBook Pro which has an LED backlit screen.  This display instantly reaches full brightness whenever the screen turns on or wakes from sleep.  I could imagine this workaround being annoying for those who have flourescent tube backlit monitors/screens, which would take a minute or two to reach full brightness and operate at full colour depth.

In your Applications folder, find the Utilities folder. Apple Utilities Folder in Applications

Within Utilities is the Terminal program. Double click Terminal to launch the program.

We need to change the permissions of the /Library/ColorSync/Profiles/Displays files so lets first go to that directory by entering the following into the Terminal:

cd /Library/ColorSync/Profiles/Displays

Next, we need to enter the command to change permissions. Enter this into Terminal:

sudo chmod 664 *

Terminal will then ask you for your password. Enter your password, hit Enter and the command will be executed.

After this, try starting your screensaver manually by opening System Preferences => Desktop & Screen Saver, clicking on the Screen Saver tab near the top middle, then clicking on the Hot Corners button at the bottom left. On the bottom right corner (or another corner of your choice), choose from the list / drop down box “Display Screen Saver”.

Click Ok then try starting the Screen Saver manually by moving your mouse into the “Hot Corner” you just created. Wake out of the Screen Saver by pressing the “fn” key (lower left hand corner of the keyboard) if you’re on a laptop or Shift if you’re on a desktop Apple. Repeat this multiple times, waiting varying lengths of time before waking out of the screensaver. Hopefully the blue tint should no longer occur after waking from the screen saver.

Mac Spaces is a great feature that allows you to virtually have dual, triple, quadruple monitors (or more) on your Mac. Mac Spaces works by creating desktops where you can place program windows, allowing you to organize your running programs and open windows into logical “groups” or “themes”.

Mac OS X Spaces Virtual Desktops

An easy way to imagine how Spaces works is to think of your display or monitor as a box with four sides. When you look at one side of the box, the other sides are hidden or out of view. On each of the four sides you can post pieces of paper, spread sheets, web pages, emails, etc. On each of these “sides” it would make sense to put certain programs together to follow a theme. For example, one side of this box could be dedicated to communications (Mail and instant messaging). Rotate the box to the right to see the next side. Now you have another empty space on which to put more running programs, such as iTunes.

The power behind this is that you don’t have a deep stack of program windows placed on top of one another and you can switch to viewing these “Spaces” where programs are fully visible beside one another, grouped into logical themes, all available with a quick button press to switch Spaces.

The majority of your time working (or playing) on your Mac is spent focusing on one thing, window or program at a time. The rest of the programs that you keep running such as iTunes or Mail are kept running because you refer to them from time to time, but you don’t need to stare at your email inbox waiting for mail to arrive you just check it periodically, which makes sense in terms of efficiency.

By default, Mac Spaces is not turned on. To enable Spaces, go to System Preferences => Exposé & Spaces => click Spaces tab on the middle top center (right beside Exposé which is blue highlighted), then check the checkbox on the left to Enable Spaces.

Expose & Spaces preferences window

Moving between spaces takes a little time to get used to. Command + 2 moves to Space 2, Command + 3 moves you to Space 3, etc. Control + Down Arrow moves to the next lower space, wrapping back to the top if you’re already at the bottom.  You can also press F8 to go into “hover view” where you see all of your spaces on the desktop (like the first screenshot up above) whereupon you can choose a Space to move to by mouse clicking on it.

To move windows in Mac Spaces from one Space to another I find it easiest to put your mouse cursor on the title bar area of the window (where the name of the window is) then click and hold the mouse button, click and hold the Control button on the keyboard, then press one of the arrow buttons, depositing the window into that Space. You can also click and drag the window itself to one of the edges of your display, wait until it switches to that Space, then let go of the mouse button to deposit it into that Space. Being a hotkey freak myself, I prefer the mouse + control + arrow key combination which I find faster and more accurate.

In a follow up to my post about how to dual boot Tiger and Leopard on your Mac, this post is about removing large (unnecessary) files from your hard disk and recovering disk space on your hard drive before attempting to repartition Macintosh drives and dual booting.

Many folks have been noticing that repartitioning disks using Leopard Disk Utility often fails with an error of “no space left on device”, even though there is plenty of space “left on the device”.

A solution that many have found is removing any “large” files from your Tiger partition before attempting Leopard Disk Utility repartitioning. By large files I’m talking single files that are in the range of 1GB+.

Before running off and deleting large files on your hard disk willy nilly, please, make a backup of your Mac hard drive using SuperDuper! (free / donation-ware) or move these large files off to a secondary external hard disk connected via USB or FireWire.  If you find that you actually need these files later, you can always move them back or revert to your complete backup you made to an external drive.

A great program that helps with finding and moving / removing large files on your disk is Disk Inventory X. Disk Inventory X generates a visual file map of your disk like the one displayed here. Disk File Map by Disk Inventory XClick on the large squares and rectangles to inspect the details of the files. The usual suspects that you can get rid of safely include scratch disks such as the Photoshop scratch disk and the Apple safe sleep memory image. This safe sleep / hibernate memory file takes the contents of your physical RAM and copies it to disk (in a single file) so that your Mac can “hibernate” for an indefinite period, with or without power, without losing what you were working on. The downside of this is that it creates a file equal the size of your physical memory. That can be anywhere from 1GB to 4GB for Macbook users.

The skinny on how to get rid of this sleep image file: First find your current sleep setting by entering this in a Terminal window:

pmset -g | grep hibernatemode

That should return you something like “hibernatemode 3″. Remember this number, send an email to yourself, write it down on a scratch pad, whatever it takes to remember your default mode. Mode 3 keeps your RAM powered during sleep to allow super fast wake-up, but also writes an image file of all memory onto disk in case power is lost.

To change the hibernate safe sleep setting to not create an image file on the disk, i.e. mode 0 (mode zero, not the letter ‘o’), enter the following in a Terminal window:

sudo pmset -a hibernatemode 0

Enter your password when asked to do so, then delete the image file with the following Terminal command:

sudo rm /var/vm/sleepimage

Macworld has a great article with more information about safe sleep and hibernation on portable Macs.

The best solution to the “no space left on device” errors while partitioning your Mac hard disk is to continue with finding and deleting 1GB+ files that you can live without or can move off to a temporary external disk. Then get back to repartitioning your Mac hard disk in preparation to setup a dual boot of OS X Tiger and Leopard on your Macbook.

Hate animated Flash ads while browsing? Get Camino. Go to Preferences, Web Features, Block Flash Animations and voilà, no more Flash based animated ads.

Stop Video Ads from playing while Browsing

Without Flash Ads

No Annoying Flash Ads

With Flash Ads

With Annoying Flash Ads

I’m not sure about you, but I like my Jolie with as little extraneous distractions as possible.

I’ve mentioned the block flash ads feature with Camino in another post, but I think this feature is important enough that it warrants its own post. There’s nothing more annoying than loud, animated, dancing ads that loop continuously as you try to read (or stare at) content. I realize that a good portion of the web operates on advertising revenues and I’m not opposed to online advertisements, but Macromedia is overbearing. Their Flash software for browsers prevents you from stopping animated ads and you can’t even prevent an ad from looping forever, with poorly designed ads cranking the CPU up to 70C to blare the same annoying message over and over.

The ability to block ads is not unique to Camino. With Firefox Add-Ons such as Adblock Plus you can get roughly the same results as Camino’s Block Flash Ads feature, but when I say “rough”, I really mean “rough”. I discovered that the way Adblock Plus works with respect to Flash ads is that it changes the permissions that Flash has for writing cache files before displaying an animation. Basically Flash no longer has the ability to write cache files, thus it cannot display the animation properly. I found this out when moving from Mac OS X Tiger to Leopard.

Before the install I was attempting to repartition my hard disk, starting off with a “Verify Permissions” check before diving in. Strangely there were errors in permissions related to Flash/ShockWave. The permissions verification was telling me that these directories should have had Read Write access, but they had only Read access. This turned on a light bulb in my head as I had recently tried out Adblock Plus in Firefox. That’s a pretty dirty hack to use in order to block Flash animated ads.

In my experience the ads were still visible for a split second, then removed and replaced with a blank spot where the ad previously was located. Hovering over the area or moving the page through scrolling at times would reveal the ad again, which was probably due to the CSS hijinks going on as well. Overall, Camino’s way to block ads is very slick and doesn’t have the feel of something hacked together to work most of the time, like other ad blocking solutions.

With Camino, the power to stop intrusive, obnoxious web ads is returned to the user. This is a killer feature that was created due to popular demand and will make Camino a true contender in the browser lineup.

Share this:

Camino Fastest Browser on MacOk, it’s a bit early for me to be describing Camino as the Fastest and Best Browser on Mac OS X 10.5 Leopard, but at the same time I can’t help but be overjoyed at the prospect of having full keyboard navigation functionality (i.e. searching, finding, clicking/navigating/opening a link purely through the keyboard) with the blazing speed of a true Mac based browser.

It’s been only three days since I started using Safari 3.04 on my Macbook Pro, due to Firefox’s painfully slow performance (about 3-5 times as slow as Safari or Camino). That switch from Mozilla Firefox to Webkit Safari was not all cookies and cake though. Along with that change I lost the ability to navigate links with search / Enter key combinations, i.e. find links through the search function, which automatically highlights the link and then open them by hitting Escape then Enter. When you’re constantly using web pages with hundreds of links like many programming language documentation sites have, full keyboard navigation of pages and links is pretty powerful.

Here are some more reasons why Camino is the fastest and best browser for Mac OS X Leopard:

  1. Fastest Browser web page rendering

    Rendering is the fancy term of reading HTML page code (<tags>, javascript, stylesheets, etc.) and producing the beautiful, formatted text, layout and pictures in the browser window. One would think that the time it takes to read and display the same web page code on different browsers would be identical between all browsers. Interestingly… it is not. Safari 3.04 and Camino 1.53, the fast web browsers, are up to 6x faster in rendering the same web page when compard to Firefox or Internet Explorer. The best example that I have is within http://www.salesforce.com. I have no idea why these pages load so slow in Firefox, but they do. Sign up for a 30 day trial account (or a limitless developer account) and click through the various tabs on the account home (after logging in). Do this both in Firefox and within Camino, performing the exact same actions. In Firefox, at least for me, it renders the exact same pages but 3-4x slower. When you’re repeating the same actions over and over again (as is common in SalesForce.com) waiting 6-8 seconds for the same page to render is painful.

  2. Block Ads

    You heard me right: the ability to prevent/block/stop hyper annoying flash video ads from auto-playing and looping forever, which takes up tons of CPU processing power and can make your computer run like a slug… just to show a bloody ad. Stop Video Ads from playing while BrowsingThe worst part about flash advertisements is that you have zero control over it. At least on a television you can mute the volume (or speed/skip through it if you’re on Tivo or ReplayTV), but on a web page you’re forced to let it loop through it’s content for as long as you’re on the page. To set this up goto the top menu bar, select Camino, Preferences, Web Features, then check Block Flash Animations. After this, load up a page you know has flash ads such as CityVox.fr and reload it a few times until you see a blank white box with a stylized “F” representing the now muted Flash ad. Camino… je t’aime. This doesn’t mean that sites that normally have videos are now useless as you can still watch the videos by simply clicking on the box containing the Flash symbols to start playing the video. But, it’s an incredible relief to have the power and ability to control my own browsing experience.

  3. Keyboard navigation

    Find links on web pages using inline search (find as you type) and open/navigate them by hitting the Enter button. This is more of a power-user feature, but it’s quite a big feature for those who know about it. Within Camino, when viewing a web page, if you see a link you want to click on (or you happen know the name of the link, often the case when reading documentation), hit the “single quote” key (’) or “forward slash” (/), which turns on “find as you type” search and start typing the word that you are looking for. Using “single quote” will find links only, whereas “forward slash” will search all text. Camino will move the cursor to the word that matches the letters that you are typing and at any time you can hit Enter to navigate/open that link. Need to move to the next matching link? Hit Command + g (the normal “Find Next” hotkey for Mac). Previous match? Hit Shift + Command + g. This is much much faster than scrolling down a web page and moving your mouse pointer to hover over the link then clicking it. Try it and you’ll understand why I think this is such a big feature. Although, if you’re not exactly Speedy Gonzales on the keyboard, this may not be a big draw. For those who are wise in the ways of Keyboard-Fu… rejoice.

Share this:       

Fastest Browser - SafariSo something that came as a bit of a surprise to me was that on certain sites, Safari is 4-5x faster than Firefox on page rendering.  Recently I’ve been doing lots of work on SalesForce.com and I was thinking: “Man, their site is hella slow”.

 After talking with a friend in Paris accessing the same site, but without all the slow loading issues I decided to give Safari on Leopard a try. The exact same pages, the exact same actions produced very different results.  Safari is by far the “fast browser” and Firefox, the slow browser, at least on OS X.  Pages that I would have to wait between 6-7 seconds to finish loading in Firefox would come up around the 1 second mark (or less) in Safari.  This is an enormous difference when you’re talking about browsing as 5-10 seconds is an eternity to wait for something to load, but too short of a time to do anything meaningful besides becoming frustrated.

Now if only Safari could navigate links using the keyboard only like it’s possible in Firefox.  In Firefox you can simply Ctrl + F to do a word search on the page (which is part of a link), when the partial word/link is highlighted, hit Esc to clear the search highlighting and you’re left with a cursor focused link that will respond to an Enter button press with opening the link.  Brilliantly fast, much faster than finding links through the mouse. Somehow we need to generate enough noise so that the Webkit (which is the basis of Safari) developers to take note and build this into the next release of their software. 

Quicksilver from Blacktree Software is a free Mac OS X program loader / launcher / starter. By launcher, I mean, it’s a way to start or run a program on your computer without using the mouse or trackpad. By setting up your favorites within Firefox or Safari or Camino in a certain way, you can make it extra easy and extremely fast to open your most visited sites.

Why would this be interesting or useful? Why wouldn’t I just click on the site’s bookmark or favorites entry and load the website that way?

Because moving the mouse pointer over the Bookmarks menu and clicking through various Bookmarked sites folders to find the name of the site you want to load is simply slow.

With Quicksilver for Mac, if you know the name of the site you want to visit, you can load it almost instantaneously, not with telepathy, but it feels like it.

This is how it works (full setup instructions for Quicksilver are below):

  1. Add a favorite to your browser’s bookmarks toolbar (the bookmarks that you see near the top of your browser on a toolbar), but name it like an acronym. Example: GMail? Name this favorite “G”. Google Finance? Make this favorite “GF”.
  2. Now restart or reload Quicksilver and test the new favorites shortcut. Hit your Quicksilver hotkey, Ctrl + Spacebar by default, then type the letter or letters of the new favorite you just made, for example: “GF” for Google Finance. The Quicksilver launcher window should now show the favorite you just made and to launch this site, just hit Enter. Once you get used to launching web pages this way, it takes less than a second to hit any of your favorite sites.

Full Instructions

Key to making keyboard shortcuts really fast is using Quicksilver, a launcher application for Mac. To load up my favourite web sites I use Ctrl + Spacebar, then one or two typed letters, then Enter. Firefox will then load the page in a new tab or a new window if it’s not already running. If you’re doing development and constantly loading up reference docs or checking your mail often, checking stock prices every 30 min., checking your Google analytics, then this system makes hitting your favourite pages a lot faster than hunting around with a mouse or trackpad for bookmarks.

Quicksilver - Blacktree Software


Step 1: Get Quicksilver launcher

Install it.

Step 2: Install the Firefox/Mozilla or Safari Plugin Module

Firefox Module - Quicksilver

This allows Quicksilver to scan through your bookmarks to create catalog entries which will create launch items for each bookmark. This is the key to having one or two letter web browser bookmarks available through Quicksilver.

Step 1337: Bezel Interface

Bezel Interface - Quicksilver

To get the Bezel Interface with Quicksilver, go to the Quicksilver Menu -> Preferences -> Appearance and choose: Bezel from the Command Interface and click on Superfluous visual effects and Load Icons for all results (if not already set). Why do this? Cause it looks “leet”.

Step 3: One or two letter bookmarks.

Personal Booksmarks Toolbar - Firefox

By one or two letter bookmarks I mean name your bookmarks with the initials of a website’s name, rather than the entire name of the website which is provided by default. For example, hit Command + D which is the make a bookmark shortcut in Firefox. The name that comes up is super long: Mac OS X Leopard & Tiger blah blah blah. You don’t need all that. Change the name to LT and save it in your Personal Bookmarks Toolbar, which is just enough letters to help you remember what this shortcut is for. More examples: Gmail.com I use the letter ‘G’. For Google Analytics I use ‘GA’.

Step 4: Rescan your bookmarks in Quicksilver.

From the Quicksilver menu, choose Rescan Catalog or hit Command + R if you have the Quicksilver application open and running in front of you. This will pick up any changes you’ve made to Firefox / Safari bookmarks.

To test out your shortcut, hit your Quicksilver activation hotkey (for me it’s Ctrl + Spacebar), then type the initials of your new bookmark. Within Quicksilver you should see an Earth graphic + Open URL (if you got leet in Step 1337).

Keyboard Shortcuts Launcher - Quicksilver

Smack enter and Firefox will load up that web page in a new tab or a new window if it’s not already running.

Rinse and Repeat with more web pages that you constantly hit and leave behind your mouse jockeying ways.

Share this:

It couldn’t be more simple (a bit too simple).  Want to quick look a file, any file? Single click the item or arrow over to it and hit Space Bar.  This toggles up the item for viewing in Quick Look.  Hit Space Bar again to un-quick look it.

Wicked.

Quick Look toggled window

The following is a summary of how I created a dual boot setup of OS X Leopard (10.5) and Tiger (10.4) on a MacBook Pro, keeping the original Tiger installation intact and available through alt/option booting during system startup. Always Always Always make a backup before you try any shenanigans like I do below. The best way to do this is with an external drive connected to your machine via FireWire or USB 2.0 and using cloning software such as SuperDuper!Leopard screenshot

Step One: Boot from Leopard

Boot from the Leopard install dvd to allow repartitioning your Tiger-installed hard disk without erasing the disk first. Insert the Leopard install DVD into the dvd drive. Ignore the pop-up Finder window. Shut down your Apple computer (don’t use restart). After your Apple has shut down fully, press the power button to start it.

When you hear the power-on “chime”, press and HOLD the Option button (just left of the Apple/Command key, also known as Alt or two horizontal lines, one diverging before connecting with the other). If for some reason your Mac doesn’t make a noise when you boot up, just press and hold the Option button when the screen lights up. Hold the Option button down until you see a grey screen with two (or more) options displayed. One of which will be a picture of a hard disk and another of the Leopard OS X Install DVD. You may have more bootable disks to choose from if you have more than one partition on your hard disk.Using the arrow keys, move to the Leopard Install DVD and hit Enter. This will boot into the Leopard install program.

DO NOT hit continue when the Leopard install window has loaded.Using the mouse, navigate up to the top menu bar and choose Utilities, then Disk Utility. Once Disk Utility has loaded you should see your Apple computer hard disk, the Leopard install dvd, and possibly other Disk Utilitydisks if you have them attached to your computer.

Choose the hard disk that you want to install Leopard on. By default this should already be selected. For me the Disk is a 111.8 GB Fujitsu MHW2… drive with Macintosh HD underneath it (that’s the volume, within the Macintosh hard disk, you can have multiple volumes inside one hard disk). From here you should see the partition map of your Macintosh HD hard disk, a rectangle standing tall, outlined in blue.

Above the right hand side window will be five choice buttons: First Aid, Erase, Partition, RAID, Restore.

First Aid:You will want to Repair your Macintosh HD before doing any partition changes, regardless of whether you know it is verified or not already. Paritioning will fail if the disk is not error free and verified within this install session. Verifying the disk within Tiger does not mean that Leopard Disk Utility will consider the drive error free as was the case with my install. Thus, repair the disk once you get to this step, even if you had previously verified the disk in Tiger.

Step 2: Resizing + Creating Partitions

After Verify Disk step is completed, we’ll resize the current Macintosh HD Tiger partition and create a second Leopard partition with the free space. NOTE: The resize and creation of a secondary partition will LIKELY FAIL if you have Parallels installed in your Tiger system disk/volume. For the repartitioning to complete without “no space left on device” error, I was forced to delete my Parallels Windows XP SP2 virtual disk, which was roughly 10GB in size.

There are some files that Disk Utility Partition program cannot move when performing its resize and repartiton operation. The Parallels virtual disk file is one of these immovable files. When Disk Utility comes across this file, repartitioning failed with the error: “no space left on device”. The solution in my case was to reboot back into Tiger, load up Parallels, and simply delete the virtual Windows XP installation (I skipped deleting the floppy drive) which deletes the virtual disks as well. I chose this because my Windows XP install is already backed up onto an external USB 2 drive clone of my Tiger system created through SuperDuper!. I’m guessing that you can simply move this file off to some secondary external drive, replace it after, and everything will be handy dandy, although I have not tested this.

EDIT: Yozlet mentions in the comments below that removing large files (1GB+) can also help avoid the dreaded “no space left on device” error while repartitioning the drive. Here are some tips on finding and removing old files on your Mac to avoid the “no space left on device” error.

Dual Boot Leopard and Tiger Partitions

Click and drag the bottom right hand corner of the Volume Scheme (the blue outlined rectangle which represents your disk, Macintosh HD) and drag it upwards, making the volume smaller. I chose around 30GB for the Macintosh volume, out of the entire 110GB disk. This leaves a healthy chunk (80GB) of unused disk space on the drive. Beneath the blue rectangle Volume Scheme there are plus and minus buttons. The plus button when clicked will add a partition to your disk. Click this to add a generic volume onto which we will install Leopard. After clicking the plus button for adding a partition, I again had to adjust the size of the Macintosh HD volume where Tiger resides, back down to about 30GB. After this, click Apply, then Partition on the pop-up window. Go make some coffee while it does the partitioning.

After you’re well caffinated partitioning should be finished and you’ve got a pristine empty partition on which to install Leopard.Exit out of Disk Utility and you’ll see the Leopard install screen again. Click Continue from here and you’ll be asked where to install Leopard. Here we choose Leopard on our hard disk. After that, continue with the install as per normal.

Step 3: Transfer

Near the end of the Leopard install the setup program will ask if you already own a Mac and want to transfer previous settings and applications. For this step choose from another volume on this Mac. Obviously the volume we’ll use is the Tiger volume that we’ve preserved on this computer. After that, I choose User files and settings, Applications and network settings. You can choose what you desire here, but I left it at that. Any programs or settings that didn’t make it over should be easy enough to replace, reinstall after. This step can take the better part of an hour depending on how much data you’re transferring.

Best of luck. Keep that backup handy.

Share this:


Try Blockbuster Total Access Free for 2 Weeks

After doing a clean install of Leopard (on a blank partition) and importing user settings / home directory, this is what I needed to do to install the Ruby on Rails development environment on Leopard OS X 10.5.

TextMate

TextMate transferred OK as an application during the import phase after the install of Leopard. The only thing needed was a re-setting-up of the command line launcher for Textmate. A symbolic link to TextMate’s mate program in Applications placed within the /usr/bin directory does the trick:

sudo ln -s /Applications/TextMate.app/Contents/Resources/mate /usr/bin/mate

MySQL 5

  • Download OS X 10.4 pre-compiled mysql binary from MySQL.com (use FTP link if you can, for some reason Firefox recognized .dmg as text mime type for the HTTP link).
  • Double click the .dmg file to mount the disk image.
  • Run the mysql-5.0.45-osx10.4-i686.pkg installer.
  • Run the MySQLStartupItem.pkg to have MySQL start upon system boot.
  • Add the location of the mysql executable to your path. For me this involved adding a line to my .profile file in my home directory
    export PATH=${PATH}:/usr/local/mysql/bin
  • Then start the mysql daemon
    sudo /Library/StartupItems/MySQLCOM/MySQLCOM start
  • At this point there should be a socket file created in your /tmp directory for connecting to mysql. Check that the following file exists: /tmp/mysql.sock
  • Login to mysql and change the root password:
    mysql -h localhost -u root
  • mysql> USE mysql;
  • mysql> UPDATE user SET Password=PASSWORD('root-pwd') WHERE user='root';
  • mysql> FLUSH PRIVILEGES;
  • mysql> EXIT
  • Create any other mysql accounts you need:
    mysql> GRANT ALL PRIVILEGES ON *.* TO 'prod'@'localhost' \
    IDENTIFIED BY 'some_pass' WITH GRANT OPTION;

    (do not include the backslash ‘\’ in this command, which was used to denote a wrapped line)

  • At this point you might want to clear out your mysql command cache (which contains what password you just set for root) located in your home directory.
    echo -n > ~/.mysql_history
  • Now load your data back into MySQL. For me this consisted of exporting the database from the production site
    mysqldump -u <username> -p -q --single-transaction \
    <db_name> > <backup_filename>

    then create the database within mysql before importing to that database

    mysql>create database my_kickin_database

    From the terminal:

    mysql -u <username> -p my_kicking_database < <backup_filename>

ImageMagick RMagick

Despite all the badpress RMagick gets about using scads of RAM and that ImageScience is a better solution, RMagick is still quite useful. The RAM stuff is also not an issue if you can figure out how to do your image manipulation calls via command line. Plus it’s got a lot more features than FreeImage/ImageScience and in my experience, more stable as well.
Solomon White’s got a great shell script for installing ImageMagick and RMagick from source without MacPorts and that’s the route that I’ve chosen to go. Check the instructions at his page. Thanks Solomon.

Be sure to install Mac OS X XcodeTools from the Leopard install DVD (Optional Installs/Xcode Tools/XcodeTools.mpkg) before attempting this source install of ImageMagick/RMagick; The compilers necessary to build these packages are not installed on OS X by default. In particular what you need are Developer Tools Essentials and UNIX Development Support. All other stuff in the Xcode Tools package are not essential for this install. Install those two packages. Should take about five minutes or so.

You may want to run each of the steps listed in Solomon’s script one at a time in case one of the them fails. You wouldn’t want to finish building ImageMagick from source (not exactly quick) when you find out that your download of the jpeg source libraries failed and ImageMagick got built without JPEG support. (This is a current issue with the jpeg source download source that Solomon’s script is using for the download, so caveat emptor).

UPDATE: The RMagick gem install may fail with an error of “too many examples failed” if the compilation and install of the jpeg package did not install static nor shared libraries (default behaviour). What this means is that the JPEG package is installed binary executable files, but not libraries that other programs such as ImageMagick can use to manipulate photos and image files. This is easy to correct. To make sure that the JPEG package installs the actual JPEG libraries do the following within the jpeg-6b directory (which was created when you untar’d the jpeg6b.tar.gz source file):

  cp /usr/share/libtool/config.sub .
  cp /usr/share/libtool/config.guess .
  ./configure --enable-shared --enable-static
  make
  sudo make install

Thanks to Matt King for posting instructions on fixing the JPEG library ImageMagick / RMagick errors.

That should be all that’s required to install the actual JPEG libraries. Now return to the ImageMagick directory (also created when you untar’d the ImageMagick source files) and try configuring and building again (NOTE: the “configure” line is just one line, no carriage returns in between all those –with –without command line arguments):

./configure --prefix=/usr/local --disable-static --with-modules
--without-perl
--without-magick-plus-plus --with-quantum-depth=8
 --with-gs-font-dir=/usr/local/share/ghostscript/fonts
make
sudo make install

Ruby-debug

This is the god of command line debugging for Rails. Grab it and gem install that baby. Once you get used to it, you’ll love it.

Resolution Phase

Once you’ve got these guys installed you should check whether you need any other gems specific to your Rails project. The gems you can skip since Mac OS X Leopard’s Ruby install includes them already: Capistrano 2.0 (and requirements), RedCloth 3.04, mongrel 1.01, hpricot .6, fastthread 1.0 and perhaps others that I’m forgetting about.

At this point, wander over to your Rails project directory and fire it up (using ruby-debug of course): rdebug -n script/server and check that everything is peachy. If things blow up, don’t panic. Things to check:

  • If you were previously using MacPorts for your MySQL install, you’ll likely have a different sockets file location now. By default MacPorts slapped the socket file somewhere like: /opt/local/var/run/mysql5/mysqld.sock Although now you’re playing with a socket file in /tmp/mysql.sock. Head over to your config/database.yml file in your Rails project and make sure your development environment is pointing at the right socket file and that the socket file is actually there.
  • Read over the webrick log that’s upchucked an error. Good chance that at the top of that error you’ll see a call to some missing gem that you’ve forgotten to load up. Head on over to RubyForge and rectify your situation.

Share this: