Studying the effect of seretoin on memory – with #memrise and #9gag


So, those cognitive scientists from memrise successfully made me addicted to their application.

Joke aside, my memory is really bad and I have been using flashcard to study Japanese and German for some years (intensively during my year in Bonn), tried with paper flash cards, Quizlet and FlashCardToGo in android.

With my limited knowledge but keen interest in cognitive science – Memrise is really seamless and game-changing for me. I am also creating this japanese course which based on Mr Children’s lyrics (trying to add context for those words!)

How’s my memory going – experiment with memrise and 9gag

Reading the great book The Shallows‘s chapter 9 today about formation of long term memory and effect of sereotin

(In 1983 Kandel, Schwartz & Richard Axel) To mimic the action of the modulating interneurons, the scientists injected serotonin into the culture. A single squirt of serotonin, replicating a single learning experience, triggered, as expected, a release of glutamate – producing the brief strengthening of the synapse that is characteristic of short-term memory. Five separate squirts of serotonin, in contrast, strengthened the existing synapse for days and also spurred the formation of new synaptic terminal-changes characteristic of long term memory.

If you are still reading:

What happens after repeated injections of serotonin is that the enzyme kinase A, along with another enzyme, called Map, moves from the neuron’s outer cytoplasm into its nuclesus. There, kinase A activates a protein called CREB-1, which in turn switches on a set of genes that synthesize the proteins the neuron needs to grow new synaptic terminals.

I dont understand very well, but I just think of a simple experiement, althought not very related actually, that I can do on myself.

Outlining an experiment with memrise and 9gag

-will I do better in memrise if I read 9gag during that?


  • I know it is not very scientific, but fun. (yes, seretoin ton doesn’t work that way, I just wanna know at least can I do better when I feel more relaxed)
  • my first experiment in cognitive science lol! before I go really into it.
  • brain is a very personal thing. genes as well. You need to measure personally, not being told
  • quite stressed recently for the examinations & projects
  • this make me feel less guilty when I read 9gag.
  • I need some excuses to spend time on my japanese
  • actually with or without this experiment I am doing the very same thing every day.

Experiment concerns

  • things to learn -> This JLPT N2 Memrise Community Edited Course because
    • I would really like to finish it
    • I have been learning japanese for quite a long time so there should not be any special trend
    • large enough and relative standard among courses
  • words to learn should be large to reduce side effects of
    • meme, audio
    • skip those really easy one / I already know (as usual )
  • to be scentific, I should be memorizing some poker numbers, but I am not into that…although that can still be cool
  • get more sleep regularly
  • ignore the first day as no recall session
  • using memrise as it is fun, small, easy to control and I am really memorsiing smomething in a efficient way
  • 9gag is something fun, actually something like listening music / aeriobic / deep breathing could be more interesting..


  • web version
  • Japanese Course


  • Starting from the end,

Phase 0

pattern: with 9gag -> without ->with, etc

  • 5min 9gag (too much to start, too less to stop)
  • 15~20min memrise
    • [recall] grow phase for ytd’s courses
    • [plant] plant a new course, 5 times i.e. 25 planted if nothing is skipped? – not very sure about its algo yet
  • 5min 9gag

Phase 1

No idea yet. may be 9gag-9gag-9gag-no-no, or 9gag- plan in memrise- 9gag, things like that


  • 30min around 11am
  • because I am too tired to do anything serious immediately after work


If you can’t measure it, you can’t improve it. be Taylorism

several possible metrics: – marks you get during recall phase – marks you get during grow phase

after 2 weeks, plot – [recall mark against 9gag when recall] recall better when relaxed? – [recall mark against 9gag when grow] grow better when relaxed?

Challenge accepted. just yet to start 😛


Syntax-Specific Key Binding in sublime Text 2 – e.g. fix javascript reindent with jsFormat and Ctrl+Shift+F

Sublime Text 2 is great. period.

In short

to use Cmd-Shift-F to reindent javascript with jsFormat without affecting others, put this in the Key Bindings :


Again this supposingly simple question took me some time to figure out

My use case is: I found there is a bug in Sublime Text 2 for reindent javascript which

whenever there is a comment line, the indentation of next bracket follow the indent of the comment line instead of matching bracket



So i installed the package JsFormat which is also closer to the my style

