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  |  
Nested iterator 
Tuesday, December 27, 2005, 08:39 PM - Java
Struts with nested iterators

There are lots of examples on the internet concerning struts with the nested tag library. The following examples concenr less used ways of displaying nested data by using 100% struts compatible methods.

The data

The data to be displayed consists out of sets of data from which the main data is a single list of names, and the second set is a list of telephone numbers per name:

Jan: 123456789 122345678 122233344
John: 155522234 123354556 132311244

This data is to be displayed in such a way that it is readable to a user, in html. In this case: The name, with underneath the telephonenumbers:
jan
123456789
122345678
122233344

To be able to do this, the data will be organized in its own data storage class per name, after which this is data storage class is stored in a Collection.

The data storage class

Bean code

JSP code

Extra: multiple lists to be accessed

Suppose the data with the telephone numbers also has an address associated to it:
jan
123456789 home
122345678 office
122233344 mobile
And you want to display this data.
To do this, the data is all stored in the storage class, and the jsp is altered in the following way:


The changes to the storage class:

Conclusion
  |  permalink  |  
cannot create iterator for this collection 
Tuesday, December 27, 2005, 12:31 PM - Java
Symptom

In jsp with struts you are trying to iterate over a Collection, but the servlet does not recognize it as such.

Solution

Use a collection instead of the type you are using now. logic:iterate works over:
- Hashtable or other maps without accessing the nested elements.
- Collections: AbstractCollection, AbstractList, AbstractSet, ArrayList, HashSet, LinkedHashSet, LinkedList, TreeSet, Vector with access to the nested elements, so a Vector with Vectors stored within etc.

Sample code:

JAVA:

public ActionForward execute(..)
{
Vector test=new Vector();
Vector test2=new Vector();
test.add("test1");
test.add("test2");
test.add("test3");
test.add("test4");
test2.add(test);
test2.add(test);
request.setAttribute("test",test2);
return mapping.findForward("success");
}

JSP:
<logic:present name="test".
<logic:iterate id="myTest" name="test">
Element value: <bean:write name="myTest" /><br/>
<nested:root name="myTest">
<nested:iterate id="myTestInner" name="myTest">
Inner element value: <bean:write name="myTestInner" /><br/>
</nested:iterate>
</nested:root>
</logic:iterate>
</logic:present>
  |  permalink  |  related link  |  
Prism54 wireless card & openSuSE 10 
Saturday, December 24, 2005, 10:52 PM - SuSE
Symptom

SuSE 10 (or openSuSE 10) recognized the prism54 chipset card, or other prism based card without problems, but still will not work.
ifconfig ethX up gives a response in /var/log/messages:
prism54: request_firmware() failed
eth1: could not upload firmware

Solution

openSuSE does not provide the firmware from the CD set. Run the online update and add the firmware in the software selection overview. Now the firmware is present and the card can finish its initialisation.
  |  permalink  |  
Quote, double quote 
Thursday, December 22, 2005, 02:19 PM - SuSE
Symptom

The quote and the double quote do not show until you press <SPACE>

Solution

The keyboard settings of you SuSE system are in international. The pressing of the quote or double qoute followed by a character like the o will give you a certain internationally used character. Most users find this behaviour annoying. Solve it by using YaST2, hardware, keyboard settings and set the keyboard from intl to basic. Now the keyboard behaves normal again
  |  permalink  |  
Keyboard and mouse failure 
Thursday, December 22, 2005, 11:43 AM - SuSE
Symptom

Under openSuSE 10.0 the numeric keypad fails completely and the mouse fails on some widgets under KDE. The logfiles showed a missing modules.dep file and some other severe errors.
The system used is a 1.6Ghz Pentium 4 Dell dimension 4300.

Solution

Since this only has been observed after a system has been booted after install and after some sig 11 errors, the failure is most likely hardware-software interaction related, and is probably caused by the incorrect loading of some modules. The way out is to reboot the system. After that the errors are gone, and are not reproducable.
  |  permalink  |  
Eclipse editor acting weird after key combination 
Monday, December 19, 2005, 04:00 PM - Java
Symptom

You pressed a key combination concerning <SHIFT>,<CTRL> and <-, and now the eclipse v3.2 editor acts weird. No inserts of characters possible, however deletes of characters are possible. Also using the arrows controls the scrollbar for the up/down arrow and jumps words for the left/right arrow.

What is wrong

You hit a key combination which put you in a different editing mode, or you are straight in a bug. I have not been able to reproduce it yet.

Solution

The correct solution is to reset the editing mode with the menu:
windows->Navigation->Activate Editor <F12>
  |  permalink  |  
java.sql.SQLException: Can not issue data manipulation statements with executeQuery(). 
Thursday, December 8, 2005, 03:46 PM - Java, MySQL
Symptom

While using JDBC, you get the following exception:
java.sql.SQLException: Can not issue data manipulation statements with executeQuery()
The query you wrote has INSERT, UPDATE or DELETE in it.

Solution

The JDBC standard does not allow this. So alter your way of executing the PreparedStatement.
Execute this with execute() or executeUpdate() instead of the very general executeQuery.
ExecuteQuery is only for real queries returning only values, not doing any data manipulation at all.
  |  permalink  |  
Create filesystem in a file 
Wednesday, December 7, 2005, 11:08 PM - General applicable solutions, Linux
To create a filesystem in a file, first a file needs to be create at the size of the filesystem. This can be done with dd:
dd if=/dev/zero of=fileXYZ bs=1024 count=1024
The count can be made bigger to get a bigger file.
Use your favourite filesystem creator on this file, and you will have the filesystem in a file available for all to use.

Mounting the filesystem is done by:
mount fileXYZ /mnt -o loop
  |  permalink  |  related link  |  
User Mode Linux: Mount host filesystem 
Tuesday, December 6, 2005, 09:25 PM - Linux
From the help of the kernel config:
mount none /tmp/fromhost -t hostfs -o /tmp/umlshare
Do this from inside your running UML system.

Also see the related link for more information
  |  permalink  |  related link  |  
Host is not allowed to connect to this MySQL serverConnection 
Tuesday, December 6, 2005, 05:18 PM - MySQL
Symptom

A connection to the mysql server with a certain user/password combination fails with the error:
Host is not allowed to connect to this MySQL serverConnection

Solution

Alter the host column in the mysql database user table to the host on which it fails or to %. Restart mysql or reload the grant tables and the login should be possible.
  |  permalink  |  
Tomcat parse exception in web.xml 
Tuesday, December 6, 2005, 05:15 PM - Java
Symptom

In the logfiles of your tomcat you find the following error:
Parse error in application web.xml
java.lang.ClassNotFoundException: org.apache.catalina.Container

Solution

Apparently one of the jars you copied or linked to the tomcat/common/lib has caused a strange conflict. Remove the last added jar(s) and start tomcat again. Now tomcat starts again, except that your application still does not run.
The class/jar you copied should have been in tomcat/shared/lib. Copy or link the jar to that location, and the error will disappear, while the added jar should work.
  |  permalink  |  

Back Next