Pages

Tuesday, January 26, 2010

รู้จัก .NET 3.0

ถ้าจะพูดถึง window workflow จริง ๆ ก็มีมานานแล้วละครับ ตั้งแต่สมัยที่ .net 3.0 ออกมา ก็นานพอสมควร ก่อนอื่นเรามาดู .net 3.0 กันก่อนดีกว่า ว่ามีความสามารถอะไรกันบ้าง


จริง ๆ .net 3.0 มันจะทำต่อมาจาก .net 2.0 โดยเพิ่ม มาอีก 4 ส่วนคือ
  1. CardSpace จะเป็นส่วนที่ทำหน้าที่เก็บข้อมูล Card เพื่อยืนยันตัวตา อย่างเช่นพวกบัตรเครดิตที่ใช้ซื้อสินค้า online โดยข้อมูลจะเก็บที่เครื่อง client
  2. Window Presentation Foundation (WPF) จะเป็นส่วนแสดงผลทำงานโดยใช้เทคโนโลยีแบบ Vector Graphic ข้อดีคือ ไม่ทำให้ภาพแตกเวลาที่เราซูม (โดยปกติที่ซูมมันแตกตลอด) และยังทำเป็น 3 มิติ สามารถหมุนได้
  3. Window Communication Foundation (WCF) จะเป็นส่วนที่สร้างมา สำหรับการออกแบบ application แบบ service-oriented จะมีลักษณะคลายกับ Object-oriented แต่ service-oriented จะไม่มองลึกถึงระดับ object แต่จะมองแค่ service
  4. Window WorkFlow (WF) เป็นส่วนที่ใช้สร้างแบบการไหลของการทำงาน
Visual studio 2005 ก็สามารถทำงานได้ แต่ว่าจะต้องลง .net 3.0 ก่อนนะครับ เป็นอะไรที่น่าตื่นเต้น ๆ




Friday, January 15, 2010

PHP5 Consume .Net Web service

error_reporting(E_ALL);
$ValidateEmail = new SoapClient("http://www.webservicex.net/ValidateEmail.asmx?wsdl");
$email = array("Email" => "me@somewhere.com");
try {
$response = $ValidateEmail->IsValidEmail($email);
if ($response->IsValidEmailResult) {
echo $email["Email"] . " is a valid email address";
} else {
echo $email["Email"] . " is not a valid email address";
}
} catch (SoapFault $fault) {
//LOG IF YOU WANT
echo $email["Email"] . " is not a valid email address";
}

echo '
' . var_dump($response) . '
';
?>

Thursday, January 14, 2010

WSDL vs. non-WSDL Modes

พอดีวันนี้ จำเป็นที่จะต้อง consume .net web service using php5 with soap extesion แล้วไปเจอเขากับ article ที่ : http://wso2.org/library/1060
เขาจะพูดเรื่องของ php soap extension แล้วผ่านไปมาเจอกับ web service module 2 แบบ คือ
1. WSDL model
2. non-WSDL model

เลยลองอ่านเพิ่มเติม ประกฏว่าได้เรื่องดังนี้ครับ (ไม่แน่ใจว่าผมเข้าใจถูกหรือเปล่าว)

สำหรับการ implement web service จะมีอยู่ 2 models ด้วยกันคือ
1. Contract First model
2. Code First model

สอง model นี้มันต่างกันยังไง

อันแรก Contact first model จะมี WSDL เป็นตัวที่ใช้อธิบาย detail ของ web service ซึ่งภายในก็จะอธิบายถึงการ implement and consume

อันหลัง Code first model. In the code first model, the code implementing the service is written first. Then in most cases a contract, in other words a WSDL, is generated out of the code. Then the client can use that WSDL, at the time of consuming the service, to take note of the interface of the service. However, the PHP 5's SOAP extension does not have provisions for generating a WSDL out of the code. To cater for this situation, the non-WSDL mode of the SoapServer and SoapClient can be used.

ง่าย ๆ คือ php extension นี้จะไม่มีการ generate wsdl ให้ เหมือนใน nusoap

Thursday, January 7, 2010

Intorduction wcf

จริง ๆ wcf ก็มีมานานแล้วละ ตั้งแต่ .net 3.0 ก็เคยของอ่านนิดหน่อยแบบเผิน ๆ ไม่ได้จริงจังกับมันมา
และมาถึงวันนี้ เริ่มที่จะมีงานเข้าที่จำเป็นต้องใช้ wcf เต็มตัวก็เลยต้องมาปัดฝุ่นกันนิดหน่อย

ก่อนอื่นมาดู features ของ wcf ที่เหนือกว่า asp.net web service

1. Support for sending messages using not only HTTP, but also TCP and other network protocols.
2. The ability to switch message protocols with minimal effort.
3. Support for hosting services on hosts other than a Web server.
4. Built-in support for the latest Web services standards (SOAP 1.2 and WS-*) and the 5. ability to easily support new ones.
6. Support for security, transactions and reliability.
7. Support for sending messages using formats other than SOAP, such as Representational State Transfer (REST).

Resource : http://msdn.microsoft.com/en-us/netframework/aa663324.aspx

แกะ wordpress

วันนี้นั่งแกะ wordpress แล้วเริ่มงง เพราะเท่าที่ผมเคยแกะมา (ชั่วโมงบินยังไม่เยอะ) ก็จะเป็นของ joomla, drupal
รู้สึกว่า wordpress จะเขียนแบบง่าย ๆ ไม่ยุ่งยากเท่ากับ joomla

เรื่องก็มีอยู่ว่าผมจะทำ plugin ขึ้นมาตัวหนึ่งแต่ไม่รู้จะเขียนยังไง หาใน google ก็มีอยู่นะแบบง่าย ๆ แต่ยังไม่เจาะลึกเท่าไหร่
อืม.... เหนื่อยใจ ไม่มีทางเลือกละ ก็เลยจัดการแกะมันทุกไฟล์ซะเลย ไล่ตั้งแต่ index.php เลยว่ามันมีการ include widget, plugin , template เข้ามากันยังไง เหอะๆ แกะไปแกะมาเริ่มออก ออกนี้คืออกอาการงงนะครับ ไม่ใช่แกะได้สำเร็จ