Skip to main content

Posts

Showing posts from December, 2011

Git-SVN mirror product: SubGit

Just a quick mention for you people who can't be bothered with my somewhat intricate Git-SVN mirror setup , there now is a now is a solution packed into a product: SubGit . I tried it out on a little local SVN repo recently, and it worked just fine. It delivered pretty much perfect two-way syncing/bi-directional mirror (which I've earlier deemed to be very impractical with git-svn ). The bad parts are: It's new (use at your own risk, in other words: DO NOT install it in your main-line subversion repo used by a 100 devs). It's closed source, so you're at the mercy of the SubGit devs for fixing any feature that you need in your special repository.  It requires instrumentation on the Subversion repository installation. If the repository is beyond your control (hosted externally, or by some separate department), you're stuck with my old setup . The good parts: Super-sweet functionality! I mean, bi-directional Git/SVN is highly sought after. Seems to

Google Guava's Predicates

So the other day I was working away on some rather tricky rules for validating an incoming identifier code. Like 999392304II+TJAJEIAJTI901119 or EPFOOMNNVLLALOWEIITOE Now, the system where this code is going is rather picky about what these codes should look like. (For the sake of this blog-post, I'll invent some business rules here on the fly, in reality they are a bit different, but the nature of them are the same): A code cannot be null, or an empty string (of course) If there are only letters (A-Z) in the code, it must be longer than 10 characters, but fewer than 20 On the other hand, if there are letters mixed with numbers, it must be exactly 10 or 15 characters Numbers only are not allowed No other symbols are allowed, but + signs are allowed, if the code starts with 999. In this case, the max length is 10. Instead of just going straight for the if-else'ing my way through these rules, I implemented it using Predicates from Google Guava . I was pretty hap