Feeds:
Posts
Comments

Archive for the ‘Programming’ Category

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…)

Advertisements

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 »

This is a follow-up to my post: Android: Zip download of Cupcake Android v1.5 source code

There is a popular quote which says

image Give a man a fish and you feed him for a day; teach a man to fish and you feed him for a lifetime.

That’s definitely true for most developers using Windows as the main development platform and will want to get the latest Android Source code without installing any prerequisite software (Cygwin, repo, git etc) to obtain the latest source code, and hence the fastest way to do so is to obtain the zip Android Source code uploaded by some kind souls. However, it is always best not to depend on someone else in the long run and therefore it will be beneficial to learn how to obtain the latest source code. Although it is unnecessary to periodically getting the latest entire source code, it is good to know that one can easily obtain the latest source code just as easy as saving a file (albeit with much patience) . In addition, the source code may even more valuable if it can be easily accessible in the IDE. So the objectives for this post is

This post will split into two main sections: Downloading the Source Code and Configuring the Source Code for use in Intellij.

(more…)

Read Full Post »

Note: There is a later post created in 3July09 titled
Android: How to download the latest zip Android Source Code easily and using it in Intellij on how to obtain the source directly from the Android code server.

A great way to learn about a Java library and framework is to browse through their innards (source code) ad hoc-ly during project development. Sometimes a method or a class that seems so simple in its name might do much more and end up create side-effect unexpectedly which result in hard-to-debug code. In addition, API documentation tends to be vague and brief that does not delve hard into detail. Hence, the source code of the Java library and framework is very indispensable resource for software development.

image This is especially so for Android Mobile Application Development where it is still relatively new in term of maturity and acceptance. There is still currently one Android phone available in the market and the forthcoming v1.5 Android platform codename Cupcake make the Android development all the more challenging. Hence having the full source code of Android can at least assist in understanding and learning on what is still a new mobile platform. However, Android SDK does not come with source code and it is up to the developer to download it from the Google code server. It is quite involving to download those source code so what if someone already do the hard work of getting and packaging the source code for you ?

image

Why not just JAD the android.jar ?

JAD Java Decompiler is a free popular tool that can be used as standalone or integrate with leading IDE to decompile Java class into its source code. When used with IDE, it allows one quickly to decompile third-party library (where source code is not available) class in real-time.

So why not just simply use JAD to decompile those class file from android.jar ? It is because JAD doesn’t work for Android. The decompiled source code does not have any useful method body and meaninglessly replaced by stub code "throw new RuntimeException("Stub!");"

For example, for the Activity.java file:

public Activity()
{
throw new RuntimeException("Stub!");
}

protected void finalize()
throws Throwable
{
throw new RuntimeException("Stub!");
}

public static long getInstanceCount()
{
throw new RuntimeException("Stub!");
}
etc

Getting the source code

Thank to someone by the name of rgruet in http://androidforums.com/android-developers/1045-source-code-android-jar.html who consolidate the source code of Android v1.5 into a zip file,

I packed the sources for android 1.5 (not a piece of cupcake ;-), and made the
archive temporarily available at http://rgruet.free.fr/public/android…upcake-src.zip (21.6MB). Please mirror it elsewhere before my ISP kills me!

Create a directory sources/ inside your <android-SDK>/platforms/android-1.5/ directory, and unzip the archive there.

Richard

There are currently three known sources to download the source code (21.6 mb).

Oh yes, download smart, use a Download Accelerator.

If possible, mirror the download.

Read Full Post »

I have been a avid reader of image for over 2 decades ever since its printed publication was available in old Singapore National Library. I remembered sitting for hours in the air-con reference room every end of the month voraciously browsing and reading through stack of InfoWorld publication. During that time, it was the premier source of information on Information Technology, covering many interesting things like upcoming technologies, information management, software tools and reviews. It is gratifying to find how IT can be made so fascinating and interesting just by the skilful words of InfoWorld editors. I’m glad that to this day that InfoWorld successfully capitalizes on the Internet and continues its tradition of delivering high quality of IT news and reporting to even more readers.

Old Singapore National Library
image
InfoWorld Printed Publication
image
The New Singapore National Library 
image
The new National library is now a modernised multi-storey building. Nostalgically miss many of ‘old’ cultural buildings that give a sense of identity.

Therefore, it is my honour and gratitude to be asked and  quoted on the subject on image by Paul Krill image , a InfoWorld editor. Like many Java developers, I am currently learning JavaFX and exploring its capabilities. JavaFX, although still yet to be officially released, has captured the interest of many faithful Java developers who like to leverage on existing Java infrastructure and ecosystem to easily create cool and interactive RIA applications that run not only on the desktop and web browser but also on JavaFX-based mobile phone.

You can find the blog of other outstanding developers who are quoted in the article as well.

  • Andres Almiray image , a experienced Java developer who involves in open source projects.
  • James Weaver image , author of book image , the only JavaFX Script book currently on the market.

To read on the two-page article, click on the following link/image to read the article.

Can JavaFX make a play for rich Internet apps?

image

Quoted as

An anonymous blogger identified only as “geekycoder” lauded the technology: “Technically, JavaFX enables me to leverage [the] Java skill set and Java technology that I am more comfortable with to deliver a compelling RIA solution. Because synergy between JavaFX and Java is excellent and the fact that JavaFX is built on the Java platform means that I can ensure that I have one of the best and supportive platforms to work in. In addition, JavaFX will enable me to be more productive in making it easier and quicker to create RIA solutions,” for Web 2.0.

“JavaFX Script, the language of JavaFX, doesn’t replace Swing, the core Java GUI toolkit, but provides an alternative way of programming that hopefully will bring Java technology to the masses,” according to geekycoder.

Read Full Post »

As the title has partly hinted, those objectives of the post are to touch on issues and solutions that make JavaFX Script a better scripting language by promoting good practices learnt from mature language, or to be more specific, its parent language, Java. The fact that JavaFX Script derives its name partly from the Java moniker means that it certainly deserves high expectation that worthy of its heritage. JavaFX Script might be new to the game but it has the advantages of getting its foundation right by learning from its predecessors eg ActionScript, Groovy.

The reasons why all these 3 areas are discussed together rather than as separate posts are  because they are closely related, and one can’t have it working correctly without effectively addressing the other. These suggestions and questions are materialized after spending some time exploring on the ‘intricacies’ of JavaFX Script and pondering on those issues that developer will encounter using JavaFX Script.

We might think that JavaFX Script might be the ideal language because it combines the the best of both worlds, that is the flexibility and ease of scripting language and robustness and predictability of a compiled language. As we should see later that it often not the case, there exists a impedance mismatch between two programming language type that if not resolved will create a language of confusion instead (Though this is nothing new to JavaFX Script as it is quite prevalent in scripting languages that provides OOP capability)

(more…)

Read Full Post »

Older Posts »