Kongzi Beta-8 announced for June

Okay. Kongzi Beta-7 has been in classroom-use testing for about 6 months now and it seems pretty solid. A lot of changes have gone on under the hood. It’s using a database for the main type of save files now and you can merge (import) data from other files without destroying your user info. This will be tuned as time goes by, but as of now it is solid for general use.

Image

All the quizzes have gotten a swift kick up in power, they now don’t just present random items but will sometimes present items which are similar to the correct answer. To do this I have created an engine which analyzes the user’s expected knowledge level and searches for similar words .This works in any language and with sentences (shown below) as well as with words (shown above).

Another thing which I’ve done is add the list of test mistakes to the score screen for easy studying. The following example is from the dictionary I use to teach “Let’s Talk in English” to Chinese students.

Image

Once I give the manual a once-over and double check a few features on my to-do list, I’m going to have to start looking at how to package this beast.

For one, I plan to blow away the competition by offering a companion textbook with preloaded vocabulary. The MCI Chinese project (see the navbar up top) isn’t dead at all and has actually expanded with sister projects such as MCI Japanese and so forth. Here are some shots of the MCI Japanese book, “Welcome to Japanese”:

Image

Image

Image

Image

As you can probably guess I’m really excited to have reached this point in the Kongzi project and I will be able to package and offer these materials to YOU (well, to anyone) very soon. Target is this summer, around June for a complete Chinese/Japanese/Korean package which will take you from step one to “fluency”.

Thank you for keeping patient all these years. The wait has been difficult for me, too! But it is almost ready now, for real!

Populating Trees and Lists in Java

I’d like to comment on what went into the new Font Chooser dialog for Kongzi Beta-5. The problem can be posed as follows:

Create a dialog box that takes, as input, existing data.
Complication: Selecting a value on some lists will change the contents of the others.

Obviously this sort of design pattern would have important usages; configuration boxes, persistant user profiles, and so forth. Or, for example, a specialized Font Chooser – which is the example I’ll discuss. Take a look at this screenshot from Kongzi Beta-4:

Kongzi Beta-4 Japanese Fonts

I remember how fiendishly difficult this was to code the first time around, so the second time around I was prepared. The problem would be that I had to follow a special order: populate the language box, select the language, then use that event to populate the font box. But then I had to interrupt the normal order of things and populate the font box before I selected the font from pre-existing data. I couldn’t think of a way to do that without cutting and pasting code or creating a very convoluted logic.

But worrying about that before I wrote any code would drive me insane. So I plunged in head first, fleshing out the dialog box in Netbeans, then adding several methods to find and select values in the list, such as “SelectLanguage(String)”. That way whenever I wanted to, I could populate the dialog box with pre-existing data, in this case, the language and font data that had been selected previously. This is important, of course, to provide a smooth user experience.

Then the nasty null pointer errors started. Basically because of the logic/flow problem I described above. The logic for populating from pre-existing data, and the logic to modify itself based on user input, was too difficult to reconcile. When I tried to populate language, the size box wouldn’t be populated yet, so I couldn’t preview sample text for the new language. If I tried to populate the size box first, this would also trigger a preview event which would crash. The workaround in Kongzi Beta-4 was to include a preview button as shown in the above screenshot. Then I was technically excused from having to do anything. But just because I put a button on it doesn’t mean it wasn’t a giant kludge. For Beta-5 I wanted something smoother. I wanted to use the same logic at all times, the same entry points, and I didn’t want a preview button. I wanted selection events to populate everything.

The key to my final solution was in realizing that when I sent commands to the lists, such as fontList.setSelectedIndex(i), I was going to trigger events which would send me back into the auto-population and auto-selection methods. This is how it had to be, to avoid cutting and pasting code, making a terrible mess. Yes, I wanted to follow “accepted practices” of reusing the same code which auto-populated the lists to accept events and propagate their own data to other lists. Doesn’t everyone?

