You can run (virtually) any operating systems like Linux (Fedora, Ubuntu, Debian, CentOS), FreeBSD in your Windows PC. For the last few days, I was evaluating Oracle's VirtualBox. The good news is, it is available for free and available under GPL.
There is no pain of partitioning your disk, disk corruption, etc. VirtualBox is an amazing solutions for Multi-OS lovers like me.
You can install any Operating System in your PC with the following steps:
1. Download VirtualBox
2. Download the VMware Image
3. Add the VMware Image into your VirtualBox
4. Tweak the memory, hard-disk, network, and display
5. Your Operating System is ready for use as an application
Post me any question on troubleshooting VirtualBox, I will try to answer them.
Get Virtual Box here
Get VMware Images here
Showing posts with label programming. Show all posts
Showing posts with label programming. Show all posts
Thursday, November 25, 2010
Thursday, February 05, 2009
Creating Static Libraries in Linux
add.c
=====
mul.c
=====
Creating Archive
================
ar cr libaddmul.a add.o mul.o // Create and replace the obj files in the archive
ranlib libaddmul.a // generate index to archive
nm libaddmul.a // list symbols from object files
How to use the Static Library
=============================
math.c
======
addmul.h
========
=====
int add(int a, int b) {
return a+b;
}
int sub(int a, int b) {
return a-b;
}
>>gcc -c add.c // creates add.o
mul.c
=====
int mul(int a, int b) {
return a*b;
}
int div(int a, int b) {
return a/b;
}
>>gcc -c mul.c // Creates mul.o
Creating Archive
================
ar cr libaddmul.a add.o mul.o // Create and replace the obj files in the archive
ranlib libaddmul.a // generate index to archive
nm libaddmul.a // list symbols from object files
How to use the Static Library
=============================
math.c
======
#include "stdio.h"
#include "addmul.h"
int main() {
printf(" 3 + 5 = %d\n", add(3, 5));
printf(" 3 - 5 = %d\n", sub(3, 5));
printf(" 3 * 5 = %d\n", mul(3, 5));
printf(" 3 / 5 = %d\n", div(3, 5));
return 0;
}
addmul.h
========
extern int add(int, int);
extern int sub(int, int);
extern int mul(int, int);
extern int div(int, int);
gcc -o math math.c -L((libaddmul.a path)) -laddmul // compile math.c with addmul library
Thursday, July 24, 2008
Knowledge Portfolio
Your Knowledge Portfolio is very important to your career, so keep updating it. In this hot industry, the only thing that is not changing is 'Change'. Change is everywhere in IT industry, so it should be one of our goal to be up-to-date with the change.
Here are some of the tips from the Book, The Pragmatic Programmer:
=> Learn at least one new language every year. Different languages solve the same problems in different ways. By learning several different approaches, you can help broaden your thinking and avoid getting stuck in a rut. Additionally, learning many languages is far easier now, thanks to the wealth of freely available software on the Internet. (You can start by learning Haskell/Lisp/Prolog)
=> Read a technical book each quarter. Bookstores are full of technical books on interesting topics related to your current project. Once you're in the habit, read a book a month. After you've mastered the technologies you're currently using, branch out and study some that don't relate to your project. (Stalin, this is not for you)
=> Read nontechnical books, too. It is important to remember that computers are used by people—people whose needs you are trying to satisfy. Don't forget the human side of the equation. (You can start by reading GEB, Infinity and Mind, Books by Roger Penrose, Richard Meyers, Steven Pinker) (Stalin, this also is not for you)
=> Take classes. Look for interesting courses at your local community college or university, or perhaps at the next trade show that comes to town.
=> Participate in local user groups. Don't just go and listen, but actively participate. Isolation can be deadly to your career; find out what people are working on outside of your company.
=> Experiment with different environments. If you've worked only in Windows, play with Unix at home (the freely available Linux is perfect for this). If you've used only makefiles and an editor, try an IDE, and vice versa.
=> Stay current. Subscribe to trade magazines and other journals. Choose some that cover technology different from that of your current project.
=> Get wired. Want to know the ins and outs of a new language or other technology? Newsgroups are a great way to find out what experiences other people are having with it, the particular jargon they use, and so on. Surf the Web for papers, commercial sites, and any other sources of information you can find.
Here are some of the tips from the Book, The Pragmatic Programmer:
=> Learn at least one new language every year. Different languages solve the same problems in different ways. By learning several different approaches, you can help broaden your thinking and avoid getting stuck in a rut. Additionally, learning many languages is far easier now, thanks to the wealth of freely available software on the Internet. (You can start by learning Haskell/Lisp/Prolog)
=> Read a technical book each quarter. Bookstores are full of technical books on interesting topics related to your current project. Once you're in the habit, read a book a month. After you've mastered the technologies you're currently using, branch out and study some that don't relate to your project. (Stalin, this is not for you)
=> Read nontechnical books, too. It is important to remember that computers are used by people—people whose needs you are trying to satisfy. Don't forget the human side of the equation. (You can start by reading GEB, Infinity and Mind, Books by Roger Penrose, Richard Meyers, Steven Pinker) (Stalin, this also is not for you)
=> Take classes. Look for interesting courses at your local community college or university, or perhaps at the next trade show that comes to town.
=> Participate in local user groups. Don't just go and listen, but actively participate. Isolation can be deadly to your career; find out what people are working on outside of your company.
=> Experiment with different environments. If you've worked only in Windows, play with Unix at home (the freely available Linux is perfect for this). If you've used only makefiles and an editor, try an IDE, and vice versa.
=> Stay current. Subscribe to trade magazines and other journals. Choose some that cover technology different from that of your current project.
=> Get wired. Want to know the ins and outs of a new language or other technology? Newsgroups are a great way to find out what experiences other people are having with it, the particular jargon they use, and so on. Surf the Web for papers, commercial sites, and any other sources of information you can find.
Wednesday, June 25, 2008
Pointer to functions - Simplified
Here is the code
1 #include < iostream >
2
3 using namespace std;
4
5 int add(int a, int b) {
6 return a+b;
7 }
8
9 int sub(int a, int b) {
10 return a-b;
11 }
12
13 // typdef pointer to a function
14 typedef int (*fpp)(int, int);
15
16 // Array of pointers to function
17 fpp fp[2];
18
19 // Function returning a pointer to a function
20 int (* getfp(int i) ) (int, int) {
21 if(i==1) return & add;
22 else return & sub;
23 }
24
25 // Pointer to a function returning a pointer to a function
26 int (* (*fgetfp)(int)) (int, int);
27
28 int main() {
29
30 fgetfp = &getfp;
31
32 fp[0] = (*fgetfp)(1); // same as fgetfp(x)
33 cout<<"10 + 20 = "<< fp[0](10,20)<< endl;
34
35 fp[1] = fgetfp(2);
36 cout<<"10 - 20 = "<< fp[1](10,20)<< endl;
37 return 0;
38 }
39
Wednesday, June 04, 2008
Programming & Maths
Programming Books
=================
http://www.amazon.com/gp/richpub/syltguides/fullview/13FHH28JQNLRD/ref=cm_syt_dtpa_f_1_rdssss0?pf_rd_p=253457301&pf_rd_s=sylt-center&pf_rd_t=201&pf_rd_i=0139798099&pf_rd_m=ATVPDKIKX0DER&pf_rd_r=0E0JVZ79T9VVSWCWE296
1. Structure and Interpretation of Computer Programs by Harold Abelson
2. Art of Computer Programming - D.E. Knuth
3. Computer Organization and Architecture by William Stallings
4. C Programming Language
5. Advanced Programming in the UNIX Environment
6. Thinking in C++
Mathematical Books (for Programmers)
==================
http://www.amazon.com/exec/obidos/tg/guides/guide-display/-/3MLMYHG1P537N/ref=cm_bg_em_vg_htm_btm/
1. Polynomials (Problem Books in Mathematics) by E.J. Barbeau
2. Calculus, Vol. 1 by Tom M. Apostol
3. Calculus, Vol. 2 by Tom M. Apostol
4. How to Solve It: A New Aspect of Mathematical Method by G. Polya
5. Basic Notions of Algebra by I.R. Shafarevich
6. Discrete Mathematics and Its Applications by Kenneth H. Rosen
7. Mathematical Analysis by Tom M. Apostol
8. Introduction to Analytic Number Theory by Tom M. Apostol
=================
http://www.amazon.com/gp/richpub/syltguides/fullview/13FHH28JQNLRD/ref=cm_syt_dtpa_f_1_rdssss0?pf_rd_p=253457301&pf_rd_s=sylt-center&pf_rd_t=201&pf_rd_i=0139798099&pf_rd_m=ATVPDKIKX0DER&pf_rd_r=0E0JVZ79T9VVSWCWE296
1. Structure and Interpretation of Computer Programs by Harold Abelson
2. Art of Computer Programming - D.E. Knuth
3. Computer Organization and Architecture by William Stallings
4. C Programming Language
5. Advanced Programming in the UNIX Environment
6. Thinking in C++
Mathematical Books (for Programmers)
==================
http://www.amazon.com/exec/obidos/tg/guides/guide-display/-/3MLMYHG1P537N/ref=cm_bg_em_vg_htm_btm/
1. Polynomials (Problem Books in Mathematics) by E.J. Barbeau
2. Calculus, Vol. 1 by Tom M. Apostol
3. Calculus, Vol. 2 by Tom M. Apostol
4. How to Solve It: A New Aspect of Mathematical Method by G. Polya
5. Basic Notions of Algebra by I.R. Shafarevich
6. Discrete Mathematics and Its Applications by Kenneth H. Rosen
7. Mathematical Analysis by Tom M. Apostol
8. Introduction to Analytic Number Theory by Tom M. Apostol
Wednesday, January 23, 2008
Knuth and Turing
Most of the Software Engineers don't know who is Donald Knuth and Turing. Oh ... God, have pity on them.
Last week on 10-Jan-08, I thought of writing an article about D.E.Knuth, who is one of my guru. Don't ask me whether I have read and understood any of his books, I was able to completely able to read and understand any of his books.
D.E.Knuth is one of the greatest Computer Scientist alive. He is the famous author of the famous book "The Art of Computer Programming". One of my life-time goal is to read his books and understand what is in it.
He is called as the father of "Algorithm Analysis". In 1971, Knuth was the recipient of the first ACM Grace Murray Hopper Award. He has received various other awards including the Turing Award, the National Medal of Science, the John von Neumann Medal and the Kyoto Prize(noble prize in Japan).
-- I will write about Alan Turing on some other day.
Last week on 10-Jan-08, I thought of writing an article about D.E.Knuth, who is one of my guru. Don't ask me whether I have read and understood any of his books, I was able to completely able to read and understand any of his books.
D.E.Knuth is one of the greatest Computer Scientist alive. He is the famous author of the famous book "The Art of Computer Programming". One of my life-time goal is to read his books and understand what is in it.
He is called as the father of "Algorithm Analysis". In 1971, Knuth was the recipient of the first ACM Grace Murray Hopper Award. He has received various other awards including the Turing Award, the National Medal of Science, the John von Neumann Medal and the Kyoto Prize(noble prize in Japan).
-- I will write about Alan Turing on some other day.
Tuesday, January 22, 2008
A simple fact abt Arrays
Consider the following array:
int a[5]={1, 2, 3, 4, 5};
a[i] == * (a + i)
* (a + i) == * (i + a)
* (i + a) = i[a]
yes, a[i] == i[a], both are same.
In this example 'a' is not a pointer the array. 'a' is just a value or constant. A pointer is an Variable, it means it's value can be modified.
'a' is a pointer constant, it is an address. That's why you can't put 'a' in the left hand side of the equation. 'a' is not an L-value.
int a[5]={1, 2, 3, 4, 5};
a[i] == * (a + i)
* (a + i) == * (i + a)
* (i + a) = i[a]
yes, a[i] == i[a], both are same.
In this example 'a' is not a pointer the array. 'a' is just a value or constant. A pointer is an Variable, it means it's value can be modified.
'a' is a pointer constant, it is an address. That's why you can't put 'a' in the left hand side of the equation. 'a' is not an L-value.
Thursday, December 13, 2007
Programming Books with Category
From the Bottom Up
This list is in the best reading order I could find. It’s not necessarily easiest to
hardest, but based on subject matter.
• Programming from the Ground Up by Jonathan Bartlett
• Introduction to Algorithms by Thomas H. Cormen, Charles E. Leiserson, and Ronald L. Rivest
• The Art of Computer Programming by Donald Knuth (3 volume set - volume 1 is the most important)
• Programming Languages by Samuel N. Kamin
• Modern Operating Systems by Andrew Tanenbaum
• Linkers and Loaders by John Levine
• Computer Organization and Design: The Hardware/Software Interface by David Patterson and John Hennessy
From the Top Down
These books are arranged from the simplest to the hardest. However, they can be
read in any order you feel comfortable with.
• How to Design Programs by Matthias Felleisen, Robert Bruce Findler, Matthew Flatt, and Shiram Krishnamurthi, available online at http://www.htdp.org/
• Simply Scheme: An Introduction to Computer Science by Brian Harvey and Matthew Wright
• How to Think Like a Computer Scientist: Learning with Python by Allen
Downey, Jeff Elkner, and Chris Meyers, available online at http://www.greenteapress.com/thinkpython/
• Structure and Interpretation of Computer Programs by Harold Abelson and Gerald Jay Sussman with Julie Sussman, available online at http://mitpress.mit.edu/sicp/
• Design Patterns by Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides
• What not How: The Rules Approach to Application Development by Chris Date
• The Algorithm Design Manual by Steve Skiena
• Programming Language Pragmatics by Michael Scott
• Essentials of Programming Languages by Daniel P. Friedman, Mitchell Wand, and Christopher T. Haynes
From the Middle Out
Each of these is the best book on its subject. If you need to know these languages,
these will tell you all you need to know.
• Programming Perl by Larry Wall, Tom Christiansen, and Jon Orwant
• Common LISP: The Language by Guy R. Steele
• ANSI Common LISP by Paul Graham
• The C Programming Language by Brian W. Kernighan and Dennis M. Ritchie
• The C++ Primer by Stanley Lippman
• The C++ Programming Language by Bjarne Stroustrup
• Thinking in Java by Bruce Eckel, available online at http://www.mindview.net/Books/TIJ/
• The Scheme Programming Language by Kent Dybvig
• Linux Assembly Language Programming by Bob Neveln
Specialized Topics
These books are the best books that cover their topic. They are thorough and
authoritative. To get a broad base of knowledge, you should read several outside of
the areas you normally program in.
• Practical Programming - Programming Pearls and More Programming Pearls by Jon Louis Bentley
• Databases - Understanding Relational Databases by Fabian Pascal
• Project Management - The Mythical Man-Month by Fred P. Brooks
• UNIX Programming - The Art of UNIX Programming by Eric S. Raymond, available online at http://www.catb.org/~esr/writings/taoup/
• UNIX Programming - Advanced Programming in the UNIX Environment by W.Richard Stevens
• Network Programming - UNIX Network Programming (2 volumes) by W.Richard Stevens
• Generic Programming - Modern C++ Design by Andrei Alexandrescu
• Compilers - The Art of Compiler Design: Theory and Practice by Thomas Pittman and James Peters
• Compilers - Advanced Compiler Design and Implementation by Steven Muchnick
• Development Process - Refactoring: Improving the Design of Existing Code by Martin Fowler, Kent Beck, John Brant, William Opdyke, and Don Roberts
• Typesetting - Computers and Typesetting (5 volumes) by Donald Knuth
• Cryptography - Applied Cryptography by Bruce Schneier
• Linux - Professional Linux Programming by Neil Matthew, Richard Stones, and 14 other people
• Linux Kernel - Linux Device Drivers by Alessandro Rubini and Jonathan Corbet
• Open Source Programming - The Cathedral and the Bazaar: Musings on Linux and Open Source by an Accidental Revolutionary by Eric S. Raymond
• Computer Architecture - Computer Architecture: A Quantitative Approach by David Patterson and John Hennessy
Further Resources on Assembly Language
In assembly language, your best resources are on the web.
• http://www.linuxassembly.org/ - a great resource for Linux assembly language programmers
• http://www.sandpile.org/ - a repository of reference material on x86, x86-64, and compatible processors
• http://www.x86.org/ - Dr. Dobb’s Journal Microprocessor Resources
• http://www.drpaulcarter.com/pcasm/ - Dr. Paul Carter’s PC Assembly Language
• http://webster.cs.ucr.edu/ - The Art of Assembly Home Page
• http://www.intel.com/design/pentium/manuals/ - Intel’s manuals for their processors
• http://www.janw.easynet.be/ - Jan Wagemaker’s Linux assembly language examples
• http://www.azillionmonkeys.com/qed/asm.html - Paul Hsieh’s x86 Assembly Page
This list is in the best reading order I could find. It’s not necessarily easiest to
hardest, but based on subject matter.
• Programming from the Ground Up by Jonathan Bartlett
• Introduction to Algorithms by Thomas H. Cormen, Charles E. Leiserson, and Ronald L. Rivest
• The Art of Computer Programming by Donald Knuth (3 volume set - volume 1 is the most important)
• Programming Languages by Samuel N. Kamin
• Modern Operating Systems by Andrew Tanenbaum
• Linkers and Loaders by John Levine
• Computer Organization and Design: The Hardware/Software Interface by David Patterson and John Hennessy
From the Top Down
These books are arranged from the simplest to the hardest. However, they can be
read in any order you feel comfortable with.
• How to Design Programs by Matthias Felleisen, Robert Bruce Findler, Matthew Flatt, and Shiram Krishnamurthi, available online at http://www.htdp.org/
• Simply Scheme: An Introduction to Computer Science by Brian Harvey and Matthew Wright
• How to Think Like a Computer Scientist: Learning with Python by Allen
Downey, Jeff Elkner, and Chris Meyers, available online at http://www.greenteapress.com/thinkpython/
• Structure and Interpretation of Computer Programs by Harold Abelson and Gerald Jay Sussman with Julie Sussman, available online at http://mitpress.mit.edu/sicp/
• Design Patterns by Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides
• What not How: The Rules Approach to Application Development by Chris Date
• The Algorithm Design Manual by Steve Skiena
• Programming Language Pragmatics by Michael Scott
• Essentials of Programming Languages by Daniel P. Friedman, Mitchell Wand, and Christopher T. Haynes
From the Middle Out
Each of these is the best book on its subject. If you need to know these languages,
these will tell you all you need to know.
• Programming Perl by Larry Wall, Tom Christiansen, and Jon Orwant
• Common LISP: The Language by Guy R. Steele
• ANSI Common LISP by Paul Graham
• The C Programming Language by Brian W. Kernighan and Dennis M. Ritchie
• The C++ Primer by Stanley Lippman
• The C++ Programming Language by Bjarne Stroustrup
• Thinking in Java by Bruce Eckel, available online at http://www.mindview.net/Books/TIJ/
• The Scheme Programming Language by Kent Dybvig
• Linux Assembly Language Programming by Bob Neveln
Specialized Topics
These books are the best books that cover their topic. They are thorough and
authoritative. To get a broad base of knowledge, you should read several outside of
the areas you normally program in.
• Practical Programming - Programming Pearls and More Programming Pearls by Jon Louis Bentley
• Databases - Understanding Relational Databases by Fabian Pascal
• Project Management - The Mythical Man-Month by Fred P. Brooks
• UNIX Programming - The Art of UNIX Programming by Eric S. Raymond, available online at http://www.catb.org/~esr/writings/taoup/
• UNIX Programming - Advanced Programming in the UNIX Environment by W.Richard Stevens
• Network Programming - UNIX Network Programming (2 volumes) by W.Richard Stevens
• Generic Programming - Modern C++ Design by Andrei Alexandrescu
• Compilers - The Art of Compiler Design: Theory and Practice by Thomas Pittman and James Peters
• Compilers - Advanced Compiler Design and Implementation by Steven Muchnick
• Development Process - Refactoring: Improving the Design of Existing Code by Martin Fowler, Kent Beck, John Brant, William Opdyke, and Don Roberts
• Typesetting - Computers and Typesetting (5 volumes) by Donald Knuth
• Cryptography - Applied Cryptography by Bruce Schneier
• Linux - Professional Linux Programming by Neil Matthew, Richard Stones, and 14 other people
• Linux Kernel - Linux Device Drivers by Alessandro Rubini and Jonathan Corbet
• Open Source Programming - The Cathedral and the Bazaar: Musings on Linux and Open Source by an Accidental Revolutionary by Eric S. Raymond
• Computer Architecture - Computer Architecture: A Quantitative Approach by David Patterson and John Hennessy
Further Resources on Assembly Language
In assembly language, your best resources are on the web.
• http://www.linuxassembly.org/ - a great resource for Linux assembly language programmers
• http://www.sandpile.org/ - a repository of reference material on x86, x86-64, and compatible processors
• http://www.x86.org/ - Dr. Dobb’s Journal Microprocessor Resources
• http://www.drpaulcarter.com/pcasm/ - Dr. Paul Carter’s PC Assembly Language
• http://webster.cs.ucr.edu/ - The Art of Assembly Home Page
• http://www.intel.com/design/pentium/manuals/ - Intel’s manuals for their processors
• http://www.janw.easynet.be/ - Jan Wagemaker’s Linux assembly language examples
• http://www.azillionmonkeys.com/qed/asm.html - Paul Hsieh’s x86 Assembly Page
Monday, October 08, 2007
The Tao of Programming
In the beginning was the Tao. The Tao gave birth to Space and Time. Therefore Space and Time are Yin and Yang of programming.
Programmers that do not comprehend the Tao are always running out of time and space for their programs. Programmers that comprehend the Tao always have enough time and space to accomplish their goals.
________________________________________________________________________________
The Tao gave birth to machine language. Machine language gave birth to the assembler.
The assembler gave birth to the compiler. Now there are ten thousand languages.
Each language has its purpose, however humble. Each language expresses the Yin and Yang of software. Each language has its place within the Tao.
But do not program in COBOL if you can avoid it.
________________________________________________________________________________
Once the Grand Master Turing dreamed that he was a machine. When he awoke he exclaimed:
"I don't know whether I am Turing dreaming that I am a machine, or a machine dreaming that I am Turing!"
________________________________________________________________________________
A master was explaining the nature of Tao of to one of his novices. "The Tao is embodied in all software - regardless of how insignificant," said the master.
"Is the Tao in a hand-held calculator?" asked the novice.
"It is," came the reply.
"Is the Tao in a video game?" continued the novice.
"It is even in a video game," said the master.
"And is the Tao in the DOS for a personal computer?"
The master coughed and shifted his position slightly. "The lesson is over for today," he said.
________________________________________________________________________________
Link: Tao of Programming
Programmers that do not comprehend the Tao are always running out of time and space for their programs. Programmers that comprehend the Tao always have enough time and space to accomplish their goals.
________________________________________________________________________________
The Tao gave birth to machine language. Machine language gave birth to the assembler.
The assembler gave birth to the compiler. Now there are ten thousand languages.
Each language has its purpose, however humble. Each language expresses the Yin and Yang of software. Each language has its place within the Tao.
But do not program in COBOL if you can avoid it.
________________________________________________________________________________
Once the Grand Master Turing dreamed that he was a machine. When he awoke he exclaimed:
"I don't know whether I am Turing dreaming that I am a machine, or a machine dreaming that I am Turing!"
________________________________________________________________________________
A master was explaining the nature of Tao of to one of his novices. "The Tao is embodied in all software - regardless of how insignificant," said the master.
"Is the Tao in a hand-held calculator?" asked the novice.
"It is," came the reply.
"Is the Tao in a video game?" continued the novice.
"It is even in a video game," said the master.
"And is the Tao in the DOS for a personal computer?"
The master coughed and shifted his position slightly. "The lesson is over for today," he said.
________________________________________________________________________________
Link: Tao of Programming
Subscribe to:
Posts (Atom)