My Tech notes: 2009
Subscribe

Unix Documentation

Free Online Unix Training Materials

Lists many links to free Unix training materials.

Pointers and Arrays Materials

Pointers and Arrays materials Explained for C beginners

C FAQ and General Questions C Interview Questions

Powered By

Free XML Skins for Blogger

Powered by Blogger

Saturday, November 7, 2009

Mastering Iptable Command Line Usage Linux Networking

Some of the most useful commands related to iptable,


  1. To display filter table rules.
  2. #iptables -t filter -L

  3. To display nat table rules.
  4. #iptables -t nat -L

  5. To display raw table rules
  6. #iptables -t raw -L

  7. To display mangle table rules.
  8. #iptables -t mangle -L


    To delete all rules in the filter,nat,raw and mangle table.
    #iptables -t filter -D
    #iptables -t nat -D
    #iptables -t raw -D
    #iptables -t mangle -D

    Set up IP FORWARDing and Masquerading
    # iptables --table nat --append POSTROUTING --out-interface eth0 -j MASQUERADE
    The above rule will do source nating.
    ( It will set eth0 IP address as source address for all outgoing packets on interface eth0.)
    # iptables --append FORWARD --in-interface eth1 -j ACCEPT

Port forwading
# iptables -t nat -A PREROUTING -i eth0 -d --dport -j DNAT --to
The above rule will change the destinationIP:portnumber of the incoming packet to private.IP:portnum
Enabing the packet forward in the kernel with proc entry.
#echo 1 > /proc/sys/net/ipv4/ip_forward


iptables is a user space application program that allows a system administrator to configure the tables provided by the Linux kernel firewall (implemented as different Netfilter modules) and the chains and rules it stores. Different kernel modules and programs are currently used for different protocols; iptables applies to IPv4, ip6tables to IPv6, arptables to ARP, and ebtables as a special for Ethernet frames.
source


Saturday, October 24, 2009

Dotnet, .Net 3.5, 2.0, C# Interview Questions

Few questions on dotnet, C# 2.0, 3.5
On Object oriented concepts

1)What is inheritance with e.g
2)What is polymorphism
-function overloading
-Function overriding
-virtual keyword use
-Static keyword and use
-Abstract classes
-Interface
-Object

3)What is threading and how do we use in realtime application(cognizant)
4)What is threadpooling, lock, monitor(write code sample)
5)Architecture of current project
6)Session state, diffrent types of state management.
7)What is Application_Start, how it works.
8)Type of authentication in asp.net
9)How to configure ASP.NET application.
10) What is Impersonation.
11) What is WebService, WSDL, UDDI, Discovery, asmx files.
12) How to implement WebService and use it.
13) When to use WebServices.
14) WPF, how to implement(BOA)
15) Testing concvepts.
16) Test attributes
17) Flow of Automation Test Method execution
18) Features of dotnet 3.5
19) CLR, garbage collection
20) Finally block
21) Manifest, Metadata, MSIL
22) Assemblies, Type of assemblies, strong name
23) GAC, gacutil, shared assemblies, path of GAC
24) Extended properties, propertyInfo
25) Better choice between WinForm and WPF
26) XAML, primitive
27) C# 3.0 features

Many are their will keep updating

Answers will be provided as per the need. Please feel free to query.

Tags: OOP, C#, framewrok, Dotnet, .Net, 2.0, 3.0, 3.5

Thursday, October 22, 2009

Virtual Table *_vptr , VTBL, C++

VTBL or VPTR nothing but virtual table and virtual pointer in C++.

It gets created when we create function with virtual keyword. As soon as we create the virtual function in a class A table gets created behind the code.

BaseClass
{
virtual void function1(){...}
}

ChildClass : public BaseClass
{
virtual void function1(){...}// method overridden.
}

When we override method that is create another version of function in derived class ChildClass in above case then the *_vptrvirtual void function1(){...}// method overridden. gets created for BaseClass.

So VTBL Of Base Class has entry for function1 and Child class will be pointing to that function. *_vptr is nothing but the pointer to function.

Note: ones the virtual keyword is introduced all the upcoming functions are considered as virtual.

ChildClass: public BaseClass
{
virtual void function1(){...}// method overridden.
void function2(){}
}

In above case function2 also considered as virtual.

BaseClass will not be pointing to any of Child Class functions and ChildClass will be pointing to all the virtual functions whose entry is in VTBL of baseclass as soon as the object of the base class instantiated or the method is overridden.

Tags : pointer, virtual, C++, function pointer,VTBL, VPTR, Function overriding , polymorphism

Tuesday, September 15, 2009

How to unzip .torrent files on Windows PC?

how to unzip .torrent files?
You do not need to decompress .torrent files. The .torrent will disappear from the end of the file once the file has finished downloading onto your computer.

Then you can use the file as you see fit. It may be a .mp3 file, a .zip file, etc
to use bittorent, you need a client. then open the .torrent file in azureus and you will download the file that the torrent is for. the .torrent isnt the file itself, it just tells the client where to get the file.
Here are some popular torrent clients for windows.
Download Azureus at Azureus
Azureus - now called Vuze - Bittorrent Client

Requires Java for Windows; if you are first time installing
http://java.com/en/download/inc/windows_new_xpi.jsp

Few more popular bittorrent clients for windows
  1. http://www.utorrent.com
  2. BitTorrent | BitTorrent

Check out Comparison of BitTorrent clients - from Wikipedia, the free encyclopedia
BitTorrent is the name of a peer-to-peer (P2P) file distribution protocol, and is the name of a free software implementation of that protocol.

Friday, August 21, 2009

Creating & Working On a CVS Branch Example Usage

Example usage OF Creating & Working On a CVS Branch
Tried working hard on CVs commands, here is simple example for working in branch using CVS, CVS is becoming nomore use with everyone opting for SVN, still CVS usages is wide as it is old,
Lets start with CVS commands to create a branch
This is done with two commands,
  • cvs tag -b release-1 //create branch
  • cvs update -j release-1 //merge the changes in main tot
Lets see with simple example
Creating and working on a branch for the existing kernel source.
#cvs co kernel/linux-2.6.26
#cd kernel/linux-2.6.26/
#cvs tag -b release-1

First we created a branch to the kernel source, as we are doing first release.
Continue your development work for second release.
After some time, reported a problem in the first release.
So you need to Get the kernel source code of first release.
#cvs co -r release-1 kernel/linux-2.6.24
and fix the problems
Now If you want to merge these changes in to main trunk.
#cvs update -j release-1
And you are done with usage OF Creating & Working On a CVS Branch

Tuesday, August 11, 2009

Linux SMB write performance With Simple Tips

SMB write performance can be increased by Tuning the buffer cache.
The secret to good performance is to keep as much of the data in memory for as long as is possible. Writing to the disk is the slowest part of any filesystem. If you know that the filesystem will be heavily used, then you can tune this process for Linux Samba.

writing out dirty blocks to the disk until the filesystem buffer cache is 80 percent full (80). default is 40%, source = http://tldp.org/LDP/solrhe/Securing-Optimizing-Linux-RH-Edition-v1.3/chap29sec287.html

by writing
echo 80 > /proc/sys/vm/dirty_ratio

