Thursday, December 3, 2009

Device Drivers and UART

One of the classic step by step explanation of the device drivers is explained in the following linux journal


One of the classic explanation for UART is explained here

Wednesday, December 2, 2009

Void Pointers CANNOT be deferenced

A void pointer in C cannot b derefrenced, nor can any arithmetic operation be performed on it

It's mainly used in function prototypes to indicate a pointer whose type is only known at runtime.

So, one could write a trivial function to sort an array of ints:

#include
#include

int cmp_int(const void *a, const void *b);

int main(void)
{
int a[] = { 1, 5, 2, 9, 3};
size_t n = sizeof a / sizeof a[0];
qsort(&a, n, sizeof a[0], cmp_int);
for (i=0; i < n; i++)
printf("%d\n", a[i]);
return EXIT_SUCCESS;
}

int cmp_int(const void *a, const void *b)
{
const int *f = a;
const int *s = b;

/* Here, one cannot perform *a < *b */
if (*f < *s) {
return -1;
} else if (*f > *s) {
return 1;
} else {
return 0;
}
}

Tuesday, September 1, 2009

Setting up your own server for blogs

http://linux.byexamples.com/archives/333/setup-your-own-apache-server-to-host-your-weblog-free/#more-333

Monday, August 31, 2009

For watching some command output after time intervals

watch -n 1 "cat /proc/meminfo | grep MemFree"

ssh login without a passwd

Let say you want to access to a machine with IP 10.0.0.4, and make sure you have command ssh, ssh-keygen, ssh-copy-id.

First, generate the key, the key will be used to open the remote machines door.

ssh-keygenYou will see something like that

Enter file in which to save the key (/home/myname/.ssh/id_rsa):Whatever it appears just press enter until it ends, press enter for passphase as well.

Okay, the key will be generated, something looks like ~/.ssh/id_rsa.pub

Copy over the key to remote machine, and enter your password

ssh-copy-id -i ~/.ssh/id_rsa.pub mysurface@10.0.0.4Done. Now you can ssh 10.0.0.4 with username mysurface without password.

ssh mysurface@10.0.0.4

Wednesday, August 26, 2009

Taglist info in vim

1) Download taglist plugin from http://vim-taglist.sourceforge.net/
2)Unzip in $HOME/.vim directory
3)Open a vim editor and type :TListToggle

You should see a Tag List Wiindows at your left side. This will contain info about all the functions , variables, macros etc. Very useful

Make your vim competent with other IDE's

Simple File Sharing Mechanism between machines

cd _directory_to_share_
python -m SimpleHTTPServer _port_no_

where port_no could be anything like 1234

From the other machine, http://_ip_addr_:_port_no_/