Wednesday, October 19, 2005

[Debian] DBDesigner4 the libborqt problem

I am running debian unstable and after doing all the above, I still got

libborqt-6.9-qt2.3.so: cannot open shared object file: No such file or directory

Finally fixed everything when I got an rpm and converted it to deb with the program alien

libborqt-6.9.0-2.i386.rpm can be downloaded from :

http://sourceforge.net/project/showfiles.php?group_id=64092&package_id=68416

Convert to deb file with alien and then install it.

#> alien libborqt-6.9.0-2.i386.rpm
#> dpkg -i libborqt_6.9.0-3_i386.deb

Sarge does work with the libborqt_6.9.0-3_i386.deb from http://sourceforge.net/project/showfiles.php?group_id=64092&package_id=68416

The rpm seems to be working for Mandrakelinux 10.x too.

Same problem under Ubuntu 5.04 too. I downloaded libborqt_6.9.0-3_i386.deb from http://sourceforge.net/project/showfiles.php?group_id=64092&package_id=68416, installed, and it worked :)

On Debian unstable (sid), I had to install the following package and libborqt-6.9.0-2: http://packages.debian.org/unstable/libs/libstdc++2.10-glibc2.2

Download the package from the URL above and install it with dpkg.

Tuesday, October 04, 2005

[Debian] Firefox print issue

In Ubuntu, can easily install printer(network or local) and using cups to manage. The printer works fine(testing print without problem) but can not print in Firefox. Installing gtklp package can resolve this issue.

apt-get install gtklp

Then, in the firefox print popup window, click propertis, using "gtklp" instead of "lpr". Done.

[debian] Chinese font

A better font than the font installed default on Ubuntu 5.04
http://www.ubuntu.org.cn/support/documentation/zhfaq/verasansyuanti
First, download the VeraSansYuanTi font package; then extract to font directory, refresh font cache, backup old fonts.conf, cp new fonts.conf


tar -xzvf VeraSansYuanTi.tar.gz
 sudo mv VeraSansYuanTi /usr/share/fonts/
 sudo fc-cache -f
 sudo cp /etc/fonts/fonts.conf /etc/fonts/fonts.conf.old
 sudo cp /usr/share/fonts/VeraSansYuanTi/fonts.conf /etc/fonts/
Restart X.

Wednesday, September 28, 2005

[Debian] Ubuntu Chinese Setup

Install Ubuntu in English. The default locale is en_US.UTF8. And the 4 ttfarph fonts are installed by defalt also. What I need is input method only. Scim is a good choice.
A good tutorial can be found here: http://www.mrbass.org/linux/ubuntu/scim/
Below are quoted from that tutorial, I modified the code since I don't need Japaese and Korean IM:

Ubuntu 5.04 Hoary SCIM Chinese, Japanese, and Korean Input Guide
You can install CJK input via ubuntuaddon or do it via internet.
Ubuntu already comes with Chinese, Japanese and Korean fonts preinstalled.

To install via internet (universe repositories must be enabled)
sudo apt-get install scim-gtk2-immodule scim-chinese scim-tables-zh

Add SCIM to startup for X11
sudo touch /etc/X11/Xsession.d/74custom-scim_startup
sudo chmod 646 /etc/X11/Xsession.d/74custom-scim_startup
echo 'export XMODIFIERS="@im=SCIM"' >> /etc/X11/Xsession.d/74custom-scim_startup
echo 'export GTK_IM_MODULE="scim"' >> /etc/X11/Xsession.d/74custom-scim_startup
echo 'export XIM_PROGRAM="scim -d"' >> /etc/X11/Xsession.d/74custom-scim_startup
echo 'export QT_IM_MODULE="scim"' >> /etc/X11/Xsession.d/74custom-scim_startup
sudo chmod 644 /etc/X11/Xsession.d/74custom-scim_startup



Next two steps are OPTIONAL (scim KDE startup and input KDE apps while in GNOME)

If you installed kubuntu-desktop (KDE) and plan on logging into KDE session do this in terminal
sudo touch ~/.kde/Autostart/startscim
echo '"#!/bin/sh"' >> ~/.kde/Autostart/startscim
echo "scim -d" >> ~/.kde/Autostart/startscim
sudo chmod 745 ~/.kde/Autostart/startscim


