Archive for the 'Java' Category



Syntactic sugar and Java arrays.

Recently I got surprised by following case.
In Java you can declare an array in following valid ways:

String[] strings = new String[] { "foo", "bar" };
// the above is equivalent to the following:
String[] strings = { "foo", "bar" };

So following Java code is perfectly valid:

public class Foo {

public void doSomething(String[] arg) {}

[...]

This tutorial will guide you through installation of Apache, HTTPS, Subversion and Trac, in order to have an (almost) complete development environment for your team.
This article is divided in following steps
1. Installing Subversion
2. Installing Apache
3. Configuring Apache with SSL
4. Configuring Subversion with Apache (and SSL)
5. Installing Trac
You may choose for example to see how [...]

Today I got this error on OSX terminal doing a "svn import" of a project created with a maven archetype.
My svn configuration defines that when I commit Java or XML sources it automatically adds the property svn:eol-style=native (see: svn automatic properties). But the project created with maven is mixing different type of end of lines, [...]

Today I reinstalled my laptop with Ubuntu 9.04 (64bit version) and it runs like a charm.
Now I am reinstalling all the things I need for work, and of course eclipse with subclipse plugin.
Facing the usual problem with JavaHL, this time I wanted to fix it; because on OSX/Linux if you run different versions of command [...]

Java native compilation

Native compilation of Java code offers some advantages over distributing .jar files:

it cannot be easily decompiled/reversed/hacked
it doesn't require a JVM on the user's computer

it doesn't require a startup shell script
performances: some people believes that native code run faster; I'm a little bit skeptical about this point

On the other side, you loose on

cross platform portability
reusability: [...]

Found this nice thread on StackOverflow:
What is the best comment in source code you have ever encountered?
A fun read. I'm trying hard to keep myself to post some snippet; fortunately I've not enough reputation on StackOverflow to post answers

More on tracing network connections.

I've been writing about tracing http requests or other kind of connections, as this can be very helpful doing system integration work. And recently I discovered two other tools that I never used before.
The first one is netcat (also known as nc: if you are on a Unix box you can learn about it with [...]

Mocking JNDI

Testing components that use JNDI to get DataSources and other resources can be annoying, because (hopefully) you don't want to run your unit tests inside the application server. JNDI is a good example of how the ServiceLocator makes testing harder.
When you can't turn around the JNDI to get your resources and inject them into your [...]

Today I used commons-net to verify when an IP address is in a subnet specified in CIDR notation. So, I got a bug.
This code:
SubnetUtils utils = new SubnetUtils("77.24.0.0/16");
System.out.println("lower address: " + utils.getInfo().getLowAddress());
System.out.println("higher address: " + utils.getInfo().getHighAddress());
System.out.println("77.23.255.254 is in range? :" + utils.getInfo().isInRange( "77.23.255.254" ));

gives this output:

lower address: 77.24.0.1
higher address: 77.24.255.254
77.23.255.254 is in range? :true

Obviously the [...]

Fonts: OSX vs Linux.

Which one do you read best?
A.

B.

Don't read this until you've answered yourself:
˙xnuıl ɯoɹɟ sǝɯoɔ ǝldɯɐs puoɔǝs ǝɥʇ 'xso ɯoɹɟ uǝʞɐʇ sı ǝldɯɐs ʇsɹıɟ ǝɥʇ




About

You are currently browsing the NewInstance weblog archives for the 'Java' category.

Longer entries are truncated. Click the headline of an entry to read it in its entirety.

Calendar

March 2010
M T W T F S S
« Jan    
1234567
891011121314
15161718192021
22232425262728
293031  

Categories