Programming

Introduction

Programming is both part of my job and one of my hobbies, so I tend to work with and think about programming quite often.

I mostly work with Java, but I also do a lot with JavaScript, HTML and CSS, with the new up-and-comer being Ruby. So what you will find here is a pile of information about whatever language and/or technology I am currently thinking about, working with or playing with.

Sub-Categories

Java - my language of choice.
Web - web development topics.
Ruby - one of my hobby languages, a real up-and-comer.
Groovy - a nice language for getting little things done quickly.

No Frills for the Mac

Well, it looks like my Eclipse Frills plug-ins do not work on Mac, which is what we develop on at my new company. I am sure it will be some stupid-easy fix, but I will have to throw this into the 1.0 release that is coming soon… no really, it is; most of the code is done, I just have to fix this and push it all out. I have just been a bit busy with other things… like moving my entire life to another state. :-)

No votes yet

Eclipse: Mmm Good Kool-aid

If you know me, you know that I love Eclipse as both an IDE and a development platform; that’s not to say that I am one of those fanatical “YOU MUST USE [INSERT TECHNOLOGY NAME]!” freaks. I have always felt that you should use what works best for you and your development style. I don’t care if you develop using Vi or notepad as long as you get things done. Anyway, that’s not really what this post is about.

No votes yet

Find Matching Ints Using Regex

If you are following along you may have noticed that I have been compiling a long list of soutions to my Find Duplicate Ints problem. I was talking to one of my co-workers, who is not a developer but used to do some Perl hacking, and he suggested that it could be done with regular expressions. Lo and behold, with the help of another of my more regular-expression-ized co-workers we found this to be true:

public int findDuplicate(final int[] array){
    final Pattern p = Pattern.compile(".*?(\\d+. ).*?\\1.*");
No votes yet

Rendering Calendars

I am poking around with an idea I had to generate desktop background images with little calendars embedded in them and I realized that there is no really easy (existing) method of rendering your standard square text calendar display. I decided to play around with it a bit.

The basic algorithm to generate the weeks and their associated days is nothing too complicated:

  1. Figure out what day of the week the first day of the month falls on
No votes yet

Quick String Padding

I stumbled on a quick little way to create string padding of various lengths:

private static String padding(final int size, final char val){
    final char[] pad = new char[size];
    Arrays.fill(pad, val);
    return new String(pad);
}
No votes yet

Recursive Solution to Finding Ints Question

Back in my posting of “Interview Question: Find 2 Matching Ints” I showed a few different solutions to the problem. A candidate we had recently suggested solving it via recursion; I decided to whip up a little recursive solution for my collection:

public static int find(int[] array){
    return scan(new HashSet<Integer>(),array,0);
}

private static int scan(Set<Integer> values, int[] array, int idx){
    if(idx == array.length){
        throw new IllegalArgumentException("No match exists");
No votes yet

Podcasts

Podcasts. I know they have been around for a while, but I have only recently started listening to them. It’s an interesting information delivery method, a bit like personalized radio. I still read quite a few different blogs but podcasts are a nice thing to have playing while I am working as kind of a background discussion.

Here are my favorite podcasts so far, all java-related, of course:

No votes yet

Code Evolution

I had an interesting brief conversation with another developer about code evolution and that got me thinking. What follows is really just some thoughts along those lines.

Wikipedia has evolution defined as:

In biology, evolution is the process of change in the inherited traits of a population of organisms from one generation to the next. It is also known as a change in a species over time.

No votes yet

Spring: Deserialized Object Factory

I recently had the idea that it would be interesting to have a Spring factory bean that would load a serialized object as its object contribution. I have no idea at this point what it would be useful for; it was just something that popped into my head. My example below describes a license key system that is not based on anything real so please don’t expect this to be a good license key implementation… it’s just an example of the deserialized bean factory idea.

No votes yet