Thursday, May 14, 2015

Tweets on May 12 and 13

May 12

There are two kind of old man. One appreciates new good thing. The other rejects everything he is not familiar. I want to be the former.
A Japanese idiom, chicken head is better than cow butt. It means bring a leader is good even if it is a leader of small group.
But sometimes chicken heads appear how they are important. Really important person doesn't do those appears.
Desires to be a important person is a kind of drugs. It is useful but if it is abused, it harms a lot.
Anger is a poison. Avoid it to keep your mind healthy.
I just finished today's lesson. To tell the truth I am very sleepy now.

May 13

Oh I forgot to tweet today.
I almost break my promise to post at least once a day.
I'm sneezing. I may have a hay fever. I have to go a doctor to confirm it.
I'm sneezing and have itchy face. It is a symptom of Gramineae pollen allergy. If it goes bad, it may cause wheat allergy. That's terrible!
I'm going to visit England with my wife soon. My hotel doesn't offer wifi access.
My friends suggest to buy a SIM card but I'm not sure I have SIM lock free device.
I have an iPhone 5S, but it is locked and we can't change its SIM card.

Monday, May 11, 2015

One line JavaScript to make easy to copy tweets from Twilog

Here is the script. I ran it to remove all unnecessary things.

[".tl-icon", ".tl-time", ".tw-buttons", ".tl-posted", ".tl-name"].forEach(function(x){$(x).css("display", "none")}); $(".tl-tweet").css("padding", "0px 0px 12px 0px")

Tweets on May 8 to 11

May 8

I'm cutting papers printed 25 book covers a sheet. Now I just finished three hundreds covers. pic.twitter.com/vg37xHaGBe

May 9

Today I'm going to go a seminar for 'clean languages'.
It's Saturday in Japan. I gonna spend my weekends to go the seminar.
Today I learned "clean space" and I felt it is very useful tool for knowledge workers.
I think it can be combined easily with Japanese popular method to come up with new concept, KJ method.
"Clean space" is a method to facilitate new inspiration by moving places physically and see the issue and self from other viewpoints.
"KJ method" is a method to organize information by moving paper pieces physically and express relation between them nonverbally.
"Mind palace" is a method to remember things by putting information in virtual places and walking in them imaginary.
I think these three methods are related each other.
They can be combined and they help the others each others.

May 10

When we use the KJ method, observer is fixed and things are moved. When we use the Clean space, things are fixed and observer moves.

May 11

I just finished my presentation.

Tweets on May 7

