Archive for the ‘java’ Category

JavaOne 2008 online

Friday, May 30th, 2008

S-au publicat o parte din materialele prezentate la JavaOne:
http://developers.sun.com/learning/javaoneonline/j1online.jsp?track=coolstuff&yr=2008

JavaOne 2008 ( Java video si JavaFX)

Thursday, May 15th, 2008

Un alt clip de la JavaOne 2008 . In acest clip baietii de la Sun anunta ( finally!!!!!!!!!!!!!!!! ) ca vor incorpora un codec video in Java si in JavaFX . Este vorba de tehnologia On2. Le-a luat ceva timp pana s-au prins ca platforma Java are nevoie de suport si pe partea video. Mai bine mai tarziu decat niciodata. Un alt lucru intersant prezentat in clip este plugin-ul JavaFX pentru programele Adobe. Cu astfel de tooluri Java si JavaFX au ceva sanse in lupta cu Adobe and Microsoft.

JavaOne 2008

Wednesday, May 14th, 2008

In caz ca nu ati fost pe la JavaOne anul acesta aruncati un ochi peste clip-ul urmator.

JNode at FOSDEM

Saturday, February 23rd, 2008

If you are in Brussels Sunday (24.02.2008) you must go to Fosdem. It is a meeting of the Free Open Source Community. As Java is an open source software since last year you will find some very interesting sessions about Java and the community around Java. One of them is related to JNode. So if you want to see JNode in action visit Fosdem.

Check the schedule of the session.

JNode 0.2.6

Saturday, February 23rd, 2008

JNode 0.2.6 is out . This new release contains some nice features:

  • More progress with OpenJDK integration
  • improve of the shell
  • Read-only HFS+ file system
  • NFS2 read write support (This is my contribution on JNode OS)
  • Included Jetty6, Servlet and JSP support

For more details of the new features visit the change log page.

Sun forgot USB

Tuesday, February 12th, 2008

I think that Sun forgot USB.
How is it possible, these days when every gadget (camera, ipod etc) has an USB port, to be very hard to connect to an USB device from Java???
Yeah yeah, I know there’s a JSR for this problem, JSR 80. There are also some implementations of the JSR 80 (all are almost dead projects).
But my problem is: why SUN doesn’t include JSR 80 in the JDK specification???
The solution could be very simple: just take one implementation of the JSR 80 and put it in the JDK. Then the implementation will evolve naturally.

I hope I’ll see more support from OpenJDK in this problem.

Replace classes in JUnit tests

Monday, February 11th, 2008

Few days ago a friend of mine showed me a nice project: StubOut. When you have strong dependencies between 2 classes in your project it is a very hard process to test each class separately. In this case StubOut makes a great job, it allows you replace one class with a mock class during the the test or to replace just some of the methods with mock methods.

Example :

package test;
public class A {

private B b=new B();

public int sum(int t){
return b.getInt()+t;
}

}

package test;
public class B {

public int getInt(){
return 10;
}

}

And the test case will be like this:

import us.blanshard.stubout.Stubber;
import us.blanshard.stubout.StubbingTestCase;

public class ATest extends StubbingTestCase{

@Override
public void beforeReloading() {
Stubber.replaceClass(”test.B”,Mock.class);
}

public void testSum() {
A a=new A();
assertEquals(1, a.sum(1));
}
}

package test;

public class Mock{

public int getInt(){
return 0;
}

}

Nice !!

In theory if each component is decoupled by an interface you will not use this library . But in reality ……………. :)

Check the site of the project for more details

Java Web Browser

Friday, February 8th, 2008

If you want a pure Java web browser check this project: Lobo. Unlike The Flying Saucer Project, Lobo has support for HTML 4, Javascript and CSS2.

There are 2 things that I don’t like about it:

  • GPL license - if I want to use this library in a commercial project I’d better find another solution
  • why don’t these guys create a jnlp link to the browser? I don’t like to download code and to run it in command line.

Worf, verifica JConsola!

Wednesday, February 6th, 2008

Saptamana trecuta un client m-a rugat sa ii fac o analiza asupra consumului de memorie al aplicatziei la care lucram in cazul in care fisierele de intrare devin foarte mari (de ordinul zecilor de mega bytes).

Am cautat niste profilere free care sa se instaleze rapid fara prea multe trickuri dar din pacate nu prea am gasit. Apoi am incercat profiler-ul de la JBoss (aplicatzia rula pe un server de aplicatzii JBoss). Din pacate acest profiler m-a dezamagit rau de tot. Cu o interfatza total neintuitiva iar cand te prinzi care pe unde este te trezesti cu niste erori care te baga si mai rau in ceatza.

