P_W999

Inverted devilish random development


Leave a comment

Munin apache plugin: [LWP::UserAgent not found]

So, I was playing a bit with Munin and I wanted to monitor a simple Apache2 webserver. For some reason, the Apache stats did not show up even tough my configuration was 100% correct:
The plugins were enabled using:


ln -s /usr/share/munin/plugins/apache* /etc/munin/plugins/

The /etc/munin/plugin-conf.d/munin-node configuration file contained


[apache*]

env.ports 80

The Apache mod_status plugin was enabled and the ExtendedStatus property was set to On.
 

But still no graphs in Munin.

 

Running /etc/munin/plugins/apache_processes autconf should give you a clue: no (LWP::UserAgent not found) (it is supposed to say yes ;) )
The same error message shows up in the output of munin-node-configure –suggest


Plugin                   | Used | Suggestions

------
...
apache_accesses          | no   | [LWP::UserAgent not found]
apache_processes         | no   | [LWP::UserAgent not found]
apache_volume            | no   | [LWP::UserAgent not found]
...

 
I had no idea what this LWP::UserAgent thing was untill I searched outside the Munin context and found out it was a Perl library which you can install under Debian by invoking

sudo aptitude install libparse-http-useragent-perl

Ps: if you get no (apache server-status not found. check if mod_status is enabled) you may want to check out this blog-post:


Leave a comment

J-ExifTool v0.0.6

Today I’ve released version 0.0.6 of J-ExifTool. This release adds new functionalities and provides some bug fixes:

  • Copy tags from an existing image using JExifInfo#copyFrom(…) method
  • Perform date/time shift using JExifInfo#timeShift(…) method
  • Some minor bug fixes

Since release v0.0.5 you’ll need the Apache Commons Exec library in your classpath. I’ve added a new lib folder on BitBucket which includes this new library or you can download the new library from Apache.

The new jar can be downloaded from BitBucket.

For the record only: v0.0.6 is commit b313016.


Leave a comment

Batch rename and replace using Microsoft Powershell

Some people don’t like it, others do, but I create my webservice clients using a local copy of the WSDL definition which I create with Soap-UI. The downside of this method is that things get messy when the webservice becomes more and more complex:

The result of a complex Soap-UI export

Soap-UI export example

Last week I’ve reached a point where Windows wouldn’t allow me to place this export in our src folder so I had to come up with a solution:

  1. Don’t use local copy
  2. Rename all xsd’s

The first solution was a no-go since the webservice URL is secured and the maven plug-in doesn’t support this.
The second solution would not only involve renaming all files, but also replacing all references to these files.
So after messing around with some regular-expressions I wrote a simple PowerShell script which will rename _1_2_3_4_…_yy.xsd to _yy.xsd and the same regular expression will be applied to the content of all files.

Powershell batch rename and replace

Powershell batch rename and replace

Dir *.xsd |
Rename-Item -NewName { $_.name -replace "(_\d{1,2})*(_\d{1,2}\.xsd)","`$2" }
Get-ChildItem . -Recurse |
Where {$_ -IS [IO.FileInfo]} |
% {
	(Get-Content $_.FullName) |
	ForEach-Object { $_ -replace "(_\d{1,2})*(_\d{1,2}\.xsd)", "`$2" } |
	Set-Content $_.FullName
	Write-Host "Processed: " $_.FullName
}


Leave a comment

The fullselect specified for the materialized query table “SCHEMA.TABLE” is not valid

These are some common issues you can get while creating an MQT (Materialized Query Table) in DB2, especially when using a ‘REFRESH IMMEDIATE’ type of MQT.

Error: The fullselect specified for the materialized query table “PW999.PW999″ is not valid. Reason code = “6″.. SQLCODE=-20058, SQLSTATE=428EC

