Archive for February, 2010

  • Hit Shift-Apple-3.  This will capture the desktop and save in a file called Screen shot <date time>.png
  • Hit Shift-Apple-4.  This will allow you to drag out an error and save that to a file.  If instead you hit space, will will let you pick what window to capture.

If you have a form like

<input type=”text” name=”go” value=”some stuff”>

how do you deal with “some stuff” when the value is “I’m going to “say” hello”

(ie two many quotes).  the answer is

single quote ‘ -> &#39

double quote ” -> &#34

as you can see by example with this html code fragment

<input size=50 name=text value=”abc123 `~!@#$%^&*()_+-=[]{}\|;&#39:,./<>?&#34″>

so interestingly enough, you don’t need to escape the other chars if the value is wrapped in “.

placeholder for centos 5.4 install on macbook pro.

Why CentOS 5.4 64bit you ask? Because that is the production system that I use for my website.  As I have mentioned on some other posts, I try not to live on the bleeding edge  unless there is good reason.  I had previously ran fedora on a live system, and the updates just killed me.

My macbook pro is a late 2009 model (I got in in October) 2.8 GHz with 4Gb mem and 320Gb drive (soon to be 120Gb patriot SSD).

First of all partition the disk ahead of time.  Just roughly the command is:

sudo diskutil resizeVolume disk0s2 200G "MS-DOS" "CentOS" 80G "MS-DOS" "Windows 7" 30G

put in centos disk into drive

boot the computer, and hold down ‘c’

enter (default install)




Choose create custom layout (from the top combo box)


click on /dev/sda3

click edit

set mount point to /

change format partition to ext3

click ok

click next

click yes

click format

click next


choose location Next

root pass next

pick packages

next (does the install)

(cd will eject when done)

click Reboot

My system hun on “Restarting system.” so after a few minutes I held the power button down for5 seconds to power it down.

the started back up

synced the gpt

click reboot on the refit menu

I setup a partition for linux on my macbook, but mad the mistake of letting bootcamp make the parituion.

you need to do it manually, and once I started the process, I’ve so far been unable to undo it.

This is a placeholder entry for when I solve it 🙂

I get the following error when trying to use boot camp to resttore to a single partition

“The statup disk cannot be partitioned or restored to a single partition.

The startup disk must be formatted as a single Mac IS Extended (journaled) volume or already  partiioned by Boot Camp Assistant for installing Windows


I thought I’d be brave and just go ahead and install CentOS 5.4 linux on my macbook pro (late 2009 edition). Part of the thinking was that if I have problems, I’ll get to learn more about the macbook. I backed up my drive, and I plan to replace the drive with an SSD anyway, so I was feeling pretty fearless.

After a few tiny hiccups, It was installed (I decided not to install grub figuring it might mess with the boot loader (and I had already installed refit).  But reboot .. nothing .. just a dreaded error

No bootable device insert boot disk and press any key

I tried a few keys to see if I could get any kind of bios settings. Nadda. So a little googling, and holding down the “option” key when booting gave me a nice looking icon with Macintosh HD, so clicked on that, and bingo. Back in mac land. And then the mac continued to reboot just fine after that.

I imagine other people might have the same problems when installing Windows XP, vista or windows 7.  I also imagine that I did something not quite right.

If you want to output jsp code from inside jsp code then you need to use jsp:text and CDATA.  I never remember the format, so I’m posting it here for next time 🙂

<%@ page info="a template to make another jsp page"

<%@ page info="the generated jsp page"
<%@include file="header.jsp" %>
<!-- this jsp outputs some dynamic content -->
<%@include file="content.jsp" %>
<%@include file="trailer.jsp" %>]]>

So the output from this jsp is:

<%@ page info="the generated jsp page"
<%@include file="header.jsp" %>
This is the output from content.jsp
Today is Thursday
<%@include file="trailer.jsp" %>

Which is the copied (as a file) to the servlet engine for use with the template engine.

I do this because I’m using jsp as a templating engine. The trouble is that I can’t find an easy way to dynamically include a jsp page “inline” from a jsp. (where this jsp page itself is generated from a text file). Yes it sounds a little convoluted, but I’m trying to make the source pages as simple as possible, yet still have access to the rich functions that I provide elsewhere (like domain name assignment for images and css).

On my 64bit CentOS 5.4 linux install just installing ant and tomcat fails.
It fails when I go to start the tomcat service or just run ant.

I tried many different things to fix the problem, including removing all the jre/jdks/ant/open jdks and sun jdk’s. My original solution was to stop using the rpm’s and just download direct from apache (and in the case of ant, set ANT_HOME and JAVA_HOME in /usr/local/apache-ant-version/bin/ant). A typical error would look like this:

[cameron@mars java]$ /usr/bin/ant
/usr/bin/build-classpath: error: JAVA_LIBDIR must be set
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/tools/ant/launch/Launcher
Caused by: java.lang.ClassNotFoundException:
 at Method)
 at java.lang.ClassLoader.loadClass(
 at sun.misc.Launcher$AppClassLoader.loadClass(
 at java.lang.ClassLoader.loadClass(
 at java.lang.ClassLoader.loadClassInternal(
[cameron@mars java]$

I have two systems that I set up basically identically, it worked fine on one (a parallels jvm running centos 5.4 64bit on my macbook pro) and nothing but problems with a native install. In the end the solution was very simple.

edit your /etc/java/java.conf file.


# System-wide Java configuration file                                -*- sh -*-
# JPackage Project 

# Location of jar files on the system

# Location of arch-specific jar files on the system

# Root of all JVM installations

# You can define a system-wide JVM root here if you're not using the default one

# Options to pass to the java interpreter

I’m a blogaholic today.

Anyway, it seemed quite scary to enter a hostname user/pass so that something could install a theme into wordpress. This seems backwards to me. It should just download the files and put them in a directory that is writable (like uploading an image).

Reading the wordpress documentation, it seems that the problem is for people that are using hosted services. As these generally won’t allow direct access to the file system from php. Still doesn’t quite make sense to me, but it’s not my case anyway.

I’m using CentOS 5.4 64bit and the latest wordpress as of this writing.

Change wp-config.php to use the “direct” mechanism (rather than ssh or ftp). Add the following files to the end of wp-config.php

if(is_admin()) {
  add_filter('filesystem_method', create_function('$a', 'return "direct";' ));
  define( 'FS_CHMOD_DIR', 0751 );

It certainly looks a bit obscure, but it worked well for me.
I chowned my files to the webserver user first, did the update, then chowned them back

chown -R apache /path/to/wp-content

Did the update, then:

chown -R somesecretuser /path/to/wp-content

and now I have a new theme 🙂

I wanted to add a user in chroot jail for ftp.

Although it doesn’t look to be exactly chroot jail (according to the doco), it’s close enough for me:

First install vsftpd (was already installed)

yum install vsftpd

then start and configure it:

chkconfig vsftpd on
/etc/rc.d/init.d/vsftpd start

I created a user (call it wordpress)

adduser wordpress
passwd wordpress
vi /etc/passwd # change homedir to where the jail is eg /var/html/path/to/

enabled the chroot jail for that user in /etc/vsftpd/vsftpd.conf


added the wordpress user to the chroot jail user list in /etc/vsftpd/chroot_list


In the end, I didn’t need this, but thought it useful to remind me how to chroot someone’s ftp account.

When I hit refresh on eclipse, it frequently (almost all the time) will crash. I’m using CentOS 5.4, 64 bit linux (and no doubt this appears in other linux distributions as well). I have subversion installed.

For my website, I don’t particularly use eclipse, but I do like the visual aspect of merging back into subversion. (perhaps someone can suggest a better, or at least lighter tool).

Anyway, the fix is quite easy (thanks to someone elses pain).

Add the following to your eclipse.ini file:


So now my eclipse.ini file looks like this: