Wednesday, June 22, 2005

Simplifying Java: How to Count the Number of Words in a String using Java (one-liner)

Java is a language of choice for millions of developers worldwide. In a series of articles I will show simple tips and techniques which make Java extremely powerful and yet simple to use. Today's article is about using regex, a pattern matcher incorporated in Java (from 1.4 I believe).


Here is a sample code (line in bold) to count the number of words in any amount of text. The sample program counts the number of words in the argument to the program. The argument must be quoted to ensure separate words are clubbed together in a single sentence by the operating system.

public class WordCount {
public static void main(String args[]) {
System.out.println(java.util.regex.Pattern.compile("[\\w]+").split(args[0].trim()).length);
}
}

[via Simple Thoughts]


Sun adds Java based Identity Tools to Software Lineup

Sun this week will release two servers in its identity management line designed to help corporate users jumpstart federation projects with partners and to aid service providers such as telcos in provisioning users on a massive scale.



The new software offerings are Sun Java System Federation Manager, a server that will help companies hook partners into their secure infrastructure, and a Service Provider Edition of Sun's Identity Manager software for extranet provisioning that includes self-registration, the ability to share account information and auditing tools.



[via Simple Thoughts]



What's New in NetBeans Mobility Pack 4.1 is the one stop for all that's new in the latest Mobility Pack. From the Visual Designer to the Wireless Connection Wizard, Eric Giguere covers it all.


Core Java Technology Features in Mustang The JDK Core Engineering Team provides details of some important core features coming in Mustang, the next release of the Java 2 Platform, Standard Edition.


Create a MIDP Application Using Drag 'n' Drop Interested in creating J2ME MIDP applications faster and more easily? Find out how the powerful new Visual Editor in the upcoming NetBeans Mobility Pack 4.1 IDE speeds your development time with drag and drop functionality. Read the transcript of this chat with the engineers who designed and implemented this feature for an inside look at its capabilities.


Exploring the NetBeans MIDP Visual Designer reveals the visual design tools of the NetBeans Mobility Pack. Eric Giguere illustrates the ease of developing the visual elements of a MIDlet suite. J2ME screen design and management has never been easier.


What's New in the Sun Java Wireless Toolkit 2.3 beta outlines the new features and APIs in the latest version of the Sun Java Wireless Toolkit. You'll learn about the toolkit's support for the Location API, SATSA, and the Content Handler API. Read the article to learn how you can create MIDP applications that discover their location, communicate with smart cards, respond to specific content types, and more.


Tuesday, June 21, 2005

Mastering J2EE Application Development Series


Open Source is Free Like a Puppy is Free


There are long term costs and hassles, and occasional cleanup jobs. I have always enjoyed Scott McNealy's knack for analogies, and this one is really right on. As I have stated in previous occasions, the fact that it's open source, thus free does not automatically make it good. I'm not going to rehash on all the arguments about open source, but focus specifically on this comment from McNealy."


Monday, June 20, 2005

Krishnan Viswanath's Blog: Hashmap Implementation


An Amazing Applet (kirk.blog-city.com)


Thursday, June 09, 2005

Lifecycle of Bloggers [A Java Geek's Diary]

To all blogger, this is an interesting blog post on Lifecycle of blogger. via Kiruba. I think every blogger should read this.


[via java.blogs Day's Entries]


GeoURL to GoogleMaps [Lost Boy] Continuing yesterday's hack here's another stylesheet that converts RSS 1.0 annotated with geourl:latitude and geourl:longitude (e.g. geourl feeds) to the Google Maps format. I added a form you can use to generate links similar to this one which shows bloggers in my area. Looks like I can shout out the window to contact some of them!...
[via java.blogs Day's Entries]


BIRT wow!. Finally, Java reports made easy [Martin Perez's Weblog]

Wow. Today I was adventurous, and I said to myself: "Let's try birt, even that there is no much tutorials and samples available - I only found these screencasts, but I haven't seen them yet.


I downloaded all the packages, and first of all tried to launch the demos, but with few results. Well, not at all, the charting demos goes fine. They throw several exceptions, but most of the samples worked. Here are some screenshots (click on them to enlarge!).





Next, I started Eclipse. I switched to Report perspective, and created a new report. That's good, you can visually design your reports. There is a component palette and a properties view to configure your components. So I added a simple text label.





Next, I went to the data menu and configured a JDBC source. That's great. You can browse through your tables, columns, filter the data, create computable columns, use javascript functions. It seems very powerful! I created a database set with a tabla that was in the database sample (embedded derby database). There is a Data Explorer view, that allow you to see those generated datasets.





But now comes the best part. I created a data widget on the report, and then I drag my database and dropped it directly on the widget. And Birt automatically updated the data and created a grid with the database contents!





And to end, I lanuched a preview in PDF, and BIRT automatically opened acrobat. Well, the preview isn't very beautiful, but I didn't care about formatting. It's only a test.





And all these tasks only took about two minutes! Finally, it seems that there is a very productive Open Soruce reporting environment in Java. I don't agree with the BIRT name, because I don't see business intelligence features anyway, but I have to recognize that it seems a powerful and easy engine.


[via java.blogs Day's Entries]


Understanding the Role of Manuals in Software Development [Simple Thoughts] Understanding the Role of Manuals in Software development; Debunking the XP Myth of Code is Documentation; Additional value of documentation; Few words on the role of Technical Writers in XP project; Summary


Struts-Layout tag library 1.1 [chandrasekhar's Weblog]

Struts-Layout tag library 1.1 Released


Struts-Layout is a tag library for Struts which provides skinnable tags that display panels, input fields, form modes,tables, pagers, treeviews, sortable lists, popups, calendars, etc.


Read on http://struts.application-servers.com/


[via java.blogs Day's Entries]


Siebel plans new Java-based technology Siebel is trying to build some buzz around its latest software release and is starting to talk about a Java-based, component-building technology it calls Nexus.
[via JavaWorld]