CREATE TABLE PW999.PW999 ( N_ID, D_DATUM, T_AAN, T_VAN, N_D1_IDF) AS (
	SELECT DISTINCT A.N_I_ID AS N_ID,
...

Cause: The query that causes this error has a distinct statement, these are not allowed in an MQT. Your query must be designed in such way that each returned row is unique.
 
 
 
 
Error: The fullselect specified for the materialized query table “PW999.PW999″ is not valid. Reason code = “7″.. SQLCODE=-20058, SQLSTATE=428EC,

CREATE TABLE PW999.PW999 ( IDF, DIRECTIE_IDF, AANVRAAG, REFERTE ) AS (
	SELECT A.IDF AS IDF,
		A.DIRECTIE_IDF AS DIRECTIE_IDF,
		TO_DATE(NULLIF(TRIM(D1.VALUE), ''), 'dd/mm/yyyy') AS AANVRAAG,
		D2.VALUE AS REFERTE
	FROM REQUEST A,
		REQUEST_DATA D1,
		REQUEST_DATA D2
		WHERE A.REQUEST_TYPE = 215
		AND (A.N_I_IDF = D1.REQUEST_IDF AND D1.REQUEST_FIELD_IDF = 36)
		AND (A.N_I_IDF = D2.REQUEST_IDF AND D2.REQUEST_FIELD_IDF = 41)
) DATA INITIALLY DEFERRED REFRESH IMMEDIATE MAINTAINED BY SYSTEM

Cause: if you have an IMMEDIATE REFRESH MQT then you must select the primary keys of all referenced tables. In the previous query I did not select the primary keys for D1 and D2. Without these primary keys DB2 can’t do its incremental updates.
 
 
 
 
Error: The fullselect specified for the materialized query table “PW999.PW999″ is not valid. Reason code = “10″.. SQLCODE=-20058, SQLSTATE=428EC

CREATE TABLE PW999.PW999 ( IDF, DIRECTIE_IDF, AANVRAAG, REFERTE ) AS (
	SELECT A.IDF AS IDF,
		A.DIRECTIE_IDF AS DIRECTIE_IDF,
		TO_DATE(NULLIF(TRIM(D1.VALUE), ''), 'dd/mm/yyyy') AS AANVRAAG,
		D2.VALUE AS REFERTE
	FROM REQUEST A
		LEFT JOIN REQUEST_DATA D1 ON
			(A.N_I_IDF = D1.REQUEST_IDF AND D1.REQUEST_FIELD_IDF = 36)
		LEFT JOIN REQUEST_DATA D2 ON
			(A.N_I_IDF = D2.REQUEST_IDF AND D2.REQUEST_FIELD_IDF = 41)
	WHERE A.REQUEST_TYPE = 215
) DATA INITIALLY DEFERRED REFRESH IMMEDIATE MAINTAINED BY SYSTEM

Cause: the explicit JOIN statement is not allowed, just must join using where clauses.
 
 
 
 
The correct way of creating the MQT:

CREATE TABLE PW999.PW999 (IDF, DIRECTIE_IDF, AANVRAAG, REFERTE, D1_IDF, D2_IDF) AS (
	SELECT A.IDF AS IDF,
		A.DIRECTIE_IDF AS DIRECTIE_IDF,
		TO_DATE(NULLIF(TRIM(D1.VALUE), ''), 'dd/mm/yyyy') AS AANVRAAG,
		D2.VALUE AS REFERTE,
		D1.IDF AS D1_IDF,
		D2.IDF AS D2_IDF
	FROM REQUEST A,
		REQUEST_DATA D1,
		REQUEST_DATA D2
		WHERE A.REQUEST_TYPE = 215
		AND (A.N_I_IDF = D1.REQUEST_IDF AND D1.REQUEST_FIELD_IDF = 36)
		AND (A.N_I_IDF = D2.REQUEST_IDF AND D2.REQUEST_FIELD_IDF = 41)
) DATA INITIALLY DEFERRED REFRESH IMMEDIATE MAINTAINED BY SYSTEM

And it’s correct because:

  • No JOIN statement
  • No DISTINCT statement
  • All primary keys are selected
  • All returned rows are unique


Leave a comment

Windows Backup 0×81000031 when using TrueCrypt

TrueCrypt can cause problems when your libraries are stored on a TrueCrypt encrypted partition. In my case, my System partition (C:) is fully encrypted and so is my Data partition (D:). My data partition is a System Favourite and is mounted during boot phase.

However, when running Windows Backup I get the following cryptic error message:

0x81000031 error in Windows Backup

0×81000031 error in Windows Backup

The Microsoft KB article gives a slight hint to what caused this problem, but it’s far from obvious.

If you look at the target locations for the back-up you see that the Data partition (D:) is missing. For some reason, Windows Backup has a different method for discovering partitions and this method can’t see the encrypted partition. As a result, my Libraries aren’t availble to Windows Backup.

Data partition missing

Data partition missing

If have no idea how to fix it so I moved my data back to the System partition… If anyone has a better solution, feel free to share ;)


Leave a comment

J-ExifTool v0.0.5

Today I’ve released version 0.0.5 of J-ExifTool. This release fixes a bug with GPS timestamps and includes several improvements.

Since this release you’ll need the Apache Commons Exec library in your classpath. I’ve added a new lib folder on BitBucket which includes this new library or you can download the new library from Apache.

The new jar can be downloaded from BitBucket.

For the record only: v0.0.5 is commit 43174e4.


Leave a comment

Windows Update cannot currently check for updates, because the service is not running (0xc800222)

Today I was yet again faced with the error “Windows Update cannot currently check for updates, because the service is not running. You may need to restart your computer”. This time however it was not due to all my services being disabled

Windows Update cannot currently check for updates, because the service is not running.

Windows Update cannot currently check for updates, because the service is not running.

Below is a small check-list if you face the same problem. Please do take the time to restart after each executed step, Windows Update does not always re-check all states, once it’s dead, it’s dead :( .

Check the services

Check that the following Windows Services are running and have the correct startup type, Windows Update will not work when the services have the wrong Startup-type:

  • Background Intelligent Transfer Service (BITS, Automatic (Delayed Start))
  • Windows Event Log (eventlog, Automatic)
  • Windows Update (wuauserv, Automatic (Delayed Start))

System Update Readiness Tool

As suggested on the Microsoft Technet fora, running the System Update Readiness Tool might resolve your problems, even tough I don’t understand how a Windows Update Standalone Installer could fix a broken Windows Update so you may be faced with the following error:

0xc800222

0xc800222

Run the system file checker

If at this point, Windows Update still doesn’t work you may have some corrupted files on your computer. Start an elevated command prompt and execute the System File Checker with sfc /scannow .

Delete that corrupted folder

If at this point it still doesn’t work then you can follow this guys advice: remove the corrupted C:\Windows\SoftwareDistribution folder. You may need to stop the Windows Update Service before deleting this folder (net stop wuauserv in an elevated command prompt ;) ).

Follow

Get every new post delivered to your Inbox.