Java
JNA: Java Native Access
by nxt on Dec.09, 2007, under Java
If you use JNI to access native code you'll quickly find yourself writing some glue in c/c++ to access the native library. With JNA you can write nice clean code in Java without the need to glue your java code to the native library. This is all done by JNA.
All you need to do is define an interface that (extends the Library interface and) exposes the methods in the library that you want to access:
import com.sun.jna.*;
// kernel32.dll uses the __stdcall calling convention
// Most C libraries will just extend com.sun.jna.Library
public interface Kernel32 extends StdCallLibrary {
// Method declarations, constant and structure definitions go here
}
Next you load the library using the following code:
Kernel32 kernel32Instance = (Kernel32)
Native.loadLibrary("kernel32", Kernel32.class);
That's all there is to it, you can now access all methods you defined in the interface.
Checkout the project page
cross domain AJAX
by nxt on Nov.24, 2006, under Java
Using AJAX (which implies the use of the XMLHttpRequest) has one big
limitation, you can only make requests to the server from where the
page was downloaded.
As an alternative you can use javascript to dynamically include other javascript files which should be generated serverside.
An example on how to call the server:
function callServer() {
var head = document.getElementsByTagName("head").item(0);
var myTag = document.createElement("script");
myTag.setAttribute("type", "text/javascript");
myTag.setAttribute("src",
"http://example.com/application/getjs/?var1=value1");
head.appendChild(myTag);
}
The idea is that you generate the javascript that you need by dynamically add another script tag on the page.
for an excellent example of this approach you can read this javaworld article
Fuse 0.1
by nxt on Feb.10, 2006, under Java
Fuse 0.1 has been released
A brief overview of the features in this release:
* Multiple ResourceInjector instance support
* TypeLoader property support
* Global resource syntax
* SWT support
* Fully modular architecture (/Core, /Swing, and /SWT)
* Documentation (both javadoc and TypeLoader specific)
* A brand new build system and instructions on how to use it
Fuse, UI Oriented Resource Injection
by nxt on Feb.04, 2006, under Java
With Fuse you can easily inject data in your application at runtime by specifying them in a properties file,
for example using an background image
you used to do something like this:
class CustomComponent extends JComponent {
private Image background;
CustomComponent() {
try {
background = ImageIO.read(getClass()
.getResource("/resources/background.png"));
} catch (IOException e) { }
}
}
With fuse the code would look like this
class CustomComponent extends JComponent {
@InjectedResource
private Image background;
CustomComponent() {
ResourceInjector.get().inject(this);
}
}
Ofcourse you must load a properties file before calling inject using:
ResourceInjector rInjector=
ResourceInjector.get().load("/resources/fuse.theme");
For more information about Fuse see this entry in the Romain Guy's blog. or take a look at the project page
Java for C++
by nxt on Dec.02, 2005, under Java
If you ever tried to use JNI, you might find this utility usefull.
Java for C++ generates c++ wrappers for your java classes to make it easier to use communicate with a c++ application.
According to the freshmeat article, there are still some problems with multidimensional arrays and strings that contain binary data.
But it looks promising.
Fold n' drop
by nxt on Jul.21, 2005, under Java
I ran into a cool thing called fold n' drop while reading an entry on the Romanian guy's blog.
it allows you to fold all windows that you want to put away while dragging an item.
Text user interfaces
by nxt on Jul.10, 2005, under Java
I found a project called Charva.
Charva is a replacement for the javax.swing & java.awt packages
wich allows you to write applications for a terminal using an api
almost identical to the one you are used to.
JBoss & EJB3
by nxt on Jul.08, 2005, under Java
JBoss has released beta 1 of their implementation of the EJB 3 standard (for as far as the specification is finished)
or to quote Bill Burke "The
spec was a fast moving target the past few weeks, so we still need to
cross the T's and dot the i's as far as spec compliance goes".
superversion
by nxt on Jul.06, 2005, under Java
SuperVersion
is a multi-user distributed version control system based on change
sets, or at least that is wat it will be. It shares a lot of
functionality with subversion,
but even though it has already reached version 2.0 I'd recommend
sticking with subversion for the moment, but since it's very easy to
use / setup it could be usefull for projects with only one user.
I'm very intrested to see how the peer to peer (without the central server) scenario will work out in the future.
Archium
by nxt on Jul.05, 2005, under Java
There is a new release coming soon…
This will finally include an eclipse plugin to visualize the design
decisions and their dependencies at runtime. This should greatly
improve the process of debugging your applications.
For those who don't know what Archium
is, Archium is a new programming language which I worked on during my
traineeship at the university, for more information see the archium
website www.archium.net.
I personally think that one of the best features is that archium allows
you to change your application at runtime, allowing you to update your
software while it continues to run.