just uncomment to activate it & put your name.
Παρασκευή 16 Δεκεμβρίου 2011
Startup Script for Glassfish
Lets say you called it FOO. You then run
Παρασκευή 25 Νοεμβρίου 2011
How to change the MySQL data default directory
Παρασκευή 21 Οκτωβρίου 2011
Object to byte array and byte array to Object in Java
public byte[] toByteArray (Object obj)
{
byte[] bytes = null;
ByteArrayOutputStream bos = new ByteArrayOutputStream();
try {
ObjectOutputStream oos = new ObjectOutputStream(bos);
oos.writeObject(obj);
oos.flush();
oos.close();
bos.close();
bytes = bos.toByteArray ();
}
catch (IOException ex) {
//TODO: Handle the exception
}
return bytes;
}
public Object toObject (byte[] bytes)
{
Object obj = null;
try {
ByteArrayInputStream bis = new ByteArrayInputStream (bytes);
ObjectInputStream ois = new ObjectInputStream (bis);
obj = ois.readObject();
}
catch (IOException ex) {
//TODO: Handle the exception
}
catch (ClassNotFoundException ex) {
//TODO: Handle the exception
}
return obj;
}
Τρίτη 19 Ιουλίου 2011
SSH without password
Your aim
login from host A / user a to Host B / user b.
call ssh from a within a shell script.
How to do it
First log in on A as user a and generate a pair of authentication keys. Do not enter a passphrase:
a@A:~> ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/a/.ssh/id_rsa):
Created directory '/home/a/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/a/.ssh/id_rsa.
Your public key has been saved in /home/a/.ssh/id_rsa.pub.
The key fingerprint is:
3e:4f:05:79:3a:9f:96:7c:3b:ad:e9:58:37:bc:37:e4 a@A
Now use ssh to create a directory ~/.ssh as user b on B. (The directory may already exist, which is fine):
a@A:~> ssh b@B mkdir -p .ssh
b@B's password:
Finally append a's new public key to b@B:.ssh/authorized_keys and enter b's password one last time:
a@A:~> cat .ssh/id_rsa.pub | ssh b@B 'cat >> .ssh/authorized_keys'
b@B's password:
From now on you can log into B as b from A as a without password:
a@A:~> ssh b@B hostname
B
A note from one of our readers: Depending on your version of SSH you might also have to do the following changes:
Put the public key in .ssh/authorized_keys2
Change the permissions of .ssh to 700
Change the permissions of .ssh/authorized_keys2 to 640
Τρίτη 23 Νοεμβρίου 2010
CLAPACK Installation in Netbeans,LINUX
Just to save a couple of hours of sleep for some people like me.
1)Download clapack.tgz from http://www.netlib.org/clapack/
2)Extract and call "make" inside the main directory
3)Call the following in terminal:
cp lapack_LINUX.a liblapack_LINUX.a
cp blas_LINUX.a libblas_LINUX.a
ranlib libblas_LINUX.a
ranlib liblapack_LINUX.a
cd F2CLIBS/
cp libf2c.a liblibf2c.a
ranlib liblibf2c.a
cp liblibf2c.a ../
4)Create new C Project in Netbeans
5)Change the makefile to contain only this:
CC = gcc
ROOTPATH = /path/to/clapack
main:main.o
$(CC) -o ./dist/Debug/GNU-Linux-x86/NAME_OF_PROJECT/main.c -I$(ROOTPATH)/INCLUDE -L$(ROOTPATH) -llapack_LINUX -lblas_LINUX -llibf2c -lm
Very helpful topic:
http://icl.cs.utk.edu/lapack-forum/viewtopic.php?f=2&t=2020
Τετάρτη 1 Σεπτεμβρίου 2010
Lyx : LaTeX Frontend
GUI for writing in LaTeX
1) sudo apt-get install lyx
2) If you want to see your math symbols instead of red text, also install the latex-xft-fonts package.
3) latex2html allows lyx to produce html output.
4) foiltex is useful for making presentations.
5) After installing such packages you should reconfigure ( goto Edit -> Reconfigure) and then restart LyX.
For Greek support:
6) Install packages texlive-lang-greek,texlive-fonts-extra,texlive-latex-extra