Oracle exp export with full tns-string

Handling the oracle tns-names file can be a pain in the ass, especially if you don’t want to rely on it. For example you want a user to enter dynamically a connection with typical “host, port, sid, username, password” configuration. In oracle you can also use the full tns-string to connect to a database. I struggled some time finding the correct escape and quotation configuration, but finally this worked:

Linux
(if the line is too long to fit in the browser window mark it completely (double-click) and copy&paste it in your favourite editor)

exp userid=\'sys/yourpw@\(DESCRIPTION\=\(ADDRESS_LIST\=\(ADDRESS\=\(PROTOCOL\=TCP\)\(Host\=192.168.123.123\)\(Port\=1521\)\)\)\(CONNECT_DATA\=\(SID\=xe\)\)\) as sysdba\' file=/tmp/testexp.dmp full=y

Oracle-Documentation
http://docs.oracle.com/cd/B19306_01/server.102/b14215/exp_imp.htm

pixelstats trackingpixel

Getting DIGITUS-DN-70440 to work with Ubuntu 11.10 and ndiswrapper

I needed a new wlan stick for my fixed pc, as the old one had a very weak reception, so I looked a bit in the shops and found that a realtek stick with reverse-sma port + a extra large antenna just were about 15 Euros. The exact name of the stick is DIGITUS-DN-70440, but it has a Realtek 8192CU chipset on board. Thinking about the fine support for Realtek Ethernet-Cards and reading it had “Linux-Support” I thought it should work like a charm…..Screw this. The crapstick kept kicking me out of the wlan every 10 seconds and I was blaming everthing else until I realised, it’s the driver. The experience I made was: you just can’t use the linux driver…

Not amused to buy a new stick i thought: Damn it, i’ll try ndiswrapper. Et voilà everythink works as expected. Here are the necessary steps:

1. Get the windows driver labeled “Utility and Driver Auto Installation Program (Support XP/Vista/Win7)(Install Shield v1.00.0187)”
http://www.realtek.com.tw/downloads/downloadsView.aspx?Langid=1&PFid=48&Level=5&Conn=4&ProdID=277&DownTypeID=3&GetDown=false&Downloads=true
2. Unzip it and copy the file “RTWLANU_Driver/WinXP/netrtwlanu.inf” somewhere on your pc (i used /opt)
3. install ndiswrapper, load the driver, see if it is loaded and the device is shown ban the old driver and reboot your pc

sudo apt-get install ndiswrapper-utils-1.9
sudo ndiswrapper -i /opt/RTWLANU_Driver/WinXP/netrtwlanu.inf
sudo ndiswrapper -l
echo "blacklist rtl8192cu" | sudo tee /etc/modprobe.d/blacklist-rtl8192cu.conf
echo 8192cu | sudo tee -a /etc/modules

the ndiswrapper -l should look like this

$> sudo ndiswrapper -l
$> netrtwlanu : driver installed
	device (0BDA:8176) present (alternate driver: rtl8192cu)

this tutorial was taken from these forum posts : http://forums.linuxmint.com/viewtopic.php?t=94495&f=53

PS: ndiswrapper is not the nice solution, but I was fed up with trying to compile the realtek-drivers (in fact I did go to all the source-code fixing stuff for Ubuntu 11.10 compiled it, but it was as crappy as before). If the linux-drivers get stable some day, just drop me a line and I will switch happily

pixelstats trackingpixel

Glassfish 3.1.1 increase asadmin deployment timeout

Recently I was wondering why the deployment of a EAR-File on Glassfish 3.1.1 over the Web-Administration-Console or with asadmin took very very long in compare to local deployment with eclipse. The EAR-File is about 50 MB of size and contains a complex web-application. With eclipse deployment takes about 20 seconds. With administration-console or with asadmin the deployment takes more than 10 minutes. As the default deployment timeout value of asadmin is 600 seconds i even wasn’t able to deploy it at all.

This was the error message:

No response from Domain Admin Server after 600 seconds.
The command is either taking too long to complete or the server has failed.
Please see the server log files for command status.
Command deploy failed.

I was searching the web and found the source of the problem:
http://java.net/jira/browse/GLASSFISH-17094

As I only needed to deploy one time I thought I would go with remote-deployment, and just wait. But how to increase the deployment timeout, after searching quite some time on the web, I found the solution. Just set the environment variable AS_ADMIN_READTIMEOUT to increase the asadmin deployment timeout from 600 seconds to 3600 seconds.

export AS_ADMIN_READTIMEOUT="3600000"
./asadmin deploy yourPackage.ear
pixelstats trackingpixel

Gnome Panel Applets not showing up in Applet List in Ubuntu 10.4 Natty

For quite some time I was trying to figure out why my installed applets like “hamster-applet” for example where not showing up in the applet list. Finally I found the solution. You have to install the gnome applet bonobo compatibility package:

