Best way to split a paragraph into sentences

…is to not use your own brain but rather ride on the shoulders of an expert. Surprisingly enough (for most), a popular ‘expert’ is Stanford CoreNLP.

Suppose you have the following paragraph (credit):

Born in Pretoria, South Africa, Musk taught himself computer programming at the age of 12. He moved to Canada when he was 17 to attend Queen’s University. He transferred to the University of Pennsylvania two years later.

Continue reading Best way to split a paragraph into sentences

Creating a Java 10 project in IntelliJ IDEA with JUnit 5 and Gradle support

IntelliJ IDEA is a free and open-source (yay!) IDE for Java development. It’s a huge-huge-huge improvement over the slow and ageing Eclipse. Recently, I wanted to do some programming practice, so I thought why not in Java. I started by writing my code in good ol’ Notepad++. Very soon I reminded myself about my TDD resolution — to never write code without unit tests. This meant needing something serious to write my Java code. It was a good opportunity to try out IDEA, something I had been meaning to do since I learnt that Android Studio is based on it (that was long ago, like 3-4 years ago).

Creating a Java project and running/debugging code in IDEA is pretty simple and quick. Configuring IDEA to support JUnit 5 tests, on the other hand, is no child’s play. It took my literally more than a day to get it to work. And hence this blog post, which is a note to self to quickly set up things in future.

If you are interested in checking the Java project that I had created in IDEA (referred to in my screenshots below), check my GitHub repo.

Continue reading Creating a Java 10 project in IntelliJ IDEA with JUnit 5 and Gradle support

Running opentaps in Windows

So I’m playing around with opentaps these days. It runs pretty neatly in Linux. Simply executing a shell script it comes with autostarts a built-in Tomcat server and runs the darn thing without a hitch. opentaps under Windows is another animal!

Although opentaps comes with a similar batch script for Windows, the thing doesn’t run without errors. With JDK and all set all right, I was getting this error when visiting opentaps in browser:

HTTP Status 500 –

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

java.util.regex.PatternSyntaxException: Unexpected internal error near index 1
\
^
java.util.regex.Pattern.error(Pattern.java:1713)
java.util.regex.Pattern.compile(Pattern.java:1466)
java.util.regex.Pattern.(Pattern.java:1133)
java.util.regex.Pattern.compile(Pattern.java:823)
java.lang.String.split(String.java:2293)
java.lang.String.split(String.java:2335)
org.ofbiz.webapp.control.ConfigXMLReader.injectControllerIfNeeded(ConfigXMLReader.java:81)
org.ofbiz.webapp.control.ConfigXMLReader.getControllerConfig(ConfigXMLReader.java:133)
org.ofbiz.webapp.control.ConfigXMLReader$ControllerConfig.loadIncludes(ConfigXMLReader.java:351)
org.ofbiz.webapp.control.ConfigXMLReader$ControllerConfig.(ConfigXMLReader.java:170)
org.ofbiz.webapp.control.ConfigXMLReader.getControllerConfig(ConfigXMLReader.java:132)
org.ofbiz.webapp.control.ConfigXMLReader$ControllerConfig.loadIncludes(ConfigXMLReader.java:351)
org.ofbiz.webapp.control.ConfigXMLReader$ControllerConfig.(ConfigXMLReader.java:170)
org.ofbiz.webapp.control.ConfigXMLReader.getControllerConfig(ConfigXMLReader.java:132)
org.ofbiz.webapp.control.RequestHandler.getControllerConfig(RequestHandler.java:97)
org.ofbiz.webapp.control.RequestHandler.getDefaultErrorPage(RequestHandler.java:647)
org.ofbiz.webapp.control.ControlServlet.doGet(ControlServlet.java:239)
javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.ofbiz.webapp.control.ContextFilter.doFilter(ContextFilter.java:270)

note The full stack trace of the root cause is available in the Apache Tomcat/6.0.26 logs.
Apache Tomcat/6.0.26

It’s amazing that a simple hack posted by someone in 2011 worked for me! After modifying ConfigXMLReader.java as mentioned in the forum post, be sure to recompile opentaps by running the ant command. Don’t have ant installed? Read this.

Granular Package Archive

rpm_logoContinuing my Java learning stint, I started experimenting on RPM packages in the Granular 2008 repository by extracting meta data from them using various Java classes I had written for my on-going college major project. To give a shape (end-user interface) to these leisurely done Java programs, I used my existing project MyBlog to create a website that could display information (extracted by the Java programs) about every RPM package in the repository. In other words, the Java programs store information about each RPM package in a central database which in turn is used by a PHP-based website to display that information, and much more.

In the introduction to Granular Package Archive post I wrote on the Team Granular blog, I explained the various features it has to offer. My personal favorite is the ability to leave comments on individual RPM pages. Other than that, I am quite satisfied with the overall look-and-feel too. In another of my Team Granular blog post, I explained the working of this package archive system, and the way to use it with any other repository of RPM packages.

Some guys at the Unity Project are also contemplating the idea of using this package archive system with their repository too.

Recent happenings

Although I haven’t yet gotten out of the agony that I got on loosing my previous blog, I am finding this new place quite comfortable. Today, I was feeling like blogging here, after so much time. So, here are some events related to me take took place not too long ago:

  1. Granular 1.0 Preview was released on 14th March 2008. Check out the release annoucnement here. I am quite happy with this release and so are rest of the Team Granular members who put the real efforts in making this release possible. So far, the reaction of the users who have tried this release has been nice and as expected. Another good news related to the release came when its official torrent became the featured torrent at our tracker linuxtracker.org. Check out the torrent here.
  2. My journey of learning a couple of programming languages resumed after the latest Granular release. I am now continuing my Python book from where I left it and sharpening my HTML/XHTML concepts simultaneously. Starting from today, I have also started a book on Java (damn, you cannot be called even a “computer guy” without learning this language!).
  3. Windows Vista SP1 has been released and it’s on my download schedule for this weekend.
  4. Apart from the programming books, these days I am reading a little nice novel by John Grisham. The name of the novel is Skipping Christmas. Till now, I have found this book a real worth-a-read.
  5. Yesterday, I took out some time to resume playing my favorite game – Half-Life 2.

More to talk later. 🙂