Sunday, October 06, 2013

Detour and Under The Radar

It has been over three years since I posted anything here.  Most of my followup websites are long dead with no chances for revival.  So what did I tried during all these times?
  • FortuneCity -- dead
  • HelioHost -- dead after a month of inactivity
  • WordPress -- alive, but not updated (ZeroInsight)
  • GoogleDrive -- alive, but not updated
It was a good run for all those sites.  But it would have been better if I had kept it all in a single source.  There was no grand plan to create a site servicing anyone, or any marketing ploy to draw viewers.  That never was the goal of all these blogs.  However, the journey taught me lots of things, and in that perspective, it was fruitful despite the lack of success.

Here are the three old blog during 2010 to 2013:  FortuneCity(left), WordPress(middle), and GDrive(right).  Maybe I will copy the posts to there someday:



Monday, December 31, 2012

Reblog: GoogleDrive - 2012

Date: Tag: Website

      And so the work on this page slowly continues. On a better note, recently I discovered AppFog and gave it the free account a try. In case you have not heard about it, AppFog is a PaaS(Platform as a Service). Basically, PaaS is similar to a fancy free hosting, but a bit different. The workflow is as follow: create an app/project, select a service (PHP, NodeJS, Rail, etc), select a cloud service to create a VM, done! Unlike a free hosting, you don't transfer files via FTP. You need Ruby command line to install "af" command line tool. Using af, you can upload your code for the project to the host. Another difference is the app/project/service system. On a free hosting, you own a folder and manage everything under. In PaaS, each project is its own folder.

      Anyways, give it a try and see how you like it. In fact, I have setted up a personal MediaWiki on it.


Update Website

Date: Tag: Website

      So GoFreeServe took down my site after a month of inactivity, just like most free host... So, I am back to hosting static pages with CSS and javascript. Just few weeks ago I heard about Site44 web hosting. However, it is unique than other free hostings because it is free hosting via *your* DropBox's public link. But since I am using DropBox for something else, I ended up using a similar service but with Google Drive. The service is called http://gdriv.es/. You can find more details at http://gdriv.es/massmind


Site and Progress

Date: Tag: C++, Blog

      So, the last couple weeks I have been somewhat occupied with Olympics (and the lack of coverage by NBC). In the mean time I finally got around to writing base64 encoding and decoding (see [1] and [2]) in C. These functions only take the input chars and split out the values. You can extend this to be a class that takes a file or a stream (as a filter).

      As for this site, it is a work in progress. You can see it here -- http://kainr2.gofreeserve.com/blog/latest

Reference:

[1] Encode base64: Show | Hide

//------------------------------------------------------------------------------
/// Convert given 3 bytes of characters to 4 chars in base64
///
/// @args[out] output  An array for storing the output
/// @args[in] input  An array of chars (3 bytes)
/// @args[in] nBits  How many bytes of valid input
///
/// @return  Number of bytes written
///
int encode64(char output[], const char* const input, int nBytes)
{
   // Define binary map for each of the three chars
   // 0000-0011 1111-2222 2233-3333
   // * http://en.wikipedia.org/wiki/Base64
   static const int BYTE0  = 252;
   static const int BYTE1A = 3;
   static const int BYTE1B = 240;
   static const int BYTE2A = 15;
   static const int BYTE2B = 192;
   static const int BYTE3  = 63;

   static const char TERM_CHAR = '=';
   static const int  MAX_OUTPUT = 4;

   // Error check: Check for how many bytes are going to be read
   if (nBytes < 1 || nBytes > 3) {
       printf("Error: incorrect amount of bytes (%d)\n", nBytes);
       return 0;
   }

   // Error check: size of output
   if (sizeof(output)/sizeof(char) < static_cast(MAX_OUTPUT)) {
       printf("Insufficient amount of output buffer (%d)\n", 
        sizeof(output)/sizeof(char));
       return 0;
   }


   // Read each char input
   int nBytesOut = nBytes+1;
   if (nBytes>=1)
   {
       output[0] = (input[0] & BYTE0) >> 2;
       output[1] = ((input[0] & BYTE1A) << 4) + ((input[1] & BYTE1B) >> 4);
       output[2] = output[3] = TERM_CHAR;
   }

   if (nBytes>=2) {
       output[2] = ((input[1] & BYTE2A) << 2) + ((input[2] & BYTE2B) >> 6);
   }

   if (nBytes==3) {
       output[3] = (input[2] & BYTE3);
   }


   // Convert to base64 -- five sets
   // (1) 0-25 [A-Z]=[65-90]
   // (2) 26-51 [a-z]=[97-122]
   // (3) 52-61 [0-9]=[48-57]
   // (4) 62 [+]=[43]
   // (5) 63 [/]=[47]
   // * http://en.wikipedia.org/wiki/Base64
   // * http://www.asciitable.com/
   for (int i=0; i < nBytesOut; i++)
   {
       if (output[i]<=25) {
           output[i] += 65;
       } else if (output[i]<=51) {
           output[i] += 71;  // 97-26
       } else if (output[i]<=61) {
           output[i] -= 4;   // 48-52
       } else if (output[i]==62) {
           output[i] = 43;
       } else if (output[i]==63) {
           output[i] = 47;
       }
   }

   return nBytesOut;
}
   

