Thursday, November 4, 2010

Reset GNOME to default

rm -rf .gnome .gnome2 .gconf .gconfd .metacity
This will reset the GNOME desktop to its default settings. If you have done a lot of changes and tweaks to your desktop and want to get it to its default setting, then you can delete these folders.
On restarting the system, the default settings will be restored.
To restore the panels to its default settings :
administrator@ubuntu:~$ gconftool --recursive-unset /apps/panel
administrator@ubuntu:~$ rm -rf ~/.gconf/ apps/panel
administrator@ubuntu:~$ pkill gnome-panel

Automatically login to GNOME and KDE

If you want to login without entering your password at boot up, you can do the following changes to your system.
For Ubuntu 10.04 (Lucid Lynx)
1. Load the Gnome Administration utility by clicking on System -> Administration -> Login Screen Settings
2. Unlock the window by hitting the unlock button (you will be asked for the administrator password)
3. Enable the checkbox for Log in as <> automatically (Select your User Name from the drop-down list of users).
1. K–>System Setting-> Login Manager.
2. Click on the Administrative Mode.
3. Enter your password when prompted.
4. Click on the Convenience tab and check the Enable Autologin checkbox option.
5. Select the user who would be logged in automatically(if there are multiple users).
Through command-line, it can be done by editing the kdmrc file and making the following changes /etc/kde4/kdm/kdmrc:

Switching between KDE and GNOME

If you’ve installed UBUNTU on your system, then the default desktop environment is GNOME. You can install KDE in UBUNTU through the following steps:
Open Ubuntu Software Centre.
Type Kubuntu and install Kubuntu Plasma Desktop system.Enter your password when prompted.
After the installation process is complete, log out and log in again. This time select KDE from the bottom of the log in screen.
However, you can only log out of KDE desktop environment back to the login screen. You will not have options like SHUTDOWN and RESTART in your KDE environment. This is because, although you login to KDE, the default display manager is still GDM (GNOME Display Manager).
If you want the (SHUTDOWN, RESTART etc.) options to appear in your KDE desktop environment, then you need to change the display manager to KDM (KDE Display Manager).
To do this, open up a terminal and type :
sudo dpkg-reconfigure kdm
and follow the fairly intuitive steps.
If you log out and log in again, the options should be enabled. But if you login to GNOME then those options will be disabled for the same reasons as above.
To change the display manager to gdm, simply type
sudo dpkg-reconfigure gdm.

A C program in Ubuntu

The GNU C compiler(gcc).
This is the GNU C compiler, a fairly portable optimizing compiler for C.
This is a dependency package providing the default GNU C compiler.
The first thing to do is to check if gcc is installed in your system.
This can be done by opening a terminal
and typing:
which gcc
This gives the location where it is installed.
Usually, the output is :
If gcc is not installed type :
sudo apt-get install build-essential
To check the version type
gcc -v
The output is :
Target: i686-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.4.4-14ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.4/README.
Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.4 --enable-shared --enable-multiarch --enable-linker-build-id --with-system-zlib --
libexecdir=/usr/lib --without-included-gettext
--enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4 --libdir=/usr/lib
--enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug
--enable-objc-gc --enable-targets=all --disable-werror --with-arch-32=i686
--with-tune=generic --enable-checking=release --build=i686-linux-gnu --host=i686-linux-gnu
Thread model: posix
gcc version 4.4.5 (Ubuntu/Linaro 4.4.4-14ubuntu5)
The next part is to compile and run a C program.
Type the program in any editor
and save it as hello.c
Sample code is given below:
#include "stdio.h"
int main()
printf("Hello World\n");
printf("C in Linux\n");
return 0;
In your terminal, go to the location where you have saved your program.
cd Desktop, if it has been saved in the desktop.
Then type
gcc hello.c -o hello
followed by
You should get the output on your screen.
If u get any permission error then,
chmod +x hello.c
Digging a little deeper
I wrote a code and saved it as test.c
#include "stdio.h"
void main()
for (int i=0;i<10 ;i++)
When I tried to compile using
gcc test.c -o test
it gave an error:
test.c: In function ‘main’:
test.c:5: error: ‘for’ loop initial declarations are only allowed in C99 mode
test.c:5: note: use option -std=c99 or -std=gnu99 to compile your code
It turns out that declaring 'i' inside the for loop is illegal in C90 mode, which
is the default mode. To compile it you either need to declare 'i' outside the for loop
int i
this works fine.
Or to use the c99 mode, where it is legal to declare variables inside the for loop.
gcc test.c -std=gnu99 -o test
gcc test.c -std=c99 -o test

