Friday, December 17, 2010

How to configure your blogspot blog to use a custom domain from Namecheap

I recently noticed that the geekythoughtbubbles.com domain name was available. It was a similar tech blog to this. So, I decided to buy the domain with Namecheap (affiliate link).

Reading the Blogger documentation, there are no specific instructions for configuring your Namecheap domain so that Blogger can use your new custom domain. Here is how to do it.

  1. Log into your Namecheap account.
  2. Go to My Account > Manage Domains
  3. Select your new domain.
  4. Under Host Management, select URL Forwarding
  5. Change the row with www by changing the text field to contain ghs.google.com (leave Record Type as CNAME)
  6. Click Save Changes
  7. Follow the rest of the instructions under Update Your Blogger Settings: How do I use a custom domain name on my blog?

Tuesday, December 7, 2010

Enabling virtualization support for Dell Latitude E6400

At work, I have a Dell Latitude E6400 laptop running Windows XP (32-bit). In order to run 64-bit VirtualBox machines, I needed to enable virtualization support. Here’s how to do this:

1. When booting up, select F12
2. Select BIOS setup
3. In the Virtualization Support tree:
    - Virtualization, select Enable, Apply
    - VT for Direct I/O Access, select Enable, Apply
    - Trusted Execution, do not select Enable
4. Select Exit to continue booting into Windows.

Friday, December 3, 2010

How to share a folder from host to guest in VirtualBox

This is documented quite well in the VirtualBox documentation. But I’ve made my own notes here since it’s a task I do often enough, but sometimes still forget.


  1. With the guest machine turned off, open the Settings dialog.
  2. Go to the Shared Folders tab.
  3. Click on the Add Shared Folders button.
  4. Browse for the directory you want to share, and give it a name. In my case, I called the share work and I selected c:\work on my host’s filesystem. Click OK.
  5. Restart your guest machine.
  6. Now you need to mount this shared folder in the guest OS.


In Windows, the share is always named \\vboxsrv\sharename. You can navigate to this via My Network Places. You could also use the net command:

net use q: \\vboxsrv\sharename

In Linux, you use the mount command:

mount -t vboxsf sharename mountpoint

e.g.,

mount -t vboxsf work /mnt/work

Friday, February 12, 2010

How to install NumPy on Solaris

I've been working with NumPy (Numerical Python module) on Solaris, and now have a set of steps to install this and get this working. Note that this is the very basic installation of NumPy and doesn't contain additional libraries like BLAS or LAPACH. You can read more about installing these at the NumPy building instructions page. These instructions are to help you get all of the prerequisites installed and a basic build of NumPy going.

First you will need to install a Fortran compiler. You can download the Sun Studio 12u1 and put it in /tmp. Then:

cd /tmp
bzcat SunStudio12u1-SunOS-x86-tar-ML.tar.bz2 | /bin/tar -xf -
cd SunStudio12u1-SunOS-x86-tar-ML
./SunStudio12u1-SunOS-x86-tar.sh --accept-license
mv sunstudio12.1/ /opt
export PATH=/usr/ccs/bin:/opt/sunstudio12.1/bin:$PATH

From sunfreeware.com, download and install python-2.6.2-sol10-x86-local.gz to /tmp as well. Unpack and install:

gunzip python-2.6.2-sol10-x86-local.gz
pkgadd -d python-2.6.2-sol10-x86-local

Also, similarly install libiconv-1.13.1-sol10-x86-local.gz, gcc-3.4.6-sol10-x86-local.gz, libgcc-3.4.6 and openssl-0.9.8l. When you get to installing libgcc, you get warnings about overwriting existing libraries. This is okay, so, just say yes to overwrite them.

Add the following to /root/.bashrc as well as your current shell:

export PATH=/usr/local/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH

Then with these new settings:

cd /tmp
svn co http://svn.scipy.org/svn/numpy/trunk numpy # (if svn is not installed, then svn co on another machine and scp -r to copy it to /tmp)
cd numpy
python setup.py build --fcompiler=sun
python setup.py install

To test the installation, create a file called /tmp/test.py with:

import numpy

Then test that it works. You should get no import errors:

python test.py

Monday, January 11, 2010

I've switched to iTerm

I was using GNU screen for a while. I liked having only one window open for multiple sessions in Mac OS X. However, setting up the configuration is not an easy feat. In recent months, however, I've switched to iTerm. I was against a tabbed command line environment because I didn't want to use the mouse to change tabs. But in iTerm you can cycle through the tabs with Command-arrow. You can get iTerm from their sourceforge page. I know that screen can do much more than iTerm, but I'm not really using those features, so for now iTerm will suffice.

