Conditional page/post navigation links in WordPress

November 18th, 2007
Update: This post has been replaced with an updated version.

While creating a new theme for this site, I added some CSS styling around the page/post navigation links.

For example, in my index.php page, I have the following HTML/WordPress code:

<div class='navigation'>
  <span class='older'><?php next_posts_link('&laquo; Older Entries') ?></span>
  <span class='newer'><?php previous_posts_link('Newer Entries &raquo;') ?></span>
</div>

And the following CSS code:

.navigation {font-size:.7em; background:#353535; height:16px; margin:0 -16px 8px -16px; padding:8px 6px 0px;}
.navigation span {margin-top:-4px;}
.navigation .older {float:left;}
.navigation .newer {float:right;}

Everything looked great, until I brought up a page that did not have a previous or next link. The styled navigation div was still there, but there was nothing in it. So, I set out to conditionally display the navigation div if either a previous or next link existed.

Read the rest of this entry »

New site design

November 14th, 2007

I finally got around to updating the theme for this site. It was quite an adventure learning about WordPress Themes and its API. The more I use WordPress, the more I like it!

Thanks to my brother-in-law, Max, for helpful tips on my new logo and also to Michael Heilemann for his default WordPress theme, which I used as a reference.

As time allows, I’ll be adding content to the about, resume, projects and contact pages.

If you have any comments or criticism ( hopefully constructive ;) ) on the new site design, I’d like to hear them…

Running Ubuntu 7.10 in VMWare Player

October 30th, 2007

I wanted to check out the latest Ubuntu release, so I downloaded the following VMWare image:
http://isv-image.ubuntu.com/vmware/Ubuntu-7.10-server-i386.zip

After extracting the 2 files, I opened Ubuntu-7.10-server-i386.vmx in VMWare Player. A dialog appeared asking me if I had moved or copied the image opened, so I selected “I copied it”.

After which, I received an “error” saying something like “This CPU is VT-Capable but VT is not enabled …”. It appears that even though the image I downloaded was for an i386 machine, it was defined as a 64-bit machine in the vmx file. After the OS loaded, I logged in (ubuntu/ubuntu) and did a shutdown:

Read the rest of this entry »

Clearing VMWare Player Recent Virtual Machines list

October 26th, 2007

The VMWare Player does not include an option to clear the list of “Recent Virtual Machines” (why not?!?!). Since the list of virtual machines that I had opened was growing quite long, I set out to find a way to clear it myself.

After searching in a few places (Windows XP), I came across the file that holds this information. It’s called preferences.ini and is located in:
[drive]:\Documents and Settings\[user]\Application Data\VMWare

UPDATE: In Windows Vista, the file is located in:
[drive]:\Users\[user]\AppData\Roaming\VMWare

At the bottom of the file, you should see entries like (where X is a sequential number):

pref.mruVMX.filename = "..."
pref.mruVMX.displayname = "..."

Just delete/reorder the entries as desired, save, then start VMWare Player to see the changes. VMWare Player will need to be closed before you make the changes, or they will not be saved.

Shared object error during cPanel Apache build

October 23rd, 2007

I was trying to add PHP Zip support on my cPanel server today and when Apache went to restart, it failed with the folowing error:

Cannot load /usr/local/apache/libexec/mod_bwlimited.so into server: /usr/local/apache/libexec/mod_bwlimited.so: cannot open shared object file: No such file or directory

After a Google search, I found that I needed to run:

cd /usr/local/cpanel/apache

/usr/local/apache/bin/apxs -iac mod_auth_passthrough.c
/usr/local/apache/bin/apxs -iac mod_bwlimited.c
/usr/local/apache/bin/apxs -iac mod_log_bytes.c

I was able to start Apache afterwards and everything is back to normal…

SimpleModal v1.0 released

October 19th, 2007

While developing a recent project at work, I had the need to display a modal dialog. I started using jQuery recently and so I started by looking for a jQuery modal dialog plugin.

I did find a couple of existing ones (jqModal and BlockUI), but neither did exactly what I was looking for. So…I decided to take a crack at writing my first jQuery plugin.

It has been a great learning experience and has caused me to become an even bigger fan of jQuery. I’ve used a few other JavaScript libraries (MooTools, Prototype, etc), but jQuery is something special.

So, if you have a need for a modal dialog…be sure to check out SimpleModal.

View Demo

Configuring WordPress

October 9th, 2007

I’ve been playing with configuring WordPress (WP) for this site. After doing some research, I had a plan for how I wanted it to work. Basically, I wanted to use WP to manage my site (like a CMS) as well as for a blog.

After a lot of trial and error, I think I’ve achieved the effect I was looking for. I installed WordPress in the /blog directory. Copied the index.php and .htaccess file into / and edited index.php:

require('blog/wp-blog-header.php');

In wp-admin, under Options > General, I changed “WordPress address (URL)” to http://www.ericmmartin.com/blog and “Blog address (URL)” to http://www.ericmmartin.com. I then created 2 pages, one called Home and one called Blog. Lastly, under Options > Reading, I set the Front Page option to “A static page (select below)” and Home for the Front page and Blog for the Posts page.

Currently, I’ve installed the WP-Syntax, Akismet, Add Your Own Headers and Exec-PHP plugins.

The rest is still a work in progress, but so far, I’m happy with WordPress!

Annoying system beep

September 15th, 2007

Even with the volume turned off, if your PC has a system speaker, it can still emit a loud system beep. I was running some MySQL statements from the command line and every time there was an error…BEEP.

To fix this, I could simply run the MySQL commands with the -b, –no-beep option, which turns off the beep on errors.

But, I’m lazy and don’t want to type -b every time I run a MySQL command. Plus, there are other instances where the system beep can be triggered, and I just don’t want to hear it! So, I used this solution…and it didn’t require a reboot!

In summary:
1. Right-click on My Computer
2. On the Hardware tab, click on [Device Manager]
3. On the “View” menu, select “Show hidden devices”
4. Under “Non-Plug and Play Drivers”, right-click “Beep”
5. Click “Disable”
6. Answer [Yes] when asked if you really want to disable it
7. Answer [No] when asked if you want to reboot
8. Right-click “Beep” again.
9. Click “Properties”
10. On the “Driver” tab, set the Startup type to Disabled
11. Click [Stop]
12. Click [OK]
13. Answer [No] when asked if you want to reboot