[2] Decode base64: Show | Hide

//------------------------------------------------------------------------------
/// Convert given 4 chars to original 3 bytes
///
/// @args[out] output  Output buffer (3 bytes)
/// @args[in] input  An array of chars (4 chars)
/// @args[in] nBytes  How many bytes to read from input
///
/// @return  Number of bytes written
///
int decode64(char output[], const char* const input, int nBytes)
{
   // Define binary map for each of the three chars
   // 0000-0011 1111-2222 2233-3333  -- output-input bit map
   // 7654 3210 7654 3210 7654 3210  -- bits index of output
   //
   // 000000 001111 111122 222222 -- input-output bit map
   // * http://en.wikipedia.org/wiki/Base64
   static const int BYTE0  = 63;
   static const int BYTE1A = 48;  // 32+16
   static const int BYTE1B = 15;
   static const int BYTE2A = 60;
   static const int BYTE2B = 3;
   static const int BYTE3  = 63;

   static const char TERM_CHAR = '=';
   static const int  MAX_OUTPUT = 3;


   // Error check: Check for how many bytes are going to be read
   if (nBytes < 2 || nBytes > 4) {
       printf("Error: incorrect amount of bytes to read(%d)\n", nBytes);
       return 0;
   }

   // Error check: size of output
   if (sizeof(output)/sizeof(char) < static_cast(MAX_OUTPUT)) {
       printf("Insufficient amount of output buffer (%d)\n", 
          sizeof(output)/sizeof(char));
       return 0;
   }

   // Convert from  -- five sets
   // (1) 0-25  <- [A-Z]=[65-90]
   // (2) 26-51 <- [a-z]=[97-122]
   // (3) 52-61 <- [0-9]=[48-57]
   // (4) 62    <- [+]=[43]
   // (5) 63    <- [/]=[47]
   // (*) Skip terminal char
   // * http://en.wikipedia.org/wiki/Base64
   // * http://www.asciitable.com/
   char buffer[4];
   for (int i=0; i < 4; i++)
   {
       buffer[i] = (i < nBytes) ? input[i] : TERM_CHAR;

       if (buffer[i]>=65 && buffer[i]<=90) {
           buffer[i] -= 65;
       } else if (buffer[i]>=97 && buffer[i]<=122) {
           buffer[i] -= 71;
       } else if (buffer[i]>=48 && buffer[i]<=57) {
           buffer[i] += 4;
       } else if (buffer[i]==43) {
           buffer[i] = 62;
       } else if (buffer[i]==47) {
           buffer[i] = 63;
       }
   }



   // Read each char input
   int nBytesOut = nBytes-1;
   output[0] = output[1] = output[2] = 0;  // clear the buffer
   if (nBytes>=2)
   {
       // Take th lower 6 bits from buffer[0] to highest bits 7-2 of output[0]
       output[0] = ((buffer[0] & BYTE0) << 2)
           + ((buffer[1] & BYTE1A) >> 4);
   }

   if (nBytes>=3 && buffer[2]!=TERM_CHAR) {
       output[1] = ((buffer[1] & BYTE1B) << 4)
           + ((buffer[2] & BYTE2A) >> 2);
   }

   if (nBytes==4 && buffer[3]!=TERM_CHAR) {
       output[2] = ((buffer[2] & BYTE2B) << 6)
           + (buffer[3] & BYTE3);
   }


   return nBytesOut;
}
   


