sobota, 1. januar 2011

New Year

I wish to you all a better 2011

torek, 14. december 2010

Is this for real?

Read what Bjarne Stroustrup said about creating C++ here. Then tell me what you think.
I must admit I always found C++ a bit weird. :)

petek, 15. oktober 2010

More space on Linux HOME partition

I've been trying to post this for a while, but never came to it.
Here it goes.

On every Linux partition there is a certain percent (usually 5%).
For certain partition you can check the amount of reserved space like this:
sudo dumpe2fs /dev/sda3 | grep "Reserved block count"

On my computer I had about 6Gb of reserved space.
You can gain those 6Gb of space back simply by using:
sudo tune2fs -m 0 /dev/sda3

I DON'T recomend using this on you root, boot, ... partitions. More on this can be read at How to Gain Couple Of Gb Of Free Space On Linux

četrtek, 23. september 2010

First


Two days ago I bought an HTC Desire phone with Android 2.2. I'm still learning, installing applications, ... This is my first smart phone and it's great. :))

This is also my first post from the phone.

petek, 7. maj 2010

Compile DB2 plugin for Qt on Linux

Steps:
- get Qt from Nokia's page
- install it
- run configure like this:
./configure -plugin-sql-db2 -v -I /opt/ibm/db2/V9.7/include -L /opt/ibm/db2/V9.7/lib64/
make
make install (if you want to install it)


- this should compile DB2 plugin for Qt. Now you can use this installation or copy generated Qt db2 plugin (libsqldb2.so) to /usr/lib/qt4/plugins/sqldrivers

Access DB2 via ODBC on Linux

This is how to install ODBC on Linux (Kubuntu 10.04) and access it.
Steps:
- install DB2 (I always install everything)
- install unixODBC
- edit $HOME/.odbc.ini :
[DB_NAME]
Description = Connection to DB_NAME
Driver=$HOME/sqllib/lib/libdb2.so

- run db2ca and add DB_NAME (don't forget to add ODBC)
- now you can use it on Qt for example like this:
QSqlDatabase db = QSqlDatabase::addDatabase("QODBC");
db.setDatabaseName("DB_NAME");
db.setUserName("DB_USER");
db.setPassword("DB_PASS");
db.open();
QSqlError error = db.lastError();
qDebug() << "db error = " << error;

QSqlQuery query = db.exec("SELECT 1 FROM SYSIBM.SYSDUMMY1");
while (query.next() == true) {
qDebug() << query.value(0).toString();
}

petek, 5. februar 2010

DB2 9.7.1, db2start and SQL1042C

As you may know I'm running Kubuntu 9.10.
The other day I installed DB2 Express-C 9.7.1 on it. When I tried db2start I got:
SQL1042C An unexpected system error occurred. SQLSTATE=58004

If you get the same try running db2ftok and then db2start again. It works for me.

ponedeljek, 1. februar 2010

"How to shoot yourself in the foot" in various languages

Follow this link.
ActiveX is the one I like the most. How about you ?

petek, 29. januar 2010

Sun is eclipsed. :(((

petek, 1. januar 2010

Happy new year

I hope it will be better that 2009

č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]