Bluish Coder

Programming Languages, Martials Arts and Computers. The Weblog of Chris Double.


2006-04-27

Javascript Partial Continuations

I've been playing around with Rhino, a Javascript interpreter written in Java, using it as a server side scripting language. Rhino supports continuations so I thought I'd try and port the bshift and breset implementation I ported to Factor to Javascript.

My initial attempt is in partial-continuations.js.This can be loaded into the Rhino interpreter using:

load("partial-continuations.js")

Rhino's 'load' understands URL's so you can even do:

load("http://www.bluishcoder.co.nz/code/partial-continuations.js")

A simple use of the 'range' example in Javascript is:

function range(rc, from, to) {
 return  bshift(rc, function(pcc) {
               while(from <= to) {
                 pcc(from++);
               }
               return undefined;
             });

function test1() {
  breset(function(rc) { 
    print(range(rc, 1, 5)); 
    return 0; 
  });
}

This works fine printing the number from 1 to 5. I've struck a bit of wierdness with the attempt to translate the CLU-iterator idiom mentioned in my previous post. My Javascript translation was:

function test3() {
  var sum = 0;
  breset(function(rc) {
    var tmp = range(rc, 1, 10);
    sum += tmp;
  });
  print(sum);
}

This works, printing '55'. But if I change it to the following it prints 10:

function test3() {
  var sum = 0;
  breset(function(rc) {
    sum += range(rc, 1, 10);
  });
  print(sum);
}

For some reason the range call is not calling the entire breset scope. It's only calling from the 'range' onwards. Can anyone spot what's wrong with my implementation?

Tags: javascript 

2006-04-25

Jack Dempsey

Jack Dempsey was a famous boxer early in the 20th century. Today I got in the mail a DVD on Jack Dempsey's style of boxing made available by Kirk Lawson on rec.martial-arts.

The DVD is a garage training session led by Ken Pfrenger, a western martial arts instructor. Ken's 'western martial arts' interest covers early bare knuckle boxing, Irish Collar and Elbow wrestling and stickplay and Cornish Close Hugg wrestling amongst other things. Based on his knowledge of Dempsey and Dempsey's book and fights he led a session on some of his techniques and tactics. This is what appears on the DVD.

Some interesting stuff covered, including: * Stance * Center line theory and parrying * The Jolt * Trigger Step * Shoulder Whirl * The Surge, upper cut and shovel hook * Feinting and drawing the punch * The Double Shift * The Corkscrew * The Cross * The Inside Triple * The Outside Triple

As you can see early boxing had its own vernicular seperate from modern boxing. Even 'The Cross' is a different punch being much more like an overhand right.

The DVD is about 45 minutes of material - raw and relatively unpolished - but containing very interesting and useful content to the enthusiast of boxing's history and great fighters. Well worth the low price Kirk is selling them for.

It is interesting to compare the differences style of the early 20th century of boxing versus modern boxing. Dempsey advocated punching with the bottom three knuckles of the fist (vs modern boxing's top two) and many punches are done with a vertical fist.

The Jolt is a lead hand punch different from the modern Jab. The fist is vertical and the power is obtained from a drop step into the opponent.

Many of the punches derive power by rapidly rotating the shoulders, concentrating on bringing back fast the non punching shoulder and thrusting forward the punching shoulder - creating a rotational torque which pushes out the punching hand. This movement being called the 'shoulder whirl'. Described in Dempsey's book, Championship Fighting, as:

One shoulder whips forward while the other whips back. Muscles of the shoulders, back, stomach, legs co-operate in achieving the whirl. Also, the process is assisted by shifting the weight from one leg to the other. You need concern yourself only with the shoulder motions. Nature will supervise the assisting muscles and movements.

...

MAKE CERTAIN THAT YOUR SHOULDERS ARE DRIVING THE PUNCHES; THAT THE PUNCHES ARE NOT PULLING THE SHOULDERS.

According to the DVD Dempsey advocated a open hand position. Rather than keeping the hands in close to the head, protecting the chin. creating a shield like say Peek-a-boo boxing style or Rodney King's Crazy Monkey, they were kept more apart to create a target for the opponent and thus draw his punches to a known point. Parrying the punch then being as simple as a downward parry motion to bat the punch away or a stop-catch with the rear hand followed by a lead hand punch or jolt.

There's some nice coverage of the shovel hook to the body and the upper cut. The delivery style for the shovel hook being to keep the drop down from the knees, keep the elbow of the hooking hand close (or attached to) the hip and torquing with the hips to drive the punch. No movement of the hand or arm away from the hip.

Some nice links to Dempsey in action:

The video of Dempsey vs Willard linked above shows some obvious differences in rules compared to modern boxing. When a boxer is knocked down they get a ten count but the opponent can stand right over them and immediately hit them when they get up. There is no neutral corner rule. In this fight Willard is knocked down seven times in the first round.

Tags: martialarts 

2006-04-24

Building wxFruit and Yampa with GHC 6.4.x

wxFruit is a Haskell GUI library based on Functional Reactive Programming concepts. It uses wxWindows as its underlying GUI framework. For FRP it uses the Haskell FRP framework Yampa.

Both libraries are relatively old and seem to have suffered bitrot as I couldn't get them to compile using a recent GHC build (GHC 6.4.x). A bit of searching came across this post to the haskell-jp list which had some patches to enable these to build. I've extracted the relevant patches here:

These can be applied by using 'patch' from within the original wxFruit and Yampa distributions:

cd afrp-0.4
patch -p1 <afrp.diff
cd ../wxfruit-0.1
patch -p1 <wxfruit.diff

Alternatively you can download the already patched versions I've made here:

To build and install the patched Yampa, the following should work:

cd afrp-0.4
runhaskell Setup.hs configure
runhaskell Setup.hs build
sudo runhaskell Setup.hs install

Once this is done the wxFruit paddle example builds with:

cd ../wxfruit-0.1
ghc --make -farrows -o paddle paddle.hs
Tags: haskell 

2006-04-23

Haskell Gameboy Emulator

OmegaGB is a Nintendo Gameboy Emulator written in Haskell. The author has a devlog where they are posting information about the implementation along with screen shots and source code.

Tags: haskell 

2006-04-19

ZoomIn - NZ Mapping Web Application

I stumbled across ZoomIn today which is a New Zealand map site with lots of interesting features.

You can search with street addresses and get maps of pretty much all of New Zealand and explore via a Google Maps like interface. Included are optional aerial photographs of many of the regions. I like the way it uses Ajax to narrow down a search for an address as you type.

ZoomIn also provides the ability for users to comment on places, upload photo's and annotate in other interesting ways. A nice idea!

For developers they have a REST style API that allows searching for addresses programatically and retrieving the lattitude and longitude of the address found. Other API's seem to allow integrating map data into your own web apps.

Tags: misc 


This site is accessable over tor as hidden service 6vp5u25g4izec5c37wv52skvecikld6kysvsivnl6sdg6q7wy25lixad.onion, or Freenet using key:
USK@1ORdIvjL2H1bZblJcP8hu2LjjKtVB-rVzp8mLty~5N4,8hL85otZBbq0geDsSKkBK4sKESL2SrNVecFZz9NxGVQ,AQACAAE/bluishcoder/-61/


Tags

Archives
Links