sudo apt-get install gnome-panel-bonobo

Then log off and on and the applets should show up in the list.

pixelstats trackingpixel

Generating MS Project Plans with MPXJ

Lately needed to create a project plan for a company who was doing some migrations. In this migrations a lot of different systems (about 200) and ressources (about 200 people) where involved. There were about 30 tasks which all had a different duration and different people involved depending on the system for which they were performed. First we thought about doing it the hard way: preparing a template for one system, copy&pasting it 200 times, then adjusting the values as needed. But due to frequent changes in the plan soon this turned out as unmanageable work effort.
So I was looking for some solution to automatically generate the plan.

I found this great java library, which makes it easy to read and write project plans: http://mpxj.sourceforge.net/

Download

First download the necessary files. The mpxj library is mandatory, the poi library you need to read mpp-Project-Files.

Setting up eclipse

  1. Create a new Java Project
  2. Add the mpxj and poi libraries to the buildpath as external archives

Create a basic project plan

Here is the example code to generate a basic project plan with tasks and subtasks and dependencies between the tasks

import java.util.Calendar;
import java.util.Calendar;
 
import net.sf.mpxj.Duration;
import net.sf.mpxj.ProjectFile;
import net.sf.mpxj.RelationType;
import net.sf.mpxj.Resource;
import net.sf.mpxj.Task;
import net.sf.mpxj.TimeUnit;
import net.sf.mpxj.mpx.MPXWriter;
 
public class MpxjExample {
 
	static Task pre = null;
 
	public static void main(String[] args) throws Exception {
 
		// writes the project-data-structure into a mpx-XML-File
		MPXWriter mpxwriter = new MPXWriter();
 
		// base data-structure for project files
		ProjectFile projectfile = new ProjectFile();
 
		// filling the project with some dummy data
		// here you can easily use your real data extracted
		// from a database or a csv-file
		int personcount = 1;
		for (int i = 1; i <= 10; i++) {
 
			// the same task as in ms project
			Task task = projectfile.addTask();
			task.setName("Example Task " + i);
 
			Task presub = null;
			// add some subtasks
			for (int j = 1; j <= 10; j++) {
 
				Task subtask = task.addTask();
				subtask.setName("Sub Task " + j);
 
				// set the subtasks duration, every subtask will take 4 hours in
				// the example
				subtask.setDuration(Duration.getInstance(4, TimeUnit.HOURS));
 
				// add resources to the subtask
				// in this example we will add only one resource to every task
				// 1. add the resource to the general projectfile
				Resource res = projectfile.addResource();
				res.setName("Person " + personcount);
				personcount++;
 
				// associate the resource with the current task
				subtask.addResourceAssignment(res);
 
				// concatenate the subtasks, so that one subtask is performed after
				// another on the timeline
				// the first task has no predecessor
				if (j == 1) {
					presub = subtask;
				} else {
					subtask.addPredecessor(presub, RelationType.FINISH_START, Duration
							.getInstance(0, TimeUnit.HOURS));
					presub = subtask;
				}
			}
 
			// concatenate the tasks, so that one main task is performed after
			// another on the timeline
			// the first task has no predecessor
			if (i == 1) {
				//set the startdate of the project
				Calendar rightNow = Calendar.getInstance();
				rightNow.set(2012, 1, 1);
				task.setStart(rightNow.getTime());
				pre = task;
			} else {
				task.addPredecessor(pre, RelationType.FINISH_START, Duration
						.getInstance(0, TimeUnit.HOURS));
				pre = task;
			}
		}
 
		//writing the project file
		mpxwriter.write(projectfile, "exampleproject.mpx");
 
	}
}

Opening the file in MS Project

At my tries there popped up an error message, but if you click to ignore the warnings the file builds up normally and then you can save it under a normal mpp-file. With the mpp-file saved by MS Project no error messages pop up.

Sometimes MS Project crashed when opening the mpx-file, but next time it worked. I think there is some problem with MS Project parsing files which have not set all values. But trying it another time for me always worked.

Adding several resources to a task

I don’t know if this is the right way to do, but for me it worked. As long as you proceed this way. If i did it otherwise, the total project times did not fit in the end.

  1. you need to know (in the code) how many resources will be added to the task
  2. add the time the task takes and divide it through the count of resources added (the more people work on the task in parallel the faster it is finished)
  3. add the resources

Here is the example code

import java.util.Calendar;
import java.util.Calendar;
 
import net.sf.mpxj.Duration;
import net.sf.mpxj.ProjectFile;
import net.sf.mpxj.RelationType;
import net.sf.mpxj.Resource;
import net.sf.mpxj.Task;
import net.sf.mpxj.TimeUnit;
import net.sf.mpxj.mpx.MPXWriter;
 
