Apr 28

     ตอนนี้ ถ้าไม่พูดถึงน้องแก้ม The star คงจะไม่ได้แล้ว เพราะน้องเขามาแรงจริงๆ ผมละก็เป็นแฟนคลับคนนึงเหมือนกันครับ สาวน้อยคมเข้มจากบ้านเกิดเมืองนอนเดียวกัน (อิอิ รีบนับญาติเชียว) ผมก็เอาใจช่วยเชียร์มาตลอด (เพิ่งจะได้เอามือถือช่วยเชียร์ก็ครั้งสุดท้ายนี่หละครับ แหะๆ) จนเธอได้เป็น The star 4 จนได้ (ดีใจแทนหนะ)

     ผมว่าน้องเค้าเป็นคนที่มีทั้งพรสวรรค์และพรแสวงในการร้องเพลงเลยหละ ตั้งแต่เห็นครั้งแรก ผมก็นึกถึง Beyonce ขึ้นมาทันที ไม่นึกว่าความสามารถของเธอจะทำให้หลายๆคน (รวมทั้งผม) ไม่ตะขิดตะขวงใจเลยที่จะยกเธอให้เป็นน้องสาว Beyonce งานนี้ผมหา clip video ที่เธอร้องเพลง Listen มาให้ฟังกันด้วยครับ รับรองไม่ผิดหวังในพลังเสียงสุดๆ ของเธอ

     นอกจากความสามารถที่เปี่ยม(จน)ล้นของเธอแล้ว มันยังต้องอาศัยเสียงโหวต ที่จะช่วยให้เธอก้าวสู่ตำแหน่งนั้นได้ด้วย ส่วนหนึ่งเลยผมว่าเพราะคนภูเก็ต ผมไม่ได้บอกว่าที่แก้มชนะเป็นเพราะคนภูเก็ตเท่านั้นที่ช่วยกันเทคะแนนโหวตให้แก้ม แต่ก็เพราะทุกเสียงของแฟนคลับนั่นแหละครับ แต่ที่กำลังจะบอกนั่นก็คือ พี่น้องชาวภูเก็ตเขารักกันจริงๆ ถ้าคุณได้มาสัมผัสเมืองภูเก็ตในช่วงสัปดาห์ที่ผ่านมา คุณจะเห็นว่ามีป้ายโฆษณาช่วยเชียร์แก้ม ติดกันให้เห็นอยู่มากมาย ไม่ว่าจะเป็นร้านหนังสือเอย (อย่างร้านเส้งโห ร้านหนังสือที่-ผมเชื่อว่า-ใหญ่ที่สุดในภูเก็ต ใหญ่กว่า B2S อีกหนะ) หรือห้างร้านอะไรต่อมิอะไรเอย ผมประทับใจในน้ำใจมากครับเลย คนเฒ่าคนแก่บางคนแม้จะส่ง sms ไม่เป็น ก็ให้ลูกให้หลานช่วยกดให้ หลานบางคนได้โอกาส แหม… กดเอาๆ จนโทรศัพท์ยายหมดซะงั้น - -”

อันข้างล่างนี้ละครับ ผมชอบที่สุดเลย ผมได้ยินบางคนก็พูดว่า

“คอยแลต๊ะ อีแก้มได๊เป๋นเดอะส๊ะตาแหน เผาะหวาฉ้านช๋วยโว๊ต”
[subtitle] “คอยดูนะ น้องแก้มได้เป็น The star แน่ เพราะว่าฉันช่วยโหวต”

     โดยส่วนใหญ่แล้วคนที่พูดแบบนี้หนะ คือเค้าไม่เคยโหวตในรายการไหนๆ มาก่อน แล้วเค้าก็โหวตให้ครั้งนึงครับ แต่ไอ้ครั้งนึงนี่แหละครับ ผมจะบอกว่าคนที่พูดแบบนี้มีหลายคนจริงๆ อย่างน้อยผมก็ได้ยินสามสี่คนหละ คนละเล็กคนละน้อยก็ทั่วเกาะภูเก็ต คนที่ไม่เคยโหวตก็ส่งกันเข้า งานนี้น้องแก้มจะไม่ชนะขาดได้งัยหละ พูดแล้วก็ซึ้งน้ำใจจริงๆ ครับ

Onion_sure

ขอบคุณทุกแรงใจ แรงมือในการกดมือถือ
และแรงทรัพย์ที่ช่วยเชียร์น้องแก้มครับ
so d0m3z

Apr 14

     The first part of this topic has explained what prototypes are and how they are used. Recall that, JS chooses rather to link the prototype to the blank object than to duplicate it. This results in the share of property code and method code - the more they share, the less memory they require. Carefully read that they share the code, not the memory space. Looking at the following example:

function X() {
}
X.prototype = {
     x: 0,
     getX: function(){
          return this.x;
     },
     setX: function(new_x){
          this.x = new_x;
     }
}
myNum = new X();
yourNum = new X();
myNum.setX(8);
document.write(yourNum.getX());   // print "0"

     After the 2 objects are created,  they contain nothing. The call setX() on “myNum”, which is available upon its prototype chain, sets “this.x” to the specified number. The “this” keyword in this context references to the object “myNum”, not the prototype. It does not change the “x” in the prototype. You might check it out by yourself. The next line calling getX(), is also found in its prototype chain. The reference to “this.x” does not directly mean the “x” in the prototype, but it is indirectly referenced because the property “x” is not in the object itself. That is, “this.x” is later found in its prototype chain.
     The art of JS language design, as you see, is extremely fascinating. The memory used is minimized as less as possible. However, the following code can cause a logical error that is unknown to most programers.