BBC Documentary -- 'The Men Who Made Us Fat'

Date: Tag: Documentary, Health

      Earlier this week, I saw part of the three hours BBC documentary called 'The Men Who Made Us Fat' on youtube. This documentary looks into the causation of why obesity is spreading rapidly among the British (and American) people. Looking at U.S. stat alone, the percentage of obese adults (age: 20 to 74) rises from appoximation 10% in 1950s to 30% early 2000s [See Wiki:Obesity_in_the_United_States]. Here are some of the key highlights I have seen so far:

  • Critical United States' public policies including the conversion of industrialize farming in the 1970s, and the beginning of fructose production
  • The undermining of public health policies and guidelines (ex: sugar consumption doesn't contributes to diabete) by corporate lobbies
  • Marketing strategies that change the social norm in U.K. to be a snacking and eat-on-run society
  • Ideas and innovation in business which push consumers to eat more, the healthy food paradox
  • And some suprising facts, like low-fat products use more sugar than normal to compenstate for the taste

      In my opinion, this documentary is pretty bias against corporations and in favor of more government oversight. It doesn't ask much for a personal accountability, but this IS a U.K. documentary afterall. The European philosophy of safety net is pretty strong. Anyways, this documentary is still worth taking a look. You can check it out on youtube also!

  • http://www.youtube.com/watch?v=iE-H__aIEFE&list=PLA0E2B2461B536A26&index=1&feature=plpp_video


Zend Framework and the Genius Teacher Problem

Date: Tag: Zend, PHP

      I think most people has this experience before. There you are in a classroom furiously writing down what the physics professor had on the board, while trying to understanding his explanation of an abstract physics theory. Every once in a while he provides examples that give a glimp of hope to understanding it. More often, everything just look confusing and incoherent. Your mind already give up after 10 minutes into the session. When you look around, other students are doing EXACTLY the same things -- taking notes and look confused. At the end of the class, the professor gets up and goes back to his research.

      For the last few weeks I have been learning Zend Framework for PHP. After hearing so much praises about its MVC framework, and how so many companies uses it, I decided to try it out. The concept and theory I read in the introduction were great -- MVC, convention overs configuration (a concept from Ruby on Rail), bootstrap, etc. Learning practical examples turned out to be a bad experience.

  • Zend's official quick tutorial throws you into the water of VC in MVC without a proper explanation about how a regular index.php is linked to a controller. Assuming you can get it working, you still have no understanding about why MVC framework without knowing how or why it works
  • Zend's API Document is not available offline. You are forced to use their online API Document web-app (generated by DocBlox). It run like a snail on my Firefox, and sometimes crash it also. This is my first time that an API Document crashes my browser! In contrast to Java, which has giant amount of documents, but able to keep it simple (KISS)
  • Zend's API Document is incomplete. It has the usual prototype of the constructor and public functions, but it really lack thoughtful explanation, examples, pitfalls, and exception thrown
  • Sheer out wrong information about certain concept. This is probably the part that scare me the most about Zend. I was looking at Zend to see if it can be used to provide a RESTful web service. Google points me to this document on Zend_Rest_Client & Zend_Rest_Server classes. It is almost as if they mistook REST for RMI. Nothing about CRUD or resource operation via URL

      Adding to these problems, the documents are not updated. Comments from 2009 pointing the flaws and complains on the poor documents are still valid. To be honest, giving how much it is being used in the industry, I am surprise that no one tried to create a better document for them yet. So, how is this relate to the story I mentioned earlier? You should know by now, Zend is like the Physics teacher that students that nobody quite understand. Zend's official document is like those ambiguous lessons that students merely follow but not master. I could on with my analogy, but it only going to sound bitter.

      In the past, Zend was the only big MVC framework in town, so people were forced to adopt it. However, serveral new PHP framework are popping up and gaining lots of momentum (See CssReflex.com). They are leaner, faster, and better documented. Any hope to redeem Zend is almost pointless. If Zend really want to compete and stay in business, they better fix all these document issues in Zend Framework 2.0.



Saturday, March 03, 2012

Reblog: WordPress - Little Known Features

Mar 3, 2012

Hi, my name is Kittipong. Each month, I will try to bring my (near zero) insight on a different aspect of life and different points in programmings. And today, I will write a bit about Yahoo! Search. Specifically, about the different little features that many people might have seen once or twice, but not quite sure about it.

You may wonder why on earth I pick Yahoo! Search for feature on this blog. Well, the fact is that everyone knows about all the google-fu for Google Search. There are so many people talking and using it, which led to publication of books dedicated to hacking of Google search engine: Google Hacking for Penetration Testers, Google Hacks: Tips & Tools for Finding and Using the World’s Information, etc. You can find them on Amazon. All of this is great; except there is nothing about it on Yahoo! or Bing search engines. In fact, did you know that Yahoo! first have the mini-drop-down keywords suggestion? When I first saw it, I thought, “What a great idea!!”, except… nobody talks about it. When Google copies the feature few months later, there were a slew of articles and comments congratulating Google for its innovation. At that moment, I saw Yahoo! in a different light. In the public eyes, Yahoo! was like the unwanted child. The one that the parents have no expectation, or really care for. The one that can do no right. Over time, Yahoo! has come to believe the public’s opinion that it is not worthy of being great. Thus, it sold part of its soul.

But…

All the great things that has been done, should not be forgotten. Here is a little something to show for…

(A) Do you remember Google’s original search box (before the tab or the crazy Google+ drop down menu)? No fat, no frill. Yahoo! decided to get one too.

(B) Search for a specific car brand and model, and you should get a full auto review.

(C) Celebrity is one of Yahoo!’s prime features. There are few ways the results can be returned. It depends on who the celebrity is (singer, actor, politician), and the current trend.

(D) Enter a metropolitan name (or any famous city), and there will be a little box with the name, the current weather, a photo-op, and little details about the city.

(E) Golf tournament?! Seriously? Anyways, search for a golf tournament, and you get the score. Although, to be honest, I am not sure why would anyone use Yahoo! search for it.

(F) Search for a local brand or a restaurant name, and you should see a mini map with location. Nothing exciting. Personally, I would use yelp with Google map.

(G) Oh, boy. This is something I see a Google search also. You do the math.

(H) Mobile app was something they added a year ago. Enter an app name, and you will see it. Probably useful on a mobile device.

(I) This seems pretty standard for me. A movie title, a poster, and a little box to search for play time.

(J) A query for a music band search produces albums and songs lists. I was going to enter Justin Bieber for the heck of it. But I think we had enough of him AND his songs… ~~Baby baby baby Ohhhh~~~ Baby baby baby NOOOO!!!~~~

(K) Blah, blah, blah. News

(L) If you ever enter product name, or an auto parts, you may get Yahoo! shopping results in a slideshow.

(M) Before internet, we all eats food, but majority of the people don’t know how to cook. Unfortunately, internet still does not solve the biggest cooking problem — cooking skill.

(N) Sport player. Sport team. One will give you the score. Another will give you the recent statistics.

(O) If you enter a stock symbol, you can get the stock price. But more likely, you will find yourself looking at news…

So, there you go. I have revealed Yahoo!’s hidden features that so many people never bother to look at, or share with the world! Some of you may question, what do I gain from sharing these functionality of a second-rated search engine? And the answer? No, it is not acknowledge; certainly, not respect nor personal ego. It is simpler, but deeper than that. Sometimes when I get to know a person or watch an entity that shares a similar experience, I begin to cheer for it too.

End of messages


Sunday, February 26, 2012

Reblog: WordPress - A Cycle of Blogs

Feb 26, 2012

Hi, my name is Kittipong, and this is my blog. It is a blog about my insight into life, and programmings. Each month, I will try to bring my (near zero) insight on a different aspect of life, or different points in programmings. And if you have any comment, feel free to comments.

Since this is my first blog, I probably should give a back history. I started working on a website back in late 1990′s. If I am not wrong, it was 1998 when I was still in high school. Back then I was not sure why anyone need a website, so even though I learned HTML couple years earlier, I did not create a personal site until 1998. So, what changed my mind back in 1998?

If you think it was for a humanitarian cause, then you thought too much of me. If you say curiosity, then you are in for a disappointment. It was for a simpler cause. It was for love. No, it was not for the love of technology. In fact, there probably was no love involved. One day during the autumn of my junior year, I was talking to couple girls in my class. They were smart and quite literate in computer, and one of the topic involved a website. When I told them I know HTML & CSS, one of them encouraged me to start one. And like any young blind teenager, a whisper from a girl was enough to made me started a website. Tada!!!

I started with Geocities. Yes, the same Geocities that is no longer around anymore. Tokyo, Palace, 4409. That was my Geocities address. And it lasted many, many years. Until I graduated and got a degree. Oh, the memory of simpler days. And, oh the realization that Geocities had no plugins for scripting languages, or DB. That was a big problem when I tried to get a job, and my Geocities failed to impress. This was back in 2005. So, in the end, I registered another host that allowed PHP & Mysql combo. All were rosy, until I realized one thing… it was hard to backup mysql.

The free host did not provide any backup. So, I had to perform manual backup — display all posts and save the HTML. Hmmm… In addition, with all the programming works on the site, I hardly use site for blogging anymore. Actually it came pretty close to being a revision README file. Another problem I faced was the need to visit the site every weeks, or it could be closed. Yeeeaaaa!! NOT!

Just to speed up. It did get closed. I started a blog on Google (eBlogger). It was filled with posts that made me look like I had a mid-life crisis every other weeks. Since I did not have anyone to complain to, it ended as new posts every so often. After two years of tween-life crisis, I took another shot at PHP & Mysql site again. And SURE enough, I got lazy for a while, and it was closed down. Geeez. So, here we are with wordpress. Hopefully, I can do better this time.


Saturday, December 31, 2011

Reblog: FortuneCity - 2011

Since FortuneCity is not longer available, I figure I copy the old stuff and paste it here. Luckily, Blogger supports CSS, so it is mostly copy-and-paste, then adjust some font size. :)
2011-07-30 SAT // 美術學校的廣告
* 美術教育,對孩子們的成長非常重要。
美術教育是一門必修課,沒有美術教育,就沒有素質教育。
* 我們的文化藝術的夏令營,為學生彌補了這重要的一課。
夏令營特安排每天上,
* 下午都有一節美術課,
這也是我們文化藝術的夏令營是其它暑期班不可比的。
* 如您想讓您的孩子,這個暑期,
在加強英文,數學,中文的同時,
* 還想在繪畫技能和創意方面得到強化訓練,
請家長們千萬不要錯過,
* 每年只有這一次的大好機會,
請參加江老師美術學校舉辦的文化藝術夏令營!