While using GNOME:
you can input into GNOME, GTK apps but NOT KDE apps.

While using KDE you can input GNOME, GTK and KDE apps.
So if you want to also input in KDE apps while using GNOME do the following:
sudo touch ~/.gnome2/session-manual
echo "[Default]" >> ~/.gnome2/session-manual
echo "num_clients=1" >> ~/.gnome2/session-manual
echo "0,RestartStyleHint=3" >> ~/.gnome2/session-manual
echo "0,Priority=50" >> ~/.gnome2/session-manual
echo "0,RestartCommand=scim -d" >> ~/.gnome2/session-manual
echo "0,Program=scim" >> ~/.gnome2/session-manual


This will create two SCIM keyboards under GNOME though but allows you to input in KDE apps while in GNOME.

OpenOffice go to Options | Language Settings | Languages
- Default languages for documents
Asian choose Japanese,Chinese or Korean
- check Asian languages support to Enabled.

Close out of options first otherwise you won't see Asian Layout in the options menu.
Go to Options | Language Settings | Asian Layout
Kerning choose Western text and Asian punctuation
Character spacing choose Compress punctuation and Japanese Kana (if not using Chinese or Korean)
First and last characters choose Japanese,Chinese or Korean

Tuesday, August 23, 2005

MySQL database connector/J

To use JDBC to connect to MySQL, should do the following:

1. insatll connector(JDBC driver). On debian, there is a libmysql-java package, or we can download from Mysql.com. Then, the fast and dirty way is copy the mysql-connector-java-[version]-bin.jar file to the $JAVA_HOME/jre/lib/ext. After that, in Eclipse--> preference --> build path, we can see this jar file.

2. the following sample code should work fine:

import java.net.*;
import java.sql.*;
import java.awt.*;
import java.awt.event.*;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class HelloJdbc extends Frame{

Choice s;
Connection con;
Statement st;

public HelloJdbc(){
s = new Choice();
String url = "jdbc:mysql://localhost:3306/trilBlog";
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
con = DriverManager.getConnection(url,"username","password");
st = con.createStatement();
String SQL = "SELECT * FROM Users";
ResultSet rs = st.executeQuery(SQL);
while(rs.next()){
s.addItem(rs.getString(3));
}
}catch(Exception e){
System.out.println("hey, cannot connect to database");
}
add(s);
}
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Frame f = new HelloJdbc();
f.setSize(300,300);
f.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent evt){
System.exit(0);
}
});
f.show();
}
}

Friday, July 29, 2005

[Debian]install java1.5 on debian

A very straightforward tutorial written by Graham Smith and Hazel Rudge-Pickard. The following are quoted from
http://www.crazysquirrel.com/computing/debian/java.jspx


Quick Guide

If you are fairly confident and don't want to read the whole document the following summary should probably be enought to get java working on your system. Lines 1 and 3 are preformed as root line 2 as a standard user.

apt-get install java-package
fakeroot make-jpkg .bin
dpkg -i .deb

Step 1 - Get the SunJVM

You could go with other JVM's like Blackdown or Kaffe if you want. I am not saying they aren't worth looking at but if you are serious about developing with Java you basically have no choice but to go with the Sun JVM. They provide it for free (as long as you sign you life away) so you might as well use the best.

You can get the latest Sun JVM from here http://java.sun.com/
Step 2 - Install the Required Builder Package

Installing Java on Debian is not the simplest thing in the world but fortunatly there is a package that will do most of the work for you (assuming it works). That heaven sent package is java-pacakge which can be installed with:

apt-get -u install java-package

Make sure that your repository is fully upto date before installing this package or you might run into problems installing the latest JVM. You also need fakeroot if you don't have it.
Step 3 - Create the .deb Package File

You have to perform this step as a non-root user so I suggest using your own account. Create a temporary directory and copy the java .bin installer file into it. then run the command:

fakeroot make-jpkg jdk-1_5_0-linux-i586.bin

changing the name of the java .bin package if you need to. You may see a few warnings while the package is being created (and it takes some time to actually create it - about 2 minutes). If you see a message at the end saying the package was created then the warnings are not a problem. The message will probably look something like this:

