Friday, January 21, 2011
4,046
Sunday, January 16, 2011
OSU Math Placement B-test, 1 of ???
Where's that Check 21 2 of 2 I promised for yesterday? Still coming, I just need to get my inspiration back after a few, um, let's call them "challenging" weeks at my day job. Anyway, enjoy!
B Test study guide, question 1a
Sunday, January 09, 2011
Adventures in Barretting
Chris introduced us to the “Flying Saucer” pub last year, which has a giant wall full of taps (possibly 20 or 30), as well as friendly wait-staff, not too intolerable prices, and a 100-beer tour that gets you some sort of free party there and your name on a plate if you finish it. Liberty and I went once with Chris to the Memphis location, and have been twice to the one in Nashville while taking an impromptu “let’s see where this road takes us” vacation.
Tuesday, December 28, 2010
Check 21 Java app - 1 of 2
Background
There are many terms relating to Image Cash Letter files: Check 21, DSTU X9.37, X9.100-187, and check truncation, to name a few.
"Check 21" refers to an act passed in 2003. From Wikipedia's "Check 21 Act" article:
Thursday, December 16, 2010
Java greyscale conversion
Using Java, how do you convert a color image to greyscale? The most straightforward answer I've found was on Code Beach, and is as follows:
Saturday, November 20, 2010
Roman numerals redux
A simple JavaScript function to validate Roman numerals, convert them to Arabic numbers, and back again.
I checked Google Analytics this morning and noticed I've been getting a lot of hits on my October 9 entry on JavaScript Roman numeral conversion. In brief, I wrote a simple function to take a number and build its Roman numeral equivalent. While I was mulling it over this morning, I spontaneously thought of a method to validate and parse a Roman numeral and turn it back into Arabic numbers using regular expressions.
Monday, November 15, 2010
The crazy geometry of basketball courts
Before starting to code, I had to learn about the measurements of a basketball court, and I was a little surprised by what I found. First and foremost, every league has its own sizes for every piece of the court, most differing by a foot or less. The biggest discrepancy is with the length of the court, which is 10 feet less for high school than for NCAA and above, or about 2 running steps. Naturally the FIBA league had measurements rounded to meters where all the US leagues are rounded to feet.
Thursday, November 11, 2010
Jury Duty
About two weeks prior to my reading of the platitude-laden corkboard, I received a summons in the mail to report for jury duty. I tried to get out of it by replying with a letter claiming a child-care burden, as I pick up Scout from school on Tuesdays and Thursdays so that Liberty can attend later classes on those days. I got a phone call the next day telling me basically to suck it up and make other arrangements. Conveniently, this did not prove to be an actual problem: On Tuesday we were released before 5pm, and the courthouse was closed today for Veteran's Day.
Sunday, October 24, 2010
Awesome Ted talks
(and Seth Godin at GEL, who also rocks)
Saturday, October 23, 2010
Saturday, October 09, 2010
JavaScript Roman numeral calculator
My mantra in these cases is simple: If the question is interesting, I try to answer it. If the poster isn't cut out for a programming career, getting my answer isn't going to change that. If he is, he's going to be asking his peers a lot of questions over his career, as no one is born with an innate gift at coding; it's a learned skill like anything else. The young "super hacker" is generally the geek equivalent of a bully - not as skilled/tough as he pretends.
Thursday, October 07, 2010
Korn shell hack of the day
Sometimes I find myself knee deep in a complicated shell script that probably would have been better off written in perl or Java. Today was one of those days. What started as a simple script I wrote for managing sftp traffic to a couple vendors has been transmogrified to handle calling Glub to do an ftps transfer (the "other" secure FTP) from a vendor, then delivering the files to an internal Windows share drive. So far so good, but feature bloat ended up straining my creativity to tackle each new problem, and ultimately saddled me with a workable solution that, while interesting, is sort of a stinker.
The connection to the Windows share was supposed to be via a mounted drive. I would copy the files to a Unix directory, and Unix would manage the SMB transfer transparently. This turned out to be unsupported by our data services group unless the Windows server in question was virtual. It was not. So suddenly I'm on the hook for adding SMB support to the process.
Sunday, October 03, 2010
Picnic with the missus
Instead of spending $20 on a movie and snacks just to sit in the dark and be quiet, let's go out for a walk in the sunshine and talk to each other... for free. Instead of stopping for greasy fast food somewhere, or spending more at a better restaurant, let's cook up some food for lunch, and take it with us somewhere. In this case, "some food" was steak cut into strips and fried up with pepper, sweet Italian mini bread, cheddar cheese cut into slices, some green onion, and a refreshing carbonated beverage (the basket has a cool separate area for bottles), and "somewhere" was Highbanks park.
When we got there, we found a long trail that didn't seem to have a lot of people on it, and proceeded to hike around looking for unofficial exit points: Good places to hang out that are accessible, hidden from the trail, but without signs saying not to go there. What we found was here:
Thursday, September 30, 2010
Bezier Curves as Ellipses
I eventually got my head around what that meant and its implication: The standard 2D graphics library doesn't concern itself with center points and radii, or foci, or pi. In fact, it doesn't even render a real circle, but a very close approximation. It renders four cubic Bezier curves representing 90 degree arcs of the circle. I found this discovery strange at the time, but on reflection it made sense.
Tuesday, September 28, 2010
Form validation using custom attributes
Background
A couple months ago, a friend's daughter came to me for help with a website she was writing for a diabetes seminar registration page. The input form needed to ask the user if they had diabetes, and if so, whether it was type 1 or type 2. She was using Dreamweaver, and was having difficulty getting the form to behave correctly with Spry Widgets form validation.
I wasn't familiar with Spry Widgets (or Dreamweaver, for that matter), so I asked her to show me the source code. We hacked out a semi-functional solution in a few minutes, but I wasn't very happy with it. Spry had input validation that intercepted form submit events. You defined some JavaScript objects declaring what input elements were required, and what format they had to be in (e.g., the input must look like a phone number, or it must look like an email address). When you submitted the form, anything that was wrong gets highlighted red, and you have to go back and correct it.
The definition syntax for a single field looked like this:
Monday, September 27, 2010
Building a Java Applet Sudoku Bot
Background
I've been interested in the game of Sudoku since it became popular a few years ago, and have often daydreamed about what approach one could take to programmatically solve a puzzle. Although I'm not an expert player, when I play I find that I see complex hints about what numbers *must* go here, or *can not* go there. Explaining to another person the logic of each choice would be fairly simple, but coding a straightforward approach for a computer to do the same thing had, until recently, eluded me. I have now successfully licked that problem, and have written a moderately functional solver applet in Java.
This entry takes you through the start-to-finish process of the applet's creation. I decided from the outset not to make this a Swing applet, and to manage event handling and painting directly.
Sunday, September 26, 2010
Java Swing applet to calculate Fibonacci numbers
So to help you seekers of assignment solutions, here you go. Study it, though, rather than just copying it wholesale. Maybe I'm not making this as streamlined as I should, or maybe the xor business is too much trouble for the modest speed and memory boost.
First, the working applet:
Saturday, September 25, 2010
Concise Perl
A few days after reading the article, I brought my eldest daughter, then 13, to work with me. She recently started high school, and was hanging out with me in the office completing a summer book summary assignment for an honors class due the first day of school. "Dad, what does 'concise' mean?" she asked me, while looking at the instructions. I replied something to the effect that it meant expressing a lot of detail in as few words as possible. The exchange reminded me of the above blog article, and also of some perl mojo I whipped up a couple weeks earlier at work.
Background
Monday, September 20, 2010
Detecting when a mouse cursor is near a line
First, I'm abandoning all of my "recreational" coding projects save one: a java applet for my wife to design clothes. Building a CAD system from the ground up is painful and slow, and I can't tinker any further with other fun things without sapping creative energy I need for my day job.
In the current early stages of this project, I've been thinking a lot about design, and what I do and don't like about similar programs. One of the things I don't like about simple CAD-like tools is their approach to manipulating existing lines. The line's endpoints are draggable, and so is a single point in the middle, but the line itself is not. Take this screenshot of Visio, for example:
Thursday, September 16, 2010
Quick experiment with Java 2D, JComponents, and MouseListeners
Enjoy!
Thursday, September 09, 2010
Labor Day adventure weekend, and the death of a friend
Thursday, August 26, 2010
Fantasy RPG applet in Java, the early stages
I got the itch to design a game after toying around with Google's App Engine framework. I wrote a slideshow unwrapper for my wife to use when browsing on Ebay or Etsy, which lets you paste in several URLs with slideshows in them, and builds a single page containing all the images. App Engine's "fetch url" function and the ability to execute arbitrary Java code made that a snap. While learning the App Engine ropes, I found that it can serve an applet, and receive an arbitrary serialized object and store it in Google's "data store".
In other words, you can play a game in an applet, and save the game state to the data store.
Wednesday, August 18, 2010
A lightweight Java solution to searching image archives
Sunday, August 08, 2010
Solving the Facebook “Gattaca” puzzle
If you're coming here looking for an algorithm or complete code to solve Facebook's Gattaca puzzle, then first, you're a damned cheater and nobody likes you. Second, they'll never hire you anyway once they realize you couldn't do it on your own. Third, you've come to the right place!
Google assures me that there are publicly available solutions for this puzzle already, and this particular puzzle has been posted in the Facebook careers section for a while now, so I'm going to break with their recommendation to not distribute complete solutions.
Monday, June 28, 2010
My Strange and Awesome Karate Kid Dream
My dream was fairly brief, and a bit of backstory was implied, but not shown in the dream itself: Mr. Han now runs a martial arts school. One of his students is a teenaged girl from a culture not very... how shall we say... "women's studies friendly". (It was unclear where specifically she was from - maybe Iran, maybe an African village. My dreams are ambiguous like that). She had an overbearing father who was waivering between supporting his daughter at the school, and pulling her out to have her veiled, executed for being alone with a male non-relative, circumcised, what have you. Mr. Han, sensitive to her plight, does what he can to keep her healthy and free.