Wednesday, September 9, 2009

Moving to Wordpress

I've decided to move my main blog here, akuyume/inside, to Wordpress.

So check me out now on Wordpress!
akuyume/inside on Wordpress

Monday, September 7, 2009

Facebook Chat's Bold and Underline Text and Prodding Facebook Chat on a mission

I never noticed this before, but by placing asterisks around a word in Facebook Chat will bold the word, and placing underscores around one will underline the word. My first instinct was to figure out how to type italic text. Well a few Google searches showed that other people were looking for it as well; so I decided to go "straight to the horse's mouth," so to speak.

Figured the first place to start the search was in the messages that relay chat and see if the HTML conversion takes place there. Now mind you I've already poked and prodded Facebook Chat's message relay server before. Its a MochiWeb server, which you can see in the HTTP headers for chat packets. For more background specifics on the setup that is Facebook chat, see Facebook's engineering blog.

Server: MochiWeb/1.0 (I'm not even supposed to be here today.)

Anyhow, by reading the HTTP packet flow, I can get the "raw" information that the webpage uses to talk to the server. These I believe are in JSON although don't quote me on that, suffice to say I can at least read enough of the raw information they contain to see the message I just received. And sure enough these contain the text just as they would have been typed, that is, asterisks instead of HTML bold tags and underscores instead of HTML underline tags.

So, then this tells me that the replacement of "Facebook Chat style markup" takes place in the user's web browser. Problem is, there's a bunch of JavaScript files attached to any Facebook page. Fortunately for me though with Firefox with the FireBug extension the process of analyzing a web page's code is fairly streamlined.

Going straight to the code generated for a chat window, I noticed that the "pic_padding" class is on each message's node (which happen to be paragraph elements). So I searched for this class in the JavaScript given that is was the best lead I had. Fortunately this lead turned out results.

var pendingElementID=pendingMsgID?' id="pending_''_'+pendingMsgID+'"':'';markup+=''+

And just a couple lines below that, ta-da!

_processStyledText:function(textProcessor,str){return textProcessor(str).replace(/\b_([^_\*]+)_\b/g,'<u>$1</u>').replace(/(\s|^)\*([^_\*]+)\*(?=$|\s)/g,'$1<b>$2</b>');}

Yep, regular expressions. Just what I was expecting. No sign of a regex that replaces something with <i>..</i>. That's right, there is no way to type in italics.

So Facebook, why no italics?

Wednesday, September 2, 2009

Net Window Shopping: Lucky Star and Yotsuba&!

I've definitely decided to become more of a patron of my favorite bookstore. After finding a favorite manga of mine there the other day I decided to check out what books and other media I an order through them. I proceeded with my search and found that I can get both an anime I've dying to get my hands on and manga of which the fan translation I found absolutely hilarious.

My problem will probably be deciding what to get first. Kyoto Animation's Lucky Star fully available, including even the OVA. [Search results]

And from Kiyohiko Azuma, author of Azumanga Daioh, is Yotsuba&!. Completely crazy about Azumanga Daioh (which incidentally happens to be the manga I picked up last week) I read up on its creator and got my hands on a fan translation of Yotsuba, which might possibly be funnier than the work I was originally sold on. [Search results]

hit counter