Saturday, May 28, 2011

writing a C/C++ program in ubuntu

Gosh!! this took me a hell lot of searches. Nowhere I could find the proper way to do it. Not even the linux gcc tutorial explained it satisfactorily. After days of searches, I luckily landed on the physics forum where a guy ('' neilay from India \n") had answered beautifully. In case you are very new to linux, this might help you.

Make sure you have the necessary gcc files installed.
To install required packages for c and c++ compilers
in the terminal window, type: sudo apt-get install build-essential

To Program in Ubuntu, follow the following steps:
1. Click on Places on menu bar > go to Home Folder.
2. A new window appears.
3. Here rightclick on your mouse button > Create Document > click on Empty File.
4. Select the file > press F2 > rename it as monika.c
5. Double click on monika.c
(steps 1 to 5 is equivalent to writing: gedit monika.c in the terminal window)
6. There you type the simplest 

C Code:
int main()
printf("my first c program \n");
return 0;

the C++ code:
using namespace std;

int main()
cout<<("my first c++ program \n");
return 0;

7. Save and minimize everything.
8. Click on Applications on the menu bar > Accessories > click on Terminal.
9. A new window appears and since my username is “monika”, monika@ubuntu: ~ appears on its title bar as default – this will be different in your case.
10. To compile a C code: type: gcc monika.c and press the Enter key.

      To compile a C++ code: type: g++ monika.c and press the Enter key.
11. Wait and if your code is correct no error will be found and simply monika@ubuntu: ~ $ will be
appeared and indicates you can execute this compiled file.
12. Now type: ./a.out and press the Enter key and see how nicely your file is executed!
13. This procedure must work with both Ubuntu and Fedora. If it is not working, then definitely
your OS has got problem with it.

14. That's all about Ubuntu C Programming.

Happy programming!

Friday, May 27, 2011

wallpaper clock on ubuntu :)

I have finally installed ubuntu10.10 on my laptop, after a number of trials and errors, bugging some of my fellow batch-mates big time. Somehow, i did it on my own. And thank god !! my hard disk did not crash.
It seems to be quite a compulsion that every Linux user blogs about using and having fun with it. So in the prospective of becoming a faithful Linux user, here i go, blogging about my first experience.
I came across this interesting thing while looking for some nice wallpapers for my desktop. A wallpaper clock, have a look at some of them...

nice na !! real time clocks beautifully integrated on your wall. Below are the steps to get one for your Ubuntu desktop.

1. First you need to install screenlets. The command is ' sudo apt-get install '. I installed it by going ubuntu software center in the applications drop-down-list.

2. Download wallpaper clock of your choice from vladstudio. The downloaded file will have a .wcz extension.
3. After the installation is complete, go to Application > Accessories > Screenlets

4. There is a wallpaper clock widget in the list of widgets. select and click on Launch/Add on the top left corner just below the search bar.

5. The widget appears on the desktop. right click on the widget. click on 'install wallpaper clock'. Browse from for the .wcz extension file you downloaded. the wallpaper is installed.

6. To apply on the desktop, right click on the widget again. select change wallpaper clock >my wallpapers> "the downloaded wallpaper"

Have fun !!