Thursday, 27 September 2012
Facial recognition lock in 3... 2... 1...
Thursday, 20 September 2012
2^5
I'm looking at my family tonight and wondering what adventures we'll have the next time I cross a power of two. I can only hope that we'll meet those challenges wearing silly hats. Because... you know... silly hats are fun.
Friday, 14 September 2012
Signs of the times
Until this week.
At breakfast she signed "finished". We thought that it might have been a fluke. But since then she's been making the sign when she's done eating in her highchair. It's pretty exciting to be able to not have to interpret just grunts, waving of arms, and different cries in some weird version of charades. Hopefully she'll pick up more signs as we go. Clear communication is always nice because it'll take the guesswork out of it, which will reduce everyone's stress.
Monday, 10 September 2012
The Story of the Craftsman
The craftsmen were told that the company would provide all the tools in order to ensure a consistent quality. The workers requested pneumatic nail guns since that allow them to go as quickly as possible. The request went to the hardware store were the clerk insisted most of their sales were for tac hammers. Clearly tac hammers are all that are required, so those were purchased. The craftsmen protested - this would take them 10x as long and would cause much frustration. Craftsmen, like all skilled labour, like to feel that they are working at the best of their ability with the appropriate tools. A tac hammer is clearly not a valid replacement for an air hammer.
Ah, but the management of the company said that the tac hammers make perfect sense. If their paid more money for the faster tools, it would be out of the company budget. This would save time, and therefore money, but only what was billed to the customers. So it wasn't in the companies best interest to ensure the craftsmen have the proper tools.
The craftsmen promised that they would pay for their own tools if they were allowed to bring them into work. Alas the company's management stated that would be against policy. I mean, if the craftsmen brought in their own tools, how would that look? People would start to think that the company wasn't able to provide the proper resources to do the job.
Sunday, 9 September 2012
Partners take turns
Now that we have a kid, I feel that idea carries even more meaning. We have to work together better than we did before. Taking turns is required. Turns feeding Alice. Turns eating. Turns going to the bathroom. Turns changing Alice. Turns going for a bike ride. Turns, turns, turns. I don't understand how that would work if you weren't partners. It can be hard enough to make it work even if you are.
Well, most things require you to take turns. I think now we'll all go for a nap. Because as they say, the family that naps together, sleeps all at the same time. Or something like that.
Thursday, 6 September 2012
Fun fun
The other day we were looking at photos from her birth and it almost seems inconceivable that she was so small. Each stage seems so exciting with "quickly! Come see what she can do!". I can't wait until I can sit down with her and we can play imagination together - like tea time or using a time machine / space ship.
She is a really good kid (so far) and doesn't get into too much trouble. She's patient with us when we're preparing her food, as long as it's clear that we've understood her request. It's really good. I'm a bit sad every day when I leave to go to work, but it's getting easier. Both of my girls are making it easier. Now if I can just get Laura to greet me with a drink and my bubble pipe when I get home...
Wednesday, 5 September 2012
Java find files for a given extension, recursively
In a bit of code I was doing I wanted to run without depending on any external libraries. The trouble that I had was that I was using commons-io.
The problem was given a directory, find all jar files recursively. Commons IO solution:
Collection<File> jarFiles = FileUtils.listFiles(new File(root), new String[]{"jar"}, true);
Simple and clean. How would I do this in java? Wait a second, I'm using java 7 which has improvements to the IO. You know, called New IO 2, or NIO2. This will probably be even easier is what I thought. Well, below is the solution that I came up with after looking at many different blogs.
final Collection<File> jarFiles = new ArrayList<File>();
final PathMatcher matcher = FileSystems.getDefault().getPathMatcher("glob:**/*.jar");
Files.walkFileTree(Paths.get(root), new SimpleFileVisitor<Path>() {
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
if (matcher.matches(file)) {
jarFiles.add(file.toFile());
}
return FileVisitResult.CONTINUE;
}
@Override
public FileVisitResult visitFileFailed(Path file, IOException exc) throws IOException {
return FileVisitResult.CONTINUE;
}
});
Close to 20 lines. Yuck. To be fair, it is super powerful with what kinds of different things that you do do with it, not just looking at the extensions, but man oh man is that a whole bunch of ugly. Why with java do you always have to use heaps of libraries and frameworks to get anything that even starts to look clean and tight?