indiWiz.com

Subhash's Tech Log

Archive for April, 2009

James Gosling writes about Netbeans Kenai.com support

without comments

The post is interesting. Kenai.com as a cloud based project hosting infrastructure is interesting. But …

Given Oracle’s acquisition of SUN, I am quite unsure if Oracle would continue investing in a Kenai.com. Or, for that matter, in Netbeans (I am a Netbeans addict, and pray that they do it).

So what have I done? I have created an account in Kenai.com. But, for the moment I am not going to host any of my OpenSource initiatives in Kenai.com. Wait and see is the only thing I can do now.

Written by Subhash Chandran

April 30th, 2009 at 9:56 am

Posted in Innovation,Java

Tagged with , ,

MySQL founder's view on Oracle's acquisition of SUN

without comments

The biggest threat to MySQL future is not Oracle per se, but that the MySQL talent at Sun will spread like the wind and go to a lot of different companies which will set the MySQL development and support back years.

Read more.

Written by Subhash Chandran

April 25th, 2009 at 2:26 pm

Posted in news

Tagged with

JMX Code Snippet

without comments

This snippet uses MX4J.

        String urlAddr = "service:jmx:rmi://" + host;
        logger.info("Address: "+urlAddr);

        JMXServiceURL address = new JMXServiceURL(urlAddr);
        Map environment = null;
        MBeanServer server = MBeanServerFactory.createMBeanServer();
        JMXConnectorServer cntorServer = JMXConnectorServerFactory.newJMXConnectorServer(address, environment, server);
        cntorServer.start();

        // HTTP Adapter

        HttpAdaptor adapter = new HttpAdaptor();
        ObjectName name = new ObjectName("Server:name=HttpAdaptor");
        server.registerMBean(adapter, name);
        logger.info("jmx-port: "+ MBeanConfig.ADAPTOR_PORT);
        logger.info("jmx-host: "+ MBeanConfig.ADAPTOR_HOST);
        adapter.setPort( MBeanConfig.ADAPTOR_PORT );
        adapter.setHost( MBeanConfig.ADAPTOR_HOST );
        adapter.setProcessor( new XSLTProcessor());
        adapter.start();

        // Register MBean

        ObjectName objectName = new ObjectName("org.wiztools.project.mbean:type=WizTools");
        logger.info("ObjectName: " + objectName);
        WizToolsMonitorMBean mb = new WizToolsMonitor();
        server.registerMBean(mb, objectName);

Written by Subhash Chandran

April 25th, 2009 at 10:17 am

Posted in Java

Tagged with ,

XPath in Java: Code Snippet

without comments

try{
    InputStream is = ...;

    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    factory.setNamespaceAware(true);
    DocumentBuilder builder = factory.newDocumentBuilder();
    Document doc = builder.parse(is);
    is.close();

    XPathFactory xfactory = XPathFactory.newInstance();
    XPath xpath = xfactory.newXPath();
    XPathExpression xpr = xpath.compile("/executors/executor");

    NodeList nodes = (NodeList)xpr.evaluate(doc, XPathConstants.NODESET);
    int size = nodes.getLength();
    for(int i=0; i<size; i++){
        NamedNodeMap nnm = nodes.item(i).getAttributes();
        String strPath = nnm.getNamedItem("path").getNodeValue();
        String strClass = nnm.getNamedItem("class").getNodeValue();
        print("Path / Class: " + strPath + " / " + strClass);
    }
} catch(ParserConfigurationException ex){
    print(ex.getMessage());
} catch(SAXException ex){
    print(ex.getMessage());
} catch(IOException ex){
    print(ex.getMessage());
} catch(XPathExpressionException ex){
    print(ex.getMessage());
}

Written by Subhash Chandran

April 25th, 2009 at 10:11 am

Posted in Java

Tagged with , ,

WizTools.org tool to test java.text.SimpleDateFormat pattern

without comments

Written by Subhash Chandran

April 23rd, 2009 at 10:12 pm

Posted in Java

Tagged with ,

Color Picking in Linux

without comments

Which color-picking software do I use? I found out two options (both are GTK based):

  • gpick: The project also has binaries for popular Linux distros available.
  • gcolor2: This is part of the Debian repository.

