Wicket

INteresting java framework for web applications:

wicket.apache.org/examples.html
platform.netbeans.org/tutorials/wicket-in-netbeans.html

Screen

Quickly:

Initiate a screen session:

screen
Detach a current screen:
Ctrl+a+d
Reattach a session:
screen -r
List screen sesions:
screen -ls

Tabs in vi

:set expandtab
       To insert spaces whenever tab key is pressed.
:set tabstop=n
       Cahnges the number of spaces a tab is replaced with
:retab
       Changes tab to match new settings
:set shiftwidth=n
    Changes the number of spaces for indentation

My options:
:set tabstop=4
:set shiftwidth=4
:set expandtab
:retab
:set ai

Quick Reference to Regex

[] --> Brackets. They enclose a list of characters that represent a single character in the expression.
    Inside the brackets, one can specify:
    -    --> For Ranges
    ^    --> For negation
 
.  -->   Period. Matches a single character
() -->   Parenthesis. Used to enclose an expression
| -->    Or

Positions:
^ Marks the beggining of the line
$ Marks the end of the line
/< Marks the beggining of a word
/> Marks the end of a word

Repetition Operators:

? Optional and matched at most once
* Zero or more times
+ One or more times
{n} n times.
{n,} n or more times.
{n,m} At least n times, but not more than m times

Examples:
t[a-z]x matches tux
doesn't match tUx
[^w]in matches lin
doesn't match win
 t.x matches  tux
doesn't match tuux
 (t.x|m.x) matches  tux, mux 
 ^t.x matches tux rules 
doesn't match rules tux 
 tu{2}x matches tuux 
doesn't match tux

^.{2,15}$ Between 2 and 15 characters
^[0-9] Starts with a number
[^[:alnum:]] Contains special characters


Quick Reference to crontab

*     *   *   *    *  command to be executed
-     -    -    -    -
|     |     |     |     |
|     |     |     |     +----- day of week (0 - 6) (Sunday=0)
|     |     |     +------- month (1 - 12)
|     |     +--------- day of month (1 - 31)
|     +----------- hour (0 - 23)
+------------- min (0 - 59)

Options to specify time:

* Every time
i,j,k Each n time
*/x Every xth time
x-y From x to y

Network Aliases

To have an network interface listening on more that one IP, aliases can be added to the configuration.
So, inside
 /etc/network/if-up.d/
create a simple script to add  aliases to the interface.
#!/bin/sh

ifconfig eth0:1 192.168.0.10 netmask 255.255.255.224
ifconfig eth0:2 192.168.0.11 netmask 255.255.255.224

The Zen of Python

Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!


By Tim Peters.