Tuesday, December 23, 2008

Tokyo Winter


Tokyo Winter, originally uploaded by I.S.B.M..

That's how Winter in Tokyo looks like. No snow, no ice, no trembling dogs near metro stations.

Saturday, October 04, 2008

OpenOffice.org 3 Release Candidate 2 on Mac OSX

Just installed OpenOffice.org Release Candidade 2 on my Mac, where I am running Leopard 10.5.5. I was really surprised when it starts just within 4.03 seconds! In compare to Microsoft Office 2008, it takes really a long time to make it start and open some document.

Check it out: http://porting.openoffice.org/mac/download/aqua-Intel.html

Friday, October 03, 2008

Proxy And Java Web Start

When running on client environent, Java Web Start is using JavaScript PAC file (proxy auto-config), completely ignoring system environment settings, for example, like "(protocol).nonProxyHosts" etc. In my case, users are not authorized to change their own default proxy settings and everybody are enforced to use some specific address.

The problem occurs, when you need something, like a different port for a web service that is running with SSL. In that case Proxy server will return an error, encouraging client to connect only through defined ports.

Here is a cure how to turn off proxy settings within Java Web Start, having no deal with the system configuration (including javaws.cfg):

ProxySelector.setDefault(new ProxySelector() {
@Override
public List<Proxy> select(URI uri) {
List<Proxy> proxyList = new ArrayList<Proxy>();
proxyList.add(Proxy.NO_PROXY);
return proxyList;
}

@Override
public void connectFailed(URI uri,
SocketAddress socketAddress,
IOException ioException) {
}
});

The object ProxySelector is a global object that is used by all the handlers. Now in this case it will return a default Proxy object that is DIRECT connection. It is equivalent to setting javaws.cfg.proxy.setting=NONE in javaws.cfg file.

Friday, September 26, 2008

Writing a Standalone Client For Secure Web Service

Today I was puzzled writing a standalone Java client (going to be Swing app) that "talks" to the remote server, which serves a secure Web Service. Looking around various blogs and other stuff, I made it. It even works as expected. :-) 

But I want now put it all together to make it very clear and up to date. The process is all undocumented properly and successfully allows everybody hit the wall with the forehead. Therefore, to avoid others had the same sad experience googling around for a half a day, soon I am going to make a end-to-end document with a screenshots and detail explanations.

Uugghhh... Now is Friday and 8:30PM. Maybe tomorrow...

Thursday, September 25, 2008

Writing a Secure Swing Client For a Web Service

Using NetBenans IDE, I've tried to write a Swing GUI client for a secure web service that I've made. While web-based servlet works great, Swing standalone application spits weird errors and won't even run. One of the interesting exceptions is:
javax.xml.ws.soap.SOAPFaultException: ERROR: No security header found in the message
...
The problem is that NetBeans is using "old" JAX-WS libraries instead using WSIT. Solution is to remove all the JAX-WS jar libraries that NetBeans added automatically, when created Web Service Client reference and replace them with the libraries from GlassFish application server.

To those, who need step-by-step instructions:
  1. In NetBeans IDE, right-click on the client project and select "Properties". "Project Properties" dialog appears.
  2. From the "Categories" tree at the left side of the dialog, select "Libraries" item.
  3. Remove all the JAX-WS libraries—do not worry, your project is completely broken anyways. :-)
  4. On the right side of the dialog, click on "Add JAR/Folder" button. "Add JAR/Folder" dialog appears.
  5. Browse to $GLASSFISH_HOME/lib folder (and subfolders) in order to select all the libraries, listed below.
  6. Click OK.
  7. Have fun. :-)