The Debian package has been created in the current
directory. You can install the package as root (e.g.
dpkg -i sun-j2sdk1.5_1.5.0+update00_i386.deb).

Step 4 - Install the Java .deb Package

You need to be root to perform this step so swtich now. Then execute the following command:

dpkg -i sun-j2sdk1.5_1.5.0+update00_i386.deb

Of course you need to specify the correct package name if yours doesn't match mine. You can find out what the package name is from looking at the success message.
Step 5 - Check it Works

This should be the simplest step. Just execute the command:

java -version

as both root and another user to make sure everything is installed correctly. You should see output not a million miles different to that shown below.

java version "1.5.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)
Java HotSpot(TM) Client VM (build 1.5.0-b64, mixed mode, sharing)

Other Tasks
Removing the Java Packages

Should you ever want to remove any of the Java packages you have installed you can do that with a command like this:

apt-get remove sun-j2sdk1.5

which would remove the package installed above. If you can't remeber what packages you have installed try searching the apt-cache for the word sun e.g.

apt-cache search sun

that should turn up the package but will match quite a lot of others as well.
Running with Multiple JVMs

TODO: Stuff about update-alternatives
The Java Plugin

TODO: Stuff about the plugin
Resources
Dealing with Packages that Require JAVA_HOME

Unlike a lot of packages many (most) Java packages need to know where the Java VM is installed and they do this through use of an environment variable called JAVA_HOME. You can set this for each package or you can set this globally in "/etc/profile". Some packages, such as Tomcat, that are started by an init script will need to know where Java is installed in order to start at boot time. Since they don't run in a shell they don't read "/etc/profile".
Step 1 - Create a Virtual Java

This step is not mandatory but it will make life much easier in the long run. All versions of Java you install will be placed in /usr/lib with names like j2sdk1.5-sun. Create a symlink to one of these called java using the following command:

ln -s /usr/lib/j2sdk1.5-sun /usr/lib/java

Keep this link uptodate and pointing at which ever version of Java you want as the default. It would be nice if there was a package to do this. Sigh. Maybe there is - anyone know of one?
Step 2 - Adding the Environment Variable to /etc/profile

Once modified your profile file should have changed from something that looks a little like this

# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).

<...snip...>

export PATH

umask 022

to this

# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).

<...snip...>

export PATH

JAVA_HOME="/usr/lib/java"
export JAVA_HOME

umask 022

Step 3 Method 1 - Starting Applications Under KDE