I am getting around 2MB increase while write operation, tested in Xp.

I have tried with this single option, as the ref source is for linux 2.2 and we are using 2.6 kernel.
we can try out Linux General Optimization suggested at http://tldp.org/LDP/solrhe/Securing-Optimizing-Linux-RH-Edition-v1.3/gen-optim.html

Tried with smb.conf, I am getting around 1MB gain while read and write.

socket options = TCP_NODELAY IPTOS_LOWDELAY SO_KEEPALIVE
oplocks = yes
dead time = 15
read size = 32768

TCP socket options can be tested at run time using -O option of SMBD
/usr/local/samba/bin/smbd -O socket optios = TCP_NODELAY IPTOS_LOWDELAY SO_KEEPALIVE

source.
http://us1.samba.org/samba/docs/man/Samba3-HOWTO/speed.html

socket level perf improvement also suggests for TCP_NODELAY
ref: http://www.ibm.com/developerworks/linux/library/l-hisock.html

http://www.stuartcheshire.org/papers/NagleDelayedAck/

SAMBA perf tuning ref.

http://oreilly.com/catalog/samba/chapter/book/appb.pdf

Wednesday, July 29, 2009

CROSS COMPILING X11 FOR ARM Board

STEPS FOR CROSS COMPILING X11 FOR ARM
Go to /usr/X11R6/lib in my linux PC.

1) install ARM toolchain, If not installed
2) Get x11 source from http://www.x.org/
3) extract all the tar files, using tar -xvzf
4) edit cross.def and host.def files, in cross.def set the paths
of tool chain in host.def file set crossCompile to YES and
DoLoadableServer to NO
5) make shadow directory "build" and link to xc "lndir ../xc"
6) run Make World


error: linux_vm86.c 281 impossible constraint in 'asm'
268 res might be used uninitialized in this function.
fix:comment line 281,
set res=0


error: implicit decleration of function 'SET_FLAG'
fix: comment line 111 in
programs/Xserver/hw/xfree86/os-support/linux/int10/helper_exec.c


error:Undefined reference to XF86VidModeQueryVersion in glxinfo
And glxgears
Undefined reference to XF86VidModeQueryVersion in xdriinfo
fix:download libXxf86vm.so.1.0 into our armtoolchain lib path
and make softlinks

ln -s libXxf86vm.so.1.0 libXxf86vm.so
ln -s libXxf86vm.so.1.0 libXxf86vm.so.1

error:X_cursor.cfg command not found.
fix:

copied all the binaries from cvs in our
arm-tools-chain bin folder...didnt work

copied libXcursor.so.1.0.2 from cvs in our arm-tools-chain
and made links

ln -s libXcursor.so.1.0.2 libXcursor.so.1
ln -s libXcursor.so.1.0.2 libXcursor.so
...still didnt work

copied xcursor.pc in pkgconfig of toolchain.

looks like xcursorgen is missing .
got it from debian.still didnt work.

copied xcursorgen from programs/xcursorgen/ to tool chain
still didnt work.

export XCURSORGEN=/usr/X11R6/bin/xcursorgen
!!! WORKED !!!


Total compilation time with "Make World" is 20 minutes.

after compilation it prints a message:
"Full build of Release 6.8 complete."

error: while doing make install got the error in fonts:
"/bin/sh -b: command not found"

workaround:
removed "models" folder from Makefile at
"programs/Xserver/XpConfig/C/print/Makefile
fix:Open the makefile in Xserver/XpConfig/C/print/models/XXX/fonts/Makefile
and then set MKFONTSCALE=$(XBINDIR)/mkfontscale below XBINDIR on line
no around 389.

Wednesday, July 22, 2009

Define:Blu-ray & About Blu-ray Movies HDTV Info

The Advancement of technology had entered into nanometer age. search in google define:Blue-ray will get wiki pages here is summary of it. Blu-ray Disc (also known as Blu-ray or BD) is an optical disc storage medium designed to supersede the standard DVD format. Its main uses are for storing PlayStation 3 games, high-definition video, and data storage, with up to 50 GB per disc. This is quite impressive, The disc has the same physical dimensions as standard DVDs and CDs.
Why Blu-ray disc stores 50GB on same size of DVD/CD?
Well here is advancement of laser technology, thanks to Shuji Nakamura for his invention on blue laser,
The name Blu-ray Disc derives from the blue-violet laser used to read the disc. While a standard DVD uses a 650 nanometre red laser, Blu-ray uses a shorter wavelength, a 405 nm blue-violet laser, and allows for almost six times more data storage than on a DVD.
check out about
Blu-ray Movies - Everything about Blu-ray movies and releases.at http://www.blu-ray.com/movies/
Few interesting stuff from Blu-ray FAQ
How much data can you fit on a Blu-ray disc?
A single-layer disc can hold 25GB.
A dual-layer disc can hold 50GB.
How much video can you fit on a Blu-ray disc?
Over 9 hours of high-definition (HD) video on a 50GB disc.
About 23 hours of standard-definition (SD) video on a 50GB disc.
Why should I upgrade from DVD to Blu-ray?
The simple answer is HDTV.
visit http://www.blu-ray.com

Tuesday, July 21, 2009

Get HyperSCSI for SAN - Storage Area Network

Get HyperSCSI for SAN - Storage Area Network
SCSI (Small Computer Systems Interface) family of protocols. HyperSCSI can allow one to connect to and use SCSI and SCSI-based devices (like IDE, USB, Fibre Channel) over a network as if it was directly attached locally.
Why HyperSCSI over iSCSI?
The main advantage of HSCSI compared to iSCSI is
  1. especially a lower network load as well as an end system (server and client) load.
  2. TCP/IP SAN performance is still not good enough without hardware acceleration
  3. FC-based SANs cannot do Storage Wide-Area Networks
  4. Fully functional software implementation of both client and server so HSCSI can be used for a solution built on commonly available hardware, no expensive and specialized hardware is needed.
  5. Therefore, HSCSI can be used for building small and cheap SANs.
HSCSI main disadvantage is this protocol has no official standard like iSCSI nd so it is unsupported in any way by manufacturers developing hardware data storage solutions.
Two modes of operation
one for local access,Local HyperSCSI over Ethernet (HS/eth),
and the other for wide-area connectivity, Wide-Area HyperSCSI over IP (HS/IP).
The reason why I am posting this is, I could not able to locate source code for HyperSCSI easily.
HyperSCSI source code download link for linux
download links
http://www.dsi.a-star.edu.sg/main/dev/mainPage.asp?cid=15022&Lid=0

Will post more if get luck while compiling HyperSCSI for ARM target board.

Wednesday, July 15, 2009

The things must know about Linux kernel ...

As a kernel or device driver developer one must know what Linux kernel can not

1) No access to C library
Generally, C library is large. Accessing a C lib function from kernel space is very time consuming.
It affects the kernel speed and size. So many libc functions are implemented in the kernel. Just like printf in libc is implemented as printk in kernel.

2) The kernel lacks memory protection.
Application in user space lacks memory protection. so when an application access illegal memory location, it results in segment violation. But when in kernel space segment violation occures, it results in oops. It is a major kernel error.

