četrtek, 24. december 2009

Novatel Wireless MC950D on Kubuntu 9.10

All I had to do is:
- unmount the CD-ROM
- set a custom DNS server

petek, 18. december 2009

Opening OpenOffice.org application through Java crashes

This is on Kubuntu 9.10.
If you see an error:
CE> QPixmap: It is not safe to use pixmaps outside the GUI thread
CE> QPixmap: It is not safe to use pixmaps outside the GUI thread
CE> QPixmap: It is not safe to use pixmaps outside the GUI thread
CE> QPixmap: It is not safe to use pixmaps outside the GUI thread
CE> QPixmap: It is not safe to use pixmaps outside the GUI thread
CE> QPixmap: It is not safe to use pixmaps outside the GUI thread
CE> QPixmap: It is not safe to use pixmaps outside the GUI thread
CE> QPainter::begin: Cannot paint on a null pixmap
CE> X-Error: BadDrawable (invalid Pixmap or Window parameter)
CE> Major opcode: 62 (X_CopyArea)
CE> Resource ID: 0x0
CE> Serial No: 621 (621)
CE> These errors are reported asynchronously,
CE> set environment variable SAL_SYNCHRONIZE to 1 to help debugging
com.sun.star.lang.DisposedException: java.io.EOFException
at com.sun.star.lib.uno.bridges.java_remote.java_remote_bridge$MessageDispatcher.run(java_remote_bridge.java:171)

when you try to open OpenOffice.org program (scalc, swriter, ...) using Java you can uninstall openoffice.org-kde or openofice.org-gtk packages. I'm still not able to pinpoint why this is crashing.

četrtek, 17. december 2009

Open 7-Zip archives in Midnight Commander

Edit Midnight Commander's extension file and look for "7zip archives". You should see something like this:
# 7zip archives (they are not man pages)
shell/.7z
View=%view{ascii} 7za l %f 2>/dev/null

Now add:
Open=%cd %p#u7z

to get:
# 7zip archives (they are not man pages)
shell/.7z
View=%view{ascii} 7za l %f 2>/dev/null
Open=%cd %p#u7z

ponedeljek, 9. november 2009

Kubuntu 9.10, mc does not show files in zip/jar

Couple of days ago I upgraded my machine to Kubuntu 9.10. I like it a lot. :)
At lease hibernate is a lot faster. :))
I had a problem with mc not showing content of zip and jar archives. When I pressed Enter of them no files were displayed.
So the solution is:
- sudo vi /usr/share/mc/extfs/uzip
- set my $op_has_zipinfo to 1
- save and restart mc

petek, 18. september 2009

Ws and HTTP Basic authentication

If you want to create a client for a web service that uses HTTP Basic authentication, you can authenticate in two different ways:
- use your own Authenticator class:
public class SAPAuthenticator extends Authenticator
{
private String username;
private char[] password;

public SAPAuthenticator(String username, char[] password)
{
this.username = username;
this.password = password;
}

@Override
protected PasswordAuthentication getPasswordAuthentication()
{
return new PasswordAuthentication(username, password);
}
}

and then use it is you client like this:
Authenticator.setDefault(new SAPAuthenticator("username", "password".toCharArray()));

- in your client you can write something like this:
((BindingProvider) port).getRequestContext().put(BindingProvider.USERNAME_PROPERTY, "username");
((BindingProvider) port).getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, "password");

torek, 1. september 2009

the science of motivation

Dan Pink - The science of motivation 1/2

Dan Pink - The science of motivation 2/2

sreda, 10. junij 2009

SQLCODE=-4214 on DB2 on Linux

If you get SQLCODE=-4214 when you try to connect to a database running on Linux then you can do:
usermod --password `openssl passwd PASSWORD_TO_USE` USERNAME

The problem is that DB2 doesn't like SHA-512 hashes, but MD5.
On Ubuntu you can also change /etc/pam.d/common-password and change line
password [success=1 default=ignore] pam_unix.so obscure sha512

to
password [success=1 default=ignore] pam_unix.so obscure md5

Now changing the password will use MD5 hashes instead of SHA-512. This is a bit unsecure, so you decide if you need it. usermod should do the trick anyway.
Just remember that DB2 expects username on Linux (probably on every UNIX) to be all lowercase.

torek, 26. maj 2009

Export public key from a X.509 certificate

If you have an X.509 certificate in .p12 file then you can export public key like this:
openssl pkcs12 -in myFile.p12 -out myPublicKey.pem -clcerts -nokeys

petek, 22. maj 2009

Enable/disable KDE 4 desktop effects on command-line

Today I had a problem that my laptop, running KDE4 with desktop effects turned on, froze before I could start systemsettings and disable it. So to manually disable it:
- start Ubuntu in recovery mode
- go to root console
- go to /home/$USER/.kde or /home/$USER/.kde4
- then edit share/config/kwinrc
- set Enabled to false under [Compositing]

četrtek, 21. maj 2009

When I came to work

If I want to know when I came to work in the morning I use this piece of code:
LANG=en_us date "+%b %d" | xargs -i grep -m1 -i {} /var/log/syslog.0 | awk '{ print "Today I got to work at " $3 }'

I can use this since I power up my laptop every morning.
I got this one on a blog that I cannot find now, so I hope the author will not be angry with me. I just added LANG=en_us since the date format in syslog.0 is in en_us.

sreda, 22. april 2009

COM port support on AMD64 and Sun JDK 6 under Linux

If you want to get support for COM ports under 64-bit Linux then you need to:
- go to http://www.ibm.com/developerworks/java/jdk/linux/download.html
- go to 64-bit AMD/Opteron/EM64T under Java SE Version 6
- download Java Communications API

Now you need to put:
- javax.comm.properties into $JAVA_HOME/jre/lib
- libLinuxSerialParallel.so into $JAVA_HOME/jre/lib/amd64
- comm.jar into your project or $JAVA_HOME/jre/lib/ext

Now you need to edit javax.comm.properties to point to a correct physical devices.

ponedeljek, 9. marec 2009

Child

I didn't post anything for a long time, but I have a good reason for that. About a month ago I got my first child, a daughter. :)))
She can only cry, eat, put things in her diper :)), make funny faces and sleep.
I'm over 30 and this is my first child. If I only knew how great is to have one I'd have her a long time ago. So anyone that is not decided to have one or not, just do it. Just make sure you have a child with a women you love.