Lately I’ve worked with mongoDB which is a great NoSQL database. A tool which can come in handy is mongosniff, which comes with mongodb binaries. Mongosniff is something like tcpdump for TCP/IP.

On my Fedora 16 x86_64 System I’m running mongodb binaries available from mongodb, this allows me to easily run the version I want. But mongosniff didn’t worked right out the box for it. When starting mongosniff I got following error: mongosniff: error while loading shared libraries: libpcap.so.0.9: cannot open shared object file: No such file or directory.  So this mostly means that libpcap isn’t installed, but this wasn’t the case as you can see in a minute.

My first try was to install libpcap for my system but this didn’t solve the problem. A lookup with ldd showed that indeed libpcap.so.0.9 was missing for it:

       linux-vdso.so.1 =>  (0x00007fffa30d2000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x0000003ef0400000)
        libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x0000003655a00000)
        libpcap.so.0.9 => not found
        libm.so.6 => /lib64/libm.so.6 (0x0000003ef1000000)
        libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x0000003654600000)
        libc.so.6 => /lib64/libc.so.6 (0x0000003ef0000000)
        /lib64/ld-linux-x86-64.so.2 (0x0000003eefc00000)

A check if any libpcap module was available showed that a too new version was installed and that a symlink as libpcap.so.0.9 was missing:

ls /usr/lib64/libpcap*
/usr/lib64/libpcapnav.so        /usr/lib64/libpcapnav.so.0
/usr/lib64/libpcap.so.1         /usr/lib64/libpcapnav.so.0.0.0
/usr/lib64/libpcap.so.1.1.1     /usr/lib64/libpcap.so

So creating a symlink for libpcap.so.0.9 solved the startup problem: ln -s /usr/lib64/libpcap.so.1.1.1 /usr/lib64/libpcap.so.0.9. If you’re running a 32bit mongodb version you may check your /usr/lib to see if the required libpcap is missing. Don’t know if this problem still exists if you’re running mongodb from the offical repositoy.

Tags: none

Tags: 64bit, fedora 16, libpcap, mongosniff

Comments 1 Comment »

As I found out within the last days it isn’t that easy to find informations about how to connect Java through JDBC with a DB2 Database remotely. So if you should come into these troubles as well, take care of this:

As DB2 driver you need to use COM.ibm.db2.jdbc.net.DB2Driver which is located in the same file (db2java.zip) as the default driver(COM.ibm.db2.jdbc.app.DB2Driver) which is “promoted” on most sites. The problem with these two drivers is that they’re not able to work with the other kind of connection. So If you inserted the net driver you can’t create local connections and vice versa. If you want to be flexible you need to use as driver com.ibm.db2.jcc.DB2Driver which is capable to handle both types of connections. The driver can be found within the db2jcc.jar file, which should be located in the same place as db2java.zip. At least for me it was further needed to provide a license in order to establish a remote connection, to achieve this add a file called db2jcc_license_cu.jar or maybe some file which is similiar named to your Classpath.

Connection string: After some search I found the DB2 page where the remote connection string was described. The string has follow this scheme for remote connections:jdbc:db2://SERVERNAME:PORT/DATABASE Not sure if can leave the DATABASE and run later a Connect to DATABASE Query. At least my quick tries resulted each time with an Exception caused by wrong connection strings.
If you don’t know on which port your DB2 Instance is running take a look at your /etc/services and look for the corresponding line

Now you should be ready to successfully open a remote Connection.

Tags: none
Tags: DB2, Java, JDBC, remote Connection

Comments No Comments »

Just worked a bit with crontab to edit some no longer working cron job. But instead of typing crontab -e I had written crontab -r, without any warning or notice my crontab was dropped! What’s the logic behind that behaviour? Isn’t the normal, userfriendly way, that you have to confirm you want to drop something? All Programms I can remember want a confirmation for not saving data or dropping some file, or even for exiting.
I could life with the problem, if it wouldn’t be too likely to do the typo. But the keys are on a normal qwert(y|z) keyboard next to the other one, so a typo isn’t that unlikely. To avoid the problem I need to add the parameter -i to it, to be asked If I’m sure I want drop that crontab. Since when do I need to add additional parameter to have a higher “security” level? Normally you need to add parameters to avoid such behaviour not to initialize it.
But as I just see my crontab version is even the userfriendly one(on Debian 5 amd64), which offers such a parameter -i. The standard BSD(as on Debian 4 x86) one hasn’t this parameter nor does -r ask the user to confirm the operation.
Anyone knows why it behaves that way, I mean a multiliner crontab isn’t too nice to be lost by accident?

