วันอังคารที่ 30 เมษายน พ.ศ. 2556

Ubuntu Operations

- at Folder view, Ctrl-h to toggle showing hidden files (files started with ".")
- at Folder view, Ctrl-l to show folder path (Esc to turn off)
- Ctrl+Alt+cursor keys to switch between desktops
- to view command history, e.g. last 50 commands, type
history 50
- to view command history under sudo, type
grep sudo /var/log/auth.log
- to check if currently use Unity2D or Unity3D, type
ps -A | grep metacity
if found, then Unity2D,

- to sync folder content
rsync -azriv --dry-run /src/folder/ /dest/folder/
   -a archive mode; equals -rlptgoD (no -H,-A,-X)
   -z compress file data during the transfer
   -r recurse into directories
   -i output a change-summary for all updates
   -v increase verbosity
   --delete delete extraneous files from destination dirs
   --dry-run perform a trial run with no changes made

วันอาทิตย์ที่ 28 เมษายน พ.ศ. 2556

Rework (ยกเครื่องความคิด) - ข้อคิดโดนๆ

หนังสือ "ยกเครื่องความคิด"
สำนักพิมพ์ WeLEARN

หนังสือเกี่ยวกับการเริ่มต้นธุรกิจใหม่ๆหรือโครงการใหม่ๆ
อะไรเป็นความคิดที่เชื่อกันต่อๆมา แต่จริงๆแล้วไม่สมเหตุสมผล

สรุปมาสั้นๆเฉพาะประเด็นที่โดนใจ
อยากรู้มากกว่านี้ ลองหาอ่านดูครับ

- อย่าสนใจโลกแห่งความจริง
  มันเป็นแค่ข้ออ้างที่จะได้ไม่ต้องลงมือพยายาม

- การเรียนรู้จากความผิดพลาดไม่ได้มีค่าอะไรขนาดนั้น
  ความสำเร็จเป็นประสบการณ์ที่มีคุณค่ามากกว่า

- การวางแผนคือการคาดเดา
  ดังนั้น อย่าเสียเวลากับมันมากเกินไป และอย่ายึดติดกับแผนมากเกินไป

- ทำไมต้องขยาย
  ไม่ผิดที่จะตั้งเป้าหมายให้ธุรกิจมีขนาดเล็ก

- บ้างาน
  จงใช้กำลังสมองมากกว่ากำลังกาย การทำงานมากเกินไปอาจทำให้การตัดสินใจผิดเพี้ยน

- คันเองก็เกาเอง
สร้างสิ่งที่ตัวคุณเองต้องการใช้ >> ประเมินคุณภาพของผลงานได้ด้วยตัวเอง & มีความสุขกับสิ่งที่ทำ

- เริ่มต้นลงมือทำอะไรซักอย่าง
อย่าคิดนาน อย่าคิดเยอะ ลงมือเลย

- ไม่มีเวลาไม่ใช่ข้ออ้าง
ถ้าต้องการทำอะไรอย่างแรงแล้ว เวลาหาได้เสมอ จังหวะที่เหมาะสมที่สุดไม่มีอยู่จริง

- ขีดเส้นบนผืนทราย
มีจุดยืนของตัวเองที่ชัดเจน คนบางกลุ่มอาจจะไม่พอใจ อย่าได้แคร์

- ถ้าทำไม่ได้จริงก็อย่าพูด
คำประกาศพันธกิจที่ทำไม่ได้จริงมันไร้ประโยชน์

- จำเป็นจริงๆหรือ
ไม่จำเป็นต้องมีอะไรต่อมิอะไรมากเท่าที่คิด
เริ่มต้นจากจุดเล็กๆ ประหยัดค่าใช้จ่ายที่ไม่จำเป็น แล้วค่อยขยับขยายก็ยังทัน

- สำเร็จครึ่งหนึ่งแต่เจ๋ง ดีกว่าเสร็จทั้งหมดแต่เจ๊ง
ตัดไอเดียที่แค่"ดี"ทิ้งไป เหลือแต่ไอเดีย"สุดเจ๋ง"ก็พอ

- เริ่มต้นที่จุดศูนย์กลาง
อะไรคือสิ่งที่สำคัญที่สุด อะไรคือหัวใจของธุรกิจ เริ่มต้นตรงนั้น

- อย่าสนใจรายละเอียดในช่วงเริ่มต้น
มองภาพใหญ่ก่อน จัดการเรื่องพื้นฐานให้เรียบร้อย

- การฟันธงคือการเดินไปข้างหน้า
ตัดสินใจซะตอนนี้แล้วเดินหน้าต่อไป พรุ่งนี้ไม่ได้ดีกว่าวันนี้ ตัดสินใจแล้วก็สามารถเปลี่ยนทีหลังได้

- ดูจากของจริง
อย่าคุยกันบนเอกสาร/คำบรรยาย ดูจากของจริง สร้างสิ่งที่จับต้องได้ขึ้นมาให้เร็วที่สุด

- หยุดเพื่อตั้งคำถาม
ทำไมถึงทำสิ่งนี้
มันแก้ปัญหาอะไร
มันมีประโยชน์จริงหรือ
มีวิธีง่ายกว่านี้ไหม
ถ้าไม่ทำเรื่องนี้แล้วจะทำอะไรได้อีกบ้าง
คุ้มค่าจริงหรือเปล่า

- การประชุมคือยาพิษ
มันเป็นนามธรรม ประโยชน์น้อย หลงประเด็นง่าย สิ้นเปลืองเวลามาก แตกตัวเป็นประชุมลูกโซ่ต่อเนื่อง
คน 10 คนประชุม 1 ชั่วโมง = เสียเวลา 10 ชั่วโมง

- แค่ใช้ได้ก็พอแล้ว
วิธีง่ายๆธรรมดาๆ ไม่ได้เพอเฟ็คต์แต่แก้ปัญหาได้ ลงมือทำแล้วเดินหน้าต่อไป

- ชนะในพริบตา
ชัยชนะย่อยๆแต่บ่อยๆสร้างแรงจูงใจกว่าชัยชนะใหญ่ๆที่ต้องใช้เวลานาน

- ไปนอนเสียเถอะ
การอดหลับอดนอนไม่ใช่เรื่องดี

- การประเมินเวลาช่างห่วยแตก
อย่าประเมินล่วงหน้านานๆ แบ่งโครงการออกเป็นส่วนๆแล้วประเมินเวลาไปทีละส่วน

- รายการยาวเหยียดไม่มีทางทำเสร็จ
แบ่งรายการเป็นชิ้นย่อยๆเพิ่มแรงจูงใจกว่า
อย่าจัดลำดับความสำคัญเป็นเลเวล(น้อย/ปานกลาง/มาก) ให้เรียงลำดับงานที่ต้องทำตามความสำคัญดีกว่า

- คู่แข่ง
อย่าสนใจว่าคนอื่นจะทำอะไร อย่าเลียนแบบ สนใจตัวเองดีกว่า
กล้าที่จะทำให้น้อยกว่าคู่แข่ง(แต่เจ๋งกว่า)

- ปฏิเสธไว้ก่อน
ปฏิเสธลูกค้าก็ได้ (ถ้ามีจุดยืนที่ชัดเจน)

- ยอมปล่อยลูกค้าไปบ้าง
อย่าปรับเปลี่ยนสินค้าตามคำเรียกร้องของลูกค้ารายใหญ่เพียงรายเดียว
ถ้าวันหนึ่งลูกค้ารายนั้นจากไปจริงๆ สินค้านั้นอาจจะไม่เหมาะกับลูกค้ารายอื่นๆอีกเลย

- ความกระตือรือร้น .vs. ลำดับความสำคัญ
ไอเดียใหม่ๆอาจจะไม่ได้ยอดเยี่ยมอย่างที่คิดเสมอไป
บันทึกไอเดียใหม่ๆไว้ ทิ้งช่วงให้ใจเย็นลงแล้วค่อยกลับมาพิจารณาอีกที

- อย่าจด
ข้อเรียกร้องที่สำคัญจริงๆจะมาซ้ำแล้วซ้ำอีกจนจำได้เอง
ข้อเรียกร้องที่ถูกลืมบ่อยๆ แสดงว่ามันไม่ค่อยสำคัญเท่าไหร่

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

