Java

Jan
2nd

Android Chord Transposer

I wrote my first Android app — a chord transposer. Usually when I’m writing a song I take out a pad and write down the chords I’m using, then try out the same progression in different keys according to what’s suitable for my voice. Since I do this so often I figured it’d be easier to create an app to do it for me. It’s simple, but it gets the job done! And faster than I can do it on paper.

Check it out on the Android market.

Posted in Android, Java, Music, Programming, Projects | Leave a comment
Tags: , ,
May
6th

Observable ArrayList

If you’ve ever needed or wanted to observe an ArrayList for changes, it’s easy to extend it so that it follows the observable pattern.

Continue reading »

Posted in Java | Leave a comment
Tags: ,
Apr
25th

Property Class Generator

Following my article on Dynamic and Parsable Properties, I decided to write a utility class that would parse a properties file and generate the class for it. This way, if you have a particularly large properties file, you don’t have to spend too much time on the class to read the properties.

Continue reading »

Posted in Java | Leave a comment
Tags: ,
Apr
23rd

Dynamic and Parsable Properties

The Properties class allows you to store and retrieve static String property types from files. I wrote two classes that makes Properties “dynamic” (so that you can reference the values of other keys) and parsable (so that instead of returning all String types, you can parse other supported types).

Continue reading »

Posted in Java | 1 Comment
Tags: , ,
Jan
8th

Java Crypter, Hasher, Masker, Truncater

I wrote a set of classes that make encrypting, decrypting, hashing, masking, and truncating data a little easier. I chose a generic design so that the API can be extended to include other, complex objects. To use it, you can include the JAR in your project (download the JAR and source here). It includes several test classes in the net.chiappone.crypt.test package for example usage. In this article I’ll show some of these examples with their corresponding output.

Continue reading »

Posted in Java, Projects, Security | 1 Comment
Tags: , , , , ,
Dec
31st

Extract text from a PDF file

This example shows you how to parse the text from a PDF file using Apache POI.

Continue reading »

Posted in Java | Leave a comment
Tags:
Dec
31st

Extract Text from a .DOC File

This example shows you how to parse the text from a Microsoft Word file (prior to the 2007 version) using Apache POI. If you want to parse a .docx file instead, click here.

Continue reading »

Posted in Java | Leave a comment
Tags: ,
Apr
25th

Simple XML Reader

This is a small utility class that I often reuse to read values from an XML file. It uses Java’s built-in XML parsing but implements two basic yet useful methods so that the logic is abstracted away: getElementValue() and getElementValues().

Continue reading »

Posted in Java | Leave a comment
Tags:
Oct
27th

Wrapping Strings

Having the ability to wrap strings can be useful if you don’t know how long your strings are going to be, such as when you’re using translated text in a JOptionPane (or any other GUI element for that matter). This is nice utility class that does exactly what we need — StringWrapper.

Continue reading »

Posted in Swing | Leave a comment
Tags: ,
Aug
13th

Java Relative Date and Time

I recently needed the ability to show the date and time in a relative manner. I.e., rather than display the full date and time like “August 13, 2009 at 3:07 pm”, I wanted to determine what the given date is relative to now and instead show something like “one hour ago” or “one hour from now.” This class converts a Calendar or Date object into a String representing the relative date.

Continue reading »

Posted in Java | 1 Comment
Tags: ,