Korean Alphabet Love

2010/04/15

Reading about Korean language representation in Unicode–and wow.

The Korean alphabet is simple enough that anyone can memorize it in an afternoon. The difficult part is that when the Korean alphabet was invented, the only other writing game in town was Chinese, with its square-shaped characters. In theory, it should be easy to read Korean letters linearly–but someone decided that the letters should be arranged in aesthetically pleasing syllabic boxes. Fast forward 600 years, and now each multi-letter syllable has its own Unicode representation.

I won’t attempt to re-explain what that article covers so thoroughly, but I just had to share the best part: when you take a Unicode point (for example, 46239) that describes a single “boxed” syllable, you can deconstruct it into letter components by:

tail = (codepoint – 44032) % 28
vowel/mid = 1 + ((codepoint – 44032 – tail) % 588)/28
lead = 1 + (int) ((codepoint – 44032)/588)

With my random number I picked above, it becomes… “dwetch,” which has no part of any Korean word so far as I know. Internet search yields… 50,000 results of complete jibberish, looking remarkably like (imagine!) someone just rendered random Unicode combinations.

But still. HOT. I love this world.


Starving Artist

2010/04/09

The trouble with passions connected to well-paying professions is that in your early days, there are no comrades in arms with whom you can drink liters of wine and fantasize about finally finding success. Young people who decide to be actors–or writers, or painters–dream desperately about their Big Break, the point after which jobs will fall into their laps and they can buy new shoes at full price and enjoy modest name recognition in their chosen field. In their day-to-day lives, though, their peers are pretty much in the same places they are: working ill-fitting jobs to pay the bills, shopping the store-brand oatmeal, wondering if it’s all worth the effort. They may or may not go on irresponsible benders. The necessity of emotional support is well understood.

Kids who go in for computer science, though, are pretty much snapped up as soon as they can demonstrate the basic skills. Sure, they secretly dream about being the next Dijkstra (who doesn’t?), but I imagine they suffer the indignities of non-rock-stardom from posh digs, with more health insurance than they know what to do with, and enjoy satisfying conversations with their brainy coworkers. Their day jobs may not be glamorous, but they avoid the identity crisis of constantly explaining their nonaligned “calling” and “job”: “I’m a writer, but I work as an accountant.” Plus, when programmers want a break from their interesting projects, they can take a month off to go study a new language in a different country. There are no emotional support groups for coders who crave their own eponymous algorithm.

For now, for lack of a more structured support group, I will redirect comfort from Anne Lamott’s guide for beginning writers, Bird by Bird (New York: Pantheon Books, 1994). Replace “writing” with “coding,” and it becomes eerily accurate:

So I tell [my students] what it will be like… when I sit down to work, with a few ideas and a lot of blank paper, with hideous conceit and low self-esteem in equal measure, fingers poised on the keyboard. I tell them they’ll want to be really good right off, and they may not be, but they might be good someday if they just keep the faith and keep practicing. And they may even go from wanting to have written something to wanting to be writing, wanting to be working on something, like they’d want to be playing the piano or tennis, because writing brings with it so much joy, so much challenge. It is work and play together… [T]heir heads will spin with ideas and invention. They’ll see the world through new eyes… At cocktail parties or in line at the post office, they will … sneak away to scribble these things down. They will have days of frantic boredom, of angry hopelessness, of wanting to quit forever, and there will be days when it feels like they have caught and are riding a wave.

And then I tell my students that the odds of their getting published and of it bringing them financial security, peace of mind, and even joy are probably not that great. Ruin, hysteria, bad skin, unsightly tics, ugly financial problems, maybe; but probably not peace of mind. I tell them that I think they ought to write anyway. But I try to make sure they understand that writing, and even getting good at it, and having books and stories and articles published, will not open the doors that most of them hope for. It will not make them well. It will not give them the feeling that the world has finally validated their parking tickets, that they have in fact finally arrived…

But I also tell them that sometimes when my writer friends are working, they feel better and more alive than they do at any other time. And sometimes when they are writing well, they feel that they are living up to something.

Back to it.


Source Control: Checking IN!

2010/03/17