If I'm in a tough situation I'll struggle with that. But If I can avoid it, I should. War is the worst solution.
It is midnight in Japan now. My holidays are finished and I have to go to the office tomorrow.
I'm going to have a presentation in Monday.
I forgot to bring my jins meme, glasses with accelerometers and eye-electric sensors.
Sensors are tools to measure physical value. Censorship is to remove information from books by power.
Are there any good English dictionaries?
Oxford advanced learner's dictionary for iPhone is 3600 yen.
This chart shows the data from jins meme. Blue line shows my blinks and red line show head rotation. pic.twitter.com/5UoU8ZITFq
I was playing a game, super hexagon. I shakes my head intentionally when the game was over.
The chart shows strong correlation between eye blinks and super hexagon. When it was over I always blinked unintentionally.
In super hexagon, it's speed is up at 60 seconds after I start it. So it is good example to survey relationship between stress and blinks.
I just finished two English lessons. Today I can't reserve backed lesson so I did two forty-minute lessons. But it is a little busy.
When I have a backed lesson, it is ninety continuous lesson. Of course we take ten minutes break, but I don't have to change booths.
I'm not good to introduce myself or ask someone how they grow.
When I booked backed lesson, some teachers said you are brave. But for me, meeting with two people is much more tough situation.
Today my teacher said my listening skill is strong and he spoke almost native speed. But I can't understand native drama, such as sharlock.
I wish I could understand English drama without Japanese subtitles.
I'm preparing for a presentation. I'm getting ready for a presentation. When is the presentation? It's next Monday. It's in Monday.
The topic of the presentation is management theory. But it is related to programmer's work.
U theory describes models behind the creation of new things and changes. Of course programmers also create new programs.
I give presentations 3 times a year. But not regularly. It depends on year.
I feel more exhausted than other days.
It is nine o'clock at night in Tokyo. It is nineteen degrees. I feel a little cold. So I use stalls.
It's not stalls. It's a stole. It is a narrow strip of cloth. I put it around my neck.
I'm waiting a train. I wish I can sit.
I have to come up with new products. It is my responsibility.
Unfortunately the train was very crowded and I couldn't sit.
You'll want to wait next train. --- But it probably is crowded as this train.
Fortunately the man sit in front of me got the train off! I'm sitting now! How lucky man I am!
I'm trying to exaggerate everything for fun.
Have you considered to exaggerate everything you see? It changes your boring life to thrilling adventure!
If I were you, I would imagine passengers are pumpkins!
The previous lesson is to advice. In role play I asked to advice by a person who are nervous with presentation in front of the CEO.
My advice was to imagine that the CEO is a pumpkin!
Now I arrived to my station. I mean the station which is the nearest from my home. I have to ask my teacher it is correct.
'My' means not only possession but also 'have relationship with me'. 'My train' doesn't mean my own train.
It is similar to cookies, but it's not sweet. It's salty. It was made with rice and soy sauce. And it's very stiff.
It is harder than raw carrots. It may be as hard as French breads.
It comes to mind now. Pretzels are more similar.
To describe how it is made is difficult. Due to differences in vocabulary of cooking. It is baked rice cake, but I heard 'bake' is in oven.
It is not baked in an oven. So should I call it fried rice cake? But no oil are used. Is it roasted rice cake? It's so difficult...
I found there is a entry in Wikipedia. It is called senbei. It is grilled over charcoal.
You should ask IT to fix your laptop. You should ask IT for a new laptop.
I have to read a lot of books to find some inspiration.
I have over six hundreds of e-books.
When I was a high school student, I commuted from Osaka to Kobe.
Today I talked with my teacher about CEO and board members. Usually board members appoint CEO, so they are more authoritative than CEO.
In the case of my company, the CEO is one of founders. He watched my company grow.
They had difficulty hiring staff because the company was not popular. Is it popular now?
Not so much yet. But we carried out TV commercials, wrapped trains and large billboards in Tokyo station.
So it's became much more popular than it was in the past.

Tweets on May 6


I followed several news accounts. They will give me topics to tweet. I hope it won't go bad about Hakone volcano.
To err is human. So human who have multiple twitter accounts definitely will post from incorrect account sooner or later.
It is the last day of five consequence holidays today.
I have new lessons tomorrow. So I have to review previous one now.
In previous lesson my instructor said I have to try to improvise more.
When I ask to describe pictures, I tend to say correct things. But as he said, I have to create new stories. It'll improve my skill faster.
I have a hey fever and my ears are sometimes irritating.
My instructor said I should mimic speaker on TED. To copy their voice tones and physical behaviors are the fastest path to be a good speaker
When I tweets in English, sentences have to really really short. Sometimes I try to write a correct sentence but it becomes too long.
It is a tough challenge to make sentences shorter and keep them grammatically correct. English is my second language.
My instructor taught me sarcasm. By using unusual voice tone, we can use words in opposite meanings.
Japanese tend to speak in flat tone. So sometimes it sounds like a sarcasm.
I watched #SHARLOCK season 1 to 3 with Japanese subtitles. I'll try to watch them again with English subtitles.

Thursday, May 7, 2015

How to Orgainze Ideas #3: Understand problems

Hi, it is Dr. NISHIO Hirokazu. this is my third entry on how to organize ideas. Previously, I explained about how to think and what to think. Today I'll explain a more detailed method, focusing on how to solve problems. I used this method at a workshop at the Kyoto University Summer Design School and I confirmed it works very well.

Assume you are looking for solutions to particular problems. You may concentrate on "how to solve them", but it is not a good practice. If you can not find solutions or you found them but they won't work well, the major reason is misunderstanding of problems. People tend to search the solutions before clarifying the problems. Focus on "what to solve" before focusing on "how to solve it".