3) Difficult to use floating point.
When floating point arithmetic is done in user space, kernel manages the transition from integer to floating point mode. But enabling floating point in kernel, the kernel requires manually saving and restoring the floating point register. It is extra overhead for kernel.

4) Limited and small stack
Linux kernel has very small stack size. The size varies by architectures. Generally it is 8KB for 32-bit architecture and 16KB for 64-bit architecture.

5) Requires synchronization and concurrency
Linux kernel is a preemptive multitasking operating system. So scheduler schedules any process among the pool of processes. It requires synchronization between tasks. The concurrency is required when two or more processes tries to access the same resource.

Sunday, July 12, 2009

Linux Kernel Based Chrome OS : Google

Google Chrome OS is an open source, lightweight operating system. It is designed mainly considering netbooks. The notebooks will be available to consumers in mid 2010.
This will be an open challenge to its rival MS Window. The key aspects of Google Chrome OS are its security, simplicity and speed.

Saturday, July 11, 2009

What is difference between monolithic kernel and microkernel?

Monolithic kernel has simple design. Monolithic kernel is a single large processes running entirely in a single address space. It is a single static binariy file. All kernel services exist and execute in kernel address space. The kernel can invoke functions directly. The examples of monolithic kernel based OSs are Linux, Unix.

In Microkernels, the kernel is broken down into separate processes, known as servers. Some of the servers run in kernel space and some run in user-space. All servers are kept separate and run in different address spaces.The communication in microkernels is done via message passing. The servers communicate through IPC (Interprocess Communication). Servers invoke "services" from each other by sending messages. The separation has advantage that if one server fails other server can still work efficiently. The example of microkernel based OS are Mac OS X and Windows NT.

Wednesday, June 10, 2009

Create File Of Any Size in Linux Using DD Command

How do I create a file of any given size on Linux?
using the dd command.

$ dd if=/dev/zero of=testss bs=1024 count=1048576

This will create a file of size 1024 * 1048576 bytes (or 1 GB).
where
if - input file
of - output file or the file to be created
bs - block size in bytes
count - # of blocks of size bs

Easiest and fasted way to create file of 250GB using DD command

$ dd if=/dev/zero of=tests bs=1 count=0 seek=250G

read dd(1) - Linux man page

Friday, June 5, 2009

Xilinx's Interview Questions

Xilinx is the world's one of largest supplier of programmable logic devices. It has started R & D department in Hyderabad, India. It has broad scope for embedded system programming in device driver in linux.

Before the interview you have to feel the Xilinx form with information containing all academic details, current/previous employer, contacts of employer( to check out info about you), current ctc, expected ctc and expected date of joining, etc.

I appeared two back to back technical interviews.

The first interview was taken by a young man look like just crossed 30's.

He asked me to tell me about myself.

Then he asked my experience.

He checked my expertise in resume.

He asked questions about RTOS, and Linux Device Drivers.
What is RTOS ? Define it.
How a linux device driver works?
How a character driver works?

He looked at my project summaries and started to ask in depth questions about each project.

After that he asked me to write to delete nth node from starting in Singly Linked List.
Then asked how would you delete the nth node from ending?

Then he asked to set and reset the nth bit of a byte.

After the first interview the second interview was unexpected for me.
This second interview was taken by a lady in mid 40's.

She asked me about why I chose embedded system as my carriar instead of the post graduation.

She had copy of my resume with her and noted down on resume years when I compledted graduation and diploma.

She asked me my expertise in embedded system.

Then she offered me to choose any of my projects which I did in my previous company and explore about them.

She started grilling on each and every, sentence and words about that project.

At the end she asked me to write a string reversing program as she gave some intial start of the code as

char * strrev( const char * string){

}

So these are some technical questions were asked me in Xilinx interview.

SCALA Programming Language Secret Behind Twitter's Growth

SCALA programming language and Secret behind Twitter's growth
Scala is a general purpose programming language designed to express common programming patterns in a concise, elegant, and type-safe way. It smoothly integrates features of object-oriented and functional languages, enabling Java and other programmers to be more productive. Code sizes are typically reduced by a factor of two to three when compared to an equivalent Java application.
http://www.scala-lang.org/
Introducing Scala

Scala is a general purpose programming language designed to express common programming patterns in a concise, elegant, and type-safe way. It smoothly integrates features of object-oriented and functional languages, enabling Java and other programmers to be more productive. Code sizes are typically reduced by a factor of two to three when compared to an equivalent Java application.

Programming Scala book

Programming in Scala Some books

A comprehensive step-by-step guide
by Martin Odersky, Lex Spoon, and Bill Venners
Book ToC at
http://www.artima.com/shop/programming_in_scala
Sample chapters from SCALA book
A scalable language http://www.artima.com/samples/chapter1.pdf
First steps in Scala http://www.artima.com/samples/chapter2.pdf

Secret behind Twitter's growth

Scala programming language helped Twitter scale
http://www.technologyreview.com/blog/editors/23282/?nlid=1908
Also do visit slides of the Scala talk given at Twitter headquarters.
http://www.slideshare.net/raffikrikorian/scala-wattzon-sitting-in-a-tree

Tuesday, June 2, 2009

Debugging Defined Testing DOTNET

 

Tags: Debugging, Testing, DOTNET, windows

Wednesday, May 27, 2009

apsscresults 10th Class results ssc 2009 of AP Board

Andhra Pradesh State Board SSC Results 2009 announced today (27-May-09) by 10.45 am. There is lot of rush for those sites, Results will be available on the following sites: I have tried to give direct links for results, good luck to students.

Results direct links from manabadi ssc
SSC results on SMS from manabadi
  1. results.manabadi.co.in
  2. Indiaresults
  3. Bharat student
Results direct links from results.sakshi.com
  1. AP SSC REGULAR results 09 results.sakshi.com/textfile/R_PRES91.TXT
  2. AP SSC PRIVATE Results results.sakshi.com/textfile/P_PRES9.txt
  3. AP OSSC REGULAR results results.sakshi.com/textfile/OS_PRES92.txt
  4. AP OSSC PRIVATE results results.sakshi.com/textfile/OS_PRES92.txt
Sakshi Results
Sakshi Results. Ceep 2009 Results · Inter Second Year 2009 Results · Inter First Year 2009 Results. results.sakshi.com

Results direct links from vidyavision.com
Vidyavision.com provides you Andhra Pradesh examination results like SSC Results , Inter Results, MCA Results, ICET Results, MBA Results, EAMCET Results, ...
www.vidyavision.com

Related
related
manabadi, andhraeducation, schools9, pratibhaplus, bharatstuden, manabadi, results.sakshi, schools9, manaba, manbadi, apsscresults, apssc, apresults, manabadi, sscresults, ap ssc , andhraeducation, pratibhaplus, manabadi, bharatstudent, bharathstudent , manabadi, indiaresults, deccan post, aarvy, vidyavision, results.sakshi, manabadi, manabadi ssc, aponline, maabadi, 10th class , esevaonlin,ushasri, manabadi, schools9, vidyavision, bharatstudent

Tuesday, May 26, 2009

C Traps & Pitfalls Book PDF Online by Andrew Koenig