Fixed my first bug in someone else’s code! Granted, it was a two-line fix of something that the dev could have fixed in about 4 seconds, but the process of going through the code base, finding the right section, stepping through the section (using my BRAIN, because I haven’t found a good debugger yet), and finally realizing where something needed to be checked and returned…

Well, let’s just say there was some victory dancing to The Black Keys ^.^

And now my tutor says I need to check it in–but that sounds scary! I have never checked something in before. What if it crashes everything? Will satellites fall out of the sky? Seriously, folks!

So far, so good: hg commit worked from my end. It’s a cloudy night, though, so I can’t tell if there’s a sudden “meteor shower”.

Rock on!


TRIUMPH (aka, randomly generated text, seeded with Jabberwocky)

2010/03/16

yre and gimble in the wabe;
All mimsy were the Jabberwock, my son!
The Jabberwock, my son!
The Jabberwock, with its head
He went galumphing back.

“And, has thou slain the wabe;
All mimsy were the Jabberwock, with its head
He chortled in hand:
Long time the Jabberwock?
Come to my arms, my beamish boy!
O frabjous day! Callay!’
He went snicker-snack!
He left it dead, and shun
The vorpal blade went snicker-snack!
He left it dead, and with eyes of flame,
Came whiffling through and the manxome foe he sought —
So rested he by the Tumtum tree,
And burbled as it came!

One, two! One, two! One, two! One, two! And through
The Jabberwock, my son!
The jaws that catch!
Beware the Jabberwock?
Come to my arms, my beamish boy!
O frabjous day! Callay!’
He chortled in his joy.

