Saturday, May 22, 2010

How to connect an InputStream to an OutputStream

In the FTP Proxy product, one basic requirement is to intercept upstream authentication commands (USER and PASS commands sent from FTP client to FTP server), finish customized authentication and then let FTP client and FTP server work together with following tasks.

For upstream commands, the proxy has an inputstream from client and an output stream to server; for downstream commands, it has an inputstream from server and an inputstream to client. An easy way to deal with it is StreamConnector.

Don't mix up with similar solutions like Convert a Java OutputStream to an InputStream and Java utilities for stream wiring and file format detection.

Sunday, May 16, 2010

Totem Media Player error in Lucid Lynx 32-bit

Upgraded to Ubuntu 10.04 for a while and everything is fine. But I encountered an error when I tried to play a video today.
An error occurred
pa_stream_writable_size() failed: Connection terminated

I played the same video on Ubuntu 10.04 64-bit without any problem. Time to switch to 64, eh?

Saturday, May 08, 2010

Where is Sun Java?

Trust yourself should be 1st law in open source world.

I installed Ubuntu 10.04 and noticed Sun Java in not in default repository any more. I checked Ubuntu 10.04 LTS Release Notes and found

Sun Java moved to the Partner repository

For Ubuntu 10.04 LTS, the sun-java6 packages have been dropped from the Multiverse section of the Ubuntu archive. It is recommended that you use openjdk-6 instead.
If you can not switch from the proprietary Sun JDK/JRE to OpenJDK, you can install sun-java6 packages from the Canonical Partner Repository. You can configure your system to use this repository via command-line:
add-apt-repository "deb lucid partner"
Easy, but it's wrong. Here is how to enable partner's repository.
You can see the leftover of the wrong command. What a(nother) shame.