vi search pattern for replacing line numbers in code snippet

19 12 2008

This is a useful search and replace pattern for deleting the line numbers in a code snippet…

use this command in vi (the unix based txt editor):

%s/^[0-9][0-9]\s*//g

this will delete (replace pattern with nothing) all the line numbers in the following code snippet (thus cleaning it and allowing you to compile it without first manually editing every line):

...
03 import java.util.List;
04 import java.util.ArrayList;
05 import java.util.Iterator;
06
07 public class Todo {
08 private String name;
09 private String note;
...





Installing netbeans 6.5M1 on ubuntu error:/usr/share/themes/Human/gtk-2.0/gtkrc:43: error: lexical error or unexpected token, expected valid token

6 08 2008

problem:

I get the following error when trying to run the linux netbeans 6.5M1 installer (netbeans-6.5_m1-php-linux.sh) on ubuntu 8.04:

/usr/share/themes/Human/gtk-2.0/gtkrc:43: error: lexical error or unexpected token, expected valid token

and then the installer window shows a blank screen.

(I’m guessing this post may relate to other versions of netbeans and ubuntu)

solution:

the problem was the jvm 1.5 I was running under, updating to jvm 1.6 solves the problem… I installed the sun-java6-jdk and the jvm dependencies then when executing the installer I specified the java home as follows:

./netbeans-6.5_m1-php-linux.sh --javahome /usr/lib/jvm/java-6-sun





chmod: copy user / owner permissions to group

24 07 2008

This is a useful unix command to copy the file / dir owner permissions to the group:

find * -exec /bin/sh -c 'chmod g+`ls -ld "{}" | cut -c2-4` "{}"' \;

As pointed out in the post below, chmod actually has built in support for this operation:

chmod g+u file