If everything else is correctly configured (e.g. your X509 and/or SSL cert's etc) then it should work now fine. Here a full list of the libraries you want to add (some of them are in lib/endorsed subfolder):
  • activation.jar
  • appserv-deployment-client.jar
  • appserv-launch.jar
  • appserv-admin.jar
  • appserv-ext.jar
  • appserv-rt.jar
  • javaee.jar (oh my...)
  • webservices-rt.jar
  • webservices-tools.jar
  • webservices-api.jar
It will eat you 34 megabytes of disk space and 40 megabytes when running. While it looks fat, still I am much more satisfied using Swing over Java Web Start (JNLP) rather than use web browser based DHTML pages (current buzzword for DHTML now is "Ajax"). Ajax UI "eats" much more memory actually. It is significant performance problem on the Enterprise, when terminal servers for lots of users are in use.

Sunday, September 21, 2008

16 Million Of Terabytes On a Laptop

Apple did great OS! Mac OSX supports 16 million of terabytes of virtual memory on... single small laptop! I am serious. Here is the evidence:


Awesome, isn't it? :-)

Thursday, August 07, 2008

Java Swing Balloon Tip

I am developing a GUIs with Java Swing. Awesome, everything fine. Now, today I needed something like tool-tip or balloon pop-up to show various messages. In particular, I find that there are no standard form validation framework, so I created one, ripping off ideas from Zope Formulator. And the validation trigger suppose to pop-up a balloon tip when something wrong and focus the widget. That's fine, validation works perfect, unless you need a balloon tip.

I found one "decent" balloon tip on https://balloontip.dev.java.net/ site. Here how it looks like in Windows with Metal L&F: (pic is taken from the site directly):

Well, it's OK. It's Windows and mostly everything looks ugly there even in Vista, so a combination of blue frame on bluish gray with a squarish hint might be OK for environment that lacks taste and design. But what about Mac? — yeah, I am snob-like a--hole here, sorry. OK, what about Gnome or KDE on Linux and/or Sun Solaris? Windows is not the only OS these days anymore. So here how the whole thing looks like in Mac:


Notice ugly corners and quite crappy close button, not mention that a close button does not fits into a balloon tip paradigm. Well, my double-advice to all Java developers who sticks on Windows platform (there are two messages in one):

People, PLEASE install Linux and/or Solaris to make sure you are NOT providing funny things!..


*sigh*

So and now this is how it should look like (took for me less than two hours to rework entire source code, throwing lots of things):


Now I am happy. :-)

P.S. And yes, it does not need a close button — just click on it...

Wednesday, July 23, 2008

Crippled Apple LaF for Java Swing

Recently I found very-very unpleasant thing with Apple Look & Feel for Swing on OSX. On JDesktopPane, to get all the internal frames getAllFrames() is called. Works fine everywhere except OSX: it does not returns iconified frames. The reason, because they are not JInternalFrame.JDesktopIcon instances as normally everybody else in the World does, but are apple.laf.CUIAquaInternalFramePane.Dock instead. WTF?.. At first, I wanted to abandon OSX LaF and use something else instead. But "Substance" release that works on Java 5 is hell buggy and still very ugly on the same Java 5. New Nimbus LaF is really cool, look great, works and feels awesome, but... looks like an alien in OSX reminding me all this GTK things with X11. Additionally, it does not run on Java 5 at all.

Why Java 5? Yes, it is old, but thanks to (inaudible) Apple, there is no Java 6 on Tiger that the whole thing should also run. In fact, Apple LaF is the best for Java 5, allows font anti-aliasing, behaves correctly as OSX app should and overall looks great, so I do not really want to abandon entire LaF either.

Thus ss a consequence, to get code working everywhere without tweaks and if/else uglyness to detect what platform it runs on, I had to implement my own window tracker.

* * *

Works fine, but still pisses developers off, when everybody have to have dozen workarounds or class extensions to fix here/there various "broken bones".

Apple wants to go Enterprise? Steve, which object of your body you use when you are thinking about Java versions interoperability (an enterprise industry standard, no matter somebody wants to accept it or not) between OSX versions? So what should I do if I have heterogeneous environment with various Macs and PCs and want to go with less old stuff (soon we will have Java 7, while Apple is enforcing me to use Java 4 or even 4)?.. Right: throw macs away from the Enterprise, because they are not compatible between each other, install PCs and bite yourself for other things they brings to you... But to get rid of most advanced desktop OSX workstations is what I definitely do NOT want to do either.

Very stupid.

Saturday, July 05, 2008

HDR Image

This is my very first HDR image:

Nothing really special, except that I found (once again) for buying cheap stuff is always equals to losing your money. In my case I bought a cheap tripod. As a result, HDR image is not really crisp and sharp, because camera slightly change position per each frame. :-(

Sunday, June 22, 2008

Screenshots Series

Few funny (or not) screenshots I took recently.

First one — Sun Solaris 10 installation. I did not noticed it much before, but that's how bad design of UI installers done. The question is: why do I need to see huge Solaris logo twice and who needs to read stupid useless incomplete Help hint that says for to go to next screen I have have to click on button "next"? Who need this screen and why there are no any functionality on it? They could use this amount of space to do something actually useful: agree to licence or start selecting components etc. No, instead you see this:

You think it is only this one screen? No. If you go through entire Solaris installation (that is unable to complete on my hardware, unfortunately) you will see lots of things like this everywhere. Instead, OpenSolaris looks indeed very promising and actually cool. Some people have complains for packaging, but that's other topic. :-)

The next one is on Dell website. Not much comment for this new Linux logo on the left side:



The third one is from apple.com and is interesting. On the site with series of video-based "howto" is a title: "Find out how". While watching a movie, I captured this frame that shows interesting combination. The only question is: find out how what... If the context is "how to configure XRaid with XServer and find why it always does not works properly", then the answer is probably just in front of you on the cover-flow... :-)

L337 h4x0r spam

I've JUST created new mailbox... And it already got L337 amount of spam crap... :-(

Beautifully Engineered Opera 9.5

I wisited opera.com for an update for Opera browser that likely "won" Acid 3 test from Safari. The website says:

beautifully engineered
Discover the new standard in Web browsing. Download Opera today to get the fastest and most powerful Web browser available and make the most of your time online.

However, after removing fugly opera's default "Macintosh native" skin and replacing it with something that actually tries to resemble Cocoa, the real beauty looks like this:


I understand it is still better than recently released Firefox 3. But... yet, Opera, you need to try harder... Me? I am just fine with WebKit (Safari) on Mac that is fastest and gets 100/100 with no any problems (grin here).

P.S. The "winner" of Acid 3 was actually Opera 9.0 for some weird reasons...

Tuesday, June 10, 2008

Salute To Cisco VPN

I just ran find / -perm +00002 -ls > /tmp/world-write and among other crap I found this hilarious thing:

731350 0 drwxrwxrwx 13 root wheel
/etc/opt/cisco-vpnclient

3731351 0 drwxrwxrwx 49 root wheel
/etc/opt/cisco-vpnclient/Certificates


Great installation, Cisco!

*morons* :-(

Thursday, May 08, 2008

Plugins In Java

I wanted to implement plugin mechanism in my applications. But the thing is, that the plugins should could be also a standalone applications with main() static function inside. This is not very that difficult in principle, just have nice way to do that. Another thing I really want to have, is a call-back mechanism that can get all the arbitrary things, implemented in the parent application. They can be a printing and reporting stuff, authentication, authorization and so on. Finally, I want to have some shared space, where all the plugins can store their arbitrary data and interoperate between each other. What I really do not want to have is a typical bloatware, built on top of some fat framework that does lots of workarounds for specific needs. The thing should be as simple as possible. 

But the challenge is, that if it would be a, let's say, Groovy or Python, then it is pretty easy to implement is: just pass a class instance. Since it is all dynamic — stuff just works. However, Java is a static language that has lots of goodness over dynamic languages, but also this is the place, where ugly shapes appears too.

I am not sure I got it completely right, but at least I could shrink entire http://jpf.sourceforge.net just up to few methods and thus throw away all the framework with no harm to the functionality.

Here above "Plugin Application" is a standalone application that is also a plugin and could be fully acquired by "Base Application". You can run your plugin app, but also you can get it's functionality in the "Base Application" by simply dropping entire JAR file into specified subfolder. That's all it is: just move the JAR and you're done.

Plugin Application has a file plugin.properties that is an XML (can not believe for the shame that there are no support for UTF-8 in plain-text properties!!!) and these props just simply describes what class is main to acquire and how. There also some additional information, like application title, some specific config paths and a menu icon to use. :-)

Base Application simply reads the folder with all the plugins that are subfolders with required libraries and properties file, finds a properties file, parses and registers the plugins. Then once user needs one, launcher actually loads it.

The most worse part of the whole story is a call-back mechanism. This should be a third external package, that is available for both main application and all the plugins. There are two things: an interface and dummy class that implements basically nothing. Real implementation is inside the main application that inherits that dummy class and implements the interface of the call-back. Base Application passes the type of the dummy class something like this:
Class paramType [] = {third.external.package.DummyCallback.class};
Class remoteObject = Class.forName("your.remote.object");
Method meth = remoteObject.getMethod("remoteMethod", paramType);
Above is how you prepare things. Now, call them, where RealCallback class is actually an instance of implemented call-back. In this example I create new one on the fly, but probably in your application it is commonly accessed field that has better constructor and does some real things:
Object params [] = {new ReallCallback()};
meth.invoke(remoteObject.newInstance(), params);