public class MpxjExample2 {
 
	static Task pre = null;
	static final int respertask = 3;
 
	public static void main(String[] args) throws Exception {
 
		// writes the project-data-structure into a mpx-XML-File
		MPXWriter mpxwriter = new MPXWriter();
 
		// base data-structure for project files
		ProjectFile projectfile = new ProjectFile();
 
		// filling the project with some dummy data
		// here you can easily use your real data extracted
		// from a database or a csv-file
		int personcount = 1;
		for (int i = 1; i <= 10; i++) {
 
			// the same task as in ms project
			Task task = projectfile.addTask();
			task.setName("Example Task " + i);
 
			Task presub = null;
			// add some subtasks
			for (int j = 1; j <= 10; j++) {
 
				Task subtask = task.addTask();
				subtask.setName("Sub Task " + j);
 
				//this time we add three resources per task
				subtask.setDuration(Duration.getInstance(((float)4/(float)respertask), TimeUnit.HOURS));
				for(int k = 1; k <= respertask; k++) {
 
 
				// add resources to the subtask
				// 1. add the resource to the general projectfile
				Resource res = projectfile.addResource();
				res.setName("Person " + personcount);
				personcount++;
 
				// associate the resource with the current task
				subtask.addResourceAssignment(res);
				}
				// set the subtasks duration, every subtask will take 4 hours in
				// the example
 
 
 
 
				// concatenate the subtasks, so that one subtask is performed after
				// another on the timeline
				// the first task has no predecessor
				if (j == 1) {
					presub = subtask;
				} else {
					subtask.addPredecessor(presub, RelationType.FINISH_START, Duration
							.getInstance(0, TimeUnit.HOURS));
					presub = subtask;
				}
			}
 
			// concatenate the tasks, so that one main task is performed after
			// another on the timeline
			// the first task has no predecessor
			if (i == 1) {
				//set the startdate of the project
				Calendar rightNow = Calendar.getInstance();
				rightNow.set(2012, 1, 1);
				task.setStart(rightNow.getTime());
				pre = task;
			} else {
				task.addPredecessor(pre, RelationType.FINISH_START, Duration
						.getInstance(0, TimeUnit.HOURS));
				pre = task;
			}
		}
 
		//writing the project file
		mpxwriter.write(projectfile, "exampleproject2.mpx");
 
	}
}

Example Java Classes

MpxjExample.java
MpxjExample2.java

pixelstats trackingpixel

nice hibernate annotation tutorial

playing around with spring and hibernate I found this very good and practical tutorial which explained to me how to model many-to-many and one-to-many relationships with hibernate using annotations.

http://www.vaannila.com/hibernate/hibernate-tutorial/hibernate-tutorial.html

By the way. If you need a good starting point for exploring spring with hibernate and maven as build system check this page out. For my tests I slightly modified the example and added the maven exec plugin to actually run the project without having to worry about the dependency libraries. (i will add this part of the pom.xml some day to this post)

http://www.mkyong.com/spring/maven-spring-hibernate-annotation-mysql-example/

pixelstats trackingpixel

(Deutsch) Studieren oder nicht studieren, das ist hier die Frage

Sorry, this entry is only available in Deutsch.

pixelstats trackingpixel

how to become a good system administrator

really like what you are doing

you wan’t to make money? you think IT sounds cool, even if you don’t know what it means? You have a iPhone, so you’re 1337? Perfect requirements to become an it-specialist … NOT . Actually there exist a lot of people outside who would call themselves it specialists who fit quite well into this pattern, but obviously they are not. The problem is that all knowlegde comes from repetition and failure (and mostly repetition of the failures 😉 ) and this can be boring and disappointing. But to get real knowledge you have to go through this process. So be curious and really like exploring the system and playing around with stuff, this will bring you very far. Don’t look at others, perhaps some gain more, perhaps some work less, but in the end you have the knowledge and this satisfaction lasts. And if you have some über-guy at work and think you will never know as much as him: He puts his pants on one leg at a time, too.

  1. really like experimenting and exploring computer systems and software. If you don’t. No matter, but perhaps you should take another less technical emphasis (it-support, it-sales, etc.).
  2. be open for the new. Often you will be asked to do some new task you don’t have the necessary knowledge for. A lot of people just reject such tasks, which makes sense if you are overloaded with work. If you have some free time try to do the stuff through learning the necessary skills. Learning with a specific task or real life application for me always was way easier than just learning in theory
  3. if you have some time left over at work look for some interesting stuff which is used or could be used in the company. Of course you can also read general information, but personally I learn best when I can try my new earned knowlegde on a reallife project. Often you find some stuff to improve or you can finally document this or that.

Where to start?

So you are motivated and want to start yesterday with learning, but you really don’t know what you should do. There are so many topic, so many stuff. What will you need? Basically everything can be of good use, as the field is very wide in IT, so you best start just with something you like. Here is a basic skill list, you can pick some stuff.