To clarify what to solve, first, let me break down "what the problems are." The problems are gaps between the ideals and the realities. The ideals are in your mind, such as your dreams. The realities are outside of your mind, such as facts. The problems are gaps between them, so if you throw your dream away, the problems disappear.

I recommend following two questions to clarify what the problems are:

  • What are your ideals? (What is your dream? What do you think it should be?)
  • What are the realities? (What happens actually? What is the fact in the situation?)
After then you are ready to think about solutions:
  • How to fill the gaps? (How to solve the problems?)

Tuesday, May 5, 2015

Tweets on May 5

May 5

long time no see. from today i'll tweet at least one per a day. it's my new challenge.

I changed my Twitter account on my iPhone from Japanese one to this English one.

My wife have set her iPhone's language preference to English. It may be good practice. I'll try it.

My councilor for English said I have to write English more frequently. I know. I wrote blog entries last year but I couldn't continue it.

I think the reasons are the cost to write and the lack of response. Mini blogs, such as Twitter, are nice tools to walk around the problems.

In English I can't tweet complex things. The word "Complexity" is 10 characters long in English, but 3 characters long in Japanese.

I should change my profile soon

In iPhone's twitter client I can easily switch two accounts. But I couldn't find similar option in PC version. I logged Japanese one off.

Unfortunately Twitter to Facebook integration won't work with multiple accounts. Should I use IFTTT instead?

I mixed up "councillor" and "counsellor". The former is a member of a council. The latter is a person who helps you solve problems.

My wife told me about "tangle teezer", a kind of hair blush. I thought it was "tumble teaser", it may tease tumbleweeds...

If I can forward the posts on this account to the Japanese account problems are solved...

I set an alarm at 22 o'clock to remember me I have to tweet in English.

Sunday, January 11, 2015

How to Organize Ideas #2: What to write

Hi, it is Dr. NISHIO Hirokazu. This is my second entry on how to organize ideas. In my previous entry I explained about the concept: "Write first". By thinking on paper, you can reduce the cost to remember ideas. So you can think more efficient than to think in your head.

Today I will explain about "what to write". When you have to create new ideas, you may try to write new ideas themselves. It is not a good way. Thomas Edison said, "Some people think perfect ideas can be born, but it is not correct. Ideas are born incompletely and then brush them up." I'm sorry but I read the quote in Japanese book, so words are not same as he said. If you are interested in it, read the "Your Creative Power" by Alex F. Osborn's, the father of brainstorming.

In other words, you can't write complete ideas. Don't try to do it. You can only write incomplete pieces of ideas. Do not be a perfectionist.

You may try to write something related to the subject. It is also a kind of perfectionism. James Webb Young said, "an idea is nothing more nor less than a new combination of old elements." So, before you find an idea as a new combination, you don't know what elements will combine. You can not know whether things are related to the subject before you get new ideas. Don't try to write what is related to the subject. Instead of that, write anything that comes to your mind. It may be related to the subject.

Steve Jobs said “You can't connect the dots looking forward; you can only connect them looking backwards. So you have to trust that the dots will somehow connect in your future.”I think it is a similar concept.

Next time I'll describe about a nice framework when you want to find a solution for some problems. I use it in the workshop at the Kyoto University Summer Design School and it works better than I expected. See you next time!

Saturday, January 10, 2015

How to Organize Ideas #1: Write first

Hi, it is Dr. NISHIO Hirokazu. I have given several presentations about "how to organize ideas" in Japanese. It seems to be good for English speakers too. So I start to translate them into English.

Today I introduce a concept "write first". Why we should write first? Imagine whether it is easier to do calculations on paper or to do calculations in your head. Yes, the former is easier. Because you don't have to remember numbers, you can use your brain power efficiently.

To organize ideas, it is the same. If you don't write your thoughts on paper, you can't use your brain efficiently. So, at first, write everything in your brain, then organize them. That is the important concept.

I wrote the draft of the diary in 2 minutes in Japanese and then wrote the diary in 25 minutes in English. It is time to finish. Next time I'll write about "what to write".