This step is optional and only affects you if you want to start a Java application that requires the JAVA_HOME environment variable under KDE (I suspect this is also relevent for other desktops, such as Gnome, as well but I haven't checked). KDE doesn't execute /etc/profile when you log in and as such doesn't have set the JAVA_HOME varible. The best way I have found to run a Java application is therefore to create a little wrapper script such as this:

#!/bin/bash
JAVA_HOME="/usr/lib/java"
export JAVA_HOME

where is replaced with the application you want to start. Call this script something like start- and place it somewhere useful (on the path maybe).
Step 3 Method 2 - Starting Applications Under KDE

Starting applications under (x|k|g)dm is tricky because they do not read either the /etc/profile or your own .profile file when they log you in. Your environment will only get set up properly when you run a shell and even then the environment will only be shared with child processes.

A fairly simple solution to this problem that will work for all applications is to have .profile set up your environment (everything in .profile must be bourne shell compatible). In .bashrc set up bash specific, non-inheriting stuff (shell functions, aliases, bash options, etc) and in .bash_profile, call .profile and .bashrc.

To hook into the xsession startup, create a file called /etc/X11/Xsession.d/75local-profile that contains (you might need to lower the number on this file to get it to execute earlier on if you find things aren't getting set correctly - try 40 if this is the case):

#
# Source a users .profile, etc
#
PROFILES="/etc/profile $HOME/.profile /etc/xprofile $HOME/.xprofile"

for PROFILE in $PROFILES ; do
[ -f "$PROFILE" ] && . "$PROFILE"
done

This will load your environment before the desktop is started so the desktop and all child processes will have the environment you want. (.xprofile is included in case you want to set up anything specific to X but not for a console login)

Environment setup has to be bourne shell compatible because the the xsession scripts run under the bourne shell, not your normal user shell which is most likely bash.
Installing Netbeans

If you get the following error message when trying to install netbeans it is probably because you are at a terminal logged in as root but root doesn't currently have a graphical interface (X) running. Simply use a terminal of the currently local user.

The installer is unable to run in graphical mode. Try running
the installer with the -console or -silent flag.

Resources

* Debian FAQ about Java - This is quite long and focuses mostly on installing the free JVMs that are around. The instructions for installing the Sun VM are at best out of date.
* Installation insructions for Debian and Ubuntu - Similar to these instructions with a little more information in some places.
* Similar Instructions

Wednesday, July 06, 2005

[Debian] Sound on debian

ALSA Sound driver works fine. Initially, in all sound settings are set to mute. In Kmix, open everything. I installed RealPlayerGold10. Intallation process goes smoothly. However, there is no sound. found a posting on a forum, says realplayer only supports OSS sound protocol. I run the modprobe and found that OSS module has been installed. Then install alsa-oss package and then run realplay with oss as following:
$ apt-get install alsa-oss
$ oss realplay

Haha, sound comes back.

Tuesday, July 05, 2005

[ASP.NET] tutorials: how to create a IE tool bar like google, yahoo tool bar.

http://www.codeproject.com/csharp/dotnetbandobjects.asp

Thursday, June 16, 2005

[debian] Install kernel 2.6.11.12 with acpi on Debian Sarge

Just installed a Debian Sarge testing on my HP ze4500 laptop.
After at least 6 times compiling kernel, it works now, finally. Now the fan is running at a reasonalbe speed, quiter than before. And the laptop is cool as well. Eventhough there are still some issues need to be figured out, such as in KDE control center--> Power Management-->ACPI config, the options are gray.
But check the /proc/acpi folder, the status are ok.

I mainly rely on two HOW-TOs:
1. http://www.tldp.org/HOWTO/ACPI-HOWTO/
It's can be found in http://acpi.sourceforge.net/ homepage.
2. http://www.falkotimme.com/howtos/debian_kernel2.6_compile/
This one help me a lot with compiling kernel. But at the last time, I use a slight different parameter to compile kernel which I found in a disscussion board.

Follow the procedure in the ACPI HOW-TO:
1.load the old config file and select new features for ACPI. Learn two lessons fro 3 times failures. One is unselecting the useless DRM driver modules. The other one is selecting the EXT3 file system as built in, not module. I use EXT3 for / (bootable). The second issue relate to another issue I will talk about later.
2.Compile use "make-kpkg" command. At first, I keep getting "kernel panic: not syncing: can not find root fs..." error. One online article recommand the solution I decribe above, choose EXT3 as built in. In the compiling kernel how to, he suggests that create a initrd.img file. I check the kernel config file, the CRAMS is enabled. So I tried to use "mkinitrd" to create ram img file. But I only success once. After that, mkinitrd can not generate img file. I don't know why. Finally, I use "make-kpkg --initrd --append-to-version=.cannon kernel_image modules_image " command to compile kernel, and then "dpkg -i ....". It works for me. It will create initrd.img file and install it to /boot.

Thursday, April 14, 2005

[java] Design Patterns

A bunch of articles about patterns in J2EE aplication.

Thursday, March 24, 2005

[ASP.NET] N-tier Application Example

MSDN has an elegant sample application which demostrate the 3-tier application architecture.

Friday, February 25, 2005

[.NET] using XML in .net tutorial collection

using XML in .net tutorial collection
http://www.topxml.com/dotnet/

Thursday, February 17, 2005

[debian] install

Installing Debian Sarge on a Dell Poweredge SC240
In November 2004 we took delivery of two Dell Poweredge SC240 servers with SATA hard drives and single Xeon 2.8GHz processors intending to run them as X application servers to our office thin-client network.

Since we use Debian almost everywhere in the office I got the job of installing Debian Sarge - and it was a real balls-ache. If it helps anyone else to get around the same problems I shall document the short way through the process below. I've wasted two days messing around trying to get a working installation that has a kernel with support for the Xeon hyperthreading and the gory details of each wrong step, screaming frustration and hair-pulling will be omitted to protect the ears and morals of minors.
Step One

You probably want to have a Dell diagnostic partition on the hard drive. Ours is a single 102Gb SATA drive. Attach a monitor, mouse and keyboard to the server, then find the disk marked 'Dell OpenManage" that comes with the server and boot from it. Giggle at the fact that it's a kind of Knoppix disk running Linux (because that's what it boots into) and head for the 'System Tools' menu then select 'Create a Utility Partition'. This puts a Dell utilities partition on the hard drive which contains some diagnostics. They don't take up much room and it's probably churlish not to install them.

Once you've done that, eject the CD and file it somewhere then reboot with a Debian boot disk in the CD drive. I used the Sarge network install. These servers may have a reset button (I haven't found it yet) but pressing the power button for about six seconds forcibly powers them down and then you can press it again to restart the box.
Step Two - Installing Sarge

At the boot prompt for Sarge, type linux26 and press return. This boots the 2.6 kernel; I chose that after extensive trawling of Google suggested it's the way to go. Select your language and keyboard type and then the installer will start configuring your system. The number one problem I had was that the Sarge installer can't deal automatically with the SATA drive BUT - at this point you can switch to another console using Alt-F2 and get a shell prompt. At that point you can type modprobe ata_piix and load the driver needed to see the hard drive. Discovering that one point cost me half a day, sadly. Switch back to the installation terminal with Alt-F1 and proceed with a normal Debian installation.

I created a /boot, swap and root partitions using manual partitioning but you can do what you like.
Step Three - full configuration

When Debian tries to boot the kernel, it hangs every time the system references the hardware clock (another half day wasted tracking this down). You will install a new kernel later that doesn't suffer from this problem, but for the moment, when it hangs having muttered about the Real Time Clock Driver or Setting the System Clock type control-C and it will carry on. Eventually you get the the first configuration screen, which hangs. Switch to the second terminal with Alt-F2 and log in as root then run ps -auxw to find the process running hwclock. Kill that with signal 9 (e.g. kill -9 xxxxx where xxxxx is the PID of the hwclock process) and switch back using Alt-F1. Agree with the odd message and continue. After selecting your timezone another use of hwclock is done, causing another hang. Repeat the trick of killing it.

Yippee - now you should have a trouble-free normal install.
Step Four - Post-install configuration

The things that Sarge seems to get wrong here are the X configuration and figuring out what the network card is (the latter is bizarre, since it gets it right during the install!).

You will also find that the installed kernel has two issues. Its habit of hanging up when it talks the hardware clock is bad enough on booting (control C at least gets you out of that) but there is no remedy I know of when you try to reboot apart from a hardware reset which leaves you with an unclean shutdown. What's more, the Sarge kernel doesn't support hyperthreading which should get about another 30% out of the Xeon processor.

So, you need to install another kernel. I downloaded the 2.6.9 kernel from kernel.org and wasted A WHOLE DAY tring to make it work with hyperthreading and an initrd image. I'm forced to the conclusion that that can't be done. Non-SMP is fine, but if you try to use SMP and an initrd then it craps out with a kernel oops every time (except one rare success) failing at apparently different places arbitrarily. If you don't try to load the SCSI and SATA drivers (you need SCSI even if you are only using SATA) from an initrd image but build them in to the kernel, it all seems to work fine. To save you going crazy, here is my .configure script. Extract the kernel files from the tar archive, copy the configure script into the directory you just extracted everything into, rename the configure file to .config and then type 'make'. If all goes well you can then type


make modules_install
cp arch/i386/boot/bzImage /boot/vmlinuz-2.6.9MB-SMP
update-grub

and you should be ready to reboot into a fully working SMP kernel with hyperthreading support.

Two whole days went by discovering that all this was needed, but now it's done, our servers work. Sigh.

You will need, if your sytem is like mine, to know that you need the VESA graphics driver and the tg3 module for the network card.

Home

Monday, February 07, 2005

[ASP.NET] Differences between Response.Redirect and Server.Transfer

In a short, Server.Transfer method avoids the postback in Response.Redirect method.
http://msdn.microsoft.com/msdnmag/issues/0400/redir/default.aspx

Thursday, January 13, 2005

[.net] A good tutorial to implement user-role security

http://www.codeproject.com/aspnet/formsroleauth.asp