C Traps & Pitfalls Book PDF Online by Andrew Koenig
C Traps and Pitfalls is a slim computer programming book by former AT&T researcher and programmer Andrew Koenig, its first edition still in print in 2005, which outlines the many ways in which beginners and even sometimes quite experienced C programmers can write poor, malfunctioning and dangerous source code.

It evolved from an earlier technical report published internally at Bell Labs, but is now available online in pdf form.



Happy coding.

Tuesday, May 12, 2009

Higher Secondary Kerala hse kerala Results Links

Today vhse kerala HSE Kerala DHSE Kerala hseresults 2009 Plus Two Kerala results are declared, students are finding difficult to get results as official sites are coming down, due to hevay loads, For those students here are some direct links and email registration links.

The result will be made available with the joint efforts of Kerala education board and the National Informatics Centre and to be published on keralaresults.nic.in
Arrangements have also been made at couple of hundred Akshaya Centres to provide the result where internet connectivity is a problem.
here are direct links for email Registration
DHSE (Plus Two) Results 2009
http://results.kerala.nic.in/dhse09/

VHSE Results 2009
http://results.kerala.nic.in/vhse09/

Schools can download the results of all their students. For students and schools who register on www.keralaresults.nic.in, the results would be sent to their e-mail ids soon after the results are declared.

VHSE Results 2009
Likely to be announced on 12 May 2009.
DHSE
plus 2 Results 2009
Likely to be announced on 12 May 2009.

Kerala HSE Results 2009, DHSE Plus Two, VHSE Exam Results, Kerala. Government of Kerala Higher Secondary Examination Results 2009. Kerala Higher Secondary Result HSE 2009 - +2 Results hse kerala, higher secondary, vhsc kerala, hseresult, higher secondary education

Friday, May 8, 2009

karresults.nic.in PUC Exam Results 2009

Government of Karnataka KARNATAKA EXAMINATIONS AUTHORITY will declare PUC Exam Results 2009 by tomorrow
Likely to be declared on 09/05/2009 at 3:30pm

check you Karnataka PUC Exam Results 2009 at karresults.nic.in

source
http://www.karresults.nic.in/

Find Karnataka PUC Results,PUC Exam Results 2008, Karnataka PUC Results 2008, Karnataka Pre University Results,PUC Results only on Sify.com

www.puc.kar.nic.in

PUC Results 2009, Karnataka

PU Education Department, Karnataka will be announcing the PUC Results 2009 on 9th May 2009.

2 puc results, 2nd puc results, 2nd puc results 2009, cet exam results, karnataka puc results, Karnataka Results, Karnataka SSLC Results 2009, puc results 2009, puc results karnataka Karnataka PUC Results | PUC Exam Results 2008 | Karnataka PUC Results 2008 | Karnataka PUC results 2008 | PUC Results



Wednesday, May 6, 2009

Use of Select() System Call In Linux To make a non-blocking connect()

About Select system call
The  select() function shall examine the file descriptor sets whose addresses are passed in the readfds, writefds,
       and errorfds parameters to see whether some of their descriptors are ready for reading, are ready for  writing,  or
       have an exceptional condition pending, respectively.
  int select(int nfds, fd_set *restrict readfds,
              fd_set *restrict writefds, fd_set *restrict errorfds,
              struct timeval *restrict timeout);
There are many usages of select() system call, Here is one usage in networking applications, The use of select system call is to make non-blocking call in Linux.
how to make a non-blocking connect() in Linux

1. create socket using socket(),

2. set the file descriptor to non-blocking mode using fcntl(2)
   fnctl (fd, SETFL, fcntl(fd, GETFL) | O_NONBLOCK)

3. call connect() - since you have set the socket to non-blocking, it will
return right away with a result of EINPROGRESS.

4.  Now

   a) Go into a loop and keep calling connect() - as long as it
       has not completed it will return EALREADY (see man page for
       connect()).  This is simple but not a good solution. check below solution
       using select to avoid loop wait.
OR
   b) Use select(2), selecting the socket for write.  When the connect is
       finished, the select should return and show the socket as writeable.
       Using select() can be tricky, but will be more efficient, since
       select() will block until the connect has finished and you are not
       wasting CPU in a tight loop.

       /* No loop required */
       fd_set write_set;
       FD_ZERO(write_set);
       FD_SET(write_set, fd);
       select (fd+1, 0, write_set, 0, 0);

File descriptor masks of type fd_set can be  initialized  and  tested  with  FD_CLR(),  FD_ISSET(),  FD_SET(),  and
   
     FD_SET(fd,  fdsetp)  shall add the file descriptor fd to the set pointed to by fdsetp. If the file descriptor fd is
       already in this set, there shall be no effect on the set, nor will an error be returned.
     FD_ZERO(fdsetp) shall initialize the descriptor set pointed to by fdsetp to the null set. No error is  returned  if
       the set is not empty at the time FD_ZERO() is invoked.
 The  original  Standard  can  be  obtained  online at http://www.opengroup.org/unix/online.html

Tuesday, May 5, 2009

Working With Linux Patch 10 Step Guide

What is Linux patch ?
Here is patch description from Linux Man pages.
       patch - apply a diff file to an original

SYNOPSIS
       patch [options] [originalfile [patchfile]]

       but usually just

       patch -pnum <patchfile

DESCRIPTION
       patch  takes  a patch file patchfile containing a difference listing produced by the diff program and applies those
       differences to one or more original files, producing patched versions.  Normally the patched versions  are  put  in
       place  of the originals.  Backups can be made; see the -b or --backup option.  The names of the files to be patched
       are usually taken from the patch file, but if there√Ęs just one file to be patched it can specified on  the  command
       line as originalfile.

How Linux patch works?
Here is short explanation about How to use patches in linux.
Working with Patch 10 step Guide.
  1. mkdir patch_test
  2. cd patch_test/
  3. mkdir old
  4. cd old
  5. create   file1.txt and file2.txt
  6. cd .. ; mkdir new
  7. cp file.txt and file2.txt == Now change both or any files to create patch
  8. cd .. ; ls // new and old dir here
  9. diff -Naur old new > learn.patch  ==Your patch is ready.
  10. patch -p0 < learn.patch  == apply patch to old folder; you should be above old dir
How to Reverse patch applied?
In order to reverse the patch applied run following command.
patch -p 1 -R < learn.patch

Monday, May 4, 2009

Creation of Static Libraries In Linux Simple Steps

Here is real time example of creation of static library and its usage, explained in simple steps.
Creation of static library with example

Creation of Static Libraries In Linux Simple Steps

1. Create Test  Directory
  Create working test directory as: /home/test/so
 
 2. Choose Library Files
   library file name: add.c
     int add(int a, int b)
     {
         return (a+b);
     }
3. Compile
Now Compile Static Library with -shared option
   gcc -c add.c
   gcc -shared -o libadd.so add.o
 
4. Usage of Static Library
 Here is example application uses this library.
   filename: main.c
   int main(void)
   {
      printf("result: %d", add(1,2));
      return 0;
   }
 
5. Compile Example Code
  gcc main.c -o main -L  <path where the library file is there, in our example it is libadd.so> -l add
       (in last option -l add we have to specify library name. name of the library is, removing the "lib"
         from libadd. i.e. how gcc takes.)
   example: gcc main.c -o main -L /home/test/so -ladd
 
