Saturday, February 28, 2009

FreeBSD เมื่อ loader.conf มีปัญหา

วันนี้นั่งหาวิธีทำให้ FreeBSD บนโน้ตบุ๊คใช้ไวเลสได้ครับ มาถึงตอนนี้ก็ยังทำไม่ได้ ซ้ำร้ายทำไปทำมา FreeBSD บู๊ทไม่ขึ้นซะอีก

อาการ
ตอนที่ FreeBSD กำลังแสดงข้อความต่าง ๆ ของระบบอยู่ดีมันก็มาหยุดที่ ndis0 (เป็นโมดูลที่เกี่ยวกับเน็ตเวิร์กของ ndis ครับ) ผมสั่งให้มันโหลดขึ้นมาตอนบู๊ท มันก็แจ้งว่า failed แล้วก็ค้างอยู่ตรงนี้

สาเหตุ
เนื่องจากว่าผมไปแก้ไฟล์ loader.conf (/boot/loader.conf) ให้มันโหลดโมดูลไดรเวอร์ของการ์ดแลนผมขึ้นมา แต่ไม่รู้ว่ามันเกิดปัญหาอะไร มันถึงโหลดไม่สำเร็จ ก็เลยเป็นสาเหตุให้ค้างตอนบู๊ทครับ

วิธีแก้
ตอนบู๊ท FreeBSD ขึ้นมาแล้วมีออปชั่นให้เลือก ให้เลือกออปชั่นหมายเลข 6 ครับ (จำไม่ได้ว่ามันเขียนว่าอะไร) แล้วมันก็จะมี prompt ขึ้นมาว่า OK ให้เราป้อนค่าตามนี้ครับ (OK นั่นเป็น prompt นะครับ ไม่ต้องกรอกตาม)

OK unload
OK load kernel
OK snd_hda
OK boot

แล้วเราก็จะบู๊ทได้ โดยไม่อ่าน loader.conf ครับ

แต่เดี๋ยวก่อนครับ ผมยังเจออีกปัญหา ตอนบู๊ทขึ้นมาด้วยวิธีนี้ ปรากฏว่าผมไปแก้ไฟล์ /etc/rc.conf ด้วย และแก้ผิดไปครับ (มีเครื่องหมายคำพูดเกินมาตัว) ทำให้มันแจ้งเตือนว่าไฟล์ /etc/rc.conf ผิด จากนั้นมันให้กรอก path ของ shell ที่จะใช้งานครับหลังจากกรอกเสร็จมันก็เข้าสู่ระบบให้โดยอัตโนมัติ

แต่ผมพบว่ามันไม่ได้ mount file system ให้ซักตัวเลยครับ ผมต้องมา mount เอง ทั้ง /usr /var /tmp เพราะเนื่องจากว่ามันไม่ได้ mount /usr ให้ดังนั้นเราจะไม่เห็นคำสั่งหลาย ๆ คำสั่งครับ รวมถึง vi ด้วย ผมเลยต้อง mount /usr แต่ว่าการใช้ vi นั้นมันจะไปสร้างไฟล์ใน /tmp เลยจำเป็นต้อง mount /tmp ด้วย ส่วน /var นั่นก็ mount เผื่อ ๆ ไปครับ (ตอน mount ก็เรียกดูจากไฟล์ /etc/fstab)

หลังจากนั้นผมก็พยายามแก้ไฟล์ทั้งสองแต่ปรากฏว่าผมไม่สามารถบันทึกได้ครับ มันแจ้งเตือนว่า "Read-Only file system" หลังจากค้นดูก็พบวิธีแก้โดยใช้คำสั่ง

mount -u /

มันจะไปเปลี่ยนจาก Read-Only เป็น Read/Write ครับ ทีนี้เราก็จะสามารถแก้ไขไฟล์ที่เสียได้ตามที่ต้องการ

----

แถม
เนื่องจากตอนที่มันไม่ mount อะไรให้ซักอย่างผมเลยต้องมา mount เอง แต่ตอนค้นเรื่อง Read-Only ผมก็เจอคำสั่ง mount ทั้งหมดให้อัตโนมัติครับ

mount -a

มันจะ mount ตามไฟล์ /etc/fstab ให้อัตโนมัติครับ

Tuesday, February 24, 2009

โค้ดที่ทำให้ IE พัง

