Saturday, September 26, 2009

When encounter bore people

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

Thursday, September 24, 2009

ASUS F81SE-VX200D Review


http://atit00784.tarad.com/product.detail.php?id=2356998

NoteBook ASUS ASUS F81SE-VX200D

ราคา 26,800.00
รายละเอียด: Type : NoteBook ASUS F81SE-VX200D
Processor : Intel Core 2 Duo T6500 (2.10GHz, 2 MB L2 cache 800 MHz FSB)
Chipset : SiS 671/FX/DX/MX & SiS 968
Display : 14.0" HD (1366x768) LED backlight,Color-Shine (Glare-type)
Graphic : ATI Mobility Radeon HD4570
Memory : 2048MB DDR2-800 (Max 4GB)
Harddrive : 320GB(5400rpm).
Optical Driver : 5.25" , 12.7mm DVD Super Multi Double Layer Blu-Ray
Modem : 56K Modem
Network : 10/100 Mbps LAN SiS191 Ethernet
Wireless : Atheros AR928X Wireless
Sound : Realtek High Definition Audio , SRS Premium Sound
WebCam : 1.3 Mega Pixel web camera
Bluetooth : Integrated Bluetooth BT-253
Keyboard Language : Thai+Eng. Keyboard
USB Port : USB 2.0 x2 port
I/O Port : VGA Out , HDMI , ExpressCard
Option : 4-in-1 card reader (SD, MMC,MS PRO, MS)
OS : DOS
Support VISTA / Windows XP
CD Drives Vista / Xp
security : Finger Print
Weight : 2.39 kg.
ฟรี!! แถมกระเป๋าโน๊ตบุ้ค
รับประกัน 2 ปี.

(23/07/2552)
  • หลังจากมีปัญหาเรื่องความร้อนกับเจ้า Compaq Presario V3723AU
  • จนทนไม่ไหว อยู๋ดีๆ ก็ดับตัวเองไปซะงั้น คงไม่นาน shipset nvidia คงจะเดีัยงแน่ๆ
  • จึงต้องเริ่มมองหา NB ตัวใหม่ วันแรก มองหลายๆ ค่ายทั้ง Acer, BenQ, Lenovo อยู่ 3 ค่ายนี้แหละ
  • แต่ที่แน่ๆ ไม่มองคือ ค่าย HP (Compaq ก็ค่าย HP) เริ่มเซงทั้งค่าย
  • ปัญหาเรื่อง nvidia กับ amd สมทบทำให้เครื่อง แทบนำไปเป็น heater ได้เลย
  • วันแรกสน ASUS F81SE-VX192 F81Series น่าสนดีแต่ราคาสูงไปหน่อย 30000 กว่า แต่ใน NB Spec ไง๋ใส่ราคาแค่ 29,500 หว่ามั่วจริง(หรือยังไงงงอย่างแรง) ตัวนี้ใช้ Core 2 Duo Centrino 2 P8700 2.53 GHz น่าสนมากๆ
  • แต่เพื่อนไปเดินพันธ์ทิพย์มาเค้าเชียร์ ASUS F81SE-VX200D
  • ASUS F81SE-VX200D 25,400 เงินสดอ่ะนะ บาท วันที่ 27 สิงหาคม 2552 พันธ์พลาซ่าประตูน้ำ Free DDR2 เพิ่มให้ 2G จากเดิมที่มีอยู่แล้ว 2G กลายเป็น 4G
  • วันแรกที่ใช้ CDROM มันสั่นแรงมากเลย โทรไปเช็คที่ศูนย์ เค้าว่าเป็นกับแผ่น ทั้งๆ ที่แผ่นนั้นเป็น driver ที่เค้าให้มาพร้อมตอนซื้อหว่า แต่พอลองเปลี่ยนไปอ่านแผ่นอื่นๆ เอ่อ สั่นเบาลงเป็นปกติ จริงๆแฮะ แสดงว่าแผ่นที่เค้าให้มาด้วย มันเป่งๆ นี่เอง ^^'
  • ส่วนอย่างอื่นก็โอเค เล่น PES2009 , FM2009 TV Mode โอเคเลยภาพ เนียนดีมากๆครับ
  • อีกเรื่องคือเค้ามีแผ่น Driver Xp, Vista มาให้อย่างละแผ่นและ อีกแผ่นไม่รู้ว่าใช้ทำไร
  • แต่ไมไม่มี แผ่น driver windows 7 มาให้ด้วยหว่า - -'
  • ตอนนี้นะ ขอบอกว่า รู้สึก โอเคมากเลย กับ VX200D
  • แต่ เสียอย่างทำไม ASUS ต้องวางตำแหน่ง speaker ไว้ด้านหน้า ล่างด้วยน้า - -'
  • อีกอย่าง เสียง beep ตอนปิดเครื่อง ไม่เป็นแหละ ไม่เหมือน Presario V3723AU
  • ส่วนเรื่อง driver ถ้าเราทำแผ่นหาย เราสามารถไปโหลดได้ที่
  • http://support.asus.com/download/download.aspx?SLanguage=en-us
  • ค่อนข้างครบทุก os (ของ wins นะ xp - 7 64bit)
  • คือ ถ้าเราใช้ windows 7 ก็ไม่ต้องพึ่ง driver vista อ่ะนะ เพราะ เค้ามีของ 7 เองเลยไปดาวน์โหลดเอาเองได้เลยอ่ะนะ
  • แต่ทำไมรุ่น Z99Se ไม่เห็นมี Driver ของ windows 7 ให้ดาวน์โหลดในเว็บเลยหว่า มีถึงแค่ vista แค่นั้นเองหรอ


อ้างอิง

Disable TouchPad when external USB mouse attached

  • ปัญหามีอยู่ว่าเมื่อใช้แป้นพิมพ์ NB แล้วมือมักไปโดน touchpad จะปิดการทำงานของ touchpad ยังไงหว่าอยากใช้แค่ USB Mouse อย่างเดียวอ่ะ
  • ASUS F81 VX200D

1. ติดตั้ง driver touchpad ก่อนเลยในแผ่น Driver & Utils
2. จากนั้นเมื่อเราติดตั้งเสร็จที่ systemtray เราจะเห็นรูป touchpad ขั้นมาแสดงว่าติดตั้งสำเร็จ
3. เข้าไปใน Control Panel เลือก Mouse ไปที่แท๊ป Device Settings
4. ติ๊กเครื่องหมายถูกหน้า Disable internal ... attached ทีนี้เมื่อเราทำการ attached USB Mouse แล้ว touchpad เราก็จะ disable เอง


สรุป

  • คือเราต้องติดตั้ง Touchpad driver ก่อนถึงจะเห็น Device Settings ของ Mouse
  • หรือแค่ อยาก disable หรือ enable touchpad โดย Fn + F9

Enable fingerprint ASUS F81SE-VX200D

  • พอดี Compaq Presario V3723AU มันไม่รักดี
  • วันก่อนเลยไปถอย NB เครื่องใหม่ซะเลย
  • คราวนี้ได้ ASUS F81Se-VX200D
  • อันนี้มี Fingerprint ให้ด้วยหว่า แต่ใช้ไม่เป็น เลยลองหาวิธีในอินเทอร์เน็ต
  • แล้วก็พอจะสรุปด้วยตัวเองได้ คร่าวๆ แบบนี้

1. นำแผ่น Driver & Utils ของ OS ที่เราใช้ใส่เข้าไปซะ ในที่นี้ใช้ Vista SP1 อ่ะ
2. เมื่อ Autorun ทำงานก็จะขึ้นประมาณ Driver และ Utils ให้เราเลือกติดตั้ง
3. เรื่องนี้เกี่ยวกับ Fingerprint เราก็เลือกที่ ASUS FingerPrint Driver and Utility และ ADSM (ASUS Data Security Manager)
4. รีบูตระบบสักรอบ จากนั้นเมื่อเราเข้าสู่ระบบ ทางด้านขวาล่าง (system tray) เราจะเห็นรูป คล้ายๆ นาฬิกาปลุก หรือ นาฬิกาจับเวลา หรือ รูปแม่กุญแจ แล้วแต่จะจินตนาการ ให้เราคลิกขวาเลือก Fingerprint Enrollment จากนั้นใส่รหัสของ user ปัจจุบันซะก่อน
5. เลือกนิ้วมือ หลังจากนั้นก็ให้รูดที่ fingerprint 3 รอบ เมื่อทุกอย่างโอเค ภาพตอนขั้นตอนการเลือกนิ้วมือก็จะเป็นรอยนิ้วมือดังภาพ เป็นอันเสร็จขั้นตอน รีบุตแล้วทดสอบ fingerprint เราได้เลย

ยกเลิกการใช้ Fingerprint
  • คลิกขวาทีรูป นาฬิการนั่นแหละ คลิก Windows Logon Setting
  • ติ๊กเอาเครื่องหมายถูกหน้า Use fingerprint ... logon ออกซะ
