Wednesday, April 11, 2007
How fast it can be
I. I would not like to use this I but as I am the user of this account and I am the one who is going to write in this blog so I have to use this I. Could any body tell me how I can avoid to use this I. This I is not good to be said, as said by many saints, many book teaches that we should avoid this I. Now, lets come to the topic as I should avoid don't be going off the track. I am pursuing FPGDST course from CDAC(Formerly NCST), Bangalore. And using many technologies on which I used to have just hands-on experience. I used to start on that technology as a hands-on and as there is not any such project so I just start them as printing a simple "Hello World \n". The basic line which is got printed by many Technical Writers. and having some hands on on loops, functions, structure/classes. That's it. Now, is this useful, as it takes a lot of time learning that technology and without running a single project on that I used to move over to another technology having and keeping a reference in my memory that ya I know something about that technology. Usually it takes 15 days to have just the basics, now joining some of the forums on the net makes you a bit smarter as a hands-on and problem solving skills in a hands-on. So, after learning a new technology one must discuss with others as a beginner level it should be done, which will take you one level up. Now, its upto you how you would like to use and implement. Use google to find out some of the forums in that technology or best is to Stumble on that topic against forums. It will give some really good results given by experienced persons. Don't forget to click on "I Like it" as you reach a good forum in that topic.
Rest is all upto you.
Good Luck in all of your efforts.
Read More
Rest is all upto you.
Good Luck in all of your efforts.
Tuesday, April 10, 2007
Installing jdk1.3.1 in Fedora6 or other Linux versions
Installing jdk1.3.1 in Fedora6 or other Linux versions
This is probably the hactic task to install jdk1.3.1 in Latest flavours of Linux. Installing the rpm is damn easy but to get it work is not so easy.
Well, let me start from downloading the jdk1.3.1 package from sun site.
Go to url http://java.sun.com and in the search bar just type "jdk1.3.1" and press enter. It will show you many results. To move to the downloads section, see carefully that the result which is shown belongs to a particular category. On that result page there is "Downloads" link. Click on that now Downloads section will be searched for "jdk1.3.1". And probably you will get many versions of "jdk1.3.1_*". Here * shows the different versions. Just choose one of them and it will move you to the downloads section. Download by clicking on the hyper link after accepting the agreement. Save the file in the users home directory.
Now, go to the terminal(bash shell), and move to that directory where the file is saved. then type
rpm -ivh jdk1.3.1_*
It will show you the progress bar and extract the files to /usr/java/jdk1.3.1_*
Move to that directory in the bin folder. and try to run ./java or ./javac
If it is running then probably everything is fine and you can start working on that, but in the latest flavours of Linux have the new versions of libstdc++ which are not supported by jdk1.3.1_*. So, you may probably get the error something like this :-
ot finding libstdc++-libc6.1-1.so.2.
So, for that you need to create a soft link for the file
libstdc++-libc6.1-1.so.2 ->(which will point to) libstdc++-2-libc6.1-1-2.9.0.so
ln -s libstdc++-2-libc6.1-1-2.9.0.so libstdc++-libc6.1-1.so.2
Well, do have that library you need to install "compat-libstdc++-296-2.96-132.fc4.rpm". If you don't know which version you are running run the command
rpm -qa | grep std
It will show you a list which are already installed in your system. After installing that, the above error will get removed now it will give a new error GLIBC_2.0. Its given below:
Error occurred during initialization of VM
Unable to load native library: /usr/java/jdk1.3.1/jre/lib/i386/libjava.so: symbol __libc_wait, version GLIBC_2.0 not defined in file libc.so.6 with link time reference
Now, to remove that error
create a file named libcwait.c
#include
#include
#include
#include
pid_t
__libc_wait (int *status)
{
int res;
asm volatile ("pushl %%ebx\n\t"
"movl %2, %%ebx\n\t"
"movl %1, %%eax\n\t"
"int $0x80\n\t"
"popl %%ebx"
: "=a" (res)
: "i" (__NR_wait4), "0" (WAIT_ANY), "c" (status), "d" (0),
"S" (0));
return res;
}
Compile it using
gcc -shared -o libcwait.so libcwait.c -fpic -O
Now export it
export LD_PRELOAD=/usr/java/jdk1.3.1/jre/lib/i386/libcwait.so
Now create one more file named hswaitpid.c
#include
#include
pid_t hslibc_waitpid(pid_t pid, int *status, int options) {
return waitpid(pid, status, options);
}
compile it using
gcc -shared -O3 -o libhswaitpid.so hswaitpid.c
Now do the following
cd /usr/java/jdk1.3.1/jre/lib/i386/; perl -e "while(<>) {" -e "s/__libc_wait/libc_wait/;" -e "print;" -e"}" libjava.so > libjava.so.tmp
mv libjava.so libjava.so.orig
mv libjava.so.tmp libjava.so
echo $LD_PRELOAD
mv libjava.so.orig libjava.so
Thats it, now you just a global variable using
export
Here, I am giving the steps to follow, by just copying history and removing the unnecessary steps.
732 rpm -ivh ~/test/java/jdk-1.3.1.i386.rpm
733 ls
734 type java
735 java
736 ls jdk1.3.1/bin/javac
737 jdk1.3.1/bin/javac
738 cd jdk1.3.1/jre/lib/i386/
740 vi libcwait.c
741 gcc -02 -shared -o libcwait.so -fpic libwait.c
742 gcc -02 -shared -o libcwait.so -fpic libcwait.c
743 gcc -shared -o libcwait.so libcwait.c -fpic -O
744 gcc -shared -o libcwait.so libcwait.c -fpic -O
745 gcc -shared -o libcwait.so libcwait.c -fpic -O
746 vi libcwait.c
747 gcc -shared -o libcwait.so libcwait.c -fpic -O
750 java
751 export LD_PRELOAD=/usr/java/jdk1.3.1/jre/lib/i386/libcwait.so 4
754 echo $LD_LIBRARY_PATH
755 echo $LD_PRELOAD
756 export LD_LIBRARY_PATH=''
757 java
758 javac
759 ls
760 vi javac (class javatest {
public static void main(String[] args) {
System.out.println("Hello World!");
}
}
)/* got to know that java program can't be javac
761 mv javatest
762 mv javac javatest.java
763 javac javatest.java
764 ls
765 java javatest
766 vi /etc/bashrc
767 vi ~/.bash_profile
768 system-config-network
769 ll
770 ll
771 cd test/
772 ls
773 cd java/
774 ll
775 rpm -qa | grep jdk
776 /usr/java/jdk1.3.1/bin/javac
777 ls
778 cd ..
779 ls
780 cd ..
781 ls
783 java
784 cd libcheck/
785 ls
786 vi libcwait.c
787 ll
788 vi compile.txt
789 mkdir test
790 cd test
791 vi hswaitpid.c
792 gcc -shared -O3 -o libhswaitpid.so hswaitpid.c
793 ll
794 ll
795 pwd
796 cd /usr/java/jdk1.3.1/
797 ls
798 cd bin
799 ls
800 ./javac
801 ./java
802 echo $LD_LIBRARY_PATH
803 echo $LD_PRELOAD
804 export
805 set
806 javac
807 java
808 java
809 . ~/.bash_profile
810 java
811 java
812 cd /usr/java/jdk1.3.1/jre/lib/i386/; perl -e "while(<>) {" -e "s/__libc_wait/libc_wait/;" -e "print;" -e"}" libjava.so > libjava.so.tmp
813 mv libjava.so libjava.so.orig
814 mv libjava.so.tmp libjava.so
815 echo $LD_PRELOAD
816 mv libjava.so.orig libjava.so
last step type in .bash_profile
export LD_PRELOAD=/usr/java/jdk1.3.1/jre/lib/i386/libcwait.so
Even though it is a bit confusing. I will try to make it more concise but till then you can work around this only. (am I a good writer ... naah) but it will be interesting for those working around and getting some internals.
My sincere thannks to Rajiv Ranjan Sir.
Good Luck
Read More
This is probably the hactic task to install jdk1.3.1 in Latest flavours of Linux. Installing the rpm is damn easy but to get it work is not so easy.
Well, let me start from downloading the jdk1.3.1 package from sun site.
Go to url http://java.sun.com and in the search bar just type "jdk1.3.1" and press enter. It will show you many results. To move to the downloads section, see carefully that the result which is shown belongs to a particular category. On that result page there is "Downloads" link. Click on that now Downloads section will be searched for "jdk1.3.1". And probably you will get many versions of "jdk1.3.1_*". Here * shows the different versions. Just choose one of them and it will move you to the downloads section. Download by clicking on the hyper link after accepting the agreement. Save the file in the users home directory.
Now, go to the terminal(bash shell), and move to that directory where the file is saved. then type
rpm -ivh jdk1.3.1_*
It will show you the progress bar and extract the files to /usr/java/jdk1.3.1_*
Move to that directory in the bin folder. and try to run ./java or ./javac
If it is running then probably everything is fine and you can start working on that, but in the latest flavours of Linux have the new versions of libstdc++ which are not supported by jdk1.3.1_*. So, you may probably get the error something like this :-
ot finding libstdc++-libc6.1-1.so.2.
So, for that you need to create a soft link for the file
libstdc++-libc6.1-1.so.2 ->(which will point to) libstdc++-2-libc6.1-1-2.9.0.so
ln -s libstdc++-2-libc6.1-1-2.9.0.so libstdc++-libc6.1-1.so.2
Well, do have that library you need to install "compat-libstdc++-296-2.96-132.fc4.rpm". If you don't know which version you are running run the command
rpm -qa | grep std
It will show you a list which are already installed in your system. After installing that, the above error will get removed now it will give a new error GLIBC_2.0. Its given below:
Error occurred during initialization of VM
Unable to load native library: /usr/java/jdk1.3.1/jre/lib/i386/libjava.so: symbol __libc_wait, version GLIBC_2.0 not defined in file libc.so.6 with link time reference
Now, to remove that error
create a file named libcwait.c
#include
#include
#include
#include
pid_t
__libc_wait (int *status)
{
int res;
asm volatile ("pushl %%ebx\n\t"
"movl %2, %%ebx\n\t"
"movl %1, %%eax\n\t"
"int $0x80\n\t"
"popl %%ebx"
: "=a" (res)
: "i" (__NR_wait4), "0" (WAIT_ANY), "c" (status), "d" (0),
"S" (0));
return res;
}
Compile it using
gcc -shared -o libcwait.so libcwait.c -fpic -O
Now export it
export LD_PRELOAD=/usr/java/jdk1.3.1/jre/lib/i386/libcwait.so
Now create one more file named hswaitpid.c
#include
#include
pid_t hslibc_waitpid(pid_t pid, int *status, int options) {
return waitpid(pid, status, options);
}
compile it using
gcc -shared -O3 -o libhswaitpid.so hswaitpid.c
Now do the following
cd /usr/java/jdk1.3.1/jre/lib/i386/; perl -e "while(<>) {" -e "s/__libc_wait/libc_wait/;" -e "print;" -e"}" libjava.so > libjava.so.tmp
mv libjava.so libjava.so.orig
mv libjava.so.tmp libjava.so
echo $LD_PRELOAD
mv libjava.so.orig libjava.so
Thats it, now you just a global variable using
export
Here, I am giving the steps to follow, by just copying history and removing the unnecessary steps.
732 rpm -ivh ~/test/java/jdk-1.3.1.i386.rpm
733 ls
734 type java
735 java
736 ls jdk1.3.1/bin/javac
737 jdk1.3.1/bin/javac
738 cd jdk1.3.1/jre/lib/i386/
740 vi libcwait.c
741 gcc -02 -shared -o libcwait.so -fpic libwait.c
742 gcc -02 -shared -o libcwait.so -fpic libcwait.c
743 gcc -shared -o libcwait.so libcwait.c -fpic -O
744 gcc -shared -o libcwait.so libcwait.c -fpic -O
745 gcc -shared -o libcwait.so libcwait.c -fpic -O
746 vi libcwait.c
747 gcc -shared -o libcwait.so libcwait.c -fpic -O
750 java
751 export LD_PRELOAD=/usr/java/jdk1.3.1/jre/lib/i386/libcwait.so 4
754 echo $LD_LIBRARY_PATH
755 echo $LD_PRELOAD
756 export LD_LIBRARY_PATH=''
757 java
758 javac
759 ls
760 vi javac (class javatest {
public static void main(String[] args) {
System.out.println("Hello World!");
}
}
)/* got to know that java program can't be javac
761 mv javatest
762 mv javac javatest.java
763 javac javatest.java
764 ls
765 java javatest
766 vi /etc/bashrc
767 vi ~/.bash_profile
768 system-config-network
769 ll
770 ll
771 cd test/
772 ls
773 cd java/
774 ll
775 rpm -qa | grep jdk
776 /usr/java/jdk1.3.1/bin/javac
777 ls
778 cd ..
779 ls
780 cd ..
781 ls
783 java
784 cd libcheck/
785 ls
786 vi libcwait.c
787 ll
788 vi compile.txt
789 mkdir test
790 cd test
791 vi hswaitpid.c
792 gcc -shared -O3 -o libhswaitpid.so hswaitpid.c
793 ll
794 ll
795 pwd
796 cd /usr/java/jdk1.3.1/
797 ls
798 cd bin
799 ls
800 ./javac
801 ./java
802 echo $LD_LIBRARY_PATH
803 echo $LD_PRELOAD
804 export
805 set
806 javac
807 java
808 java
809 . ~/.bash_profile
810 java
811 java
812 cd /usr/java/jdk1.3.1/jre/lib/i386/; perl -e "while(<>) {" -e "s/__libc_wait/libc_wait/;" -e "print;" -e"}" libjava.so > libjava.so.tmp
813 mv libjava.so libjava.so.orig
814 mv libjava.so.tmp libjava.so
815 echo $LD_PRELOAD
816 mv libjava.so.orig libjava.so
last step type in .bash_profile
export LD_PRELOAD=/usr/java/jdk1.3.1/jre/lib/i386/libcwait.so
Even though it is a bit confusing. I will try to make it more concise but till then you can work around this only. (am I a good writer ... naah) but it will be interesting for those working around and getting some internals.
My sincere thannks to Rajiv Ranjan Sir.
Good Luck
Sunday, April 08, 2007
Bash Shell Shortcuts
The default shell on most Linux operating systems is called Bash. There are a couple of important hotkeys that you should get familiar with if you plan to spend a lot of time at the command line. These shortcuts will save you a ton of time if you learn them.
Read More
- Ctrl + A Go to the beginning of the line you are currently typing on
- Ctrl + E Go to the end of the line you are currently typing on
- Ctrl + L Clears the Screen, similar to the clear command
- Ctrl + U Clears the line before the cursor position. If you are at the end of the line, clears the entire line.
- Ctrl + H Same as backspace
- Ctrl + R Let’s you search through previously used commands
- Ctrl + C Kill whatever you are running
- Ctrl + D Exit the current shell
- Ctrl + Z Puts whatever you are running into a suspended background process. fg restores it.
- Ctrl + W Delete the word before the cursor
- Ctrl + K Clear the line after the cursor
- Ctrl + T Swap the last two characters before the cursor
- Esc + T Swap the last two words before the cursor
- Alt + F Move cursor forward one word on the current line
- Alt + B Move cursor backward one word on the current line
- Tab Auto-complete files and folder names
- Ctrl + W erase word before cursor
- Ctrl + Y to paste it (as in delete and copy) all text in front of the cursor
Useful Note that some of these commands may not work if you are accessing bash through a telnet ,ssh session, or depending on how you have your keys mapped.
Subscribe to:
Posts
(
Atom
)