* Art is an important to children's growth. It is an essential course, without art is to be without an inner quality.
* Our art summer class allow students to make up for this important course. The summer class is prepared daily,
* every afternoon's art class is our non-summer class(?)
* If you are interested in letting your child join this summer, which reinforce English, Math, and Chinese at the same time,
* and expand their art skill and creativity, head of the household, do not miss this opportunity,
* each year this is the big oppportunity, please join teacher Jiang's summer art class!
2011-07-05 TUE // 少林功夫【一】
說起功夫,人們就會想起少林寺以及功夫高強的僧人。
少林寺和倍的寺院不同的地方,就在於功夫。
可是念經的僧人怎麼會和武術聯繫在一起呢?

關於少林功夫的起源有多種說法,其中一種是:
沙林寺僧人打坐,坐累了,
就站起來活動活動的身體,打打拳練練武,
他們發現,這也可以得到一種精神上的修煉。
後來,少林的僧人結合,獸,鳥,魚,蟲的各種動作
以及民間武功的精華,逐步形成了少林獨特的功夫

    少林功夫是中國寶貴的文化遺產,
有拳術,刀術,槍術,劍術,棍術
以及氣功等多種套路和功法。
它剛健有力,變化無窮,
所以學習功夫不僅可以鍛煉身體,
而且還可以修身養性。
1500多年來,少林功夫吸引了千千萬萬的愛好者,
成為中國廣為流傳的一種健身方法

    少林功夫很早以前就流傳到國外。
