Feeds:
Posts
Comments

Archive for the ‘Technical’ Category

Software Requirements:
– Windows OS => WinXP, WinVista, Win7
– Eclipse v3.5
– JProfiler v5
– YourKit v8

Objective

A profiler is a very powerful tool to help pinpoint performance and memory issues. It offers a variety of ways to which a developer can help track down classes that lead to dismal performance, inefficiency and memory leak issues. This includes taking and comparing snapshot at certain point in time, watching how CPU time and memory is consumed in realtime in a visual chart and marking interested classes for analysis.
There are many profilers in the markets , both open-source (eg VisualVM that bundled with Java SDK) and commerical offerings. However, this document will show the steps to configure two of the best commerical Java profilers in the market, YourKit and JProfiler, to profile GWT client application in Eclipse in the Windows environment.
Even though both profilers are just as effective and powerful, both use different approach to profile the application.

Still, the following steps will work with any IDE (eg Intellij ) since it is just a matter of adding adding additional profiler’s agent as argument to the JVM. All IDEs allow argument to be passed to the JVM that run the project application.

Yourkit and JProfiler offer a 15 and 10 days evaluation trial respectively.

(more…)

Advertisements

Read Full Post »

Issue

Final variable is used to define constant value and reference, and can only define once. In most cases, declaring a final variable is just a matter of assigning to a primitive value or a object reference directly.  However, in some cases, declaring a final class/instance variable may be more involving especially it get assigned from method that throws Exception (eg API for database access, web access), or it may involve multiple statements. In such cases, the code may become cluttered with class helper method and dummy temporary variable that help define final variable, making the code look less elegant and harder to maintain. The following common ways of declaring a final variable in those situations might look familiar to many.

(more…)

Read Full Post »

Issues

I always thought that there is ought to be better way to develop JavaFX application, with kind of similar and gratifying experience as developing Java Swing application. Traditionally in developing desktop application, one normally develop and test using class file to save time, and only uses JAR file for deployment (or if running in mobile emulator or device). However with the advent of RIA platform, the trend is to use a application container file (eg jar, swf) as default way of development since it facilitates seamless running in several modes without hassle (eg as Applet, webstart, and mobile device). Unfortunately, this is rather inefficient if one is developing desktop application, or experimenting with ideas. Unnecessary waiting time only disrupts the creativity and programming flow. Saving a few seconds for every run will accumulate into significant saving of time. Besides, it is rather counter-productive to use container file as the only mode of development if the technology can support alternative efficient way.

(more…)

Read Full Post »

Important: This version is not the official release by the original author of NanoXML (http://nanoxml.cyberelf.be/). It appears that the development for NanoXML has ceased.

Issue in NanoXML

Back in 2008, a version of NanoXML v2.2.4 is “unofficial” released to add comment feature (Javalobby mirror). However, there is one problem that persists which prevent developers from using NanoXML to manipulate xml file. The developers might use xml file for to store profile for their application and will need to manage xml file (etc delete, rename, add). However, it turns out that NanoXML is locking the xml file while waiting for the Garbage Collector to kick in and release the file. However the GC is behaving unpredictably and might not release the file as and when the program expects it. The developers will thus want more control over the release of file resource. Unfortunately, there is currently no API to force release of file resource under current release.

NanoXML v2.2.5

Therefore, I have modified NanoXML and released it as  NanoXML v2.2.5 to allow developers to use a specific method to release file resource manually so that the file can be manipulated (etc delete, rename).

  • public void close()
    This will release all file resource that are held up by Reader.

The aforementioned method will release the file resource that is created using the static method IXMLReader fileReader(String filename) in StdXMLReader class.

Example

public class XmlTest
{

// ## means new features added.

    public static void main(String[] _args) throws Exception
    {
        IXMLParser parser = XMLParserFactory.createDefaultXMLParser();

        /*// If pass string, use stringReader
        IXMLReader reader = StdXMLReader.stringReader(“<root></root>”);
         */
        // Pass by file. Important to use toURL method otherwise exception will be thrown.
        IXMLReader reader = StdXMLReader.fileReader(
                new File(“c:/test.xml”).toURI().getPath());
        parser.setReader(reader);

        // parse() method does not include comment
        IXMLElement xml = (IXMLElement) parser.parse(true);   // ## true means parse comment too

        IXMLElement _x = xml.createElement(“newChild”);
        _x.setComment(“This is new child”); // ## Adding comment
        _x.setAttribute(“att1″, “me1″);
        _x.setAttribute(“att2″, “me2″);
        xml.addChild(_x, 0);  // ## Adding at specific position.

        IXMLElement _b = xml.getChildAtIndex(1);
        xml.removeChild(_b);  // Remove tag

        XMLWriter writer = new XMLWriter(System.out);
        // Default for write is excluded comment
        writer.setIncludeComment(true); // ## Include comment at generation.
        writer.write(xml, true);

        reader.close();

    }

}

 

Download NanoXML v2.2.5

The following file contains the full source code and the library jar file. To check on those changes that I have made, you can search for ‘GeekyCoder’ in the source code.

image
NanoXML-2.2.5.zip (93kb)

Released on 6 Feb 2010


Read Full Post »

Experimenting with “Office 2007” Zoom interface

image

I have to admit that I like the Default FullZoom Level extension which significantly improve on the FireFox’s rudimentary Zoom feature.

(more…)

Read Full Post »

The following Software and settings are tested on Windows 7. It will also work on Windows XP, Vista.

Introduction

Okay, I understand your frustration of having to read those CHM Help (** CHM refers to format whereas CHM HELP refers to the standalone Help Viewer) that doesn’t offer control over the text sizeimage. It can be torturous and straining to read ant-like text in high resolution screen. There is really a ton of CHM Help out in wilderness that doesn’t have a Font option to control the text size. I baffled me what is in the mind of those CHM producers who couldn’t add the Font option image  to enhance readability as the CHM is supposed to be ubiquitous distributed format that as common as PDF and to be readable over many types of screen, big and small alike.

Despite the PDF been the de facto standard for document distribution, CHM is still a widely popular format due to its simplicity, size, performance and speedy search capability. Unfortunately there is no way to add a Font options in existing CHM Help unless you want to decompile the CHM and regenerate the CHM, which by no mean a trivial effort.

(more…)

Read Full Post »

Tested on
– Windows Vista/7
– NetBeans 6.71 with JavaFX

If you need to customize the AutoIt script , you need to install the AutoIt v3 environment (http://www.autoitscript.com/)
Note that AutoIt ONLY works in Windows environment.

Issues

NetBeans is the official IDE for JavaFX development. However, the latest v6.71 (or beta 6.8) of NetBeans is unable to beautify JavaFX Script (JfxScript) code as the “Format” option is not working (It just do nothing.  See Bug acknowledgement).

The code beautifier is one of the most important tools for learning and using  JavaFX as most raw code copied from Internet/ebook tends to be unformatted, making it hard to read and use. Performing manual format is just too tedious. So until the next NetBeans’s release, users have to resort to using painstakingly manual code formatting .

Code beautifier turn this (The following JfxScript code is formatted in NetBeans ! Read on to see how it’s done.)

image

into this

image

(more…)

Read Full Post »

Older Posts »