- แข่งด้วยการสอน
ให้ความรู้กับลูกค้า จะได้ความรู้สึกผูกพันของลูกค้า
การแบ่งปันข้อมูลความรู้ไม่ทำให้คนอื่นเอาชนะได้ง่ายๆหรอก

- ไม่มีใครชอบดอกไม้พลาสติก
อย่ากลัวที่จะเปิดเผยข้อบกพร่อง
ความไม่สมบูรณ์แบบคือความงามรูปแบบหนึ่ง
(แนวคิดเรื่อง wabi sabi ของญี่ปุ่น)

- เอาอย่างนักค้ายา
สร้างสินค้าที่ดีเยี่ยม แจกตัวอย่างให้ทดลองใช้
ถ้าสินค้าดีจริง ลูกค้าจะกลับมาอีก

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

- ลองทำด้วยตัวเองก่อน
อย่าจ้างใครมาทำหน้าที่ใดๆโดยที่ไม่ได้ลองทำเองก่อน
ถ้าไม่ลองทำเอง จะรู้ได้ยังไงว่าควรจะจ้างคนแบบไหน ควรจะวิจารณ์หรือแนะนำยังไง

- ว่าจ้างเมื่อเริ่มเจ็บ
เมื่อเริ่มทำเองไม่ไหว เมื่อคุณภาพงานเริ่มถดถอย เมื่อเริ่มทำงานไม่ทันกำหนด

- ปล่อยคนเก่งให้ผ่านไป
อย่าจ้างคนเก่งๆมานั่งเฉยๆโดยไม่มีงานสำคัญให้ทำ
คนเก่งมีอีกมากมาย อย่าเสียดายที่ต้องปล่อยให้ผ่านไป
(เติมเอง : คนเก่งไม่ใช่ของสะสม)

- จำนวนปีไม่ใช่เรื่องใหญ่
ทำงานมานานแค่ไหน ไม่สำคัญเท่ากับทำงานได้ดีแค่ไหน

- จ้างนักเขียนชั้นเยี่ยม
การเขียนที่ดี = ระบบความคิดที่ดี ความสามารถในการสื่อสาร
ปัจจุบันเราสื่อสารกันด้วยการเขียนมากกว่าการคุย

- ทดลองพนักงาน
สร้างโครงการเล็กๆให้พนักงานทำจริงๆ จะได้เห็นตัวตนของพนักงานมากกว่าแค่สัมภาษณ์

- จัดการกับข่าวร้ายด้วยตัวเอง
อย่าปิดบังความจริง เผยแพร่ข่าวร้ายออกไปในวงกว้างที่สุด
ขอโทษอย่างจริงใจ แก้ปัญหาอย่างจริงใจ จริงจังและรวดเร็ว

- หายใจลึกๆ
หลังการเปลี่ยนแปลงอะไร อย่าตื่นตกใจกับปฏิกิริยาแง่ลบของลูกค้า
คนเรามักไม่ชอบการเปลี่ยนแปลงอยู่แล้ว

- การตัดสินใจเป็นแค่เรื่องชั่วคราว
ตัดสินใจสิ่งที่เหมาะสมในตอนนี้
อย่าเพิ่งกังวลกับปัญหาที่มันยังไม่เกิดขึ้นจริง
ถ้าสถานการณ์เปลี่ยนก็ยังเปลี่ยนการตัดสินใจได้

- สร้างสภาพแวดล้อมการทำงานที่ดี
ความไว้วางใจ อิสระในการทำงาน ความรับผิดชอบ ความเป็นส่วนตัว เครื่องไม้เครื่องมือพร้อม

- พนักงานไม่ใช่เด็ก
จะตั้งข้อห้ามอะไรมากมาย เอาเวลาไปสร้างงานที่มีประโยชน์ดีกว่า

- ปล่อยพนักงานกลับบ้านตอนห้าโมง
งานจะมีประสิทธิภาพมากขึ้นถ้ามีเวลาน้อยลง

- นโยบายคือรอยแผลเป็น
อย่าแตกตื่นสร้างนโยบายเพราะความเจ็บปวดครั้งแรก
นโยบาย = การจับเอาความตื่นตูมมาสร้างเป็นกฏระเบียบ

- คำอันตราย
จำเป็น ต้อง ไม่ได้ ง่าย แค่ เพียง เร็ว ทุกคน ไม่มีใครเลย เสมอ ไม่เคย
ตัวอย่างจากหนังสือ
"เราจำเป็นต้องเพิ่มคุณสมบัตินี้เข้าไปในสินค้าทันที เราเปิดตัวโดยไม่มีคุณสมบัตินี้ไม่ได้
เพราะมันเป็นสิ่งที่ลูกค้าทุกคนต้องการ มันเป็นแค่เรื่องเล็กๆน้อยๆ เพราะฉะนั้น มันก็น่า
จะง่ายมากๆ คุณควรจะรีบทำเสียให้เสร็จเร็วๆนะ!"

- ไอเดียไม่มีวันตาย แต่แรงบันดาลใจมีอายุ
เมื่อเกิดแรงบันดาลใจแล้ว ให้ลงมือทันที

วันเสาร์ที่ 27 เมษายน พ.ศ. 2556

เว็บข้อมูลอื่นๆที่เกี่ยวกับหุ้น

เว็บดูราคา commodities ต่างๆ ดูย้อนหลังได้ถึง 30 ปี
http://www.indexmundi.com/commodities/?commodity=coal-australian&months=180

สำหรับ BANPU
http://www.indexmundi.com/commodities/?commodity=coal-australian&months=180

สำหรับทอง
http://www.indexmundi.com/commodities/?commodity=gold&months=180

ราคาน้ำมัน
http://www.indexmundi.com/commodities/?commodity=crude-oil&months=180

อัตราผลตอบแทนของพันธบัตรรัฐบาล (ไว้ใช้คำนวณ DCF)
http://www.thaibma.or.th/yieldcurve/YieldTTM.aspx

TRIS Rating (ไว้ดูความเสี่ยงของบริษัท)
http://www.trisrating.com/en/rating-information/ratinglist/current/rating-list-present.html

ราคาสินค้าโภคภัณฑ์ พร้อมกับรายชื่อหุ้นที่เกี่ยวข้อง
http://panwasit-stock.blogspot.com/p/gp_28.html
http://www.kid-vi.com/index.php?lay=show&ac=article&Id=539389290

วันเสาร์ที่ 20 เมษายน พ.ศ. 2556

VI กับ 20 คำถาม

ก้อปปี้มาจากเว็บนี้ครับ >> http://clubvi.com/2013/04/20/20-questiongame/