Thursday, September 18, 2014

Keynote speech on PyCon JP 2014

I gave keynote speech on PyCon JP 2014 4 days ago.

Here is the movie recorded, but it is in Japanese and simultaneous translation was not recorded: CH10 Opening~Keynote: Hirokazu Nishio - YouTube

So I translated my slide and added explanations. Here is the English version: PyConJP Keynote Speech (English version)

If you are interested in, here is the original Japanese version: PyConJP Keynote Speech (Japanese version)

You are welcome to ask any questions!

Friday, September 5, 2014

What is better to call "hand-copying sample codes"?

If someone is learning new language and he/she feel difficult to understand textbook, I recommend to type small sample codes in tutorial by hands.

This learning methodology is called 'Shakyo' in Japanese, named after a practice of hand-copying sutras. (Sutras for Buddhist is similar to the Bible for Christian, see Sutra copying - Wikipedia)

However there are some people with opposite view. The original Shakyo practice include to empty his/her mind. That means Shakyo as programming practice must include to empty mind. Hand-copying sample code in empty mind is not good practice for learning programming, we should think a lot.

I think the word Shakyo causes misunderstanding. But I have no idea to replace it. Do you have any idea for that? Please tell me your opinion.

Thursday, September 4, 2014

My book was translated and published in Chinese!

Here is the page of the book: 人民邮电出版社优秀图书:代码之髓:编程语言核心概念 图灵程序设计丛书.

The book was published in Japanese on 2013, published in Korean on this March. If you are interested in English version, please check this page: Programming Langueges: Their Core Concepts.

Saturday, August 30, 2014

"Process to make an idea real is simple labor work..."

Takashi Murakami said "Process to make an idea real is simple labor work. So you should check by yourself carefully if the theme is worth to do labor work"

I found the quote on 2011 and tweeted in Japanese. Curiously it was retweeted in these days by a lot of people, so I translated it now.

Friday, August 29, 2014

Translation of my book is in progress

Hi, it is Dr. NISHIO Hirokazu. I published a book on April 2013 in Japan. It was the bestseller in Amazon programming category and it was the bestseller among computer related books published in 2013.

Here is the table of contents: Programming Langueges: Their Core Concepts

It was translated to Korean. Now the book is been translated to English!

You can read drafts of chapter 1 and 2 on GitHub: https://github.com/nishio/langbook

Sunday, August 24, 2014

Long time no see!

Hi, it's Dr. NISHIO. Long time no see. I haven't wrote entries in English for three years. I'll have keynote speech on PyCon JP on mid-September. I'd like to use this opportunity to relaunch my blog and then increase output in English!

Tuesday, July 26, 2011

Extra information about QUMA

Hi, it is Dr. NISHIO Hirokazu. Did you already read Quma: 3D Motion-Capture Figure For 3D CG Production (Video) | TechCrunch or The Washington Post? I'm very glad to see a lot of people are interested in the project. Unfortunately, there are less information in English than in Japanese. I'll write about them.



Pronunciation
COO of 'cool' + MA of 'mama'. It is similar to the word 'KUMA'(bear) in Japanese. It is because early prototype was put in teddy-bear skin.

How much? It must be expensive!

There are no official announcement about the price. However, SoftEther said "the selling price will be between 10000 JPY and 20000 JPY" on 2009/10/30, with showing QUMA prototype. (ref. 1) In my humble opinion, it will cost much, 2 or 3 times. However it couldn't possibly imagine that it costs over 100000 JPY. Again, it is my humble opinion, not an official one.

About contributers

SoftEther said CELSYS、ViVienne, 3D-GAN and University of Tsukuba are the contributor of the project. (ref. 2)

CELSYS is selling software to make illustrations, comics and animations. It is nice if those soft supports QUMA directly. It seems possible.

ViVienne got a subsidy to a 3D-related project from MEXT(Ministry of Economy, Trade and Industry) (ref. 3). SoftEther got the subsidy form MEXT too. SoftEther colocates with Tsukuba Univ. It seems those three players are cooperating tightly.

