Bash - Display Function Definition

May 2, 2007

A tip.

If you create a function in bash and want to see its definition. Try

declare -f 'your-function'


Continue reading →

After Cygwin Upgrade – Command Not Found

January 31, 2007

After upgrading Cygwin and starting I found that while sourcing my .bashrc file a lot of “: command not found” messages.

It turns out that this is caused by CR/LF endings needing to be CR. Strange, yesterday’s bash didn’t have a problem with this and today the new version does.

The fix is to run d2u on each file to ‘fix’ the line ending. If you have a .profile that sources your .bashrc don’t forget to run d2u on it as well.

Actually, this isn’t much of a fix as you’ll get very annoyed converting all your scripts.

A better solutions is to create a Windows environment variable SHELLOPTS and set it to igncr.

This sets up Bash to handle the strange line feeds .


Continue reading →

Adding Google Analytics To A Wordpress Site

January 27, 2007

The following are instructions on using reading the WordPress Plugin for Google Analytics

  • Download and unpack the google-anlytics.tgz file to get google-analytics.php.
  • Copy that to your wordpress/wp-content/plugins folder.
  • Login to your WordPress site and select Plugins. Active the Google Analytics plugin.
  • Navigate to Options and select Google Anaylitics and add the _uacct value you were given from Google.

For more details see plugin author’s Google Analytics WordPress Plugin page.


Continue reading →

More Jazz On Youtube

January 10, 2007

Anthony Braxton : Impressions - http://www.youtube.com/watch?v=0o0AYFRFX7g Lounge Lizards - Voice Of Chunk - http://www.youtube.com/watch?v=kRY_PZIKeqM Ornette Coleman : Pat Metheny 1988 - http://www.youtube.com/watch?v=4SL3ojOKmWY Steve Lacy - http://www.youtube.com/watch?v=SlFUPVv6010


Continue reading →

Bad Markup Causing Multiple Calls To Spring Controller

January 10, 2007

Had an interesting problem come up with a client using Spring MVC. For some reason they where experiencing GET requests to a Controller resulting in two calls to the Controller. It was as if the browser was making to requests for each user initiated request. Of course, implementing a simple version of the controller and a basic view did not reproduce the problem. Going back to the application and logging continued to verify that the handleRequestInternal was in fact being entered twice.

Nest, the Controller and it’s View where slimmed down a bit to localize the problem. A single test url was setup to point to this controller. Then iteratively parts where changed. Any unnecessary processing was removed so the Controller was excercised from a link and simply returned the View. This still showed the problem. Next, the view was replaced with a very minimal Jsp. When this happened the problem went away. Could something in the existing View cause the Controller to be called again? This didn’t seem likely but it certainly seemed to be true.

Returning to the original view, and selectivly removing one section at at time until the problem went away eventually localized the offending part of the View.

Inside the HTML tag for a TABLE where was a background=”#C3D9FF”. This invalid attribute looked to cause the browser to recall the page as it expected the background to be associated with the BODY.

Replacing the background with bgcolor tag fixed the problem.


Continue reading →

Ornette Coleman – Video On Youtube.Com

November 2, 2006

The latest JazzTimes cover story on Ornette Coleman mentions a video on YouTube.com of Ornette on Saturday Night Live back in 1979.

Here is the link.

Ornette Coleman 1979 – SNL

For JazzTimes see Jazz Times – November 2006


Continue reading →

Lispbox – Access Denied – Use Winzip To Extract

November 2, 2006

In setting up Lispbox on a Windows machine I found it wouldn’t run. From a command prompt, running lispbox.bat, returned “Access is denied”.

I discovered that the Security settings on the EXEs were set to not allow them to run.

I realized that I had unzipped the downloaded zip with the unzip included in Cygwin.

After unzipping the Lispbox download with a copy of WinZip the problem went away.


Continue reading →

Errors Install Ruby On Rails On Linux

August 18, 2006

If you see errors like the following while installing Ruby and Rails