เพิ่มเติม
  • ถ้าต้องการใช้ระบบจดจำใบหน้าเราก็ต้องลง application ชื่อ SmartLogon
  • ขอบอกอีกอย่างรุ่นนี้ ATI RADEON HD4570 ของเค้าแรงดีจริง เล่น PES 2009 งี้เนียนเฉียว
  • ถึง MB จะใช้ SIS ก็เหอะ แต่เครื่องก็โอเคนะ ไม่ร้อนเท่าใหร่
  • ส่วนใครใช้ Xp ก็ใช้ Driver & Util XP เค้าจะมีมาให้ 3 แผ่น , 2 แผ่นเป็น driver ของ xp, vista อีกแผ่นเป็น application เกี่ยวกับ multimedia
  • รุ่นนี้วันนี้ทดสอบลงด้วย Windows 7 ไม่ค่อยเวิร์คหว่า ใช้ Vista แจ่มกว่า (ตอนนี้นะ)
  • แต่รุ่นอื่นที่ใช้ ATI RADEON HD 2400 ก็เล่น PES 2009 ได้นะแต่ รู้สึก จะเนียนไม่เท่า 200D เรา

สำหรับ windows 7

Or

Sunday, September 20, 2009

Query condition on datetime type column

  • เมื่อเราเปิด Microsoft SQL Server Management Studio ขึ้นมา
  • ทำการ select หรือ insert หรือ อาไรก็ชั่งที่เกี่ยวกับ datetime
  • ตอนเริ่มต้นครั้งแรกๆ งงแน่ๆ ว่าเราจะใส่ตัวเลขยังไงระหว่าง วัน กับ เดือน
ตัวอย่าง

c1 - c2 - c3[y-m-d]
1 - a - 2009-01-02
2 - b - 2009-02-01
3 - c - 2009-01-03
4 - d - 2009-03-01
  • ถ้าเราต้องการค้นหา row ที่ c3 เป็น วันที่ 1 เดือน 2 ปี 2009 ซึ่งผลลัพธ์ต้องได้ 2 - b - 2009-02-01
select * from table1 where c3 = '1/2/2009'
  • ผลลัพของ query เราจะได้ 1 - a - 2009-01-02 ซึ่งไม่ตรงตามที่เราต้องการ
  • คือ จริงๆ แล้ว Default ของโปรแกรมจะเป็น set dateformat mdy เริ่มต้นเลย
  • แต่ถ้าเราต้องการใส่เงื่อนไขแบบเนี๋ย '1/2/2009' ให้เราบอก query มอง datetime แบบ dmy ก่อน query เราก็จะได้ 2 - b -2009-02-01
set dateformat dmy
select * from table1 where c3 = '1/2/2009'
  • ซึ่งปกติผุ้เขียนก็ไม่ค่อยใช้แบบนี้อ่ะ / แต่จะใช้ - ชัวร์กว่าเยอะเลยคือ yyyy-mm-dd ปีเดือนวัน จำง่ายดี
  • การ insert , update, delete ก็เช่นกัน

Cannot perform '=' operation on System.String and System.Int32


Server Error in '/webapp' Application.
--------------------------------------------------------------------------------