6. export LD_LIBRARY_PATH=<directory where your .so file is>
    if you copy the .so file to /lib  directory no need to set this environment variable

Tags static library, Linux, My Notes, C Programs, Embedded Linux.

Thursday, April 23, 2009

The Linux Foundation Free Training Program at linuxfoundation

The Linux Foundation Training Program is:

* For the Community, by the Community. The Linux Foundation is
building the program with its Technical Advisory Board to ensure the
content, instructors and classes are the top quality available.
* Technically the most advanced. Since the Linux Foundation works
directly with community developers, it can cover features and advances
in Linux before commercial companies.
* Connected. The Linux Foundation has unfettered access to the
leading developers and companies in the Linux ecosystem and will use
these connections to best position attendees for success. For example,
attendees can attend the exclusive, invite-only Collaboration Summit
where they can forge connections beneficial to their career.
* Real World. The Linux Foundation training courses all have hands
on components and a highly rigorous curriculum of programming or
administration exercises. Graduates will be well equipped to master
Linux programming and system administration tasks

The Linux Foundation Training Program will span the enterprise server
and mobile and embedded markets, with courses being offered on the
following subjects:

* The latest filesystems
* Device driver development
* Kernel internals
* Advanced systems administration
* Kernel debugging
* Application development
* Power Management & Optimization

These courses will be provided in three core offerings:

* Training offered at the Linux Foundation Collaboration Summit
and LinuxCon allowing developers to attend advanced training as a part
of their conference experience.
* Courses held in cities throughout the U.S. and around the world
* Custom courses for corporations who need training to help
advance their developer core
For more information, please contact training (at) linuxfoundation dot org.
source http://events.linuxfoundation.org/training

Monday, April 20, 2009

Configure udhcpc for Setting IP netmask and Gateway

How to Configure udhcpc for Setting IP netmask and Gateway?
Tell udhcpc client to run on eht1 interface with -i option.
Also use -s option to tell udhcpc client to use script from specified path.
/sbin/udhcpc -i eth1 -p /var/run/dhcpClient-wifi.pid -s /usr/share/udhcpc-wifi/default.script &

default.script directs the udhcpc to executes one by one scripts from specified folder ie /usr/share/udhcpc-wifi/
else default folder location for udhcpc script is /usr/share/udhcpc/

For directing IP address to temp file obtained using udhcpc client or for DHCP, do little
modification in sample.bound file.
Here is Sample udhcpc renew script, which will update the ip address, netmask and gatway obtained
by boradcasting. The new values will be updataed in /var/dhcpfile.

#!/bin/sh
# Sample udhcpc renew script

RESOLV_CONF="/etc/resolv.conf"

[ -n "$broadcast" ] && BROADCAST="broadcast $broadcast"
[ -n "$subnet" ] && NETMASK="netmask $subnet

echo $ip > /var/dhcpfile
echo $subnet >> /var/dhcpfile

/sbin/ifconfig $interface $ip $BROADCAST $NETMASK

if [ -n "$router" ]
then
echo "deleting routers"
while /sbin/route del default gw 0.0.0.0 dev $interface
do :
done

for i in $router
do
/sbin/route add default gw $i dev $interface
echo $i > /var/dhcp_gw_wifi
done
fi

Same file can be extended to work on multiple interfaces link eth0 eth1 using $interface

example

if [ "$interface" == "eth0" ];
then
echo $ip > /var/dhcpfile
echo $subnet >> /var/dhcpfile
else
echo $ip > /var/dhcpfile1
echo $subnet >> /var/dhcpfile1
fi

Wednesday, April 8, 2009

Use Of Bootloader In SoC Design Life Cycle

Use of bootloader, in SoC design.
SoC in simple terms is collection of required blocks, like USB, MAC, PCI, surrounded to the CPU (generally RISC CPU, ARM).
As a part of SoC development each hardware block is validated for its functionality.
Validation is done register level. Example if we want to test functionality provided by MAC block in our SoC, then these functionality are validated by writing test cases in bootloader (u-boot-1.1.6).
Bootloader will create an environment for the test cases. The test cases are added as commands for each block with different subtests for each block to touch the corner conditions.
To start with U-boot provides generic block test cases, like I2C and many more are getting added day by day.
Format of bootloader commands

int do_hello (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
printf("Hello World\n");
}


U_BOOT_CMD(
hello, 5, 0, do_hello,
" hello - Prints hello world\n",
" hello - Prints hello world\n"
" \n" \
);

this will register "hello" as command in bootloader commands list.
Using this structure To validate simple GPIO functionality we write GPIO related test cases, so as to test GPIO features like GPIO interrupt.

MAC Block Validation test cases could be
  1. Link Up/Down test
  2. a. Validates PHY interface.
  3. b. Validates link negotiated by PHY
  4. Link Interrupt test
  5. a. Validatess the Link interrupt
  6. Digital loop-back test in full duplex mode
  7. a. Validates data path in MAC controller in varous link speeds
  8. 10/100/1000Mbps
  9. b. Validates normal frames (60-1514)
  10. Analog Loop-back in full duplex mode
  11. a. Validates PHY interface
  12. b. Validates Data path in MAC as well as PHY
  13. External loop-back test
  14. a. Validates PHY interface
  15. b. Validates Data path in MAC as well as PHY
  16. Digital Loop-back test in half duplex mode
  17. a. Validates data path in MAC controller
  18. DMA interrupt test
  19. a. Validates th MAC interrupts
  20. Incremental test
  21. a. Validates Data pathin MAC controller for varrying packet length
  22. External Incremental test
  23. a. Validates Data path in MAC controller and PHY for varrying packet length
  24. Promiscuous and MIB
  25. a. Validates Promiscous and Normal mode
  26. b. Validates the statistic count registers
  27. Pause Frame test
  28. a. Validates Pause frame Transmit and recieve
  29. b. Validates the statistic count registers
  30. Multicast frame test
  31. a. Validates the Hash table entry for Multicast filter
  32. b. Validates drop and pass of a Multicast Frame
  33. c. Validates the statistic count registers

Friday, April 3, 2009

UDP Traffic Generator Client Side C code

Learning Networking basics using C programs, to start with here is simple UDP client side code,
Why to start with UDP because its simple, no need of connection handshake like TCP.
This code sends continues UDP traffic over network, depending on the payload (ie send_buf) and delay between each transfer, rate at which data is pumped over network is calculated. Example: this client program is sending constant length 0f 1400 (in sendto function), so if you keep delay as 1s then data transfer rate will be 1400 per sec, decrease the delay to pump traffic at high rate.
You need UDP server side code for running this client.
udp client

#include
#include
#include
#include
#include
#include
#include
#include /* memset() */
#include /* select() */

#define REMOTE_SERVER_PORT 1500
#define MAX_MSG 1600