เผื่อว่าถ้าจะทำสรุปข้อมูลเกี่ยวกับหุ้นซักตัว
เหล่านี้คือข้อมูลที่ต้องหา


  1. บริษัทมีรายได้ทั้งปีเท่าไร? (ถ้าบอกได้ถึงไตรมาสล่าสุดเลยยิ่งดี)
  2. บริษัทมีกำไรทั้งปีเท่าไร? (เช่นเดียวกันครับ ถ้าบอกได้ถึงไตรมาสล่าสุดเลยจะดีมาก)
  3. ROE ปัจจุบันประมาณกี่เปอร์เซ็นต์?
  4. กระแสเงินสดเป็นอย่างไร? (อธิบายโดยภาพรวมให้พอเข้าใจ เช่น บริษัทนี้เงินสดเหลือเฟือ เพราะเป็นบริษัทค้าปลีก ขายสินค้าเป็นเงินสด แต่ซื้อของเป็นเงินเชื่อ หรือบริษัทนี้เป็นบริษัทลีสซิ่ง เงินสดไม่มาก ลูกหนี้เยอะ เป็นต้น)
  5. Gross Margin, Net Margin ปัจจุบันประมาณกี่เปอร์เซ็นต์? มีแนวโน้มเพิ่มขึ้นหรือลดลงหรือไม่?
  6. D/E (อัตราส่วนหนี้สินต่อส่วนของผู้ถือหุ้น) อยู่ที่เท่าไร? มีแนวโน้มเพิ่มขึ้นหรือลดลง?
  7. Market Cap. ประมาณเท่าไร? (ตัวเลขนี้ดูใน Settrade.com ก็รู้แล้ว)
  8. กำไรของบริษัทย้อนหลัง 5 ปี โตปีละกี่เปอร์เซ็นต์? มีความสม่ำเสมอหรือไม่อย่างไร? (อันนี้สำคัญมากครับ อดีตบอกอนาคต ถ้าโตมาตลอด แปลว่ามีโอกาสจะโตต่อไปเรื่อยๆ)
  9. รายได้ของบริษัทย้อนหลัง 5 ปี โตปีละกี่เปอร์เซ็นต์? มีความสม่ำเสมอหรือไม่อย่างไร? (เช่นเดียวกับคำถามก่อนหน้า .. อดีตบอกอนาคต)
  10. บริษัทมีความจำเป็นต้องใช้เงินลงทุนก้อนใหญ่อยู่เสมอหรือไม่? ถ้าใช่ จะหาแหล่งเงินทุนอย่างไร? (ถ้ากู้มาก็ต้องใช้หนี้กันเหนื่อย ถ้าเพิ่มทุน EPS ก็จะลด มูลค่าหุ้นถูก Dilute เดือดร้อนเราต้องไปหาเงินมาเติมอีก)
  11. ปัจจุบันมี Market Share กี่เปอร์เซ็นต์? เป็นอันดับที่เท่าไรของตลาด?
  12. ใครเป็นคู่แข่งสำคัญของบริษัท? เปรียบเทียบส่วนแบ่งตลาดของบริษัทกับบริษัทคู่แข่ง มากน้อยต่างกันอย่างไร ?
  13. ศักยภาพในการแข่งขันของบริษัทเป็นอย่างไร? มี Competitive Advantage เหนือบริษัทอื่นหรือไม่? (อันนี้เป็นเรื่องเชิงคุณภาพครับ ต้องวิเคราะห์ธุรกิจเป็นด้วย)
  14. มีการซื้อหุ้นคืน เพิ่มทุน หรือออกวอร์แรนต์มั้ย?
  15. ผู้บริหารคือใคร เคยมีประวัติปั่นหุ้น หรือทุจริตอะไรมั้ย?
  16. ผู้บริหารเก่งจริงมั้ย? ทำอะไรมาก่อน? ธุรกิจที่เคยบริหารสอดคล้องกับธุรกิจที่บริหารอยู่ในปัจจุบันหรือไม่? เคยประสบความสำเร็จอะไรมาบ้าง? เคยทำบริษัทเจ๊งมาหรือเปล่า?
  17. แผนการเติบโตของบริษัทในอนาคตเป็นอย่างไร? (หาฟังได้จาก Opp Day หรือถามจากผู้บริหารเวลาเข้าประชุมผู้ถือหุ้น หรือคอยตามข่าวในสื่อต่างๆ)
  18. P/E ปัจจุบันเท่ากับเท่าไร? และค่า P/E เฉลี่ยในอดีต 10 ปี ที่ผ่านมาอยู่ที่เท่าไร?
  19. P/BV ปัจจุบันเท่ากับเท่าไร?
  20. นโยบายการจ่ายปันผลเป็นอย่างไร จ่ายกี่เปอร์เซ็นต์ของกำไร? จ่ายสม่ำเสมอหรือไม่?
เพิ่มเองอีก 1 ข้อ

- มีปัจจัยอะไรที่ส่งผลกับผลประกอบการของบริษัทบ้าง เช่น ค่าเงินบาท ราคาน้ำมัน เศรษฐกิจในประเทศ/ต่างประเทศ 

วันพฤหัสบดีที่ 18 เมษายน พ.ศ. 2556

Scrum Development Process

Scrum Process Overview


Product Backlog
- Product Owner เป็นคนสร้างขึ้น ประมาณว่าเป็นรายการของ business requirement ที่มีการจัดเรียงลำดับตามความสำคัญ/ความเร่งด่วนแล้ว
Sprint Planning Meeting
- เป็น meeting ใช้เวลาไม่เกิน 8 ชั่วโมง
- 4 ชั่วโมงแรก Product Owner อธิบายรายการใน Product Backlog ให้ทีมฟัง
- 4 ชั่วโมงต่อมา ทีมทำการเลือกรายการใน Product Backlog ที่คิดว่าสามารถทำได้เสร็จใน Sprint นั้นๆ (ไม่เกิน 30 วัน)
Sprint Backlog
- ทีมแตกรายการใน Product Backlog ที่เลือกไว้ออกเป็น Task ย่อยๆ(เรียกว่า Sprint Backlog)
- แต่ละ task ใช้เวลาประมาณ 4-16 ชั่วโมงในการ develop
Sprint Daily Meeting
- ในแต่ละวัน ใช้เวลาประชุมประมาณ 15 นาทีเพื่อสรุป
  a) progress จากการประชุมครั้งที่แล้ว
  b) ปัญหาที่เกิด
  c) แผนงานวันนี้
เมื่อสิ้นสุด Sprint เราจะได้ระบบที่มี function ที่ตอบโจทย์ Product Backlog ส่วนที่เลือกไว้ตอนแรก
Sprint Review Meeting
ประชุม(ไม่เกิน 4 ชั่วโมง) เพื่อสรุปงานใน Sprint ที่จบลงไป
Sprint Retrospective Meeting
ประชุม(ไม่เกิน 4 ชั่วโมง) เพื่อสรุปปัญหาใน Scrum Process และวิธีแก้ปัญหา (กึ่งๆเป็นการทำ Process Improvement)

ตัวอย่าง Product Backlog

- backlog item จัดกลุ่มตาม Sprint
- Adjusted Estimation = Initial Estimation * (1 + Complexity Factor) (หน่วยเป็นชั่วโมง?)
- รายการที่ทำไม่เสร็จใน Sprint ก่อนหน้า ยกมาไว้ใน Sprint ถัดๆไปได้ (เช่น Backlog 3 ในรูป)
- รายการที่เพิ่งเกิดจะไม่มี estimation ใน Sprint ก่อนหน้า (่เช่น Backlog 11 ในรูป)
- Burndown Chart จะเป็นตัวสรุปว่าเหลืองานอีกเท่าไหร่
  ตัวอย่างในรูป ณ วันที่เริ่ม Sprint 1 เหลืองานอีก 43.3 ชั่วโมง ณ วันที่เริ่ม Sprint 2 เหลือ 30 ชั่วโมง ...


ตัวอย่าง Sprint Backlog 

ไม่ต้องอธิบายเพิ่มแล้วมั้ง ไม่น่ายาก...

วันอาทิตย์ที่ 14 เมษายน พ.ศ. 2556

หุ้นกับ 7 mega trends

Mega Trend 1 : 3G

- เครือข่ายโทรศัพท์มือถือ 3G
- ขายสมาร์ตโฟนและแท็บเล็ต
- mobile banking
- ค้าปลีก e-Commerce
- เว็บธุรกรรมออนไลน์
- โซเชียลมีเดีย & เกมออนไลน์
ADVANC, DTAC, TRUE, JMART

Mega Trend 2 : TV Digital

- เจ้าของสถานีโทรทัศน์
- ผลิตรายการ
- โฆษณาทางทีวี
- ติดตั้งอุปกรณ์การออกอากาศ/รับสัญญาณทีวีดิจิตอล
GRAMMY, RS, WORK
INTUCH, SAMART
- ทีวีดิจิตอลต้นทุนสูงกว่าทีวีดาวเทียม (หลักพันล้าน .vs. หลักร้อยล้าน)
- ค่าโฆษณาทีวีดาวเทียมต่ำกว่าฟรีทีวี แต่ต้นทุนการผลิตรายการเท่ากัน
- จำนวนช่องมาก >> เม็ดเงินโฆษณากระจายตัวไปตามแต่ละช่อง
- จำนวนช่องมาก >> content สำคัญ
- วัดเรตติ้งได้แม่นยำขึ้น

Mega Trend 3 : AEC

- ท่องเที่ยว
- ก่อสร้าง
- บริการขนส่งสินค้า & คน
- การบิน
- อสังหา
SCC, SCCC
ERW, CENTEL, MINT
- การก่อสร้างระบบขนส่ง&เส้นทางคมนาคม
- แรงงานราคาถูกจากประเทศเพื่อนบ้าน >> hit labor intensive industries
- ย้ายฐานการผลิตไปประเทศเพื่อนบ้านที่มีค่าแรงถูก
- การท่องเที่ยวบูม (หนึ่งวีซ่าสิบประเทศ)