Apoi mi-am adus aminte de noile facilitatzi de monitorizare a masini virtuale (JVM) introduse in JDK 1.5. In JDK 1.5 baietzii de la SUN au introdus cateva MBean-uri (Managed Bean) pentru monitorizare si managementul JVM-ului. Ce este un MBean? Un MBean este un obiect Java care poate fi intrebat de sanatate. El expune o interfatza prin care o un alt obiect Java aflat in aceiasi masina virtuala sau in alta masina virtuala poate sa ii citeasca attributele, sa ii modifice atributele, sa ii apeleze metode sau sa fie notificat de catre MBean . Pentru mai multe detailli despre MBean-uri citeste aici.

MBean-urile pentru managementul si monitorizarea JVM-ului:

Aceste MBean-uri pot fi interogate cu orice client JMX (daca ai citit ce este un MBean stii ce este si un client JMX). Dar taticii de la SUN au creat un client JMX special pentru aceste MBeanuri: JConsole (sau pe romaneste JConsola :) ). Acest client vine cu orice JDK mai mare de 1.5. Deschidetzi o consola si tastazi ‘jconsole’(Asta in vazul cand executabilele din JDK se afla in PATH) si voila !.
Ca JConsole sa va poate accesa aplicatzia trebuie sa pornitzi JVM cu proprietatea com.sun.management.jmxremote activata.

JAVA_HOME/bin/java -Dcom.sun.management.jmxremote -jar test.jar

Pasii pentru monitorizare:

  1. Pornesti JVM-ul aplicatziei cu proprietatea com.sun.management.jmxremote activa.
  2. Pornesti JConsole . In momentul in care pornesti aplicatzia JConsole va detecta toate aplicatziile java care ruleaza local si va afisa o fereastra de dialog care iti permite sa selectatzi aplicatzia pe care o doresti sa o monitorizezi. Aplicatzia JConsole trebuie sa ruleze sub acelasi user sub care ruleza si aplicatzia target.

Aplicatzia JConsole poate sa ruleze si pe alta masina decat aplicatzia target . In cazul asta setarile sunt mai complicate.

screen11.png

Concluzie.
Aplicatzia JConsole nu este la fel de completa ca un profiler dar este perfecta pentru a afla cateva informatzii: cata memorie ocupa aplicatzia dv, deadlock-uri, ce thread-uri ruleaza la un moment dat, cate clase sunt incarcate in memorie etc. O alta deosebire este ca un profiler este mult mai invaziv in JVM decat acest soft de monitorizare. Un alt plus fatza de profiler este ca poate sa monitorizeze o aplicatzie in productzie (in cazul asta este recomandat ca aplicatzia JConsole sa ruleze pe alta masina).

Pentru mai multe detalii:
http://java.sun.com/j2se/1.5.0/docs/guide/management/agent.html

http://java.sun.com/developer/technicalArticles/J2SE/jconsole.html

Sau cautatzi JConsole pe google.com

My new toy: Linutop

Sunday, February 3rd, 2008

Yesterday I received from France my new toy: Linutop. It is a small computer running from an USB key. When I say small I mean very small: 9.3 x 2.7 x 15 cm. It doesn’t have a harddisk and it is power by an AMD Geode LX processor.

The installation kit



The entire OS is stored on the USB key. The kit came with an optimized version of Xubuntu LiveCD, the light brother of the Ubuntu. It comes with a few applications: Firefox for browsing, Gaim for instant messaging and AbiWord for office stuff.
The hardware configuration is:

  • Processor: AMD Geode LX700 (x86)
  • Memory: 256 M
  • 4x USB 2.0 ports
  • Network: 10/100baseT Ethernet
  • Weight: 280 gr

The only thing that I don’t like about it is that the flash player doesn’t play flash movies very smooth. So you can not use this pc to play Youtube movies. But for browsing, chatting and write emails it is perfect. You can even use it as a home small server.

One of the things that that I like about it is that it doesn’t have a hard disk . So bye-bye movement parts. I can put this box in my pocket, I can put in my bag without any worry of breaking something.

I hope this week I can run my favorite OS JNode on this nice piece of hardware. The only problem is that the Linutop boots only from the USB and the JNode OS doesn’t have a good support for USB, but it boots very nice from the network. So I must put on the USB key the PXELinux to be able to boot from network. I hope also that the memory is enough to run JNode.

So I’ll be busy this week :)