« červenec 2005 »
PoÚtStČtSoNe
    
23
30
31
       
Today

Navigation

Speaker Profile
Roumen's Weblog
Login
Sun Bloggers
Technorati Profile

Am I popular?

Today's Page Hits: 1231

Contacts

Name: Roman Strobl
E-mail: roman dot strobl
at sun dot com

NetBeans

Java Sites

Javalobby
The Server Side
Java Tips
Java Blogs
java.net
java.sun.com
java.cz

Blogs

NetBeans:
Geertjan
Brian Leonard
Gregg Sporar
Lukas Hasik
Ludovic Champenois
Vincent Brabant
Alexis Moussine-Pouchkine
Jullion-Ceccarelli
Tom Ball
Tim Boudreau
Jesse Glick
Petr Blaha
Ruth Kusterer
Jara Uhrik
xzajo
Jan Lahoda
James Branam
nbextras.org

Sun:
Kazem - bug cartoons ;-)
Tor Norbye
Romain Guy
James Gosling
Chief Gaming Officer
Bill Vass
Jim Grisanzio
Jonathan Schwartz

Planets:
Planet Netbeans
Planet Sun
Planet Eclipse

Other:
netbeans-blog.org
Joel Spolsky
Bruce Eckel

License info

Creative Commons License
This work is licensed under a Creative Commons License.

Recent Entries

Map of visits

Locations of visitors to this page
« Previous day (Jul 4, 2005) | Main | Next day (Jul 5, 2005) »
20050705 Úterý červenec 05, 2005
Great Refactoring Support For OSS Projects

I've recently crossed a product called Refactor IT. They offer unlimited free usage on open source projects. There is a plug-in available for NetBeans.

Why am I blogging about it? Although many refactorings are being prepared for 4.2, people using 4.1 have only several refactorings in their disposal. Refactor IT might be a good solution if you are working on an OSS project or your employer is willing to buy the plug-in.

Screenshot of available refactorings + graph of dependencies:

Scripting Support in Mustang - An Example You Can Try

Well, it's 1:30 a.m. but feels like late afternoon. Time shift is a funny thing. I thought that if I can't sleep, I could try to play with the new scripting support in Mustang (JSR-223). Well, it's as simple as this:

Preparing JavaScript code (notice I am using java.lang.StringBuffer inside JavaScript - isn't that cool?):

        input.setText("var out = new java.lang.StringBuffer();\nfor (i=0; i<3; i++)\n   
                                    out.append('hello, world! ('+i+')\\n');");


Executing the code:

	ScriptEngineManager manager = new ScriptEngineManager();
	ScriptEngine jsengine = manager.getEngineByName("js");
        try {
            jsengine.eval(input.getText());
            String out = new String((StringBuffer)jsengine.get("out"));
            output.setText(out);
        } catch (javax.script.ScriptException e) {
            output.setText("ScriptException" + e);
        }

A screenshot:

Full source code is here. To execute, you need to install latest mustang build.

Well, if it's simple as this it may mean future Java code getting "polluted" by scripting code. Programming in scripting languages can be very productive for certain types of problems. Currently, Rhino JavaScript support is available by Sun as reference implementation and PHP support is being written, too. Any other languages may follow - the scripting framework enables any other languages to be plugged in. I really wonder what will be the impact of JSR 223 on web development...


    Disclaimer: The contents of my blog represent my personal opinions which may differ from official views of my employer, Sun Microsystems.