custom_require.rb:21:in `require__': No such file to load -- zlib (LoadError)

See the following links as I found them helpful.

  • http://downloads.rimuhosting.com/miscproj/rails.html
  • http://bliki.rimuhosting.com/space/knowledgebase/linux/miscapplications/ruby+on+rails

Continue reading →

Building Emacs On Linux

August 2, 2006

This is worth repeating if someone needs this tip and finds it earlier than I did.

When building on some versions of Linux, Emacs will seg fault during the build. It is mentioned in the etc/PROBLEMS but was unclear. Eric Raymond posted a cleaned up PROBLEMS file that makes it more clear. (His post is here ).

In short I entered the following and Emacs built fine.

setarch i386 ./configure
setarch i386 make

Continue reading →

Scp Timeouts

July 31, 2006

If you have put scripts using scp that timeout due to a slow connection or if you are tunneling out through a proxy. Ty the following flags passed into scp.

-o ServerAliveCountMax=1500 -o ServerAliveInterval=20

Continue reading →

Pretty Printing Classpaths Within Ant

July 16, 2006

I found a great Ant tip over at

http://andrewbeacock.blogspot.com/2005/08/pretty-printing-java-classpaths-using.html

With it you can debug your classpath references quite nicely.


Continue reading →

Hsqldb Not Writing Changes To Disk

July 16, 2006

If you are working with HSQLDB v1.8 and you don’t see changes written to disk or if after you app runs you can view your data it’s because HSQL since 1.7 is not closing the database after the last connection is closed.

To fix this append the following to your JDBC url.

;shutdown=true

See the following link for more details:

http://blog.taragana.com/index.php/archive/hsqldb-database-connection-close-doesnt-write-to-disk-solution/


Continue reading →

Cygwin Ssh Doesn’T Find Config

July 12, 2006

After installing Cygwin and setting up a new home directory with a .ssh directory and a config file. You may find that you need to run ssh with -F to help it find the ~/.ssh/config file.

If this is the case. Double check that $HOME is set correctly. Next look at your entry in /etc/passwd. If you find that it has a different home directory you’ve found the problem. Turns out ssh doesn’t look at $HOME but to the setting in /etc/passwd.

One easy way to fix this is with mount. Mount the incorrect home in /etc/passwd to the correct one. For example, my incorrect home is /etc/brad and the correct is c:\home\brad. This is fixed with the following.

mount -s -f c:\\home\\brad /home/brad

Continue reading →

Telling Firefox Where To Store Your Bookmarks

July 11, 2006

By default Firefox stores your bookmarks in your profile. This is buried in under your name in Windows under ‘Documents and Settings’.

In my working from elsewhere project I needed to store my bookmarks under my own ‘home’ directory so I could manage them with CVS. With this I can work elsewhere, checkin at the end of the day, return home and do and update and continue.

To accomplish this you need to create a small file call user.js and store in your Firefox profile. This file tells Firefox to use another location to store your bookmarks. Here is a sample user.js file:

// Specify which bookmarks file to use:
user_pref(

“browser.bookmarks.file”, “C:\\home\\brad\\firefox\\bookmarks.html”

);

To locate your profile directory see -> http://www.mozilla.org/support/firefox/edit#profile

To read about user.js see -> http://www.mozilla.org/support/firefox/edit#user

Lastly, see the heading “Use your Netscape 6/7 or Mozilla bookmarks in Firefox” on this page http://www.mozilla.org/support/firefox/tips


Continue reading →

Checkstyle Plug-In For Eclipse

June 30, 2006

I just found a useful plug-in for Eclipse that analyzes your Java code. It’s available at http://eclipse-cs.sourceforge.net/index.html.

I used the Remote install feature of Eclipse to install it. Here are the instructions.

  • Within Eclipse go to Help->Software Updates->Find and Install
  • Choose Search for new features to install and press Next
  • Create a New Remote Site…
  • Input a name to your liking (for instance Checkstyle Plug-in) and input the following URL: http://eclipse-cs.sourceforge.net/update
  • Click your way through the following pages to install the plug-in.

A quick tip that you need to know is that you have to enable your project for CheckStyle. Right click on your project and select Properties. In the dialog select CheckStyoe and then check ”Checkstyle active for this project”.

Then rebuild your project and look in the Problems view. You’ll see CheckStyle problems there. They’ll continue to be updated each time a file is compiled.old-

Very nice.

Also, see http://checkstyle.sourceforge.net/index.html for details on CheckStyle including a list of the checks it makes.


Continue reading →