Mega Trend 4 : สังคมผู้สูงอายุ

- โรงพยาบาลรายใหญ่
- ประกันสุขภาพ ประกันชีวิต
- ผลิตภัณฑ์ดูแลสุขภาพ-อาหารเสริม
- ก่อสร้างบ้านสำหรับผู้สูงอายุ
- สถานพยาบาล&บ้านพักคนชรา
BGH, BH, BCH
- ความต้องการสถานพยาบาล&บุคลากรจะเพิ่มขึ้นมากจนขาดแคลนได้

Mega Trend 5 : สังคมเมือง

- ค้าปลีก
- ก่อสร้าง
- ขนส่ง
- อสังหา
ROBINS, CPN, BIGC, CPALL, MAKRO, HMPRO
ITD, CK, STECON
PS, LH, SPALI, LPN
SCC, SCCC
- ค้าปลีกขยายไปตามหัวเมืองชั้นหนึ่ง/ชั้นสอง
- การก่อสร้างโครงสร้างพื้นฐานเพื่อเชื่อมหัวเมืองต่างๆ

Mega Trend 6 : Gen Y

- สินค้า/บริการที่อำนวยความสะดวกในชีวิตประจำวัน
- ขายสมาร์ตโฟนและแท็บเล็ต
- เครือข่ายโทรศัพท์มือถือ 3G
- เครื่องสำอาง/เสริมความงาม
- สุขภาพ เช่น ลดความอ้วน อาหารเสริม
ADVANC, DTAC, TRUE, JMART
KAMART, BEAUTY
CPF
BIGC, CPALL, MAKRO
HMPRO, GLOBAL

คาแรกเตอร์ Gen Y

1. อยากรวยเร็ว
2.ความอดทนต่ำ
3. โซเชียลเน็ตเวิร์ค
4. multi-tasking
5. เน้นปฏิบัติ ไม่ชอบฟัง
6. ความคิดสร้างสรรค์

ไลฟ์สไตล์ Gen Y

1. mobile life เคลื่อนที่ไปด้วยทำไปด้วย
2. screen culture & cloud ใช้ชีวิตบนหลายๆอุปกรณ์ที่มีจอภาพ
3. DIY
4. ร้านค้าปลีกแบบมีแบบแผน (e.g. 7-11)
5. max value คุ้มค่าคุ้มราคา
6. สินค้า how-to รวย
7. สินค้า fast track (e.g. ฟาสต์ฟู้ด)
8. good looking ต้องดูดี
9. DIH Do-It-your-Health รักสุขภาพ
10. หาข้อมูลจาก internet / social media

Mega Trend 7 : ภาวะโลกร้อน

- ประกันภัย ประกันชีวิต
- พลังงานที่เป็นมิตรกับสิ่งแวดล้อม
- อสังหาบนพื้นที่ที่อยู่พ้นน้ำ
- ก่อสร้าง
- น้ำสะอาด
- อาหาร

วันศุกร์ที่ 12 เมษายน พ.ศ. 2556

เว็บดูข้อมูลหุ้น

Shares - Asia - Thailand
http://www.4-traders.com/stock-exchange/shares/Asia-6/Thailand-144/
มี ranking ของหุ้นให้ดูด้วย
คลิกที่ชื่อหุ้นจะมีข้อมูล financial ให้ดู
มีงบการเงินย้อนหลัง 3 ปี + estimate 3 ปี

Shares - Asia - Singapore
http://www.4-traders.com/stock-exchange/shares/Asia-6/Singapore-141/
เหมือนข้างบน ไว้เวลาเลือกหุ้นสิงคโปร์

http://performance.morningstar.com/stock/performance-return.action?p=price_history_page&t=KYE&region=THA&culture=en-us
กดปุ่ม Max + Daily แล้วกดปุ่ม Export ตรงมุมขวาบน
สามารถโหลดข้อมูลสำหรับกราฟแท่งเทียนได้เยอะมากๆ


http://markets.ft.com/research/Markets/Tearsheets/Forecasts?s=ADVANC:SET
ข้อมูลจาก Financial Times

ดูกราฟย้อนหลัง 10+ ปี (คลิกที่ Interactive Chart) 
ดูงบย้อนหลัง 3 ปี / 3Q  (คลิกที่ Financial)
มี consensus ย้อนหลัง 1 ปี กับ forecast 2 ปี (คลิกที่ Forecast)


ข้อมูลจาก Morning Star
มี PE, PB ratio ย้อนหลัง 10 ปี (คลิกที่ Valuation)
มี ratio ต่างๆ ย้อนหลัง 10 ปี (คลิกที่ Key Ratios)
ดูงบย้อนหลัง 5 ปี / 5Q  (คลิกที่ Financials)


http://investing.businessweek.com/research/stocks/charts/charts.asp?ticker=JMART:TB
ข้อมูลจาก Business Week
ดูกราฟย้อนหลัง 5 ปี
ดูงบย้อนหลัง 4 ปี / 4Q ของปีก่อนหน้า
เว็บช้านิดนึง

http://data.cnbc.com/quotes/MAKR.BK/tab/7
ดูกราฟย้อนหลัง 10 ปี
ดูงบย้อนหลัง 4 ปี / 5Q

http://siamchart.com/stock-chart/BANPU/
ดูกราฟย้อนหลัง 3 ปี
config กราฟได้

http://www.bloomberg.com/quote/ADVANC:TB/chart
ดูกราฟย้อนหลัง 5 ปี

jQuery Widget


Header

header for no widget

  <script type="text/javascript"  src="http://code.jquery.com/jquery-latest.js"></script>

header for widgets (from jQuery)

  <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.2/themes/smoothness/jquery-ui.css" />
  <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
  <script src="http://code.jquery.com/ui/1.10.2/jquery-ui.js"></script>

header for widgets (from Google)

  <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
  <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>

Accordian

use accordian

sample here >> http://jqueryui.com/accordion/
detail here >> http://api.jqueryui.com/accordion/
  $("#accordion").accordion(); << various options available

NOTE:
default accordian open ONLY ONE section at a time
sample of accordian open multiple sections here
>> http://stackoverflow.com/questions/12190592/jquery-accordion-multiple-sections-open-at-once
>> http://jsfiddle.net/akhurshid/WDzh9/

Datepicker

use datepicker

sample here >> http://jqueryui.com/datepicker/ (demo of various options here)
detail here >> http://api.jqueryui.com/datepicker/
  $("#datepicker").datepicker(); << various option available

Dialog

use dialog

sample here >> http://jqueryui.com/dialog/
detail here >> http://api.jqueryui.com/dialog/
  $("#dialog").dialog(); << various options available

dialog with OK button

  $("#dialog").dialog({;
    buttons: {"OK" : function() {
      $(this).dialog("close"); } }
    });
  });
  ...
  <div id="dialog" title="Dialog Title"> ...dialog content... </div>

dialog with input form

  $("#dialog").dialog({
    buttons: {"Ok": function() { $(this).dialog("close"); } },
    beforeclose: function(event, ui) {      << beforeClose event
       $("#results").text("You entered " +
       $("#text").val())                    << get value from <input> element
    }
  });
  ...
  <div id="dialog" title="Dialog Title">
    <input type="text" id="text"></input>
  </div>

Progresbar

use progressbar

sample here >> http://jqueryui.com/progressbar/
detail here >> http://api.jqueryui.com/progressbar/
  $("#progressbar").progressbar({'value', 80}); << set initial value

Slider

use slider

sample here >> http://jqueryui.com/slider/
detail here >> http://api.jqueryui.com/slider/
  $("#slider").slider({
    range:"max",
    min: 1,
    max: 100,
    value:2,
    slide: function(event, ui) {
      $("#results").val(ui.value) << ui.value = slider value AFTER moved (i.e. after this event)
    }
  });
  ...
  <div id="slider"></div>
  <input type="text" id="results" />

Tab

use tab

sample here >> http://jqueryui.com/tab/
detail here >> http://api.jqueryui.com/tab/
  $("tabs").tabs()
  ...
  <div id="tabs">
  <ul>
    <li><a href="#tabs-1">...label for tab 1 (content local)...</a></li>
    <li><a href="#tabs-2">...label for tab 2 (content local)...</a></li>
    <li><a href="http://...">...label for tab 3 (content outside)...</a></li>
  </ul>
  <div id="tabs-1">
    content for tab 1
  </div>
  <div id="tabs-2">
    content for tab 2
  </div>
