Skip to content

www.rolfje.com

Tag: Utilities

Simple Strict Date Parsing

Posted on 2010-03-06 By rolfje No Comments on Simple Strict Date Parsing

In Java, the DateFormat.parse() method is a funny little critter. It helps you by trying to figure out what date you actually meant when you typed in “35/12/2O10” (note the letter “O” in 2O10). In this case, it will parse the date without errors or warnings, and returns the date “11/12/04” (November 12th, 0004). That’s because it thinks “35” is a month, and “2” is the year, ignoring everything after the letter “O”.

DateFormat tries to convert the “35th month” into 2 years and 11 months, and correct the date accordingly. df.setLenient(false) prevents this, but that still leaves the problem of the parsing stopping at the first wrong character without warning.

I needed a much stricter way of parsing dates, and yesterday I found an elegant solution to this problem. It’s so small I was able to tweet it in less than 140 characters, but I thought it deserved a decent blogpost so here it goes:

public Date parseDateString(String inputDateString) 
         throws ParseException {
  DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT);
  Date parsedDate = df.parse(inputDateString);

  if (!inputDateString.equals(df.format(parsedDate))) {
    throw new ParseException("Invalid Date", 0);
  }
  return parsedDate;
}

The brilliance here is in the comparing of the formatted date with the original input. The method returns a normal ParseException so you can perfectly replace your original df.parse() calls with it, making them more strict.

Thanks to Bas for this elegant and simple solution.

Software

Omniplan Progress Tracking Tip

Posted on 2009-08-13 By rolfje 4 Comments on Omniplan Progress Tracking Tip

OmniplanDuring one of my Omniplan sessions at work, I discovered that the resource leveling was acting a bit funny, where people were not planned to do any work for days. I played around with a fake planning and soon discovered the problem and several solutions to it.

Read More “Omniplan Progress Tracking Tip” »

Apple, Software

Starting Java app from Applescript

Posted on 2009-06-11 By rolfje No Comments on Starting Java app from Applescript

Suppose you have a Java Swing application which you can start by typing the following on the command line:

java -jar myTerrificSwingApp.jar

If you want to make that application start from the Finder in OSX, there are a lot of options which range from ugly to convoluted. If you need a quick fix, here’s how to do it.

Read More “Starting Java app from Applescript” »

Apple, Software

Migrate from Password Gorilla to KeePass

Posted on 2009-05-12 By rolfje 3 Comments on Migrate from Password Gorilla to KeePass

KeePass logoI used to use Password Gorilla to store my passwords, because it can run on both Mac and Windows. Because my password database keeps growing, Password Gorilla is becomming a very slow starter, even on my new solid state disk. A few weeks ago I learned that KeePass is a much more modern application, and is available for both Mac and Windows. Here’s what I did to get all my passwords into KeePass:

Read More “Migrate from Password Gorilla to KeePass” »

Uncategorized

How to put DVD’s on your iPhone (for free)

Posted on 2009-02-28 By rolfje 11 Comments on How to put DVD’s on your iPhone (for free)

For A Few Dollars More

A lot of companies like to sell you applications to put DVD’s on your iPhone. Usually these apps are just wrappers around existing tools, and are pretty expensive if you consider you can do it for free. And you don’t need to be a computer wizard either! The steps are simple:

  1. Use Handbrake to rip the DVD to iPhone format
  2. Drag the generated mp4 file into iTunes
  3. Sync it to your iPhone like all other content

To show you exactly how this is done, I’ve  written up this “babystep-by-babystep” tutorial. Let me show you how I ripped “For A Few Dollars More” and put it on my iPhone:

Disclaimer: The DVD I ripped is bought and payed for. This article does not relief you of your responsibility to obey the law, so please be careful. And be nice, don’t pirate.

Read More “How to put DVD’s on your iPhone (for free)” »

Apple

Tweet Week

Posted on 2009-02-15 By rolfje 1 Comment on Tweet Week

TwitterAbout a week ago, I was a bit bored and decided to see what Twitter is all about. I created an account, and I Tweeted for a week. I tried to keep to the original idea, where a Tweet should answer the question “What are you doing”? Looking back, my tweets include Coffee, Podcasts, Global frustration, Small joys, Small irritations, Re-tweets, and Replies. 

Read More “Tweet Week” »

Uncategorized

Rip and Convert FLAC, M4A, MP3, AAC files

Posted on 2009-02-14 By rolfje 1 Comment on Rip and Convert FLAC, M4A, MP3, AAC files

