This blog is made for Expressing My Ideas, Views, and to put some technical datas.
Monday, April 26, 2010
patch (Unix)
Usage context
Developed by a programmer for other programmers, patch was frequently used for updating of source code to a newer version. Because of this many people came to associate patches with source code, whereas patches can in fact be applied to any text. It should be noted that patched files do not accumulate any unneeded text, which is what some people perceive based on the English meaning of the word; patch is as capable of removing text as it is of adding it.
Patches described here should not be confused with binary patches, which, although can be conceptually similar, are distributed to update binary files comprising the program to a new release.
Patches in software development
The diff files that serve as input to patch are readable text files, which means that they can be easily reviewed or modified by humans before use.
In addition to the "diff" program, diffs can also be produced by other programs, such as Subversion, CVS, RCS, Mercurial and Git.
Patches have been the crucial component of many source control systems, including CVS.
Usage examples
To create a patch, one could run the following command in a shell:
$ diff -u oldFile newFile > mods.diff # -u tells diff to output unified diff format
To apply a patch, one could run the following command in a shell:
$ patch < mods.diff
This tells patch to apply the changes to the specified files described in mods.diff. Patches to files in subdirectories require the additional -pnumber option, where number is 1 if the base directory of the source tree is included in the diff, and 0 otherwise.
Patches can be undone, or reversed, with the '-R' option:
$ patch -R < mods.diff
If the file is not identical to the version the diff was generated against, the patch will not be able to be applied cleanly. For example, if lines of text are inserted at the beginning, the line numbers referred to in the patch will be incorrect. patch is able to recover from this, by looking at nearby lines to relocate the text to be patched. It will also recover when lines of context (for context and unified diffs) are altered; this is described as fuzz.
Ports of patch
Originally written for Unix and Unix-like systems, patch has also been ported to Windows and many other platforms. Windows ports of patch are provided by GnuWin32 and UnxUtils.
Thanks to :
http://en.wikipedia.org/wiki/Patch_(Unix)
Saturday, April 24, 2010
grep
grep- Fine-Tune Your Searches
| To Find… | Use This Option | Example |
|---|---|---|
| Text in subfolders | -r | grep -r Walden ~/Documents/*Finds Walden in any file in any subfolder of ~/Documents. |
| Whole words only | -w | grep -w liveFinds only live ; does not find liver , lives , lived , and so on. |
| Case-insensitive text | -i | grep -i pondFinds pond , POND , or Pond . |
| File names only | -l | grep -l WaldenFinds files containing Walden , but returns only a list of file names. |
| Number of occurrences only | -c | grep -c WaldenReturns the names of files containing Walden and the number of hits in each file. |
grep: Searching for Words
grep
Within Linux (or any other UNIX), many people make use of filters, small programs (black boxes) that read input from standard input (stdin), do something with this input, and return the result to standard output (stdout).
Linux has many filters. Some examples are:
wc: print the number of bytes, words and lines in a file
tr: translate or delete characters
grep: print lines matching a pattern
sort: sort lines in a file
cut: cut selected fields from a file
The easiest way to learn these filters is to use them. This may seem daunting at first, since you may not know all the capabilities of these filters. I will describe the functions of grep so that you can benefit from its power.
I will be using this article (article.txt) as the input file for all the examples.
The syntax of the grep command is as follows:
grep [ -[[AB] ]num ] [ -[CEFGVBchilnsvwx] ][ -e ] pattern| -file ] [ files... ]
I use GNU grep Version 2; if you're using another version, you may have slightly different options. I will touch on only those options I use most. To learn more about the grep command, see the man page. Variants of the grep command are egrep and fgrep. grep includes flags to simulate these commands: -E for egrep and -F for fgrep.
The simplest form of the command is:
grep flip article.txt
This will search for the word “flip” in the file article.txt and will display all lines containing the word “flip”.
grep also accepts regular expressions, so to search for “flip” in all files in the directory, the following command can be given:
grep flip *
All lines in all files which contain the word “flip” will be displayed, preceded by the file name. Thus, the first line of the output will look like this:
article.txt:grep flip article.txtThe line begins with the name of the file containing the word “flip”, followed by a colon, then the appropriate line.
Sometimes you may want to define the search for special characters or a word combination. To do this, put the expression between quotes so that the whole expression/pattern will be treated as one. The command would then look like this:
grep -e "is the"
I put the -e (i.e., do pattern search) option in this example just for demonstration purposes. It is not necessary to specify, as it is the default value.
To see the line numbers in which the pattern is found, use the -n option. The output will look like that shown above, with the file name replaced by the line number before the colon.
Another option which provides us with a number is the -c option. This option outputs the number of times a word exists in a file. This article contains the word “flip” 10 times.
> grep -c flip article.txt
10
You may now be able to think of many ways in which you might use grep. For any command you use often, speed is important. Normally, grep can do its job quickly. However, if the search is being done over many large files, the results will be slower to return. In this case, you can speed up the process by using either fgrep or egrep. fgrep is used only for finding strings, and egrep is used for complicated regular expressions.
File names, words, sentences and numbers can all be found quickly using grep. In addition, using the grep command together with other filters can be very powerful and prove to be of great value. For example, you could search a statistics file and sort the output by piping it through the sort and cut commands (see man pages):
grep ... | sort ... | grep ... | cut ... > result
This has been a quick introduction to get you started and rouse your curiosity to learn more about grep and other filters.
Thanks to :
http://www.linuxjournal.com/article/2384
Tuesday, April 20, 2010
Asynchronous serial communication
In the diagram, a start bit is sent, followed by seven data bits, a parity bit and one "stop bit", for a 10-bit character frame. The number of data and formatting bits, the order of data bits, and the transmission speed must be pre-agreed by the communicating parties.The "stop bit" is actually a "stop period"; the stop period of the transmitter may be arbitrarily long. It cannot be shorter than a specified amount, usually 1 to 2 bit times. The receiver requires a shorter stop period than the transmitter. At the end of each character, the receiver stops briefly to wait for the next start bit. It is this difference which keeps the transmitter and receiver synchronized.
Thanks to:
http://en.wikipedia.org/wiki/Asynchronous_serial_communication
Thursday, April 15, 2010
Twitux : enter password for default keyring to unlock - solution
Today I was fiddling around my Ubuntu ( jaunty ) desktop . I installed twitux , a twitter client and was happy with it. I switched off the machine and went for lunch. When I came back, twitux started asking this.
"enter password for default keyring to unlock
The application 'Twittux
wants access to the default keyring but it is locked"
I tried out my default login password. But could not start twitux.
I searched on net and finally arrived at a solution.
Here it is.
$ cd ~/.gnome2/keyrings
$ rm deault.keyring
That fixed my problem. The next time I started twitux, it asked me to setup a new password for the key ring.
Wednesday, April 14, 2010
C Programming FAQs Part1
/*************************************************************************/
#define int char
main()
{
int i=65;
printf("sizeof(i)=%d \n",sizeof(i));
}
/*Answer:
sizeof(i)=1
Explanation:
Since the #define replaces the string int by the macro char
*/
/*************************************************************************/
void main()
{
int const * p=5;
printf("%d",++(*p));
}
/*************************************************************************/
main()
{
char s[ ]="man";
int i;
for(i=0;s[ i ];i++)
printf("%c%c%c%c \n",s[ i ],*(s+i),*(i+s),i[s]);
}
/*
Explanation:
s[i], *(i+s), *(s+i), i[s] are all different ways of expressing the
same
idea. Generally array name is the base address for that array. Here s
is
the base address. i is the index number/displacement from the base
address. So, indirecting it with * is same as s[i]. i[s] may be
surprising. But in the case of C it is same as s[i].*/
/*************************************************************************/
main()
{
static int var = 5;
printf("%d ",var--);
if(var)
main();
}
/*
Explanation:
When static storage class is given, it is initialized once. The change
in
the value of a static variable is retained even between the function
calls. Main is also treated like any other ordinary function, which can
be
called recursively.*/
main()
{
int c[ ]={2.8,3.4,4,6.7,5};
int j,*p=c,*q=c;
for(j=0;j<5;j++) {
printf(" %d ",*c);
++q; }
for(j=0;j<5;j++){
printf(" %d ",*p);
++p; }
}
/*
Answer:
2 2 2 2 2 2 3 4 6 5
Explanation:
Initially pointer c is assigned to both p and q. In the first loop,
since
only q is incremented and not c , the value 2 will be printed 5 times.
In
second loop p itself is incremented. So the values 2 3 4 6 5 will be
printed.
*/
/*************************************************************************/
main()
{
extern int i;
i=20;
printf("%d",i);
}
/*
Answer:
Linker Error : Undefined symbol '_i'
Explanation:
extern storage class in the following declaration,
extern int i;
specifies to the compiler that the memory for i is allocated in some
other
program and that address will be given to the current program at the
time
of linking. But linker finds that no other variable of name i is
available
in any other program with memory space allocated for it. Hence a linker
error has occurred .
*/
/*************************************************************************/
main()
{
int i=-1,j=-1,k=0,l=2,m;
m=i++&&j++&&k++||l++;
printf("%d %d %d %d %d",i,j,k,l,m);
}
/*Explanation :
Logical operations always give a result of 1 or 0 . And also the
logical
AND (&&) operator has higher priority over the logical OR (||)
operator.
So the expression �i++ && j++ && k++� is executed first. The result of
this expression is 0 (-1 && -1 && 0 = 0). Now the expression is 0 ||
2
which evaluates to 1 (because OR operator always gives 1 except for �0
||
0� combination- for which it gives 0). So the value of m is 1. The
values
of other variables are also incremented by 1.
*/
/*************************************************************************/
main()
{
char *p;
printf("%d %d \n",sizeof(*p),sizeof(p));
}
/*
Answer:
1 2
Explanation:
The sizeof() operator gives the number of bytes taken by its operand. P
is
a character pointer, which needs one byte for storing its value (a
character). Hence sizeof(*p) gives a value of 1. Since it needs two
bytes
to store the address of the character pointer sizeof(p) gives 2.
*/
/*************************************************************************/
main()
{
int i=10;
i=!i>14;
printf("i=%d \n",i);
}
/*
Answer:
i=0
Explanation:
In the expression !i>14 , NOT (!) operator has more precedence than>
symbol. ! is a unary logical operator. !i (!10) is 0 (not of true is
false). 0>14 is false (zero).
*/
/* http://www.c.happycodings.com/Beginners_Lab_Assignments/code24.html */
/*************************************************************************/
Thanks to :
How to configure Gmail in your Evolution inbox
You can check if you have it or not by going to your Gmail account, them Settings. Check that on the top menu says “Forwarding and POP/IMAP” instead of just “Forwarding and POP”.
If not, make sure your language is set to “English (US)”.
If/when you do have the option, go to the menu and check the “Enable IMAP” radio button.
Now open your Evolution client and add the following settings:
=> Identity Tab
- Full Name: Name you’d like to be displayed on your messages
- Email Address: You full Gmail address
=> Receiving E-mail
Server Type: IMAP
Server: imap.gmail.com:993
Username: Your complete Gmail address
Security: SSL
Authentication Type: Password
Remember Password: Check (optional)
=> Sending E-mail
Server Type: SMTP
Server: smtp.gmail.com:587
Server Requires Authentication: Check
Security: TLS
Authentication Type: Login
Username: Your complete Gmail address
Remember Password: Check (optional)
After that click on send and receive. You should start getting your messages. I’ve heard some people saying that they had to restart Evolution for it to start working (also complaints that IMAP on Evolution is really slow).
You will see the folders added to the left pane of your Evolution inbox.
Monday, April 12, 2010
How to connect two systems using a ethernet cable and make one as gateway and browse internet