int main() {

int sd, rc, i;
struct sockaddr_in cliAddr, remoteServAddr;
struct hostent *h;
char *send_buf;
unsigned int count=0;
int reply;

send_buf= (char *) malloc(1600);
*((unsigned int *)send_buf) = count;

strcpy((send_buf+4),"hello how r u !!!!");
remoteServAddr.sin_family = AF_INET;
remoteServAddr.sin_addr.s_addr= inet_addr("1.168.3.100"); //using fixed IP for simplicity
remoteServAddr.sin_port = htons(REMOTE_SERVER_PORT);

/* socket creation */
sd = socket(AF_INET,SOCK_DGRAM,0);
if(sd<0)>
printf("cannot open socket \n");
exit(-1);
}

/* send data */
while(1){

*((unsigned int *)send_buf) = ++count;

rc = sendto(sd, send_buf, 1400, 0,(struct sockaddr *) &remoteServAddr,
sizeof(remoteServAddr));
usleep(10000);

if(rc<0)>
printf("cannot send data %d \n");
close(sd);
exit(-1);
}
}
}

Thursday, April 2, 2009

UDP Traffic Generator Server Side C code

Learning Networking basics using C programs, to start with here is simple UDP server side code,
Why to start with UDP because its simple, no need of connection handshake like TCP.

udp server

#include <sys/types.h>;
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <stdio.h>
#include <unistd.h>/* close() */
#include <string.h> /* memset() */

#define LOCAL_SERVER_PORT 1500
#define MAX_MSG 1500

int main() {

int sd, rc, n, cliLen;
struct sockaddr_in cliAddr, servAddr;
char msg[MAX_MSG];
int count;
int prev_count=0;
/* socket creation */
sd=socket(AF_INET, SOCK_DGRAM, 0); //create unix socket
if(sd<0)>
printf("cannot open socket \n");
exit(-1);
}

/* bind local server port */
servAddr.sin_family = AF_INET;
servAddr.sin_addr.s_addr = inet_addr("1.168.3.100"); //using fixed IP for simplicity
servAddr.sin_port = htons(LOCAL_SERVER_PORT);
rc = bind (sd, (struct sockaddr *) &servAddr,sizeof(servAddr));
if(rc<0)>
printf("cannot bind port number %d \n", LOCAL_SERVER_PORT);
exit(-1);
}

printf("waiting for data on port UDP %u\n",
LOCAL_SERVER_PORT);

/* server infinite loop */
while(1) {

/* receive message */
cliLen = sizeof(cliAddr);
n = recvfrom(sd, msg, MAX_MSG, 0,
(struct sockaddr *) &cliAddr, &cliLen);

if(n<0)>
printf("cannot receive data \n");
continue;
}

/* print received message */
printf("from %s:UDP%u: count:%d message: %s\n",

}/* end of server infinite loop */

return 0;
}

Tuesday, March 31, 2009

AVG Antivirus Free Download a free.avg.com Online

Here are some links for avg antivirus free, avg antivirus, avg free download, avg antivirus gratis, avg free

AVG Anti-Virus Free Edition - trusted by 80 million users. Antivirus and antispyware protection for Windows available to download for free ...
free.avg.com
free.avg.com/download-avg-anti-virus-free-edition
Download antivirus and antispyware security software for Windows for free, join the millions of home users that trust AVG to protect their computers.
free.avg.com

Come to CNET Download.com for free and safe AVG Anti-Virus Free Edition downloads. Protect your computer from viruses and malicious programs.
download.cnet.com

Thursday, March 26, 2009

From Windows Vista Home Edition Access SMBD ver 2.2.12

How to Access NAS Box From Windows Vista Home Edition?
Access NAS box windows vista (Ultimate editions), If you NAS box contains SMBD/ SAMBA version less than or equals 2.2.12
Steps to access NAS box from Windows Vista Home Edition
1. In the Windows taskbar, click Start and select Run. In Run window type “regedit” and press OK.
2. This will open User Account control window, here click continue.
3. Double click on the “HKEY_LOCAL_MACHINE” , “SYSTEM”, “Current Control Set” and
“Control”.
4. Then click on “Lsa” then you will get some parameters in the right windowpane.
5. Find for “LMCompatibilityLevel” and double click on this item.
6. In the edit window change the “Value data” to 1 from 3.
7. Press OK then Close the Registry Editor (regedit).

your Vista PC ready to access the NAS box.

Wednesday, March 25, 2009

Access NAS Box From Windows Vista Ultimate Edition

How to Access NAS Box From Windows Vista Ultimate Edition?
Access NAS box windows vista (Ultimate editions), If you NAS box contains SMBD/ SAMBA version less than or equals 2.2.12
Steps to access NAS box from Windows Vista Ultimate Edition

1. In the Windows taskbar, click Start and select Run. In Run window type “secpol.msc” and press OK.
2. This will open User Account control window, here click continue.

3. Now double click on the “Local Policies” and click on “Security Options”.
4. Find “Network Security: LAN Manager authentication level” in right windowpane and double click on this policy.

5. Now change Local Security Setting “Send NTLMv2 response only” to “Send LM & NTLM –use NTLMv2 session security if negotiated”.
6. click “apply” and then “OK”.
Now your Vista PC ready to access the NAS box.
Share your tricks also.

Thursday, March 19, 2009

How To Compile Tool Chain For Bootloader

For compiling Uboot 3.4.4 tool chain is required.
Steps to check and change tool chain correspondingly
1) At the bash prompt of your Linux PC, execute the following command.

$ tar -zxvf arm-tools.tar.gz

Now you will have the "arm-tools" folder created in your current directory.


2) Copy the "arm-tools" directory to your home directory (or wherever you
prefer to)

$ cp -rf arm-tools ~/


3) Modify the .bash_profile file in the home directory, by using the following
steps. (Add the following lines in .bash_profile)

$ vi ~/.bash_profile

This will open the file for editing. Make the following changes in the file

export HOME=$HOME/arm-tools
PATH=$PATH:$HOME/bin:$HOME/arm-tools/arm-linux/bin:$HOME/arm- tools/image_tools/:$HOME/arm-tools/image_tools/bin

export PATH

Close the ".bash_profile" file.


4) Then execute the command

$ source .bash_profile


5) To check whether arm-tools environment has been properly set or not type the
following at the prompt

$ which arm-linux-gcc

The expected output is as follows:

~/arm-tools/arm-linux/bin/arm-linux-gcc

If the tool chain doesn't get set with by doing above step 5 logout and login
again to the system and repeat the step 5.

Related
check out what is bootloader in embedded system.
Internal bootloader.

Wednesday, March 18, 2009

How to participate in the Linux kernel community

How to participate in the Linux kernel community? check out A GUIDE TO THE KERNEL DEVELOPMENT PROCESS
Jonathan Corbet has written a very interesting article on "how
to participate in the Linux kernel community"

Section 1 is the executive summary.

Section 2 introduces the development process, the kernel release
cycle, and the mechanics of the merge window.

Section 3 covers early-stage project planning, with an emphasis
on involving the development community as soon as possible.

Section 4 is about the coding process; several pitfalls which
have been encountered by other developers are discussed.

Section 5 talks about the process of posting patches for review.

Section 6 covers what happens after posting patches; the job is
far from done at that point.

Section 7 introduces managing patches with git and reviewing
patches posted by others.

Section 8 concludes the document with pointers to sources for
more information on kernel development.

Please take a look at the complete document at
http://ldn.linuxfoundation.org/how-participate-linux-community
Please click here to download the PDF version.