Monday, January 4, 2010

Install numpy 2.6 on Snow Leopard (Mac OS X 10.6) from source

Here are the problems I was facing with using NumPy with Python 2.6.1 on Mac OS X 10.6.2 (Snow Leopard). This might be a bit convoluted, but bear with me.

First, in order to call STAF from a Python script, I built PYSTAF.so from source. However, the only way to get it to work is to run Python in 32-bit mode:

export VERSIONER_PYTHON_PREFER_32_BIT=yes

This then caused problems with NumPy:

Python 2.6.1 (r261:67515, Jul  7 2009, 23:51:51)
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
Traceback (most recent call last):
File "", line 1, in
File "/Library/Python/2.6/site-packages/numpy-1.4.0.dev7542-py2.6-macosx-10.6-universal.egg/numpy/__init__.py", line 130, in
import add_newdocs
File "/Library/Python/2.6/site-packages/numpy-1.4.0.dev7542-py2.6-macosx-10.6-universal.egg/numpy/add_newdocs.py", line 9, in
from lib import add_newdoc
File "/Library/Python/2.6/site-packages/numpy-1.4.0.dev7542-py2.6-macosx-10.6-universal.egg/numpy/lib/__init__.py", line 4, in
from type_check import *
File "/Library/Python/2.6/site-packages/numpy-1.4.0.dev7542-py2.6-macosx-10.6-universal.egg/numpy/lib/type_check.py", line 8, in
File "/Library/Python/2.6/site-packages/numpy-1.4.0.dev7542-py2.6-macosx-10.6-universal.egg/numpy/core/__init__.py", line 8, in
import numerictypes as nt
File "/Library/Python/2.6/site-packages/numpy-1.4.0.dev7542-py2.6-macosx-10.6-universal.egg/numpy/core/numerictypes.py", line 737, in
_typestr[key] = empty((1,),key).dtype.str[1:]
ValueError: array is too big.

According to Numpy Ticket #1221 (http://projects.scipy.org/numpy/ticket/1221) this is fixed in revision 7793. However, I was trying to use r7542 as was installed by the SciPy SuperPack installer (http://macinscience.org/?page_id=6).

Still following along? Okay, so here's how I think I resolved my issues. I built and installed NumPy using the instructions on HyperJeff's blog: http://blog.hyperjeff.net/?p=160

First we need to move old versions of Numpy. In my case:

sudo mv /System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/numpy \
/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/numpy_APPLE_DEFAULT
sudo mv /Library/Python/2.6/site-packages/numpy-1.4.0.dev7542-py2.6-macosx-10.6-universal.egg \
/Library/Python/2.6/site-packages/numpy-1.4.0.dev7542-py2.6-macosx-10.6-universal.egg-OLD

Then set the environment, build and install.

export MACOSX_DEPLOYMENT_TARGET=10.6
export CFLAGS="-arch i386 -arch x86_64"
export FFLAGS="-arch i386 -arch x86_64"
export LDFLAGS="-Wall -undefined dynamic_lookup -bundle -arch i386 -arch x86_64"
cd ~/tmp
svn co http://svn.scipy.org/svn/numpy/trunk numpy
cd numpy
python setup.py build --fcompiler=gnu95
sudo python setup.py install

If this doesn't work for you, you might want to run through all of the steps in HyperJeff's page above. I probably had much of the prerequisites from previously running the SciPy SuperPack installer.

Wednesday, October 14, 2009

Simple flashcard perl script

I think my friend Dan gave me a perl script a long time ago that was for Spanish flashcards. I have no idea where that is nowadays, but I decided to whip out a simple script. I think it is way simpler than Dan's version. There is no "grading" in this script. That is, there is no comparison with the answer you provide and the answer in the file. All you need to do to use this is to create a flashcard file. Each row contains the question and answer separated by a pipe.

Wednesday, September 16, 2009

Upgrading to Snow Leopard means upgrading ClamXav to 2.0 Beta

I upgraded to Mac OS X 10.6.1 yesterday. This morning my clamXav log said that "This version of the ClamAV engine is outdated." Not only that, I was unable to launch the ClamXav UI. Further investigation found this problem in my Console:

[Deprecated] CocoaJava: com.apple.cocoa.foundation.NSRuntime
-[NSJavaVirtualMachine initWithClassPath:] FATAL: cannot initialize ObjCJava. Exit


So, it appears that ClamXav 1.x will not run on Snow Leopard. Upgrading to ClamXav 2.0 beta fixes this. The new 2.0 interface also allows for version checking and will automatically guide you to update your clamav scanning engine quite painlessly.

