Tuesday, September 2, 2008

Chrome


Chrome is fast. Even though I had problems installing it on my laptop win xp sp3, I managed to get a copy of the exe file from http://cache.googlevideo.com/chrome/install/149.27/chrome_installer.exe. I run it and it installed fine. Not sure what the problem was because other people with sp3 could install it just fine. It was probably a disabled service.

Cool things to try in the address bar:

about:network - Network Tools
about:stats - Shhh! This page is secret!
about:cache - Cache.
about:histograms - Data about chrome features.
about:plugins - Installed Plug-ins.
about:dns - DNS records.
about:version - Google Chrome browser version.
https://gmail.com - This one is pretty bad actually... No one is perfect.

To access google's task manager: right click in the blue space at the top and click Task Manager.

Bad news: still doesn't work on linux(nor wine) or macs.

Friday, August 29, 2008

Understanding a Crazy Programmer



Found this on the net. If you have any problems with a programmer in your team, this article/blog might help.

Learning Lisp - Do you know any programmers that exhibit these personality traits?

Tuesday, August 5, 2008

Catching Ctrl+C in Ruby 1.9

Ctrl+C sends a SIGINT signal to the kernel.
To catch it and execute code we use:
Kernel.trap('INT') { code }
Remember to call Kernel.exit if you want to terminate the execution of your ruby script. Kernel.trap can also catch other signals. For more information visit: Kernel.trap

Saturday, August 2, 2008

Storing Passwords securely


The best way to store a password: Salt it then Hash it.

To salt it add random characters to the password entered by the user. Remember we are going to need those random characters later so save them somewhere you can retrieve them later. I would say insert them in fixed locations in the hash. To hash it use the md5 or sha1 function. You can find these functions in the encode ruby extension.

To authenticate the user, you will need to pull the hash associated with the username, retrieve the salt characters, apply them to the password entered by the user, hash it and compare.

Is there a better way?

Tuesday, July 29, 2008

Terminal Awesomeness


The best way to make your desktop look nice is to add true transparency to your terminals. I got urxvt with true transparency enabled working with xcompmgr and it looks wonderful.

xcompmgr is a lightweight composite window manager.
urxvt is an xterm-like terminal lightweight and fast.

I'm using openbox as a window manager and hsetroot to set my desktop wallpaper. These are the contents of my ~/.config/openbox/autostart.sh :

hsetroot -fill ~/Desktop/desktop.jpg &
xcompmgr &
rxvt &
docker &


"docker" takes care of the system tray.

To enable transparency in urxvt you need to add these lines to your ~/.Xresources file:
URxvt*depth: 32
urxvt*background: rgba:0000/0000/0000/cccc
URxvt*background: rgba:0000/0000/0000/cccc
URxvt*foreground: green


Change the background and foreground to whatever color you want.

I believe desktop managers like kde or gnome are overrated. Openbox is great and doesn't consume your precious resources so u can use them for more important things like compiling code.

Friday, July 25, 2008

More VIM stuff


Set tab size:
set tabstop=2
Quick Write and quit
:wq
If you press Ctrl+S while on a terminal and it freezes then press the following to unfreeze:
Ctrl+Q
Working with tabs
:tabe file # Opens File
:tabn # goes to next tab
:tabp # goes to previous tab
:q # closes current tab
gt # will take you to the next tab
gT # will take you to the previous tab

Auto completion
Ctrl+N Ctrl+P
You can also invoke make and grep within vim
:grep args
:make

If you work on windows (gvim.exe) place your vimrc file in the VIM exe directory. You might need to set the environment variable VIM to the path where gvim.exe. Name your vimrc file as _vimrc

Moving to VIM


I decided to make vim my default text editor. Here are a couple of tips:

To get syntax highlighting in vim, add the following to your ~/.vimrc file or enter while editing (command mode, remember to press ':' before entering):
set background=dark # if your console background is dark..
syntax on

To get line numbers:
set nu
To split the screen in 2
split
vsplit # Vertical Split

To Move from split windows
Ctrl+W+(direction)
Open a file
open file
Close a file
close
Search Reg Ex
/regex
Goto Line Number
:number
Search word under cursor
*

I will post more eventually... vim kicks emacs butt by the way.