Tags: none
Tags: amd64, bsd, crontab, debian, x86

Comments 1 Comment »

Recently I had to build a Joomla based website, the applied template was quite ok except the problem that the good looking HTML background was taken into account for the print page. Which is quite bad, a few searches later I got first useable results on adding a new Stylesheet with the media="print" attribute set. Unfortunately this only works if the user presses the print Button within his browser, it’s not working for the Joomla build-in print preparation. As the standard templates for Joomla seem to avoid that problem there needs to be a solution, finally I found that entry: Customizing Print Popup on docs.joomla.org which revealed the magic behind the problem. You need to add/modify the Component.php file within your template.

Hope this helps the one or other, and hopefully will pop over the retired solutions for Joomla earlier than 1.5.

Tags: none
Tags: customize, Joomla

Comments No Comments »

Somedays it’s really hard to come along with Linux, it’s apps and tools. Recently I’ve tried to use AuthMySQL for authentication within a certain webfolder. To reach this, many trails and even more errors were needed :( .

The first point was to configure the module correctly, which isn’t that easy, as no post tells which version of AuthMySQL is used nor that there are two of them out, additionally it seems that the module can handle at least partially both directives, but later more.
I’ve searched quickly for some resources about how to configure AuthMySQL, some of the commands worked other didn’t. After several tries with extensive watching the apache error.log I finally managed to get the authentication running, upto the point of the used Encryption. The first try was to use MD5, but sadly the module did not support that value, although somewhere was talked about it (later I encountered it was for the other module). No Problem there’s another MD5 Setting, let’s switch to that one (Crypt_MD5), now AuthMySQL was working, but didn’t accepted the login details. A google search later I discovered that Crypt_MD5 uses a default Salt of 12 signs (or so) to encrypt the passwords, but my password is encrypted with md5, so no way to get it working. After a few searches why md5 isn’t working with my version of the module I found that forum entry which revealed that there are two modules out, which offer Authentication through MySQL.
But as I already supposed Debian doesn’t offer a package for the other module or I didn’t find it, anyway I got to the website of the other module and downloaded it’s source code. A fast lookup on howto compile and install modules for apache showed that I need to run apxs. But for my debian install the application wasn’t installed, you need to get some apache-dev package to install apxs. A few minutes later I’ve got a matching package and installed it. Next problem: while compiling apxs throws an error 65536, but luckily I found soon an patch, in this blog entry a patch is supplied so that the module was successful compiled under my linux installation.
The needed renaming of the module directives was done quickly and finally I got the authentication through MySQL working.
Alltogether it took a few hours to get that simple job working, anyway I’ve increased my knowledge about Apache and Linux, which isn’t that bad :)
Maybe this post will help the one or other to solve his problems quicker, as it contains quite well condensed errors and their solution.
If you want to use AuthMySQL get this version as it supplies in my eyes the best functionality. The easiest way to differ both versions is that one requires underlines within the directives and the other one doesn’t (the one which is linked).

Tags: none
Tags: apache, apxs, authentication, authMySQL, error 65536

Comments 1 Comment »

I’ve seen in within my two years of JS progamming some weird things, about browser behaviour. But the one I’ve discovered yesterday tops them all. Some JS class uses in the Init function the document.createElement function. The Script is working fine built in within one Website even with IE. But when the Script is added to another Website, IE complaints that document.createElement isn’t supported by this Object. An alert directly before the call is executed shows:
function createElement() {
[native Code]
}

But it still doesn’t work in IE.
Someone ever encountered that problem? I’m currently missing a solutin except the try to manually create the HTML-Node.

Tags: none
Tags: document.createElement, IE, Js

Comments 2 Comments »

If you need to extract all mails from a single mbox file to seperate .eml files, take a look at this tool. I had recently the need to do so, and this tool was just perfect for it. It lets you choose which files to extract from mbox to .eml. In order to import a normal GNU/Linux (any *nix?) mbox into the tool, you need to set as file-ending .mbx. The Only restriction is that it can only handle western character sets, but not sure if that’s a big problem, aren’t most Emails still in latin?
To run the tool you need to have installed JavaRuntime 1.2 or higher