Tuesday, June 30, 2009

Fixing RHL up2date InvalidRedirectionError

I wanted to install pstack on Red Hat Linux and decided to use up2date for the first time. I kept getting an InvalidRedirectionError when it tried to update pstack's gdb dependency. Looking in the /var/log/up2date file I had:

[Fri Jun 26 14:05:22 2009] up2date   File "/usr/sbin/up2date", line 1312, in ?
sys.exit(main() or 0)
File "/usr/sbin/up2date", line 813, in main
fullUpdate, dryRun=options.dry_run))
File "/usr/sbin/up2date", line 1160, in batchRun
batch.run()
File "/usr/share/rhn/up2date_client/up2dateBatch.py", line 93, in run
self.__getPackages()
File "/usr/share/rhn/up2date_client/up2dateBatch.py", line 225, in __getPackages
up2date.getPackage(pkg, wrapperUtils.printPkg, wrapperUtils.printRetrieveHash)
File "/usr/share/rhn/up2date_client/up2date.py", line 180, in getPackage
buf = rpcServer.doCall(repos.getPackage, pkg, msgCallback, progressCallback)
File "/usr/share/rhn/up2date_client/rpcServer.py", line 238, in doCall
ret = apply(method, args, kwargs)
File "/usr/share/rhn/up2date_client/repoDirector.py", line 37, in getPackage
return self.handlers[channel['type']].getPackage(pkg, msgCallback, progressCallback)
File "/usr/share/rhn/up2date_client/rpmSource.py", line 186, in getPackage
package = source.getPackage(pkg, MsgCallback, progressCallback)
File "/usr/share/rhn/up2date_client/repoBackends/up2dateRepo.py", line 201, in getPackage
fd = self.s.getPackage(channel, filename, offset=startpoint)
File "/usr/lib/python2.3/site-packages/rhn/rpclib.py", line 622, in __call__
result = self._send(self._name, args)
File "/usr/lib/python2.3/site-packages/rhn/rpclib.py", line 290, in _request
raise InvalidRedirectionError("Too many redirects")


I'm not sure what had happened previously on this particular lab machine, but it looks like a previous attempt to update gdb was corrupt, or perhaps interrupted. When I deleted /var/spool/up2date/gdb-6.3.0.0-1.162.el4.x86_64.rpm, then the up2date command worked like a charm.

How to uninstall Subversion on Mac OS X

I ran into this problem today where I was trying to uninstall Subversion 1.6 so I could install 1.5 instead. So, according to the instructions, you only need to delete the /opt/subversion directory and all of the sym links in /usr/local/bin that point to /opt/subversion. After doing this I tried to run the Subversion 1.5 installer and kept getting this message:

You cannot install Subversion 1.5.4 on this volume

The way to solve this problem is to delete Subversion-1.6.1.pkg from /Library/Receipts. Then I was able to run the Subversion 1.5 installer.

Thursday, June 4, 2009

How I work in a Mac OS X environment

I've been using a Mac as my exclusive desktop at work for the last few months. I've learned a few tricks to keep my hands on the keyboard and away from the mouse as much as possible. This is to prevent any repetitive use injuries like Carpal Tunnel Syndrome. Here are a few things that I've started doing to make things easier for me.
  1. Hide, don't minimize! Coming from Windows OS, I used to minimize windows frequently and keep them down in the task bar. In Mac OS X, you can easily minimize a window to the Dock with Command-M. However, you cannot easily restore the window with a simple keystroke. While Command-Tab allows you to cycle through your open applications, it doesn't really let you cycle through your windows. So, if you select an application via Command-Tab, you may or may not get the minimized window to restore. If you are using Command-Tab, as you select your application, keep holding down the Command button and then also select the Option key as you release. This will allow you restore a window. However, it is extremely awkward to me. So, instead of minimizing windows, now I just hide them. Using Command-H will hide the application, and cycling through Command-Tab will bring it back.
  2. Quicksilver is a fast and easy tool to launch applications. I highly recommend this free utility. I don't navigate to the Applications folder anymore to start a program. With Quicksilver, I just type Control-Space to open a window where I can type in the first few letters of the application I want. I know that using Command-Space will open Spotlight and you can achieve the same thing. It's just a matter of preference.
  3. Gnu screen instead of multiple terminals. I have recently started using screen. I usually need a lot of ssh sessions open to various machines here at work. Instead of having half a dozen terminal windows, I only have one terminal running screen. There are a few getting started type tutorials out there on the internet, and I suggest that if you find your desktop cluttered with terminal screens you should spend a little time learning screen.

Monday, April 20, 2009

All about the process

