Posts

โอ้ feature ของ google search ยอดไปเลย

นั่งหาข่าว tsunami อยู่อยู่ๆก็เจอ feature ตอน search http://www.google.com/search?q=tsunami+warning&hl=en& tbs=rltm :1&tbo=u&ei=Z1uJS-OCNYq-rAfUz8iaCg&sa=X&oi=realtime_result_group_more_results_link&ct=title&resnum=8&ved=0CDcQ5QUwBw ไอ้ตัว bold ถ้าใส่ไปแล้วเป็น google.com ด้วย จะมี options ในการแสดงด้านซ้ายขึ้นมาชื่อว่า latest จะำทำให้แสดงผลการค้นหาเป็นแบบ realtime ฮ่าๆๆ ยอดไปเลยว่ามั้ย (หรือว่าเขารู้กันอยู่แล้วหว่า)

thai in debian

i try to put 'thai stuff' in debian first i 1.add line in /etc/apt/source.list 2." deb ftp://ftp.debianclub.org/debclub unstable main contrib non-free" second i apt-get install ttf-thai-tlwg third i #apt-get install xfonts-thai* #dpkg-reconfigure locales choose thai-> th_utf-8 and last resize font in config desktop theme

Python Script Rename

During serial collecting data from cyberglove , Some accident happens!!! timeout signal from cyberglove coming when chatting with phd candidate from tokai u. Have to change name of file follow order that continue from last time collecting. So import os for fname in os.listdir(os.getcwd()): if fname.endswith('.dat'): os.rename(oldname, newname) i google and get interested information smart author!!!:)

Build DLL Using Command line Visual C++ cl.exe

กำลังแกะ code ของ การ capture ท่ามือ อยู่ดีๆ เจอ struct timeb.h เลย งง หาไปหามา เจอ link สุดเท่ ก็เลยเอามาขึ้นหนะคับ cl -o myoutput.dll myfile1.cpp myfile2.cpp /I D:\required1\include /I D:\required2\include\win32 /link /DLL ref http://codediaries.blogspot.com/2009/07/build-dll-using-command-line-visual-c.html ได้อีกอันมาด้วย Simple Windows C++ DLL Example with Implicit and Explicit Calls

Cell Array Structure in Numpy

โอ้ว หลังจากpost ใน www.stackoverflow.com สักระยะ ระหว่างการเปลี่ยน code matlab ให้ เป็น python - numpy โดย มีปัญหาคือ cell array ใน matlab จะมาเป็น numpy structure ยังงัย ในที่สุดก็ได้คำตอบจากท่าน thrope ใน stackoverflow ได้แนะนำ linkไป http://docs.scipy.org/doc/scipy/reference/tutorial/io.html#matlab-cell-arrays และก็ได้บอกว่า ให้กำหนด dtype=numpy.object ตัวอย่างเช่น >>import numpy >>a = numpy.zeros((2,2),dtype=numpy.object) เท่านี้ เราจะสามารถเพิ่ม ค่าแบบใดๆ เข้าไปก็ได้เช่น >>a[0,0] = numpy.zeros((3,4)) >>a[0,1] = numpy.zeros((2,2)) ้hahahah มันยอดไปเลยไหมหละคับ

Warm Night with my girlfriend at my Labs

อืม ท่าทางเกือบจะเช้าัวันศุกรแลว้สินะ ขณะที่ผมกำลังเขียนบทความนี้ บนตักของกระผมก็มีผู้หญิงที่แสนน่ารัก(แฟนผมเอง หึหึหึ)เอาหัววางพิงอยู่ ว่าแล้วเธอก็หลับไปแล้วซะด้วย ช่วงเวลานี้ เป็นช่วงเวลาที่ดีอย่างหนักเลยหนะเนี่ย และระหว่างนี้ ผมก็ได้ convert matlab code ไปเป็น python ด้วยความร่วมมือของ numpy กับ stackoverflow และการโหลดไฟลจาก matlab ที่เซฟในรูปแบบของ value1,value2\n value1,value2\n ก็สามารถโหลดเข้ามาใน python โดย f = numpy.loadtxt('c:\\data001.txt',dtype='float',delimiter=',') กลายมาเป็น numpy.ndarray type ได้อย่างง่ายดาย ฮ่าๆๆๆๆ หลังจากก่อนหน้านี้ประมาณ สามชั่วโมงก่อน กระผมได้มีความยุ่งยากกับ การ convert matlab command บางตัวเช่น repmat สุดท้ายก็หาทางเลี่ยงๆไปได้ หึหึหึ

convert matlab's data to python's data

ขณะที่กำลัง debug เราสามารถใช้ command ที่ prompt K>> dlmwrite('yourfile.txt',Variable,'delimiter','\t','precision','%.6f','newline','pc') เป็นการ เขียนไฟล yourfile.txt โดยเอา ค่า ใน ตัวแปร matric Variable ที่มี delimiter คือ tabs ทศนิยม precision เป็น 6 ตำแหน่ง float ขึ้นบรรทัดใหม่สำหรับ pc