ป้ายกำกับ

วันจันทร์ที่ 20 มกราคม พ.ศ. 2557

Eclipse cannot start after upgrade Ubuntu to 13.10

สองวันมานี้ผมเสียเวลาไปกับการอัพเกรดเครื่องจาก Ubuntu 12.04 LTS ไปเป็น 13.10 เนื่องจากผมต้องการทดลองใช้งานโปรแกรมใหม่ๆ จึงคิดว่าถึงเวลาเตรียมพร้อมสำหรับ 14.04 LTS ที่จะออกมาประมาณเดือนเมษายนนี้แล้ว โดยผมใช้วิธีค่อยๆอัพเกรดเป็นขั้นๆ เนื่องจากมีโปรแกรมหลายๆอย่างที่ผมไม่อยากตั้งค่าใหม่ และอยากจะเห็นความเปลี่ยนแปลงของแต่ละรุ่นด้วย แต่ก็เสียเวลามากหน่อยเพราะต้องอัพเกรดดังนี้

  • จาก 12.04 LTS ไปเป็น 12.10
  • จาก 12.10 ไปเป็น 13.04
  • จาก 13.04 ไปเป็น 13.10
เสียเวลาไปเกือบสองวัน สุดท้ายก็ได้ทุกอย่างสมกับที่ยอมเสียเวลาเหนื่อย

แต่ก็มีปัญหากับ Eclipse ที่รันไม่ได้ ปัญหานี้มักจะเจอบ่อยๆในหลายๆครั้งที่ผมอัพเกรด Ubuntu ครั้งนี้มี Error คือ

!SESSION Mon Jan 20 21:15:05 ICT 2014 ------------------------------------------
!ENTRY org.eclipse.equinox.launcher 4 0 2014-01-20 21:15:05.091
!MESSAGE Exception launching the Eclipse Platform:
!STACK
java.lang.ClassNotFoundException: org.eclipse.core.runtime.adaptor.EclipseStarter
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:626)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584)
at org.eclipse.equinox.launcher.Main.run(Main.java:1438)
at org.eclipse.equinox.launcher.Main.main(Main.java:1414)

มีหลายคนแนะนำให้แก้ไขไฟล์ eclipse/configuration/config.ini เนื่องจากชื่อไฟล์ org.eclipse.osgi_x.x.x.jar ไม่ตรงกับรุ่นที่ติดตั้ง ซึ่งเมื่อผมตรวจสอบ พบว่า ในเครื่องของผมไม่มีไฟล์นี้อยู่ ไม่รู้ว่าหายไปไหน และก็ไม่รู้ว่าจะเอามาจากไหนดีด้วย ค้นไปค้นมา ก็พบว่ามันอยู่ใน Package ชื่อ libequinox-osgi-java ครับ แต่ในเครื่องมันแสดงว่าผมติดตั้งไว้แล้ว ซึ่งควรจะมีไฟล์อยู่ ผมจึง reinstall ใหม่ ก็ใช้ได้เลยครับ

วันพุธที่ 15 มกราคม พ.ศ. 2557

Hadoop 1.x Installation on Ubuntu

เมื่อประมาณเกือบๆ 1 ปีที่ผ่านมา ผมได้ติดตั้ง Hadoop รุ่น 1.1.2 บน Ubuntu 12.04 LTS เรียบร้อยไปแล้ว ซึ่งตอนนั้นมีปัญหาในการติดตั้งบางอย่าง แต่ผมก็ได้แก้ปัญหาไปแล้ว แต่มาเมื่อสัปดาห์ก่อน ผมต้องการติดตั้ง Hadoop บนอีกเครื่องหนึ่ง ทำให้ผมต้องมารื้อฟื้นความจำว่าปัญหาเก่าๆที่เคยแก้ไปนั้น ผมทำอย่างไร แต่นึกเท่าไหร่ก็นึกไม่ออกสักที ไฟล์เก่าๆที่เคยบันทึก หรือ เขียนสคริปท์ไว้ ตอนนี้ก็ไม่รู้เก็บไว้ที่ไหนแล้ว เนื่องจากผมมีการ backup ไฟล์ไว้หลายที่ กระจัดกระจายกันไป ไม่มีเวลามาจัดให้เข้าที่เข้าทางสักที (ดูเหมือนจะเป็นปัญหาคลาสสิกสำหรับคนไอทีเลยก็ว่าได้ ใครมีไอเดียดีๆที่ช่วยแก้ปัญหานี้ได้น่าจะทำโปรแกรมขายได้นะครับ) ครั้งนี้ผมจึงอาศัยการบันทึกไว้ที่บล็อกนี้แทน และหวังว่าจะเป็นประโยชน์สำหรับบางคนที่ติดปัญหาเดียวกัน

Hadoop Version

รุ่นของ Hadoop ที่เมื่อก่อนผมเลือกใช้ คือ 1.1.2 ตอนนั้น น่าจะเป็นรุ่นใหม่ที่ stable ที่สุดแล้ว แต่ปัจจุบันนี้ มีรุ่นที่เป็น stable อยู่ 2 รุ่น เนื่องจากมีการแตกรุ่นออกเป็น 1.x และ 2.x โดยรุ่น stable ของ 1.x คือ 1.2.1 ส่วนรุ่น stable ของ 2.x คือ 2.2.0 ครับ
  • 1.x stable -> 1.2.1 (1 Aug, 2013)
  • 2.x stable -> 2.2.0 (15 Oct, 2013)
ทีแรกผมจะทดลองติดตั้ง 2.x แต่ก็เกรงว่า โปรแกรมเก่าจะใช้งานไม่ได้ ประกอบกับ เมื่อเข้าไปดาวโหลดไฟล์แล้ว ปรากฏว่า ไม่มี Debian Package ให้ดาวโหลด ผิดกับ 1.2.1 ที่มี Package ทั้งแบบ Debian (.deb) RedHat(.rpm) และ Binary(.tar.gz) รวมทั้งมีทั้งสถาปัตยกรรมแบบ i386 และ x86_64 ให้ครบหมด ผมจึงตัดสินใจดาวโหลด 1.2.1 มาลง ซึ่งก็พบว่าปัญหาเดิมที่พบใน 1.1.2 ยังไม่ได้รับการแก้ไข

Why Debian Package?

ระบบปฏิบัติการ Ubuntu นั้น มีพื้นฐานมาจาก Debian ดังนั้น Package สำหรับติดตั้งโปรแกรมจึงเป็นแบบ Debian ซึ่งสำหรับใครที่ติดตั้งด้วย Binary และทำตามคำแนะนำในเว็บไซต์ต่างๆ ก็ทำได้ครับ แต่จะไม่เหมือนกับ Debian Package ที่มีการวางระบบไฟล์ ไม่ว่าจะเป็น Configuration Library Script และอื่นๆไว้ในแบบของ Debian มีการกำหนดสิทธิ์ในการเข้าถึงไฟล์ต่างเหล่านี้อย่างเป็นระบบและเพื่อความปลอดภัยสูง ไม่ให้เกิดช่องโหว่ได้ ดังนั้น เราจึงควรทำตามที่กำหนดไว้จะดีที่สุด แต่สำหรับการทดลอง ทดสอบ หรือใช้พัฒนาโปรแกรมโดยเราใช้เองคนเดียว การติดตั้งแบบ Binary ก็จะสะดวกกว่ามากครับ เพราะทุกอย่างจะรวมอยู่ในโฟลเดอร์เดียวหมด แตกไฟล์มาก็แทบจะใช้ได้เลย

Users/Groups are not created during installation

เมื่อนำไฟล์ .deb มาติดตั้ง โดยปกติเมื่อ double-click ที่ไฟล์ โปรแกรม Package Installer จะทำงาน เปิดหน้าต่างมาให้เราติดตั้ง ซึ่งเป็น GUI ทำให้สะดวกมาก แต่จะทำให้เราไม่ทันได้สังเกตข้อความแจ้งเตือนต่างๆ จึงเข้าใจว่าติดตั้งเสร็จเรียบร้อยแล้ว แต่พอไปใช้งานก็จะมีปัญหา ซึ่งถ้าเราติดตั้งด้วยคำสั่ง
sudo -E dpkg -i hadoop_1.2.1-1_x86_64.deb

หมายเหตุ:

ที่กำหนด option -E ไว้ เพื่อให้มีการนำค่า JAVA_HOME ที่กำหนดไว้มาใช้ตอนติดตั้ง

