12/29/2004

RikaiXUL update (use Rikai-functionality directly from Firefox)

(note: this article is out of date. Please see http://rikaixul.mozdev.org/installation.html for the latest version)


I've taken some of the new popup code, merged it with the code I used to have in RikaiXUL, and now you can have Japanese popups on any web-page without ever touching rikai.com
Install RikaiXUL v0.4

Released under the GPL.
To use:
- you MUST use the firefox browser.
- go to a Japanese web-page you want to read.
- right-click, and choose "rikaixul!" from the popup menu, or use tools/rikaixul! from the main menu.
- mouseover to see popups.
- use shift-rightclick (technically, any mouseup event not on button 1) to pop up information on a single kanji

thats it!
This is released under the GPL.
Please let me know if you use this in an educational setting (you may, you may!).

12/27/2004

New popup method released under the GPL

For the Japanese Rikai site I've developed a new way of doing both the popups and the mediation (i.e., proxying the web through rikai.com). It turns out this is all much simpler when done in Javascript in modern browsers, as I can let the client parse the html for me.

Here's the source:
  • Adding popups for Japanese
  • Rewriting URLs to point back to Rikai.com

    You're welcome to help get these work faster, integrate into Mozilla, or whatever..
    Some notes:
    - the popups load from a small script at http://www.rikai.com/perl/popup.pl. Because of browser security features, this will not work if the main page did not in the rikai.com domain. If you need popups to help develop, you'll need to repoint this at a local file or something.
    - the mediator points to a script at http://www.rikai.com/proxy. I have not as yet released this script as yet, but it does little other than spit back the html from the mediate_uri parameter, plus the small amount of javascript to add popups and repoint URLs.. Currently, that amounts to:

    <script language="JavaScript1.2" src="http://www.rikai.com/mediate/mediate.js">
    </script>
    <script language="JavaScript1.2" src="http://www.rikai.com/popups/popup-script3.js"></script>

    at the start of the body, and:

    <script language="Javascript1.2">addPopups();</script>
    <script language="Javascript1.2">proxyMediateAll();</script>

    at the end.
    It also plops in a base href tag so that relative path images and such load from the original server.
  • 12/17/2004

    Rikaixul -- The Rikai plugin to Mozilla

    (note: this article is out of date. Please see http://rikaixul.mozdev.org/installation.html for the latest version)


    Excited by XUL, I started to write a mozilla browser plugin to do what rikai does. The project is archived at the mozdev rikaixul, but I gave up on it after a while (and having a kid). It is functional, and in some ways better than the web-page (more below).

    Well, I'm happy to report that much of the code lives on in Moji, which is very close to being what I was trying to do. It includes all the dictionary and lookup code, even cleaned up a bit. But for some reason, Erwin (the maintainer) has never plugged in my mouseover code from rikaixul. All that needs to be done is to have a button which goes through the DOM of the main document and adds javascript callbacks to show that kanji and/or look up words from that location (just put the next 10 chars as an argument into the callback--since it's all local, the size of the doc isn't a big deal).

    All the dictionary/word lookup code is there in rikaixul for the taking. This actually works better than Rikai, because I just try to look up words from whereever you point the mouse. I.e., rikaixul made no attempt to segment the Japanese. I found this actually made it easier to use because I can always parse things better than any automated method, and so didn't as often get hung up on bad segmentation.

    Anyway, from time to time people ask how they can help. I really hope someone will pick this up and add mouseover functionality to moji (though I guess then mozilla users would never use this site, eh?).

    The colored diff "replacement" I've used for years

    If you use a color xterm (most modern ones are), try colordiff instead of sdiff. I'm kinda proud of the simplicity--it uses a gnu diff feature meant for C code and replaces the #ifdefs with some ansi sequences. The result? A quick color comparison of files.

    12/16/2004

    unistrok file

    Ah ha! I found the unistrok file, the original file full of stroke data for several thousand characters that I spent so much time typing in (when I should have been studying). Since JavaDict had the preprocessed versions without documentation, I was always getting asked about this.
    A little late I suppose :)

    DOS games I wrote in 93 or so

    NBall, a clone of the old Lucasarts game BallBlasters/Blazers or whatever, but with texture mapping to give it a bit more realism. Still works for me, though I can't find the source code to this. The opponent ship is a raytraced romulan I think. :)

    XStar, a top-view shooter. I can't get this running correctly on NVidia, it doesn't seem to like the VGA tricks I did back then. But it worked on another box I tried with dosbox. Includes source code.

    If you want soundblaster sound, or have trouble with these games otherwise, you might have better luck trying to run it from within dosbox, a program made just for this purpose (running old DOS games).

    I'd really like to find the old StarCastle game I made. Somewhere on the net I guess... Wish I'd kept all the really old classic computer stuff. Who knew there'd be emulators?

    Obviously ignore any cheesy "shareware" notices on these things.

    JavaDict, a Jap<->Eng dictionary package with HW recognition

    JavaDict was another little toy I made in grad-school to avoid actually studying Japanese (who had time for that? I was a CS guy!). I can't change that page at the U of A anymore, but I'm content to let it live there for now.

    It won me a laptop from IBM. Funny story--a year after the contest they sent me a laptop model from a year before the contest. It was clearly refurbished, not even in a proper box or with documentation. Then they reported it at it's new value that it sold at originally. So I ended up paying $2K bucks (in taxes) for a refurbished 2 year old laptop. Some prize! Is that how all these things work?

    Anyway, the beauty of the GPL is that elements have been ported to/incorporated into lots of other programs:

    • Robert Wells wrote a palmpilot version of the HW recognition
    • WaJei, which I haven't tried, uses the input method
    • KanjiPad is a x-windows proggie which uses the HW recognition
    • Here's a port I found... Is this for a handheld? That was my dream for this thing
    • Pocket Kanji, another PALM version of the HW recognition
    • Yudit, a text editor, uses the HW recognition for Japanese input
    • Some fellow named Marshal Ramsey made a version of the H/W recognition for the web, hosted on Master Jim Breen's site. Marshal added some very good kana recognition, wrote a paper, and got a PHD. But he didn't GPL it! Jeez. What do people think, should I tell Jim to take it down?
    • PADict, yet another PALMOS implementation of the H/W recognition.

    I have one request to all of these fine folks... If your application can interact with the 'net at all, please give people a way to contribute their actual stroke data to a public database. Real stroke information would make it possible to write real handwriting recognition algorithms (mine's a hack of sorts).

    Bogged.. A free boggle implementation for Linux/Unix/etc.

    Actually, it's possible to run on Windows too (perhaps with minor editing of the startup) if you have wish (part of tcl/tk) installed.

    I haven't touched this since college, but it still works, so now bogged lives here forever.

    Enjoy!

    Object oriented KSH

    I've decided to start off my programming tools page with a tip, something I've never seen anyone else implement or use, but which I find extremely useful.

    I'm a pretty heavy shell user in my day to day work, and use databases a lot (Sybase in my case). I never liked the GUI sql shells, never quite got used to starting emacs to use sqsh. Dammit, I like the shell. I figured there has to be an easier way.

    Sorry I can't post the code, but the trick is to write the function S:
    function S {
    ...
    eval 'function '"$1"' { (
    my_isql_like_thingy '"$2"' '"$3"' '"$4"' ...
    )}'
    }

    The idea is that I can run:
    S mytag SERVER DB USER PASSWORD

    and then whenever I want to run sql on that database, I need only run
    mytag '... sql ...'
    and I can use all the ordinary shell mechanics for editing the line, redirecting, loops, etc...

    Step 2: simple enough... In your startup .rc file, autodefine a bunch of these for the databases you use most often.

    Step 3: write a kick ass my_isql_like_thingy... Mine can present the data three different ways, bcp in/out raw data on stdin (streaming so you can bcp out with one sql and into something else at the same time), or list tables or procs or views, print the text of tables or procs or views. So, e.g., I can whip up simple scripties like:

    for p in $(p2 print views | fgrep Equity) ; do
    print "*** $p"
    p2 cols "$p" | fgrep -i tick
    done

    in a flash...
    Anyway, I find this useful. Where I work is a Sybase shop though, so even if I made a generic version who would care... Anything like this for mysql?