Then there is another problem — it is not overriding the reindent but create another command ‘jsFormat’ thus I cannot use my usual hotkey cmd + shift + f to reindent but need to use the default ctrl+alt+F. Even I change it to cmd+shift+f, other language (syntax) will be affected

The Settings - More -> Syntax-specific is for setting but not key bindings


Finally figure out the scope concept from this SO Thread
so the scope for js is scope.js not scope.javascript

The correct way to know the scope is to check syntax’s .tmLanguage file for the key scopeName

seems the alternative -plugin ScopeHunter is not working for me

Originally I thought it is the bug, but it works now

Related SO:

My version

Version:2.0.1, Build2217 OS: MacOSX 10.7.4

Chinese characters identifier (Java)

Chinese characters identifier (Java)


This JAVA program check if input word/Char is Chinese. visit ChineseCharIdentifier in github


use public static boolean isChineseChar(int codePoint) to check against code point of a character and public boolean isChineseWord(String s) to check against a word.

It is also possible to exclude filtering of particular regex patterns (e.g. accept some Alphanumeric words, like _NOUN_ in google data set)


To work on a Chinese N-Gram Analysis with the google books Dataset, I spent sometime figure out how to identify a character is Chinese or not, which is supposed to be quite easy.

Stuff here is not very serious or standard, just hoped to help others to understand some basics and get quick solution.

Some Concepts:

To check whether a character is Chinese, we can use its code point, which can be obtained using Java’s Character.codePointAt()

Code Point

From Wikipedia

code point or code position is any of the numerical values that make up the code space.[1] For example, ASCII comprises 128 code points in the range 0hex to 7Fhex, Extended ASCII comprises 256 code points in the range 0hex to FFhex, and Unicode comprises 1,114,112 code points in the range 0hex to 10FFFFhex.

What are the range of Code Point for Chinese?

This question is harder.

For English it is easy, it is from a to z, A to Z.

As accordingly to the Unicode Scheme many characters are actually not only Chinese, but common in Japanese/(traditional) Korean as well. Thus Chinese characters are contained in the set called CJK, where this is a disjoint set, i.e. the range is not continous


so From the official FAQ:

A: It is a commonly used acronym for “Chinese, Japanese, and Korean”. The term “CJK character” generally refers to “Chinese characters”, or more specifically, the Chinese (= Han) ideographs used in the writing systems of the Chinese and Japanese languages, occasionally for Korean, and historically in Vietnam

Chinese Only!

Closer to what you want may be “Blocks Containing Han Ideographs”. This is hard to reach if you have been looking for “Chinese”

check out this SO Thread and the standard specification to get the correct range.

Full Unicode Chart

This is blogged in here

Browser automation testing in javascript- selenium, webdriverJs

I am adding automation testing the for my application and I have also been the online testing “champion” in my workplace (Java).

As usual, Concept first

This is stil a relative fresh field. There are quite a lot of concerns, I try to write one by one and be concise.

Why browser automation testing

I am not very expereinced in unit-testing or javascript. IMO, it may be a bit too expensive, especially when you have simple code and what you focus is the webpage being shown to users and things work there. It is expensive in a sense that comparing to JAVA, again IMO, it is harder to yield in automated refactoring and it is easily coupled with DOM.

There are nice behaviour testing framework like Jasmine. Some of them are also possible to run in browsers. But still that may not be the same as browser automation testing, which test against USER ACTIONS in browsers. You use the real page to test can care less about the fixtures.


Nowadays selenium, from Google, is the de facto standard for that. I am used to it in Java and it is roboust, easy to write and scalable. Even run in headless Linux is possible . Alternatives: JsTestServer

Why browser automation testing with JS

I am building couchdb app (with node.js tools) and simpler, javascript is the language of web.

Selenium Javascript port (client/binding)

There are ports to use selenium in javascript. Almost all are based on the OfficialJsonWireProtocol

So the story is: your javascript test code run with the selenium webdriver client, which communicates with the selenium server via the JsonWireProtocol, which then issue requests to the connected browsers and carry out the actions.

Frameworks out there..

At first I was quite confused as they all name as webDriverJs. So some quick facts.

All are available as node component, and in NPM:

official selenium-webdriver-js – actively developing

Camme/WebdriverJs – last commit Sep2012