The first idea I had was checking for null pointers and then skipping over those lines of code. I rejected this almost immediately because of the difficulty it would present to doing any sort of error checking. I would in essence be assuming that any time I encountered a null pointer, I knew why it was there; and that was simply untrue. To write proper code, I would then have to write a second check to determine if the null pointer was there because there was a bug, or simply because the dialog wasn’t fully populated yet.

Or, as an aside, populated properly. I saw the potential for sloppy logic to start creeping in, caused by my abuse of checking for null pointers. In horror, I imagined several cases where entire blocks of code would never execute because they would always be called at a time when null pointers were there. I imagined terrifying cases where a population function would be called four, five, or more times, each time getting sent back with a null pointer, until the dialog was finally ready to accept the input. I recoiled from checking for null pointers, and resolved to find a better way.”

After staring into the monitor for a while, I came up with the idea of using boolean flags to keep track of what procedure I was in. The solution worked like a charm. I created several class-wide variables such as “boolean populatingFontList”. Any time a method dialog was performing an operation on a list where the selection would change as an unintended consequence, I simply set “updatingFontList” or “updatingSelectLanguage” (or whatever) to true. Then, at the beginning of that function (and any other appropriate place) I would put in a clause which prevented anything bad from happening. Usually something like “if (updatingFonts) return;” at the beginning of a troublesome function.

populatingSelectLanguage = true;
selectLanguage.removeAllItems();
populatingSelectLanguage = false;

Then when the program fires off it’s little events as a result of you removing whatever item was selected, you wont get an error because the font list isn’t populated yet. And so forth.

Kongzi in Korean?

Kongzi Beta-4 Screenshot

Kongzi is, of course, designed to deal natively with all languages. But it’s often easier said than done. I don’t know a single program that works equally well in both Chinese and Japanese. Anki for example doesn’t recognize tones properly (and neither does Stackz) and Stackz still displays simplified Chinese even after i’ve selected Traditional mode.

Well I’ve made sure problems like this don’t happen when you use Kongzi. Thanks to suggestions I’ve received from the Beta Testers, Kongzi now works equally well with Japanese, Korean, and Chinese. See for yourself:

Kongzi Beta-4 Japanese FontsKongzi Beta-4 Korean Fonts

Now, you can make Kongzi look however you want! What’s your favourite font for Korean, Japanese or Chinese? Kongzi can use it and make you feel at home.

The Font Chooser for Kongzi is incredibly intelligent. It automatically detects any fonts you have installed on your system which support the language you want to use. I’m very proud of it and I hope that it will satisfy user’s expectations well.

On the other hand, after reading Designing a Better Font Selection Widget it seems that what I have actually done is stumbled upon how the Mac has been doing things for years…

Doing things this way is very convenient for me as a programmer too. Auto-detecting your fonts lets me escape from having to distribute and install special fonts with the program. It is much easier to provide links to fonts on the internet than to distribute them in a zip file.

When will it be finished?

There are three important things I want to do with Kongzi before I release it.

1. I want to put in a help system.
I think it’s almost required for a good program to have online help nowadays, as well as in a pdf file or printed manual.

2. I want to create a Sample Dictionary & shortcut file
To help people jump right into learning with Kongzi, I want to provide sample “starter dictionaries” for Chinese and possibly Japanese & Korean as well. Giving users a blank slate wouldn’t be very fair. To this end I’m currently thinking about giving Kongzi the power to import dictionary files like JMdict/EDICT or CC-EDICT. That would solve all my problems in one fell swoop (except for users who want to learn Korean, or anything else not Japanese or Chinese).

3. I want to put in a “Phrase of the Day”
Simple enough to implement. But related to this is improving support for bigrams, phrases, idioms, etc. Right now Kongzi works really well for single character entries. But if you throw bigrams or phrases into the mix, some aspects might break. For example the Memory Game. It won’t work with phrases. Bigrams – maybe. Also, it would be pretty obvious during a multiple choice if long phrases and single characters were mixed. This will take some thinking I suspect.

