Fix sluggish mouse in Ubuntu 12.04 LTS

For some time now i have the problem with my Dell Latitude E6510 Laptop that when I plug in a USB mouse the mouse is really slow and sluggish. Usually a reboot fixes this, but this is very inconvenient. Today I tried some googleing again and found at least a workaround to restart the usb-services without rebooting. This usually helps to fix the mouse.

Find with lspci the device ids of your usb hubs:

lspci | grep -i usb
00:1a.0 USB controller: Intel Corporation 5 Series/3400 Series Chipset USB2 Enhanced Host Controller (rev 05)
00:1d.0 USB controller: Intel Corporation 5 Series/3400 Series Chipset USB2 Enhanced Host Controller (rev 05)

I wrote this little script, but of course you can also execute the commands directly on the commandline. In this case just be sure, that you have another keyboard than the one that is connected to usb, as of course after the unbind it will not work anymore until the rebind. (If you execute the commands by script or in one line, separated with ; it should be no problem as rebind is triggered directly after unbind without further keyboard involment).

switch the device numbers according to your lspci listing

#!/bin/bash
echo -n '0000:00:1a.0' > /sys/bus/pci/drivers/ehci_hcd/unbind 
echo -n '0000:00:1a.0' > /sys/bus/pci/drivers/ehci_hcd/bind 
echo -n '0000:00:1d.0' > /sys/bus/pci/drivers/ehci_hcd/unbind 
echo -n '0000:00:1d.0' > /sys/bus/pci/drivers/ehci_hcd/bind
pixelstats trackingpixel

Ubuntu Upgrade to 12.04 LTS -> Libreoffice not working anymore

After a update session of several hours from Ubuntu 11.04 over 11.10 to 12.04 LTS I wanted to start using libreoffice, but it terminated right after start:

$> loimpress
terminate called after throwing an instance of 'com::sun::star::uno::RuntimeException'

As root it started without problems, after some googleing and seeing the gdb-trace I found the solution to my problem. Something with the migration of the previous version config files got wrong. So I just deleted them. It is not very elegant, but worked for me and as I did not make any special settings in libreoffice for me it was not painful.

Caution! you will loose all libreoffice-settings with this method

For me the important part was deleting the .ure-Directory, after this it worked.

$> cd ~
$> sudo rm -rf .libreoffice
$> sudo rm -rf .openoffice.org
$> sudo rm -rf .config/libreoffice
$> sudo rm -rf .ure
pixelstats trackingpixel

Ubuntu 12.04 Gnome Classic Panel Right-Click does not work

As I was looking for this really a long time I am reposting it:

http://askubuntu.com/questions/66414/how-to-add-panel-applets-to-classic-gnome-panel

With the new gnome and using a classic-session you have to press META + ALT + RightClick to access the panel menu. In my case META is “Alt Gr”. So try this:

  • ALT + RightClick  (if it doesn’t work try next)
  • Alt Gr + Alt + RightClick
pixelstats trackingpixel

Informatica 9.1 Installation could not start _AdminConsole

Installing Informatica with the installer was straightforward, but for some strange reason the adminconsole could not be started. Here the output I found in the Logfile:

INFA_HOME/tomcat/logs/node.log
 2012-08-08 12:17:45,294 ERROR [Thread 6 of 6 in DomainServiceThreadPool] [SPC_10013] Prozess für Dienst _AdminConsole konnte nicht gestartet werden.
 2012-08-08 12:27:41,524 ERROR [Thread 6 of 6 in DomainServiceThreadPool] [SPC_10013] Prozess für Dienst _AdminConsole konnte nicht gestartet werden.
 2012-08-08 12:42:07,275 ERROR [Thread 6 of 6 in DomainServiceThreadPool] [SPC_10013] Prozess für Dienst _AdminConsole konnte nicht gestartet werden.

this is not very helpful, but in the following logfile I found a clue:

INFA_HOME/services/AdministratorConsole/administrator.log