**Update: per author’s comment it is now active again :)**

WD.js – actively developing

Some footprint analysis in github: not very popular in wild

  • selenium-webdriver 38 code results
  • webdriverjs: 142 code results

Which to use?

Sometimes it is not the matter of which API to use, rather it is more on understanding the tradeoff and how you make them decouple. IMO things are still not very mature today and I am thus suggesting for a even simpler framework. Lets dive in more…

Browser Automation Testing Concerns


client API

Basically all the clients framework are async and used a queue-like implementation. So your script will finish but it actually just registered the actions for selenium. Then selenium will wait and call the callbacks at right time.

Comparing the official one and Camme/WebdriverJs, the former one is more sophisticated with concept of “Promise” and “Defer”, but this may also be harder to understand and write. Meanwhile the later has no explicit wait method and this is quite a large limitation in testing against ajax.

As you can see in the WebDriverJs wiki, concerns are problem of state, API too verbose, too many nested callback and how they are currently handled. I think the official client did a great job.

It is also for sure that if you use the official API, it is expected to be more updated with selenium..

Selector Style

There are many methods to select an element in selenium. Name/Id/Css Selectors.

The official webdriverJs’s basic API use the common selenium API driver.findElement('q')); where the advantange is it is consistent even you come from Java.

On the other hand it may be quite strange to write in javascript, esp content assist is unlikely in place and the builder pattern makes you hard to debug & see available methods. There is also lack of documentation.

On this I prefer Camme/WebdriverJs which is more jQuery-like.

Also it may be to your surprise, it is possible for selenium to execute javascript. By this I mean you can have the script as a string and let it be executed by selenium server for you, no matter from Java/Python/etc, of course in javascript. This is quite handy in some situations, but some common use case like getting the value back into the place you call could be hard.


Then one might ask is that possible to use jQuery?

First we need to separate the questions into 2: 1. to use in test script 2. to run in browser

For 1, you can always make jquery available in Node.js by require('jquery'). The point is you cant use jQuery selector directly to write the test flow, as actual actions are done by selenium instead

For 2, it may be hard as you can imagine the dependency.

You may argue that jQuery is not necessary because selenium support css selectors already. but some methods are not, like .first() or .show(). I believe this can greatly save developer’s time.

I just tried to check if a element is present in the official webdriver, which is quite hard.

So the tradeoff:consistency amond languages vs native style. I will prefer and suggest to have a selenium client like jQuery as much as possible.

Testing – PageObject

It is imporant to separate test code and automation code.

This official reference to PageObject is extremely helpful.

I tried to write my own js page-object, but that may be harder as to duel with the scope and state.

this js-page-object project also seems interesting.

Testing – assert Style

Afer all this is a test case. Camme/WebdriverJs provides a test mode. This may be very convenient to keep scripts compact and with less dependencies.


    .tests.cssPropertyEquals(".login a", "color", "#4183c4", "Color of .login a is #4183c4")
    .tests.titleEquals("Secure source code hosting and collaborative development - GitHub", "Title of the page is 'Secure source code hosting and collaborative development - GitHub'")
    .click(".pricing a")
    .tests.titleEquals("Plans & Pricing - GitHub", "Title of the page is 'Plans & Pricing - GitHub'")
    .tests.visible(".pagehead", true, ".pagehead is visible after click")

For me, I used in hybrid with nodeunit.

For the general assert(actual expected) vs assert(expected, actual) war link1 , the former is what in Node and nodeunit. I am from Java but I think I will stick with Node’s approach from now on.

One can use the tearDown() method to make sure the browser is killed after test, even in case of exceptions.


I will try to write more and make it a “white paper”

— suggestion is lets use the official API and look forward to its API wrappers ang page-object implementatio. May make one myself if I have time and I really need it.

Java Quiz Preparation

I dont agree this is the best thing to do for learning a language, just to be honest sometimes this will be really helpful in job interviews(Just for the entrance ticket) ——after all interview & your education is a signaling game

There are lots of more important aspects like how to write clean code, object design, testability, etc. This post is mostly about the aspect of basic Java syntax and the language of quiz questions. “can method-local inner class be abstract”, “Output for System.out.print(” ” + 7 + 2 + ” “);”, is ArrayList “ordered” (Ordered !=Sorted) etc.