That's it. Base Application has been found remote object, a method and invoked it. Now, on the other side of the whole chain, the following thing is done:

import third.external.package.DummyCallback;
public void remoteMethod(DummyCallback callback) {
callback.dosomething();
}

This is probably the whole idea that already works for me pretty fine.

Wednesday, May 07, 2008

NetBeans 6.1 on OSX

Decided to try NetBeans 6.1 Final.
Shortly: everything fine, except one very disturbing thing that makes entire IDE dead. Right after default installation, IDE runs fine. But I've decided to put all required extensions and after restart IDE refused to run, saying that some buggy Xalan version appeared in IDE's class path, sending me to the Wiki, where I've got very strange suggestion to cripple my entire JRE by removing a Xalan from there.

Since this problem appeared after modules installation, obviously, some module brought it to me in addition. Real "Bad Guy ©" appeared in my ~/.netbeans/6.1/ext/ directory. After removing it away, everything runs fine. But ugly crap remains: after this one removed, IDE's class path overall still contains few xalan.jar files, that are just different versions.

No idea where it belonged to, but was too lazy to figure out. :-)

Thursday, May 01, 2008

Hacker Key

We do all remember Geek Code, that is somewhat now not updated for a long time. More neat toy for geeks appeared: a Hacker Key that looks kinda interesting. You can take a walk through generator of the Hacker Key or decrypt someone's.

Here is my hacker key:
v4sw7JUYhw4ln3pr7AOck4ma3u7BLMNOSw2m7l5ADEFRUVi63Ce4t3b4Len9a3Xs0r5g3

Thursday, April 17, 2008

IBM now loves Macs

Interesting point: IBM is now researching what user impact while migrating to Macs:

A summary of the pilot program, detailed in a IBM document obtained by RoughlyDrafted, revealed that IBM is actively working to move away from its dependence upon Microsoft Windows and toward a heterogeneous cross-platform future.

Wait a second. IBM makes their laptops no more, right? So do not really cares about their future. Personally I am not very sure this move will bring value in a physical items, but this move from IBM, as a father of all PCs is very clear symbolic/spiritual/political/charismatic/call-it-whatever sign to others sign to which way corporate standard shall go.

That's pretty much it: no more IBM Lenovo laptops as corportate de-facto standard.


Wednesday, April 09, 2008

Safari 3 passes Acid 3 test

Safari 3 passes Acid 3 test. Despite of Opera "won" it faster getting all bits of the test, still it is available only in 9.0 version and still performs more poorly than Safari WebKit. Here I updated the engine of the browser. That's pretty it on a screenshot, nothing else to add:


Safari rulez! :-P

The real life still is quite different: MSIE still keeps huge market-share and it still can squeeze only ~17% of the test. Firefox still quite far from the ideal status too. So let's forget about really good AJAX applications and back to the reality... or... Java WebStart?..

Sunday, April 06, 2008

How To Modify Classpath At Runtime?

I am designing a quite large system that one of the user interfaces is based on Java Swing GUI library. Each subsystem is a standalone application itself that can be used separately if appropriate conditions issued, however they also are plugins within the central UI infrastructure.

If application is standalone, authentication is its own and other applications are not visible. If application is connected as a plugin within the infrastructure, then common authentication mechanism is used and tight integration with other applications appears.

Whatever, during some investigations, I needed to modify my $CLASSPATH at JVM runtime. For curious people how it is done, here is a source below. Enjoy:


import java.io.File;
import java.io.IOException;
import java.lang.reflect.Method;
import java.net.URL;
import java.net.URLClassLoader;


public class ClassPathModificator {
private static final Class[] urlParams =
new Class[]{URL.class};
public static void appendPath(URL newURL) throws
IOException {
URLClassLoader classLoader = (URLClassLoader)
ClassLoader.getSystemClassLoader();
try {
Method meth = URLClassLoader.class.
getDeclaredMethod("addURL", urlParams);
meth.setAccessible(true);
meth.invoke(classLoader, new Object []
{newURL});
} catch (Throwable err) {
throw new IOException();
}
}

public static void appendPath(String newPath)
throws IOException {
appendPath(new File(newPath));
}

public static void appendPath(File fileObj)
throws IOException {
appendPath(fileObj.toURL());
}
}



P.S. Extremely stupid Blogger's interface does not allows me to make it nicer, so I had to give up colorize the code and had to wrap it that ugly... :-(

