Tuesday, November 16, 2010

Friday, September 10, 2010

Be mindful that Tuesday morning problems don't become Friday afternoon problems.

Thursday, August 19, 2010

"Elegance: The modesty not to draw attention to the difficulties one has surmounted." paraphrasing Alain de Botton via @spolsky

Friday, August 13, 2010

Minimum number of moves to solve any Rubik's cube configuration (aka "God's Number"): 20 http://bbc.in/9rkt7J

Wednesday, July 28, 2010

Just read online: "I feel like dancing a marimba." Mambo? Meringue? With a marimba? It's a mystery.

On technical debt

"Bad code isn't Technical Debt, it's an unhedged call option" http://bit.ly/a3rQcq

Monday, July 26, 2010

Autism has unique vocal signature, new technology reveals http://bit.ly/b6xg3g

Saturday, July 24, 2010

Thursday, July 15, 2010

It costs 1.5 cents to make a penny. A nickel costs 6 cents. In 2009, the U.S Mint lost $22 million making these coins. http://bit.ly/9vNeNf

Wednesday, May 26, 2010

Grails 1.3.1 dependency resolution

After upgrading Grails to 1.3.1 from 1.2.2, I repeatedly received "UNRESOLVED DEPENDENCIES" errors. After an inordinate amount of troubleshooting, I stumbled upon the sole archived message on the Internet that recommended deleting (or renaming) the %USER_HOME%\.ivy2 directory. Sure enough, this worked like a charm, so I post the resolution here for posterity. It seems there were some transitive dependencies that weren't getting sorted out. It's all good now.

Sunday, May 16, 2010

The Light Bulb Is Not Yet On

I have reset on going through Essentials of Programming Languages, and struggling my way through learning Scheme. I wrote a working answer (at least as tested) for a problem in the second chapter, but I feel like I happened upon it through test-driven development. I suppose in some ways that's a good thing, but I can say that it is not a terribly comfortable feeling to write some code but not really grok what it's doing. Anyway, here is the paraphrased problem, and my solution (test cases included):

Exercise 2.2.9, #3. (car&cdr2 s slst errvalue) generates a procedure composition that, when evaluated, produces the code for a procedure that takes a list with the same structure as slst and returns the value in the same position as the leftmost occurrence of s in slst. If s does not occur in slst, then errvalue is returned.

(define (contains? s los)
(if (null? los)
#f
(if (symbol? (car los))
(if (eq? s (car los))
#t
(contains? s (cdr los)))
(if (contains? s (car los))
#t
(contains? s (cdr los))))))

(define (car&cdr2 s slst errvalue)
(if (contains? s slst)
(car&cdr2-help s slst 'car)
errvalue))

(define (car&cdr2-help s slst lst)
(if (symbol? (car slst))
(if (eq? s (car slst))
lst
(list 'compose lst (car&cdr2-help s (cdr slst) 'cdr)))
(if (contains? s (car slst))
(list 'compose 'car (car&cdr2-help s (car slst) 'cdr))
(list 'compose lst (car&cdr2-help s (cdr slst) 'cdr)))))


Here are the tests (schemeunit):
(define-test-suite 2.2.9
(test-case "3."
(check equal?
(car&cdr2 'a '() 'fail)
'fail)
(check equal?
(car&cdr2 'a '(a) 'fail)
'car)
(check equal?
(car&cdr2 'a '(b) 'fail)
'fail)
(check equal?
(car&cdr2 'a '(a b) 'fail)
'car)
(check equal?
(car&cdr2 'b '(a b) 'fail)
'(compose car cdr))
(check equal?
(car&cdr2 'c '(a b c) 'fail)
'(compose car (compose cdr cdr)))
(check equal?
(car&cdr2 'd '(a (b c) d) 'fail)
'(compose car (compose cdr cdr)))
(check equal?
(car&cdr2 'dog '(cat lion (fish dog) pig) 'fail)
'(compose car (compose cdr (compose car (compose cdr cdr)))))
(check equal?
(car&cdr2 'c '((a b) c) 'fail)
'(compose car cdr))))

Any Schemers care to give me pointers? I sure could use the help.

Thursday, April 29, 2010

Stupid coding tricks.

In a fit of distraction one day, this was the most ridiculous "solution" for converting a test score to a letter grade I could muster.
public static char S2G(int s) {
return (char)(1249078710>>s/10*3&7|64);
}

DailyWTF-worthy, I say.

Saturday, March 20, 2010

NCAA Wrestling Championships + ESPN Hi-Def == great television.
heavyWetSnow.clear();

Tuesday, March 09, 2010

Estimation and planning

A 2008 survey of 500 software practitioners found that four of the top five “Most Damaging Classic Mistakes Overall” in software development are directly related to project estimation and planning. Each mistake was rated as having a severe and serious impact to projects in which the mistakes occur. In order of frequency and severity, these four mistakes are:

1. Unrealistic expectations
2. Overly optimistic schedules
4. Wishful thinking
5. Confusing estimates with targets

Thursday, December 31, 2009

These are a few of my favorite teams...

Northwest Bearcats - Division II National Champs
Nebraska Cornhuskers - Holiday Bowl Champs
Iowa State Cyclones - Insight Bowl Champs

It's been a great season.

Wednesday, November 11, 2009

Veterans Day

A very thankful Veterans Day, from me and my family. A special gratitude, admiration, and respect for my brother, who is currently serving in Iraq. Here's to wrapping up a successful tour quickly and a safe return home.

Thursday, August 27, 2009

Unexpected SimpleDateFormat Behavior

Failing test case:

import static org.junit.Assert.*;
import java.text.*;
import org.junit.Test;

public class DateFormatTests {

@Test
public void testRequiredTwoDigitDay() {
DateFormat df = new SimpleDateFormat("yyyyMMdd");
df.setLenient(false);
try {
df.parse("2009081");
fail("Expected two-digit day");
} catch (ParseException e) {
e.printStackTrace();
}
}
}

Argh.

SimpleDateFormat API Javadocs
:
For parsing, the number of pattern letters is ignored unless it's needed to separate two adjacent fields.
Tricksy API javadocs. We hatessss it forever.

Java - Resolving NullPointerException

In Java, the NullPointerException (NPE) is generally a simple exception to resolve. In very basic terms, it means that one is trying to access a property or call a method on an object that does not exist. Read the error message to find the line where the NPE occurred. Examine that line to determine which reference is a likely candidate to be null. Dig a little deeper to find out why that reference is null and fix the application to either ensure the reference is not null or to handle the reference gracefully if it is null.