Archive for April, 2009
James Gosling writes about Netbeans Kenai.com support
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.
MySQL founder's view on Oracle's acquisition of SUN
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.
JMX Code Snippet
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);
XPath in Java: Code Snippet
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());
}
WizTools.org tool to test java.text.SimpleDateFormat pattern
Color Picking in Linux
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.
Local time search
I wanted to find the local time in Italy, and I got the result without clicking on the search result:
I tried the same in Google, and found the same result.
Linux Screen Rulers
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
Writing HTML
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.
Saddest news of recession: Oracle buys SUN
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
Playing with CouchDB
I have been playing with CouchDB recently. It is a Document store:
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 is written in Erlang.
VirtualBox 2.2 Released
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.
Parallel download of artifacts in Maven 2.1.0
freshmeat.net gets an update…
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.