Saturday, March 29, 2008

AsiaBSDCon 2008

Asia BSD Conference 2008
Today, in 水道橋グラヌドホテル (Suidobashi Grand Hotel) was a third day of Asia BSD Conference, 2008. It was full of interesting geeks that came to Tokyo from different places of the Earth. They has been amazed by japanese culture, food, quality and please.

This is the entrance to the conference (no alcohol, sorry):


This is the real entrance (alcohol and girls included), after the conference:



There was not so many people, as I could expect, because Japan still mostly bound to Microsoft Windows. Linux and Sun Solaris is only a server-side and Apple Mac only recently got a huge boost in market thanks to well-designed MS Vista that can not even handle properly a 4GB RAM. Thus Mac here getting up to 65% of sales vs 2.5% of Microsoft Vista. The rest is fast and reliable Windows XP that now, after MS Vista everybody started to love. Desperately.

OK, anyway with the Vista and other things. Here is FreeBSD conference!!! Yay!!!

Brief history
(Note: copied from very truthful source). The FreeLSD project was started at Berkeley Community College in Caledonia by a group of devil worshippers who built the first kernel by running the contents of the Necronomicon through a C compiler. The project was so named because of the FreeLSD tradition of giving free LSD to all contributors. However, after the threat of a lawsuit from a competing angel of death, Darl McBride, for stealing his hallucinations of grandeur, the project ceased the practice, and renamed to FreeBSD. Libraries and system tools were later adopted and integrated from other systems such as FreeTIBET, FreeMUMIA, and GNU/Windows.

Today, FreeBSD is continually being improved by contributors all over the world (and the underworld). Its source code is chanted at black masses and cross-burnings on every continent.

One of the very interesting part of the FreeBSD system is a UFS, the Unholy File System. It is the native file system of FreeBSD. The most prominent feature of UFS is called 'Soft-updates', which achieves high levels of file I/O performance at the application level by holding pending disk read/write operations up in a kernel buffer for weeks on end while the system solves fourth-order differential equations to figure out which operations can safely be performed first.

UFS is a replacement for FFS, or FAT File System, which was used in the earliest versions of FreeBSD. The former FFS was known as FAT8 File System, which was later copied by Microsoft and originated FAT16.

Conference and speakers As it is very common and usual in FreeBSD world, all technical part was in its the best traditions and spirit: strongly promoting FreeBSD OS, using all advanced recent BSD inventions and technologies, such as Mac OSX, Microsoft Power Point, sometimes Microsoft Windows, and rarely Ubuntu Linux.

On this conference was also accepted new logo for upcoming FreeBSD 8.0 release:


M. Warner Losh (photo below) presents Tracking FreeBSD in a Commercial Setting, using advanced presentation technology, such as Microsoft Power Point and Mac OSX Tiger 10.4.10 (not the very last update, BTW). He strongly believes, that if commercial organizations wishing to use FreeBSD in their products must be aware of this significant policy. And the policy itself supposed that each 3 years FreeBSD OS should be terminated and hardware disposed, replacing with more CPU, more RAM and totally new version of totally new OS release. Kind of cool: no matter what happened, you SHOULD kill you server after 3 years of use, even if version of multi-million Enterprise software supports only that version of OS.


Here Peter Losher (Internet Systems Consortium, Inc.) is using his totally FreeBSD hardware with manufacturer OS a presentation, that intended to be promote IPv4 bubble, bashing IPv6. No, sorry, maybe opposite... Anyway. His additional friendly statements was completely deny such internet services like BIND, SMTP, XMPP, XXX, PR0N. He also had a 15 minutes to scare people about firewall and security:


Once started his speech, Peter was surprised by advanced firewall security of upcoming experimental FreeBSD 9.0 Pre-Alpha, saying: "WTF?", which (I think) probably means "Web The Foundation!":



The rocket science guy, who actually never used PostgreSQL more than two tables and totally dislikes Trac, still creates his stunning presentation about how those two amazing products advanced technologies and environment, so how can they fit in Enterprise at all it's best:


Jörg Sönnënbërgër (left), an author of German version of ÜFß file system in NetBSD OS with his personal bodyguard Krištopz Dzonsonz (right) from Lathuinia, city of Riga-Vilniškės. He's hobby is to totally bastardize the only still left clean product on the market that is sane and simple by code and design: the NetBSD kernel, re-calling it with very innovative name: MULTIX. The idea is to copy the kernel multiple hundred times on one single machine and call them simultaneously, burning out CPUs and running out of the memory, as it successfully happened on the demo here. More about this fantastic project you can find here: http://mult.bsd.lv. Codename of the project is "Mooltixux Moolt Moolter". It is all written in the most innovative and clean, aspect-oriented language: Perl and some areas are written in Visual Basic for more visual low-level system support.