Tuesday, March 17, 2009

Adding Network Printer in MS windows Simplest Way

yes you can add Network Printer in MS windows in very Simplest Way. I was allocated a new windows Xp PC, I was waiting for network printer to configure on my new machine. I just tried this simplest way, rather to wait for network admin. My friend also asked me about configuration for network printer and i told him same way, which is worked for him also. Here is simplest way to configure your new printer.

go to start->settings-> Printers and Faxes

Here you can see the default printer name.
Just ask your friend about the name of network printer, and all you have to do is rename your default printer with network printer name, your printer is on. check out this trick works for you also.
Sometimes you need to select the driver for the same, from printer properties-> advanced option.

comment on your tricks also.

Sunday, March 15, 2009

Difference Between Static And Shared Libraries ?

Libraries are collection of precompiled functions which have been written to be reusable.

Libraries in Linux are classified into two types:

1) Static Libraries:- The collection of object files kept together. When a program needs a function, that is stored in static library, it includes the header file that declares the function. The compiler combines the program code and linker links the library into an execuatble code.

Static Libraries are also called as archives that ends with .a extension.

e.g. /usr/lib/libc.a is a standard C library.

Disadvantage of Static Libraries:- In the static libraries the function code is included in the executable. So when we run many applications that use the same function code, we end up with many copies of same functions in memory.

2) Shared Libraries:- When a program uses a function in a shared library, then that code does not get included in the execuatable. Instead it references to shared code that will be made available at run time. So when that program is loaded in memory to execute, the functions references are resolved and calls are maded to shared libraries which will be loaded into memory.

So many applications uses a single copy of shared libraries. Also shared libraries can be updated independently of the applications that rely on it.

Shared libraries has the form libname.so.N

name - name of library so - extension N - major revision number

e.g. libc.so.5

Shared libraries(.so) are just like Dynamic Link Libraries(.dll) in Windows.

Thursday, March 5, 2009

Loop Unrolling or Loop unwinding in C

What is Loop Unrolling or Loop unwinding in C?
Loop unwinding, also known as loop unrolling, is a loop transformation technique that attempts optimize a program's execution speed at the expense of its size.
The goal of loop unwinding is to increase the program's speed by reducing (or eliminating) the "end of loop" test on each iteration. Loops can be re-written as a sequence of independent statements which eliminates the loop controller overhead.
The major side effects of loop unrolling is The increased register usage in a single iteration to store temporary variables (though much will depend on possible optimizations), which may hurt performance.
The code size expansion after the unrolling, which is undesirable for embedded applications and for purposes of code readability. Large code can also cause an increase in instruction cache misses, which may adversely affect performance.
A simple example
A procedure in a computer program is to delete 100 items from a collection. This is accomplished by means of a for-loop which calls the function delete(item_number):


for (int x = 0; x <>



If this part of the program is to be optimized, and the overhead of the loop requires significant resources compared to that for delete(x), loop unwinding can be used to speed it up. This will result in an optimized code fragment like:


for (int x = 0; x <>


As a result of this modification, the new program has to make only twenty loops, instead of a hundred.

check example here.

Wednesday, March 4, 2009

Access Samba Using Dos Commands List Here

I was searching for accessing samba using DOS command, Finally I managed it by own; here is list of useful command.
To mount or to map the SAMBA folder to local machine.
eg; to map public folder from and copy test.txt
use :- net use z: \\computer\folder
Map the Z: drive to the network path //computer/folder.
net use z: \\2.168.4.500\public

enter user-name (if connecting first time)
enter password

To copy the data to this drive

ie to put file
copy test.txt \\2.168.4.500\public

to get the file
copy \\2.168.4.500\public\test.txt

To delete the connection
use
net use z: /del /yes

Tuesday, March 3, 2009

Scientists discover oldest words in the English language

The oldest words in the English language include "I" and "who", while words like "dirty" could die out relatively quickly, British researchers said Thursday.
clipped from www.physorg.com

Scientists discover oldest words in the English language, predict which ones are likely to disappear

Scientists at the University of Reading have discovered that 'I', 'we', 'who' and the numbers '1', '2' and '3' are amongst the oldest words, not only in English, but across all Indo-European languages. What's more, words like 'squeeze', 'guts', 'stick', 'throw' and 'dirty' look like they are heading for history's dustbin - along with a host of others
Evolutionary language scientistsfrom the University of Reading
have been investigating how languages evolve, and whether that evolution followed any rules. Until recently they believed they would not be able to track words back in time for more than 5,000 years, however their new IBM supercomputerhas enabled them to go back almost 30,000 years, and finally provide the answers
Supercomputers are enabling the world to become increasingly interconnected, instrumented and intelligent
 blog it

Friday, February 27, 2009

Linux Essential Shortcuts and Commands

Linux essential shortcuts and sanity commands


Switch to the first text terminal. Under Linux you can have several (6 in standard setup) terminals opened at the same time.
(n=1..6)
Switch to the nth text terminal.
tty
Print the name of the terminal in which you are typing this command.

Switch to the first GUI terminal (if X-windows is running on this terminal).
(n=7..12)
Switch to the nth GUI terminal (if a GUI terminal is running on screen n-1). On default, nothing is running on terminals
8 to 12, but you can run another server there.

(In a text terminal) Autocomplete the command if there is only one option, or else show all the available options.
THIS SHORTCUT IS GREAT! It even works at LILO prompt!

Scroll and edit the command history. Press to execute.

Scroll terminal output up. Work also at the login prompt, so you can scroll through your bootup messages.

Scroll terminal output down.
<+>
(in X-windows) Change to the next X-server resolution (if you set up the X-server to more than one resolution). For multiple resolutions on my standard SVGA card/monitor, I have the following line in the file /etc/X11/XF86Config (the first resolution starts on default, the largest determines the size of the "virtual screen"):
Modes "1024x768" "800x600" "640x480" "512x384" "480x300" "400x300" "1152x864"
<->
(in X-windows) Change to the previous X-server resolution.

(in X-windows) Kill the current X-windows server. Use if the X-windows server crushes and cannot be exited normally.

Useful Tips
I. If the output of a command scrolls too fast and you missed
something, press SHIFT+PAGEUP key to scroll backup.

II. You need not type the full name of a file or a command the TAB key
has an autocomplete feature in bash.
For example, let's say you have a file one_awefully_long_name_file
in your home directory, and want to look at its contents. You can say:
$ cat one[TAB]
The file name will be completed, provided no other file has
its name starting from 'one'. This tip can be applied any time you have
to enter a file-name or path-name at the command-prompt.
Similarly, you can also autocomplete commands also:
$ Xc[TAB]
will automatically insert:
$ Xconfigurator
As if that were not enough, pressing TAB twice will list all the
files/commands starting with that pattern. Try these:

$ cat a[TAB][TAB]
$ X[TAB][TAB]

III. You can work in multiple terminals, running KDE in one and pure
console on another. Press CTRL+ALT+F2. See the login prompt? Usually
there will be six such virtual terminals. You can be using all of them.
Press CTRL+ALT+F-keys to switch. CTRL+ALT+F7 returns you to X if you
were originally using X Window like

Thursday, February 19, 2009

9 brain habits you did not realize you had

Brain is certainly the most amazing part of human body. It becomes more interesting when it does not work the way you expect it should. Psychology frequently establishes our intuitions about how human mind works, but it reveals a number of surprises as well…
clipped from www.mindcafe.org

1) The maximum capacity of your short-term memory is seven.

short-term memory is seven

2) The most visible color is Chartreuse.

