Thursday, March 20, 2014

Work: What Went Wrong?

If everyone thinks the same way, then society would fail at the first stupid idea

Over the last few days, I got some time to think about what make and break a project. After some long thought, it comes down these few reasons:
  • people: managers, co-workers, supporting teams, external teams
  • plan: vision, milestones, requirements, designs
  • execution: tools, communications, automation
  • non-engineering: timeline, finance, competitors
So, why oh why... do projects fail? Because there are thousands of ways it could go wrong. And should one factor stands out too much, it becomes a loose string in a sweater that slowly taking other parts down with it.
      If the leader has no vision, then there is no direction
      If the team does not have the right tools, then the product will be delayed
      If the co-workers do not get along, then parts won't fit well together

So, when I was asked what went well, I could have given the usual answer -- we work hard, we tried to plan, we created some automation, etc. But I answered with what went wrong -- lack planning, and insufficient tools. However, I never got around to people... It is sad to see that there are much more to be said, but change-agents limit the scope. If the goal is to bring changes, then all ideas should come before any time constraints. The insufficiency of patient, sincerity, and humility is what I see, and it means nothing will change. THAT is what went wrong after all the wrongs...

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.