Other peaceful folks are trying to get used latest FreeBSD hardware, such as MacBook Air, MacBook Pro and the most free and competitive open-source software from GNU/Microsoft and Debian Symbian:




What else? Sakura! In Tokyo now Sakura everywhere. Almost like a winter in Kristop's Latvia, just bit wormer with the difference of just few 15-20 degrees:



Sunday, March 23, 2008

MacBook Air

New hardware at my home: meet MacBook Air.

I've got from postman neat plastic wrapped box. You can understand the dimensions of entire package how it looks like:

After I've removed cover of the package, notebook was just on top. Take it, power it on and just use. Packaging of Air is also very different from all previous Apple packaging. There are no more bulky boxes that is hard to dispose. This means that transportation of this sort of product will take less fuel and thus contamination to the environment. Here how it looks like:


Under the laptop all needed accessories: a short manual how to use the thing, two DVD with OSX and utilities, some cables and a power adapter that use 45W at its best:


Width and depth dimensions are the same as MacBook. This is not very surprising because MB Air has 13" display. However all of what MacBook Air is about, is a thickness and a weight. The device is really thin and lightweight. Imagine your laptop weights just nearly 1 kilogram and fits between your documents.


Thickness is really different. Here I put it on top of MacBook Pro machine and you can find that lid of the MacBook Pro is more thick than the base of MacBook Air:


Here how it is opened:



It is really thin:


Now, what can I say, especially after Lenovo X300 has been released. As usually, Apple hardware is beautiful and slick, unlike everything else. This machine is just different. Different in style, look and feel and approach to entire sub-notebook computing. It enforces you to get rid of cables and do everything through WiFi.

What you get with MacBook Air?
  • A decent keyboard. The keyboard just phenomenal. I did not see anything similar somewhere. You need to spend some time to feel the difference, but once you got it, you understand the meaning of the beauty.
  • Nice screen. LED. Slim. Bright. Crisp. Cool.
  • 1.8GHz Intel Core 2 Duo and 2M RAM.
  • Very slow HDD with only 4200 rpm. :-)
  • 1 USB (for your iPod or iPhone), 1 micro DVI to wow your customers with cool presentation and 1 headphone out to do not hear their feedback. :-)
Machine works fast enough as for its class. Never gets hot even on heavy software compilations. You can play 3D games. For fun I tried few, for example, Sauerbraten. It is brilliant there and works great. You can do your programming: C/C++, Java, Python... You can write your documents with iWork '08 or MS Office 2008. Remote CD/DVD solves all the problems with installations. The rest you take to or put from the network storage you probably already have for backups. :-)

Sunday, March 09, 2008

Home Theater and PLC Adaptor

Previously, half a year ago, I've built a home theater based on top of FreeVO MythTV. Few shell scripts does the rest: movies pre-buffering from the storage, managing music etc. Hardware is relatively small and very silent while works. Power consumption takes 50W at its best, but usually 45W. I have two machines like this, another just has twice more memory and twice better CPU (read: twice bigger power consumption). Here how the thing looks in all its glory (cover removed, as usual):


