光へ

Dream On

Page 2


Go Programming Language

I have spent some time to learn and practice Go Programming Language.

The staring point is this article, How We Moved Our API From Ruby to Go and Saved Our Sanity. Project changed from Ruby to other language is not fresh. But this time, I would like to try, too. Because in my experience, by using Sinatra/Ruby for my small website, I am not quite happy about the performance either. In the meantime, I want to try concurrent feature in Go. So I learn.

I try to implement some script in Go, and then try to establish web server using go-martini with mgo. Here’s the demo and Github

The first surprising is that, the code is quite simple and clean. I must admit that I am quite satisfied with Ruby syntax. I like block and many syntax sugar it provided. At begin I complain about all the error-handling idiom in Go. But after some script, I found it provided a good idiom to user. If I am in...

Continue reading →


Keep Going

Recently I continue to solve Project Euler problems. And learn some Haskell.

Solve problem by doing, or learn in hard way, is actually good for me. I have not much patient to keep reading manual. Learning by solving problem and try to use new knowledge as tool gives me good confident.

In problem 69, Euler’s Totient function is needed. Although we can get the answer by some thinking, I still try to use Ruby, Haskell, and C++ to implement a brute-force solution.

Haskell solution is not good. It should be lack of experience, but I have no habit to ask in stackoverflow. I use C++ version, it’s not fast, but ok.

Problem 70 need much better solution to integer factorization. To scan all integer below 107, it cannot use brute-force method. I think I need to create one function on my own.

It looks Quadratic sieve is good choice. Hope it’s not that hard to implement.

The only way to...

Continue reading →


Design Pattern

I got one feature request recently in work.

This is one command feature. Previously we already have several function to do the work, but we need to utilize those function to support another new command.

Because previously functions are for only one command, thus not much structure flexibility. And because I have not enough experience in this feature, I prefer to get the thing done in the ugly way and try to earn more time for refactoring later.

This lead to one question. How much effort we need to put into decide a good structure before start solving the problem? We all want to get the thing done first, but once the thing is done, there may have not much time to perform refactoring.

But the problem is, due to tight deadline, we may prefer fast solution other than perfect solution. And there exist no perfect solution, a.k.a. no silver bullet.

I have cough yesterday. And when I...

Continue reading →


Domain Forwarding & Copy-to-clipboard

Oh, long time no see.

Recently not much update in website design. I buy one more domain name for it, and try to make two domain in separate functionality. Now I use KalaKuo.info as personal website, and use OBMSHOP as e-commerce website.

It’s kind of experience to handle with Nginx. And dealing with it let me get much familiar with domain and IP. Lots things are meant to be learn by doing.

Previously I try to dig more from Sinatra and MongoDB. I use these for Front-end and Back-end. It’s really interesting experience. But I hope I have time to try more Front-end widget such as node.js and RoR. Hope I have more time. Because next thing I want to try is Android APP. Hope I have time.

And tonight, I have another request. Copy-to-clipboard. I forgot I get this request before or not, it’s not easy. It’s very easy in IE, but not easy in modern browser. And much more difficult to do it...

Continue reading →


When it need expansion …

Recently, I need some kind of upgrade or expansion request from my boss. Originally I have two kinds of items. And the request is to add three kinds of display/view from one property of the item.

I have not much experience in Design Pattern, not to mention the application time of DP. When I got the request, I feel that I need to have kind of Refactoring. I know the classical book but not read it yet, and notice one great website and not finish reading it yet.

But I need to do it, anyway, in SHORT time.

Often we got the task in hand and without time to do a full learning or even survey before start it. We just need to do it based whatever we know/have now. In this moment.

Today I have another request. I need to add one more item. Simple, but not that easy. This item have slightly different property from previous two and in fact I decide to disable the support of three kinds of...

Continue reading →


Good tools

I decide to take the challenge, 通訳案內士試験, which the first exam will take place in the end of August.

There’s many thing need to study and the time left little to me. But I still want to enjoy the study and want to use some tool I know to help me.

The first tool is Timeline.js.

This tool is to give the designer to create good timeline using jQuery. I give it a try, it works fine. To create the timeline of Japan History, I scan the wikipedia and fill-in the Google Spreadsheet. It takes three days for me to finish it, and I think I had done it very quick.

Here’s the result.
日本の歴史: 上古-江戶 明治-現代

I think it’s good, but sometimes I just want to collect the location of some historical locations. After some finding, I got one - Maplace.js

I was attracted by the demo page. There exist some other plugins which looks powerful, but the one I want is simple and I need to know what can it...

Continue reading →


Web Design for Mobile view

Recently I focus on algorithm practice. These two days my boss suggest me to support another layout for mobile viewer. I haven’t try it before, but quick search in Google and Stack Overflow showing that it’s possible. Just need to try it.

There are several way to support it. Register a sub-domain with m.xxx.com, which is the most full solution while need some times establish. There’s some config demo that Nginx can support it, too. But since I use Sinatra for the router management and Rack-based module support it quite well, I choose to try in Sinatra config.

It’s quite easy, mobvious is a Rack-based device type (mobile, tablet, etc.) detection from HTTP requests module. I give it a try, and it works amazing. Without any failure. Just too easy to believe it just works.

So, I think there exist no other question others than recommend it.

After that, I need to provide another layout...

Continue reading →


API Design

How To Design A Good API and Why it Matters

  • PDF file

I find this good talk suggested from Quora answer. It indeed quite interesting. Even I listen to this talk not fully concentrate, I still find this talk is very information condense and thus very recommend to get it.

Even though I have no experience in Java, but the rule is quite general. And each item suggested by Joshua Bloch is a good guide for writing code.

I think it’s true that each programmer is writing API even thought he just write some normal function. So to learn some suggestion from master should be good to the career. Give it a try if you don’t view it yet.

  • Kala Kuo

Continue reading →


Schedule

Today I do many things, and plan even more.

I create one page in my website. Link. This link will trigger every time to retrieve the article in baidu forum. It will get the article title list in the page first, filter out non-sense and extract useful article I want. And then do another connection to get the real novel contents.

At first I thought that Ruby+Nokogiri is fail to extract the mega html page. And I found that it can use Python to get that. But I just correct the script and successfully to get the contents using all Ruby script. It’s really good feeling to me to done that way.

But most important today is that, I plan and schedule to solve each problems in Cracking the coding interview and LeetCode. I found that computer science students in China will go over and over again to practice their coding interview skill. I try that in last year, but not iterate enough.

I think...

Continue reading →


Keep Learn.

I encounter some frustration whenever I found how much I need to learn.

Always realize the reality is crude. I even thought that what I should take is never think about how much left, but how much I had done.

Finding how to keep myself focused in daily life to improve myself is what I learn these days. I believe that everyone have their own pace or atmosphere to get thing done. What I want to find is the pattern. When I got it, I can get more use of my time.

I still need time to relax, such as to watch movies or drama. Even novels, which seems a little time-consuming to me now. But that’s life. I cannot live terrible life and fake myself to have wonderful life in near future.

I believe, that when I fake it, I will make it, soon.

Just keep going.

BTW, Michael Fogleman has created Minecraft in C++ with OpenGL and Python in few thousand lines of code. While Python version is far...

Continue reading →