28 March 2012

mysql hex

mysql> SELECT X'4D7953514C';
      -> 'MySQL'
mysql> SELECT 0x0a+0;
      -> 10
mysql> SELECT 0x5061756c;
      -> 'Paul'

 default type ada string. kalau nak paksa sebagai nombor, guna CAST(.... AS UNSIGNED)
mysql> SELECT 0x41, CAST(0x41 AS UNSIGNED);
      -> 'A', 65

 ........................
tambahan:
mysql> SELECT HEX('cat');
      -> '636174'
mysql> SELECT 0x636174;
      -> 'cat'

 ref>> http://dev.mysql.com/doc/refman/5.0/en/hexadecimal-literals.html

26 March 2012

bsd route

static route:
route add -net 10.0.0.0/24  192.168.1.20

permanent static route:
file: /etc/rc.conf
static_routes="lan1 lan2"
route_lan1="-net 10.0.0.0/24 192.168.1.20"
route_lan2="-net 10.0.1.0/24 192.168.1.20"