Additionaly, the figure designer ASAI Masaki tweeted about his contribution. (ref. 4) He is very popular as a creator of figma, action figures with exchangeable faces and modules.

Modularity
SoftEther said, the joints of QUMA are modular and can be re-assemble, so you can make various animals like camels, snakes etc, not only human. In my humble opinion, no one use snakes as snakes, but tentacles. ;)

Reference
(ref. 1) 3Dキャラの動きをぬいぐるみで操作、個人用モーションキャプチャ -INTERNET Watch
(ref. 2) 報道発表資料 - 開発中の「QUMA」技術を応用した 3D モーションキャプチャ装置を公開
(ref .3) IPA:2007年度第I期「未踏ユース」採択概要
(ref. 4) http://twitter.com/#!/masakiapsy/status/93823167306530816

Thursday, January 20, 2011

'git add -p'

Hi, it is NISHIO Hirokazu. I just found "git add -p" is very nice. I show it.

Here is a sample script. I'm going to add new function on it.


def hallo():
print "hello!"


When I added new function 'bye', I also found there is a typo s/hallo/hello/. I fixed it too. Let me show 'git diff'


$ git diff
@@ -1,2 +1,5 @@
-def hallo():
+def hello():
print "hello!"
+
+def bye():
+ print "bye!!"


Now I wanted to commit it, but there are two changesets. I didn't want to commit all in one changeset. That's when I should use 'git add -p'!


$ git add -p
@@ -1,2 +1,5 @@
-def hallo():
+def hello():
print "hello!"
+
+def bye():
+ print "bye!!"
Stage this hunk [y,n,q,a,d,/,s,e,?]?


Git asked me whether choose the block of changes (hunk). But it contains both changes... I chose 's' to split it.


Stage this hunk [y,n,q,a,d,/,j,J,g,e,?]? s
Split into 2 hunks.
@@ -1,2 +1,2 @@
-def hallo():
+def hello():
print "hello!"
Stage this hunk [y,n,q,a,d,/,j,J,g,e,?]?


Now I pressed 'y' to choose the hunk, 'n' to skip another hunk and commit.

Stage this hunk [y,n,q,a,d,/,j,J,g,e,?]? y
@@ -2 +2,4 @@
print "hello!"
+
+def bye():
+ print "bye!!"
Stage this hunk [y,n,q,a,d,/,K,g,e,?]? n

$ git commit -m "fix typo"
[master 82bd7c6] fix typo
1 files changed, 1 insertions(+), 1 deletions(-)


Let me show 'git diff' again. The other modification left. Add it and commit it.

$ git diff
@@ -1,2 +1,5 @@
def hello():
print "hello!"
+
+def bye():
+ print "bye!!"

$ git add .
$ git commit -m "add new function: 'bye'"
[master fd5ab40] add new function: 'bye'
1 files changed, 3 insertions(+), 0 deletions(-)


How nice is it! Does other VCS (mercurial, subversion etc.) has such feature?

Tuesday, November 30, 2010

What is 4277075694

Hi, it is NISHIO Hirokazu. I encountered the magic number, 4277075694, when I hacked on Windows. I searched where it comes from. However, it doesn't appear on any code. I also searched 0xFEEEFEEE, 0xFEEE and 65262, and it neither.

Finally I found: 4277075694 (0xFEEEFEEE) comes from Windows NT's heap manager. When a memory released, it is set to 0xFEEEFEEE.

Here are other magic numbers:

0xBAADF00D : 3131961357
0xFDFDFDFD : 4261281277
0xCDCDCDCD : 3452816845
0xDDDDDDDD : 3722304989
0xFEEEFEEE : 4277075694


Here is good instruction: Win32 Debug CRT Heap Internals

Thursday, July 15, 2010

The shortest oneline brainf*ck interpreter in python (558 characters)

Hi, it is Dr. NISHIO Hirokazu. This code was written in 2006-09 but I didn't have publish yet in English.

get from here: http://gist.github.com/476940. It takes a filename as an argument and exec it as Brainf*ck code. All illegal characters are ignored.