</div>

Ajax in jQuery


General Flow

1. create XMLHttpRequest object
2. configure XMLHttpRequest object with data to send to server
3. attach callback function to read server response
4. connect to server with send() function
5. interpret response from server
6. extract data from XMLHttpRequest object

load(url, parameters, callback) function

  $("div").load("http://127.0.0.1/message.txt"); << load data from message.txt to <div> element
NOTE:
- use GET method by default
- use POST if pass parameter to server
- load data to element

load() function with callback (executed after data loaded)

  $("div").load("http://127.0.0.1/message.txt", callback); << load data from message.txt to <div> element
  ...
  function callback() {
    $("#targetDiv").text("Got the data.");
  }

load() function with parameter

  $("div").load("poster.php", {data: 1}); << parameter name = data, value = 1

pass form data to server (use serializeArray() function)

  <form id="targetForm">
    ...
  </form>
  ...
  $("div").load("poster.php", $("#targetForm").serializeArray());

$.get(), $.post() << explicitly use GET/POST method
  $.post("poster.php", {data: 1}, function(data){ << parameter data = data from server
    $("div").text(data);
  });
NOTE:
- explicitly use GET/POST method
- get downloaded data directly (without loading to element)
- when pass parameters, GET append param value to URL, POST pass param values in HTTP header

$.ajax() function

  $.ajax({
    type: "GET",          << GET/POST method
    url: "getter.php",    << URL to retrieve content
    data: {data: 1},      << data passed to server
    success: callback,    << callback function if success
    timeout: 10,          << timeout in msec
    error: error          << callback function if error
  });

  function callback(data, status) { << data = data returned from server
      $("div").text(data);
  }

  function err(xhr, reason, ex) {   << xhr = XMLHttpRequest object; reason = reason text; ex = Exception object
      $("div").text(reason);
  }

use Ajax to handle XML

  $.ajax({
    type: "GET",
    url: "sandwiches.xml",  << source data
    dataType: "xml",        << data type = xml
    success: callback
  });
  ...
  function callback(data, status) {
    var sandwiches = data.getElementsByTagName("sandwich"); << get data from XML
    listSandwiches(sandwiches);
  }

  function listSandwiches (sandwiches) {
    var loopIndex;
    var selectControl = document.getElementById('sandwichList');

    for (loopIndex = 0; loopIndex < sandwiches.length; loopIndex++) {
        selectControl.options[loopIndex] = new Option(sandwiches[loopIndex].firstChild.data);
    }
  }

Ajax global events

  $("#starting").bind("ajaxStart", function(){ << global event AjaxStart
   $(this).show();
  });
  ...
  <div id="starting">Starting...</div>
NOTE: there are AjaxStart, AjaxSend, AjaxSuccess, AjaxError, AjaxComplete, AjaxStop

How to Hide Devices in Ubuntu


detail here >> http://www.worldofnubcraft.com/969/hide-your-disks-or-partitions-from-nautilus/

Currenty when open Home Folder, in device list it shows "System Reserved" (for dual boot?) and "210 GB Filesystem" (for Windows)

To hide these two devices,
  1. mount both
  2. at command line, type mount
  3. from output get device name, e.g.
      /dev/sda1 on /media/System Reserved type fuseblk (rw,nosuid,nodev,allow_other,default_permissions,blksize=4096)
      /dev/sda2 on /media/70A8BF9FA8BF6270 type fuseblk (rw,nosuid,nodev,allow_other,default_permissions,blksize=4096)
     sda1 = "System Reserved"; sda2 = "210 GB ..." (there is no name, so it displays uuid 70A8B...)
  4. create new file named 99-hide-disks.rules with content below
      KERNEL=="sda1", ENV{UDISKS_PRESENTATION_HIDE}="1"
      KERNEL=="sda2", ENV{UDISKS_PRESENTATION_HIDE}="1"
  5. copy to /etc/udev/rules.d/
      sudo cp ./99-hide-disks.rules /etc/udev/rules.d/
  6. reboot or run following command

      sudo udevadm trigger

วันพุธที่ 10 เมษายน พ.ศ. 2556

Add Image to Ubuntu Wallpaper List

  1. add image file to directory /usr/share/backgrounds
  2. add entry to file  /usr/share/gnome-background-properties/precise-wallpapers.xml
  3. make sure to remove backup file for precise-wallpapers.xml. If not, each background image will be shown twice in the list

ตะแกรงร่อนหุ้น

จดโน้ตไว้ก่อนตอนอ่านเจออะไรดีๆจากหนังสือ

จากหนังสือ"ตะแกรงร่อนหุ้น"

วิธีหา Earning Power Value

สมมุติกำไรวันละ 500 บาท >> ปีละ 500 x 365 = 182,500 บาท
ถ้าจะฝากแบงค์ ดอกเบี้ย 2% เพื่อให้ได้ 182,500 บาท
จะต้องฝากแบงค์ 182,500/0.02 = 9,125,000 บาท = Earning Power Value

ข้อเสียของ Earning Power Value คือ
  1. ไม่ได้คิดการเติบโตของบริษัท
  2. ใช้กำไรปีเดียวมาคำนวณ กำไรแต่ละปีอาจขึ้นๆลงๆ

Total Debt กับ Total Liabilities

Total Debt = Long-term Liabilities
Total Liabilities = Short-term + Long-term Liabilities

เวลาหา D/E Ratio ให้ใช้ Total Debt ไม่ใช่ Total Liabilities 
(ไม่ต้องรวมหนี้สินหมุนเวียน เพราะถือเป็น working capital)

ROTC (Return on Total Capital)

ROTC = Net Profit / (Equity + Long-term Liabilities)
บริษัทปกติควรจะ > 15%
สถาบันการเงินควรจะ > 3%

Priority

Stock Selection > Port Management > Timing & Psychology

วิธีหา margin ของหุ้น


  1. เข้าไปที่ http://www.set.or.th/th/market/market_statistics.html แล้วเลื่อนลงมาที่ สรุปรายงานหลักทรัพย์ที่วางเป็นประกันการชำระหนี้ในบัญชีมาร์จิ้นสูงสุด 50 อันดับแรก (จะมีไอคอนExcelเรียงกันเยอะๆ)
  2. คลิกที่ไอคอนรูปสเปรดชีตของเดือนล่าสุดที่มีเพื่อดาวน์โหลดสเปรดชีต
  3. เอาคอลัมน์ที่ 5 หารด้วยคอลัมน์ที่ 4 เพื่อหา %การใช้ margin ของผู้ถือหุ้นรายย่อย เช่น BLAND มี%การใช้มาร์จิ้นเป็น 19.66% (= 10.95/55.7*100)ของหุ้นในมือรายย่อย
ถ้า%การใช้มาร์จิ้นสูง เวลาตลาดหุ้นตก โอกาสที่หุ้นจะตกลงแรงจะมีมากกว่า

วันอังคารที่ 9 เมษายน พ.ศ. 2556

jQuery Notes




select element

select by id
  $('#third')
  ...
  <p id="third"> ... </p>

select set of elements
  $("p") << select all <p> element
  $("p").size() << number of <p> elements
  $("p").length << number of <p> elements

select by index from set of elements
  $("img")[0] << select first <p> element
  NOTE: this will return browser element, not jQuery-wrapped element, so cannot use further jQuery function.
  $("img").slice(0, 1) return jQuery-wrapped element, so can use further jQuery function.
  e.g. $("img").slice(0, 1).attr("alt") << OK
  $("img")[0].attr("alt") << NG

select by style
  $('p.second')
  ...
  <p class="second"> ... </p>

select by index
  $('p:first') << first <p> element
  $('p:last') << last <p> element
  $('p:nth-child(3)') << 3rd <p> element (nothing happened if invalid index is given)
  $('p:nth-child(even)'), $('p:nth-child(odd)') << even/odd <p> elements
  $('p.second:first') << combine style & first/last
  :even << even elements
  :odd << odd elements
  :eq(9) << element indexed 9 (index start from 0 --> select 10th element)
  :gt(9) << element indexed 10 and after
  :lt(9) << element indexed 0..8

