Nithya's how to?
Nithya N
Vijayakumar
Last modified: Mon Jan 15 13:18:42 EST 2007
Eclipse color settings
To change font color:
Java > Editor > Syntax Coloring to configure the colors. The color you
want to set is Java > Others (and anything else)
To change font size: General->Appearance->Colors and Fonts
To change background of Text Editor:
General->Editors->TextEditor->(background and foreground colors)
Change line highlights etc
General->Editors->TextEditor->(everything here)
Quotations in Latex
Left quotes are `` (The left-most key on the
upper row below ~). Right quotes are given by the two symbols '' (which
is on the key below the single symbol " which is NOT used).
For single quotes, use just one ` and '.
Citations inside caption in Latex
use \caption[]{xxx \cite{yyy}}
Execute scripts in MySQL
If you are already running mysql, you can execute an SQL script file
using the source command or \. command:
mysql> source file_name
mysql> \. file_name
Increasing Java Heap Size
If Java runs out of memory, the following error occurs:
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
Java heap size can be increased using the
following runtime parameters:
java -Xms{initial heap size} -Xmx{maximum heap size}
Defaults are:
java -Xms32m -Xmx128m
You can set this either in the Java Control Panel or on the command line,
depending on the environment you run your application.
Cutting and Joining files columnwise in Unix
Example:
cut -d " " -f 1,2 > 1.txt
cut -d " " -f 1,3 > 2.txt
'join 1.txt 2.txt' will output fields 1,2,3 together. Here the files are
joined on the first column.
Usage of Java2WSDL command
java org.apache.axis.wsdl.Java2WSDL -o planner.wsdl -l
http://localhost:9099/axis/services/PlannerService sqp
.api.PlannerService
Xemacs changed colors abruptly
execute xrdb <. Xdefaults from the home directory
How to increase the scroll size of the terminal in unix?
Edit->Current Profile->Scrolling
How can I find out which version of glibc I am using in the
moment?
From http://www.gnu.org/software/libc/FAQ.html:
If you want to find out about the version from the command line
simply run the libc binary. This is probably not possible on all platforms
but where it is simply locate the libc DSO and start it as an application.
On Linux like
/lib/libc.so.6
This will produce all the information you need.
What always will work is to use the API glibc provides. Compile and run
the following little program to get the version information:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#include
#include
int main (void) { puts (gnu_get_libc_version ()); return 0; }
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This interface can also obviously be used to perform tests at runtime if
this should be necessary.
Cannot
see workspace in RHEL. Logging in shows
empty
screen
If you have recently upgraded to RHEL and used a different linux
distribution before, the profile needs to be reset. Press
Ctrl+Alt+Backspace to kill the xserver that shows empty screen. Then press
ctrl+alt+F1 to get shell type login prompt. Enter into your home dir and
run resetgui. this will reset the gui profile. backit up before running
resetgui if needed. Logout from shell prompt. Press ctrl+alt+F7 to get
back to gui mode.
What are the files created when you run configure (autoconf)?
The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
those values to create a `Makefile' in each directory of the package.
It may also create one or more `.h' files containing system-dependent
definitions. Finally, it creates a shell script `config.status' that
you can run in the future to recreate the current configuration, a file
`config.cache' that saves the results of its tests to speed up
reconfiguring, and a file `config.log' containing compiler output
(useful mainly for debugging `configure').
How to remove a directory from CVS?
Remove all the files in the directory.
Specify the `-P' option to cvs update, cvs checkout, or cvs export, which
will cause CVS to remove empty directories from working directories.
The following works well:
top_dir> find dir_to_be_removed -type "f" -exec echo "cvs rm {} "> temp \;
top_dir> rm dir_to_be_removed/*
top_dir> execute commands in temp
top_dir> cvs update -P
How to find red-hat release
version?
cat /etc/redhat-release to find out the release
How to change space layouts in the middle of latex documents?
\usepackage{setspace}
\doublespacing
\onehalfspacing
\singlespacing
How to extract usercert and userkey from downloaded grid
certificates?
To extract usercert.pem: openssl pkcs12 -in YourCert.p12 -clcerts
-nokeys -out $HOME/.globus/usercert.pem To extract userkey.pem:
openssl pkcs12 -in YourCert.p12 -nocerts -out $HOME/.globus/userkey.pem
Cannot connect to mysql from CS department php server
Need to make mysql obtain connections from a particular host.
Login as root and use database mysql. Then execute "grant all on db.*
to 'your-name'@'belfry.cs.indiana.edu'
identified by 'password';"
How to see your paycheck from IU?
Login to onestart. In the list box titled Select your role on the top
right corner, select 'All Roles'. Click in Staff tools. The pay
information is listed under the my finances portlet on the left hand
side.
How to redirect a webpage?
< HTML >
< HEAD >
< META HTTP-EQUIV="REFRESH"
CONTENT="5;URL=http://www.geocities.com/nithyanirmal/url-to-new-page" >
< /HEAD >
< BODY >
This web site has MOVED.
Your browser should automatically take you there in 5 seconds.
If not, please go to < a href="http://www.geocities.com/nithyanirmal/url-to-new-page" > Link < /a >.
< /BODY >
< /HTML >
How to import a full project into CVS?
From inside the project directory execute:
cvs import project-dir-name vendor-tag release-tag
Move the project-dir to some-dir.
cvs co project-dir-name
Check if the project-dir-name and some-dir are same.
Delete some-dir.
Internet Explorer font size is too small to read.
This may occur if the Text Size setting in Microsoft Internet Explorer
has
been changed to Smaller or Smallest.
Open Internet Explorer, select Text Size from the View menu, and change
the setting to Medium, or Large. You must close and restart Help and
Support for the change to take effect.
Alternately, you may change an Accessibility setting under Internet
Options. To do so, on the Tools menu, click Internet Options, click
Accessibility, and then select the Ignore Font Sizes Specified on Web
Pages option.
Autoconf, Automake error
Problem with configure. cannot find makefile.in or some problem in
build.sh. Copy dist directory from a working version.
C Dynamic Library not linking
If it is a C library used inside C++, the .h file needs to be included within
extern "C"{
}
Also define and declare the functions are extern inside the C code.
How to create a binary file?
To create a binary file of size 100KB
dd if=/dev/zero of=data.txt bs=1K count=100
How much space remains in the hard disk?
To find space available in different hard drives in linux:
df -h
df (in bytes)
How to produce high quality ps?
high quality ps: use dvips -Ppdf -G0 $(FILE).dvi -o $(FILE).ps option in
linux and then use distill in solaris
How to use find and exec commands together?
How to use find and execute two commands
find . -name "filespec" -exec echo {} \;
How to reset terminal?
**If terminal gets corrupted use 'reset'
dQUOB stream rates
when a fast stream is input to quoblet, it cannot read the inputs that
fast. Hence it reads only the first few events. but since the maxtimestamp
interval is calculated from these events, the rate is diagnosed properly.
ie. if two streams are coming at 50 events per second, the quoblet can process
only 10 events. But since the maxtimestamp interval is also for these
events, we can calculate the rate as 50. deceiving :(
.deps/*.Po no found
Problem in libtool installation. Use libtool-1.5.8 or later
Recursive include error in C++
If there is a problem with a .H file trying to include itself,
for example in dquob, Timer.H includes quoblet.H which inturn includes Timer.H,
predefine one class in another. ie. include forward declaration of class Timer
in quoblet.H
Multiple inclusion of libstdc++ error
If there is a problem with multiple inclusions of the same libstdc++.so
file, use -lstdc++ -L/l/gcc3/lib in src/Makefile.am and use make inside
src and then in dquobEC.
Problems with detecting std::ios_base, std::base_ostream etc...
Included -lstdc++ and setenv to libstdc++.so.5
C++ class functions not detected
When connecting testharness to dquobEC, the Channel_element functions
were not detected. removed 'using namespace std' from Comm_includes.h.
using namespace std localises the variable and function names.
Problem in select accept
Some connection requests were not accepted.
timeout for select thread needs to be kept at more than zero. currently
it is 10000 microseconds
Problem with autotools installing libraries
Will be done during make install.
Problem in using vector push_back
Initially there were two vectors in Channel_server and pushing values
into both was causing a delete to occur in vector. Then one of the
vectors was changed into an array. reason unknown
How to retreive elements from a vector in C++?
Getting values out of the vector was causing problems. Using iterators
instead of direct access '[]' solved the problem.
Connection to channel server across the network was refused
The connect_socket function in Common_functions.C was changed from
m_addr.sin_addr.s_addr=inet_addr(host);
int status = inet_pton ( AF_INET, host, &m_addr.sin_addr );
to
m_addr.sin_addr.s_addr =htonl(INADDR_ANY);
struct hostent *hostinfo;
hostinfo= gethostbyname (host);
if (hostinfo == NULL){
cout<<"Unknown host %s.\n"<
return -1;
}
m_addr.sin_addr = *(struct in_addr *) hostinfo->h_addr;
Errors in listening and port number of channel server not getting
released as soon as the program is killed.
In channel server use: (Channel_server.C)
int on = 1;
if ( setsockopt ( server_socket, SOL_SOCKET, SO_REUSEADDR, ( void * ) &on, sizeof ( on ) ) == -1 )
return -1;
and in source and sinks do not have this option (this code is in Common_functions.C).
/* The following lines need to be commented for requesting connection outside local host */
// if ( setsockopt ( m_sock, SOL_SOCKET, SO_REUSEADDR, ( void * ) &on, sizeof ( on ) ) == -1 )
// return -1;
How to set read permission only for files?
find . -type d -exec chmod 711 {} \;
g++ throws warning about old headers
use instead of , for in
conjunction with "using namespace std;". allows new format of
headers. Section 17.4.1.2 of C++ standard.
http://gcc.gnu.org/onlinedocs/libstdc++/17_intro/headers_cc.txt
SAX Exception
if SAX exception, problem is probably with xalan.jar version if
Invoking DBLoader in Portal hangs, copy the hsqldb/lib/hsqldb.jar to
uPortal/lib run hsqldb from the command given in
uPortal/rdbm.properties
Service to service communication:
Message contains: - a unique identifier, a unique identifier of the data
object. real stream of outputs..
How to deploy jar files to tomcat directly?
Change the extension xx.jar to xx.war
place the xx.war file in tomcat/webapps
restart tomcat
now access http://tomcathost:port/xx
you should see the internal class files of xx here
Installing nexus and hdf5
Download HDF5 binary for linux 2.4
Download Szip2.0 binary for linux 2.4
copy szip2.0/lib/libsz.so.2 to hdf5/lib
Download Nexus API 2.0
Edit makefile_options to set compiler (gcc) and source files
edit makefile_hdf5 to remove napif.o from target
go to nexus dir
make lib5
Nexus napi5_test fails
when you edit napi5.c make sure all copies of napi5.c inside nexus
(main dir and src dir) are also changed.
Just a heads-up regarding HDF5. I installed the latest version of
the HDF 5 library* and hit some problems running napi5_test.
The problems come from the return value of H5Aiterate and
H5GIterate, and affect NX5getattrinfo, NX5getnextattr and
NX5getnextentry. The nexus API seems to expect them to return 1
while iteration is valid, 0 at the end of the traversal, and -1
otherwise. However, these functions now seem to skip the 0 and go
straight to -1. The state NX_EOD never seems to be reached;
instead one gets immediately to the state NX_ERROR. This means
functions like NX5getnextattr and NX5getnextentry fail with
"ERROR: iteration was not successful", and NX5getattrinfo goes
into infinite loops.
Simple hacks get past this. If one replaces the line in
NX5getnextentry( ):
else if (iRet == 0)
with
else if (iRet == 0 || iRet == -1),
and changes a few similar lines in NX5getattrinfo &
NX5getnextattr (changing lines like while(iRet != 0) to while(
iRet > 0) eliminates infinite loops), then napi5_test runs
successfully.
But this solution might hide a problem: the HDF5 behavior that
supported the distinction between NX_EOD and NX_ERROR may have
changed. Anyone relying on that distinction would want to know
about this.
collect2: ld returned 1 exit status
This is most likely a problem with not linking the correct
libraries. use -l and -L for linking libraries. If you are
sure, it is not a linking problem, then it could be problem
with not having enough space in /tmp. The linker tries to load
the libraries into /tmp and if you are out of disk space, you
may not be able to compile and get a ld error.
I placed a new war file in tomcat and tomcat keeps crashing
Try deleting the directory that was created by tomcat while
unwaring the file. This needs to be done every time the war
file is updated.
Tomcat keeps crashing
If tomcat keeps crashing could be the port is blocked and was
not released when tomcat was shutdown. Kill all java processes
and restart tomcat.
Axis Error in listing wsdl
Most likely some services deployed earlier are no longer
available. Edit the
tomcat/webapps/axis/WEB-INF/server-config.wsdd to remove
un-available services.
setting env variable through sh
try source xx.sh
make sure you have ended the last line with a
'enter'. Otherwise this line will not be executed.
(500) Internal server error in Axis
This is most likely an issue with classpath. All jars that are
needed by the services deployed into axis are to be copied into
tomcat/webapps/axis/WEB-INF/lib directory. The client side
classpath may not get reflected when tomcat is started as
standalone as it may or may not run in the same shell.
Change Mozilla/Firefox profile
Inside .mozilla/firefox there is a file called "profiles.ini" if
the valur of 'StartWithLastProfile' is set to 1, once a browser is
closed, it will be opened with the last used profile. If this
value is set to '0', the browser will prompt for choosing a
profile.
Mozilla profile in use
When mozilla is opened for the first time, it creates a lock
for the profile being used. by deleting this lock, you can
open mozilla with the same profile multiple times. Look into
~/.mozilla/profile_name/somedir/lock (or parent.lock or
parentlock)
How to start the java admin tool for SRB?
cd SRB/MCAT/java
java -Djava.util.prefs.syncInterval=200000 -jar mcatAdmin.jar
Error reading log4j.properites. java error opening zip
file
Check for the log4j.properties file in path and remove it. May be
it defaults to a wrong one.
test_srb_mdas_auth a b c (something like this) fails
Remove 's' in the last line of pgsql/data/pg_hba.conf
perl install.pl stop
perl install.pl start
perl install.pl
How to call cgi directly?
http://www.rgagnon.com/javadetails/java-0082.html
non-dce hpss 4.5
https://lists.sdsc.edu/pipermail/srb-chat/2004-March/000815.html
How to open the html output of a servlet in a new browser from the applet?
http://www.javaworld.com/javaworld/javatips/jw-javatip41.html
http://www.vipan.com/htdocs/usefulservlets.html
Cannot find "sns-portal" but tomcat is running
Check web.xml. Most likely there is something wrong here.
IncompatibleClassChangeError
This could be because you have multiple saaj jars in your
classpath. Remove others and retain only one saaj.jar and it
should work fine.
Unable to internalize message (SOAP attachments)
Need xercesImpl.jar in classpath
Webservices session management
http://java.boot.by/wsd-guide/ch04s04.html
How to use a fileinputstream as a SOAP attachment
import javax.xml.transform.stream.StreamSource;
import org.apache.axis.attachments.SourceDataSource;
import javax.activation.DataHandler;
....
AttachmentPart ap = reply.createAttachmentPart();
DataHandler dh = new DataHandler(new SourceDataSource("source","text/plain", new StreamSource(fis)));
ap.setDataHandler(dh);
reply.addAttachmentPart(ap);
....
Web services tutorial
http://java.sun.com/webservices/docs/1.0/tutorial/doc/JavaWSTutorialTOC.html
how to start apache in a different port
Edit 'Listen' directive in files apache_install_dir/conf/httpd.conf
Run shtml files in apache.
Edit apache/conf/httpd.conf. Uncomment
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
If you are still facing problems, try adding
AddHandler server-parsed .shtml
to enable server parsed html.
To add a style sheet to latex
To rehahsh latex search path use 'texhash' (in cygwin)
In cygwin default path for new sty files: /usr/share/texmf/tex/latex/.