Following the instructions at http://code.google.com/p/gnizr/wiki/HelloWorldDemo
Mysql setup commands:
mysql -u root -p
create database gnizr_test;
create user gnizr;
update mysql.user set password=PASSWORD('gnizr') WHERE Host = '%' AND User = 'gnizr';
GRANT ALL PRIVILEGES ON *.* TO 'gnizr'@'localhost' IDENTIFIED BY 'gnizr' WITH GRANT OPTION;
Next moved on to set up eclipse and tomcat.
There were lots of problems as things wont work the first time or the second time or even a third time. Tomcat tips: http://www.onjava.com/pub/a/onjava/2003/06/25/tomcat_tips.html too didn't help. I was getting an error: "SEVERE: Error listenerStart". Now the logs do not show the details about the exact problem. Being new to Tomcat, I didn't know how to enable more detailed logs.
After several attempts I uninstalled tomcat 5.5 and installed tomcat 6. This helped. Tomcat 6 comes with a good interface to deploy applications. Also, the logs found at /var/lib/tomcat6/logs also contained the details of the problem with listenerStart. I fixed a few issues then.
I tried to then run tomcat from eclipse. The problem was as a unprivileged user, I could not access tomcat-users.conf. I changed the permissions of tomcat-users.conf and of /var/cache/tomcat6 to enable this (Not to mention, this should not be done on production machines).
Stuckness shouldn't be avoided. It's the psychic predecessor of all real understanding. An egoless acceptance of stuckness is a key to an understanding of Quality, in mechanical work as in other endeavors. It's this understanding of Quality as revealed by stuckness which so often makes self-taught mechanics so superior to institute-trained men who have learned how to handle everything except a new situation. - Robert Pirsig, Zen and the Art of Motorcycle Maintenance
Sunday, December 21, 2008
Saturday, October 4, 2008
Skype on Ubuntu Linux Automatically Starts - Too Bad
After I installed Skype on Ubuntu, it automatically starts whenever I log in. I hate softwares that automatically start upon log in. To top, there is no option to disable the automatic start unless you log in into skype. I didn't find any option to disable skype upon startup ... Grrrrrrr ... although I found a way to start it minimized (Log in into skype > Options > Advanced > Start minimized). Sad, they would make softwares like this.
http://forum.skype.com/index.php?showtopic=39775
http://forum.skype.com/index.php?showtopic=39775
Monday, September 22, 2008
Executing after linking with DLL file on Windows using Visual Studio
The problem is to link dll file for execution of a developed executable using visual studio.
As shown at http://stackoverflow.com/questions/45769/managingusing-libraries-with-debug-builds-vs-release-builds#46120 one can add a custom build step that copies the dll to the directory with the executable.
As shown at http://stackoverflow.com/questions/45769/managingusing-libraries-with-debug-builds-vs-release-builds#46120 one can add a custom build step that copies the dll to the directory with the executable.
Friday, September 19, 2008
Comparing Two Folders on Windows/Linux/Whatever
In Eclipse, create a new project and include in it the link to the folders in the filesystem. Then use Compare With > Each Other. Cool!
Latex Problem with Using Bibliography
Underscores cause quite a problem in latex. There are places where one should never put _ and there are places where one can. When there is an _ in title of a bibliographic entry, a strange error like this is produced (discovered this after a lot of permutation and combination of debugging):
! LaTeX Error: Lonely \item--perhaps a missing list environment.
! LaTeX Error: Lonely \item--perhaps a missing list environment.
See the LaTeX manual or LaTeX Companion for explanation.
Type H
...
l.46 \bibitem{mcconnell04}
Try typing
Compiling Java Code from JSHOPGUI
Just some java code I had to compile. The code structure
downloaded JSHOPGUI
In src directory
----------------
javac -classpath ..\antlr.jar;..\bin.build\JSHOP2.jar;JSHOP2;JSHOP2\*.java -d ..\bin.build\
In examples\logistics
---------------------
javac *.java -classpath ..\..\antlr.jar;..\..\bin.build;..\foralltest
In examples\logistics
----------------------
java -classpath ..\..\antlr.jar;..\..\bin.build;..\foralltest gui
The correct way was to look at the Makefile and run the commands as per Makefile (including the classpath as above).
downloaded JSHOPGUI
In src directory
----------------
javac -classpath ..\antlr.jar;..\bin.build\JSHOP2.jar;JSHOP2;JSHOP2\*.java -d ..\bin.build\
In examples\logistics
---------------------
javac *.java -classpath ..\..\antlr.jar;..\..\bin.build;..\foralltest
In examples\logistics
----------------------
java -classpath ..\..\antlr.jar;..\..\bin.build;..\foralltest gui
The correct way was to look at the Makefile and run the commands as per Makefile (including the classpath as above).
Friday, September 12, 2008
Set Up Thunderbird for NUS Email on Ubuntu Linux
This is pretty easy (~5 mins), and exponentially more productive than Microsoft Exchange. I am putting up this information here for reference/people new to Ubuntu Linux.
> Install Thunderbird through Synaptic Package Manager
> Configure IMAP (if you want to use IMAP; an alternative protocol is POP: check here) with details as here.
> Put your username as NUSSTU\ if you are a student.
and that's it!
> Install Thunderbird through Synaptic Package Manager
> Configure IMAP (if you want to use IMAP; an alternative protocol is POP: check here) with details as here.
> Put your username as NUSSTU\
and that's it!
Thursday, June 5, 2008
Getting Used to NUS SVU
NUS Supercomputing and Visualization Lab uses the Load Sharing Facility LSF (bqueue, bjobs, bsub). My SVU account has a quota of 200MB (update on 21 May 2009 - now it seems to have been increased to 4GB) so I cannot put/compile much stuff there. So usually in future I will make my program in a linux system, copy the binary there using scp and run using bsub.
Finding Properties of the Machine
After logging in, one can run the dmesg command to find what kind of CPU, memory etc is on the machine. For example, on atlas4-c01 I wanted to confirm that it has Intel Xeon Processor as said at the SVU list of hosts and queues. So I ran on the command prompt:
dmesg | grep -i intel -C 1 | less
and received output:
CPU0: Initial APIC ID: 0
CPU0: Intel(R) Xeon(R) CPU E5430 @ 2.66GHz stepping 06
per-CPU timeslice cutoff: 6145.14 usecs.
--
CPU1: Initial APIC ID: 4
Intel(R) Xeon(R) CPU E5430 @ 2.66GHz stepping 06
Booting processor 2/2 rip 6000 rsp 100cfe1df58
--
CPU2: Initial APIC ID: 2
Intel(R) Xeon(R) CPU E5430 @ 2.66GHz stepping 06
Booting processor 3/6 rip 6000 rsp 10037e13f58
--
CPU3: Initial APIC ID: 6
Intel(R) Xeon(R) CPU E5430 @ 2.66GHz stepping 06
Booting processor 4/1 rip 6000 rsp 10006989f58
--
CPU4: Initial APIC ID: 1
Intel(R) Xeon(R) CPU E5430 @ 2.66GHz stepping 06
Booting processor 5/5 rip 6000 rsp 100069c1f58
--
CPU5: Initial APIC ID: 5
Intel(R) Xeon(R) CPU E5430 @ 2.66GHz stepping 06
Booting processor 6/3 rip 6000 rsp 100069f7f58
--
CPU6: Initial APIC ID: 3
Intel(R) Xeon(R) CPU E5430 @ 2.66GHz stepping 06
Booting processor 7/7 rip 6000 rsp 1042142df58
--
CPU7: Initial APIC ID: 7
Intel(R) Xeon(R) CPU E5430 @ 2.66GHz stepping 06
Total of 8 processors activated (42672.12 BogoMIPS).
So this machine has 8 processors. On Intel site I found that E5430 has L2 cache size of 12 MB, which is more than the 8MB in my office desktop Intel Core 2 Quad with 4 processors.
dmesg command didn't work on cougar1 and cougar2 when I tried.
Updated on Feb 5, 2011: To find the architecture of your machine, use "uname -i".
Useful Commands To Submit Jobs
Following are some useful commands:
bsub -q mcore_parallel_test -m multicore -n2 "./a.out > a.output"
bjobs
bpeek
bqeueues -l
Further links on the b commands: www.cisl.ucar.edu/docs/lightning/lsf.usage.ppt http://www.nus.edu.sg/comcen/svu/techinfo/unixcom.pdf
Running your executables on SVU machines
I tried running some executables built on my machines on SVU machines. Unfortunately since the versions of libraries on SVU are different from those on the built machine, I faced problems. First, the version of python I used on my machine is different from that on the SVU machine "atlas3". It had no "subprocess" module which I was using for forking a process.
I am currently stuck with "/lib/tls/libc.so.6: version `GLIBC_2.4' not found (required by ./libtbb.so)". Lets see how it turns out.
Finding Properties of the Machine
After logging in, one can run the dmesg command to find what kind of CPU, memory etc is on the machine. For example, on atlas4-c01 I wanted to confirm that it has Intel Xeon Processor as said at the SVU list of hosts and queues. So I ran on the command prompt:
dmesg | grep -i intel -C 1 | less
and received output:
CPU0: Initial APIC ID: 0
CPU0: Intel(R) Xeon(R) CPU E5430 @ 2.66GHz stepping 06
per-CPU timeslice cutoff: 6145.14 usecs.
--
CPU1: Initial APIC ID: 4
Intel(R) Xeon(R) CPU E5430 @ 2.66GHz stepping 06
Booting processor 2/2 rip 6000 rsp 100cfe1df58
--
CPU2: Initial APIC ID: 2
Intel(R) Xeon(R) CPU E5430 @ 2.66GHz stepping 06
Booting processor 3/6 rip 6000 rsp 10037e13f58
--
CPU3: Initial APIC ID: 6
Intel(R) Xeon(R) CPU E5430 @ 2.66GHz stepping 06
Booting processor 4/1 rip 6000 rsp 10006989f58
--
CPU4: Initial APIC ID: 1
Intel(R) Xeon(R) CPU E5430 @ 2.66GHz stepping 06
Booting processor 5/5 rip 6000 rsp 100069c1f58
--
CPU5: Initial APIC ID: 5
Intel(R) Xeon(R) CPU E5430 @ 2.66GHz stepping 06
Booting processor 6/3 rip 6000 rsp 100069f7f58
--
CPU6: Initial APIC ID: 3
Intel(R) Xeon(R) CPU E5430 @ 2.66GHz stepping 06
Booting processor 7/7 rip 6000 rsp 1042142df58
--
CPU7: Initial APIC ID: 7
Intel(R) Xeon(R) CPU E5430 @ 2.66GHz stepping 06
Total of 8 processors activated (42672.12 BogoMIPS).
So this machine has 8 processors. On Intel site I found that E5430 has L2 cache size of 12 MB, which is more than the 8MB in my office desktop Intel Core 2 Quad with 4 processors.
dmesg command didn't work on cougar1 and cougar2 when I tried.
Updated on Feb 5, 2011: To find the architecture of your machine, use "uname -i".
Useful Commands To Submit Jobs
Following are some useful commands:
bsub -q mcore_parallel_test -m multicore -n2 "./a.out > a.output"
bjobs
bpeek
bqeueues -l
Further links on the b commands: www.cisl.ucar.edu/docs/lightning/lsf.usage.ppt http://www.nus.edu.sg/comcen/svu/techinfo/unixcom.pdf
Running your executables on SVU machines
I tried running some executables built on my machines on SVU machines. Unfortunately since the versions of libraries on SVU are different from those on the built machine, I faced problems. First, the version of python I used on my machine is different from that on the SVU machine "atlas3". It had no "subprocess" module which I was using for forking a process.
I am currently stuck with "/lib/tls/libc.so.6: version `GLIBC_2.4' not found (required by ./libtbb.so)". Lets see how it turns out.
Installing Subversion (svn) on Linux without Root Privileges
I know this should have been easy, but subversion (svn) has a lot of dependencies which must be there as well. There is no pre-built binary package for linux that you can install without root privileges.
I went to a number of searches on this topic, but finally the following worked for me:
1. download the latest subversion source from http://subversion.tigris.org/servlets/ProjectDocumentList?folderID=260&expandFolder=74
2. also download the deps (dependencies) source
3. untar both these using tar -zvxf in the same directory
4. run ./configure --with-ssl --enable-shared
The last option is needed, otherwise your build will fail (for more details see http://subversion.tigris.org/faq.html#relocation-against-local-symbol)
5. make
and now the subversion binary is ready. You can run it from bin directory. Set your PATH environment variable accordingly in .bashrc.
I went to a number of searches on this topic, but finally the following worked for me:
1. download the latest subversion source from http://subversion.tigris.org/servlets/ProjectDocumentList?folderID=260&expandFolder=74
2. also download the deps (dependencies) source
3. untar both these using tar -zvxf in the same directory
4. run ./configure --with-ssl --enable-shared
The last option is needed, otherwise your build will fail (for more details see http://subversion.tigris.org/faq.html#relocation-against-local-symbol)
5. make
and now the subversion binary is ready. You can run it from bin directory. Set your PATH environment variable accordingly in .bashrc.
Friday, May 16, 2008
Improve your code by using boost::transform_iterator with STL map and multimap
Often while using STL, you want to select the key or value while iterating through the map, but the STL interface yield a pair upon derefencing the iterator. This makes the interface of your class while your implementation uses map, different from interface using vector. This is undesirable.
No worry, you can return a boost::transform_iterator. boost::transform_iterator is a useful tool to transform the value of the iterator while dereferencing it. The most common use of boost::transform_iterator is in the situation described above, although it is more general. For using boost::transform_iterator as above, you will need functions select_first and select_second as implemented here.
Always cheers while coding in C++!
No worry, you can return a boost::transform_iterator. boost::transform_iterator is a useful tool to transform the value of the iterator while dereferencing it. The most common use of boost::transform_iterator is in the situation described above, although it is more general. For using boost::transform_iterator as above, you will need functions select_first and select_second as implemented here.
Always cheers while coding in C++!
Tuesday, April 29, 2008
Fixing Some Vista Woes
We have got the latest operating system Vista in our lab and latest configuration Quad Core Intel Processors. We have got large monitors and we have got game consoles. We have got them all. But Vista has been troubling me for quite some time. It randomly hangs (I found online it might be around 30 seconds) for some time. How do I find what is the issue and fix it?
I login as an Administrator, go to Control Panel > Administrative Tools > Event Viewer. Event Viewer > Application shows several errors - most related to vmware. Event Viewer > System also shows some errors. I will need to track these errors from now on.
To my surprise Event Viewer > System shows several error events (to view just error events, Menu > Action > Filter Current Log) which could be significant:
I login as an Administrator, go to Control Panel > Administrative Tools > Event Viewer. Event Viewer > Application shows several errors - most related to vmware. Event Viewer > System also shows some errors. I will need to track these errors from now on.
To my surprise Event Viewer > System shows several error events (to view just error events, Menu > Action > Filter Current Log) which could be significant:
- The file system structure on the disk is corrupt and unusable. Please run the chkdsk utility on the volume OS. Such events were raised at 2 AM (probably after some system process executed) on 30 April 2008.
- The device, \Device\Ide\iaStor0, did not respond within the timeout period.
So I took the following steps:
- I ran chkdsk on my disks. As I expected there are no errors detected.
- For the iaStor0 issue, saw http://www.intel.com/support/chipsets/imsm/sb/cs-025783.htm. I am wary of installing new things unless needed. So I will wait for Vista to hang again before I try to fix the issue.
Wednesday, April 23, 2008
How I Formed an Excel Sheet of Students in the Course I am Tutoring
Every semester once I would have to form a list of all students in a course. Since the frequency of this task is not high I dont prefer to make a program to automate this task. This time I did the following:
1. Go to IVLE to get the list of students in one page. Save this page.
2. Clear out the irrelevant lines.
3. With vim, query replace the ";" with "\r" newline, or whatever else to get "name, Metric No" list. The useful commands are:
%s/ /\r/gc
%s/.*userID=\(.*\)' , 800 , 600)">\(.*\).*/\1,\2\r/gc
:%s/.*t.*/\r/gc
:%s/^\n//gc
4. Import this data into excel.
1. Go to IVLE to get the list of students in one page. Save this page.
2. Clear out the irrelevant lines.
3. With vim, query replace the ";" with "\r" newline, or whatever else to get "name, Metric No" list. The useful commands are:
%s/ /\r/gc
%s/.*userID=\(.*\)' , 800 , 600)">\(.*\).*/\1,\2\r/gc
:%s/.*t.*/\r/gc
:%s/^\n//gc
4. Import this data into excel.
Thursday, April 3, 2008
Ubuntu: Get Wireless Working After Hibernate
After I installed ubuntu I faced a peculiar problem that the wireless wont connect after ubuntu wakes up from hibernation.
sudo /etc/init.d/networking restart didnt work for me.
Later I found that:
sudo /etc/init.d/dbus restart worked. But I am afraid it might be risky to do it everytime since it restarts a very low level process (though I am not an expert on this, and have no right to say it might be risky or not).
So as stated in this forum I edited the services that are shut down on hibernation. Have to see how it works out!
sudo /etc/init.d/networking restart didnt work for me.
Later I found that:
sudo /etc/init.d/dbus restart worked. But I am afraid it might be risky to do it everytime since it restarts a very low level process (though I am not an expert on this, and have no right to say it might be risky or not).
So as stated in this forum I edited the services that are shut down on hibernation. Have to see how it works out!
Wednesday, March 19, 2008
Eclipse does not use User's Environment Variables on Linux
Eclipse + CDT does not pick the environment variables I defined in ~/.bashrc, for example LD_LIBRARY_PATH.
Getaround tried - I changed the eclipse driver file in the same way as firefox uses firefox-bin.
amit@ubuntu:~$ cd /usr/bin
amit@ubuntu:/usr/bin$ sudo mv eclipse eclipse-bin
Password:
amit@ubuntu:/usr/bin$ sudo vim eclipse
amit@ubuntu:/usr/bin$ sudo chmod 755 eclipse
BUT IT DID NOT WORK.
Finally I had to enter environment variables manually into the eclipse CDT dialog.
Getaround tried - I changed the eclipse driver file in the same way as firefox uses firefox-bin.
amit@ubuntu:~$ cd /usr/bin
amit@ubuntu:/usr/bin$ sudo mv eclipse eclipse-bin
Password:
amit@ubuntu:/usr/bin$ sudo vim eclipse
amit@ubuntu:/usr/bin$ sudo chmod 755 eclipse
BUT IT DID NOT WORK.
Finally I had to enter environment variables manually into the eclipse CDT dialog.
Saturday, February 9, 2008
C++: Forward Declarations and Typedef
Consider the situation where I have two header files A.h and B.h
A.h:
class FwdDeclared;
----
B.h:
class Defined {
...
};
typedef Defined FwdDeclared;
----
This is not allowed in C++ [see GOTW: 034]. The GCC compiler complains: "error: Conflicting declaration". I need to look for the rationale for this language behavior. The workaround is to use "typedef Defined FwdDeclared" in A.h too - which means you're not forward declaring the typedefed class at all. I am looking for a better way to do this.
A.h:
class FwdDeclared;
----
B.h:
class Defined {
...
};
typedef Defined FwdDeclared;
----
This is not allowed in C++ [see GOTW: 034]. The GCC compiler complains: "error: Conflicting declaration". I need to look for the rationale for this language behavior. The workaround is to use "typedef Defined FwdDeclared" in A.h too - which means you're not forward declaring the typedefed class at all. I am looking for a better way to do this.
Tuesday, February 5, 2008
Installing MPICH2
I downloaded MPICH2 from http://www.mcs.anl.gov/research/projects/mpich2/ and installed it as Administrator on my lab's Windows Vista machine. After compiling my source the command
mpiexec.exe -n 1 MPICircuitSAT.exe
would not run complaining "Unable to connect to port 8676 ... No connection could be made because the target machine actively refused it." Update: Later I figured this is the error when smpd.exe is not running. Start smpd.exe using
smpd.exe -start
I then did
smpd.exe -install
in\bin, but only to receive a different error message on execution again:
"Aborting: Unable to connect ..."
mpiexec.exe -n 1 MPICircuitSAT.exe
would not run complaining "Unable to connect to port 8676 ... No connection could be made because the target machine actively refused it." Update: Later I figured this is the error when smpd.exe is not running. Start smpd.exe using
smpd.exe -start
I then did
smpd.exe -install
in
"Aborting: Unable to connect ..."
Thursday, January 31, 2008
WxWidget Linking Woes
I am trying out using WxWidgets for UI for our Crackpot project (started with the basic example at WxWidget documentation at http://www.wxwidgets.org/docs/tutorials/hello.htm)
Link errors while using WxWidgets were resolved using stuff at: http://www.soe.ucsc.edu/~agames/wxogl.htm
Some other link errors are still left :(
Updated on Feb 8, 2008:
The link errors I was getting were related to unresolved symbols:
I was able to fix these today after much hue and cry, after I built the sample projects in the wxWidgets/samples directory. I copied the VC++ settings from these samples to my project. Indeed my settings were quite a lot different from that used in samples - preprocessor definitions, system type: (I was using console in place of windows), linked library names.
Anyway, all is well that ends well. Lesson learnt: Look for samples of compilation using a downloaded open source library first, before getting stuck with a compilation problem.
Link errors while using WxWidgets were resolved using stuff at: http://www.soe.ucsc.edu/~agames/wxogl.htm
Some other link errors are still left :(
Updated on Feb 8, 2008:
The link errors I was getting were related to unresolved symbols:
- wxFrameNameStr
- wxApp::Initialize
I was able to fix these today after much hue and cry, after I built the sample projects in the wxWidgets/samples directory. I copied the VC++ settings from these samples to my project. Indeed my settings were quite a lot different from that used in samples - preprocessor definitions, system type: (I was using console in place of windows), linked library names.
Anyway, all is well that ends well. Lesson learnt: Look for samples of compilation using a downloaded open source library first, before getting stuck with a compilation problem.
Subscribe to:
Posts (Atom)