Hardware Knowledge

  • Buy the components and build your own self configured PC, know what the components do
  • Setup your own network, use a switch, crimp some cables by your own

Basic System Knowledge

  • Basic Linux/Unix Administration: set up your own linux server (you can do it easily with a virtual machine these days), play around with basic commands, read a good basic linux book and DO THE PRACTICAL EXERCISES
  • try to build your own kernel (you can start with the config of your distribution-kernel, normally found under /boot/kernel-name.config)
  • try to compile some program under linux, for example the videolan-player or something else
  • learn to use SSH
  • get used to the run-level autostart system
  • Basic Windows Active Directory Setup: Learn how to set up a Domain-Controller with server-saved profiles, DNS, Shares
  • use group policies to install a printer and mount the shared-Directory on the windows clients

Services

  • Set up a apache-Webserver with PHP-Support
  • Set up a DNS Server (e.g. bind)
  • Set up a FTP Server (e.g. vsftpd)
  • Set up a Mail Server (e.g. postfix + dovecot)

Programming

  • Learn Bash-Skripting
  • Aquire at least some basic Perl-Knowledge (as it is one of the most popular languages among administrators)
  • Learn Perl or PHP or Python or Ruby, etc. , it should be a scripting language, because this is easier for most administrative tasks
  • Solve Problems regarding your daily work, for example a simple Backup-Skript, etc.
pixelstats trackingpixel

Installing Glassfish 3.1 on headless Centos 5.5

i run into some problems installing glassfish on a centos server without X-Windows. You can use the glassfish installer, but actually just unzipping the glassfish-zip is the easier method.

Method 1: Installing just with a zip file (easy method)

1. you have to get a java sdk and install (i used the rpm provided by oracle)
2. get the glassfish zip-file install package

3. to install the glassfish server, just unzip it in the directory you want. For example for /opt

cd /opt
wget http://download.java.net/glassfish/3.1.2/release/glassfish-3.1.2-ml.zip
unzip glassfish-3.1.2-ml.zip

4. configure the jdk in file /opt/glassfish3/glassfish/config/asenv.conf, add the line AS_JAVA=[pathtoyourjdk]

AS_JAVA=/opt/jdk1.6.29

5. check your /etc/hosts file. There HAS TO BE a entry with your hostname pointing to eth0
(eg. if eth0=192.168.123.3, then you need a line like this
192.168.123.3 centsrv.example.com centsrv

otherwise you will get the error “There is a process already using the admin port 4848 — it probably is another instance of a GlassFish server.”

Method 2: Installing with the Glassfish Installer

loli (local linux box) you need X-Windows running there of course
centsrv (remote centos server without X11)

1. you have to get a java sdk and install (i used the rpm provided by oracle)
2. get the glassfish install package for linux
3. install the xauth package (e.g. yum install xorg-x11-xauth) without it you can’t with ssh X-forwarding
4. connect with X forwarding to centsrv: ssh -X root@centsrv
5. now simply start the glassfish setup, the graphical installer will start on your local linux machine (loli) but it will run on the server centsrv. i installed glassfish under /opt/glassfish3
6. check your /etc/hosts file. There HAS TO BE a entry with your hostname pointing to eth0
(eg. if eth0=192.168.123.3, then you need a line like this
192.168.123.3 centsrv.example.com centsrv

otherwise you will get the error “There is a process already using the admin port 4848 — it probably is another instance of a GlassFish server.”

First steps

Start the glassfish-server

/opt/glassfish3/glassfish/bin/asadmin start-domain

Now go to the admin console http://[yourdomain].com:4848/

to upload the first webapplication

The logfiles for the default domain domain1 are located in /opt/glassfish3/glassfish/domains/domain1/log/

pixelstats trackingpixel

Mounting ReadyNAS CIFS Volume under Ubuntu Linux

I had severe problems to get a mount of the ReadyNAS automatic usershare to my laptop. Everthing I was trying failed and serveral people had the same problem. The NAS had domain-authentication activated.

The error was error 13 = Permission denied

This is my fstab entry which worked in the end, substitute XX with your IP and mmustermann with your user.


//192.168.XX.XX/mmustermann /mnt/mmustermann-usershare cifs credentials=/etc/samba/mmustermann-creds,uid=mmustermann,gid=mmustermann,domain=mydomain,forceuid,forcegid,sec=krb5,iocharset=utf8 0 0

this is my credential file /etc/samba/mmustermann-creds:

username=mmustermann
password=mypw

EDIT: i forgot the domain part, without it it didn’t work properly. Actually i had some problems mounting the autogenerated usershare again. So for now only thing that worked for me was a “normal” manual created share.

pixelstats trackingpixel