Wednesday, January 14, 2009

[Java] Install Java 6 doc on Ubuntu 8.10 aka Intrepid Ibex

Ubuntu 8.10 doesnt provide the java 6 doc but an installer that will take care of unzipping and copying the java doc in the right location.

If you want to install the java 6 doc on Ubuntu 8.10, you will have to:
  • download the doc package at http://java.sun.com/javase/downloads/index.jsp. There, click on the "Download" button in the "Java SE 6 Documentation" section. The name of the just-downloaded file will look like jdk-6u10-docs.zip
  • Copy this file under /tmp
  • Rename it to jdk-6-doc.zip
  • Change the ownership of the zip to root
    chown root:root jdk-6-doc.zip
  • Run sudo apt-get install sun-java6-doc
  • Et Voila!

Friday, January 9, 2009

[LDAP] Comments that are not comments

Today, we try to run one of the application we worked on in a new environment.
This application uses OpenLDAP and we had to reconfigure everything (create a new root dn, a binding user ...) but as Murpy's law says, "if anything can go wrong, it will". And I can confirm it happened.
We found out that when we set up the access to the ldap server in slapd.conf, comments (starting with #) does not necessarily comment the line out.
We had some lines as follow:

access to attrs=userPassword,shadowLastChange
   by dn="cn=admin,dc=myserver,dc=com" write
   #by dn="uid=cyril,ou=People,dc=myserver,dc=com" write
   #by anonymous auth
   by self write
   by * none

You would think that it would be like the below but it's not

access to attrs=userPassword,shadowLastChange
   by dn="cn=admin,dc=myserver,dc=com" write
   by self write
   by * none

According to the slapd config documentation
Blank lines and comment lines beginning with a '#' character are ignored. If a line begins with white space, it is considered a continuation of the previous line (even if the previous line is a comment).

Thursday, January 8, 2009

[vi] Basic vi command

See below the basic you should (me anyway) need to get started with vi.
I usually use vim(vi improved) but in some Sun servers, you may have only vi available.
  • h
Move the cursor to the left one character position
  • j
Move the cursor down one line.
  • k
Move the cursor up one line.
  • l
Move the cursor to the right one character position.
  • X
Delete the character before the cursor.
  • x
Delete character under the cursor. A count tells how many characters to delete. The characters will be deleted after the cursor.
  • a
Enter insert mode, the characters typed in will be inserted after the current cursor position. A count inserts all the text that had been inserted that many times.
  • i
Enter insert mode, the characters typed in will be inserted before the current cursor position. A count inserts all the text that had been inserted that many times.


You can find the above here

[perl] - Generate a random password

The following code will generate a random password composed of uppercase/lowercase/special characters and digits.

sub generate_password {
  my $length = shift || 10;
  my @chars = ( "A" .. "Z", "a" .. "z", 0 .. 9, qw(! @ $ % ^ & * ) );
  my $password = join("", @chars[ map { rand @chars } ( 1 .. $length ) ]);
  return $password;
}

You can pass a number as parameter to the generate_password function that will determine the length of the new password.
Default length here is 10

Friday, December 12, 2008

[Tips] List of protocols supported by Konqueror

I always use Konqueror as an alternative web browser to Firefox and to access my mobile phone via Bluetooth.
I just find out that Konqueror supports lots of other protocols.
See http://en.opensuse.org/Konqueror_Tips_and_Tricks

Monday, December 8, 2008

Webcast of OpenSolaris

Here is a little webcast from a OpenSolaris evangelist that shows the cool features of OpenSolaris 8.11, in particular ZFS in action
http://webcast-west.sun.com/interactive/09A12416/index.html

Monday, November 10, 2008

[perl] Few tips

*To Jump to a variable/function declaration, type:
gd
Found at http://www.moolenaar.net/habits.html

*To check if a user has an account on a host, you can use getpwnam
Found at http://www.perl.com/doc/manual/html/pod/perlfunc/getpwnam.html
See also getgrnam and other variants get*


*Some perl variables:
$<, $>
Description of those special perl variables at http://affy.blogspot.com/p5be/ch12.htm
Those threads may help you understand
http://www.linuxforums.org/forum/redhat-fedora-linux-help/106602-difference-between-uid-effective-uid.html
http://stackoverflow.com/questions/205070/whats-the-deal-with-all-the-different-uids-a-process-can-have