Tags: none
Tags: converter, eml, howto, mbox

Comments No Comments »

A few days ago I started to write since some time a Plugin for WordPress again, for a customer. As I read over on WordPress you shall declare the files as UTF-8, but I would have changed it myself as well. Now after some initial testings I encountered this Problem:

Warning: Cannot modify header information - headers already sent by (output started at /xampp/htdocs/blog/wp-content/plugins/phRelatedLinks.php:1) in /xampp/htdocs/blog/wp-includes/pluggable.php on line 776)

Ah yeah…some known Problem within the WordPress Universe and the PHP one as well, caused by the Problem that infront of the starting < ?php are some other signs. Now when WordPress wants to send the header Information of the Page the whitespace/sign was already sent, but the header needs to be the first part of the website which is sent…therefore PHP throws this error.
Unfortunally this wasn’t the case for my Problem. As I had no clue what it could be else I searched for some time, and anything I could find told it’s a problem with leading signs before < ?php. Luckily I found this Post with the same Problem, which solved it.

While saving my file with SciTE as UTF-8, SciTE added a Byte Order Mask to the file, which isn’t needed at all as UTF-8 doesn’t encounter differences between big-Endian & little-Endian. Anyway it’s now widely used to easily tell apart UTF-8 and ISO-8859. So if a file contains as starting Bytes: EF BB BF it’s (mostly) a UTF-8 formatted file. But as these Bytes aren’t displayed within SciTE at all, you can go crazy with it. To write a file without this optional BOM you need to select as Encoding UTF-8 Cookie within SciTE.

Now the real cause was found, and it wasn’t WordPress who tried to drive me crazy at all. A look within PHP revealed that PHP isn’t able to interpret these Bytes as mark for a following UTF-8 Encoding. The related Bug Post was closed as won’t fix for PHP 5/4, the correct behavior will be implemented with PHP 6+.

In the meantime I hope that not too many other people will encounter that Problem and if, they’re able to find the solution faster than me!

Tags: none
Tags: Byte Order Mask, PHP, UTF-8

Comments 3 Comments »

Since awhile now I’m working with Javascript. I have to say that it’s for sure not that hard to write cross-browser Source Code like it’s still with CSS. But some parts aren’t easy to get them working. A recent problem is indeed the image.onload. At first it’s obviously that you should register an onload EventListener, before you assign an Image, like this:

image.onload = function() { alert("let's do something in here!");};
image.src = "myURL";

As it’s quite possible that the other way around, the picture is already loaded before the EventListener is registered.
But Hey! That’s no reason to make this mistake a few times…Now after you solve that self-made problem you can run into the next one! Opera calls the onload Event, only if the Object is newly created or the Image loaded isn’t already cached. That’s the state of Opera 7.5, as I read several times on various sites, that this problem was fixed within Opera 8.x. But now it seems that this Problem is back with Opera 9.26+( or earlier…).
Unfortunately my Script needs to be noticed everytime a new Image is loaded, although it may already be cached. The only way I’m aware of getting what I want is to disable the Cache of Opera, through Opera’s settings or per HTTP Header. Ok another way would be a function which looks the whole time if the image is changing, but both aren’t that what I’m searching for. Someone know if it’s possible to get some real onload for Images, in Opera, without any of the previously mentioned “hacks”?
Or can Opera fix this problem? It’s working correctly in IE, why not in Opera?

Tags: none
Tags: IE, Javascript, opera, problem

Comments 2 Comments »

That’s maybe some common Error you’re receiving, when you’re new to find and the exec parameter. So I encountered the Problem as well.
After a short research within the man page of find the problem was found: ‘;‘ needs to be escaped with a Backslash ‘\‘. The look over to my commandline just showed that this was already the case. Now the internet was asked and most results just reveal the same thing: escape the ; with a Backslash.

Some hits later I found a german page where they told that it’s even required that the ‘\;‘ is separated from the previous commands with a space ‘ \;‘. So it’s not enough to write -exec command ‘{}\;‘ it needs to be -exec command ‘{} \;‘ . Well from my point of view some mistake which can be fast overseen, even more if you suppose that ‘{}\;‘ should work out nicely as it’s something which occurs often or everytime within the exec(at least these groups of signs).

Just something new learnt, and hopefully for a few people less headache.

Tags: none
Tags: -exec, find

Comments 3 Comments »

Bad Behavior has blocked 2049 access attempts in the last 7 days.