Problem installing PEAR 
Saturday, December 1, 2007, 04:34 PM - php
Issue:

You have a problem installing pear:
Installing PEAR environment: /usr/local/php5/lib/php/

Notice: unserialize(): Error at offset 255 of 987 bytes in phar://install-pear-nozlib.phar/PEAR/Config.php on line 1007

Fatal error: Call to undefined method PEAR_Error::getLayers() in phar://install-pear-nozlib.phar/index.php on line 66
make[1]: *** [install-pear-installer] Segmentation fault
make: *** [install-pear] Error 2

Solution:
Delete your pear.conf from where ever it is (usually /etc or your php $basedir/etc). It contains different data than expected by the installer, causing the installer to crash.

  |  permalink  |  
QMail delivers message many times after mailbox migration 
Saturday, December 1, 2007, 04:32 PM - General applicable solutions
Issue:
Qmail delivers message many times after migration from Plesk to vpopmail setup.

Solution:
Remove "|autoresponder" from .qmail configuration for the troubled user. The queue will than empty itself delivering the messages 1 last time.

  |  permalink  |  
Qmail bounces messages after mailbox migration 
Saturday, December 1, 2007, 04:31 PM - General applicable solutions
Issue:
Qmail bounces email after migration of some mailboxes (from Plesk to vpopmail setup).

The bounce mail from vpopmail:
Hi. This is the qmail-send program at xyz.com.
I'm afraid I wasn't able to deliver your message to the following addresses.
This is a permanent error; I've given up. Sorry it didn't work out.