most visible color is Chartreuse

3) Subconscious is smarter than you.

Subconscious is smarter than you

4) There are two nervous systems.

There are two nervous systems

5) Brain is exceptionally bad at probability.

Brain is exceptionally bad at probability

6) Memory isn’t great either.

Memory isn’t great either

7) Depth is perceivable with one eye.

Depth is perceivable with one eye

8 ) Long-term memory closes up during sleep.

Long-term memory closes up during sleep

9) The Brain has an amazing instant playback feature.

Brain has an amazing instant playback feature

Brain is certainly the most amazing part of human body. It becomes more interesting when it does not work the way you expect it should. Psychology frequently establishes our intuitions about how human mind works, but it reveals a number of surprises as well…

 blog it

Wednesday, February 18, 2009

Useful Vi Editor Trick

Here is yet another Vi editor trick. At the Vi editor, we can edit multiple files by switching between them (With out opening another terminal)

$vi ex1.c ex2.c ex3.c

To switch one file to another use :n, :#e (With out exiting and opening the file)
like $vi ex1.c ex2.c ex3.c

:n Move forward to next file is the file list
:e# Toggle between the last two edited files
:rew Rewind file list and reopen first file in the list

Monday, February 16, 2009

Animated LILO The Linux Loader for SuSE Linux 7.2 or Animated boot-up screen

It's just something fun to do to add eye candy to your boot-up screen, if your tired of looking at the same old LILO prompt or boot-up screen every time you start your system.
Make your LILO boot screen more exciting with animated pictures! From the author's web page:

Since mid-2001, most Linux distributions include some patched versions of LILO (the LInux LOader) that support VGA or VESA graphical modes and make it possible to have a nice background image while booting. Starting with SuSE Linux 7.2, the SuSE distribution includes an interesting extension to LILO that allows a programmer to define some callback functions that are triggered when some events occur (key pressed, timeout, ...). It gives a much greater flexibility than the other extensions that are provided by most of the other Linux distributions, including the new graphical modes that have recently been added to the official version of LILO 22.x.

While testing the SuSE version of LILO and the helper program mkbootmsg, I was wondering if the timer callbacks together with the function that copies parts of the image to the screen could be used for creating animations. I quickly found out that it was indeed possible to enhance the boot screen with animations. Since my friends liked the results, I decided to share them on this web site. ... These animated boot screens have been tested with SuSE Linux 7.2 and 7.3. If you are using another distribution such as Debian, Red Hat, Mandrake or a custom set of packages, you will not get the expected results if you keep the version of LILO included in your distribution.
help page.

Sunday, February 15, 2009

Gear Up for GSoC 2009 Google Summe of Code

http://www.gstatic.com/codesite/ph/images/code_sm.png The Google Summer of Code is a program designed to encourage college student participation
in open source development.
How does it work? Students submit project proposals to the organizations,
organizations rank the submissions (students paired with
mentor from open source community).Google allocates a given number of slots to each
organization, the students work all summer on their project in close mentored collaboration with that organization.
GSoC 2009 Timeline
March 9-13: Google will accept applications from open source projects.
March 13-17: Google program administrators review organization applications.
March 18: List of accepted mentoring organizations published on code.google.com/soc/
March 23-April 3: Student applications acceptance period.
March 23: Student application period opens.
April 3: Student application deadline.
April 20: Accepted student proposals announced at http://code.google.com/soc/
August 24: Final evaluation deadline.
September 3: Students can begin submitting required code samples to Google.

Google will provide a stipend of 5000 USD per accepted
student developer, of which 4500 USD goes to the student
and 500 USD goes to the mentoring organization.
• Accepted students in good standing with their mentoring
organization will receive a 500 USD stipend shortly after
coding begin.
• Students who receive passing mid-term evaluations will
receive a 2000 USD stipend shortly after the mid-term
evaluation.
• Students who receive passing final evaluations and who have
submitted their final program evaluations will receive a 2000
USD stipend and mentoring organizations will receive 500
USD shortly after the final evaluation deadline.
For more information visit
http://code.google.com/soc/
and apply!
Presentations on the Google Summer of Code Program

Thursday, February 12, 2009

Useful VI Commands For Linux Beginners Read on

useful vi commands for Linux beginners

1) To open two files in single window of vi editor
a) vi a.c
b) give the following command in vi editor to open b.c file
:sp b.c
c) Now vi editor contain two files in each half screen. TO switch
between two files use ctrl+ww.


2)Replacing a text
a) vi a.c
b) In a.c file, replace printf with printk using follwing command
:%s/printf/printk
This will replace only first occurrence of printf in each line.
:%s/printf/printk/g
The above command will replace all printf words in entire
file with printk.
:%s/printf/printk/gc
The above command will ask confirmation.
:s/printf/printk
This commamnd will replace in current line.

3)setting auto indentation:

In home directory create .exrc file add the following commands
:set nu
:set cindent

:set cindent will do indentation in C
4) To open a man page of a system call from vi editor
a) vi a.c
put the cursor at system call and press shift+k

5) commands:

G : to goto endline in vi
X : delete the character
J : To join two lines
DW : Delete the Word
/str : search down for string
?str : search up for string

Wednesday, February 11, 2009

Linux Command Line Most Used Shortcuts

Just sharing some of the command line shortcuts that I used and learnt; please share yours also.

1. To search in history or run previous commands
This is my most used shortcut. Hit Control-R and begin to type a string.

For example, type the following and hit Enter.

grep root /etc/passwd

Then hit Control-R and begin to type 'grep'.

Control-R
(reverse-i-search)`gre': grep root /etc/passwd

When you see the original command listed, hit Enter to execute it. Alternatively, you can also hit the Right-Arrow to edit the command before running it.


Use -> ctrl + r and type the command, to go one more level back again hit ctrl + r, to edit the command before you execute use right key arrow.

2. To clear the present screen use -> ctrl + l (My discovery works on board also).

3. To edit previous command using vi commands -> set -o vi

Now you can use the Vi cw command to change the word in command.

4. Use of alias

alias ll='ls -l'
alias gohome='cd; ls'
If you want these custom aliases should be available each login, add them to your .bashrc.

You can refer to command line Bible got by chancehttp://blog.taragana.com/wp-content/uploads/2009/01/linux-command-line.jpg

Features in a Nutshell

  • Understand the Linux desktop and various command-line parameters
  • Learn filesystem navigation, file handling, and the basics of bash shell commands
  • Write shell scripts to automate routine functions and reports
  • Harness nesting loops and structured commands
  • Monitor programs, master file permissions, and make queries
  • Run scripts in background mode and schedule jobs
  • Use sed, gawk, and regular expressions
  • Explore all alternate shells, including ash, tcsh, ksh, korn, and zsh

Download




This is a linux command line reference for common operations at one place.