for sys1 :
For configuring the sys1 as the ip address of 10.0.1.1
$ sudo ifconfig eth0 10.0.1.1 netmask 255.255.255.0 broadcast 10.0.1.255
for sys2 :
For configuring the sys2 as the ip address of 10.0.1.2
$ sudo ifconfig eth0 10.0.1.2 netmask 255.255.255.0 broadcast 10.0.1.255
for sys1
siva@ubuntu:~$ /sbin/ifconfig
eth0 Link encap:Ethernet HWaddr 00:24:1d:28:93:97
inet addr:10.0.1.1 Bcast:10.0.1.255 Mask:255.255.255.0
inet6 addr: fe80::224:1dff:fe28:9397/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:73 errors:0 dropped:0 overruns:0 frame:0
TX packets:54 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:13801 (13.8 KB) TX bytes:9044 (9.0 KB)
Interrupt:253 Base address:0xa000
eth1 Link encap:Ethernet HWaddr 00:e0:5c:00:27:1f
inet addr:172.16.0.226 Bcast:172.16.255.255 Mask:255.255.0.0
inet6 addr: fe80::2e0:5cff:fe00:271f/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:4968 errors:0 dropped:0 overruns:0 frame:0
TX packets:5438 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:3325051 (3.3 MB) TX bytes:1119263 (1.1 MB)
Interrupt:21 Base address:0xce00
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:4 errors:0 dropped:0 overruns:0 frame:0
TX packets:4 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:240 (240.0 B) TX bytes:240 (240.0 B)
for sys1
$ siva@ubuntu:~$ sudo echo 1 > /proc/sys/net/ipv4/ip_forward
else
$ siva@ubuntu:~$ chmod +x /tmp/forward.sh
$ sudo echo 1 > /proc/sys/net/ipv4/ip_forward
$ sudo /tmp/forward.sh
siva@ubuntu:~$ route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.0.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 1000 0 0 eth1
172.16.0.0 0.0.0.0 255.255.0.0 U 1 0 0 eth1
0.0.0.0 172.16.0.6 0.0.0.0 UG 0 0 0 eth1
Now configure ip address of 10.0.1.1 sys1 as gateway in sys2
for sys2 :
$ root@localhost.com # /sbin/rout add default gw 10.0.1.1
for sys2 :
$ ping 10.0.1.1
You have to configure your destination IP and gateway IP in the internet router. then follow the steps as
for sys2 :
$ ping 172.16.0.2
for sys2 :
$ ping www.google.com
In sys2 :
$ root@localhost.com # :~$ ping www.google.com
PING www.l.google.com (209.85.231.104) 56(84) bytes of data.
64 bytes from maa03s01-in-f104.1e100.net (209.85.231.104): icmp_seq=1 ttl=56 time=28.4 ms
64 bytes from maa03s01-in-f104.1e100.net (209.85.231.104): icmp_seq=2 ttl=56 time=28.5 ms
64 bytes from maa03s01-in-f104.1e100.net (209.85.231.104): icmp_seq=3 ttl=56 time=27.8 ms
C-c C-c
--- www.google.com ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2002ms
rtt min/avg/max/mdev = 27.802/28.261/28.577/0.332 ms
I think so this tutorial will be easier to configure.
How to communicate between two ubuntu systems using a Ethernet cable
To setup ip addresses from console is not very hard. Here is what I would do:
You can set ip address with ifconfig command. That kind of setting will not be remembered after you reboot, but will be enough to set up local network between two computers for transfering files (that is what I do when I need to transfer files from my laptop to my home computer). On your laptop you should type (in console):
ifconfig eth0 10.0.1.1 netmask 255.255.255.0 broadcast 10.0.1.255
And on your home computer:
ifconfig eth0 10.0.1.2 netmask 255.255.255.0 broadcast 10.0.1.255
Two computers are now on the same network and can talk to each other. At this point I usually start ssh daemon on one of the computers. On suse you can start it from yast, and on ubuntu you may type (as root):
/etc/init.d/ssh start (or sudo /etc/init.d/ssh start)
Now you can connect to that machine via ssh, by typing:
ssh 10.0.1.1 (or 10.0.1.2)
or copy files with scp command, for example:
scp username@10.0.1.1:/home/username/Desktop/*.mp3 .
will copy all mp3 files from your Desktop folder on 10.0.1.1 machine to 10.0.1.2
Friday, April 9, 2010
Duty Cycle

The duty cycle is the fraction of time that a system is in an "active" state. In particular, it is used in the following contexts:
Duty cycle is the proportion of time during which a component, device, or system is operated.Suppose a disk drive operates for 1 second, and is shut off for 99 seconds, then is run for 1 second again, and so on. The drive runs for one out of 100 seconds, or 1/100 of the time, and its duty cycle is therefore 1/100, or 1 percent.
In a periodic phenomenon, the ratio of the duration of the phenomenon in a given period to the period.
Duty cycle D = (τ/T)
where
τ is the duration that the function is active high (normally when the signal is greater than zero);
Τ is the period of the function.
For example, in an ideal pulse train (one having rectangular pulses), the duty cycle is the pulse duration divided by the pulse period. For a pulse train in which the pulse duration is 1 μs and the pulse period is 4 μs, the duty cycle is 0.25. The duty cycle of a square wave is 0.5, or 50%.
Thanks to :
Friday, March 19, 2010
Data Types in C Language
| Implicit specifier(s) | Explicit specifier | Number of bits | Unambiguous type |
|---|---|---|---|
signed char | same | 8 | int8_t |
unsigned char | same | 8 | uint8_t |
char | one of the above | 8 | int8_t or uint8_t |
short | signed short int | 16 | int16_t |
unsigned short | unsigned short int | 16 | uint16_t |
int | signed int | 16 or 32 | int16_t or int32_t |
unsigned | unsigned int | 16 or 32 | uint16_t or uint32_t |
long | signed long int | 32 or 64 | int32_t or int64_t |
unsigned long | unsigned long int | 32 or 64 | uint32_t or uint64_t |
long long[1] | signed long long int | 64 | int64_t |
unsigned long long[1] | unsigned long long int | 64 | uint64_t |
| Specifier | Common Equivalent | Signing | Bits | Bytes | Minimum Value | Maximum Value | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
int8_t | signed char | Signed | 8 | 1 | −128 | 127 | ||||||||
uint8_t | unsigned char | Unsigned | 8 | 1 | 0 | 255 | ||||||||
int16_t | short | Signed | 16 | 2 | −32,768 | 32,767 | ||||||||
uint16_t | unsigned short | Unsigned | 16 | 2 | 0 | 65,535 | ||||||||
int32_t | int | Signed | 32 | 4 | −2,147,483,648 | 2,147,483,647 | ||||||||
uint32_t | unsigned int | Unsigned | 32 | 4 | 0 | 4,294,967,295 | ||||||||
int64_t | long long | Signed | 64 | 8 | −9,223,372,036,854,775,808 | 9,223,372,036,854,775,807 | ||||||||
uint64_t | unsigned long long | Unsigned | 64 | 8 | 0 | 18,446,744,073,709,551,615 |
Wednesday, March 10, 2010
Solution for : No rule to make target `kernel/bounds.c', needed by `kernel/bounds.s'
make -C /lib/modules/2.6.28-11-generic/build M= modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.28-11-generic'
CHK include/linux/version.h
CHK include/linux/utsrelease.h
SYMLINK include/asm -> include/asm-x86
HOSTCC scripts/basic/fixdep
HOSTCC scripts/basic/docproc
HOSTCC scripts/basic/hash
make[2]: *** No rule to make target `kernel/bounds.c', needed by `kernel/bounds.s'\
. Stop.
make[1]: *** [prepare0] Error 2
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 304 not upgraded.
Need to get 0B/668kB of archives.
After this operation, 0B of additional disk space will be used.
Do you want to continue [Y/n]? y
make -C /lib/modules/2.6.28-11-generic/build M=/home/siva/ldd/ydevice modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.28-11-generic'
CC [M] /home/siva/ldd/ydevice/ydevice.o
Building modules, stage 2.
MODPOST 1 modules
CC /home/siva/ldd/ydevice/ydevice.mod.o
LD [M] /home/siva/ldd/ydevice/ydevice.ko
make[1]: Leaving directory `/usr/src/linux-headers-2.6.28-11-generic'
Thanks to : http://ubuntuforums.org/showthread.php?t=1047374
Saturday, March 6, 2010
Version control of files using "hg" for your local system
Repository Maintenance
Maintaining a Subversion repository can be a daunting task, mostly due to the complexities inherent in systems which have a database backend. Doing the task well is all about knowing the tools—what they are, when to use them, and how to use them. This section will introduce you to the repository administration tools provided by hg, and how to wield them to accomplish tasks such as repository migrations, upgrades, backups and cleanups.Prepare Mercurial
As first step, you should teach Mercurial your name. For that you open the file ~/.hgrc with a text-editor and add the ui section (user interaction) with your username:
[ui]
username = Mr. Johnson
Initialize the project
Now you add a new folder in which you want to work
$ hg init project
Add files and track them
$ cd project
$ (add files)
$ hg add
Note:
You can also go into an existing directory with files and init the repository there.
$ cd project
$ hg init
Alternatively you can add only specific files instead of all files in the directory. Mercurial will then track only these files and won't know about the others. The following tells mercurial to track all files whose names begin with "file0" as well as file10, file11 and file12.
$ hg add file0* file10 file11 file12
Save changes
$ (do some changes)
see which files changed, which have been added or removed, and which aren't tracked yet
$ hg status
see the exact changes
$ hg diff
commit the changes.
$ hg commit
now an editor pops up and asks you for a commit message. Upon saving and closing the editor, your changes have been stored by Mercurial.
Note:
You can also supply the commit message directly via hg commit -m 'MESSAGE'.
Move and copy files
When you copy or move files, you should tell Mercurial to do the copy or move or you, so it can track the relationship between the files.
Remember to commit after moving or copying. From the basic commands only commit creates a new revision
$ hg cp original copy
$ hg commit
(enter the commit message)
$ hg mv original target
$ hg commit
(enter the commit message)
Now you have two files, "copy" and "target", and Mercurial knows how they are related.
Check your history
$ hg log
This prints a list of changesets along with their date, the user who committed them (you) and their commit message.
To see a certain revision, you can use the -r switch (--revision). To also see the diff of the displayed revisions, there's the -p switch (--patch)
$ hg log -p -r 3
The procedure given for hg is so simple, if you follow up the commands and get practised with your local system then the other repository maintenances will be easy.So get practised with this hg and enjoy it.
Thanks to : http://mercurial.selenic.com/guide/
Friday, March 5, 2010
What is difference between interest rate stated as per annum and just interest rate as a percentage?
1) a friend asks for a loan of $1,000 for a couple of months. You say, OK but I want 10% Interest when you pay me back! When you friend pays you back the $1,000 he or she has to add 10% of the initial loan which equals $1,100.00.
2) You go to the bank and want to open an account paying 5.45% per annum on a 6 month CD (Certificate of Deposit) You give the bank 10,000. When you cash in your CD in 6 months, you'll have earned -
1/2 of $545 or $272.50 -- how did that happen?
The bank is only paying 5.45% per YEAR - you only loaned the bank 10,000 for 1/2 year.
The Math:
5.45 divided by 12 months equals: 0.454 x 6 Months Equals 2.7249996 x 10,000 - 272.50 rounded off. Hope this helps
An interest rate as a percentage is the one flat rate you must pay. Interest rate per annum is a compound interest, determined every year that the loan (or whatever) has not been paid back. Say, if you owed me $100 with a 1% per annum interest rate. You have to pay me back $101. If you have not repaid the loan, the next year you would have to pay me an extra 1% of $101, and so on.
Thanks to : http://wiki.answers.com
Tuesday, March 2, 2010
How to read man page of open system call function.
Section Description
1 General commands
2 System calls
3 C library functions
4 Special files (usually devices, those found in /dev) and drivers
5 File formats and conventions
6 Games and screensavers
7 Miscellanea
8 System administration commands and daemons
In general if you read a man page of
man open
it will give a man page of openvt - start a program on a new virtual terminal.We are not in need of this, we are in need of open system calls function man page.so to read this you have to update your man page.
The man page can be update as follows.
Install development man pages
Use apt-get command:
$ sudo apt-get install manpages-dev
so now you are ready to read the man page of open system call.
now type the following command in the terminal as below
Thanks to:
wikipedia and ubuntu forums
How to install sdcc with 8051 support libraries
the above command line will install sdcc but nowadays it doesnt support mcs51 8051 libraries so it is better uninstall the older version of sdcc and install sdcc-nf.
If you are not aware of the procedure how to remove the older version of sdcc and install sdcc-nf , then follow the steps given below.
dpkg --listfiles sdcc-libraries-nf
apt-cache show sdcc-nf
dpkg --list | grep sdcc
apt-cache search sdcc
sdcc --version
echo $PATH
the above commands will say about your older version of sdcc and its libraries.
the following command will remove the older version of sdcc
the following command will install the newer version of sdcc-nf
So now we are ready to use the 8051 related libraries.
Thanks to :
My Frnds and website resources provided by internet.
Monday, March 1, 2010
How-to: Install Ubuntu Linux on a usb pendrive
Being able to run Linux out of a usb bar is a great way to enjoy the live CD experience (being able to use Linux on any computer you might get by) and the big advantage of being easier to carry around than a CD.
1. Requirements
In order to reproduce this tutorial, you will need a few items such as:- a ubuntu liveCD
- a usb bar of at least 1G
- a running Linux operating system
2. Setting up the USB disk
2.1. Finding the device
In the first place, you need to plug your usb drive and check under which device it is associated. To find out the device, run:Once you found your device, you are going to create the partitions.
2.2. Making the partitions
Make sure every of your already mounted partition are unmounted:At fdisk prompt type d x where x is the partition number (you can simply type d if you only have one partition), then:
- n to create a new partition
- p to make it primary
- 1 so it is the first primary partition
- Accept the default or type 1 to start from the first cylinder
- +750M to make it 750 Meg big
- a to toggle the partition active for boot
- 1 to choose the 1 partition
- t to change the partition type
- 6 to set it to FAT16
- n to create yet again a new partition
- p to make it primary
- 2 to be the second partition
- Accept the default by typing Enter
- Accept the default to make your partition as big as possible
- Finally, type w to write the change to your usb pendrive
2.3. Formatting the partitions
The first partition is going to be formated as a FAT filesystem of size 16 and we are going to attribute it the label "liveusb".3.1. Mounting Ubuntu liveCd image
In the first place we need to mount our ubuntu iso. Depending if you have the .iso file or the CD, there is 2 different ways of mounting it.3.1.1. Mounting from the CD
People using Ubuntu or any other user-friendly distro, might just have to insert the cd and it will be mounted automatically. If this is not the case:3.1.2. Mounting from an .iso image file
We will need to create a temporary directory, let say /tmp/ubuntu-livecd and then mount our iso (I will be using a feisty fawn iso).$ sudo mount -o loop /path/to/feisty-desktop-i386.iso /tmp/ubuntu-livecd
3.2. Mounting the usb bar partitions
Same here, you might be able to get both your partition by simply replugging the usb pendrive, partition might appears as: /media/liveusb and /media/casper-rw. If this is not the case, then you will need to mount them manually:$ sudo mount /dev/sdb1 /tmp/liveusb
3.3. Copying the files to the usb bar
Let positionned yourself on the CD image directory (in my case: /tmp/ubuntu-livecd , but it might be /media/cdrom , and copy at the root of your usb first partition:- the directories: 'casper', 'disctree', 'dists', 'install', 'pics', 'pool', 'preseed', '.disk'
- The content of directory 'isolinux'
- and files 'md5sum.txt', 'README.diskdefines', 'ubuntu.ico'
- as well as files: 'casper/vmlinuz', 'casper/initrd.gz' and 'install/mt86plus'
$ sudo cp -rf casper disctree dists install pics pool preseed .disk isolinux/* md5sum.txt README.diskdefines ubuntu.ico casper/vmlinuz casper/initrd.gz install/mt86plus /tmp/liveusb/
When i did the above procedure disctree ubuntu.ico was not available in my /tmp/ubuntu-livecd so dont worry about that two folders and proceed with your further steps.
It might complain about symbolic links not being able to create, you can ignore this.
Now let's go to the first partition of your usb disk and rename isolinux.cfg to syslinux.cfg:
$ sudo mv isolinux.cfg syslinux.cfg
Edit syslinux.cfg so it looks like:
DEFAULT persistent GFXBOOT bootlogo GFXBOOT-BACKGROUND 0xB6875A APPEND file=preseed/ubuntu.seed boot=casper initrd=initrd.gz ramdisk_size=1048576 root=/dev/ram rw quiet splash -- LABEL persistent menu label ^Start Ubuntu in persistent mode kernel vmlinuz append file=preseed/ubuntu.seed boot=casper persistent initrd=initrd.gz ramdisk_size=1048576 root=/dev/ram rw quiet splash -- LABEL live menu label ^Start or install Ubuntu kernel vmlinuz append file=preseed/ubuntu.seed boot=casper initrd=initrd.gz ramdisk_size=1048576 root=/dev/ram rw quiet splash -- LABEL xforcevesa menu label Start Ubuntu in safe ^graphics mode kernel vmlinuz append file=preseed/ubuntu.seed boot=casper xforcevesa initrd=initrd.gz ramdisk_size=1048576 root=/dev/ram rw quiet splash -- LABEL check menu label ^Check CD for defects kernel vmlinuz append boot=casper integrity-check initrd=initrd.gz ramdisk_size=1048576 root=/dev/ram rw quiet splash -- LABEL memtest menu label ^Memory test kernel mt86plus append - LABEL hd menu label ^Boot from first hard disk localboot 0x80 append - DISPLAY isolinux.txt TIMEOUT 300 PROMPT 1 F1 f1.txt F2 f2.txt F3 f3.txt F4 f4.txt F5 f5.txt F6 f6.txt F7 f7.txt F8 f8.txt F9 f9.txt F0 f10.txtWoof, finally we have our usb disk almost usuable. We have a last thing to do: make the usb bootable.
3.4. Making the usb bar bootable.
in order to make our usb disk bootable, we need to install syslinux and mtools:$ sudo umount /tmp/liveusb
$ sudo syslinux -f /dev/sdb1
4. Troubleshooting
If you are having trouble booting on the usb bar, this might be due to your MBR being corrupted. In order to fix it up, you can use lilo (I installed lilo on my box only for thid purpose).Come on go ahead and use your Ubuntu Linux on a usb pendrive - happily wherever you go.
Thanks to :
http://www.debuntu.org/how-to-install-ubuntu-linux-on-usb-bar
My office colleagues who helped me