Realistically the above won’t take me more than a couple of days if I sat down and just did it. I could probably toss in an internalization template during that time, too. But working on this program is starting to drag since it’s almost finished and I like to code rapidly. I spend at least 90% of time playing video games and scheming to corner the stock market. Plus I do have a “real job” outside of moonlight hacking. So when will it be done?

Well I also plan to distribute “Welcome to Chinese”, my MCI Chinese textbook, with the “full” version of the program. I’m also going to design a website to launch this. So all things considered at least a month.

I also have to stop myself from using the program – i’ve begun to spend entirely too much time using it myself instead of working on it. Hehehe 🙂

Kongzi’s Calligraphy

It would appear that my quest for an Icon is now over.

Han icon image in png form

I couldn’t believe my luck – as it turns out someone I’ve known for years is not only a well-known Chinese Painter, but a Calligrapher as well. The subject turned to Calligraphy and learning Chinese. I mentioned my program and he offered to write a few words for me to help my program and to help people learn Chinese. I mean how cool is that? Here’s how I’m planning on using the above work:

kongzi-icon.png

This word is “han”, with a falling tone. It means writing brush, or writing, in a literary sense. I think it’s a clever play on words – “hanlin” (writing brush forest) was the name of the Imperial Academy of Scholars in “Ancient” China. So you have a sense of being a part of this great literary tradition, in Chinese. What a great concept for this program. Now all we need is a few ants to help teach us Chinese and we’ll be golden 😉

Needless to say the reference fits well with the name of the program, “Kongzi” (Confucious). Oh and speaking of Confucious, here’s another sample of the Calligraphy:

Kongzi Beta-4 About Box

I plan to add more to the program before release. But hey, isn’t it beautiful? I think so.

Would you like custom calligraphy done? I can have it arranged. Send me a comment on this blog, or an email. Good luck and thanks for stopping by!

Kongzi Beta News

So much work has gone into Kongzi Beta-3 I almost want to call it Beta-4. But I’ve decided to hold off just a little while longer until the Memory Game is done. Yeah, Memory Game. I don’t know a single program which has that capability – Kongzi might be the first. Check out the new Mix ‘n Match Quiz type i’ve designed. It’s similar to one of Stackz’ features:

Kongzi Beta-3 Quiz MenuKongzi Beta-3 Mix ‘n Match Quiz

Pretty cool huh? Yeah I thought so too. It’s drawn attention to the fact that I need to let the user configure his own fonts; especially because CERG Chinese/Bitstream Cyberbit don’t appear to support Japanese characters; that’s inexcusable for a program purporting to support any language natively. So that will be added in Beta-4, and Beta-4 will begin right after I finish the memory game (which is about 25% done).

Kongzi Beta-3 Flashcard Quiz

I’ve also done a lot of work on the new “Flashcard Quiz” system – which is very similar to how Stackz or Anki does quizzing. It starts by presenting a character, and you can select if you either know it or not. Or you can press space to reveal more information like phonetic or definition. I’ve allowed you to use the mouse or keyboard here – left click = known, right click = unknown. Middle button reveal information. It’s fun and fast for breaking in a new dictionary; props to Louise Brenner for convincing me to do this. I still have to take another look at Anki though. Although it’s rather limited in some ways and crashes a lot, it looks amazing and seems very user friendly – far more so than even Stackz, which is a commercial program. That being said once I got to learn Stackz it was just as fun and fast as Anki or any other program.

Also in Beta-4 I’m thinking of adding internationalization support. This would be important because the program can also be used to study English using the reverse quiz option:

Kongzi Beta-3 Configure Quiz 2

Reverse quiz is explained fully in the user manual (I haven’t uploaded the latest version yet, however). For the uninitiated, it means that if the quiz is, say, a definition based quiz, instead of the (hanzi or hiragana or whatever) appearing as the question, it will appear as the answer; and the definition will be used as the question. How cool is that?

