Tuesday, July 30, 2013

Install nginx

Install PCRE – Perl Compatible Regular Expressions.

sudo curl -OL h ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.33.tar.gz

mv pcre-8.33.tar.gz /usr/local/src/

tar xvzf pcre-8.33.tar.gz

cd pcre-8.33

sudo ./configure --prefix=/usr/local

sudo make install

Download nginx

tar xvzf nginx-0.8.33.tar.gz

cd nginx-0.8.33

./configure --prefix=/usr/local --with-http_ssl_module

sudo make install

vi .bash_profile

Add /usr/local/sbin to $PATH

sudo nginx

Sunday, February 26, 2012

Importance of Software

Ariane 5 launch caused by 16 bit arithmetic overflow.
http://www.youtube.com/watch?v=kYUrqdUyEpI


We expect software to be buggy!
Also, Unexpectedly short lived code is an epic failure.

AI ML courses

Competed these courses in Fall of 2011:
www.ai-class.com
The course covers all areas of AI, based on book by Peter Norvig.
www.ml-class.org
The course was taught by Andrew Ng, Stanford prof. Assignments in Octave(just like Matlab, I hear, but free)

Completed this course from Univ of Washington, Spring 2011:
Introduction to Logic
The course was about First order logic.

Tuesday, September 8, 2009

fstab

fstab is a configuration file that contains information of all the partitions and storage devices in your computer. The file is located under /etc, so the full path to this file is /etc/fstab.

# device name mount point fs-type options dump-freq pass-num
LABEL=/ / ext3 defaults 1 1
/dev/hda6 swap swap defaults 0 0
none /dev/pts devpts gid=5,mode=620 0 0

/etc/inittab

The inittab file describes which processes are started at bootup and during normal operation (e.g. /etc/init.d/boot, /etc/init.d/rc, gettys...). Init(8) distinguishes multiple runlevels, each of which can have its own set of processes that are started. Valid runlevels are 0-6 plus A, B, and C for ondemand entries. An entry in the inittab file has the following format:
id:runlevels:action:process

# inittab for linux
id:1:initdefault:
rc::bootwait:/etc/rc
1:1:respawn:/etc/getty 9600 tty1
2:1:respawn:/etc/getty 9600 tty2
3:1:respawn:/etc/getty 9600 tty3
4:1:respawn:/etc/getty 9600 tty4
This inittab file executes /etc/rc during boot and starts gettys on tty1-tty4.

init: The kernel starts PID 1 (init).
init: The init process reads the /etc/inittab and /etc/default/init and follows the instructions in those files.

what is a runlevel? the point at which the system is entered. Runlevel 1 is the most basic configuration (simple single user access using an text interface), while runlevel 5 is the most advanced (multi-user, networking, and a GUI front end). Runlevels 0 and 6 are used for halting and rebooting the system.
>init 6 This will reboot the system.
/etc/rc.d/rc.local file. This script file is run once, before all other scripts have run but before the logon prompt appears.
When the system is shut down, there is another symlink in the /etc/rc0.d and /etc/rc6.d directories (halt and reboot, respectively) that starts with a K instead of an S, which tells init to shut down the process.

Quick:
When you boot your computer, the first thing that it will do is load the bootloader -- either GRUB or LILO in most cases. The bootloader will then load the Linux kernel -- the core operating system. Next, a process called init starts. This process reads the file /etc/inittab to establish the runlevel to use. The runlevel is the start mode for the computer.
Once init knows the runlevel it will look for the appropriate files or directories as defined in /etc/initab.
Init will then either run the script files defined by /etc/initab, or run the script files in the directories defined by /etc/initab (depending on the set up of your system).
Finally, init will present you with the logon mode that you've selected.

Wednesday, August 19, 2009

Sign = in SQL

In C/java there's difference between = and ==. First one is assignment operrator, and == is equality operator.
In SQL Select query:
select * from table_a where col1 = 'abc';
here = is used to check for equality. that's weird!

for loop vs while loop

Which loop to choose, for or while:
1. If we know that we must loop a max of x no of times, then for loop. for loop takes index of how many times to loop.
2. We can use index with while loop too, but it seems more unnatural. eg i++ needs to go inside statements, but in for loop, it goes in for structure.
3. Moreover if we need to break for loop based on some condition, we need to use break statement; a little unnatural again.