.NET Compact Framework

Ever since I posted my experiences creating software for the .NET Compact Framework back in 2006, I’ve received a steady trickle of thank-you emails. Apparently there are bits of information in there that are (or at least were, at the time) somewhat hard to find.

Sadly the information there has fallen somewhat out of date due to new CF and VS.NET releases, and I’ve been busy on other platforms and projects (Java and much more) since then. If anyone out there can suggest a handful of the best places to learn now about CF development, please do so in the comments below, for the benefit of others reading this page.

Flex version of my overworn “flying boxes” GUI demo

Long-time fans may remember my “flying boxes” demo at the St. Louis Java user group in 2005, or my followup work in 2008, in which I translated that demo to JavaScript (Rhino).

I picked that demo project up again last year and recreated it with Flex 3; you can now try it out onlinedownload the code, or browse it on github. It looks like this:

Click on it to try it “live” in as Flash/Flex.

The interesting part is the drag-drop movement – not my less-then-stellar color and design choices.

Factor Talk at the Lambda Lounge

Last night (April 2, 2009) at the St. Louis Lambda Lounge I gave a 45-minute talk on the Factor programming language. I’ve uploaded the handout and example code here. I apologize in advance to anyone in the Factor community who reads it and laughs at my “newbie” mistakes and misstatements. Continue reading “Factor Talk at the Lambda Lounge”

Incompetence -> Progress

From http://www.theodoregray.com/BrainRot/index.html

“The most profound engine of civilization is the inability of a larger and larger fraction of the population to do the basic things needed to survive.  Many people fail to realize this.”

“Technology’s greatest contribution is to permit people to be incompetent at a larger and larger range of things.  Only by embracing such incompetence is the human race able to progress.”

It’s a good read, with important thoughts on civilization and education.  It is part of the introduction to a book about Mathematica, a truly amazing piece of software. (Mathematica, was amazing when I used it in the 1990s, I can scarcely imagine what it does now.)

Move files into an existing directory structure, on Linux

I recently needed to move a large number of files (millions) in a deep directory structure, into another similar directory structure, “merging” the contents of each directory and creating any missing directories. This task is easily (though slowly) performed on Windows with Control-C Control-V in Explorer, but I could find no obvious way to do it on Linux.

There is quite a bit of discussion about this on the web, including:

  • Suggestions to do with with tar; this is a poor idea because it copies all the file data, taking an enormously long time.
  • Suggestions to do it with “mv -r”… but as far as I can tell, mv does not have a -r option.

After a little thought I came up with the script below. I’d love to have a Linux/Bash guru out there point out how awful it and and send me something better!

A critical feature for me is that it does not overwrite files; if a source file name/path overlaps a destinate file, the source file is left alone, untouched. This can be changed easily to overwrite instead: remove the [[-f]] test.

$ cat ~/bin/move_files_merge.sh
#!/bin/bash

# Move files from dir $1 to dir $2,
# merging in to existing dirs
# Call it like so:
# move_files_merge.sh /FROM/directory /TO/directory

# Lousy error handling:
# Exit if called with missing params.
[ "A" == "A${1}" ] && exit 1
[ "A" == "A${2}" ] && exit 1

echo finding all the source directories
cd $1
find . -type d -not -empty | sort | uniq >$2/dirlist.txt

echo making all the destination directories
cd $2
wc -l dirlist.txt
xargs --no-run-if-empty -a dirlist.txt mkdir -p
rm dirlist.txt

echo Moving the files
cd $1
# There is surely a better way to do this:
find . -type f -printf "[[ -f '$2/%p' ]] || mv '%p' '$2/%h'\n" | bash

echo removing empty source dirs
find $1 -depth -type d -empty -delete

echo done.

Factor

Over the holiday I looked at the Factor programming language, and was very impressed. It has a Lisp-like metacircular quality, and a remarkably wide set of features/libraries in spite of a very small development team and community. Unlike many other small language projects, Factor is fast, rich, and can produce shippable binaries. Its team cares about robustness, and operates a build farm for multiple platforms. If you can spare a few hours, first watch Slava’s Google Tech Talk, then download Factor and work through some tutorials.

Will Factor become popular? With a FORTH-like syntax, I suspect the answer is a firm No, the syntax is too foreign (even compared to Ruby, for example) for mainstream devleopers. But I find it fascinating nonetheless, and I will keep my eyes open for an opporunity to use it on a small, real project.

It would also make a great topic for the Lambda Lounge, a new St. Louis area user group about which I am quite excited.