現在世界上很多地方都有少林功夫愛好者,
很多人還不遠萬里道少林寺參觀學習。
2011-06-27 MON // Nothing Loss
    There are days, where I just sit and think seriously -- morally and philosophically. I did not have much times or chances to do so in last few years, but this passed weekend I had one. Nothing earth shattering, or even revelational. However, the mental recognition of "I am alive" is refreshing even if physically, I did nothing.

    In Taoism, there is an idea that actively pursing happiness results in emptiness, but a passive mind can find fulfillment. It is similar to the feeling from a long meditation.
2011-02-19 SAT // California Public School
    Over the past two weeks, I got a chance to watch some interesting documents regarding public schools. First is a documentary movie called Waiting for Superman (2010), and another was shown on PBS called Not As Good As You Think - The Myth of the Middle Class School. Both documentaries point out some of the problem in the current education system, the inability to reform the current education system.

    Waiting for Superman focuses on union contract of teachers that prevent firing of inept or bad teachers. One major problem is teacher-union organizations that holds political power, and pushes against any change in the system. Not As Good As You Think looks at one of the school district in Orange County, where district education administrators misappropriate the money. It started with public criticism from the community when they found out that administrators were using public money to build administration building($52 million), while schools were laying off teachers. And when the people from the community tried to change, they were black-listed by the school board. The board even go so far as to creating flyers asking local to fight back against these activists -- with names, phone numbers, and home addresses.

    After watching those documentaries, I thought back about how teacher unions went crazy when LA Times did a study and publish a teacher-ranking list of Los Angeles public school teachers. So, with only internet, I figure it would be interesting what can parents do to find out more about their local schools:
  • School Digger ~ This site shows public school rating. It also included a tool that shows what schools are in the zip code area. Another useful tool is CST Test Schore charts of schools with % of proficiency on various subject.
  • GreatSchools.com ~ This site has its own rating of public schools (GREATSCHOOLS RATING), but there are several comments from parents also
  • The National Association of Independent Schools ~ Load and load of information about schools, but may required registration
  • Private School Review ~ For private shcools, it includes details like tuition per year
  • Los Angeles Teacher Ratings ~ This rating was done back in 2009/2010 and it drew a whole load of fire from both sides of the public. Worth checking it out if you lived in Los Angeles.
  • RateMyTeachers.com ~ Just like RateMyProfessor, this is for K-12... okay, it is mainly meant for high school students.
  • Not As Good As You Think: The Myth of The Middle Class School: Part I and Part II


    Well, anyways, that is it for me. All comments are welcome. My email is shown on the navigation menu...
2011-01-08 SAT // Digital Afterlife
Yesterday I thought that you would never leave me
But I feel that yesterday is now gone
-- Lyric from Yesterday by Miss Destiny

    Today I got an opportunity to read an article about digital afterlife on NYTimes. The article digs on the impact of Mac Tonnies -- a scifi author in his 30s, a blogger of scifi-related stuff with several online followers and friends. So, when he suddenly went to bed and passed away, many could not believe it. His online friends pull together to preseve his works and materials, Mac's digital footprint. However, some content cannot be retrieved because they have no access to his online accounts. His parents also don't have access to Mac's digital life. They never used computer before his death, and wasn't involved with Mac's digital presence.

    So, what about myself? What kind of message am I leaving here? When I look back, it certainly started out noble and experimental. Before the term "blog" was used, I would create log entries. There were lots of things I tried out. It took a lot of effort and as you can see... none ever stick around. At times, I would complain and babble about stories that only I would know. At present, I am somewhat at my digital peace. I couldn't write much anymore. I don't know who to write this for. I don't know what to write anymore.

    Certain things in life, even after you gave your best, and it did not amount to anything significant. But, nevertheless, you keep moving on.

Article: Cyberspace When You're Dead