Written by Subhash Chandran

April 22nd, 2009 at 5:47 pm

Posted in Linux

Tagged with ,

Local time search

without comments

I wanted to find the local time in Italy, and I got the result without clicking on the search result:

Yahoo! Time

I tried the same in Google, and found the same result.

Written by Subhash Chandran

April 22nd, 2009 at 9:33 am

Posted in Innovation

Tagged with , ,

Linux Screen Rulers

with 3 comments

Recently I have been working with a demanding Web Designer based client. She was insisting on pixel-level spacing and detail. Thus I wanted to have a Screen Ruler for measuring her template. I use Ubuntu-based Linux, and found the following tools in its repository:

For KDE users:


$ sudo apt-get install kruler

For GNOME users:


$ sudo apt-get install screenruler

Written by Subhash Chandran

April 21st, 2009 at 3:13 pm

Posted in Uncategorized

Tagged with , ,

Writing HTML

with one comment

Programmers are often required to write HTML code. Recently, on reviewing such code, I found some glaring mistakes. Based on this experience, I have assembled some points which programmers should note when developing HTML.

Version of HTML

Before writing HTML, decide upon version compliance. HTML 4.01 and XHTML 1.0 are popular choices.

Specify Version of HTML as DOCTYPE

For HTML 4.01 it is:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

For XHTML 1.0:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

For a detailed list, visit: http://webdesign.about.com/od/xhtml/a/aa011507.htm

Don’t use deprecated elements like <font>

<font> has been deprecated since version 4.01 of HTML.

Use CSS for styling

For styling purposes (specifying font, color, background-color, border, etc.) use only CSS. For example, for setting the background of a page, the earlier method is:

<body bgcolor="blue">

This is better written as:

<body style="background: blue;">

Open/Close Elements

Please ensure you open and close the HTML elements in proper order. Always have the discipline of closing open elements.

Indentation

HTML is also source code which is maintained by humans. Please respect yourself and the people who will be maintaining it later: write readable HTML with proper indentation.

Validate HTML

Use a proper validation service before publishing your HTML. You may also use tools like xmllint also to validate your HTML.

Test in target browser

All our development systems are Linux. We developers test our HTMLs in Firefox. But our clients use IE. Situations like these demand additional testing effort in IE.

Written by Subhash Chandran

April 21st, 2009 at 11:16 am

Posted in Software Dev

Tagged with , ,

Saddest news of recession: Oracle buys SUN

without comments

This is the saddest news of this recession. I do not know how many SUN sponsored OpenSource products will loose their financial lifeline. This is SUN’s demise.

not

Written by Subhash Chandran

April 20th, 2009 at 7:18 pm

Posted in news

Tagged with

Playing with CouchDB

without comments

I have been playing with CouchDB recently. It is a Document store:

CouchDB Documents

As can be seen in the above screenshot, we can store any number of attributes (key-value pairs) for the document. And one document may have any number of attachments.

CouchDB provides RESTful-JSON API to access and download documents:

CouchDB JSON Representation

CouchDB JSON Representation

CouchDB is written in Erlang.

Written by Subhash Chandran

April 13th, 2009 at 10:41 pm

Posted in Uncategorized

Tagged with , , ,

VirtualBox 2.2 Released

without comments

Version 2.2 of my favorite OpenSource virtualization software, VirtualBox is released. On reading the changelog, I found the new version supporting Open Virtualization Format. This is cool because, now it will be possible to share virtual appliances built with different tools.

Written by Subhash Chandran

April 9th, 2009 at 11:24 am

Posted in news,OpenSource

Tagged with , ,

Parallel download of artifacts in Maven 2.1.0

without comments

Maven 2.1.0 Parallel Download

Written by Subhash Chandran

April 7th, 2009 at 5:12 am

Posted in build,Innovation,news

Tagged with

freshmeat.net gets an update…

without comments

freshmeat.net gets a facelift with modern look and feel. I was growing tired of its old interface and full page loading. The current avatar looks good. But I find some information missing (or, maybe, I am not able to locate), like how many people have subscribed to my project and list of all my projects.

Written by Subhash Chandran

April 3rd, 2009 at 10:39 am

Posted in news

Tagged with ,