`Twas brillig, and with its head

(cue victory dance!)


Honestly…

2010/03/16

For better or for worse, another brutally detailed schedule will help keep me honest today:

8:35 Drive with roommate to coffee shop

8:45 Walk home–and notice there’s a new sustainable, local butcher shop opening soon!

9:00 Read programming blogs (and Rothfuss).

9:45 Make coffee

9:50 Open geany and start stepping through my random-text-generator code. Maps of maps!

10:36 Worried that the program is printing the same output to screen about a hundred times–then realize, oh, I actually TOLD it to do that. Precisely 100 times.

11:14 Ack! Got distracted by NYTimes again. Thank goodness for Leechblock, reminding me that my 15 minutes was up.

11:38 Most of my functions work! The only time I have problems is when my shortcut keeps biting me in the butt. Which is a good lesson all around. So far, it generates:

butter butter “But,” she batter. If I baked it would make my batter it would make my batter.” So she bat

YES I have the power!!!

11:44 Time for a run. And when I come back, I will start my real project of the day.

12:44 Oh so good! 4 miles in about 37 minutes. I am so proud that I can even run 4 miles without dying; there was a time in the very recent past when I couldn’t even finish 5K.

13:40 Showered and cooked lunch. It’s sad that rice’n’beans are such a cliche; they are seriously delicious, and the cheapness is just a bonus.

13:45 Ok, a softer world is not going to help me code. Time for tea, which will!

14:09 Broke everything! Well, not quite everything. The opening screen now has two errors, even though I thought I commented out all the code I’d added.

14:11 Ok, I found where the files are that the program can’t find–now I have to find where the program calls them, so I can redirect it to MY build (instead of the ‘official’ build). Maybe I didn’t get these errors before because I was running the wrong build?

14:14 Found it! … in a binary file.

14:16 Maybe I can assume these errors don’t matter. You know–this is a good thing to ask The Dev.

14:57 Oh, work email. Lonesome Japanese student, last-minute Colombian requests. and a lovely but inconvenient overabundance of Korean students. What was I doing again?

14:59 Oh dear, and there is inheritance. Another piece I haven’t picked up yet.

15:01 Oo, new fitness routines! Except… these look like they were made with Hypercard last decade. Unfortunate.

15:10 Clearly, I am just wasting time while I don’t know what to do yet. I’ll bend my tutor’s ear tonight, and we’ll work through this first bit together. Meanwhile, I am going to keep coding! But I’ll go back to my ‘fun’ project, since I am determined to finish all these Stanford problems.

15:38 Fine, fine, I will learn how to kill a program running in the terminal.

15:57 No, I don’t want to kill the whole terminal… just my wonky program! I give up for now. I can only take in so many special cases in one day.

16:03 YES. This is how you are supposed to work, my lovely!


Get Back On The Penguin

2010/03/15

So, I am back in that place where I don’t know what to do. I have a good list going, though, of what is NOT helpful:

So, what might be helpful?

  • Open the source code
  • Find the bug list
  • Try to repro the bug
  • Make a new to-do list
  • Make some tea

OK, tea is pri 1.

>>>

Sweet! Now I’ve done everything on both lists, except make a new to-do list. So:

  • Try to find where “search” is written and called
  • Try to step through code… using my IDE that does not step through code. This may be the first time in my life I’ve used this expression, but: d’oh.

Finding the spot where “search” is called…

>>>

Um… O Gods. What?

>>>

No, seriously… what?!

>>>

Holy mother of God… I feel really, really dumb.

>>>

So! “The strcasecmp() function compares the two strings s1 and s2, ignoring the case of the characters,” says you. And you claim that “The variable optind is the index of the next element to be processed in argv.” And you go so far as imply–no, state quite baldly–that “[t]here are at least two arguments to main: argc and argv. The first of these is a count of the arguments supplied to the program and the second is an array of pointers to the strings which are those arguments.”

I had never actually seen argc and argv used! I thought they were just window dressing.

So! We are checking to see whether the string passed in equals some other string, even if we pass in many many things as arguments. We check one at a time.

>>>

Yes, but that doesn’t explain why all these people on the ‘tubes are running around saying:

if(!strcasecmp(doWhatVar, “Do This Thing”)

{

doThisThing();

}

That seems like… the opposite of what it should do.

Is 0 the same as not something? Oh god. How could I be so ignorant?

>>>

This is the part where I remind myself that I am still learning, don’t expect myself to know everything, etc., etc., etc. And maybe pour myself some beer. Because if I’m going to be ashamed and irrationally afraid that I’ll never get a job, I might as well do it with a tasty beverage.

>>>

Why are there slashes everywhere? Do I know this language at all?

>>>

Oh… slashes are line continuations inside a giant macro. Haven’t used macros before. That explains a lot!

>>>

Now there’s the part where I wonder if the answer is to soldier on and Get Back On The Penguin, as it were, or take a break and come back all fresh-faced and dewy. If it weren’t 11 o’clock at night, I’d go for a run. Maybe instead I’ll do some pushups. And ask my ever-patient roommate for help. And then maybe… maybe sleep.


Note to Self

2010/03/15

If you start an informal professional blog–one where you hope to express your trials and triumphs as you struggle with motivation, bang your head against intellectual challenges, and occasionally mire yourself in idiocy–think carefully before sharing the address with an immediate supervisor. It makes it impossibly awkward to start an entry with: “Well! We have a status update meeting tomorrow, and instead of working this weekend, I enjoyed sunshine and hung out with friends and read Terry Pratchett and took naps. Although, come to think of it, I DID do one programming project… but it was just for fun.”

No, but this is part of the tradition of openness I am trying to cultivate: a balance between “Goddess of Perfection” and “Dirty Secrets: Two for a Nickel!”. I tend to err on the impeccable side, but I’d learn more if I were more honest about my flaws. (Future Coworker: “The new girl has a near fatal weakness for Latin rhythms–maybe we should have an intervention!” Other Future Coworker: “Seriously, how can she code while dancing in her chair?”)

On the other hand, I’ve got one big strike against me already (<– liberal arts degree), so shouldn’t I be trying to balance that out with an airtight degree of awesomeness? (Future Coworker: “She may be a French major, but she sure never gets distracted by the internet!” Other Future Coworker: “I heard she won’t even read xkcd till she retires!”)

Bloody hell. Again, I think the answer is clearly to acknowledge my flaws, and be damned sure I am working to fix them. If the carrot of “satisfaction in a job well done” fails, the stick of “self-induced public shame” may just come in handy ~.^

So, what? Stop writing and start working? Ja.