Now, the thing is to actually connect it to the network. First what comes to mind: WiFi on cheap PCMCIA card (I've got two of them free as a gift). After spending hours evenings to figure out why NDISWrapper turns the box from "not connected by WiFi mode" to "brick mode" issuing friendly Linux kernel panic, finally I've got a connection. My Linux installation was bit screwed up by several user-friendly kernel recompilations (thanks to its nice monolithic design) and some libraries updates, thus packages turned to be inconsistent. Well, at least it works... At all its best it was slow, bad and chunked, since WiFi router quite far from the TV installation.

I've decided to make it better and drop WiFi idea. But along with that, I hate cables to be visible across my apartments. So decision was made to go with PLC. Preference was given to Panasonic BL-PA100. This is a kit of two devices, where Panasonic already has prepared a starter kit (BL-PA100KT) for ease of installation. The kit includes two preconfigured BL-PA100 adaptors - one is used as the Master and the other as a Terminal adaptor.

The kit allows the average person to easily establish a secure network without using a PC. Simply plug in the Master adaptor into a power outlet and connect a broadband router/modem to the adaptor. Then plug in the Terminal adaptor to a wall outlet in another room where you want to access the network. PC and other network "clients," such as Panasonic IP network camera, can be connected to the Ethernet port of the Terminal adaptor.

Adding another Terminal adaptor is also simple. Plug a second Terminal adaptor, (sold individually), to the same power outlet as the Master and press the "Setup" buttons on both units simultaneously to register the Terminal. Once registered, the adaptor can be placed in power outlets anywhere in the house. Also, the clients can be connected to any Terminal adaptors in the house to communicate on the network. A total of 15 Terminal adaptors can be connected to the system.




Despite of the fact that HD-PLC Ethernet Adapter has a 190Mbps bandwidth, which is really enough to accommodate my needs, adding new Terminal adaptor will "eat" bandwidth too. The more adaptors you have, the less bandwidth you get. So the final solution of my LAN upgrade was adding more WiFi access points over apartments by combining PLC adaptor in Terminal mode with a WiFi router without NAT that works just like an access point. For the WiFi router I use La Fonera device, which is hackable by re-flashing it with OpenWRT firmware. Installing OpenWRT is simple and configuration is just trivial. La Fonera router is very small, can fit in your palm easily. Here is a picture of how two devices looks together:



So now my home theater works great and fast and also I have one more access point with 80-97% of signal available between near rooms.

More information about Panasonic BL-PA100 PLC Adaptor you can find here: http://panasonic.co.jp/pcc/products/en/plc/sp/lineup/index.html

If you want La Fonera for ridiculous price :-) get it here: http://www.fon.com/en/

Wednesday, February 20, 2008

Java Swing UI and MacOS X

I wrote an application using Swing UI library, but it does not fits to MacOS X by default. So here is a small tip how to bring main menu to MacOS. So, in your Java Swing application, if you need this:



...to be done like this:


...set com.apple.macos.useScreenMenuBar to true. It is possible to do as JVM parameter (-D is your friend), but better within the application somewhere at the beginning in the main() as follows:

System.setProperty("com.apple.macos.useScreenMenuBar","true");

This is one more step toward Apple MacOSX integreation. However, this is good for Java 1.3 and less. These days we use 1.5 or 1.6 developers preview. :-) It is quite sad that Apple Java releases takes a gap for about a year, but on the other hand Java on Mac really that stable and reliable. Well, anyway, here is the list of deprecated values system properties that were available in Java 1.3.1 but are likely trying to be no longer supported since Java 1.4.1. This is not very true due to they are supported in Java 1.6, though it is nice to get rid of them ASAP:

1. "com.apple.macos.use-file-dialog-packages" and "com.apple.macos.useScreenMenuBar" are replaced with "apple.laf.useScreenMenuBar".

2. "com.apple.macos.useSmallTabs" and "com.apple.macosx.AntiAliasedTextOn" are replaced with "apple.awt.textantialiasing".

3. "com.apple.mrj.application.growbox.intrudes" replaced with "apple.awt.showGrowBox".

Sunday, February 17, 2008

Bye-bye ReportLab

Recently I am having fun playing with my new toy: porting my Python project "OpenRML" to Java. Python's OpenRML is using ReportLab library as a PDF generator. Among it is relatively slow, also there are number of features I really missing. Also it is quite expensive by time to add third-party stuff. So I've decided to say "bye-bye" to ReportLab.
First thought was to re-implement stuff in Jython or Groovy, because these are dynamic languages. But then I've decided to go with plain Java to avoid troubles in a future.
In this project, will no more ReportLab's RML markup for documents for a number of reasons. In short: I want markup to be small, cute, flexible and extendable, unlike RML. I had implemented a reporting middle-ware in Aozora Bank and now I see why RML is quite clunky idea.
Now, the project is in very early stage, no any RPC server yet and data integration. But it already can produce something: rich text paragraphs, coloring, fancy tables, clickable table of contents, insert images from URL or file etc. 
Today I had implemented Japanese QRCode barcode. It is amazing data encoding, which is damage-resistant and can contain lots of data on quite small print-out size. We have plenty of them everywhere and we need them on a paper too. I also working on mobile application, which scans the code from a camera or any image and decodes it back to text.

Screenshot below shows what my current newly ported from Python library produces:



Tomorrow I am going to implement SVG support. :-)