Digital Archeology

04 February 2023

Floppies

Nostalgia for Old Code

I’ve been coding for a very long time, so I’ve had lots of projects in various languages, on various platforms, and stored very differently.

I got nostalgic on and off over the past couple years and went digging around to recover the source for some of those old projects. I uploaded the more notable projects to my GitHub account.

Old Floppies

I spent money to buy a 3.5-inch USB floppy drive and an old 386 PC with a 5.25-inch and 3.5-inch floppy drive, so I could ultimately copy files from really old 5.25-inch floppies that I used in the late 1980s and early 1990s to my live storage of today. Among those old files were binaries and source in GWBASIC and QuickBasic.

QuickBasic

I found one of the first games I wrote and sort of distributed, Gravity Blocks. I could play the compiled binary with DOSBox and read the main source file, but some of the source code for my common libraries is still locked up in a compressed format from QuickBasic 4.5. I may need to dig deeper into QB64, a clone of QuickBasic 4.5 that seems to be able to read, run, and compile those old compressed files.

GWBASIC

I also found source code for the first software I wrote for the local fire company to help track statistics on calls and print reports to submit to the local municipalities we served.

It was written in GWBASIC, so I was able to decode the compressed source where needed to read it. I published my CALL-REP source, so I could go back and have a look at the simple, but useful, things I used to write as a kid.

Copies of Old Servers and Subversion

I continued to build stuff through college (and obviously beyond). Some of it was in C, PERL, and Java.

I recovered these bits of source code laying around in backups and copies of old Linux servers I’ve run over the years. This source was in old Subversion repositories that used old versions of Berkeley DB. Initially, This BDB version mismatch kept svn checkout from working, but the current Subversion tools have an svnadmin recover command that could fix the repository for normal reading today. I’m sure some of those old SVN repositories had previously been migrated from CVS.

Java

I found the source code from my final project in the Java class in my last year of college in 2000.

Pop-a-Prof is a clone of my favorite puzzle game, Bust-a-Move. It’s a Java Applet that ran in Netscape allowing any number of players, and it coordinated everyone’s play with a shared public server, Each round lasted 5 minutes, and any time you topped-out, you’d lose some points, and start over, so no one needed to sit around watching the last people battle it out.

After school, I started on Pop-a-Prof 2. This one ran as a plain Java application, and implemented rebounding balls in the game. It was more of a proof-of-concept for the new game mechanics, and it never got network play.

Java ME

I liked running little bits of code, like applets did, so I continued into writing Java ME (J2ME) for my feature phones around 2005.

I did a gas-logging app that stored fuel-ups and drew graphs to show fuel economy.

I also wrote a quick little game called Ben’s Backhoe to give the kids a little something to do on my phone. By the time I was building this sort of thing, though, I’m a decent Java programmer, so it’s not the fun mess that we see in the other old project.

Still More

I spent most the day poking around at various old BASIC files and trying to tweak them a bit to run in PCBasic or QB64. I used lots of weird graphics modes from the Tandy 1000 and didn’t think much about portability. I may post more projects over time.


Java Joyless

27 January 2021

Mr Haki has a Java Joy article about transforming a stream of strings into a map using functional Java. I’m having a bit of trouble embracing it enthusiastically, since each example is 81 lines of Java code and a pointy pile of type declarations!

I dashed out the same functionality in 4 lines of Clojure, and I can understand it a whole lot easier. I’m not even sure this is the fewest forms, but it’s still nicer.

  (->>
    ["language" "clojure" "username" "john"]
    (partition 2)
    (reduce (fn [m [k v]] (assoc m k v)) {}))
  ;; => {"language" "clojure", "username" "john"}

Update 2021-04-14: It can be done in one line of Clojure.

  (apply hash-map ["language" "clojure" "username" "john"])
  ;; => {"language" "clojure", "username" "john"}

Written with Clojure 1.10.2.


Missing Classes in IDEA

25 November 2019

I use InteliJ IDEA for work when working on Java code. When the IDE doesn’t work, though, it’s incredibly distracting.

I had a problem where IDEA would not find a few auxiliary classes in my application. It would highlight them as errors in imports, and the search would find the source file, but technically not the class definition. I’d poke at the problem over a couple weeks, but I’d otherwise ignore it most the time until it seemed to be losing more and more of my classes, some of which I was actively modifying.

Re-importing the project’s Maven build didn’t fix it; re-cloning a brand new project didn’t fix it; and re-installing IDEA didn’t even work. Finally, I found IDEA’s config directories, and wiped those out to start over, and that cleared up the problem: I was able to find all my classes again.


Quick and Easy Groovy for the Web

22 June 2011

Groovy can be used pretty easily to spin up some simple web pages in almost the same way one would hack out some PHP or JSP without going to the trouble to do an all-out Grails project.

The Groovy Servlet allows you to pack up the groovy-all-*.jar, a simple web.xml, and whatever *.groovy scripts you want and deploy it right into Tomcat as a plain WAR file. The Groovy Servlet page

Here's a bit of a script I put together to jump start a simple Groovlet project by packaging a WAR file from a directory of scripts. This isn't Groovy Servlet code itself, but just a command-line tool. (The Groovy Servlet page linked previously has examples for writing your own servlets.) This script will copy in the Groovy JAR and generate the basic web.xml to wire up the GroovyServlet to dynamically execute your scripts. I also have a downloadable copy of package_groovlet.groovy.

#!/usr/bin/env groovy

if (args.size() < 1) {
    print """\
        |Usage: package_groovlet.groovy <war-name>
        |Package the current directory into a Groovy Servlet war.
        |""".stripMargin()
    return
}

def war = args[0]
def embed = "${System.getenv()['GROOVY_HOME']}/embeddable"

def ant = new AntBuilder()

ant.sequential {
    delete(dir: 'build')
    mkdir(dir: 'build/WEB-INF/lib')
    copy(toDir: 'build/WEB-INF/lib') {
        fileset(dir: embed) {
            include(name: 'groovy-all-*.jar')
        }
    }
    copy(toDir: 'build') {
        fileset(dir: '.') {
            exclude(name: 'build/**')
        }
    }
}

new FileOutputStream('build/WEB-INF/web.xml').withWriter { webxml ->
    webxml.print """\
        <!DOCTYPE web-app PUBLIC
          "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
          "http://java.sun.com/dtd/web-app_2_3.dtd" >
        <web-app>
            <servlet>
                <servlet-name>Groovy</servlet-name>
                <servlet-class>groovy.servlet.GroovyServlet</servlet-class>
            </servlet>
            <servlet-mapping>
                <servlet-name>Groovy</servlet-name>
                <url-pattern>*.groovy</url-pattern>
            </servlet-mapping>
         </web-app>
     """.stripIndent()
}

ant.jar(destfile: "build/${war}", basedir: 'build')
println "Created build/${war}"


All the Posts

February 2023

January 2021

November 2019

June 2011

September 2010

January 2010

February 2009

June 2008

March 2008

January 2008

December 2007

October 2007

August 2007

June 2007

May 2007

April 2007

March 2007

February 2007

January 2007

December 2006

November 2006

October 2006

September 2006

August 2006

July 2006

June 2006

May 2006

April 2006

March 2006

February 2006

January 2006

November 2005

October 2005

September 2005

August 2005

July 2005

June 2005

May 2005

April 2005

March 2005

February 2005

January 2005

December 2004

November 2004

October 2004

September 2004

August 2004

July 2004

June 2004

May 2004

April 2004

March 2004

February 2004

January 2004

December 2003

November 2003

September 2003