Saturday Dec 22, 2007

Chinese learning tool in Java

I found a Chinese dictionary/annotation tool written in Java called DimSum. I ran it on Windows and Solaris. Here's how I ran it on Solaris 10 x86 8/07.

  1. Download DimSum.jar from http://www.mandarintools.com/download/DimSum.jar
  2. DimSum uses public-domain Chinese-English dictionary called CEDICT. The dictionary's was just updated last week. So, replace the one in DimSum.jar with the latest one.

    $ curl http://www.mdbg.net/chindict/export/cedict/cedict_1_0_ts_utf-8_mdbg.txt.gz | gunzip > cedict_ds.u8
    $ jar uvf DimSum.jar cedict_ds.u8
    adding: cedict_ds.u8(in = 3481130) (out= 1436906)(deflated 58%)
  3. Now, I can run it just with 'java -jar'. But if one wants to annotate Chinese web page, start it like:
    $ BROWSER=firefox PATH=/usr/dt/bin:$PATH java -jar DimSum.jar &

  4. I annotated http://cn.sun.com/. It opened a new tab in Firefox. Notice the URL below. cn.sun.com's page was processed locally and served up from local host's port 4445. When I hover the mouse over Chinese word, translation box appears.




  5. Now, there's a small glitch. When the DimSum.jar starts browser, it does it by via /usr/dt/bin/sdtwebclient. Problem is that sdtwebclient doesn't exit even after successful launch so DimSum.jar hangs. Workaround is to kill sdtwebclient like:
    $ pkill sdtwebclient
web/text file annotation is not the only function of DimSum. There's also 'Dictionary' and 'Flashcards'. I'm thinking about adding Japanese translation to the dictionary.

Sunday Dec 16, 2007

creating Firefox 2/IE7 search plug-in for Yahoo! group

One of my Yahoo group I subscribe doesn't disclose its archive to public. E-mails are not getting indexed to Google because its archive is open for search to members only. So, I created search plug-in. I heard there's Firefox plug-in to easily create search plug-ins. But I used a web site called 'Ready2Search' which generates plug-in.

  1. Visit http://groups.yahoo.com/ and go to the group I subscribe.
  2. Submit a search. Confirm that search term appears in URL, which means search was done by GET rather than POST.
  3. Open Ready2Search.




  4. Fill in 3 boxes in the left.
  5. (This part is not mandatory.) Now, I want to assign a small graphic. I decided to use groups.yahoo.com site's favicon.ico file. As it says on the right half of the page, it doesn't accept ico file so I converted to png. I could have saved it to a png file on disk and choose it in the lower box to the right. Instead, I base64 encoded it without saving to disk.
    $ curl http://us.i1.yimg.com/us.yimg.com/i/yg/img/logo/favicon.ico \\
    | convert ico:- png:- | perl -MMIME::Base64 -0777 -ne 'print encode_base64($_,"")'

    % Total % Received % Xferd Average Speed Time Time Time Current
    Dload Upload Total Spent Left Speed
    100 1406 100 1406 0 0 6376 0 --:--:-- --:--:-- --:--:-- 2224
    iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/gD+AP7rGNSCAAAA...(omitted)......
  6. Paste the base64 string to upper right box in the page. Click on 'Read the image text'. Confirm the image.
  7. Click 'Make search plug-in' button.
  8. Click on 'OpenSearch plug-in' in lower left and install plug-in.
Tip for Yahoo! groups search: For many search site like Google, "(double quote) is used for literal search. But for Yahoo! groups, it's '(single quote).
About

The views expressed on this blog are my own and do not necessarily reflect the views of Oracle.

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today