Monthly Archives: December 2008

Mac OS Password Assistant

Mac OS has a useful utility for generating secure passwords – Password Assistant. While it’s certainly useful, it’s only accessible from within preference panes that require you to enter a password.

I spent some time with Activity Monitor to see if I could determine if Password Assistant was a separate program being called. No joy there, so I turned to my old friend Google.

That’s how I found a utility from codepoetry that calls Password Assistant directly. It’s small, it works and best of all it’s free.

I May Have Found The Answer…

…. to our current economic woes.

Just keep making mistakes like this until you find someone gullible enough to pay off the bank.1

VoilĂ , problem solved!

  1. Targeting students is probably not the way to go. Instead the banks should be looking for billionaires with a whole lot more money than sense. The US would be a good place to start I think. []

Copying Mac Address Book to LG Viewty (LG-KU990)

My phone contract was up recently, and as an incentive to sign on for another year, my provider offered me a free upgrade. So I took the LG Viewty also known as the LG-KU990.1 I’ll do a full review later, but for the moment, I want to talk about one issue I’ve experienced with it.

LG Viewty (LG-KU990)

LG Viewty (LG-KU990)

I go through so many phones that I like to keep my address book on my MacBook and sync it with my phone. While the Viewty does have Bluetooth, it’s not supported by iSync. Even worse, Bluetooth File Exchange couldn’t see any of the files or folders on the phone2.

I had the same problem with my Nokia 3120, so I was somewhat hopeful that I’d find an iSync plugin to get me up and running.

After a lot of searching, I discovered that LG use their own OS on the phone which is overlaid with Flash screens to enable interactivity. Worse still, LG don’t implement the SyncML protocol used by the other major manufacturers, and by iSync. So there’s no way to sync my brand new phone with my MacBook.

My only concern is the phone book, I don’t use iCal, and I really don’t want to have to manually enter every name in my Address Book. Luckily, there is a work-around, and here’s how:

  • Open Address Book,
  • Use CMD-A to select all the entries in your Address Book,
  • Navigate to “File” -> “Export” -> “Export vCard…”,
  • When prompted save the vCard.

The next step involves connecting to the Viewty via Bluetooth. If you have not paired the devices before, then you should do so now.3

  • Click the Bluetooth icon in the Menu Bar and navigate to “Browse Device”,
  • Select your phone name from the list and click “Browse”,
  • Tap “Yes” on the Viewty to accept the incoming connection request,
  • On your Mac, click the “Send…” button in Bluetooth File Exchange,
  • Locate the vCards file that you saved earlier, and click “Send”,
  • Once the transfer has completed, the Viewty should prompt you to “Restore Contact backup file”, tap “Yes”.

And that’s it. Your Address Book has now been copied to your phone.

  1. I’d usually link to the official site, but it’s flash based and doesn’t work on Mac OS X – and there doesn’t seem to be a text based version available []
  2. Even though Bluetooth File Exchange won’t display any files or folders, the phone is still connected via Bluetooth and files can still be transferred in the normal manner. []
  3. Short and simple explanation: Turn on Bluetooth on your Mac, turn on Bluetooth on your phone, click the Bluetooth icon in the Menu Bar, select “Set Up Bluetooth Device” and follow the Setup Assistant. []

Updating Your WordPress Theme to Use More Than One Sidebar

Since I started working on my own themes, I’ve learnt a lot about how WordPress works. I’m still not at the level where I can write a theme from scratch, but I’m learning to modify themes for my own use. My first themes were based on either Public Domain or GPL themes, and I mainly stuck to modifying the CSS stylesheet.

My latest theme now uses five different sidebars to display information. There are four on the homepage (home.php) and one on the single post page (single.php). Most themes that I’ve come across implement one sidebar, or at most two. So how do you add more sidebars?

The first step is to edit your themes function.php file. Search the file for the following code:

if ( function_exists('register_sidebar') )

Some themes might also use the following code instead:

if ( !function_exists('register_sidebars') )

Within this section you’ll need to locate the code that tells WordPress how many sidebars you are using. Themes using a single sidebar will generally use this WordPress API function:

register_sidebar();

Themes using more than one sidebar, will use the following API function:

register_sidebars();

Both API functions take an array as a parameter. This array specifies the HTML code that appears before and after each widget that will appear in the sidebar. register_sidebars(); takes an additional parameter that allows you to specify how many sidebars should be used.

In either case, you’ll need to change this code to the following:

register_sidebars(x, array);

Replace x with the number of sidebars that you want in your theme. The array part of the code can be left as is.

The next step is to add the actual sidebars to the theme files that you want to contain the new sidebars. (Usually these would be either index.php, home.php, single.php, orarchives.php.)

Add the following code to the appropriate theme file:

<div class="sidebar_css_class"><ul class="sidebar_list_class"><?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar(x) ) : ?><?php endif; ?></ul></div>

The class names used in this code example can be anything that you want, and will have to be added to your theme’s style.css file. Replace x with the specific number of the sidebar that you want to insert, e.g., if you want to insert a second sidebar into the theme, then your code will look like this:

<div class="sidebar_css_class"><ul class="sidebar_list_class"><?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar(2) ) : ?><?php endif; ?></ul></div>

Upload the files to your theme directory, overwriting the original files if prompted. (To be extra safe, you should already have backed up the original files.) To configure the new sidebar, go to the Widgets sub-page under the Design page in your WordPress Admin and select your sidebar from the drop-down list.

Footnote: register_sidebar(); does allow more than one sidebar to be specified. It’s used in cases where each sidebar needs a different name and allows the theme designer to specify different layouts/ appearances for each sidebar. More information can be found on the relevant WordPress codex pages: register_sidebar(); and register_sidebars();.

Centring Images Using CSS

While working on my latest theme, I wanted a way to centre images. CSS 2 doesn’t have any native way to centre align an image. But there is one way to force the image to be centred:

img.centred {display: block;margin-left: auto;margin-right: auto;}

This CSS code specifies that the image should be displayed as a block and the left and right margins are automatically sized, forcing the image to be centred.