This will allow me to beta test the program in some of the local cram schools. This feels like it could be very powerful for me; where I work there are some computers and the kids are encouraged to play English “learning” games on them like spelling games, whatever. Hell I might even get my first sales locally (I was imagining getting them on the internet). So yeah localization support is inevitable in Beta-4, I would think.

But when am I gonna let you guys taste the rainbow? I honestly don’t know. I don’t want to release a product with sucks because I’m going to be charging money for this, and first impressions count alot in this market. It’s definately almost ready though. It’s fun to use! And I feel much more secure releasing it now that I’ve removed all that netbeans actionmap garbage – it shrinks, obfuscates and optimizes quite nicely now.

I am considering making some UI changes too, like making the dialogs internal to a frame and maximizing the frame. The UI seems a little weird in that the main window never changes. Why is it there? To hold a jmenu? Hmm, a little redesign might go a long way in that department. Windows users aren’t used to this style; I think they would expect a full-screen application like msword or something, even if it didn’t have a lot of features. Maybe I will redesign it graphically similar to glGo or CGoban 2/3. Those kind of graphic menus are interesting and can look very professional.

Ehh well i’ll keep posting updates – and please do contact me if you want to beta test this software. These kongzi pages get a lot of hits (many times what my old tai chi blog would get) but far fewer comments (than the tai chi blog). I guess that’s the nature of this market.

Netbeans 6 Form Designer is Broken

I’ve been using Netbeans 6 (and previous versions) for several reasons but recently my loyalty suffered a massive blow. Simply put I had a run in with the netbeans form designer. You know, that gui builder tool they have. Don’t get me wrong it WORKS, kind of, but what happened after I tried to compress the code for distribution was a nightmare.

Netbeans 6 uses a horribly broken design paradigm for buttons. This is extended on to subclasses and related classes of buttons, such as menu items in a jmenu. What they do is they use some kind of weird reflection technique – for absolutely no reason. Seriously. What makes it worse is that they use inner classes to declare actionlisteners for things like valuechanged on a jtree or list. This is a real mind job because there is no real difference between this and declaring inner classes in the exact same way and NOT using actionmap.

In fact it could be argued that the reflection/actionmap/@action crap is inefficient from a profiling standpoint compared to using inner classes to call methods.

I mean heck – if you are gonna declare anonymous inner classes to call a function for something like a value change on a jtree why the hell would you jump through fifty hoops to use reflection to call a button handler or menu item handler? It doesn’t make any sense. It’s a bloody greyed out collapsed uneditable code block. Why not make it easy on people who will use the code with real world applications? You know like yGuard or ProGuard?

I’m currently in the process of breaking my code away from crappy Netbeans 6 form designer.

I was also pissed off how the form designer locked my code into using netbeans 6. Seriously that jdesktop stuff is GARBAGE. There is no reason why you need it. None. You have .form files for god’s sake, put any data you need in there and keep it out of my lib directory.

But now I don’t need .form files anymore. Oh, yes, I will use them to design and prototype, but the final product won’t use them.

And I swear I’m going to try out eclipse later on and I know my code will drop in compile (or should) because it won’t be using any IDE-specific libraries (!).

I miss kawa. I really do. Life was simpler.

Get off the computer!

Two months ago I wrote about the difficulty in selecting a small and efficient vocabulary for my MCI Chinese textbook and software (The Missing Link). The question was how to precisely determine which characters should be in the first book. I already have many frequency studies which I’ve conducted and also some ones in books like 6000 Chinese Characters (an excellent book – by James Erwin Dew). But something was missing – I hadn’t yet convinced myself that the most common 200 or 250 characters from the frequency study were the best ones to use.

I had gone so far as to think about writing software which would let me drag chinese characters around from pile to pile visually. Then it stuck me. “What is it exactly that I am doing?” I was playing with flashcards.

Gee, it’s so simple, I never would have imagined you don’t need a computer to do it.

I guess it’s time to take a break from the computer, and spend some time with my flashcards. While I’m at it, I might as well spend some time with my family – after all, it’s New Years.

Happy new year!