My first Makefile

A starter’s guide to a makefile
This post is just the tip of the iceberg called “make” and its capabilities. It does not even scratch the surface but is meant as a tutorial to write your first makefile.
The following Makefile is used to make it easier to type commands to compile and run a program.
for eg. to compile arg.c
we use
gcc -o arg arg.c
Instead of this we can create a Makefile as:
(tab) gcc -o arg arg.c
and save it as Makefile in the directory where our program arg.c is saved.
Now we can type:
$ make 1
to compile the program
to run the program.
anand@anand-desktop:~/Desktop$ make 1
Makefile:5: *** missing separator. Stop.
This error comes if we have missed the tab in the newline before gcc -o arg arg.c
(Tab) gcc -o arg arg.c
Make sure you press the tab key and not write (Tab) .
If we can compile a program, why not run it too?
edit the Makefile and add the following:
(tab) ./arg
$make 1
$make 2
in your terminal is same as
gcc -o arg arg.c
followed by

Tuesday, April 20, 2010

Mother's Day, Flowers and 1800flowers

Mother's Day is to celebrate those people who have the biggest but quietest influence in our lives.If a wish or a gift has touched your heart on Mother's Day, then say 'Thank You'. Also this is a good time to thank your mom or someone you feel is as inspiring or loving. Nothing can come close to the love that a mother feels for her children. Most women are inherently excellent mothers. Women carry their young before they are born and then continue to nurture them throughout their childhood and even into adulthood.

Mothers make sure that their children are safe and happy throughout their childhood. It is the unconditional love that a mother feels that drives these feelings. It is hard to describe the feeling that a mother has towards her children. In fact, most people do not understand unless they become a mother themselves.

A famous saying states that "God could not be everywhere and so he invented mothers", these words are a great inspiration to mothers across the world. When all is well, a mother puts her children before anything else, including their own comfort and happiness.

To celebrate Mothers Day and appreciate the beautiful things that she has done for you, 1800Flowers brings to you a wide range of gifts and flowers to choose from. What better way then, than to gift your mom with those lovely flowers and brighten her day?

Wednesday, February 10, 2010

1800flowers for your valentine

Valentine’s Day is fast approaching and flowers are an easy and affordable way to get a smile from those you love on Valentine’s Day.
The most important aspect of all things on Valentine’s Day is not the price but your thoughtfulness and creativity. Flowers have a magical way of saying what words sometimes cannot. At the same time the words that accompany the flowers can have a power of their own.
1-800-flowers has introduced several Twilight flowers DVD offer. One of them is really cool in that it actually comes with a pre-order of the New Moon DVD.
Basic Package is $49.95 and comes with 12 Premium long stem roses, Exclusive Twilight Gift Card / Poster from Hallmark, and Clear or silver vase available at additional cost.
Premium Package is $99.95 and includes your roses doubled to 24 Premium long stem roses, Pre-order New Moon DVD, Collectible Twilight Chocolate Candy Bars, Exclusive Hallmark Twilight Card/Poster, and Clear or silver vase available at additional cost.
1800flowers offers these exclusive gift packages for a very reasonable price. In fact, according to MSNBC, 1800flowers has been approved to have a much better policy with regards to price than its competitors.