Friday, May 9, 2008

Java and dot Net Integration with IKVM

A coworker of mine recently discovered a great Java and dot Net integration tool at IKVM.net. It is a customized JVM written in dot Net that provides a mechanism for dot Net to access Java code. I was skeptical at first, but have since been quite impressed with how well it works. We have a need for just such a tool on one of our current projects. As an interim solution we need to allow a dot Net application to access our Java framework. The distributed Java code uses RMI to communicate between modules. We provide a lightweight 'connector' that hides the communication layer and exposes public methods for the dot Net client. In the future we may provide web service style access and forgo the IKVM approach. But having done dot Net -> Java web services in the past I am not excited about doing it again.

Thursday, April 10, 2008

3000 Lines of Code a Day

I've been in a productive spell lately. Ok, maybe 3000 lines of code a day is an exaggeration. But I have definitely been on a roll. Usually I code small modules and test along the way. But since the project I've been working on is largely distributed that would have required too much additional work. So I coded the entire thing and now begin the testing. Somewhere along the way I picked up an uncanny ability to write large chunks of code and have them 'just work'. I believe it's because I build my checks into the code from the beginning .. Usually before I have written the significant bit of the code. My methods often begin with a series of sanity checks. If anything important fails the check, I throw an exception. This allows me to isolate most of the silly programming mistakes very quickly. It was a tough lesson to learn, but has saved me time and again.

Thursday, February 14, 2008

EVDO Makes the Grade

I've been an internet outcast for years. It's by choice, mostly. I choose to live in a rural area. But this choice has severely limited my internet connection options. The larger cities in Mississippi have been wired for broadband since about 1996, but folks in the sticks have been left completely out. Our choices have been dial-up (not even the 56k variety .. more like 33k), or satellite. I was a subscriber to DirecWay for a few years, but the service started out as bad and only got worse. Even when the service is working nominally, the inappropriately-named FAP (Fair Access Policy) keeps you from doing anything useful with the satellite connection. About a year back we ditched the satellite connection and turned on the data connection through our cell phone provider. The connection was much slower, but also much more reliable. And since the cell phone company does not impose any usage limits, the phone connection is actually a lot more useful than the satellite connection. But let's face it, GRPS is painfully slow. That's right, we don't even get EDGE in my area .. forget about UMTS!

When I recently found out that Alltel offers EVDO in my area, I jumped at the chance to try it out. I received a Franklin USB modem for my birthday and switched on the EVDO service. It's amazing! The ping times are relatively low, consistently less than 500ms (please understand, I'm used to seeing >1000ms pings with the satellite and >700ms pings with the cell phone service). The downstream speeds are good, between 600-700Kbps, while the upsream speeds are a usable 60-80Kbps. I've only had this service for a few days, but it looks like the real deal!

You may be thinking this review is unbalanced since my previous forms of internet connectivity have been so bad. So it's important to point out that the internet connection at my office is an 8Mbit cable connection. I know and appreciate what good internet is. And I'm certainly not saying the Alltel EVDO service competes with with that type of service. However, it is leaps and bounds better than any other form of service previously available. I've waited a long time for reasonable internet service in my area, but it looks like the wait is finally over.

Thursday, February 7, 2008

Java Plugins

I learned something pretty neat today. The team at my office is working on a medium-sized Java project and we have the need (desire really) to develop some components as plugins. One of the guys came across some example code to do just that (thanks to the folks at javaranch.com). After seeing the example we realized that Java has a handy utility built right in that handles plugins nicely. The ClassLoader class (sorry, I forgot the namespace and don't have a reference handy) makes quick work of plugins. And check out his friend UrlClassLoader to load code from any standard URL style resource. Stuff like this is why I like Java. I have developed plugins before in C++ and Linux. It was not this easy. So go ahead and make your code plugable. It's easy!

Sunday, February 3, 2008

Loving Linux Journal

I was at a book store last night and flipped through the latest copy of Linux Journal. I have always been impressed at the timeliness of the information inside the magazine. If you're a Linux user or developper, then you should check it out. If you're a Linux sysadmin, well then you already know how good it is.

Thursday, January 24, 2008

Why dot Net?

Someone asked me a while ago "what is dot net"? Typically I would just say "dot net is Microsoft's answer to Java", so I did. But it really got me thinking. Why did Microsoft go through all the time and effort to create this entirely new development framework? Well it probably got started with their custom Java JVM stuff back in the nineties. Sun said "you can't call that Java", so they called it c#. But why continue to pursue it? Sure, the MFC was old and ugly. But why not create a new native API? The big advantage of Java is its portability. It takes a performance hit to achieve that portability. So why would Microsoft opt for an interpretive environment but leave out the portability part? Maybe they didn't. There are a couple of possibilities here.

1) Microsoft intends to make an entirely new OS, like Apple did with OS X. And dot net is their compatability layer. When they deploy their new OS it will come with a dot net framework (as most OSes have Java frameworks now). This will ensure a large base of existing apps at launch time.