Max Audio TranscoderI recently found an old harddisk which used to be in one of my old PC’s. I discovered some FLAC files on there, which were rips of old CD’s I used to have. iTunes is not too happy with importing them into my library, and the original CD’s are in a box in a deep dark corner of my garage.

I searched for a converter and found this wonderful converter which can just about convert any audio format out there. It’s called “Max”, it’s Open Source, free to use, and available as bundled OSX application. Brilliant! It does have a bunch of options, but as long as you go for the “MP4 Audio” output format, high quiality, 256 bits and VBR, you can’t go wrong.

According to their website “Max can generate audio in over 20 compressed and uncompressed formats including MP3, Ogg Vorbis, FLAC, AAC, Apple Lossless, Monkey’s Audio, WavPack, Speex, AIFF, and WAVE”.

Happy transcoding!

Uncategorized

DLNA on OSX, done right

Posted on 2009-01-31 By rolfje 60 Comments on DLNA on OSX, done right

Sony PS3 LogoMy wife bought me a playstation 3 last year, and I’ve enjoyed many hours of gaming on it, finishing Tomb Raider underworld, and now making decent progress in Ratchet and Clank: Tools of Destruction.

DLNA logo

I was a bit sceptical about the DLNA capabilities of the PS3, because I read a lot of bad news on this fairly new  “Interoperability Guidelines” concept. It sounded like a lot of trouble to go through to simply watch the photos and home videos on a TV. For weeks, I was not able to find a single site telling me how to install a DLNA server on my Mac, or where to find a decent one.

Altgough they’re hard to find, there are a few OSX DLNA servers out there. One of them is actually very good. Here’s what I found:

Read More “DLNA on OSX, done right” »

Apple, Software

Remote Desktop Connection updated

Posted on 2009-01-25 By rolfje 1 Comment on Remote Desktop Connection updated

Remote Desktop Connection icon

“Remote Desktop Connection.app” allows you to see the desktop of a remote Windows machine on your mac. This application will not update itself automatically, unless you have it installed as part of the Microsoft Office for Mac suite. If you’ve downloaded the 1.0.3 version you probably did not notice that “Remote Desktop Connection.app” was updated somewhere last year by microsoft.

You can find the latest version of Remote Desktop Connection on the Microsoft Mactopia site. Version 2 is an improvement over 1.0.3 (which I had). Notable differences are:

  • Nicer configuration screens, makes configuring your resolution and shares easier.
  • Now a Universal Binary, which should improve performance on Intel Macs. I have not noticed improvement, but that’s probably because the network is the bottleneck.
  • Supports the new RDC 6.0 protocol used by Vista.
  • Can do authentication of the remote machine (if it’s a Vista machine).
  • Your Mac printer can be exposed to the Windows machine so you can print documents on your local printer.

I played with it for a while, and apart form the new looks I can not say it’s very different from the 1.0.x version. It could load my old RDC 1.0.3 configuration files. If you need to connect to a Windows desktop from your Mac, this does the job just fine.

Apple, Microsoft, Software

Automount network shares

Posted on 2009-01-18 By rolfje No Comments on Automount network shares

Bonjour Mounter iconThere is a nice and clean way to automatically mount network shares each time you log into your Mac. It’s called the “Bonjour Mounter”, a simple application which runs on login, and mounts the drives you configured it to mount. No more, no less.

Apple, Software

Posts navigation

Previous 1 2 3 4 Next
         

Recent Comments

  • rolfje on European alternatives to AWS/Azure/GoogleCloud
  • rolfje on Are you de-skilling?
  • rolfje on Are you de-skilling?
  • rolfje on Exit WordPress
  • Guus on Exit WordPress

Tags

Apple backup design DIY DRM eclipse environment fix Fun Garmin gmail google hacking hamradio Hardware helicopter iphone ipod iTunes Java Kawasaki Keynote linux modelling motorcycle music news opinion oracle osx photo photography programming repair review security Software technology Time Machine Ubuntu usability Utilities vacation windows Workshop

Categories

  • Apple (107)
  • Divorce (1)
  • Electronics (4)
  • Fun (57)
  • Games (7)
  • Hardware (73)
  • Microsoft (18)
  • Racing (16)
  • Software (143)
  • Uncategorized (68)
  • Workshop (22)

Archives

Brought to you without adds, banners, cookies or tracking. This one is on me. Yes, life can be this good. Pay it forward.

Copyright © 2026 www.rolfje.com.

Powered by PressBook WordPress theme