2011年2月20日日曜日

日本の和って…

真面目に思ったことを忘れぬうちに…

営利企業の現場は冷酷なまでに投資とリターンの場だと思ってる。でもそれが世界標準になってきているなら、それを真似したって横並びかもしれない。だから日本の和の精神とかが今後重要になるんじゃないかと思っている。

でも勘違いしちゃいけない、やっちゃいけないと思っていることは、和の精神を尊ぶ気持ちが結果としてでも自己犠牲を強制するような構造になってしまうこと。

高度成長期を支えたおじさんたちは猛烈に働いたんだと思う。苦しいながらもやってきた理由の一つには、そういう仲間との和があったからだと思う。それを次の世代に教えてほしい。そして自分を含め今の30、20代の世代はそれを学ぶ必要があるんじゃないかと思う。

そして日本の和も昔のものから進化する必要があるのかもしれない。そしてそれが出来るのも今の世代だけなんだろう。

本当はそんなことを頭でうだうだ考えるのではなくて、働きながら、市場・会社に揉まれながら必要に応じて編み出していくべきなんだろうけど…というわけで泥まみれになって働いてもいない輩のウンチクなのかもね。

2011年2月19日土曜日

My minutes "Tutorials:How jQuery Works"

Learning "Tutorials:How jQuery Works", so here is my minute and code. My minutes are written in comment area.
There seems be no function like "sleep" in Javascript or jQuery, is this because of Javascript doesn't intend to run threads? mmh, I don't know why currently, but I will find it later.


<!DOCTYPE html>
 <html lang="en">

 <script type="text/javascript">
 // from http://www.devcheater.com/
 function sleep(milliSeconds){
  var startTime = new Date().getTime(); // get the current time
  while (new Date().getTime() < startTime + milliSeconds); // hog cpu
 }
</script>

 <style>
    a.test { font-weight: bold; }
 </style>

 <head>
   <meta charset="utf-8">
   <title>jQuery demo</title>
 </head>
 <body>
   <a href="http://jquery.com/">jQuery</a>
   <!--
    jQuery can be downloaded from jQuery downloading page,
    but we can use it on CDN.
    jQuery download page : http://docs.jquery.com/Downloading_jQuery
    what is CDN : http://en.wikipedia.org/wiki/Content_delivery_network
   -->
   <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
   <script>
     /*
      window.onload() waits all documents and images loaded.
      it might include ads.
      .ready() event means that the DOM object is loaded and can be manipulated.
      Events are listed in http://api.jquery.com/category/events/.
     */
     $(document).ready(function(){
       $("a").click(function(event){
         alert("As you can see, the link no longer took you to jquery.com");
         /*
          Dynamically, we can add class to the DOM object.
         */
         $("a").addClass("test");
         /*
          wait for 3 secs, before the next alert dialog.
          addClass behaviour cannot be observated without this sleep.
         */
         sleep(3000);
         alert("Check the object added the class");

         /*
          Remove the class dynamically that is added just before.
         */
         $("a").removeClass("test");
         sleep(3000);
         alert("Check the object removed the class");

         /*
           "a" tag is for navigating a user to the location where "url" specifes.
          but "event.preventDefault()" disables such default behavior.
           Therefore,navigation to the next location does not happen.
          */ 
         event.preventDefault();

         /*
          Finally, this object("a") will hide. this is a special effect.
         */
         $(this).hide("slow");
       });
     });
   </script>
 </body>
 </html>

2011年2月12日土曜日

Starting JQuery with Twitter

Here is the first my code referencing to below URL.
http://www.atmarkit.co.jp/fwcr/rensai/ajaxrecipe01/ajaxrecipe01_1.html

Onload, this page tries to get Twitter's public_timeline with JSON format.
Then, shows  some values of the first element by JavaScript alert dialog.

<html>
<head>
  <script type="text/javascript">
    function foo(json) {
      alert(json[0].user.name);
      alert(json[0].user.location);
      alert(json[0].user.url);

    }
  </script>

  <script type="text/javascript"             
    src="http://api.twitter.com/1/statuses/public_timeline.json?callback=foo">

  </script>
</head>
<body>
</body>
</html>

* Code-Prettify (a tool for highlighting codes made by Google)
* Twitter API doc