Oftentimes, when we are debugging a system, it is helpful to gather data on the various processes running on a system. One of the first commands that I learned in Unix was ps. Since most of my QA career has centered around testing java applications, I have typed the following command uncountable times: ps -ef | grep java. This usually results in this type of information. Note that the second column is the PID, which is helpful in case you need to kill a process. Also note that the last column will get truncated if it's too long.

bash-3.00# ps -ef | grep java
noaccess 709 1 0 Mar 31 ? 10:37 /usr/java/bin/java -server -Xmx128m -XX:+UseParallelGC -XX:ParallelGCThreads=4
root 12309 1 0 15:26:21 ? 59:33 /usr/jdk/instances/jdk1.6.0_12/jre/bin/amd64/java -server -Xmx30g -Xms30g -XX:+
root 12549 12540 0 09:27:33 pts/1 0:00 grep java
root 12273 1 0 14:37:37 ? 59:22 /usr/jdk/instances/jdk1.6.0_12/jre/bin/amd64/java -server -Xmx30g -Xms30g -XX:+
root 6463 1 0 Apr 10 ? 113:57 /usr/jdk/instances/jdk1.6.0_12/bin/java -server -Xms512m -Xmx512m CommandLineRe


Another useful command for java processes only is jps. It will give you results with the PID as well.

bash-3.00# /usr/java/bin/jps
12541 Jps
12273 DirectoryServer
12309 DirectoryServer
709 Bootstrap
6463 CommandLineResourceMonitorClient


You can also try jps -Vv to get more information as well. See the jps man page. The last useful command that I have in my repertoire is pargs. Say you know the PID, you can get all of the arguments that were used. E.g.,

bash-3.00# pargs 12273
12273: /usr/jdk/instances/jdk1.6.0_12/jre/bin/amd64/java -server -Xmx30g -Xms30g -XX:+
argv[0]: /usr/jdk/instances/jdk1.6.0_12/jre/bin/amd64/java
argv[1]: -server
argv[2]: -Xmx30g
argv[3]: -Xms30g
argv[4]: -XX:+UseConcMarkSweepGC
argv[5]: -XX:+CMSConcurrentMTEnabled
argv[6]: -XX:+CMSParallelRemarkEnabled
argv[7]: -XX:+CMSParallelSurvivorRemarkEnabled
argv[8]: -XX:ParallelCMSThreads=8
argv[9]: -XX:CMSMaxAbortablePrecleanTime=10
argv[10]: -XX:CMSInitiatingOccupancyFraction=80
argv[11]: -XX:+UseParNewGC
argv[12]: -XX:+UseBiasedLocking
argv[13]: -XX:+UseLargePages
argv[14]: -XX:+HeapDumpOnOutOfMemoryError
argv[15]: -Dcom.unboundid.directory.server.scriptName=start-ds
argv[16]: com.unboundid.directory.server.core.DirectoryServer
argv[17]: --configClass
argv[18]: com.unboundid.directory.server.extensions.ConfigFileHandler
argv[19]: --configFile
argv[20]: /ds/cynthia/repl/1/config/config.ldif

Monday, March 30, 2009

STAF and STAX

With my new position at UnboundID, I have been in learning mode for the last couple of weeks. And I haven't posted anything too geeky here lately. But one thing that I have been trying to acquaint myself with is STAX, which is a plugin to STAF.

I have used STAF (Software Testing Automation Framework) a little before when I was at Phurnace. I never really thought of it as a real testing framework though. It's more like a very useful library, especially if you are doing distributed testing. It very capably allows you to move files around different machines and execute commands remotely. But a framework it is not.

I don't know why I have never really looked into STAX (STAf eXecution engine) before. It is actually more like a testing framework. It is a STAF service plugin that allows you to define define testcases in XML with some embedded Python scripts (Jython, actually).

If you don't currently have a test framework in-house, the STAF/STAX solution is one you should consider. I personally think that test scripting in XML is a bit unnatural, but I'm starting to get the hang of it. Using Eclipse as a development environment helps a lot. I still don't really know Python yet, but the fact that I have inherited existing tests helps a lot, in addition to some good reference websites that I have found.

My only problem right now with STAX is that, given our current test framework which downloads, installs and configures STAX automatically, I can't seem to get it to work on Mac OS X. It just doesn't start up the STAX service. I know that it should work, but perhaps I've got an incompatibility somewhere with the Java version and STAX version. This inherited test framework on top of STAX is using older versions of STAF and STAX and related libraries. So, right now, I'm running a Solaris VM on my Mac, until I can figure out the right combination of version numbers (if that, hopefully, is indeed the problem).