Wednesday, March 18, 2009

"The security log on this system is full" message when you try to log on to a computer that is running Windows XP or Windows Server 2003

ปัญหา: เกิดขึ้นเมื่อพยายาม log on เข้าสู่ window จะแสดงข้อความ

The security log on this system is full. Only administrators can log on to fix the problem

โดยสามารถเข้าได้เฉพาะ user ที่อยู่ใน Group Admin

สาเหตุ: เนื่องจาก window ไม่สามารถเขียน system log file ได้
ทางแก้ไข : เข้าด้วย user administrator group แล้วทำตามขั้นตอนดังนี้
  1. Click Start, point to All Programs, point to Administrative Tools, and then click Event Viewer.
  2. Right-click Security, and then click Properties.
  3. In the Log Size area of the Security Properties window, click the Overwrite events as needed option under When maximum log size is reached.
  4. Click OK.
  5. Close Event Viewer.

Tuesday, March 17, 2009

ความหมาย Dispose() ในภาษา Java

Free up and recycle any behind-the-scenes peer resources this component is using (e.g. inside the native GUI).

You most commonly use dispose in a windowClosing event handler for a JFrame or Frame.

Java can automatically garbage collect stranded objects created by Java, but it needs this help arranging to recycle resources inside the brain-damaged native GUI. This does not delete the current Container itself. E.g. dispose for a Panel would remove the panel from the screen, and would discard all the paraphernalia needed to put the panel on the screen, but all the panel fields would still be intact.

It is wise to arrange to dispose of any unneeded Graphics objects you obtained with getGraphics.

If you just hide frames rather than disposing of them, they can be made visible again more quickly. On the other hand, if you are truly finished with a frame, the associated GUI peer resources the invisible frame is holding onto won’t be recycled. Rule of thumb, use dispose, and only if you need to fine tune, sometimes use setVisible( false ) instead for free standing Frames, JFrames and Windows. use setVisible( false ) for everything else.

dispose cannot be counted on to do built-in setVisible( false ). Do your own setVisible( false ) first. I have not experimented, but I doubt that dispose removes children. When disposing Frames, you must disconnect any off-frame Listeners and any references to the Frame, if you want the Frame itself to be garbage collected.

Image.flush() should really be called Image.dispose().

Saturday, March 7, 2009

JSP ไม่รู้จัก EL

ในกรณีนี้สืบเนื่องมากจาก ผมได้ทำการแก้ไขเว็บเก่าโดยตอนทำเว็บแรกๆก็ใช้ Dream และเขียนแบบธรรมดา
ต่อมาเมื่อทำการเพิ่มเมนูเพื่อไปใช้กับเว็บอื่น ผมก็ได้ย้าย project นี้ไปไว้บน Netbean6.1 และส่วนที่เพิ่มมาก็
เขียนแบบ MVC (เฉพาะเมนูที่เพิ่มใหม่) และได้ทำการคัดลอกส่วนที่เพิ่มมานี้จากโปรเจ็คอื่น ก็เลยพบปัญหาดังนี้
ปัญหา : พบว่าหน้า jsp ไม่รู้จัก EL คือ ถ้าพิมพ์ ${1+1} อันที่จริงแล้วจะได้ 2 แสดงมาหน้าเว็บ แต่มันดันแสดง
${1+1} ออกมาซะนี่
สาเหตุ : ผมได้หาสาเหตุอยู่หลายวันทีเดียว เพราะว่าผมได้เพิ่ม lib jstl1.1 แล้วและหน้า jsp ก็ได้ใส่
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> ไปแล้วและคำสั่ง jstl ก็ทำงานได้ปรกติ เว้นก็แต่ EL เท่านั้นที่ไม่ทำงาน ก็เลยนึกได้ว่าอาจจะเป็นที่ web.xml ก็เป็นได้เลยที่ไม่ได้เปิดให้สนับสนุน EL
ทางแก้ไข : แต่ผมไม่ต้องการที่จะแก้ไขที่ web.xml เลยแก้ไขที่หน้าที่ต้องแสดง EL คือได้เพิ่มโค้ด
<%@ page isELIgnored='false'%> เพื่อให้ jsp ไม่ละเลย EL ก็ปรากฏว่า jsp รู้จัก EL ซะทีเฮ้อ(เหนื่อยมาหลายวัน)