ปัญหาแรกที่เราจะพบเมื่อติดตั้ง คือข้อความ
Selecting previously unselected package hadoop.
(Reading database ... 336159 files and directories currently installed.)
Unpacking hadoop (from .../hadoop_1.2.1-1_x86_64.deb) ...
groupadd: GID '123' already exists
Setting up hadoop (1.2.1) ...
chown: invalid group: `root:hadoop'
ซึ่งปกติแล้ว จะเป็นขั้นตอนการสร้าง group ชื่อ hadoop และ user ชื่อ mapred และ hdfs โดยสามารถตรวจสอบได้ ด้วยการเปิดดูไฟล์ preinst ซึ่งเป็นสคริปท์ที่จะถูกรันหลังจากที่มีการแตกไฟล์(Unpacking)เรียบร้อยแล้ว ซึ่งสคริปท์นี้เขียนไว้ตายตัวคือ
getent group hadoop 2>/dev/null >/dev/null || /usr/sbin/groupadd -g 123 -r hadoop
หมายความว่าให้สร้าง group ชื่อ hadoop โดยกำหนดให้มี GID เป็น 123 ซึ่งถ้าหากในเครื่องของเรามี GID 123 อยู่แล้ว ก็จะเกิด error GID '123' already exists นั่นเอง ข้อผิดพลาดนี้ได้มีการรายงานไว้แล้วตั้งแต่รุ่น 1.0.3 แต่ยังไม่ได้รับการแก้ไข สาเหตุของปัญหานี้เกิดจากการใช้คำสั่ง groupadd ซึ่งปกติแล้ว บนระบบ Debian จะมีอีกคำสั่งหนึ่งคือ addgroup ซึ่งทำงานคล้ายกัน groupadd จะเป็นคำสั่งระดับล่าง ส่วน addgroup จะเป็นคำสั่งระดับบน ซึ่งถ้าเราไม่กำหนด GID คำสั่ง addgroup จะหาค่าที่เหมาะสมตามระบบของ Debian มาให้แทน ดังนั้น คำสั่งนี้ควรจะแก้เป็น
getent group hadoop 2>/dev/null >/dev/null || /usr/sbin/addgroup --system hadoop
แต่เนื่องจากเราได้ติดตั้งไฟล์ไปแล้ว จึงแก้ไขด้วยการสั่งเองภายหลังจากที่แตกไฟล์เรียบร้อยแล้ว ดังนี้
/usr/sbin/addgroup --system hadoop
/usr/sbin/adduser --shell /bin/bash --no-create-home --system --ingroup hadoop --home /var/lib/hadoop/mapred mapred
/usr/sbin/adduser --shell /bin/bash --no-create-home --system --ingroup hadoop --home /var/lib/hadoop/hdfs hdfs
ซึ่งจะสร้าง group ชื่อ hadoop และ user ชื่อ mapred และ hdfs ขึ้นมา

Configuration Files

ก่อนที่เราจะเริ่ม start Hadoop จะมี config ไฟล์ที่ต้องแก้ไขต่างๆ ซึ่งตามคำแนะนำใน Document ของ Hadoop 1.2.1 จะระบุชื่อไฟล์ในโฟลเดอร์ conf แต่ Debian Package จะย้ายไปอยู่ที่ /etc/hadoop โดยมีไฟล์ต่างๆที่ต้องแก้ไขดังนี้
  1. hadoop-env.sh
    • กำหนดค่า JAVA_HOME ใหม่ให้ถูกต้อง สำหรับค่า default ที่กำหนดไว้คือ /usr/lib/jvm/java-6-sun แต่เนื่องจากบน Ubuntu จะใช้ OpenJDK เป็นหลัก ผมจึงเปลี่ยนค่าให้เป็น /usr/lib/jvm/default-java ซึ่งจะใช้ default JDK ที่ติดตั้งไว้ โดยปกติแล้ว Ubuntu 12.04 LTS จะใช้ OpenJDK 6 ซึ่งน่าจะเข้ากันได้ดี แต่เนื่องจากผมมีโปรแกรมบางตัวที่ใช้ Java 7 จึงเปลี่ยนมาใช้ OpenJDK 7 (หวังว่าจะไม่มีปัญหา)
    • หากต้องการเปลี่ยนค่า environment สามารถใช้คำสั่ง update-hadoop-env.sh ได้ โดยสั่ง
    • sudo -E bash /usr/sbin/update-hadoop-env.sh --prefix=/usr --bin-dir=/usr/bin --sbin-dir=/usr/sbin --conf-dir=/etc/hadoop --log-dir=/var/log/hadoop --pid-dir=/var/run/hadoop
  2. master/slave
    • master ไฟล์ จะเก็บรายชื่อเครื่องที่ทำหน้าที่เป็น NameNode ซึ่งจะเป็นเครื่องแม่ และสามารถเป็น JobTracker TaskTracker และ DataNode ได้ด้วย
    • slave ไฟล์ จะเก็บรายชื่อเครื่องที่ทำหน้าที่เป็น DataNode และเป็น TaskTracker ได้ด้วย
    • ถ้าติดตั้งในโหมด Single-Node ทั้งสองไฟล์จะมีค่าเป็น localhost
  3. *-site.xml
    • core-site.xml เป็นไฟล์ที่เก็บค่าเกี่ยวกับ NameNode เช่น fs.default.name เป็นค่า URL ของเครื่อง NameNode ที่ Hadoop ในเครื่องนั้นๆจะติดต่อด้วย โดยค่า default ใน Debian Package กำหนดไว้เป็น hdfs://localhost:8020 แต่เว็บอื่นๆมักกำหนดค่าตัวอย่างไว้ที่พอร์ต 9000 หรือ 9001 ซึ่งจะต้องระวังการกำหนดค่าตรงนี้ให้ดี เพราะหากชนกับบริการอื่นๆที่มีอยู่ในเครื่อง NameNode ก็จะไม่สามารถ start ได้ ค่า default ต่างๆของไฟล์นี้ สามารถดูได้จากไฟล์ core-default.xml
    • hdfs-site.xml เป็นไฟล์ที่เก็บค่าเกี่ยวกับ HDFS ว่าจะมีการจัดแบ่งข้อมูลของระบบอย่างไร โดยเฉพาะค่า dfs.replication ซึ่งเป็นจำนวนการทำซ้ำข้อมูล จำนวนนี้ไม่ควรเกินจำนวน DataNode ค่า default ต่างๆของไฟล์นี้ สามารถดูได้จากไฟล์ hdfs-default.xml
    • mapred-site.xml เป็นไฟล์ที่เก็บค่าเกี่ยวกับ JobTracker ค่า default ต่างๆของไฟล์นี้ สามารถดูได้จากไฟล์ mapred-default.xml

Operation Mode

ระบบ Hadoop จะประกอบไปด้วยบริการ 4 ประเภทคือ
  1. NameNode เป็นบริการหลัก ทำหน้าที่ค้นหาและจัดการบริการอื่นๆในระบบ
  2. JobTracker ทำหน้าที่จัดคิวการทำงาน
  3. TaskTracker ทำหน้าที่ประมวลผล Map-Reduce หรืองานอื่นๆ
  4. DataNode ทำหน้าที่จัดการข้อมูลในระบบ HDFS (Hadoop Distributed File System)
ซึ่งบริการทั้ง 4 ประเภท สามารถทำงานอยู่บนเครื่องๆเดียวได้ (Single-Node โหมด) หรือจะแบ่งเป็นเครื่อง 2 กลุ่ม คือ master ซึ่งสามารถมีบริการทั้ง 4 ประเภทในเครื่องเดียว หรือ slave ซึ่งจะมีบริการเฉพาะ TaskTracker และ DataNode เท่านั้น เพื่อแบ่งหรือกระจายการประมวลผลและข้อมูลของระบบออกไปยังเครื่องลูกจำนวนมากๆ โดยการติดตั้งระบบ เราสามารถเลือกติดตั้งให้ทำงานได้ 3 โหมดคือ
  1. Local (Standalone)
    • การทำงานจะอยู่บนเครื่องเดียว และไม่เป็นเครือข่าย
    • โหมดนี้เป็น default ของโปรแกรม หากยังไม่มีการตั้งค่าใดๆ
    • เหมาะกับการทดสอบและ debug มากกว่า
  2. Pseudo-Distributed (Single-Node)
    • การทำงานจะอยู่บนเครื่องเดียว แต่เป็นเครือข่าย
    • สามารถตั้งค่าต่างๆได้ง่ายด้วยโปรแกรม hadoop-setup-single-node.sh
    • เหมาะกับการใช้งานเบื้องต้น และพร้อมที่จะขยายไปเป็น Fully-Distributed โหมด
  3. Fully-Distributed (Multi-Node)
    • การทำงานจะเป็นเครือข่ายหลายเครื่องสมบูรณ์แบบ
    • สามารถปรับแก้ไฟล์บางไฟล์จาก Pseudo-Distributed โหมด กลายเป็น Fully-Distributed โหมดได้ทันที
    • เหมาะกับการใช้งานเต็มรูปแบบ รองรับภาระงานเพิ่มขึ้นโดยเพิ่มจำนวนเครื่องได้

Setup Single-Node Mode

หลังจากที่เราติดตั้ง Debian Package เรียบร้อยแล้ว ไฟล์ hadoop-env.sh จะถูกตั้งค่า environment ไว้เรียบร้อยแล้ว แต่หากค่าต่างๆยังไม่ถูกต้อง เช่นค่า JAVA_HOME ควรแก้ไขให้ถูกต้องเสียก่อนนะครับ จากนั้นเราจะต้องตั้งค่าไฟล์ *-site.xml ให้ครบถ้วน ก่อน ซึ่งขึ้นอยู่กับโหมดการใช้งานที่เราต้องการ โดยปกติแล้วถ้าเป็น Standalone โหมด ก็ไม่ต้องแก้ไขอะไร แต่ส่วนใหญ่แล้ว เราจะไม่ใช้โหมดนี้ เราจะใช้โหมด Single-Node มากกว่า ซึ่งค่าต่างๆที่ต้องกำหนด สามารถศึกษาได้จาก document ซึ่งผมจะไม่ขอกล่าวในที่นี้นะครับ แต่เราก็มีวิธีที่ง่ายกว่านั้น เนื่องจากมีสคริปท์ช่วยอำนวยความสะดวกให้แล้วคือ hadoop-setup-single-node.sh โดยมีลำดับของการทำงานคือ
  1. ตั้งค่า config ต่างๆ
  2. ทำการ Format NameNode (เหมือนเรา Format ฮาร์ดดิสก์นะครับ)
  3. จัดเตรียมโครงสร้างของไฟล์ในระบบ HDFS
  4. start บริการต่างๆของ Hadoop ซึ่งก็คือ NameNode DataNode JobTracker และ TaskTracker
  5. ตั้งค่าสำหรับให้บริการต่างๆ start อัตโนมัติเมื่อบู๊ตเครื่อง
เมื่อรัน hadoop-setup-single-node.sh แล้วตอบ y ทั้งหมด คือเลือกใช้ค่า default ทั้งหมด ผลปรากฏว่า มีปัญหาเกี่ยวกับ permission ของโฟลเดอร์ /var/hadoop/log/root เกิดขึ้นตอนรัน JobTracker และ TaskTracker ซึ่งมีข้อความตัวอย่างดังนี้

* Starting Apache Hadoop Job Tracker server hadoop-jobtracker                                      chown: changing ownership of `/var/log/hadoop/root': Operation not permitted
starting jobtracker, logging to /var/log/hadoop/root/hadoop-root-jobtracker-SLOffice.out
/usr/sbin/hadoop-daemon.sh: line 137: /var/log/hadoop/root/hadoop-root-jobtracker-SLOffice.out: Permission denied
head: cannot open `/var/log/hadoop/root/hadoop-root-jobtracker-SLOffice.out' for reading: No such file or directory
/usr/sbin/hadoop-daemon.sh: line 147: /var/log/hadoop/root/hadoop-root-jobtracker-SLOffice.out: Permission denied
/usr/sbin/hadoop-daemon.sh: line 148: /var/log/hadoop/root/hadoop-root-jobtracker-SLOffice.out: Permission denied
                                                                                             [fail]
สาเหตุ เกิดจาก JobTracker และ TaskTracker จะถูกรันโดย user ชื่อ mapred แต่โฟลเดอร์ /var/log/hadoop/root ถูกสร้างขึ้น เพราะเราสั่งรัน hadoop-setup-single-node.sh ด้วย root ซึ่งตอนรัน NameNode และ DataNode จะรันโดย user ชื่อ hdfs ทำให้มีการเปลี่ยนสิทธิ์ของ /var/log/hadoop/root ให้เป็นของ hdfs:hadoop ด้วย chmod มีค่าเป็น 755 พอ mapred จะมาเปลี่ยน จึงเปลี่ยนไม่ได้ ผมจึงแก้ไขด้วย chmod ให้เป็น 775 แทน

Start/Stop Service

การสั่ง start/stop บริการต่างๆของ Hadoop ความจริงแล้ว จะมีสคริปท์ให้เรียกใช้ โดยเฉพาะคำสั่ง start-all.sh และ stop-all.sh ซึ่งจะไปเรียก start-dfs.sh/start-mapred.sh และ stop-dfs.sh/stop-mapred.sh อีกทีหนึ่ง โดย dfs นั้นจะมีบริการ NameNode และ DataNode อยู่ ส่วน mapred จะมี JobTracker และ TaskTracker ครับ ดังนั้น เราจึง start ได้ด้วยคำสั่ง
sudo start-all.sh
และ stop ด้วยคำสั่ง
sudo stop-all.sh
แต่ถ้าหากเรากำหนดให้ hadoop-setup-single-node.sh ติดตั้ง service ให้ start/stop Hadoop อัตโนมัติตอน boot/shutdown เครื่อง เราก็สามารถสั่ง start ได้ด้วยคำสั่ง
sudo service hadoop-xxx start
และ stop ได้ด้วยคำสั่ง
sudo service hadoop-xxx stop
โดยมีสคริปท์สำหรับบริการต่างๆอยู่ที่ /etc/init.d/hadoop-xxx คือ
  • hadoop-namenode
  • hadoop-datanode
  • hadoop-jobtracker
  • hadoop-tasktracker
  • hadoop-secondarynamenode (ปกติจะไม่ start อัตโนมัติ)
และคำสั่งทั้งหมดนั้น จริงๆแล้วจะไปเรียกคำสั่ง hadoop-daemon.sh อีกทีหนึ่ง ซึ่งสามารถเรียกใช้ได้เช่นกัน มีรูปแบบคือ
hadoop-daemon.sh [start/stop] [ชื่อบริการ]
เช่น
hadoop-daemon.sh start namenode

หมายเหตุ:

หาก start ด้วยวิธีใด ให้ stop ด้วยวิธีที่คู่กัน

Startup Checking

จากการตรวจสอบการทำงานด้วยคำสั่ง jps จะพบว่ามีเพียง NameNode DataNode และ TaskTracker รันอยู่ แต่ JobTracker ไม่มี ผมจึงเข้าไปตรวจสอบ log ไฟล์ของ JobTracker ที่โฟลเดอร์ /var/log/hadoop พบข้อความผิดพลาดคือ
WARN org.apache.hadoop.mapred.JobTracker: Failed to operate on mapred.system.dir (hdfs://localhost:8020/mapred/mapredsystem) because of permissions.
WARN org.apache.hadoop.mapred.JobTracker: Manually delete the mapred.system.dir (hdfs://localhost:8020/mapred/mapredsystem) and then start the JobTracker.
WARN org.apache.hadoop.mapred.JobTracker: Bailing out ...
org.apache.hadoop.security.AccessControlException: org.apache.hadoop.security.AccessControlException: Permission denied: user=mapred, access=WRITE, inode="":hdfs:supergroup:rwxr-xr-x
สาเหตุก็คือ เนื่องจากขั้นตอนที่ 3 ของ hadoop-setup-single-node.sh นั้น จะสร้างโฟลเดอร์ /tmp และ /usr ไว้ใน HDFS เท่านั้น จะไม่มีโฟลเดอร์ /mapred แต่เนื่องจากใน mapred-site.xml ได้กำหนดค่า mapred.system.dir ไว้ที่ /mapred/mapredsystem จึงทำให้ JobTracker พยายามที่จะเขียนข้อมูลไปที่นั่น แต่ก็ทำไม่ได้ และจบการทำงานไป วิธีการแก้ไขที่มีคนแนะนำไว้ก็คือ ให้ตั้งค่า mapred.system.dir ไปไว้ใน /tmp แทน โดยให้อิงกับค่า hadoop.tmp.dir ซึ่งจะต้องแก้ไขในไฟล์ mapred-site.xml ดังนี้
<property>
<name>mapred.system.dir</name>
<value>${hadoop.tmp.dir}/mapred/mapredsystem</value>
<final>true</final>
</property>
เมื่อแก้ไขเสร็จแล้ว สั่ง start JobTracker ใหม่ ก็จะพบปัญหาทำนองเดียวกันกับค่า mapred.job.tracker.history.completed.location จึงแก้ไขให้เป็น
<property>
<name>mapred.job.tracker.history.completed.location</name>
<value>${hadoop.tmp.dir}/mapred/history/done</value>
</property>

Web Interface

เมื่อแก้ไขข้อผิดพลาดต่างๆ และ start บริการต่างๆได้หมดแล้ว ก็สามารถเปิดดู NameNode ผ่านเว็บได้ที่ URL http://localhost:50070 ส่วน JobTracker เปิดดูได้ที่ http://localhost:50030

อ้างอิง



วันเสาร์ที่ 11 มกราคม พ.ศ. 2557

การแก้ไข Debian Package

วันนี้ผมมีปัญหากับการติดตั้ง Hadoop บน Ubuntu ซึ่งติดตั้งจาก Debian Package (.deb ไฟล์) แต่เนื่องจากภายใน package มีสคริปท์ที่เขียนไว้สำหรับติดตั้งมีปัญหาบางอย่าง จึงทำให้การติดตั้งไม่สมบูรณ์ ผมจึงอยากจะแก้ไข จึงค้นหาวิธีการมาฝากดังนี้

Debian Package File Format

สำหรับโครงสร้างไฟล์นั้น เป็น Archive ไฟล์แบบหนึ่ง (ไฟล์บีบอัด) เราสามารถใช้โปรแกรม Archive Manager เปิดดูไฟล์ภายในได้ หรือแม้แต่ใช้โปรแกรม Package Installer ก็สามารถดูข้อมูลภายในได้เช่นกัน สามารถแตกไฟล์ออกมาได้ แต่ถ้าเรามีไฟล์อยู่แล้วต้องการจะรวมเป็น Debian Package เขาแนะนำให้ใช้โปรแกรม dpkg-deb จะสะดวกมากครับ

Control Files

โดยโครงสร้างซึ่งเป็นไฟล์แบบบีบอัด ดังนั้น โปรแกรมของเราจะมีไฟล์อะไรบ้าง เราก็เตรียมไว้ให้มีโครงสร้างเป็นโฟลเดอร์ต่างๆตามแบบของ Debian เช่น Configuration ต่างๆควรอยู่ที่ /etc ส่วนโปรแกรมเฉพาะส่วนที่เป็น read-only ควรอยู่ที่ /usr และข้อมูลอื่นๆที่เปลี่ยนแปลงบ่อยๆก็ควรอยู่ที่ /var  เป็นต้น (อ่านรายละเอียดได้จากเรื่อง  Filesystem Hierarchy Standard)

นอกจากนี้ยังมีโฟลเดอร์พิเศษชื่อ DEBIAN สำหรับเก็บไฟล์ที่สำคัญของการติดตั้ง Package ซึ่งประกอบไปด้วยไฟล์ดังนี้ (อ้างอิง How to create a Debian .deb package)

  1. control - เก็บข้อมูลหลักของ package เช่น ชื่อ package, รุ่น, สถาปัตยกรรม ฯลฯ
  2. conffiles - เก็บรายชื่อ config ไฟล์ ที่จะไม่ลบทิ้งเมื่อ uninstall เนื่องจากผู้ใช้อาจจะต้องการลงโปรแกรมใหม่ด้วยค่า config เดิม
  3. md5sums - เก็บค่า md5sum ของทุกๆไฟล์ใน package เพื่อใช้ตรวจสอบความถูกต้องของข้อมูล
  4. preinst - เป็นสคริปท์ที่จะถูกเรียกหลังจากที่แตกไฟล์ต่างๆเสร็จแล้ว และก่อนที่จะทำการติดตั้งใดๆ เช่น สคริปท์สำหรับสร้าง user/group เป็นต้น
  5. postinst - เป็นสคริปท์ที่จะถูกเรียกหลังจากที่รัน preinst เสร็จแล้ว เพื่อติดตั้งค่าต่างๆรวมทั้ง init สคริปท์ต่างๆสำหรับให้โปรแกรมทำงานในสภาวะต่างๆ
  6. prerm - เป็นสคริปท์ที่จะถูกเรียกก่อนที่จะลบโปรแกม เพื่อยกเลิกการทำงานที่ค้างอยู่ ลบข้อมูลบางอย่างที่ถูกสร้างขึ้นจาก postinst
  7. postrm - เป็นสคริปท์ที่จะถูกเรียกหลังจากที่รัน prerm เสร็จแล้ว เพื่อลบสิ่งที่สร้างขึ้นจาก preinst

Extract Debian Package

สมมติว่าไฟล์ต่างๆที่เราจะแตกออกมา เราจะไปไว้ในโฟลเดอร์ชื่อ tmp โดยใช้คำสั่ง dpkg-deb เช่น สมมติว่า package ที่ต้องการจะแก้ไขชื่อ application.deb ใช้ -x เพื่อแตกไฟล์โปรแกรม ส่วน -e เพื่อแตก Control ไฟล์ ซึ่งจะต้องอยู่ในโฟลเดอร์ชื่อ DEBIAN นะครับ
dpkg-deb -x /path/to/application.deb tmp
dpkg-deb -e /path/to/application.deb tmp/DEBIAN
จากนั้นก็แก้ไขไฟล์ตามที่ต้องการได้เลย

Rebuild Package

เมื่อแก้ไขทุกอย่างเรียบร้อยแล้ว เราก็สามารถใช้ -b เพื่อที่จะ build Package ใหม่ดังนี้
dpkg-deb -b tmp /path/to/application-new.deb
ก็จะได้ Debian Package ใหม่ตามที่ต้องการ

วันอังคารที่ 17 ธันวาคม พ.ศ. 2556

CDN (Content Delivery Network) คืออะไร

CDN คืออะไร?

ความจริงคำว่า CDN มีมานานพอสมควรแล้ว แต่อาจจะไม่แพร่หลายเหมือนอย่างคำว่า Cloud ซึ่ง CDN นี้ ย่อมาจากคำว่า Content Delivery Network หรือบางท่านอาจจะเรียกว่า Content Distributed Network ความหมายสั้นๆตรงๆเลยก็คือ ระบบเครือข่ายที่จะทำหน้าที่ส่งข้อมูลให้ถึงผู้รับได้อย่างรวดเร็วโดยวิธีการกระจายเครื่องแม่ข่ายออกไปยังภูมิภาคต่างๆให้ไกล้กับผู้รับมากที่สุด เช่น เมื่อเราเปิดเว็บ Facebook ถ้าสังเกตข้อความแสดงสถานะการรอคอยข้อมูลด้านล่างของ Browser เราจะพบว่า แทนที่จะมีการดึงข้อมูลจาก www.facebook.com อย่างเดียว กลับมีการดึงข้อมูลมาจาก xxx.akamixx.net ซึ่งเป็น server ของบริษัท Akamai Technologies ที่ให้บริการ CDN ให้กับ Facebook นั่นเอง

แล้วมันยังไง?

หลายคนอาจจะสงสัยว่า แล้วเขาทำอย่างนั้นได้อย่างไร? คำตอบก็คือว่า จะมีการกระจายเครื่องแม่ข่ายออกไปตามภูมิภาคต่างๆ เช่น เว็บหลักอยู่ที่อเมริกา แต่มีการตั้งเครื่องแม่ข่ายกระจายไปยังประเทศอื่นๆ ไม่ว่าจะเป็น ญี่ปุ่น จีน อังกฤษ ออสเตรีย สิงคโปร์ เป็นต้น โดยจะมีการกระจายเนื้อหาที่เป็นแบบ static มาไว้บนเครื่องแม่ข่ายเหล่านี้ก่อน เช่น ไฟล์ภาพ ไฟล์วีดีโอคลิป ไฟล์ CSS และไฟล์ JavaScript เป็นต้น เมื่อมีการร้องขอข้อมูลใดๆไปยังเครื่องหลักที่ใช้ระบบ CDN การร้องขอนั้นก็จะถูก Re-Direct ไปยังเครื่องแม่ข่ายในระบบเคลือข่ายของ CDN ที่อยู่ไกล้ที่สุด ทำให้เราได้รับข้อมูลอย่างรวดเร็ว และลดภาระงานให้กับเครื่องหลักได้มาก นอกจากนี้ หากเครื่องใดรับภาระงานมากเกินไป ระบบก็สามารถกระจายภาระงานออกไปยังเครื่องแม่ข่ายอื่นๆที่อยู่ไกล้เคียงได้อย่างเหมาะสมอีกด้วย โดยที่เราแทบจะไม่รู้สึกเลยว่าข้อมูลนั้นมาจากไหน

ฟังดูแล้วมันเหมือน Cloud เลยหรือเปล่าล่ะครับ?
จะเรียกว่าใช่ก็ไม่เชิงครับ เอาเป็นว่า ระบบ Cloud Computing ที่เป็น Public Cloud ก็ใช้เทคโนโลยีนี้เป็นส่วนหนึ่งดีกว่าครับ เพราะระบบ Cloud Computing ยังมีอีกหลายๆเรื่องที่เป็นองค์ประกอบ ไว้วันหลังถ้าผมมีเวลาจะมาเขียนเล่าให้ฟังครับ

วันพุธที่ 30 ตุลาคม พ.ศ. 2556

Visual Studio 2013 ดาวโหดฟรีสำหรับนักศึกษา

วันนี้เมื่อผมเปิดใช้ Visual Studio 2012 มันเตือนให้ Update โดยขณะนี้เป็น Update 3 แล้ว ผมจำได้ว่าไม่ได้ใช้ Visual Studio เพียงไม่กี่เดือนเท่านั้นนี่นา เอแต่ทำไมจึงยังไม่เคยเห็น Update 2 เลย แต่ไม่ว่าจะเป็นรุ่นไหน ยังไงก็ขอ Update ซะหน่อย ปรากฏว่ามีปัญหาเล็กน้อย เนื่องจากไฟล์โปรแกรม Update ที่มันให้ดาวโหลดมาติดตั้งนั้น เมื่อรันแล้ว มันจะดาวโหลดส่วนอื่นๆที่เหลือมาลง และปรากฎว่า มันดาวโหลดมาเพียง Package เดียวแล้วก็ติดตั้งเลย ซึ่งทำให้เกิด Error ว่าหา Package อื่นๆไม่เจอ ผมก็เลยต้องดาวโหลดไฟล์เต็มๆมา ขนาดทั้งหมด 2.2GB เสียเวลาไปเป็นชั่วโมง สุดท้ายก็ติดตั้งได้เรียบร้อย

เมื่อเสร็จแล้ว ผมก็เลยคิดว่า แล้ว Visual Studio มีอะไรใหม่ๆเพิ่มขึ้นมาบ้าง ก็เลยเข้าเว็ปของไมโครซอฟต์ดู ปรากฏว่ามี Visual Studio 2013 ออกมาแล้วครับ ตามข่าวในเว็ปบอกว่าออกมาตั้งแต่เมื่อวันที่ 17 ตุลาคม 2556(2013) นี้  อืมช้าไปประมาณ 10+1 เดือน เพราะตามข่าวบอกว่าตอนนี้ปล่อยออกมาทางเว็ปให้ดาวโหลดไปทดลองกันดู เป็นรุ่น Released Candidate (RC) และจะปล่อยจริงเดือนหน้าครับ

อย่างไรก็ตาม ไมโครซอฟต์ก็ยังคงนโยบายเดิมคือมีรุ่น Express ให้ดาวโหลดไปใช้กันฟรีๆด้วย ซึ่งก็เรียกว่าเป็นปกติมาตั้งแต่สมัย Visual Studio 2005 แล้ว และยิ่งกว่านั้นคือ มีรุ่น Professional ให้ดาวโหลดฟรี สำหรับนักศึกษาด้วย อันนี้มีมาตั้งแต่สมัย Visual Studio 2012 ครับ งานนี้ไมโครซอฟต์ทุ่มทุนอย่างมากเลย แต่ก็ดีครับ เราก็จะได้ไม่ต้องใช้ของเถื่อน ละเมิดลิขสิทธิ์กัน ยังไงไมโครซอฟต์ก็ไม่ขาดทุนอยู่แล้ว ยิ่งมีนักพัฒนาบน Windows มากเท่าไหร่ ก็ยิ่งขายดีมากขึ้น

วันอังคารที่ 8 ตุลาคม พ.ศ. 2556

Professional jQuery

Title:Professional JQuery
Authors:Cesar Otero & Rob Larsen
Formats:PDF
Ids:GoogleDouban Books,9781118026687
Tags:JavaScript, jQuery, Programming Language, Web
Publishers:John Wiley & Sons
Author Sort:Otero, Cesar & Larsen, Rob
Title Sort:Professional JQuery
Date:08 ต.ค. 2013
uuid:0d8f471b-3b3a-428d-bec3-fe77f0382add
id:5953
Published:พ.ค. 2012
Modified:08 ต.ค. 2013
Size:22.69MB
Languages:English
Type:book

Over the past several years JavaScript has undergone a remarkable transformation. It is now one of the most important programming languages in the world. With the ongoing importance of Ajax-based development and the rise of full-featured JavaScript libraries, most of the stigma around JavaScript has vanished. The most beginner-friendly library, jQuery, is responsible for most of this turnaround. jQuery is used at some of the largest organizations in the world, including Amazon, IBM, Twitter, NBC, Best Buy, and Dell. In 2011 there were three major releases in jQuery and the community surrounding it continues to grow. jQuery is prominently featured at the front end of Java/Spring, PHP, .NET, Ruby on Rails, and Python/Django stacks all over the Web. If you have experience with HTML, CSS, and JavaScript, this book is for you. It will expand your jQuery knowledge by focusing on the core library with the benefit of strong core JavaScript expertise in many of the lessons.This book is aimed at three groups of readers: Experienced server-side web application developers looking to move into the client-side using the world's most popular front-end libraryExperienced JavaScript programmers looking to ramp up quickly on jQueryNovice to intermediate jQuery developers looking to expand their jQuery knowledge into more advanced topicsThis book is not aimed at beginners. For those looking to start with the basics of HTML, CSS, and JavaScript/jQuery development, " Beginning JavaScript and CSS Development with jQuery (Wrox Programmer to Programmer)" by Richard York will most likely help you more.This book covers a lot of information about jQuery including a developer-level introduction as well as providing an in-depth look into some of the more advanced features. The book is divided into two parts, jQuery Fundamentals and Applied jQuery. jQuery Fundamentals introduces the core concepts while Applied jQuery focuses on more advanced subjects. The first part of the book offers an in-depth introduction to jQuery fundamentals, which includes selecting elements, manipulating the DOM, and binding and reacting to browser books. After providing a solid foundation, the book will then outline more advanced topics such as plugin development, unit testing with JavaScript, and other advanced features of the library. The book also focuses on features available as of jQuery 1.7.1. but also tries to incorporate feature support in older versions of the library wherever it is relevant.The first few chapters will help you set up a development environment and they also review important JavaScript concepts. Chapters 3-7 examine the jQuery core concepts. The second half of the book focuses on applying jQuery in the real world as well as detailing jQuery UI, plugin development, and templates among other lessons.Part 1, jQuery Fundamentals, contains chapters 1-7. Chapter 1 sets up an environment for developing and debugging jQuery and JavaScript code. It also defines the code standards that will be used throughout the book. Chapter 2 goes through the basics of JavaScript programming language to strengthen the foundation that the rest of the book is built upon. Chapter 3 introduces the basic functions that make up the library and illuminates usages of the core jQuery functions. It also introduces many of the functions that you will need to perform varieties of tasks. Chapter 4 goes in-depth into one of the core features of jQuery, which is the ability to select and manipulate HTML elements. Chapter 5 introduces another feature of jQuery: the cross-browser ability to bind and manage browser events. Chapter 6 explores one of the biggest revolutions in web development in recent years--Ajax. Chapter 7 focuses on some of the shortcuts jQuery offers for animating components in your web applications. These include moving, fading, toggling, and resizing elements.Part 2, Applied jQuery, contains chapters 8-14. Chapter 8 introduces jQuery UI, which is an associated user interface library for jQuery and contains things such as widgets, effects, animations, and interactions. Chapter 9 explores additional jQuery UI features including moving, sorting, resizing, and selection elements with a mouse. Chapter 10 teaches a variety of techniques, best practices, and patterns that you can apply to your code to immediately make it more efficient, maintainable, and clear. Chapter 11 focuses on the jQuery Template plugin. Templates are a standard way of marrying data and markup snippets. Chapter 12 focuses on authoring jQuery plugins. It is important to know how to extend the power of jQuery with custom methods as it is a fundamental skill for a top jQuery developer. Chapter 13 introduces the jQuery Deferred Object, which was introduced in version 1.5. It is a chainable utility object that provides control over the way callback functions are handled. Chapter 14 introduces the general concept of unit testing and goes into detail with the specific unit testing framework created by and used by the jQuery project itself, QUnit.In order to use this book effectively, you will need one of the following web browsers to run the samples provided within the book: Firefox 3.6, Current -1 VersionInternet Explorer 6+Safari 5.0xOpera current - 1 VersionChrome Current - 1 VersionCesar Otero is a freelance web developer. His technical interests include Python, Django, JavaScript, and jQuery. He sometimes contributes articles to IBM's developer works. He holds a degree in electrical engineering.Rob Larsen has many years' experience as a front-end engineer and team leader. He has built websites and applications for some of the world's biggest brands. He is currently a Senior Specialist, Platform at Sapient Global markets. Rob is an active writer and speaker on web technology with a special focus on emerging standards like HTML5, CSS3, and JavaScript.

jQuery Ui 1.8

Title:jQuery Ui 1.8
Authors:Wellman, Dan
Formats:PDF
Ids:GoogleDouban Books,9781849516525
Tags:JavaScript, jQuery, Programming Language, UI, Web Programming
Publishers:Packt Publishing, Limited
Author Sort:Dan, Wellman,
Title Sort:jQuery Ui 1.8
Date:08 ต.ค. 2013
uuid:4ba7f0a4-6a55-4ba5-82aa-80865000c5d1
id:5952
Published:ส.ค. 2011
Modified:08 ต.ค. 2013
Size:7.11MB
Languages:English
Type:book

jQuery UI, the official suite of plugins for the jQuery JavaScript library, gives you a solid platform on which to build rich and engaging interfaces with maximum compatibility, stability, and a minimum of time and effort.jQuery UI has a series of ready-made user interface widgets and a comprehensive set of core interaction helpers to reduce the amount of code that you need to write to take a project from conception to completion.jQuery UI 1.8: The User Interface Library for jQuery has been specially revised for version 1.8 of jQuery UI. It is written to maximize your experience with the library by breaking down each component and walking you through examples that progressively build upon your knowledge, taking you from beginner to advanced usage in a series of easy-to-follow steps.Throughout the book, you'll learn how each component can be initialized in a basic default implementation and then customize and configure each component to tailor it to your application. You'll look at the configuration options and the methods exposed by each component's API to see how these can be used to bring out the best of the library. Each chapter will also show you the custom events fired by the component covered and how these events can be intercepted and acted upon.What you will learn from this book :How the CSS framework consistently themes the widgets and how these styles can be used in your own codeCreate a custom jQuery UI widget using the widget libraryThe underlying mark-up required by different components, and how each widget or interaction helper is initializedConfigure the different components, and the different options that each component usesWork with each widget programmatically using its methods and event hooksPractical examples of how each component can be usedAdd flair to your interface with animation effectsApproachAn example-based approach leads you step-by-step through the implementation and customization of each library component and its associated resources. Reference tables of each configuration option, method, and event for each component are provided, alongside detailed explanations of how each widget is used.Who this book is written forThis book is for front-end designers and developers who need to quickly learn how to use jQuery UI. To get the most out of this book you should have a good working knowledge of HTML, CSS, and JavaScript, and should ideally be comfortable using jQuery.

jQuery Pocket Reference

Title:jQuery Pocket Reference
Authors:David Flanagan
Formats:PDF
Ids:GoogleDouban Books,9781449397227
Tags:HTML, JavaScript, jQuery, Programming Languages, Reference, Web, Web Programming
Publishers:O'Reilly
Author Sort:Flanagan, David
Title Sort:jQuery Pocket Reference
Date:08 ต.ค. 2013
uuid:e6a094f5-2e20-412d-a9cb-0d176e71c239
id:5949
Published:ธ.ค. 2010
Modified:08 ต.ค. 2013
Size:0.71MB
Languages:English
Type:book

"As someone who uses jQuery on a regular basis, it was surprising to discover how much of the library I’m not using. This book is indispensable for anyone who is serious about using jQuery for non-trivial applications." -- Raffaele Cecco, longtime developer of video games, including Cybernoid, Exolon, and Stormlord
jQuery is the "write less, do more" JavaScript library. Its powerful features and ease of use have made it the most popular client-side JavaScript framework for the Web. This book is jQuery's trusty companion: the definitive "read less, learn more" guide to the library.
jQuery Pocket Reference explains everything you need to know about jQuery, completely and comprehensively. You'll learn how to:
* Select and manipulate document elements
* Alter document structure
* Handle and trigger events
* Create visual effects and animations
* Script HTTP with Ajax utilities
* Use jQuery's selectors and selection methods, utilities, plugins and more
The 25-page quick reference summarizes the library, listing all jQuery methods and functions, with signatures and descriptions.

jQuery in Action

Title:jQuery in Action
Authors:Bear Bibeault & Yehuda Katz
Formats:PDF
Ids:GoogleDouban Books,9781933988351
Tags:HTML, JavaScript, jQuery, Programming Languages, Web
Publishers:Manning Publications
Rating:★★★★
Author Sort:Bibeault, Bear & Katz, Yehuda
Title Sort:jQuery in Action
Date:08 ต.ค. 2013
uuid:aa51abf2-05cd-40d9-bafa-b0efa2693463
id:5948
Published:ก.พ. 2008
Modified:08 ต.ค. 2013
Size:23.17MB
Languages:English
Type:book

A good web development framework anticipates what you need to do and makes those tasks easier and more efficient; jQuery practically reads your mind. Developers of every stripe-hobbyists and professionals alike-fall in love with jQuery the minute they've reduced 20 lines of clunky JavaScript into three lines of elegant, readable code. This new, concise JavaScript library radically simplifies how you traverse HTML documents, handle events, perform animations, and add Ajax interactions to your web pages. "jQuery in Action," like jQuery itself, is a concise tool designed to make you a more efficient and effective web developer. In a short 300 pages, this book introduces you to the jQuery programming model and guides you through the major features and techniques you'll need to be productive immediately. The book anchors each new concept in the tasks you'll tackle in day-to-day web development and offers unique lab pages where you immediately put your jQuery knowledge to work. There are dozens of JavaScript libraries available now, with major companies like Google, Yahoo and AOL open-sourcing their in-house tools. This book shows you how jQuery stacks up against other libraries and helps you navigate interaction with other tools and frameworks. "jQuery in Action" offers a rich investigation of the up-and-coming jQuery library for client-side JavaScript. This book covers all major features and capabilities in a manner focused on getting the reader up and running with jQuery from the very first sections. Web Developers reading this book will gain a deep understanding of how to use jQuery to simplify their pages and lives, as well as learn the philosophy behind writingjQuery-enhanced pages.

WebKit คืออะไร

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

WebKit คือ

WebKit (webkit.org) เป็นโครงการ open source ที่สร้าง render engine สำหรับ web browser หรืออาจจะเรียกได้ว่ามันคือ render engine ของผลิตภัณฑ์หลายๆตัวใน Mac OS X System Framework  เช่น Safari Dashboard Mail และอื่นๆอีกมากมาย ซึ่งต้องขอย้ำว่า WebKit ไม่ใช่ browser แต่เป็น render engine สำหรับ browser โดยมีการนำ WebKit ไปสร้าง browser มากมาย ดังรายชื่อที่มีคนรวบรวมไว้ที่ Wiki ไม่ต่ำกว่า 30 ตัว

ความสามารถของ WebKit

  1. CSS (CSS1/CSS2.1/CSS3)
  2. DOM (HTML DOM, XML DOM)
  3. HTML/XHTML
  4. HTML Editing
  5. HTML Forms
  6. JavaScript (ECMAScript)
  7. MathML
  8. Plug-ins
  9. Printing
  10. SVG (SVG 1.1)
  11. Accessibility
  12. XML
  13. XSLT

Port

หลักๆแล้ว WebKit สร้างขึ้นสำหรับระบบปฏิบัติการ Mac OS X ซึ่งแกนหลักเป็น Linux ดังนั้นเวลาจะ build โปรแกรมให้ใช้งานบน Windows ได้ จะต้องมีโปรแกรมจำลองสภาพแวดล้อมให้เป็น Linux และที่เขาแนะนำไว้ก็คือโปรแกรม cygwin ส่วนระบบอื่นๆก็ยังมีอีก เช่น Qt GTK+ EFL และอื่นๆอีกมากมายเป็นต้น ซึ่งล้วนเป็น Linux เพียงแต่เปลี่ยน UI เท่านั้น โดยก่อนหน้านี้ WebKit เขียนด้วย Objective-C และกำลังเปลี่ยนผ่านมาสู่ WebCore ซึ่งเป็น C++ ทำให้สามารถ port ไปยังระบบอื่นๆได้ง่ายขึ้น

สรุป

ใครสนใจสร้างโปรแกรมที่ต้องการความสามารถบางส่วนเป็น browser ก็ลองศึกษาเพิ่มเติมดูตามลิ้งค์ที่ให้ไว้ได้เลยนะครับ

วันศุกร์ที่ 4 ตุลาคม พ.ศ. 2556

The Handbook of Formulas and Tables for Signal Processing

Title:The Handbook of Formulas and Tables for Signal Processing
Authors:Alexander D. Poularikas
Formats:PDF
Ids:GoogleDouban Books,9780849385797
Tags:Handbooks & Manuals, Reference, Signal Processing, Technology & Engineering
Publishers:CRC Press
Author Sort:Poularikas, Alexander D.
Title Sort:Handbook of Formulas and Tables for Signal Processing, The
Date:04 ต.ค. 2013
uuid:99c823b7-9eaa-49c1-bd78-6a21f199448c
id:6121
Published:ก.ย. 1998
Modified:04 ต.ค. 2013
Size:10.96MB
Languages:English
Type:book

Signal processing is a broad and timeless area. The term 'signal' includes audio, video, speech, image, communication, geophysical, sonar, radar, medical, and more. Signal processing applies to the theory and application of filtering, coding, transmitting, estimating, detecting, analyzing, recognizing, synthesizing, recording, and reproducing signals. "Handbook of Formulas and Tables for Signal Processing" a must-have reference for all engineering professionals involved in signal and image processing.Collecting the most useful formulas and tables - such as integral tables, formulas of algebra, formulas of trigonometry - the text includes: material for the deterministic and statistical signal processing areas; examples explaining the use of the given formula; numerous definitions; and, many figures that have been added to special chapters. "Handbook of Formulas and Tables for Signal Processing" brings together - in one textbook - all the equations necessary for signal and image processing for professionals transforming anything from a physical to a manipulated form, creating a new standard for any person starting a future in the broad, extensive area of research.

An Introduction to Statistical Signal Processing

Title:An Introduction to Statistical Signal Processing
Authors:Gray, Robert M.; Davisson, Lee D.; Robert M., Gray
Formats:PDF
Ids:Douban Books9780521131827
Tags:Signal Processing, Statistical
Author Sort:Gray, Gray, Robert M.; Davisson, Lee D.; Robert M.,
Title Sort:Introduction to Statistical Signal Processing, An
Date:04 ต.ค. 2013
uuid:d8b27a17-330b-4618-8d35-1abb1adba084
id:6120
Published:ก.พ. 2010
Modified:04 ต.ค. 2013
Size:1.72MB
Languages:English
Type:book

This book describes the essential tools and techniques of statistical signal processing. At every stage theoretical ideas are linked to specific applications in communications and signal processing using a range of carefully chosen examples. The book begins with a development of basic probability, random objects, expectation, and second order moment theory followed by a wide variety of examples of the most popular random process models and their basic uses and properties. Specific applications to the analysis of random signals and systems for communicating, estimating, detecting, modulating, and other processing of signals are interspersed throughout the book. Hundreds of homework problems are included and the book is ideal for graduate students of electrical engineering and applied mathematics. It is also a useful reference for researchers in signal processing and communications.

Introduction to Digital Signal and System Analysis


Title:Introduction to Digital Signal and System Analysis
Authors:Weiji Wang
Formats:PDF
Ids:Google9788740301588
Tags:Digital Signal Processing, System Analysis
Publishers:Bookboon
Author Sort:Wang, Weiji
Title Sort:Introduction to Digital Signal and System Analysis
Date:04 ต.ค. 2013
uuid:c2e4817c-0046-4dc7-8466-a0b94e52c5ae
id:6119
Modified:04 ต.ค. 2013
Size:3.78MB
Languages:English
Type:book

วันเสาร์ที่ 28 กันยายน พ.ศ. 2556

Jiayu JY-G3

อะไรๆมันเปลี่ยนแปลงไปอยู่เสมอ เมื่อถึงเวลา ผมเองก็ต้องเปลี่ยนตาม เพื่อปรับตัว
โทรศัพท์มือถือของผมใช้มาหลายปี ความจริงมันก็ยังใช้ได้อยู่ครับ ผมมีสองเครื่องดังภาพ
เครื่องทางซ้ายมือ เป็นเครื่องที่ใช้อยู่ประจำ ความจริงเครื่องนี้เก่ากว่าทางขวา เครื่องทางขวานั้นไม่ได้เสีย แต่ปุ่มกดเปิด-ปิดซึ่งมียางครอบมันเสื่อมสภาพหลุดออกไป ทำให้ต้องแหย่นิ้วเข้าไปในช่องเพื่อกดปุ่ม ซึ่งลำบากมาก พอดีเครื่องด้านซ้าย เป็นของแม่ยาย เขาทำหล่นจนจอเสียไป ผมก็เลยเอาไปซ่อม เสียค่าซ่อมน่าจะประมาณ 2-3ร้อยบาท ก็ใช้ได้ดีมาหลายปี เครื่องทางขวาก็เลยไว้เป็นที่ช๊าจแบ็ตฯแทน

ในขณะที่เมืองไทยก็มี 3G ค่อนข้างกระจายทั่วถึงมากขึ้น ผมก็มี iPad 2 ซึ่งภาควิชาฯได้ให้ไว้ทำงาน ปกติผมก็ใช้ WiFi แต่พอเดินทางก็ต้องงด ซึ่งความจริงก็ไม่เดือดร้อนมาก เพราะส่วนใหญ่ผมใช้มันอ่าน ebook มากกว่า ซึ่งรู้สึกไม่ค่อยคุ้มค่าสักเท่าไหร่นะครับ แต่ก็ต้องทำใจครับ เพราะความจริงแล้ว ช่วงแรกๆที่ผมได้ iPad 2 มา ผมใช้เวลาหลายเดือนเพื่อพยายามทำให้มันใช้ทำงานได้ โดยเฉพาะงานเขียนโปรแกรม แต่จนแล้วจนรอด ก็ไม่สามารถทำได้ ก็เลยต้องทำใจแทน (ใครมี solution ที่ดีๆช่วยแนะนำกันหน่อยนะครับ)

ช่วงประมาณ 2 เดือนมานี้ ผมก็ได้ทดลองศึกษา HTML5 jQuery และ jQuery Mobile เพื่อเขียนโปรแกรมให้กับทางแผนกศัลยศาสตร์ คณะแพทยศาสตร์ มหาวิทยาลัยสงขลานครินทร์ เนื่องจากเขาต้องการโปรแกรมที่ทำงานบนอุปกรณ์โมบาย เพื่อจะได้พกพาสะดวก โปรแกรมนี้เป็นโปรแกรมที่ใช้แสดงภาพเพื่อสื่อสารกับผู้ป่วย เนื่องจากผู้ป่วยที่ได้รับการผ่าตัดสอดท่อช่วยหายใจ ไม่สามารถพูดได้ จึงต้องสื่อสารด้วยภาพ และจะมี Text to speech ด้วยในอนาคต ทำให้ผมเริ่มเห็นแนวทางในการใช้ iPad ทำงาน เพราะสามารถใช้เครื่องมือง่ายๆเขียน JavaScript พร้อมทั้งทดสอบการทำงานได้ไม่ยุ่งยากนัก ทำให้ผมลองใช้ 3G ด้วยเครื่อง iPad นี้ และพบว่า 3G ของ DTAC ก็ค่อนข้างกระจายไปทั่วพอสมควรแล้ว จึงคิดว่าน่าจะถึงเวลาแล้วที่จะเปลี่ยนมือถือ 2G ของตัวเองเป็น 3G

และเช่นเคยครับ ช่วงนี้ iPhone 5s และ 5c กำลังเป็นที่ล่ำลือกันมาก ก่อนหน้านี้มีข่าวมาว่า 5c จะราคาถูก แต่พอราคาออกมาแบบนี้ ทำให้ผมมั่นใจมากที่จะซื้อมือถือจีน เพราะผมตั้งงบไว้สำหรับมือถือไม่เกิน 1หมื่นบาท เกินกว่านั้น ผมคิดว่าผมใช้งานไม่คุ้มค่าแน่นอน วันที่ Apple ประกาศเปิดตัว iPhone 5c จึงเป็นวันที่ผมตัดสินใจซื้อ Jiayu JY-G3 รุ่น upgrade ใช้ CPU MT6589T ซึ่งเป็น quad core (เดิมรุ่นนี้ CPU จะเป็น MT6577 ซึ่งเป็น dual core) ตัวนี้ในราคา $177.99 (ค่าส่งฟรี) หรือประมาณ 5,760 บาท (คิด $1 = 32 บาท) ซื้อมาจาก AliExpress ร้านชื่อ
Desoon Technology Co., Limited
ขออภัยที่ภาพถ่ายอาจจะไม่ชัด เพราะมือใหม่ ใช้งานยังไม่คล่อง เอาเป็นว่าดูรูปจากทางร้านที่ผมซื้อมาดีกว่าครับ

ส่วน Spec. เครื่อง ดูข้อมูลที่ได้จาก Android System Info กันเลยดีกว่าครับ (ขอตัดเอามาเฉพาะบางส่วนนะครับ เพราะมันยาวมาก)

OS

Browser UserAgent : Mozilla/5.0 (Linux; U; Android 4.2.1; en-us; JY-G3 Build/JOP40D) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30

BuildInfos

Android version : 4.2.1
Release Codename : REL
API LEVEL : 17
CPU ABI : armeabi-v7a
Manufacturer : JIAYU
Bootloader : unknown
CPU ABI2 : armeabi
Hardware : mt6589
Radio : unknown
Board : V6
Brand : JIAYU
Device : V6
Display : JY-G3 20130607-114647
Fingerprint : JIAYU/V6/V6:4.2.1/JOP40D/1373968121:user/test-keys

Memory

Download Cache Max: 123MB/ Free: 119MB
data Max: 2.50GB/ Free: 2.05GB --> ROM 4GB (เลือกรุ่นถูกสุด)
External storage: mounted
External storage Max: 29.32GB/ Free: 29.30GB --> อันนี้ใส่เพิ่มเอง 32GB
External storage removable: true
External storage emulated: false
Total RAM: 0.95GB
Free RAM: 170MB
Threshold RAM: 64.00MB

CPU

Processor ARMv7 Processor rev 2 (v7l)
processor 0
BogoMIPS 3043.37
processor 1
BogoMIPS 3053.37 --> ไม่แน่ใจว่าทำไมถึงเจอแค่ 2 core

Features swp half thumb fastmult vfp edsp thumbee neon vfpv3 tls vfpv4 idiva idivt
CPU implementer 0x41
CPU architecture 7
CPU variant 0x0
CPU part 0xc07
CPU revision 2
Hardware MT6589
Revision 0000
Serial 0000000000000000
Frequency range: 497.25 -> 1508.0MHz
Current Frequency: 1508.0MHz
Frequency Stats (time):
- 1508.0 MHz 9.57% (388628)
- 1209.0 MHz 55.08% (2235946)
- 988.0 MHz 0.38% (15292)
- 754.0 MHz 0.46% (18609)
- 497.25 MHz 34.52% (1401245)

Camera

Antibanding: off
Color Effect: none
Exposure Compensation: 0
Exposure Compensation Step: 1.0
Flash Mode: off
Focus Mode: auto
Focal Length: 3.5
Horizontal View Angle: 55.0
Jpeg Quality: 100
Jpeg Thumbnail Quality: 100
Jpeg Thumbnail Size: 128x160
Max Exposure Compensation: 3
Max Zoom: 10
Min Exposure Compensation: -3
Picture Format: JPEG
Picture Size: 1920x2560
Preview Format: NV21
Preview Framerate: 30
Preview Size: 480x640
Supported Antibanding:
  off  50hz  60hz  auto
Supported Color Effects:
  none  mono  negative  sepia  aqua  whiteboard  blackboard
Supported Flash Modes:
  off  on  auto  red-eye  torch
Supported Focus Modes:
  auto  macro  infinity  continuous-picture  continuous-video  manual  fullscan
Supported Jpeg Thumbnail Sizes:
  0x0  128x160  240x320
Supported Picture Formats:
  JPEG
Supported Picture Sizes:
240x320480x640768x1024720x1280
768x1280960x12801200x16001536x2048
1440x25601920x25602448x32641872x3328
1728x28802160x3600
Supported Preview Formats:
  NV21  UNKNOWN
Supported Preview Frame Rates:
  15  24  30
Supported Preview Sizes:
144x176240x320288x352320x480
368x480480x640480x720480x800
600x800480x864540x960720x1280
Supported Scene Modes:
  auto  portrait  landscape  night  night-portrait  theatre
  beach  snow  sunset  steadyphoto  fireworks  sports
  party  candlelight  hdr
Supported White Balance:
  auto  incandescent  fluorescent  warm-fluorescent
  daylight  cloudy-daylight  twilight  shade
White Balance: auto
Vertical View Angle: 42.0
Zoom: 0
Zoom Ratios:
  100  114  132  151  174  200  229  263  303  348  400
Smooth Zoom Supported: true
Zoom Supported: true

Screen

Resolution: 720 x 1280
Refresh Rate: 54.060005
X factor for DIP: 2.0
Density: 320 dpi
Pixel per inch X: 320.0 dpi Y: 320.0 dpi

OpenGL

OpenGL Version supported : 2.0
OpenGL Version supported : OpenGL ES-CM 1.1
Vendor : Imagination Technologies
Renderer : PowerVR SGX 544MP

Sensors

BMA050 3-axis Accelerometer: 0.13 mA by Bosch
cm36283 Proximity Sensor: 0.13 mA by Capella
cm36283 Light Sensor: 0.13 mA by Capella

MPU3050c gyroscope Sensor: 6.1 mA by Invensensor
BMM050 3-axis Magnetic Field sensor: 0.25 mA by Bosch
Rotation Vector Sensor: 6.48 mA by Google Inc.
Gravity Sensor: 6.48 mA by Google Inc.
Linear Acceleration Sensor: 6.48 mA by Google Inc.
Orientation Sensor: 6.48 mA by Google Inc.
Corrected Gyroscope Sensor: 6.48 mA by Google Inc.

เนื่องจากไม่แน่ใจว่าทำไม Android System Info ถึงเช็คเจอ 2 processor ก็เลยใช้ CPU-Z มาทดสอบดู ปรากฎว่าเจอ 4 Core จริง และได้ผลดังนี้

เมื่อใช้งานผ่านไป 9 ชั่วโมง

หลังจากชาร์จไฟเต็มที่เสร็จเมื่อบ่ายโมงนี้ เปิด WiFi  ไว้ตลอด ช่วง 3 ชั่วโมงแรกไม่ค่อยจะได้ใช้ทำอะไร เนื่องจากทำงานอื่นอยู่  แต่หลังจากนั้นก็ใช้งานมาตลอด ทั้งเข้าเฟส ฟังวิทยุ ก็อปไฟล์ ลงโปรแกรม ฯลฯ ดูได้จากแถบสีฟ้าเส้นล่างสุด เป็นเส้นแสดงว่าจอภาพเปิดใช้งานเกือบตลอด 9 ชั่วโมง พลังงานเหลือ 47% นี่ถ้าไม่ต้องนอน ผมก็อยากจะเล่นไปจนกว่าแบ็ตจะหมดไปเลย

ตอนนี้ ประมาณคร่าวๆว่า 9 ชั่วโมง แบ็ตหมดไปครึ่งหนึ่ง ดังนั้น ถ้าใช้งานตลอด  ทั้งหมดน่าจะอยู่ได้ประมาณ 17-18 ชั่วโมง

Standby 6 ชั่วโมง

หลังจากที่เปิดมือถือ และ WiFi ไว้ตลอด แล้วไปนอน ผ่านไปประมาณ 6 ชั่วโมง แบ็ตฯลดไปประมาณ 13% ถ้าเทียบง่ายๆ 100% ก็ 46 ชั่วโมง ประมาณสองวันถ้าอยู่ในโหมด standby (โดยเปิด WiFi)

ใช้งานจริง 12-20 ชั่วโมง

หลังจากเปิด WiFi ใช้งานไป 19 ชั่วโมง 35 นาที เหลือแบ็ตอยู่ 4% เครื่องก็เตือนให้ชาร์จแบ็ตฯใหม่ ซึ่งทั้งหมดนี้ทำให้ผมสรุปคร่าวๆว่า ถ้าใช้งานเปิด WiFi ตลอด แต่ใช้งานบ้างไม่ใช้บ้าง โดยเฉพาะจริงๆแล้วที่ใช้ไฟมากที่สุดน่าจะเป็นจอภาพ ผมเปิดไว้เป็น Auto ซึ่งสว่างพอสมควร น่าจะใช้งานได้ถึง 20 ชั่วโมง หรือถ้า Standby อย่างเดียวก็ได้ 46 ชั่วโมง ตามที่ได้วิเคราะห์ไว้ก่อนหน้านี้
แต่เพื่อให้เห็นชัดๆว่า ถ้าใช้งานตลอดเวลาจะได้กี่ชั่วโมง ผมก็เลยเอาภาพที่ได้ไปวิเคราะห์ โดยลากเส้นที่ 1 เทียบกับความเอียงตอนใช้งานทั่วไป จากนั้นก็ก็อปปี้เส้นที่ 1 มาเป็นเส้นที่ 2 แล้วเลื่อนเส้นที่ 2 มาให้จุดเริ่มต้นอยู่ที่ 100% จะไปตัดแกนเวลาที่ประมาณ 12.2 ชั่วโมงดังภาพ
สรุปว่า ถ้าเปิด WiFi ตลอด และใช้งานตลอดเวลา น่าจะใช้งานได้ประมาณ 12 ชั่วโมง แต่ถ้าใช้บ้างไม่ใช้บ้าง จะได้ถึง 20 ชั่วโมง ถ้าทิ้งไว้ไม่ใช้เลย ได้ถึง 46 ชั่วโมงครับ


Benchmark

ทดสอบด้วยโปรแกรม AnTuTu Benchmark ได้ผลเร็วกว่า Samsung Galaxy S2 มาก แต่ไกล้เคียงกับ HTC One X และต่ำกว่า Samsung Galaxy S3 เล็กน้อย ดังนี้