Cannot perform '=' operation on System.String and System.Int32.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.EvaluateException: Cannot perform '=' operation on System.String and System.Int32.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[EvaluateException: Cannot perform '=' operation on System.String and System.Int32.]
System.Data.BinaryNode.SetTypeMismatchError(Int32 op, Type left, Type right) +21
System.Data.BinaryNode.BinaryCompare(Object vLeft, Object vRight, StorageType resultType, Int32 op) +2008
System.Data.BinaryNode.EvalBinaryOp(Int32 op, ExpressionNode left, ExpressionNode right, DataRow row, DataRowVersion version, Int32[] recordNos) +11791
System.Data.BinaryNode.Eval(DataRow row, DataRowVersion version) +27
System.Data.DataExpression.Invoke(DataRow row, DataRowVersion version) +81
System.Data.Index.AcceptRecord(Int32 record, IFilter filter) +103
System.Data.Index.InitRecords(IFilter filter) +214
System.Data.Index..ctor(DataTable table, Int32[] ndexDesc, IndexField[] indexFields, Comparison`1 comparison, DataViewRowState recordStates, IFilter rowFilter) +414
System.Data.DataTable.GetIndex(IndexField[] indexDesc, DataViewRowState recordStates, IFilter rowFilter) +240
System.Data.DataView.UpdateIndex(Boolean force, Boolean fireEvent) +165
System.Data.DataView.UpdateIndex(Boolean force) +12
System.Data.DataView.SetIndex2(String newSort, DataViewRowState newRowStates, IFilter newRowFilter, Boolean fireEvent) +113
System.Data.DataView.SetIndex(String newSort, DataViewRowState newRowStates, IFilter newRowFilter) +17
System.Data.DataView.set_RowFilter(String value) +170
System.Web.UI.WebControls.FilteredDataSetHelper.CreateFilteredDataView(DataTable table, String sortExpression, String filterExpression, IDictionary filterParameters) +386
System.Web.UI.WebControls.SqlDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +1610
System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +19
System.Web.UI.WebControls.DataBoundControl.PerformSelect() +142
System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +73
System.Web.UI.WebControls.GridView.DataBind() +4
System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +82
System.Web.UI.WebControls.BaseDataBoundControl.OnPreRender(EventArgs e) +22
System.Web.UI.WebControls.GridView.OnPreRender(EventArgs e) +17
System.Web.UI.Control.PreRenderRecursiveInternal() +80
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +842

--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.3074; ASP.NET Version:2.0.50727.3601


  • Error ด้านบนตอนเจอครั้งแรกก็งงเล็กน้อย ถึง ปานกลาง เพราะหา query ที่ผิดปกติไม่เจอ
  • พอเจอก็ถึงบางอ้อ คือ เราพยายามให้ query โดยใส่เงื่อนไข เปรียบเทียบแบบนี้
select ... where column1 = 25
  • ซึ่ง column1 มี type เป็น varchar เราพยายาม query เงื่อนไขระหว่าง varchar กับ int
  • ซึ่งอาจจะอยู่ใน filterexpression หรือ select ของ datatable ก็เป็นได้ถ้าเราหาใน query ไม่เจอนะ
SqlDataSource1.FilterExpression = " column1 = 1 ";
---------------------- OR ------------------------------
DataTable dt...
DataRow[] dr1 = dt.Select(" column1 = 2 ");
  • หรือบางทีถ้าไม่เจอใน query เหล่านี้ลองไปหาใน store procedure หรือ function ที่เราเขียนใน database
  • ตอนเขียน store procedure กับ function ใน database จำไม่ได้ว่าตอน compile เค้าตรวจสอบมั้ยน้า
  • ไม่แน่ใจ ต้องลองเช็คดูให้ รอบด้าน แต่คิดว่า เค้าน่าจะเช็ค syntax อยู่นะตอน compile หว่า
  • อีกเรื่องถ้า column มี type เป็น int เราสามารถ select ... where column_int = '4' ได้

Friday, September 18, 2009

มีปัญหากับ NB ตัวเองซะแหละ Compaq Presario V3723AU

  • อาการคือ ร้อนแล้วก็ ดับตัวเองไปซะงั้น
  • พอให้พักสัก ครึ่งชั่วโมง เปิดอีกที จอไม่ขึ้นอาไรเลย ตามอ้างอิงเลย
  • ปิด - เปิด อยู่ หลายรอบถอดใจคงต้องเสียเงิน หรือ ต้องถอยตัวใหม่แน่ๆ
  • พอเปิดอีกทีได้เฉยเลยแฮะ งง - -'' เล่นเอาเหงื่อตกเลยเรา
  • สงสัยต้องเปิดพัดลมอัดซะแหละ เวลาใช้งาน
  • สงสัย Series V3000 จะมีปัญหาเรื่อง ship nvidia หมดแน่ๆ

อ้างอิง

Install SQL Server 2008 Express problem with VS2008

  • คือ พยายามติดตั้ง SQL Server 2008 Express บน Windows 7 แต่ไม่ผ่านอ่ะ
  • ติดขั้นตอนเนี๋ย คือ เข้าว่า VS2008 เราต้อง update เป็น Service Pack 1 เสียก่อนหว่า
  • ไปอัพเดทกัน จากที่นี่
  • แต่เสียอย่างทำไมโหลดไฟล์อัพเดทมาได้แต่ 500 กว่า K เอง
  • ไง๋เข้าให้ อัพเดทผ่าน internet ซะงั้นน่าจะมีไฟล์ เดียวโหลดแล้วใช้ได้เลยไม่ต้องต่อเน็ตอ่ะ

Reference

Move or copy large files with Helper Copy program

  • ก็พอรู้มานานแล้วล่ะ ว่ามีโปรแกรมประเภทนี้ใช้อยู่
  • แต่ไม่เคยใช้จริงๆ จนมาถึงเมื่อวาน นั่งย้ายไฟล์จาก External Drive มาใส่ drive d: ในระบบ
  • folder ที่จะทำการย้ายมีขนาดใหญ่มากถึง 100 กว่า G พยายาม Copy & Paste บน Windows 7 เราอ่ะนะ
  • ตอนแรกจะคัดลอกทั้งหมดด้วย Copy & Paste ธรรมดาเนี๋ยล่ะ แต่ ไม่มีอาไรตอบสนองเลย
  • พอลองคัดลอก ไฟล์เล็กๆ ขนาดไม่กี่ G ก็ทำได้แต่รอนานเหมือนกันแฮะ หลับไปงี้บหนึ่งเลยอ่ะ
  • ทีนี้พอจะลอง คัดลอกไฟล์ที่เหลือ ประมาณ 32 G ไง๋เป็นเหมือนเดิมซะงั้น ไม่มีอาไรตอบสนองเลย
  • คิดว่าระบบมีปัญหา reboot os แล้วก็เป็นเหมือนเดิม
  • ก็เลยลองนึกชื่อโปรแกรมสำหรับ copy file และค้นหาใน google ก็ได้เจอ TeraCopy เป็น Freeware ด้วยแหละ
  • พอลอง Copy & Paste ด้วย TeraCopy ปรากฏว่า สุโค้ยเลย ทำได้และ เวลาที่ใช้ก็โอเคด้วยแหละ
  • เวลาในการคัดลอกไฟล์ (folder บรรจุไฟล์) ขนาด 32 G ใช้เวลาประมาณไม่เกิน 15 นาทีนะ
  • อยากแนะนำอีกตัวคือ fastcopy อันนี้ก็โอเคน่าใช้เหมือนกัน
  • อีกตัว super copy

อ้างอิง

Open iso or image file on Windows 7 with Alcohol 52% Free Edition

  • รู้สึกว่า พยายามลง Alcohol 120% แล้ว แต่ว่า Vista กับ 7 แสดงข้อความว่า Uncompatible อ่ะ
  • เลยต้องหาตัวอื่นมาลองใช้ดู ซึ่งมีทั้ง UltraISO ที่ใช้ได้ แต่ไม่ค่อยชอบ
  • และอีกตัวก็เป็น Alcohol 52% ซึ่งตัวเนี๋ยฟรีครับ
  • แต่ความสามารถก็พอใช้แค่ Burn image ไม่ได้แต่ Build image ได้

Wednesday, September 16, 2009

Tip about Crystal Report when export or printing

  • เกี่ยวกับ Crystal Report อ่ะนะ
  • คือ ทำหน้าออกรายงานด้วย Crystal Report
  • ในหน้านั้นก็จะมี TextBox เอาไว้ใส่คำค้นโดยใช้ LIKE '%...%'
  • และ ปุ่มเอาไว้กดแล้ว select ข้อมูลมาแสดงในรายงาน
  • ปัญหาเรื่องการออกรายงานนั้นไม่มีอาไร
  • แต่งง ตรงที่พอกด print หรือ export แล้ว หน้านั้นก็ refresh ตัวเองแล้วก็ไม่เกิดอาไรขึ้นงงอย่างแรง
  • พอไปดูโค้ดเก่าที่ทำงานได้ อืมก็เห็นความต่างตรงที่ อันอื่นจะมีการให้ใส่คำค้นหาจากหน้าอื่น แล้ว พอกดปุ่มแล้วส่งคำค้นหา มาที่หน้า Crystal Report viewer ซึ่งโค้ดการออกรายงานจะอยู่ที่ Page Load
  • จากตรงนี้ ใน code เราเลยไปใส่โค้ดออกรายงานที่ Page Load อีกอัน
  • ทำให้รู้ว่า เมื่อกด print หรือ export จะมีการ สร้าง Report ใน C:\Windows\Temp อีกหว่า
  • หรือ ตอนเรา export เค้าจะให้เลือกรูปแบบที่จะส่งออก หน้านี้เมื่อกด Ok ก็จะมีการสร้าง Rpt ใน Temp ด้วย
  • แต่ Local Report ไม่ต้องไปวางโค้ดออกรายงานที่ Page Load ก็ export ได้ปกตินะ

สรุป
  • ใช้ Crystal Report ควรไปวางโค้ดที่ Page Load ด้วย

Tuesday, September 15, 2009

using SQLParameter for SQL: "LIKE '%@parameter%'"

  • ปัญหาหนึ่งที่จำไม่ค่อยได้เลยว่าเขียนอย่างไร
  • คือ การ query แบบ like โดยส่ง parameter ไปเป็นเงื่อนไข like
  • แต่ใช้แบบนี้ ไม่ได้อ่ะ
select... where c1 like '%@searchterm%'
  • แต่เราสามารถใช้ แบบนี้ แล้วทำการส่งค่ามาแบบ %คำค้น% ได้ด้วยแหละ
select ... where c1 like @searchterm
  • แต่ถ้าไม่ต้องการให้ผู้ใช้ต้องใส่ % มาก็ให้ค้นหาแบบ like ได้ก็ให้ทำ ถ้าแบบบ้านๆ ก็ + ต่อ string
  • หรือ ถ้าจะใช้แบบป้องกัน injection ด้วยแล้วก็ต้องแบบนี้เลย
select ... where c1 like '%' + @searchterm + '%'
  • แล้วเราก็ทำการส่งค่าผ่าน SqlCommand หรือ SqlDataAdapter ได้เลยครับพี่น้อง

อ้างอิง

Writing Store Procedure and Function sql server for Me

ปัญหาที่ไม่ค่อยจะจำสักที เซงตัวเอง
  • ปัญหาอย่างหนึ่งที่พบ บ่อยมากๆ เมื่อเขียน Store Procedure (SP หรือ Function บน sql server คือ การประกาศ ตัวแปรชนิด varchar ซึ่งเรื่อง size ของ varchar เนี๋ยแหละ เจอและลืมประจำเลยว่า ต้องใส่ขนาดด้วย
  • ก็ใส่ขนาดซะ ปัญหาเรื่องไม่เป็นเรื่องก็จะจางไป อีกอย่าง ถ้า Function return varchar ก็ควรกำหนดขนาดให้ return ด้วยเช่นกัน
  • คือ ถ้าเราไม่ใส่ เมื่อเราทำการส่งค่าให้ SP หรือ Function หลายตัวอักษร ค่าที่ SP นั้นจะนำไปใช้จะใช้แค่เพียงตัวอักษรตัวแรก ตัวเดียวเท่านั้น ซึ่งอันนี้ก็ลืม ประจำเลย ทำให้กว่าจะแก้ได้ก็งงไปเป็นชั่วโมง
  • อีกเรื่องคือ ส่งค่าแบบใส่ space ไปด้วยทำให้เราสังเกตเห็นได้ยากนะ เช่น ' hello' ซึ่งถ้าใช้ SP หรือ Function ไม่ได้ทำการตัดช่องว่างก่อน นำไปประมวลผลเช่นนำไปใส่เป็นเงื่อนไขของ where อาจทำให้ผลการค้นหานั้น ไม่ถูกต้อง อันนี้ หาตั้งนานกว่าจะเจอว่า ตูเขียนอาไรผิดไปน้า ทำไมผลลัพธ์ มันไม่ได้สักที

Monday, September 14, 2009

ไขข้อข้องใจ ใช้แบตเตอรี่ notebook อย่างไรไม่ให้เสื่อมเร็ว

  • เป็นเรื่องที่เราสนใจพอดี เลย
  • คัดลอกทั้งหมด มาเก็บไว้เพื่อ ตัวเอง แค่เนี๋ย
posted on 09 Feb 2009 22:33 by hackerlife


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

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


และต่อไปนี้คือวิธีที่จะช่วยยืดอายุการใช้งาน
แบตเตอรี่โน๊ตบุคของคุณครับ


1. Defrag คอมพ์เสียบ้าง
การ Degragmentation คอมพิวเตอร์เนี่ยจะช่วยให้
การทำงานของโน๊ตบุคดีขึ้น มีประสิทธิภาพดีขึ้น
เพราะมันจะทำให้เวลาในการเข้าถึงข้อมูลลดน้อยลง
การจะเข้าไปอ่านข้อมูลใน Hard Drive จะต้อง
ใช้แบตเตอรี่ ผลกระทบมันอาจะน้อยนิด แต่ถ้าเรา
หมั่นรักษา hard drive ของเรา ก็ย่อมส่งผล
ต่อการใช้พลังงานจากแบตเตอรี่ด้วย ดังนั้นจง defrag คอมบ้างนะคับ

2. ตัวไหนไม่ใช้งานก็เอาออกซะ
ลองกด Ctrl-Alt-Del ดูนะครับ เพื่อจะได้หน้าต่าง
Windows Task Manager หากว่าคุณไม่ได้ใช้งาน internet
ก็ปิดโปรแกรมที่ไม่จำเป็นออกไปซะ เช่น firewall
พยายามปิดโปรแกรมที่ไม่จำเป็นในการใช้งาน
โดยเฉพาะอย่างยิ่งโปรแกรมตอน start-up (เมื่อเปิดเครื่อง
โปรแกรมเหล่านี้จะรันอัติโนมัติ) เราสามารถปิดโปรแกรม
ที่เป็น start-ups program ได้โดยการแก้ไขที่
System Configuration วิธีการก็คือ
ไปที่ Run แล้วพิมพ์ msconfing กด enter
แล้วก็ไปที่แถบ Startup ให้ uncheck โปรแกรม
ที่คุณไม่ต้องการให้มันรันอัติโนมัติตอนเปิดเครื่อง
แล้วก็รีสตาร์ทเครื่องไปหนึ่งครั้ง

3. หยุดการทำงานของ scheduled tast
ซึ่งอาจจะเป็นการตอนสแกนไวรัส หรือตอน defrag คอม
แต่ต้องมั่นใจว่าเราหยุดกระบวนการพวกนี้ไว้ก่อน
เฉพาะตอนที่แบตเตอรี่เราใกล้จะหมดแล้ว ถ้าหาก
แบตยังเหลือเีพียงพอ ก็ปล่อยให้มันทำงานไป

4. Unplug external devices
USB เป็นตัวการสำคัญที่สุดเลยแหล่ะ
ที่เป็นตัวกินพลังงานจากแบตเตอรรี่
ให้ถอด external device ออก เช่น เมาส์
PC cards, Wi-Fi,ฺีฺเครื่องเสียง,ฺBluetooth
หรือ iPod ก็จะทำให้เราใ้ช้งานได้นานขึ้น

5. Empty the CD/DVD Drives
ถ้าไม่ได้จะใช้งานจากแผ่น CD/DVDs ก็เอา
แผ่นออกจากคอมฯเสียเถดครับ เพราะถ้า
เกิดเราเอาแผ่นค้างไว้ เครื่องก็จะมาอ่าน
CD ด้วย ทำให้สูญเสียพลังงานของแบต
ไปโดยเปล่าประโยชน์

6. Lower the lights
จอ LCD ของโน๊ตบุคก็เป็นอีกตัวที่ใช้พลังงานเยอะ
ยิ่งใช้แสงจ้ามากๆ ก็ยิ่งใช้แบตมาก ดังนั้น
ควรเปิดแสงให้สว่างพอที่คุณจะมองเห็น ไม่ต้อง
จ้าเป็นไฟฉายหรอกนะครับ คุณสามารถแก้
ไขความจ้าของหน้าจอคอมได้ ด้วยการเปลี่ยนค่า
ที่ Display Setting (คลิกขวาหน้าจอ เลือก properties)

7.
ปิด screen saver
ตามนั้นแหล่ะครับ ปิดไปเสีย จะได้ใช้ได้นานขึ้น

8. Hibernate ดีกว่าเลือก Sleep
เวลาเราจะพักการทำงานของโน๊ตบุค
จะมีสองอย่างให้เลือกใช้ไหมครับ นั่นคือ Hibernate
กับ sleep ให้เลือก Hibernate ดีกว่า

วันนี้ผมก็มีมากฝาก 8 วิธีนะครับ หากเจอวิธีอื่นๆเพิ่มเิติม
ก็จะนำมาบอกอีกนะครับ เพื่อนๆคนไหนมีวิธีนอกเหนือ
จากนี้ก็เล่าสู่กันฟังได้นะคับ
(เพิ่มเติมข้อมูล ครับ)
-- มีเสียงเรียกร้องดูวิธีการป้องกันแบตไม่ให้เสื่อมเร็ว ผมเลยเอามาฝากคับ --

สำหรับแบตเตอรี่นี่จะเป็นแบตเตอรี่ที่เรียกว่า Lithium นะคับ
ซึ่งโน๊ตบุคส่วนใหญ่ก็จะใช้แบตเตอรี่ชนิดนี้ทังนั้นคับ รวมทั้ง
อุปกรณ์พกพาอย่างอื่นๆด้วยคับ เช่น มือถือ กล้องดิจิตอล เป็นต้น
ซึ่งแบตเตอรี่แบบ lithium นั้นถูกออกแบบมาให้ใช้งานง่าย
น้ำหนักเบา และไม่ต้องดูแลรักษามากนัก ซึ่งจะต่างจากแบตเตอรี่
แบบชาร์ตไฟใหม่ได้ในสมัยก่อนๆอย่างสิ้นเชิง
ทั้งในด้านวิธีใช้งาน และการดูแลรักษาอย่างถูกต้อง
แจ่มจริงๆ....
แบตเตอรี่แบบ lithium ที่พบเห็นบ่อยๆ ในปัจจุบันมีด้วยกัน 2 แบบ คือ

1. lithium-ion หรือตัวย่อว่า Li-ion เป็นแบตเตอรี่ที่พบเห็นมากที่สุด
ถือว่าเป็นแบตเตอรี่มาตรฐานสำหรับอุปกรณ์อิเล็กทรอนิกส์ในทุกวันนี้

2. lithium-ion polymer หรือตัวย่อว่า Li-Poly เป็นแบตเตอรี่ที่พัฒนาต่อยอดมาจาก
Li-ion โดยจะมีความจุไฟฟ้ามากว่า Li-ion ถึง 20% ในขนาดแบตเตอรี่ที่เท่ากัน
แบตเตอรี่แบบนี้มีจุดเด่นอีกอย่างหนึ่งคือมีข้อจำกัดเรื่องรูปร่างของเบตเต อรี่น้อยมาก
จึงทำให้สามารถสร้างแบตเตอรี่แบบ Li-Poly ให้มีขนาดเล็กและบางได้
รวมทั้งสามารถสร้างให้มีรูปทรงแปลกๆ ที่ไม่ใช่ทรงกระบอกหรือทรง
สี่เหลื่ยมเหมือนแบตเตอรี่แบบเดิมๆได้อีกด้วย อย่างไรก็ตาม
ต้นทุนการผลิตของ Li-Poly ยังจัดว่ามีต้นทุนสูง
ดังนั้นความนิยมจึงยังมีไม่มากเท่าแบตเตอรี่แบบ Li-ion

ทีนี้ลองพลิกดูแบตเตอรี่ของคุณๆ ดูว่าใช่แบตเตอรี่แบบ lithium
กันรึเปล่า ถ้าใช่แล้ว เรามาไขข้อเท็จจริงเกี่ยวกับแบตเตอรี่ lithium กันเลยดีกว่าครับ

1. ตารางเจ้าปัญหา ความจริงที่ถูกบิดเบือน

หลายๆคนอาจจะเคยเห็นตารางอย่างในรูปข้างบนมาแล้วใช่ไหมครับ
ต้นฉบับที่แท้จริงของตารางข้างบนมาจากเว็บ
ซึ่งในเว็บ และบนหัวตารางก็ระบุไว้อย่างชัดเจนมันคือตาราง
charge/discharge rateซึ่งคำว่า charge rate ไม่ได้หมายความว่า
ใช้แบตไปหมดไปกี่เปอร์เซ็นต์แล้วค่อยชาร์ตไฟกลับคืนเป็น 100%
แต่ charge rate หมายถึงอัตราของกระแสไฟฟ้าที่ใช้ชาร์ตแบตเตอรี่ในช่วงเวลา เช่น
ถ้าเรามีแบตเตอรี่ขนาด 10 Ah(ampere-hour) แต่เราชาร์ตไฟด้วย
แท่นชาร์ตที่ปล่อยไฟชั่วโมงละ 2 แอมแปร์(ampare) ก็จะต้องใช้เวลาชาร์ตไฟ
เข้าไปในแบตเตอรี่ที่ว่างเปล่าจนไฟเต็มด้วยเวลา 5 ชั่วโมง อัตราการชาร์ตระดับนี้เราเรียกว่าอัตรา C/5
หรือ 0.2C

ส่วนอัตรา 1C ก็คือ ถ้าชาร์ตแบตเตอรี่ขนาด 10Ah
ก็ต้องใช้แท่นชาร์ตที่ปล่อยไฟชั่วโมงละ 10 แอมแปร์ก็จะชาร์ดไฟได้เสร็จใน 1 ชั่วโมง

เช่นเดียวกับอัตรา 2C ก็คือ ชาร์ตแบตเตอรี่ขนาด 10Ah
ด้วยแท่นชาร์ตที่ปล่อยไฟชั่วโมงละ 20 แอมแปร์ก็จะชาร์ตไฟได้เสร็จใน 30 นาที

และคำว่า discharge rate ก็จะคล้ายๆกับ charge rate ครับแต่เป็นในทางกลับกันคือเป็นอัตราการใช้ไฟ

ดังนั้นจะเห็นได้ว่าตารางข้างต้นแสดงถึงว่าถ้าเราชาร์ตไฟด้วยกระแสไฟสูงใน
เวลาสั้นหรือใช้ไฟจากแบตในปริมาณมากในระยะเวลาอันสั้น
จะทำให้แบตเตอรี่แบบ lithium เสื่อมเร็วขึ้น (จำนวน cycle ลดลง)

ส่วนกรณีที่ยกมาอ้างว่า การชาร์ตไฟบ่อยๆหรือการใช้ไฟจากแบตเตอรี่เพียงเล็กน้อยแล้วรีบชาร์ตกลับให้ เต็ม 100% เป็นการช่วยเพิ่มจำนวน cycle นั้นไม่เป็นความจริงแม้แต่น้อย เพราะการเพิ่มลดของจำนวน cycle ไม่เกี่ยวกับรูปแบบการใช้งานว่าใช้มากใช้น้อยแล้วค่อยชาร์ตไฟ แต่จำนวน cycle เกี่ยวข้องโดยตรงกับรูปเครื่องชาร์ตว่าชาร์ตเร็วหรือช้า ถ้ายิ่งชาร์ตเร็วแบตฯก็จะเสี่ยมเร็ว ถ้าเครื่องชาร์ตค่อยๆชาร์ตแบตก็จะเสื่อมช้า
2. นับจำนวน Cycle อย่างไร
จำนวน Cycle คือตัวเลขที่บ่งบอกอายุการใช้งานของแบตเตอรี่ว่าแบตฯจะเริ่มเสื่อมเมื่อผ่าน การชาร์ตไปนานแค่ไหน ถ้าแปลตรงๆตัวคำว่า cycle ก็คือรอบ คำว่ารอบไม่ได้เท่ากับคำว่าครั้ง ดังนั้นการชาร์ต 1 ครั้งจึงไม่เท่ากับ 1 cycle ซะทีเดียว

จำนวน 1 Cycle จะวัดจากปริมาณการชาร์ตไฟที่รวมๆแล้ว เท่ากับปริมาณการชาร์ตไฟจากแบตเตอรี่ที่ไม่มีไฟ(0%) จนแบตเตอรี่มีไฟเต็ม(100%) 1 ครั้ง

เช่น ถ้าเราชาร์ตครั้งแรกจากแบตเตอรี่ 50%=>100% การชาร์ตครั้งนี้ก็จะนับเท่ากับ 0.5 cycle
(เก็ทบ่คับ??)
3. ชาร์ตอย่างไรถึงจะดี

หลาย คนคงเคยได้ยินว่าต้องชาร์ตแบตเตอรี่ครั้งแรกเท่านั้นเท่านี้ชั่วโมงแล้วจึง
จะเริ่มใช้งานได้ หรือว่าต้องหมั่นชาร์ตบ่อยๆ หรือไม่ก็ใช้ให้ไฟหมดก่อนแล้วค่อยชาร์ต
ซึ่งข้อความทั้งหมดนี้ก็มีข้อจริงและเท็จปนๆกัน
อันที่จริงแล้วสำหรับแบตเตอรี่แบบ lithium (ย้ำว่าแบบ lithium เท่านั้น)
จะชาร์ตอย่างไรก็ได้ไม่มีผลต่ออายุการใช้งานครับ

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

การที่แบตเตอรี่แบบ lithium จะเสื่อมจากการใช้งานนั้นมีอยู่ด้วยกัน 4 เงื่อนไข คือ

- เมื่อใช้งานจนถึงจำนวน Cycle ที่แบตเตอรี่จะเริ่มเสื่อมเองตามปกติ
- เมื่อถึงเวลาที่แบตเตอรี่จะเสื่อมมันก็จะเรี่มเสื่อมเอง โดยเวลาที่ว่าเป็นเวลาที่นับตั้งแต่การผลิต ไม่ใช่เวลาในการใช้งาน
- การชาร์ตไฟของตัวชาร์ต (ดังที่กล่าวไปแล้วในข้อ 1)
- อุณหภูมิของแบตเตอรี่ ถ้าแบตเตอรี่อยู่ในสภาพแวดล้อมที่อุณหภูมิสูงก็จะส่งผลให้แบตเตอรี่เสื่อมเร็วกว่าปกติได้

4. ได้ยินว่าชาร์ตไฟ 40% แบตจะอยู่ได้นานกว่าจรึงรึเปล่า??
สำหรับแบตเตอรี่แบบ lithium ถ้าชาร์ตไฟที่ 40% แล้วเก็บเอาไว้
โดยไม่ใช้งานเป็นระยะเวลา 1 ปีขึ้นไป ตัวแบตจะเสื่อมน้อยกว่าการชาร์ตไฟที่
100% แล้วเก็บไว้นาน 1 ปีขึ้นไป
แต่สำหรับแบตเตอรี่ที่ไม่ได้เก็บไว้นานเกิน 1 ปี
หรือแบตเตอรี่ที่ใช้งานตามปกติ(ไม่ได้เก็บเข้ากรุ) อัตราการเสื่อมของแบตเตอรี่
ไม่ว่าจะมีไฟที่ 40% หรือ 100% นั้นแทบจะไม่ต่างกัน

สรุปว่าข้อความข้างต้นเป็นจริงเฉพาะแบตเตอรี่ lithium ที่เก็บไว้นานๆโดยไม่ใช้งานครับ
5. แล้วเวลาใช้งาน Notebook เมื่อเสียบปลั๊กแล้วควรจะถอดแบตหรือไม่
คำตอบนี้ตอบได้ทั้งควร และไม่ควรครับ ขึ้นอยู่กับผู้ใช้งานจะเลือกแบบไหน

1. เสียบปลั๊กแล้วแต่ไม่ถอดแบตฯ
ข้อดี
- หากระบบไฟฟ้ามีปัญหา ก็จะไม่ส่งผลต่อการทำงาน และงานที่ทำในเครื่อง Notebook เปรียบเหมือนกับเครื่องคอมพิวเตอร์ที่ใช้ USP อยู่
- ขัวแบตเตอรี่จะไม่เกิดปัญหา ฝุ่นผงหรือความชื้นไปเกาะ
- มีความสะดวก สบายในการใช้งาน ไม่ต้องถอดๆใส่ๆ

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

2. เสียบปลั๊กแล้วถอดแบตฯ
ข้อด
- แบตเตอรี่จะปลอดภัยต่อความร้อนที่มาจากตัวเครื่อง notebook
ข้อเสีย
- ขั้วแบตเตอรี่อาจเกิดฝุ่นผงหรือมีความขึ้นไปเกาะทำให้เกิดคราบออกไซด์ อาจส่งผลให้เกิดอาการเสียบแบตเตอรี่แล้วไฟไม่เข้าเครื่องได้
- หากระบบไฟมีปัญหา เครื่อง notebook จะดับ ทำให้งานในเครื่องเสียหาย และอาจทำให้อุปกรณ์ฮาร์ดแวร์ในเครื่องเสียหายได้

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

1. พยายามหลีกเลี่ยงการใช้แบตเตอรี่จดหมดแล้วค่อยชาร์ดครับ
เพื่อป้องกันไม่ให้เกิด discharge rate ในอัตราที่สูง (ใช้ไฟเยอะในเวลาอันสั้น)
ซึ่งจะทำให้แบตเตอรี่เสื่อมเร็ว เช่น กรณีที่ต้องการใช้งานเครื่องหนักๆ(กินแบตฯเยอะๆ)
ก็ควรใช้แค่ช่วงเวลาไม่นาน และไม่ควรใช้จนแบตหมดครับ
ถ้าเลี่ยงไม่ได้จริงๆให้หาโอกาสชาร์ตไฟเป็นระยะๆ
จะช่วยป้องกันไม่ให้เกิด discharge rate ในอัตราที่สูงได้
และที่สำคัญที่สุดคือการชาร์ตบ่อยๆ จะช่วยป้องกันการลืมชาร์ตไฟ
ซึ่งถ้าหากปล่อยให้แบต lithium ไฟหมดเป็นเวลานานแบบจะเสีย
ไม่สามารถชาร์ตไฟได้อีก

2. ระลึกไว้เสมอว่าแบตฯแบบ lithium ความร้อนมีผลต่อการเสื่อมมากกว่า
รูปแบบการชาร์ตไฟครับ ดังนั้นพยายามดูแลอย่าให้แบตฯร้อน
จะได้ผลดีกว่ามัวกังวลเรื่องชาร์ดบ่อย ชาร์ตมาก ชาร์ตน้อย

3. เก็บแบตเตอรี่ไว้ในที่เย็นๆ ถ้าจำเป็นจะต้องเก็บ Notebook
ไว้ในรถที่จอดตากแดด ก็ควรถอดแบตเตอรี่แยกติดตัวออกมาครับ
จะช่วยให้แบตฯเสื่อมช้าลง

4. ถ้าจำเป็นจะต้องเป็บแบตไว้เป็นเวลานาน โดยไม่ได้ใช้งาน
ให้ชาร์ตไฟไว้ที่ประมาณ 40% ของความจุ
แล้วเก็บไว้ในที่เย็นๆ จะช่วยยืดอายุการใช้งานได้

5. ไม่ควรซื้อแบตเตอร์แบบ lithium มาเก็บไว้เผื่อใช้งานครับ
เพราะแบตแบบ lithium มีอายุการเสื่อมสภาพนับจากวันผลิต(ไม่ใช่วันที่ใช้นะครับ)
ดังนั้นถ้าเก็บไว้นานโดยไม่ใช่มันก็จะเสื่อมไปเองได้ครับ และเช่นเดียวกันกับ
การเลือกซื้อแบตแบบ lithium ไม่ควรซื้อแบตฯแบบเก่าเก็บครับ
เพราะซื้อมาแล้วใช้ได้ไม่นานแบตฯมันจะเสื่อมตามอายุของมันเองครับ

จบแล้วครับสำหรับ 5 คำถามกับคำตอบที่ถูกต้อง และ 5 คำแนะนำในการใช้แบตเตอรี่แบบ lithium ยังไงอ่านบทความชิ้นนี้แล้วช่วยบอกต่อๆ กันไปด้วยนะครับ เพราะปัจจุบันนี้มีคนเข้าใจผิดกันเยอะ และมีบทความที่เขียนกันผิดๆ แปลมาผิดๆกันเยอะครับ ส่วนเว็บท้ายบทความนี้ใช้อ้างอิงและหาข้อมูลเพิ่มเติมได้สำหรับผู้ที่ต้อง การนะครับ
ยาวหน่อยนะครับผม ต้องขอบคุณท่านเจ้าของบทความครับ (ผมไปค้นหาข้อมูลมาอีกที)
ขอบคุณบทความและภาพจาก http://technology.impaqmsn.com/techhow_list.asp


คัดลอกมาจาก

เพิ่มเติม

Monday, September 7, 2009

Using report parameters in local mode

What are report parameters used for?

The most common use of report parameters is to specify a criterion for subsetting data. The value of the parameter may be set programmatically by the host application, or one report may pass a parameter to another report.

When you drillthrough from one report to another, the main report passes the id of the item the user clicked on to the drillthrough report as a report parameter. The drillthrough report then uses the parameter value to only display data corresponding to the item the user clicked on.

When a master-detail report is implemented using subreports, the main report passes the id of the master item to the subreport as a report parameter. The subreport uses the parameter value to only display detail rows corresponding to the specified master item.

Subsetting data can be done in two ways: (a) The host application can examine the value of the parameter being passed to a subreport or drillthrough report (in the corresponding event handlers) and only supply the subset of data corresponding to the parameter value to ReportViewer. Or (b) the host application can supply the entire data to ReportViewer, and in the RDL file specify a filter that only lets in values that match the parameter value (see screenshot).

Report parameters can be used for other purposes too. In the example below a report parameter is used to control the visiblity of a textbox.

Defining a report parameter

To add a parameter to a report, from the menu choose Report > Report Parameters command. Press Add to add a parameter.

The value of a parameter can be used in expressions as Parameters!Foo.Value where Foo is the name of the parameter.

Parameter Prompting

When operating in remote mode ReportViewer automatically prompts the user for parameter values unless told not to do so.

When operating in local processing mode, ReportViewer does not prompt for parameter values. The rationale is as follows: The most common use of report parameters is to pass to queries as values of query parameters. But unlike the Report Server, the ReportViewer control does not execute queries itself. Rather, queries are executed by the host application, and the result is passed to the ReportViewer control. So the ReportViewer control does not have the opportunity to set query parameters.

In local mode the host application must handle parameter prompting, as seen in the example below.

Example

In the example below, the application (an RSS Browser) has a textbox for specifying news items of interest, and a checkbox for turning descriptions on or off. Note that this textbox, checkbox, the url dropdown and the load button are all implemented by the host application. UI features of the ReportViewer control such as toolbar have been turned off in this application.

The ability to turn descriptions on or off, and the ability to filter news items are implemented using report parameters.

In the RDL the visibility of the description textbox is controlled using a boolean report parameter, like this:

        

=not(Parameters!ShowDescriptions.Value)

....
....

The host application then sets the value of the ShowDescriptions parameter based on the value of the checkbox, like this:
        private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
ReportParameter p = new
ReportParameter("ShowDescriptions", checkBox1.Checked ? "true" : "false");
this.reportViewer1.LocalReport.SetParameters(new ReportParameter[] { p });
this.reportViewer1.RefreshReport();
}

Note
  • ใช้ได้ทั้ง local และ server report

Reference

SQL to Select a random row from a database table

There are lots of ways to select a random record or row from a database table. Here are some example SQL statements that don't require additional application logic, but each database server requires different SQL syntax.

Select a random row with MySQL:

SELECT column FROM table
ORDER BY RAND()
LIMIT 1

Select a random row with PostgreSQL:

SELECT column FROM table
ORDER BY RANDOM()
LIMIT 1

Select a random row with Microsoft SQL Server:

SELECT TOP 1 column FROM table
ORDER BY NEWID()

Select a random row with IBM DB2

SELECT column, RAND() as IDX
FROM table
ORDER BY IDX FETCH FIRST 1 ROWS ONLY

Thanks Tim

Select a random record with Oracle:

SELECT column FROM
( SELECT column FROM table
ORDER BY dbms_random.value )
WHERE rownum = 1

Thanks Mark Murphy

Feel free to post other example, variations, and SQL statements for other database servers in the comments.


Reference

Friday, September 4, 2009

คำว่า "Engine" ในทางคอมพิวเตอร์

  • อ่านบทควาทที่ www.blognone.com แล้วได้ความรู้ update สมองเยอะเลยครับ
  • เรื่องนี้เค้า ถาม - ตอบ กันเกี่ยวกับ Engine ในทางคอมพิวเตอร์
  • ชอบคำตอบของคุณ heart มากเลยอ่านแล้วเข้าใจง่ายไม่ต้องตีความอาไรมาก


คำว่า "Engine" ในทางคอมพิวเตอร์ มันคืออะไร? หมายความว่าอะไร?คะ ไม่ทราบจริงๆช่วยมาตอบหน่อยนะคะ

tags:

คำว่า "Engine" ในทางคอมพิวเตอร์ มันคืออะไร? หมายความว่าอะไร?กันแน่คะ และ ในการเขียน โปรแกรมภาษาคำว่า "Engine" มันคืออะไร หมายความว่าอะไร? คะ ช่วยอธิบายให้กระจ่างหน่อยนะคะ ไม่ทราบจริงๆ ค่ะ ไปถามคนอื่นก็ไม่ได้คำตอบที่กระจ่าง

(ไม่รู้ว่าตั้งกระทู้ถูกหมวดหรือเปล่า ถ้าไม่ใช่ก็ขออภัยด้วยนะคะ เพิ่งสมัครเข้ามาอ่ะค่ะ) ***พอดีไปอ่าน Code ของคนๆนึง ที่เขียน app ด้วย java มาอ่ะค่ะ ไม่เข้าใจจริงๆ



Submitted by heart on 31 August, 2009 - 11:20. (#121965)

Engine คือเครื่องยนต์

เครื่องยนต์ ก็จะประกอบไปด้วยส่วนเล็กๆน้อยๆ เช่นฟันเฟืองต่างๆ ระบบเล็กๆน้อยๆ หลายๆระบบรวมกัน โดยจะผลิตในบริษัทเดียว หรือนำเข้าชิ้นส่วนจากต่างประเทศก็ได้

เครื่องยนต์ก็จะมีความสามารถ และมีวิธีการทำงานของมัน

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

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

Engine เอง จะยังไม่สามารถใช้งานได้ เหมือนเครื่องยนต์ ที่ตั้งเอาไว้ก็เป็นเศษเหล็ก

เราต้องนำมันมาใช้งาน สาเหตุที่ต้องทำ Engine หรือเครื่องยนต์แยกไว้ เพราะว่า เราจะสามารถนำมันมาใช้งานได้หลากหลาย

ยกตัวอย่างเช่น Engine ของคูโบต้า สามารถนำมันมาเป็นรถอีแต๋นก็ได้ นำมาประกอบส่วนอื่นๆและใช้ไถนาก็ได้

หรือนำสายยางมาต่อ ทำเป็นเครื่องสูบน้ำเข้านา ก็ยังได้


Framework แปลตรงตัวคือ กรอบการทำงาน

Framework คือการที่เราตั้งกฏ ขึ้นมา ให้ทำงานได้เร็วขึ้น โดยไม่ต้องทำความเข้าใจเหตุผล (แต่ถ้าอยากเก่ง ก็ต้องทำความเข้าใจ)

เช่น การประกอบรถยนต์ เรารู้แค่ว่า เอาล้อ มาต่อตรงนี้ ตัวถังต่อตรงนี้ เครื่องยนต์ ต่อในห้องเครื่อง (เครื่องยนต์ก็คือ Engine ที่อธิบายไป)

เมื่อต่อครบ จะได้รถวิ่งได้ จะเห็นได้ว่า เราทำความเข้าใจกับเหตุผลน้อยมาก แค่ทำตามกฏ ก็จะได้รถออกมา

เปรียบเทียบกับ Framework ในทางการเขียนโปรแกรม ยกตัวอย่าง CakePHP เป็น Framework ในการเขียนเว็ปไซท์

เราแค่ ตั้งค่า ดาต้าเบส นำส่วนต่างๆไปวางไว้ที่โฟลเดอร์ที่กำหนดไว้ ตั้งชื่อไฟล์ตามกฏ โดยเราแทบจะไม่ต้องรู้เลยว่า แล้วทำไมต้องบังคับกรูตั้งชื่อไฟล์ด้วยวะ

แต่สุดท้าย เมื่อทำตามกฏที่ว่า จะได้เว็ปไซท์ออกมา ในเวลาที่รวดเร็ว




Submitted by mr_tawan on 26 August, 2009 - 20:10. (#121164)

Framework เหมือนเป็นการจำกัดกรอบคร่าว ๆ ของ Application ให้เราพัฒนาต่อยอดขึ้นไปครับ

นึกถึงตอนเอาโครงลวดมาพอกด้วยดินน้ำมัน ไอ้ตัวหุ่นที่ปั้นขึ้นมาจะถูกบังคับโดยโครงให้มีลักษณะประมาณนึง แต่ว่าวิธีการพอกดินน้ำมันให้มันเป็นหุ่นจะทำให้หุ่นแต่ละตัวดูแตกต่างกัน ครับ

Engine เหมือนเป็น Blackbox อันนึงที่ พอเราโยน Input เข้าไป (พร้อม Logic บางส่วน) มันจะสร้าง Output ออกมา อย่างเช่น ถ้าเราเขียนเกม ถ้าเราโยนกราฟิค พร้อมกับกำหนดกฎหลัก ๆ บางส่วนของเกมลงไปใน Engine มันก็จะสร้างเกมออกมาให้เราเล่นได้ (ซึ่งต่างกับการเขียนเกมด้วยการเขียนโปรแกรมที่ต้องเขียนมันหมดทุกอย่าง ทั้งวิธีการแสดงผล วิธีการรับอินพุต ฯลฯ)

จะมองว่า Engine เป็น Application ที่เกือบจะเสร็จแล้ว ขาดแต่ Content บางอย่างที่จะทำให้ทำให้ Application ออกมาแตกต่างกัน

... อ่าน ๆ ไปแล้วก็งง ๆ อันที่จริง ๆ ผมว่ามันก็ก้ำกึ่ง ๆ กันนะ ... ผมว่ามันแตกต่างกันที่ความสมบูรณ์ของ Lib มากกว่า

Framework เหมือนจะเป็นแค่โครงที่กำหนดวิธีการคร่าว ๆ เรายังต้องสร้างอะไรเข้าไปต่อเติมอีกเยอะกว่าจะออกมาเป็นโปรแกรมได้ ในขณะที่ Engine เนี่ย มันเหมือนเกือบจะเสร็จแล้ว แค่หาอะไรใส่เข้าไปอีกหน่อยก็สมบูรณ์เป็นโปรแกรมละ

ทั้งนี้ทั้งนั้น นิยามตรงนี้มันก็จะต่างกันไปในแต่ละคน (คำว่า Framework มีนิยามค่อนข้างตายตัว แต่ Engine เนี่ยจะหลากหลายกันไปหน่อย) ดังนั้นก็คงมีคนที่เห็นไม่ตรงกับผมครับ (อย่างข้างบนนี้ก็มีคนนึงล่ะ)


  • เป็นบทควาทที่ดีมากๆ เลย
  • คนเขียนเค้าเขียนได้ละเอียดมากๆ ครับ
  • แค่เก็บบันทึกไว้ update สมองตัวเองแค่นั้น
From http://ardchoille42.blogspot.com/2009/08/linux-file-permissions.html

By Nana Langstedt

Permissions and ownership - why?
If you can't access some of the files on your very own Linux system, it's usually because of misconfigured file access permissions. If you are the only user on your Linux box, you may be wondering what's the point of having all these permissions (or lack thereof) that restrict your access to your very own penguin OS. However, before pulling your hair off, you must keep in mind Linux is designed to be a multi-user environment. In an environment with more than one user, it is crucial to have a secure system for deciding which files are yours and who can fiddle with them.

Even if you're the only user on an ordinary desktop system, file permissions help keep your important files safe, both from outsiders and your own mistakes.

Understanding file ownership
Every file on your Linux system, including directories, is owned by a specific user and group. Therefore, file permissions are defined separately for users, groups, and others.

User: The username of the person who owns the file. By default, the user who creates the file will become its owner.

Group: The usergroup that owns the file. All users who belong into the group that owns the file will have the same access permissions to the file. This is useful if, for example, you have a project that requires a bunch of different users to be able to access certain files, while others can't. In that case, you'll add all the users into the same group, make sure the required files are owned by that group, and set the file's group permissions accordingly.

Other: A user who isn't the owner of the file and doesn't belong in the same group the file does. In other words, if you set a permission for the "other" category, it will affect everyone else by default. For this reason, people often talk about setting the "world" permission bit when they mean setting the permissions for "other."

Understanding file permissions
There are three types of access permissions on Linux: read, write, and execute. These permissions are defined separately for the file's owner, group and all other users.

Read permission. On a regular file, the read permission bit means the file can be opened and read. On a directory, the read permission means you can list the contents of the directory.

Write permission. On a regular file, this means you can modify the file, aka write new data to the file. In the case of a directory, the write permission means you can add, remove, and rename files in the directory. This means that if a file has the write permission bit, you are allowed to modify the file's contents, but you're allowed to rename or delete the file only if the permissions of the file's directory allow you to do so.

Execute permission. In the case of a regular file, this means you can execute the file as a program or a shell script. On a directory, the execute permission (also called the "search bit") allows you to access files in the directory and enter it, with the cd command, for example. However, note that although the execute bit lets you enter the directory, you're not allowed to list its contents, unless you also have the read permissions to that directory.

How to view file permissions
You can view the access permissions of a file by doing the long directory listing with the ls -l command. This is what a long directory listing might look like:

me@puter: /home/writers$ ls -l
total 17
drwxr-xr-x 3 nana writers 80 2005-09-20 21:37 dir
-rw-r----- 1 nana writers 8187 2005-09-19 13:35 file
-rwxr-xr-x 1 nana writers 10348 2005-07-17 20:31 otherfile

What does the output of ls -l mean? The very first column, the one that looks like a bunch of mumbo jumbo, shows the file type and permissions. The second column shows the number of links (directory entries that refer to the file), the third one shows the owner of the file, and the fourth one shows the group the file belongs to. The other columns show the file's size in bytes, date and time of last modification, and the filename.

The first column, the one that shows the file's permissions and looks like mumbo jumbo, is organized into four separate groups, although it certainly doesn't look very organized.

The first group consists of only one character, and it shows the file's type. For example, d means a directory and - means a normal file, so if you take a look at our example output, you'll notice dir is a directory, while file and otherfile are regular files.

The first character can be any of these:
  • d = directory
  • - = regular file
  • l = symbolic link
  • s = Unix domain socket
  • p = named pipe
  • c = character device file
  • b = block device file
The next nine characters show the file's permissions, divided into three groups, each consisting of three characters. The first group of three characters shows the read, write, and execute permissions for user, the owner of the file. The next group shows the read, write, and execute permissions for the group of the file. Similarly, the last group of three characters shows the permissions for other, everyone else. In each group, the first character means the read permission, the second one write permission, and the third one execute permission.

The characters are pretty easy to remember.
  • r = read permission
  • w = write permission
  • x = execute permission
  • - = no permission
What does this mean in practice? Let's have an example. Remember the imaginary directory listing we did at the beginning? The output looked like this:

drwxr-xr-x 3 nana writers 80 2005-09-20 21:37 dir
-rw-r----- 1 nana writers 8187 2005-09-19 13:35 file
-rwxr-xr-x 1 nana writers 10348 2005-07-17 20:31 otherfile

As we already noticed, dir is a directory, because the first column begins with a d. The owner of this directory is user nana and the group owner is writers. The first three characters, rwx, indicate the directory's owner, nana in this case, has full access to the directory. The user nana is able to access, view, and modify the files in that directory. The next three characters, r-x, indicate that all users belonging to group writers have read and execute permissions to the directory. They can change into the directory, execute files, and view its contents. However, because they don't have write permissions, they can't make any changes to the directory content. Finally, the last three characters, r-x, indicate that all the users who are not nana or don't belong into group writers, have read and execute permissions in the directory.

How about file? Because the first column begins with a -, the file is a regular file, owned by user nana and group writers, just like the directory in our example. The first three characters, rw-, indicate the owner has read and write access to the file. According to the next three characters, r--, the users belonging to group writers can view the file but not modify or execute it. The final three characters, ---, indicate no one else has any access to the file.

Similarly, you can see otherfile is a regular file and its owner has full access to it, while everyone else can read and execute the file but not modify it.

How to set file permissions - symbolic mode
You can set file permissions with the chmod command. Both the root user and the file's owner can set file permissions. chmod has two modes, symbolic and numeric.

The symbolic mode is pretty easy to remember. First, you decide if you set permissions for the user (u), the group (g), others (o), or all of the three (a). Then, you either add a permission (+), remove it (-), or wipe out the previous permissions and add a new one (=). Next, you decide if you set the read permission (r), write permission (w), or execute permission (x). Last, you'll tell chmod which file's permissions you want to change.

Let's have a couple of examples. Suppose we have a regular file called testfile, and the file has full access permissions for all the groups (long directory listing would show -rwxrwxrwx as the file's permissions).

Wipe out all the permissions but add read permission for everybody:
$ chmod a=r testfile
After the command, the file's permissions would be -r--r--r--

Add execute permissions for group:
$ chmod g+x testfile
Now, the file's permissions would be -r--r-xr--

Add both write and execute permissions for the file's owner. Note how you can set more than one permission at the same time:
$ chmod u+wx testfile
After this, the file permissions will be -rwxr-xr--

Remove the execute permission from both the file's owner and group. Note, again, how you can set them both at once:
$ chmod ug-x testfile
Now, the permissions are -rw-r--r--

As a summary, have a look at this quick reference for setting file permissions in symbolic mode:
  • Which user?
  • u means user/owner
  • g means group
  • o means other
  • a means all
  • What to do?
  • + means add this permission
  • - means remove this permission
  • = means set exactly this permission
  • Which permissions?
  • r means read
  • w means write
  • x means execute
How to set file permissions - numeric mode
The other mode in which chmod can be used is the numeric mode. In the numeric mode, the file permissions aren't represented by characters. Instead, they are represented by a three-digit octal number.
  • 4 means read (r)
  • 2 means write (w)
  • 1 means execute (x)
  • 0 means no permission (-)
To get the permission bits you want, you add up the numbers accordingly. For example, the rwx permissions would be 4+2+1=7, rx would be 4+1=5, and rw would be 4+2=6. Because you set separate permissions for the owner, group, and others, you'll need a three-digit number representing the permissions of all these groups.

Let's have an example:
$ chmod 755 testfile
This would change the testfile's permissions to -rwxr-xr-x. The owner would have full read, write, and execute permissions (7=4+2+1), the group would have read and execute permissions (5=4+1), and the world would have the read and execute permissions as well.

Let's have another example:
$ chmod 640 testfile
In this case, testfile's permissions would be -rw-r-----. The owner would have read and write permissions (6=4+2), the group would have read permissions only (4), and the others wouldn't have any access permissions (0).

The numeric mode may not be as straightforward as the symbolic mode, but with the numeric mode, you can more quickly and efficiently set the file permissions. This quick reference for setting file permissions in numeric mode might help:
  • Which number?
  • 0 means --- or no permissions
  • 1 means --x or execute permission
  • 2 means -w- or write permission
  • 3 means -wx or write and execute permission
  • 4 means r-- or read permission
  • 5 means r-x or read and execute permission
  • 6 means rw- or read and write permission
  • 7 means rwx or read, write and execute permission


File Permissions And Directories by Ian MacGregor

Recursive chmod
One very important item needs to be addressed when working with file permissions. I've seen it many times. A new Linux user will download a theme and find all graphic files have the execute bit set. In an attempt to remove them the user will use a recursive chmod command, find that access is now denied to the affected directories and wonder what happened.

When using chmod recursively to change permissions care must be taken to avoid removing the execute bit on directories because doing so will lock all users out of the affected directories.


Here is an example:
[testdir @ 13:50:42]$ ls
[testdir @ 13:50:44]$ mkdir -p test1/subtest1 test1/subtest2
[testdir @ 13:51:48]$ ls
test1
[testdir @ 13:52:16]$ ls -la test1
total 16
drwxr-xr-x 4 testuser testuser 4096 2009-08-25 13:51 .
drwxr-xr-x 4 testuser testuser 4096 2009-08-25 13:51 ..
drwxr-xr-x 2 testuser testuser 4096 2009-08-25 13:51 subtest1
drwxr-xr-x 2 testuser testuser 4096 2009-08-25 13:51 subtest2
[testdir @ 13:52:24]$ chmod -R a-x test1
chmod: cannot access `test1/subtest1': Permission denied
chmod: cannot access `test1/subtest2': Permission denied
[testdir @ 13:52:35]$ ls -la test1
ls: cannot access test1/subtest1: Permission denied
ls: cannot access test1/subtest2: Permission denied
ls: cannot access test1/..: Permission denied
ls: cannot access test1/.: Permission denied
total 0
d????????? ? ? ? ? ? .
d????????? ? ? ? ? ? ..
d????????? ? ? ? ? ? subtest1
d????????? ? ? ? ? ? subtest2
[testdir @ 13:52:49]$ cd test1
bash: cd: test1: Permission denied
[testdir @ 13:53:23]$ chmod -R a+x test1
[testdir @ 13:53:33]$ ls -la test1
total 16
drwxr-xr-x 4 testuser testuser 4096 2009-08-25 13:51 .
drwxr-xr-x 4 testuser testuser 4096 2009-08-25 13:51 ..
drwxr-xr-x 2 testuser testuser 4096 2009-08-25 13:51 subtest1
drwxr-xr-x 2 testuser testuser 4096 2009-08-25 13:51 subtest2
[testdir @ 13:53:39]$


A better method of recursively removing the execute bit from files is to pipe the find command to the xargs comand like this:

find . -type f | xargs chmod a-x

The "f" in the above command tells find to look for files of type "f", or "regular file". A "d" would be used to look for directories so using an "f" in the command above will avoid changing permissions of directories. For more information about the find command, please see man find.

Here is a demonstration:
[testdir @ 14:36:58]$ mkdir -p testdir1/subdir1 testdir1/subdir2
[testdir @ 14:37:39]$ touch testdir1/subdir1/newfile1 testdir1/subdir1/newfile2
[testdir @ 14:39:00]$ chmod -R a+x testdir1/
[testdir @ 14:39:12]$ ls -la testdir1/subdir1
total 8
drwxr-xr-x 2 testuser testuser 4096 2009-08-25 14:39 .
drwxr-xr-x 4 testuser testuser 4096 2009-08-25 14:37 ..
-rwxr-xr-x 1 testuser testuser 0 2009-08-25 14:39 newfile1
-rwxr-xr-x 1 testuser testuser 0 2009-08-25 14:39 newfile2
[testdir @ 14:39:28]$ find . -type f | xargs chmod a-x
[testdir @ 14:39:52]$ ls -la testdir1/subdir1
total 8
drwxr-xr-x 2 testuser testuser 4096 2009-08-25 14:39 .
drwxr-xr-x 4 testuser testuser 4096 2009-08-25 14:37 ..
-rw-r--r-- 1 testuser testuser 0 2009-08-25 14:39 newfile1
-rw-r--r-- 1 testuser testuser 0 2009-08-25 14:39 newfile2
[testdir @ 14:39:56]$ cd testdir1/subdir1
[subdir1 @ 14:40:12]$ pwd
/home/testuser/testdir/testdir1/subdir1
[subdir1 @ 14:40:15]$

Thursday, September 3, 2009

IIS with Directory Security on Windows Server 2003

  • ปกเมื่อเราทำการเพิ่ม web หรือ virtual host เข้าไปใน IIS web หรือ virtual นั้นจะมี Directory Security , Authentication Methods ซึ่งถ้าเรากำหนดให้ enable anonymous เราจะได้ user ที่แทน anonymous คือ IUSR_HOSTNAME และได้ password ของ user โดยอัติโนมัติอยู่แล้ว ก็คือจะสืบทอดค่าคอนฟิกต่างๆตาม parent Site ว่างั้นก็ได้
  • ปัญหายอย่างหนึ่งที่พบเมื่อสองวันก่อนคือ มีคนไปเปลี่ยน user ของ web ไปใช้ windows user อื่นๆ ซึ่งไม่ใช่ IUSR_HOSTNAME ซะงั้นเปลี่ยนทำไมฟะ อยากรู้จริงๆ หรือ เค้าคนนั้นไปลยพาสเวิร์ด IUSR_HOSTNAME แล้วไม่รู้ว่าพาสคืออาไรเลยต้องเปลี่ยนใช้ user ใหม่ที่เค้ารู้พาส หรือป่าวหว่า เพราะ ถ้าเราไปลบพาสของ IUSR_HOSTNAME ใน Directory Security ออก จะทำให้เวลามีคนมาเข้าเว็บเรา จะขึ้น User และ Password ให้เค้าคนนั้นต้องกรอก ถ้า user และ password ของ anonymous ที่ตั้งไว้ที่ Directory Security ไม่ถูกต้อง
  • การแก้ปํญหา แค่ลบ web site นั้นออกแล้วทำการสร้างใหม่ แล้วทำการสร้าง site นั้นใหม่ ซึ่ง site ที่เราสร้างใหม่ anonymous จะใช้ IUSR_HOSTNAME อัติโนมัติตาม parent site (ถ้า parent site ใช้ IUSR_HOSTNAME สำหรับ anonymous นะ)
  • แต่ที่แย่กว่านั้นคือ parent โดยเปลี่ยน user และ password ที่ Directory Security ซะงั้น มึนจริงๆ เค้าคนนั้น ทำให้เวลาสร้าง site ใหม่ภายใต้ parent นั้นเราก็จะไม่ได้ IUSR_HOSTNAME แต่จะได้ user ที่ parent ใช้อยู่โดยอัติโนมัติ กรณีนี้ก็ซวยไป สงสัยถ้ากรณีนี้คงต้อง ถอนและ ลง IIS ใหม่
  • แต่คิดว่าเราน่าจะไปเปลี่ยนรหัสผ่านของ IUSR_HOSTNAME เองได้โดยผ่าน Manage => Local Users and Groups น่าจะได้นะ หลังจากแก้แล้ว เราก็ไปเปลี่ยน รหัสผ่านให้กับ site ที่ใช้ IUSR_HOSTNAME ซะนะ คิดว่า ถ้าเราไม่ไปเปลี่ยน เว็บไซต์จะต้อง มีป๊อปอัพขึ้นมาให้ authen แน่นอน หรือป่าวไม่แน่ใจ ^^' เพราะ เราเปลี่ยนรหัสของ IUSR แล้วนิ เว็บที่ใช้ IUSR จะเป็นรหัสเดิมอยู่ คิดว่านะ แค่คาดการณ์ และความน่าจะเป็น ของผู้เขียนเอง

ทดสอบ
  • สร้าง site จากนั้นลองเข้า site ก็เข้าไปปกติ พอลองเปลี่ยน พาสของ IUSR และทำการเข้าเว็บใหม่อีกรอบ ก็ยังเข้าได้อยู่
  • พอลองเปลี่ยน pass IUSR ที่ Directory Security เป็นพาส อื่นมั่ว จากนั้นเข้า site ก็เข้าไม่ได้
  • พอลองเปลี่ยนเป็นพาสใหม่ที่แก้ให้ IUSR และ เข้า site ก็เข้าได้

ทิป
  • ถ้าเราสร้าง site โดยให้เป็น private ต้อง logon ก่อน ให้เราเอาเครื่องหมายถูกหน้า Enable anonymous access ออกก่อน จากนั้นให้ทำเครื่องหมายถูกหน้า Intregated Windows Authentication
  • แค่แน่ก็โอเคแหละ เมื่อมีใครสักคนจะเข้า site นี้ก็จะมี ป๊อปอัพขึ้นมาให้กรอก username และ password ก็ให้ใส่ username และ password ของ windows นั่นแหละ
  • หรือ อาจเลือก option อื่นๆ ที่อยู่ด้านล่าง Intregated Windows Authentication ประกอบการตั้งค่าด้วยก็น่าจะดีไม่น้อย

สรุป
  • เราสามารถเปลี่ยน password ให้กับ IUSR_HOSTNAME ได้ทาง Manage => Local Users and Groups

Note
  • เห็นว่า IUSR_HOSTNAME windows เค้าจะทำการสุ่มพาสให้เองนะ
  • แล้วเราจะเปลี่ยน password ของ IUSR_HOSTNAME ได้ปะเนี๋ย
  • ก่อนการลบ และ สร้าง site ใหม่เราควรบันทึกค่าต่างๆ ที่ site นั้นมีอยู่เช่น default document , permission, path web เป็นต้น

Popular Posts