exec(reduce(lambda x,y:x.replace(y[0],y[1:]),'Iz"d",|Jz"t",|K1),"|L.read(|Mimport |O,lambda|Psys.std|Q",0);z"|R"Yzp,|S}.get(code[|T)or |U"YZor z"p",p|Vifilter(bool,(|W)%256)or Z,"|X)for x in count())).next()|Y:lambda:|Zz"c",c+1)|q(globals().get(p,0)|zglobals().__setitem__('.split('|'),'Msys;from itertools Mcount,ifilter;z"cQpQj"O kYq==0)^(k==-1)and(Jc+kTI1TVId+{"]":-1,"[":1St],0)*kTd==0 or Jt+kXand z"c",t+1T1TZ);z"code",file(sys.argv[1])L));Vc==len(code)or({">U+K<U-K+Rq+1W-Rq+255W."YPout.write(chrq)TZ,",Rord(PinL1)W[":j(K]":j(-1),Sc]O:Z)()and NoneX'))

See this charm point!

>U+K<U-K+Rq+1W-Rq+255W

It's a definition of >, <, + and - !

Monday, July 12, 2010

Haskell Quiz Answer

Hi, it is Dr. NISHIO Hirokazu. This is an answer for Haskell Quiz. Please read it in advance.

Why some program show strange behavior? To answer the question, I should define what is "strange". For example the following behavior is strange.


// JS
var a = ***, b = ***, c = ***;
console.log(a < b); // true
console.log(b < c); // true
console.log(c < a); // true


In the case, "strange" means "different from mathematical behavior". Now the answer is clear, it is because those are not purely mathematical objects.


var a = "9", b = 10, c = "100";
console.log(a < b); // true
console.log(b < c); // true
console.log(c < a); // true


Haskell also shares some common "strangeness" with other languages.

Prelude> let x = *****
Prelude> x == x + 1
True

You may know the quiz in the other language. This "strangeness" come from the limited resolution of floating point number.

Prelude> let x = 2 ** 64
Prelude> x == x + 1
True


Now, return to the problem I posted.

In Haskell, you can overload different value on one name.
You may disagree. You may see "Multiple declarations of something" error.
But wait. Didn't you have ever defined 'show'? Isn't it overloaded?

Haskell is very different from C++/Java. In C++/Java, you can overload functions whose type of arguments are different. In Haskell, you can also overload functions whose type of return value are different. It is very important.

The quiz's tricks are,

  1. You can overload in Haskell
  2. You can overload functions whose return value are different
  3. and there are no need to take argument
  4. (+) and (==) are t -> t -> t, so it can be used to restrict arguments' type. x + (1::Int) says x is (x::Int).
  5. Number Literal (e.g. 0) are (Num a) => a, so it can be used as both (0::Int) and (0::Integer).


Now let me show my answer.


class Foo t where
a :: t
b :: t

instance Foo Int where
a = 0
b = 1

instance Foo Integer where
a = 1
b = 0

c :: Int
c = 0

d :: Integer
d = 0

main = do
print $ a + c == 0 -- True.
print $ a == c -- True. a::Int == c::Int == 0.
print $ c == 0 -- True.
print $ a + d == 1 -- True.
-- d is Integer. So the variable a is a::Integer,
-- which equals 1. "d == 1" is a misconception.
print $ b + c == 1 -- True. b::Int is 1.
print $ b + d == 0 -- True. However, b::Integer is 0.
print $ b == d -- True. Yes, both are 0::Integer;
print $ d == 0 -- True.
-- Why I use "d == 0" not "b == 0"?
-- Because it causes "ambiguous type" error.
-- You know, ":t 0" is "(Num t) => t". No way to determine
-- it is Int or Integer.

-- hints to make answer unique (perhaps...)
print $ sum([a, b, c]) -- 1: It is [0, 1, 0]::[Int]
print $ sum([a, b, d]) -- 1: It is [1, 0, 0]::[Integer]
print $ [a, b, c] !! a -- 0: (!!) take Int argument,
print $ [a, b, c] !! b -- 1: so it says (a::Int /= b::Int)
print $ [a, b, c] !! c -- 0
-- Why I didn't show [a, b, c] !! d is,
-- it causes error because d is Integer.