เมื่อวานไปค้นไฟล์ที่เก็บไว้ในคอมที่มหาลัยเจอโค้ด HTML ไฟล์นึงครับ จำได้ว่าเซฟมาจาก blognone เป็นโค้ดที่รันแล้วจะทำให้ Internet Explorer 6 พังครับ แบบว่าดับไปซะดื้อ ๆ เลย ก็เลยมาบล็อกเก็บไว้หน่อย โค้ดนั้นเป็นแบบนี้ครับ

<style>*{position:relative}<table><input></table>

สั้น ๆ แค่นี้แหละครับ

ลองกับไฟร์ฟอกซ์ได้ก็ไม่มีปัญหาครับ แล้วพอลองกับ IE 7 ก็ไม่ดับครับ แต่อาการแปลก ๆ (เหมือนมันค้าง ๆ ไงไม่รู้)

แปลกดี

Monday, February 23, 2009

เปลี่ยนภาษา

ช่วงนี้ขอเปลี่ยนภาษาหน่อยครับ ไม่งั้นเกรงว่าคงไม่ได้เขียนบล็อกนี้ไปอีกนานเลย
จะพยายามเขียนภาษาอังกฤษนะครับ ถ้ามีอารมณ์ ถ้าไม่มีอารมณ์ก็จะเขียนเป็นภาษาไทยนี่แหละ

Monday, January 5, 2009

Not roses. Not violets.

Exceptions are red.
Keywords are blue.
It compiles.
Because of you.

Sunday, April 27, 2008

Why I use twitter?

Becasue there is one period that twitter want the twitterers to send their reason about "Why I use twitter?" (I don't sure about real topic) so I sent one. And this is mine.
I saw @sugree use Twitter and he made slide show to introduce Twitter at @barcampbangkok (It's camp about technology and computer) so I interest in it.

At first, I tweet in private world(0 following and 0 follower) becasue I just only want something to heard my complain, happy story, sad story, my study, my life, etc... And I happy with it.

And then, there is someone followed me, @RainbowInTheSky, she is Italian girl. I wondered very much that there is someone followed me because I didn't tell anyone that I use Twitter. And then she and I become friend. We always talk together about each other life and cultural such as Thai history, Italian food and another.

But now, I follow more people. Almost are in science and IT industry in Thailand(someone calls them "geek") so I can know more about IT's news in Thailand and I think it's good that I can know people that work in this field(Maybe I can make connection with them, I hope)

I'm happy with Twitter, happy that can know what people do, what they think and another.

These are my reason tha I use Twitter.
And how about your reason?

Thursday, March 27, 2008

"Pung Lae Pung".

I can't translate it to English so I'll post on Thai language. from my senior, P'Tao.(the person that like c++ very much)

พังและพัง
แต่งโดย พี่เต๋า cp 31
ถ้าบอกว่าโปรแกรมนี้ เขียนเสร็จแล้ว เธอจะเชื่อไหม
GUI มันอาจไม่สวยงาม เหมือนโปรแกรมทั่วไป
อยากให้รู้ ว่าโปรแกรมบัก ถ้าไม่ noob ก็เขียนไม่ได้
แต่กับ C++ รู้ไหมฉันเขียนง่ายดาย

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

ให้มันเป็นภาษา ที่ควรเอาไปขึ้นเขียง
ที่จะมีเพียงคนเสียสติเท่านั้น
จะอยู่กับมันนานนาน

ดังในใจความบอกใน IE ว่าตราบใดที่ใช้ C++ ย่อมมีพัง
คือทุกครั้งที่จอฟ้าสดใส ฉันเห็นลางลาง

มีความจริงอยู่ใน code ตั้งมากมาย
และที่ผ่านมาฉันใช้เวลาเพื่อหาแทบตาย
แต่ไม่นานก็พึ่งรู้ ว่าทุกครั้งที่ pointer เข้ามาใกล้
ว่าถ้าnewแล้วไม่delete Memoryก็จะleakแล้วwindowsก็ใกล้จะไป

มีภาษาอื่นให้เราเลือกเขียน แต่ดันเขียน C++ ทำไมนั่น


PS. If you can get this song mean that you used to coding in c++.

Wednesday, March 26, 2008

my x comed back.

about my report last time, now i can fixed it. i copy x config file from live cd. i ran ubuntu live cd and copy file "xorg.conf" from /etc/X11 and replaced the old one. (for do that, you must have root authorized.)

after replaced it, the resolution was better and the position of screen come back at the middle of the monitor except log in screen. it's still shift left for a littel. but when i enabled desktop effect, it became normal everything. i don't know why. but now i have normal screen ubuntu.

and the last one problem that i found is i can't use thai on my keyboard. i will solve it soon. when i can solve it, i will report agian.