2012-08-08 11:40:45,103 ERROR [org.apache.catalina.core.ContainerBase.[_AdminConsole].[localhost].[/administrator]] Exception sending context initialized event to listener instance of class com.informatica.adminconsole.app.config.CustomChainListener
java.lang.RuntimeException: Exception parsing chain config resource ‘/WEB-INF/chain-config.xml’: /..INFA_HOME../services/AdministratorConsole/administrator/WEB-INF/chain-config.xml (Too many open files)
at org.apache.commons.chain.web.ChainResources.parseWebResources(ChainResources.java:194)
at org.apache.commons.chain.web.ChainListener.contextInitialized(ChainListener.java:221)
at com.informatica.adminconsole.app.config.CustomChainListener.contextInitialized(CustomChainListener.java:32)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3795)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4252)
at org.apache.catalina.core.StandardContext.reload(StandardContext.java:3056)
at org.apache.catalina.loader.WebappLoader.backgroundProcess(WebappLoader.java:432)
at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1278)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1570)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1579)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1579)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1559)
at java.lang.Thread.run(Thread.java:662)

So to fix the problem you have to increase the open file descriptor limits.
http://www.cyberciti.biz/faq/linux-increase-the-maximum-number-of-open-files/

#$ sysctl -w fs.file-max=100000

#$ vi /etc/sysctl.conf

add the line:

fs.file-max = 100000

#$ sysctl -p

#$ vi /etc/security/limits.conf

Add the lines for your informatica user (e.g. informatica)
informatica soft nofile 4096
informatica hard nofile 10240

or if you are not sure for all users:

* soft nofile 4096 * hard nofile 10240

Restart the server and it should work. Or do:

http://lzone.de/apply+limits+immediately

Here is a little tip how I found interesting logfiles in the Informatica-Home-Directory:
This gives all files with ending “log” and the line count

find . -name "*.log" | xargs wc -l
 0 ./servicesFramework.log
 0 ./isp/bin/servicesFramework.log
 0 ./services/AdministratorConsole/monitoring.log
 15 ./services/AdministratorConsole/administrator.log
 0 ./server/servicesFramework.log
 0 ./tomcat/webapps/csm/output/csm.log
 367 ./tomcat/logs/node.log
 264 ./tomcat/logs/exceptions.log
 0 ./tomcat/temp/_AdminConsole/logs/host-manager.2012-08-08.log
 0 ./tomcat/temp/_AdminConsole/logs/manager.2012-08-08.log
 55459 ./tomcat/temp/_AdminConsole/logs/catalina.2012-08-08.log
 0 ./tomcat/temp/_AdminConsole/logs/admin.2012-08-08.log
 0 ./tomcat/temp/_AdminConsole/logs/localhost.2012-08-08.log
 622 ./tomcat/bin/ispLogs.log
 676 ./tomcat/bin/servicesFramework.log
 0 ./tomcat/bin/infa_jsf.log
 402 ./Informatica_9.1.0_Services_HotFix4.log
 297 ./Informatica_9.1.0_HotFix4_Services_InstallLog.log
pixelstats trackingpixel

Glassfish Directory Deployment (explode Ear)

Recently I was struggeling with glassfish directory deployment. Actually it is quite easy:

  • unzip the ear-File (eg. example.ear) to a directory without .ear
  • then go into this directory and unzip all war and jar files to directories named _jar and _war (only on this directory level, don’t touch the files in /lib)
  • now copy the folder into your domains-autodeploy-folder

For more convenience, use this script. I think it is selfexplaining.

earexploder.sh example.ear

FILE: earexploder.sh

#!/bin/bash
 
EAR=$1
 
EARDIR=${EAR%.ear}
 
unzip $EAR -d $EARDIR
cd $EARDIR
 
for ARCHIVE in $(ls -1 *.jar); do
    ARCHIVEDIR=${ARCHIVE%.jar}
    ARCHIVEDIR=${ARCHIVEDIR}_jar
    unzip $ARCHIVE -d $ARCHIVEDIR
done
 
for ARCHIVE in $(ls -1 *.war); do
    ARCHIVEDIR=${ARCHIVE%.war}
    ARCHIVEDIR=${ARCHIVEDIR}_war
    unzip $ARCHIVE -d $ARCHIVEDIR
done
pixelstats trackingpixel

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
←Older