Java encoding

For one of our projects I had to write a simple program, for importing items into our online store (watercoolshop.de). When I finished the coding everything seemed to run smooth, but only on Windows. Afterwards I tested the program on my linux box and it did not work.

After checking all files I found out that the encoding of the files was wrong for importing into our shop. With the help of google and some other sites the problem was solved. I had to use ISO-8859-1 for all files, because the core data is 8859.

To read a file I use the following code now:

BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream(),”ISO-8859-1″));

and to write:

Writer bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(fileName), “ISO-8859-1”));

I hope this will help someone who has a similar problem.

Thorsten

References:

java.ittoolbox.com

www.schoenitzer.de

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

Nokia N810 GPS fix solution

The Nokia N810 with its internal GPS is a device that should fit well for navigation purposes. Below you can see it running navit. In my opinion this is the best available navigation software for the N810. Navit is the main reason for me for wanting the GPS unit in the N810 to be reliable. Get the svn version from here: Gerrit’s Techie Stuff. Some hints on getting navit to run on the N810 can be found on wiki.navit-project.org.

N810 running Navit
N810 running Navit

Sadly the internal GPS unit of the N810 is known to be very problematic and occasionally hardly gets a fix. The suspect seems to be the gpsdriver. It writes i.e. the almanac data to /var/lib/gps/nvd_data. This file seems to be corrupt sometimes when the gpsdriver writes it. Probably the problem occurs when the GPS unit has no fix. The bug entry on this topic on bugs.maemo.org inspired me to write a small wrapper script for the gpsd that copies a backup to /var/lib/gps/nvd_data and watches the gps-daemon. When the GPS unit has a fix it creates a new backup copy of the nvd_data file for later use. Since I use the script, acquiring a GPS fix never took me more than five minutes anymore (without AGPS, with AGPS it is faster, of course).

If you also want to give my script a try, install bash via program manager and download my script from here: [download#23]

The most convenient way to get the script to the n810 and to perform the necessary changes is to log into the tablet using ssh. How to get ssh to run on your internet tablet is described here: internettabletblog

Log into your tablet using ssh and rename the original gpsd.

-sh-3.2# mv /usr/sbin/gpsd /usr/sbin/gpsd.orig

Then copy my script to the tablet (replace XXX.XXX.XXX.XXX with the ip of your tablet):

scp gpsd root@XXX.XXX.XXX.XXX:/usr/sbin/

Afterwards fix the permissions of the script on the tablet:

-sh-3.2# chmod a+rx /usr/sbin/gpsd

That’s all, now you should have a much better working GPS unit in your N810. Since I only have one device to test this on, please leave a comment if this also worked for you.

regards

Jürgen

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

util-vserver-0.30.216_pre2841 vserver startup fails

A while ago during regular upgrades my gentoo box serving as test environment for vservers updated to util-vserver-0.30.216_pre2841. Some weeks later, when I restarted the box I recognized that it could not start any vserver:

# vserver ubuntu start
vcontext: pivot_root(): Invalid argument

An error occured while executing the vserver startup sequence; when
there are no other messages, it is very likely that the init-script
(/etc/init.d/rc 3) failed.

Common causes are:
* /etc/rc.d/rc on Fedora Core 1 and RH9 fails always; the ‘apt-rpm’ build
method knows how to deal with this, but on existing installations,
appending ‘true’ to this file will help.

The box is running vserver-sources kernel 2.6.28-vs2.3.0.36.4-gentoo #2 SMP.

Since I did not find any useful information regarding his error in the web I tried downgrading to util-vserver-0.30.215-r3. For gentoo users this is accomplished by including

>sys-cluster/util-vserver-0.30.215-r3

in /etc/portage/package.mask. Afterwards everything reverted to normality.

If you also experience the “pivot_root(): Invalid argument” error, try downgrading util-vserver and hope for the best 😉

regards

Jürgen

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

siteinfo

Translator