<abc@xyz.com>:
This message is looping: it already has my Delivered-To line. (#5.4.6)

Solution:
You setting contains a forward which is not understood by the vpopmail setup of qmail. Replace the .qmail-default file content for this domain with:
| /home/vpopmail/bin/vdelivermail '' bounce-no-mailbox

  |  permalink  |  
Bea weblogic logrotate fails 
Saturday, December 1, 2007, 04:27 PM - Java
Issue:

The logrotate of Bea Weblogic does not seem to work, while in the rotated files directory created by the admin, files are created. The logfiles just keep growing untill the disk is full.

Solution:
The issue is that Bea weblogic wants an absolute path in the configuration for the logrotate, but appearently can live with a relative path when writing to the logfiles itself. Replace all the paths to the logfiles and also to the rotation location with absolute paths, and the problem should be solved. Restart admin server to verify it works.


  |  permalink  |  
Pop-up Greybox frame with Flash 
Saturday, July 7, 2007, 02:02 PM - General applicable solutions
Issue:
Greybox provides pop-up frames by altering the href with javascript code. The onclick gets defined.
When wanting to use the same code from Flash, there are some problems with the transparancy of the greybox code.

Solution:
To get the greybox pop-up working correctly, call the javascript from flash with the following function (from greybox examples.html file):
getUrl("javacript:GBFlashCall(caption,url,height,width)");

In which you can set the caption, url, height and width yourself.
Add a script link in the header of you html file after the greybox files, also add the GB_ROOT_DIR, else it will not work:
<script type="text/javascript">
var GB_ROOT_DIR = "./greybox/";
</script>

<script type="text/javascript" src="greybox/AJS.js"></script>
<script type="text/javascript" src="greybox/AJS_fx.js"></script>
<script type="text/javascript" src="greybox/gb_scripts.js"></script>
<script type="text/javascript" src="GBFlashCall.js"></script>
<link href="greybox/gb_styles.css" rel="stylesheet" type="text/css" media="all" />



Create the GBFlashCall.js file with the following content on the correct loction as defined in the <script> call:

GB_myShow = function(caption, url, /* optional */ height, width, callback_fn) {
var options = {
caption: caption,
center_win:true,
height: height || 500,
width: width || 500,
fullscreen: false,
show_loading: true,
callback_fn: callback_fn
}
var win = new GB_Window(options);
return win.show(url);
}

function GBFlashCall(caption, url, height, width) {
myShow(caption, url, height, width);
}

You can alter the true/false options to alter the behaviour of you pop-up, or you can move the options over to flash to get the same results.
  |  permalink  |  
Passing sql scripts to sqlplus with extra variables 
Monday, March 19, 2007, 03:32 PM - Oracle
Issue:
Using unix variables in an Oracle sql script with sqlplus.

Solution:
Use the following parameters to pass the sql to sqlplus:
$SQLDIR/sqlplus -silent $USER/$PASSWORD $SCRIPTNAME.sql PARAM

Important is the @ before the $SCRIPTNAME. The last parameter PARAM can be used in sqlplus with &INT where INT is the number of the parameter (in this case 1=> &1).
Also important is the SQL which you parse into sqlplus in this case: Put a quit on the last line to prevent sqlplus from not exiting in batchmode, for example if it is run from the cron deamon.


  |  permalink  |  
Oracle SQL Developer fails to update or delete a record 
Sunday, March 18, 2007, 07:44 PM - Oracle
Issue:
Oracle SQL Developer and other graphic userinterfaces use database properties to determine how to update or delete a row in a database. This can lead to mystery record locks which can not be traces.
No lock can be found in V$LOCK, no abnormal sessions can be found in V$SESSION.
Typical oracle where statement looks like:
WHERE ROWID = 'ABCDE+ABCDEFGHIJKL' AND ORA_ROWSCN = '123456'

Solution:
Type your own update statement instead of the SQL Developer generated one, and see if that works. If so, it is a problem with SQL Developer, else search on.

  |  permalink  |  
SET ECHO OFF but still SQL code visible in spool file 
Wednesday, March 7, 2007, 01:49 PM - Oracle
Issue

The SET ECHO OFF command in sqlplus does not produce the required result. In other words: You are still seeing SQL code in your logfiles or spoolfiles.

Solution

There is a sqlplus parameter which is also of influence. This parameter is: silent. If you call sqlplus with -silent, the SQL code will not show anymore.
  |  permalink  |  
Problem with &amp;amp; in Mambo and Joomla 
Sunday, January 21, 2007, 04:46 PM - php
Issue:

There is a possibitiy that at least the pathway module replaces an &amp; to many with &amp;amp;.

Solution:

The ampReplace function in the includes/mambo.php does not take single &amp; with spaces around it in account. To counter that, add a str_replace for this single &amp;:
function ...
$text = str_replace( '& ', '*--*', $text );
...
$text = str_replace( '*--*', '& ', $text );
...

Leading to the total function as displayed below:

/**
* Replaces &amp; with & for xhtml compliance
*
* Needed to handle unicode conflicts due to unicode conflicts
*/
function ampReplace( $text ) {
$text = str_replace( '& ', '*--*', $text );
$text = str_replace( '&#', '*-*', $text );
$text = str_replace( '&', '&amp;', $text );
$text = str_replace( '*-*', '&#', $text );
$text = str_replace( '*--*', '& ', $text );

return $text;
}

  |  permalink  |  
Exporting & printing bug in dia under SuSE 10 
Thursday, August 17, 2006, 09:21 PM - SuSE
The issue

Printing and exporting a diagram from dia 0.94 under SuSE 10 results in diagrams where some of the fonts are smaller than they should be.

The solution

This bug is a bug in dia 0.94. Update to dia 0.95 should do the trick to solve this problem.

Dia for windows (the 0.95 version tested) has some new issues with the font, causing diagrams to fall apart if you are nog carefull.
The simple solution there is, to save the file with dia 0.94 as uncompressed dia file. Edit that file with vi or notepad to change the font size of all 0.8 size fonts to 0.6, 1.0 to 0.8, and probably a bit more depending on your diagram. After that you can open the file in dia 0.95 with very little compatibility issues.

P.S. First preview your file in 0.95. It is possible that this is a Microsoft Windows issue.
  |  permalink  |  
Importing old e-mail from KMail into KMail 
Saturday, August 12, 2006, 06:01 PM - General applicable solutions
The issue

KMail has a range of options to insert old e-mail from other applications, but none for its own e-mail. This piece explains how to import KMail e-mails into KMail.

KMail is able to handle to mail storage types:
- maildir
- mbox
Maildir is the standard selection, and the one which is missed in the import filters of KMail.
The filter of KMail for some reason excludes its own e-mails from the import. This can be solved by renaming the e-mails to the same name but then with a .txt extention.

Rename script
This script renames the files to a .txt extention. Run this in your KMail maildir folder:

#!/bin/bash
files=$(ls -1)
for x in $files
do
mv $x $x.txt
done

The steps to import the e-mail:

The import functionalities can be found under tools, import messages. Since maildir are plain text messages, you want to use the import plain text e-mails option.
The next step is to select the folder where you stored the backup of your KMail. Every folder has 3 sub folders:
- cur
- new
- tmp
The last step is to press next.
The result is that the e-mails are loaded into the folder PLAIN-cur.


  |  permalink  |  
Slow USB devices under SuSE linux 
Friday, May 5, 2006, 03:03 PM - SuSE
USB devices tend to be extremely slow under SuSE 10 due to syncing the disk after every write. The USB driver can be told not to do this, resulting in a faster response from your USB devices.

According to /usr/share/doc/release-notes/RELEASE-NOTES.en.rtf you can mount hot plug devices without sync.

Create a file under /usr/share/hal/fdi/policy/20thirdparty with the name: 90-storage-nosync.fdi
Put the following contents in the file:

<?xml version="1.0" encoding="ISO-8859-1"?>
<deviceinfo version="0.2">
<device>
<!-- disable sync for mount -->
<match key="block.is_volume" bool="true">
<match key="volume.fsusage" string="filesystem">
<match key="@info.parent:storage.bus" string="usb">
<merge key="volume.policy.mount_option.sync" type="bool">false</merge>
</match>
</match>
</match>
</device>
</deviceinfo>

One reminder: The data will not be synchronized anymore, so umount before unplugging the device!
  |  permalink  |  
Duplex settings on sis900 
Wednesday, April 26, 2006, 02:10 PM - Linux
The sis900 ethernet controller is full GPL and in wide use. The issue was setting a media type on a 10Mbit network full duplex, where autonegotiation came back with half duplex.
By turning off the auto-negotiation, the duplex modes stays, else it will not be set.

To set full duplex, use the ethtool with the following settings:
ethtool -s eth0 speed 10 duplex full autoneg off

Querying the interface with ethtool eth0 gives:
Settings for eth0:
Supported ports: [ TP MII ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
Supports auto-negotiation: Yes
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
Advertised auto-negotiation: Yes
Speed: 10Mb/s
Duplex: Half
Port: MII
PHYAD: 1
Transceiver: internal
Auto-negotiation: on
Current message level: 0x000000c5 (197)
Link detected: yes


  |  permalink  |  
Hacking LaCie ethernet Disk mini to multiple samba shares 
Sunday, February 5, 2006, 07:31 PM - General applicable solutions
Introduction

The LaCie ethernet disk mini 300GB is a linux based device. The early versions of this device with firmware lower than firmware 2.0, are not capable of handling more than one share, which with a networked device is far from optimal. To be able to handle more than one share, this manual has been written. Lacie was also contacted by a Lacie user about this issue, and he also got a response saying that they were already addressing the issue in firmware 2.0. By downloading the firmware, you can add your shares the easy way. If you want to do more, you can use this article to know ahead what you will run into hacking your lacie drive.


Linux based, so what about GPL

Sources can be downloaded from the LaCie website. They use a kernel tailored to there own, and several applications, among which samba and busybox.

Where is the configuration stored

Lacie stores the configuration on the device its harddisk. This makes the task at hand a lot easier. To start with, the partitions can be backupped up easily so in case of trouble they can be restored.
The main system boots from the extended partition in the ethernet disk:
fdisk output:
/dev/hda5 82 Linux swap / Solaris
/dev/hda6 83 Linux // probably /boot, contains the kernel
/dev/hda7 83 Linux // busybox & other applications, also a /etc with basic settings, overridden by /dev/hda8
/dev/hda8 83 Linux // The settings the system uses

The changes

At this moment all what is needed is to edit /etc/samba/smb.conf to an acceptable multiple shares layout. It is handy when you already made the users by using the webinterface, so you only have to address the shares itself. The samba config directs to /home for the standard share. You could keep that for yourself, and add subdirectories in /home (once mounted) to use with samba.

How to apply the changes

Disassemble the ethernetdisk mini by unscrewing the two screws at the back (voids your 2 year warranty!!). Take out the disk and mount it in your pc running linux.
Make backups from /dev/hdX6,7 & 8 with dd.
Mount /dev/hdX8 and edit the smb.conf file to your liking.
Shutdown, reassemble the ethernet disk and start it.
Do not use ethernetdisk mini configurationtools anymore. They will overwrite your new config!

Just a handy change

Since you do not want to disassemble your PC and lacie every time you want to change something, it might be handy to included /dev/hda7 & 8 in your samba configuration file with special permissions. This way you can update the smaba configuration with a text editor and the new config will than be available after reboot.

Further research for adding more features

The CPU in the lacie is a Freescale MPC5200. Some programs need to be compiled for this CPU, based on powerPC architecture, see "Work to be done".

Work to be done

- Add telnet or ssh (preferred ssh), possibly by just downloading a powerPC distro (for example yellow dog linux), and copy the libraries & programs to the lacie.
- Discover what username/password storage is used to have the shared login
- Maybe update the userinterface.
- Maybe put a little bit of pressure on lacie to update their software to accomodate multiple shares, add telnet, and tell which processor architecture is used so nice additions can be made.
(Help is welcome, answers will be posted here ASAP)
  |  permalink  |  
javamail 501 HELO hostname 
Tuesday, January 17, 2006, 10:55 AM - Java
Symptom

The javamail implementation you are using, is giving the following exception:
javax.mail.SendFailedException: Sending failed;
nested exception is:
class javax.mail.MessagingException: 501 Syntax: HELO hostname

This error is slightly vague in origin, since java api descriptions fail to list most common exception causes. In this case it is the mail server responding on a single HELO command without a hostname. Since it wants to have a hostname, however fake it can be, it responds with 501 Syntax: HELO hostname. JavaMail just echos that response in the exception.

Solution

Send the hostname in the HELO command. Usually when you set up a common javamail, the InitialContext & session contain the necessary properties. Apperently the property mail.smtp.localhost is not set. To see the current properties, get the properties of the session: java.util.Properties props=session.getProperties(); and print them: System.out.println("my properties: "+props.toString());
You will see that the key mail.smtp.localhost is missing.
The correct solution to solve this, is to update the resource parameters of your mail/Session, for example in tomcat's server.xml:

<Resource name="mail/Session" auth="Container" type="javax.mail.Session"/>
<ResourceParams name="mail/Session">
<parameter>
<name>mail.hipersonik.com</name>
<value>localhost</value>
</parameter>
<parameter>
<name>mail.smtp.localhost</name>
<value>localhost</value>
</parameter>
</ResourceParams>

An alternative solution for when the previous solution is not available to you:
Add the key with the following code:
Properties props=session.getProperties();
String key= "mail.smtp.localhost";
String prop= props.getProperty(key);
if (prop== null) props.put(key, "localhost");
This way sending by using the localhost is possible. It also works for other hosts, so you can select any mailserver you want (as long as you are allowed to use it).


  |  permalink  |  related link  |  
if statement fails to compare two Integer objects 
Wednesday, January 11, 2006, 04:12 PM - Java
Symptom

While using java 1.5, the following is allowed:
Integer number1=1;
Integer number2=1;

if(number1==number2) System.out.println("number1 is number2");
else System.out.println("number1 is not number2");

This fails.

Solution

It is not allowed in the java standard to compare two objects. You are actually comparing the object identifiers instead of the object values. Use the intValue or the compareTo methods to do the correct comparisson.
  |  permalink  |  
Kill script 
Wednesday, January 4, 2006, 10:23 AM - Linux
Sometimes there are multiple jobs to be killed. This bash script is handy for that purpose:
TOBEKILLED=your unique identifying name of the program
for PROCESS in `ps aux | grep $TOBEKILLED | grep -v grep | awk '{print $2}'`
do
kill -9 $PROCESS
done
  |  permalink  |  
MessageResource problems with struts 
Saturday, December 31, 2005, 09:37 PM - Java
Symptom

There are several exceptions in the style of "key not found exception" while there are references to the message resource file in the struts-config.xml or web.xml from tomcat.

Solution

The advice is to use the struts-config file only setup and not to include the message resource as an init parameter in the web.xml file.
To include the message resource files put the following in the struts-config.xml:
<message-resources
null="false"
parameter="your.preferred.package.ApplicationResources" />
The file in this should be named: ApplicationResources.properties, or with the language extention to it: ApplicationResources_es.properties.
The resource file has to be included in your build by adjusting ant or any other tool you are using.

  |  permalink  |  
Memory expansion on asus A2500H 
Friday, December 30, 2005, 03:08 PM - General applicable solutions
The memory expansion of an asus notebook of the a2 series (a2500H) is not in the compartment on the bottom of the laptop which they mention in the manual. It is actually under the keyboard of the system. The compartment on the bottom contains a set of copper heatpipes and a passive CPU cooler. It is protected by a void warranty sticker on one of the screws.

So to avoid any problems with warranty:
To get to the correct compartment, take of the bezel above the keyboard by pushing it to the left, it it will not go easy! Break a nail or two, but it is possible. UPDATE: There is a small hole in the bezel, in which a pin can be pushed. By pushing in a pin, you unlock the bezel, and the removal will go easier!
Now you can lift the keyboard by shifting it up a few milimeter and than flip it over. In the middle is a compartment protected by a cover with two screws. Open the compartment, insert the memory and place the keyboard and bezel back at its location.


  |  permalink  |  
log4j and Digester exception 
Thursday, December 29, 2005, 04:30 PM - Java
Symptom

In the catalina.out logfile from tomcat there is an exception:
ERROR org.apache.commons.digester.Digester[main] - End event threw exception
java.lang.reflect.InvocationTargetException
etc....

For the rest everything works fine.

Solution

Copy the log4j jar file to the /WEB-INF/lib location and reboot tomcat. The error is gone.

  |  permalink  |  

Back Next