select by text content
  $('p:contains("3")') << all <p> elements with text contains "3"

select by attribute
  $('p[Language]') << all <p> elements with have attribute "Language"
  $('p[Language='German']') << all <p> elements with have attribute "Language" = "German"

select by hierarchy
  $('body div p') << select all <p> elements inside <div> inside <body>

select by direct hierarchy
  $('div > p') << select all <p> elements DIRECTLY inside <div>

user input

checkbox selected
  $('input:checked') << all input elements that user selected
  $('input[type='radio']:checked') << combined : all radio buttons selected
  $("input:radio") << all radio buttons
  $("input:radio:checked") << all radio button selected
  ...
  <form>
    <input type="checkbox">Check 1</input>
    <input type="radio">Check 2</input>
    ...
  </form>

list selected
  $("select option:selected") << selected elements
  <form>
    <select size="4" multiple="true">
      <option>Item 1</option>
      <option>Item 2</option>
      ...
    </select>
  </form>

attribute value

get attribute value
  $('img:first').attr("alt") << get value of attribute "alt" from first <img> element
  $('img')slice(0, 1).attr("alt") << same
  $('img')[0].attr("alt") << won't work
  $('img:nth-child(1)).attr("alt") << won't work (throw "undefined"), don't know why

set attribute value
  $('img:first').attr("alt", "...") << set value of attribute "alt" for first <img> element
for "value" attribute, can also use function val()
  $("#target").val("new value") << same as $("#target").attr("value", "new value")

set width/height
  $('img').width(486); $('img').height(365); << set new size

rewrite text  
  $("p")[0].innerHTML = "<i>Hello there!</i>";

rewrite element
  $("div").html("...") << rewrite HTML text inside <div> element
  $("div").text("...") << rewrite text inside <div> element (treat parameter as simple text)
  $("p").append("...") << append HTML content for all <p> elements

page structure

check element type
  $('#p1').is('p') << TRUE if element with ID 'p1' is <p> element

insert element before/after
  $("...").insertAfter("#first") << insert after element with ID=first
  $("#first").after(...) << same
  $("...").insertBefore("p") << insert before EVERY <p> elements
  $("p").before(...)  << same

move element
  $("p:last").append($("p:first")) << append existing element = move element
  NOTE: index not updated after element moved?
  e.g. following example work can only rotate one round
  function rotate()
  {
    $("p:last").append($("p:first"));
  }
  ...
  <p>Element 1</p>
  <p>Element 2</p>
  <p>Element 3</p>
  <p>Element 4</p>
  <form>
  <input type = "button" value="Rotate" onclick="rotate()"></input>

wrap element
  $('p').wrap('<h1></h1>') << wrap <p> in <h1> i.e. become <h1><p>...</p></h1>

event

overview
  page element --> event --> event handler
bind an element's event to event handler
  $('img').bind(event, data, handler)
    event : event name
    data : additional data (optional)
    handler : handler function
  e.g. bind image(with id="target")'s click event (alert a message)
    <script>
      $(function(){
        $('#target')
          .bind('click', function(event) {
            alert('Hello!');
          });
      });
    </script>
    ...
    <img id='target' ...>
    ...

bind multiple events
  $('#target')
    .bind('click', function(event) {
      ...1st event handler...
    })
    .bind('click', function(event) {
      ...2nd event handler...
    })
    .bind(...)

shortcut (apply to all type of event)
  .bind('click', function(event){... = .click(function(event) {...

call event handler only once
  .one('click', function(event){... << use one() instead of bind()

some event object properties
  event.pageX, event.pageY, event.screenX, event.screenY
  NOTE: top-left = (0,0)
  event.type e.g. click, mouseenter, mouseout
  event.keyCode << key pressed (raw key code, no shift detected)
    String.fromCharCode(event.keyCode) << convert from key code to char (return capital letter)
  event.target

handle hover event
  $('#target').hover(over, out);
  ...
  function over(event) {
    ...
  }
  function out(event) {
    ...
  }

show/hide

show/hide element
  $('p:first').show();
  $('p:first').hide();
NOTE:
  can specify parameters same as slideUp/slideDown mentioned below

show/hide with duration and callback
  $('#target').show(2000, hey) << duration = 2000 msec; call function hey() after done (can pass parameters if necessary)
  $('#target').hide(2000, hey)
  $('#target').toggle(duration, callback) << switch between show/hide
  $('#target').fadeIn(duration, callback) << (show/hide + visual effect)
  $('#target').fadeOut(duration, callback) << (show/hide + visual effect)
  $('#target').fadeTo(duration, callback) << partially fade
  $('#target').slideUp(duration, callback) << (show/hide + visual effect)
  $('#target').slideDown(duration, callback) << (show/hide + visual effect)
  $('#target').slideToggle(duration, callback) << switch between slide up/down
  $('#first').slideUp("slow"); $('#first').slideDown("slow")
NOTE:
- duration : fast = 200msec, slow=600msec;
- much more parameters are available, see jQuery API at http://api.jquery.com/slideUp/
- use attribute style to initially hide element >> <img id='target' src='image1.jpg' style='display:none'/>

animation

  animate(params, duration, easing, callback) << animation from starting style to target style (specified by params)
  e.g.
  <script>
    function animator()
    {
      $("#target").animate({
        width: "80%",
        opacity: 0.333,
        fontSize: "26pt",
        marginLeft: "0.5in",
        borderWidth: "15px"
      }, 2000 );
    }
  </script>

others

apply/toggle class
  $('div p.second').addClass("striped");
  $('div p.second').toggleClass("striped");
  ...
  <style>
    p.second {
      font-weight: normal;
    }
    p.striped {
      background-color: cyan;
    }
  </style>

running code when page is ready
  $(document).ready(function() {
    ...
  });
OR in short form
  $(function() {
    ...
  });

change style
  $('p:first').css("font-style", "italic");

create new element
  $("...<html text here>...") OR jquery("...")

apply custom function to elements
  $('img').each(function(m) { << apply to <img> element; refer each element using this, m = element index
    this.alt = "Image " + (m+1);
    ...
  });

วันศุกร์ที่ 5 เมษายน พ.ศ. 2556

Some Nice Programs on Ubuntu


Good page for various indicators for Ubuntu
  http://askubuntu.com/questions/30334/what-application-indicators-are-available

Listed are some of my favorite from above page, and how to install

System Load Indicator - a small indicator on top of screen for monitor CPU, memory, ...

  sudo apt-get install indicator-multiload

Shutter - screen capture tool

detail here >> http://www.noobslab.com/2012/02/install-shutter-screenshot-tool-on.html
  sudo add-apt-repository ppa:shutter/ppa
  sudo apt-get update
  sudo apt-get install shutter

Indicator Stickynotes - a sticky note on desktop

  sudo add-apt-repository ppa:umang/indicator-stickynotes
  sudo apt-get update
  sudo apt-get install indicator-stickynotes

Sublime Text 2 - a text editor for coding

1. download tarball from http://www.sublimetext.com/2
2. uncompress file
  tar xf "Sublime Text 2.0.1 x64.tar.bz2"
3. move to /opt
  sudo mv "Sublime Text 2" /opt/
4. create symbolic link (to call from terminal using 'sublime')
  sudo ln -s /opt/Sublime\ Text\ 2/sublime_text /usr/bin/sublime
5. add launcher in Unity
  sudo sublime /usr/share/applications/sublime.desktop
6. paste following entry in above file
  [Desktop Entry]
  Version=1.0
  Name=Sublime Text 2
  # Only KDE 4 seems to use GenericName, so we reuse the KDE strings.
  # From Ubuntu's language-pack-kde-XX-base packages, version 9.04-20090413.
  GenericName=Text Editor
  
  Exec=sublime
  Terminal=false
  Icon=/opt/Sublime Text 2/Icon/48x48/sublime_text.png
  Type=Application
  Categories=TextEditor;IDE;Development
  X-Ayatana-Desktop-Shortcuts=NewWindow
  
  [NewWindow Shortcut Group]
  Name=New Window
  Exec=sublime -n
  TargetEnvironment=Unity
7. set Sublime as default text editor
  sudo sublime /usr/share/applications/defaults.list
  then replace all occurrences of gedit.desktop with sublime.desktop

Ubuntu Tweak 0.8 - to remove previous linux version from GRUB

detail here >> http://www.noobslab.com/2012/11/install-ubuntu-tweak-082-in-ubuntu.html
  sudo add-apt-repository ppa:tualatrix/ppa
  sudo apt-get update
  sudo apt-get install ubuntu-tweak
After install Ubuntu Tweak, to remove "linux previous version" from GRUB list,
follow these steps
1. Start Janitor in Ubuntu Tweak, and click "Old Kernel"
2. Select old kernel (can select all), and click "Clean"
3. Restart Ubuntu, and "linux previous version" will disappear from GRUB list
detail here >> http://askubuntu.com/questions/28978/how-to-get-rid-of-multiple-linux-versions-in-grub-boot-menu

Google Chrome - Web Browser

detail here >> http://www.noobslab.com/2012/02/install-latest-google-chrome-on-ubuntu.html
1. download installation file from https://www.google.com/intl/en/chrome/browser/?platform=linux
2. to install (for 64-bit)
  sudo apt-get install libnss3-1d libxss1
  cd Downloads
  sudo dpkg -i google-chrome-stable_current_amd64.deb

PDF Reader 9

  sudo apt-add-repository "deb http://archive.canonical.com/ $(lsb_release -sc) partner"
  sudo apt-get update
  sudo apt-get install acroread

WISH LIST

- ClassicMenu Indicator << Windows-like menu
   This is still beta version

Prepare Python + Django Development Environment


Here are steps I set up Ubuntu for web development using
- MySQL 5.5 + MySQL Workbench + phpMyAdmin
- Apache2
- Python 2.7.3 + Django 1.4.5
- Eclipse + PyDev + Color Theme
- South 0.7.6 (library to manage model sync with database in Django)
- Django Debug Toolbar

Install MySQL 5.5

detail here >> https://help.ubuntu.com/12.04/serverguide/mysql.html
  to install MySQL (root password = admin....)
    sudo apt-get install mysql-server
  to check if MySQL Server is running
    sudo netstat -tap | grep mysql
  to start/stop/restart MySQL
    sudo service mysql stop
    sudo service mysql restart
  to change config file
    config file at /etc/mysql/my.cnf
    after change, restart MySQL
  to change root password
    sudo dpkg-reconfigure mysql-server-5.5

Install MySQL Tuner

detail here >> https://help.ubuntu.com/12.04/serverguide/mysql.html
  to install
    sudo apt-get install mysqltuner
  to run
    mysqltuner

Install MySQL Workbench

detail here >> http://www.upubuntu.com/2012/12/install-mysql-workbench-5244-from-ppa.html?m=0
  to install
    sudo add-apt-repository ppa:olivier-berten/misc
    sudo apt-get update
    sudo apt-get install mysql-workbench
  to run
    mysql-workbench &

Install Apache2

  to install
    sudo apt-get install apache2
  to test
    http://127.0.0.1

  file location
    document root at /var/www
    config file at /etc/apache2/apache2.conf
    additional config at /etc/apache2 directories, e.g.
       /etc/apache2/mods-enabled (for Apache modules),
       /etc/apache2/sites-enabled (for virtual hosts), and
       /etc/apache2/conf.d.
    log file at /var/log/apache2

Install phpMyAdmin

detail here >> https://www.digitalocean.com/community/articles/how-to-install-and-secure-phpmyadmin-on-ubuntu-12-04
  sudo apt-get install phpmyadmin
    Select Apache2 for the server
    Choose YES when asked about whether to Configure the database
  edit /etc/apache2/apache2.conf to add following line
    Include /etc/phpmyadmin/apache.conf
  sudo service apache2 restart << restart Apache2
  test access to http://localhost/phpmyadmin

Install Python 2.7

No need for this step since Python 2.7.3 is installed by default on Ubuntu 12.04

NOTE: Python files at /usr/local/lib/python2.7/

Install Django 1.4

1. install mod_wsgi (for Apache2, similar to mod_php to link Apache with script)
  sudo apt-get install libapache2-mod-wsgi
2. install Python library for install Python package
  sudo apt-get install python-setuptools python-pip
3. install Django
  sudo pip install django==1.4.5
4. test Django
  python
  >>> import django
  >>> django.VERSION
  (1, 4, 5, 'final', 0)

NOTE: django files at /usr/local/lib/python2.7/dist-packages/django/

Install Eclipse

detail here >> http://www.linoob.com/2011/09/starting-with-python-on-eclipse-in-ubuntu/
detail for color theme here >> http://marketplace.eclipse.org/content/eclipse-color-theme#.UeCmfxcW3Zg
detail for template highlight here >> http://eclipse.kacprzak.org/

1. install Eclipse from Ubuntu Software Center (no need to install java before hand)
2. setup Pydev
   2.1 from Eclipse menu > Help > Install New Software > Add button
   2.2 input Name=PydevEnv(or what ever), URL=http://pydev.org/updates then click OK
   2.3 click Works With field, select Pydev from list below, then click Next, Next, and follow the steps
3. configure Pydev
  from Eclipse menu > Window > Preferences > PyDev > Interpreter Python > click AutoConfig > click OK for default selelction
  (no need to select the first one for Pydev)
4. [optional but nice to have] add color theme for eclipse
   4.1 from Eclipse menu > Help > Install New Software > Add button
   4.2 input Name=(what ever), URL=http://eclipse-color-theme.github.com/update then click OK
   4.3 select Eclipse Color Theme from list below, then click Next, Next, and follow the steps.
   4.4 to change color theme, go to menu Window > Preference > General > Appearance > Color Theme (for dark theme I use Sunburst).
5. [optional but nice to have] add highlight for Django template
   5.1 from Eclipse menu > Help > Install New Software > Add button
   5.2 input Name=(what ever), URL= http://eclipse.kacprzak.org/updates then click OK
   5.3 select Django Template Editor from list below, then click Next, Next, and follow the steps.
   5.4 to change settings, go to menu Window > Preference > Django Editor

Install MySQL for Python (MySQL connector for Python programming)

detail here >> http://blog.mattwoodward.com/2012/08/installing-mysql-python-module-on-ubuntu.html
1. (if not installed yet) Install pip
  sudo easy_install pip
2. (just for sure) upgrade pip
  sudo pip install pip --upgrade
3. build the dependencies for the python-mysqldb libraries
  sudo apt-get build-dep python-mysqldb
4. use pip to install the Python MySQL libraries
  sudo easy_install -U distribute
  sudo pip install MySQL-python


Install South (database migration in Django)

detail here >> http://south.readthedocs.org/en/0.7.6/
1. Install South (database migration in Django)
  sudo easy_install South
2. register to Eclipse
  go to menu Window > Preferences > PyDev > Interpreter-Python
  click button 'New Folder' to add
  /usr/local/lib/python2.7/dist-packages/South-0.7.6-py2.7.egg

Install Django Debug Toolbar (provide additional debug information)

detail here
>> https://github.com/django-debug-toolbar/django-debug-toolbar
     very detail in installation/configuration in this official site
>> http://www.packtpub.com/article/django-debug-toolbar
     explain screen image and usage

1. install debug tool bar
  sudo easy_install django_debug_toolbar
2. add 'debug_toolbar.middleware.DebugToolbarMiddleware', to the end of middleware classes in project settings
3. edit INTERNAL_IPS = ('127.0.0.1', ) in my django.global_settings.py
   by default, debug toolbar is displayed only when DEBUG is True and run from IP listed in INTERNAL_IPS.
4. add 'debug_toolbar', to the INSTALLED_APPS in project settings.py
<< optional >>
5. add a tuple called DEBUG_TOOLBAR_PANELS to settings.py to specify the full Python path to panels that are included in toolbar.
    # comment out unnecessary panels or re-order if needed
    DEBUG_TOOLBAR_PANELS = (
        'debug_toolbar.panels.version.VersionDebugPanel',
        'debug_toolbar.panels.timer.TimerDebugPanel',
        'debug_toolbar.panels.settings_vars.SettingsVarsDebugPanel',
        'debug_toolbar.panels.headers.HeaderDebugPanel',
        'debug_toolbar.panels.request_vars.RequestVarsDebugPanel',
        'debug_toolbar.panels.template.TemplateDebugPanel',
        'debug_toolbar.panels.sql.SQLDebugPanel',
        'debug_toolbar.panels.signals.SignalDebugPanel',
        'debug_toolbar.panels.logger.LoggingPanel',
    )
6. add a dictionary called DEBUG_TOOLBAR_CONFIG to settings.py to specify additional configuration
    DEBUG_TOOLBAR_CONFIG = {
        'INTERCEPT_REDIRECTS': False,
        'SHOW_TOOLBAR_CALLBACK': None,
        'EXTRA_SIGNALS': ['myproject.signals.MySignal'],
        'HIDE_DJANGO_SQL': False,
        'SHOW_TEMPLATE_CONTEXT': False,
        'TAG': 'div',
        'ENABLE_STACKTRACES' : True,
    }
7. add the debug_toolbar directory to your Python path (so far not needed)

NOTE: The debug toolbar will only display itself if the mimetype of the response is either text/html or application/xhtml+xml and contains a closing tag.

Create Sample Django Project

1. create project folder
  cd /home/somnuk/workspace
  django-admin.py startproject twc
  << ls to see result >>
  somnuk@somnuk-NB:~/workspace$ ls twc
  manage.py  twc
  somnuk@somnuk-NB:~/workspace$ ls twc/twc
  __init__.py  settings.py  urls.py  wsgi.py

2. create file /home/somnuk/workspace/twc/apache/django.wsgi with following content
  NOTE: make sure no indent in this file (indent in Python has meaning)
    import os
    import sys

    sys.path.append('/home/somnuk/workspace/twc')
    os.environ['DJANGO_SETTINGS_MODULE'] = 'twc.settings'
    import django.core.handlers.wsgi
    application = django.core.handlers.wsgi.WSGIHandler()

3. create necessary folders
  mkdir /home/somnuk/workspace/twc/static
  mkdir /home/somnuk/workspace/twc/media
  mkdir /home/somnuk/workspace/twc/django-static
  NOTE:
  - corresponding to file twc.conf created in step 4
  - if these folders not exists, Internal Server Error when test in step 6

4. create file /etc/apache2/sites-available/twc.conf with following content
  Alias /robots.txt /home/somnuk/workspace/twc/static/robots.txt
  Alias /favicon.ico /home/somnuk/workspace/twc/static/favicon.ico

  AliasMatch ^/([^/]*\.css) /home/somnuk/workspace/twc/static/styles/$1

  Alias /media/ /home/somnuk/workspace/twc/media/
  Alias /static/ /home/somnuk/workspace/twc/django-static/

  <Directory /home/somnuk/workspace/twc/django-static>
    Order deny,allow
    Allow from all
  </Directory>

  <Directory /home/somnuk/workspace/twc/media>
    Order deny,allow
    Allow from all
  </Directory>

  WSGIScriptAlias / /home/somnuk/workspace/twc/apache/django.wsgi

  <Directory /home/somnuk/workspace/twc/apache>
    Order allow,deny
    Allow from all
  </Directory>

5. enable site
  sudo a2ensite twc.conf
  sudo /etc/init.d/apache2 restart

6. access http://127.0.0.1
  if error, check apache log at /var/log/apache2

วันพฤหัสบดีที่ 4 เมษายน พ.ศ. 2556

Dual Boot Ubuntu Desktop 12.04 + Windows7 : The Right Solution

Dual Boot Ubuntu Desktop 12.04 + Windows7 : The Right Solution

NOTE: Ubuntu WUBI didn't work well (don't know why)
NOTE: Check Ubuntu certified H/W here >> http://www.ubuntu.com/certification/desktop/
1. Install Ubuntu
   detail steps here >> http://www.dedoimedo.com/computers/dual-boot-windows-7-ubuntu.html
   1.1 download Ubuntu Desktop from web --> got file .iso
   1.2 burn to DVD
       it's bootable
   1.3 boot from DVD, select Try Ubuntu
       check if there is no problem with H/W
   1.4 (if needed) use GParted to create partition for install Ubuntu
       it comes with DVD
       - one extended partition, and under this extended partition create:
       - one logical partition for root (File System = ext4, Label = root)
       - one logical partition for swap (File System = linux-swap, Label = swap)
       - one logical partition for home (File System = ext4, Label = home)
   1.5 install Ubuntu at root partition above
       - mount point / for root partition
       - mount point /home for home partition
       - [IMPORTANT] create GRUB loader at root partition (then use EasyBCD to dual boot later)
         if create at HDD (i.e. /dev/sda), it will overwrite Windows boot loader,
         hence boot from GRUB, and might cause problem if want to remove Ubuntu later and have only Windows
         NOTE: Never try this way because I used GRUB, but this should be a better way - -;
2. Install EasyBCD 2.2
   It is a small program for multi-boot, free for non-commercial.
   After installed, add new entry for Ubuntu
   Type = GRUB 2
   Drive = Automatically locate and load

If you have used GRUB, and want to switch to EasyBCD, here are steps

0. Situation
   0.1 Current : When switch on, GRUB loader work, listed Ubuntu and Windows
   0.2 Target  : When switch on, EasyBCD work, listed Ubuntu and Windows, when select Ubuntu, not list Windows again
1. Install EasyBCD 2.2 and create entry for Ubuntu (as above)
2. Boot into Ubuntu and do following steps
   cd /etc/boot.d
   sudo chmod a-x 30_os-prober
   sudo update-grub
   NOTE: 30_os-prober is a script to find other OS (e.g. Windows),
         remove 'x' from it will prevent GRUB to show Windows for selection
3. Restore Windows Master Boot Record
   3.1 Boot with Windows installation DVD,
   3.2 select Repair My Computer > select drive with Windows installation > select Command Prompt
   3.3 use this two commands (execute one command at a time)
       bootrec.exe /FixBoot
       bootrec.exe /FixMbr
   detail here >> http://blog.eukhost.com/webhosting/howto-remove-grub-loader-and-restore-windows-7-and-vista-bootloader/
4. Restart and it should be OK now.

Another alternative is to use Boot Repair in Ubuntu.
Recommended repair worked for me so far.
This will boot from GRUB.

Just in case, here are steps to create Ubuntu VMWare

detail here >> http://www.howtogeek.com/howto/11287/how-to-run-ubuntu-in-windows-7-with-vmware-player/
1. download Ubuntu Desktop from web --> got file .iso
   same as above
2. start VMWare Player or Workstation, click "Create a New Virtual Machine"
3. select "Installer disc image file (iso)", and browse to above iso file
4. go ahead, following steps not difficult
5. (just in case) if install VMWare Tool failed during setup,
   manually install it (detail step in the above URL)
   to integrate with host OS (i.e. Windows) from Ubuntu VMWare

To install nVidia driver on Ubuntu

detail here
>> http://news.softpedia.com/news/How-to-Install-The-Latest-Nvidia-Driver-on-Ubuntu-12-04-295542.shtml
>> http://www.noobslab.com/2012/10/install-latest-nvidia-drivers-in-ubuntu.html
1. for clean install
   sudo add-apt-repository ppa:ubuntu-x-swat/x-updates
   sudo apt-get update
   sudo apt-get install nvidia-current
2. for upgrade
   sudo add-apt-repository ppa:ubuntu-x-swat/x-updates
   sudo apt-get update
   sudo apt-get dist-upgrade
3. just for unlucky case where after installed the driver, resolution may down to 640x480,
   here are steps to remove nVidia driver (hence return to default nouveau driver)
   detail here >> http://askubuntu.com/questions/206283/how-can-i-uninstall-a-nvidia-driver-completely
   sudo apt-get remove --purge nvidia-*
   sudo apt-get install ubuntu-destkop
   sudo rm /etc/X11/xorg.conf
   echo 'nouveau' | sudo tee -a /etc/modules

Turn on/off Touchpad in ThinkPad Edge E430

I tried using xinput set-prop to disable touchpad, but the device ID keep changing (e.g. sometimes 14, sometimes 12, ...) so I changed to use Touchpad Indicator, and it works.
detail for disable device from command line  here
http://askubuntu.com/questions/65951/how-to-disable-touchpad

to make it run every reboot, detail here >> http://ubuntuforums.org/showthread.php?t=1930479
1. create file disable_touchpad.sh as below (use appropriate id from xinput list, "14" is just an example)

    #!/bin/bash
    xinput set-prop 14 "Device Enabled" 0

2. save at ~/bin folder
3. register at Startup Applications to run when startup.