function X(){
}
X.prototype = new function(){
     var x;
     this.getX =  function(){
          return x;
     }
     this.setX = function(new_x){
          x = new_x;
     }
}
myNum = new X();
yourNum = new X();
myNum.setX(8);
document.write(yourNum.getX());   // print "8"

     Differently coded, the sematic is almost the same except that “x” is set local or private. You might think that the above is better. However, unlike local variables in the constructor that are saved as separate closures for separate objects, “x” is shared among objects that link it as their prototype. The reason is that, the prototype is an object that has been instantiated long before. The save of the closure was done only once by the time the prototype was instantiated. As a result, there is only one closure shared among objects. So, be very careful if you wish to use private variables, which is not supported directly by JS.
     Prototypes are not only used for object instantiation, but also for primitive types. Surprising? Remember that, reference types and corresponding primitive types are differentiated only by the presence of the “new” keyword. But, they do share the same constructor. The “new” keyword simply gives you a blank object linked to its prototype. Without “new” keyword, a memory is also allocated to that primitive value and linked to the prototype as well. The “this” keyword refer to the primitive data instead of object. That is a reason why we have a wonderful code work nicely.

Number.prototype.isOdd = function(){
     return (this%2)? true : false;
}
var a = 7;
if(a.isOdd())
     document.write("Is it really odd?");

JS Prototypes

     By now, I assume that you are familiar with prototypes. The following referencing is meant to check your understanding. It can confuse you more if you do not really understand. Think of what they are before execute it. The weird syntax is used by mean to guide you to the answer. There is a saying that thousands words cannot better explain than a picture. Looking up this picture will also guide you to the answer. I got it from MollyPages.org

var Foo = Function("", "this.x = 6;");
var myObj = new Foo();
var myList = [
     myObj.__proto__,
     myObj.__proto__.constructor,
     Foo.prototype,
     Foo.__proto__,
     Foo.__proto__.constructor,
     Object.prototype.__proto__,
     myObj.__proto__.constructor.__proto__.constructor,
]
for(index in myList){
     document.write("<li>" + myList[index] + "</li>");
}

Onion_sure

กุบ้าได้ที่แล้ว หึหึ . . .
so d0m3z

Apr 14

     Prototypes are class-like objects that act as templates for prototype-based languages. In this topic we will get through it in detail. Recall that functions are primitive data. Looking at them this way, rather than procedural way, will help you better understand the content.
     Since functions are like other variables, these following code should not be surprising - they can posses some properties and methods like primitive strings.

var myObj = new function(){
     this.x = 6;
}
var foo = function() {
     return this.x;
}
document.write(foo.call(myObj));   // print "6"
document.write(foo.apply(myObj));   // print "6"
document.write(typeof foo.prototype);   // print "object"

     The “prototype” property of the function foo, as you can see, is an object of reference type. It points to an ordinary object. It is, in deed, a prototype linked when instantiating a new object. Let’s inspect in detail before going further.

var suspectingObject = foo.prototype;
document.write(suspectingObject.constructor);
suspectingObject.sayHi = function() {
     alert("Hi!");
}

     This object (the prototype) has a reference back to the function it belongs to. The print out, therefore, shows the function “foo”. That is, functions and their prototypes are doubly linked back and forth using “.prototype” and “.constructor”. The last statement simply shows the dynamic declaration possible as other ordinary objects.
     You can even change the entire thing by:

foo.prototype = new function(){
     this.bar = "bar";
     this.show = function(){
          alert(this.bar);
     }
     this.constructor = foo;
}

     Changing the reference to prototype to a newly created object (with any style of declaration) is also possible, but make sure that the reference back to the constructor is set correctly. Be very careful because you are working manually.
     It is now high time to know the automatic machanism of the object instantiation. Suppose that a new object is instantiated with a function named “Foo” acting as the constructor. As far as you know, the “new” keyword simply gives you a blank object, and calls Foo() in the context of that object’s scope. Moreover, the “new” object is linked to the “Foo.prototype” object. Remark that, the prototype now is pointed to by many objects.
     The following code will help you closer inspect the prototypes. Unfortuantely, it works only on Firefox and Netscape.

function Car(){
     this.speed = 10;
}
Car.prototype.color = "black";
var myCar = new Car();
for(key in myCar.__proto__)
     document.write(key + ": " + myCar.__proto__[key]);
document.write(myCar.__proto__.constructor);

     The special property “__proto__” is provided for every object, referencing to the prototype of the function used as its constructor. Traversal through myCar.__proto__ simply prints out the prototype’s properties (eg. color). The last statement, of course, prints out the function “Car”.
     At this moment, you can go back the case when the called properties or methods are not available in the specified object. The prototype chain means the linkage connected fomr an object to another by “__proto__”. JS will climb up the chain searching for those unavailable properties and methods . The word “chain” suggests that the prototype object can be instatntiated from another function, and form a long chain.

Onion_nga

 นี่แค่เริ่มต้นคร้าบพี่น้อง
 so d0m3z

« Previous Entries