2) Microsoft intends to support other OSes. They could release dot net frameworks for Mac and Linux and add a whole new customer base.

Option 2 seems a lot less likely, since Microsoft has never liked playing nice with others. But I think option 1 has merit. I think Microsoft has found themselves in an unfamiliar position .. They are starting to see real competition. Apple is providing competition from a traditional business model and Linux is providing a very different kind of competition. I think it's Linux that Microsoft is scared of. Their typical model of sue-first doesn't work as well with open source software. Either way, I think Microsoft will actually have to innovate to maintain their dominant status. The Windows platform is hopelessly broken. And Microsoft's insistance on maintaining legacy compatibility has played a large part in that. I am anxious to see what someone with that much money and smarts can do when they turn their attention towards coding instead of litigation.

Database in a File

For the past few years I have been using the SQLite database on a variety of software projects. The more I use it the more uses I find for it. Perhaps the best use I have found is in creating binary file formats with my applications. SQLite gives me the benefits of using a binary file format (speed, size, a bit of opaqueness) without the fuss of creating and (more importantly) maintaining custom code. And since SQLite works as an embedded database there is nothing to setup in advance. This is a huge benefit! Recently I have started using the Java connector for SQLite. I write a lot of code in Java, so I was happy to see SQLite get a first class connector. They even include a pure Java version, so you can take advantage of SQLite files without having to deal with platform specific issues. For improved speed you can opt for the native version. It uses the JNI interface to perform all the file IO in C. The trade-off is you have to build and install the native C library for your target system.

Tuesday, January 22, 2008

Ubuntu for All

I am a long-time Linux user. Started back in the 0.99 days. That means I've used a lot of distros .. From slackware to fedora core and most things in between. In my nerdier days my favorite pick was gentoo. Now I am more interested in being productive. I have found ubuntu to be a great distro for getting work done. The ubuntu folks have paid great attention to detail. I love debian style package management. Apt-get is my friend. Ubuntu installs a good base system and most everything else I need is easily installed through the core repositories. I do have to add a source for grabbing the wine binary, but they provide good directions on their web site. And I usually install eclipse using the latest from their site, since the version in the ubuntu repository is typically stale. I like ubuntu so much I even run it on my servers. From firewalls to file servers .. It just works. They have the easiest LAMP setup I have seen. So hats off to the folks at ubuntu on a job well done.

Monday, January 21, 2008

Pearl of Wisdom

I bought a BlackBerry Pearl last month. Despite a few shortcomings I really like the phone. The keyboard works reasonably well, the screen is bright and pretty, it makes a decent music player, and it's a fine phone. Unfortunately it's useless as a modem for my Mac. RIM has some bug in the bluetooth stack that leaves it in a bad way after one connection. I would gladly use it via USB, but sadly that's not supported. My wife's Dash works great as a modem, so that's my crutch for now.

Making the Switch

Apple makes some great products. But there's a down side to all that ease-of-use; it makes you dumb. At least that's the effect it had on me. I remember spending hours (days even) tweaking all the details in Linux. After I bought my first Mac in 2003 all that slowed and eventually stopped. I never thought of myself as a conformist .. Quite the opposite. But I have conformed to Mac OS with little fuss. Of course having access to a UNIX prompt helps.

Is this thing on?

I've created this blog site using my blackberry, so watch out! I haven't hit any big snags yet but your mileage may vary.