Just if you are going to use / using Java everyday, it may be also a way to get concepts clear, know the gotchas.

Do it like a machine. Reminds me the old days of HKAL..

First thing, read the manual

Java has bug. Java has design flaw. While if people ask your Java questions, you should read the Oracle stuff. Make sure you understand every sentences in theTutorial. Get used to reading some common java sources when you code– Executors etc. This is the relative efficient way before spending time on deeper Java Source, specification or even JVM bytecode

Some good online free java quiz filtered

More than java syntax


Why Markdown, how to use it in Outlook, Evernote, WordPress and everywhere

Update: I have created Cheeatz which can be used as a markdown editor and sync it to Evernote. Particular good for developers as you can embed gist easily 

Today is a Markdown day – I am working on a project design and I try to put everything in trello for brainstorming. Naturally I am getting my hands dirty with Markdown.

Concept first – even for any small small things

Contrary to to its name, Markdown belongs to the category of Markup languages. we are familiar with Markup languages, not as “a modern system for annotating a document in a way that is syntactically distinguishable from the text.”, but as HTML being one of them.

Why Markdown

To confess, I started to be serious in Markdown because of this post titled “The future of MarkDown” by Jeff Atwood (When I am writing this I tried to get the link in markdown, but I am still typing in Evernote)

I am biased. I reply infrequently in stack overflow, while I use Trello heavily. (Created by Joel, co-founder of stack overflow)

And I DO jot a lot of notes. I can spent hours on evernote/ oneNote everyday, from tech, chinese medicine to list of restaurants to try. I also a lazy blogger writing stuff like what you are reading.

Formatting is important, but it should not be complicated. It is impossible in Microsoft “World”, Mac/Google makes it better, but it should be simpler. I already touch-type bold, italic, change font size in Word/Evernote, using all hotkeys I can. In OneNote I ctrl-shfit+> several times, drag it and ctrl+. to make it bulletin. It is still hard, especially when there is code.

Frustration really comes when you try to paste from one place to another – like you drafted the post in Evernote and edit in WordPress for bold and links. Then you try to reply in stack overflow every links (and possible format) breaks. (This is one major point I considering going forTumblr)

One Best thing of Evernote is that it really keep layout of webpage, (based on ENML which based on XHTML) but when you paste it to OneNote, most format doesn’t hold


  • You familiar with this single syntax as a “high level” language
  • You save some seconds every time
  • This principle always apply in software dev – more important than time, you free up your mind to focus on what you are doing, which is very important.
  • After all this reduces the sugar your brain uses.

Same reason as Jeff Atwood suggest, I do hope Markdown will be “the language” that can be used everywhere. For me it is like JSON. So start from today I will try to stick with it

Tools – Markable, Cheatsheet

Note the online markdown editior Markable, I am new to it while I think it is very helpful and has lots of potential. Online File Saving, Easy integration with Dropbox, Evernote and Tumblr One feature I will suggest is hotkeys like ctrl-b to generate markdowns, which I believe will be available soon.

At odds with the simplicity of the language, the original syntax guide is a bit hard for quick reference. I will suggest the cheat sheet from Markable

My Workflows to make it work everywhere:

  • Outlook: after all outlook support some HTML
  • EvernoteUpdate: you can use Cheeatz created by me, which is an online editor with live preview and you can seamlessly sync notes to evernote, opening for modify later. It also allows you to embed gists inside your note with a simple tag, such that you can search your code offline. More read this post
  • Or you can use Markable . one gotcha is you need to save the file first, otherwise it will keep asking for your permission. Also possible to copy as HTML in Outlook and send to evernote.
    (Furthermore, instead of drafting the note in email and send to Evernote as your company blocks Evernote, you can do it here, and better. vice versa, for import)
  • Wordpandoc, pending to try
  • use Markable, either copy the right view to it in “Visual” mode (keep paragraphs & bolds & links at least! quite excited for this!) or view as HTML (tick Source at the bottom) and paste in “Text” mode in wordpress for some support
  • you may check here

A side note: For similar reason, I always to draw the sequence diagram during prototyping. while drawing by hands always has the highest efficiency, just perhaps no one including myself can read it.

P.S. now the problem back to how you sync copies among these places when you say, edit in wordpress…