ICT

No, not the Minister of Information and Communication Technology but a time zone. Whenever we set up a linux box and selecting a time zone of asia/bangkok, we would encounter with a question like "Does ICT looks sensible to you?" More lately, I was asked what is ICT from its appearance in each entry in our planet. Well, We know that ICT is the time zone of Thailand but we never know what does it stand for.

Well, wikipedia is your best friend. It turns out that ICT stands for Indochina Time. A freaking name, though.

New aggregator for CP24

I have decided to switch our aggregator engine from planet to Gregarius. The new one does not support navigation bar. I am too lazy to edit the template yet. So, there will be no link from our planet (I still love the name planet) to our forums.

Our old planet can still be accessed at http://dae.linux.eng.chula.ac.th/planet/output/ while the new one is at http://isl2.cp.eng.chula.ac.th/~dae/gregarius. After some test drive, If no problem exists, I will switch our planet.cp-24.com to the new one.

Moving again

Finally, I move my home again. This time to isl2 server, powered by drupal 4.7.2 with meta themes. Well, just register a new domain name. Now we have http://www.nattee.net pointing to here and also a domain hack of http://our.obor.us.

CUCA Night '49

มาอีกแล้วครับท่าน CUCA Night เชิญ cp24 ทุก ๆ ท่านครับ

วันศุกร์ที่ 16 มิ.ย. 18:00 - 22:00 ที่ สโมสรทหารบก วิภาวดี ห้องมัฆวานรังสรรค์ รูม C

บัตร 500 บาทจ้า

ใครจะไปติดต่อป๋มหรือกัญญาก็ด้ายยยยย

Ruby

Mr. Woods told me about Ruby many times. At that time, I never which to try it. I am not fluent with C++ enough so why bothering with other languages. (Hell, that's true. I just cope `dynamic_cast' and love it only recently.) Today, after reading Bruce Eckel's blog, there are many many concept I have never heard of, e.g., coroutine, metaclass, continuations, Rail, etc. What the heck.

Have to give them a try.

We must eliminate richness

That's quite exaggerated but for a catch words, it seems fine. Today I chatted with Aj. Prabhas (again), the topic wander from A to B to C and at some point in time, we were discussing about my protanomalous. Suddenly Aj. prabhas asks me whether my mind also blind? The topic changed into social. I long believe that Money is limited. There exists a fixed quantity of money in the entire planet. This quantity is increasing (by burning, or less pestimistic, by harvesting and utilizing our beloved and also limited resources). If someone takes, then someone else gives (or loss). The conclusion is simple, we can eliminate poorness, in Taksin way, by making the rich very very rich so that the poor cannot live, and just simply die. Obviously this is bogus since poorness always existst (remember that for a well-ordered set, there always exists a minimum element, thus, the poor cannot be eliminated this way).

The other solution, if we believe this model, is quite simple: stop trying to be rich. Obviously, this is also bogus because other body will take the resource that is eligible for someone else (if that one aim for richness). Well, the final conclusion is also simple, just make it harder and harder to be rich and rich and rich. For example, the advance rate tax system is one of that kind. The richer you are the higher you have to pay for the other.

Hmm..... the other problem comes around. Normal dilemma, if it is hard to be rich and being poor is fine, no one will work and waiting for the very rich to make the living for the poor.

Man...... Death solve all problem. No man, No probem......

(quote from Stalin)

EnumWindows And the Enumeration of Real Windows

จะหา Windows บนจอที่มี ตอนแรกไปเปิด Win32API เจอ EnumWindows ตอนแรกนึกว่าจะใช้ได้เลย แต่พอใช้จริง ๆ ดันเจออะไรบ้าบอเต็มไปหมด คือเป็น Windows ที่เป็น Top Level แต่มีอะไรบ้า ๆ บอ ๆ เยอะ คือเจอ Windows ที่มันไม่โผล่มาให้เห็นหลายอัน

หลังจากไล่ ๆ search ใน net สักพัก ก็เลยรู้ว่าต้อง Check ดังต่อไปนี้ด้วย

  • ต้องเป็น Windows ที่ Visible สามารถ check ได้จาก IsWindowVisible
  • ต้องไม่มีป๊ะป๋า คือเป็นโคตรเตี่ย windows check จาก GetParent
  • ต้อง (have no owner and are not Tool windows) OR (have an owner and are App windows) สามารถดูได้จาก GetWindowLong(hwnd, GWL_EXSTYLE)
  • สุดท้าย มันควรจะมี Caption ดูได้จาก GetWindowText

source code version delphi จะเป็นยังเงี้ย

if IsWindowVisible(hWnd) then begin
  If GetParent(hWnd) = 0 Then begin
      hasNoOwner := (GetWindow(hwnd, GW_OWNER) = 0);
      lExStyle := GetWindowLong(hwnd, GWL_EXSTYLE);
      If (((lExStyle And WS_EX_TOOLWINDOW) = 0) And hasNoOwner) Or
         (((lExStyle And WS_EX_APPWINDOW) <> 0) And Not hasNoOwner) Then begin
          If GetWindowText(hwnd, TheText, SizeOf(TheText)) > 0 Then begin
            st := TheText;
            Form1.Memo1.Lines.Add(Format('[%s]',[st]));
          End;
      End;
  End;
end;

VLC สุดยออออดดดด

VLC (VideoLan) หรือเรียกง่าย ๆ ว่า Media Player บน linux มันสุดยอดไปเลย... คือจะเรียกว่ามันเป็น media player ก็ไม่ค่อยถูก จริง ๆ แล้วมันเป็น media encoder ด้วยตะหาก

วันนี้ลอง ๆ ใช้ ตอนแรกนึกว่ามันทำได้แค่ pull, i.e., เปิด stream จากสักที่นึง แล้วตัวเองก็ปล่อย stream ให้ที่อื่นมารับไป แต่ว่าจริง ๆ แล้วมันทำ push mode ก็ได้เหมือนกัน คือเปิด port ตัวเองรอไว้ ให้ vlc ตัวอื่นมัน push เข้ามา แล้วตัวเองก็ปล่อย stream ออกไปพร้อม ๆ กัน

tip ต่าง ๆ

  • เวลาจะเปิด stream output ให้ Media Player ผ่าน http ต้องใช้ encapsulation method เป็น asf ไม่งั้นจะดูไม่ได้ แต่ถ้าจะดูผ่าน mms ก็ใช้ encapsulation แบบ MPEG-TS ได้ไม่จำเป็นต้องเป็น asf
  • pull โหมดทำได้โดยเปิด input เป็น udp://@:1235 หมายถึงจะรับ input ผ่าน port 1235 นั่นเอง
  • ตัวอย่าง --sout ที่ ส่ง stream ออกไปให้ media player ดูได้ #transcode{vcodec=DIV3,vb=256,scale=1,acodec=mpga, ab=32,channels=2}:duplicate{dst=display,dst=std{access=http ,mux=asf,url=xxx.xxx.xxx.xx:pppp}} อันนี้จะส่งไปที่ host xxx.xxx.xxx.xxx port pppp
  • เวลาทำ transcoder ที่ server ไม่ต้องใส่ dst=display ก็ได้ (ใส่แล้วโคตรจะกินแรงเครื่อง)
  • มันมี web interface ด้วยเจ๋งโคตร ๆ เปิดได้โดย --extraintf http --http-host aa.bb.cc.dd:eeee
  • ถ้าจะ nohup ให้ปิด interface ไปเลย (คือใช้ -I httpd เลย อย่าใช้ --extraintf) ไม่งั้นมันจะไม่ยอม run เพราะหา terminal ไม่เจอ