Archive for April, 2006

When a Bullet… (NC-16)

…or more technically correct term, a round (5.56mm ball) was fired from the M16, i was shook. It surprised me, even though my earplugs was on and it should be less than half a year that I last fired. Not that I was hit, but while waiting behind the firer for my turn, with each sheer whip or the crack of the shots were forcing me to close my eyes in a unusual reaction.

But when its time for me to fire, even though with the face so near or touching the gun, its doesn’t feel as loud as from beside. Let me breakdown the process as if like a Matrix slow-mo.

With 1.6kg applied to the trigger from the finger, clockwork-liked mechanism would release energy from the cocked spring, transferring it to a firing pin would be strike the back of the “bullet”, the percussion cap. This ignites “gunpowder” or propellant which would burn very quickly, giving out high pressure, hot gases.

The result? The “bullet” or projectile find its way through and out the barrel, until it reaches the end of its flight. Forget the big flames, explosions and actions you see on TV when the guns fire. In a split second, the bullet is now just a piece of metal, which will travel hundreds of meters, and if it touches human flesh, the high velocity spin (rifling) will cause it to penetrate the body and continues to screw through . If by the time the bullet goes out from the other side, it has created a hole exit much bigger at its entrance.

The side-results? The heat from the barrel is air-cooled, so you might see some “steam” arising. Smoke and gases will also escape from a vent. Remember those high pressured gasses? It does a few more things, it extracts the empty cartridge case out of the weapon, and clocks the weapon so that the next shot will be ready to fire (therefore semi-automatic).

I asked why sound of a gunshot is so loud before. My ammo course-mates was saying defiantly was the pressure, its like a pop sound you get when the cock fly out from a champagne bottle. I thought there was more to that, and my reasoning is that since the bullet fly near supersonic speeds (the speed of sound), it gives off mini sonic-booms. The disruption in the sound waves causes it to be deafening.

Something else, guess the power of the pressured gas. 200 horsepower, and i guess too thats about the same in a cannon. Then, the last not to be forgotten, the “recoil”. Knowing this fact will show the unreal-ism in many movies. The recoil is like the gun giving you a kick when its fired. Like some other smaller sized or skinny people, I used to tired out after getting the shock in the shoulder, and have little energy to even hold the rifle steadily. Well, I thought I have improved physically, but mentally I lost after some mistakes and couldnt recover from the mental “kicks”. I shouldnt, but that my excuss for missing the mark for marksmanship.

Thats for explaining the experiences of a live round. Now my experience for watching a demolition briefly (this was sitting in my drafts too many months).

Just 1.5kg of TNT was detonated, at the end of the explosive train. Even with sandbags covering it, earplugs & helmet on, standing behind a wall at safety distance, the shockwave felt was enough to turn you “high”. Here’s what will happen in a spilt second.

1. You see a whole pile of sand, smoke, dust expanded, covering over an area at before you know it. (sorry, no fanciful flames you get in movies)
2. Some might say they felt point 3 happen first, but others say point 4, anyway it all happened in super quick times almost at the same time.
3. You feel the shockwave.. an invisible force, like a push, like a wind, but it shakes the ground, passes through the wall, and goes through your body.
4. You hear a loud blast, better than Dobly Surround.

How can you die because of it
1. Killed by the blast - high pressure and temperatures (enuff to turn solid into vapour)
2. Killed by fragments - high speed (imagine being stabbed by 101 items in 1 second)
3. Killed by suffocation - the sudden lack of oxygen, causing the lungs and heart to crush.

Now, think about it, and you imagine how horrible is just 1 car bombing going to be.

More Mencoder

This is the followup of the More Video Compression series touching on the free, open sourced, fast, all-powerful…
Mplayer … ’s counterpart… Mencoder! And a little about converting to DVD/SVCD/KVCD.

First of all, do you have mplayer and mencoder?
Get it from http://www.mplayerhq.hu/design7/dload.html. Windows users, you can get win32 mingw32 ports from http://oss.netfarm.it/mplayer-win32.php. I think these ports are more optimised and faster.

Next, make sure you get the codecs you need. Fonts/skins/others are optional. Extract them to the correct directory. If you know how to play with those configuration files, do so.

Now windows mplayer user, here’s a tip to you. Never under-estimate what this command line/dos/linux style(whatever you call it) can do. First, its very portable. Zip them up and it takes maybe only 20+MB which plays almost any video format. Download a mega codec pack and its already tripple that size. Place it on your thumbdrive and you don’t even need any installtion to use. Remember the key bindings and you have a full control of media player at the keyboard. F for fullscreen, O for elapsed/total time, 9 and 0 for volume, D for frameskipping options, Q/Esc to escape, x/f for subs delay, up/down&page up/down, home/end for fastwarding/rewinding quickly.

Using mencoder
IIRC, I did cover this before, but only providing links to how to convert files. Example, using Easy Realmedia Producer, you converted all your media files to rmvb. Now you need to convert to some other common formats so 1) you can send to your friend 2) you want to burn it 3) copy into some media devices which dont support real media.

(I was at a shop and overheard this conversation that no devices can play rm. Not true I think, ngage can, and even a hacked ipod can do the job imho. A interesting equiment i found was a 2.5″ harddisk casing with capabilities to backup sd/cf cards, and ability to play media files, and tv output, using a recharable nokia battery. )

As mentioned before, MediaCoder is a powerful frontend to the free tools including mencoder which helps you convert to whatever format you want just using mouse-and-click.

Basic Mencoder Usage

mencoder convertme.rmvb -ovc lavc -oac mp3lame -o encoded.avi

This is what I call a simple, default encoding. “-o” specify the output file. mp3lame by default uses mpegII layer III compression, and ffmpeg libraries for video compression. The result, about 400mb for a vcd/60mins, in (ffmpeg’s)mpeg-4, for a very quick processing rate (400+fps? so maybe a mere 10mins job at 50% cpu on a hyperthreading machine) .

Next I’m teaching, is something quite primitive but still very useful for a windows user - batch files.
Open notepad, paste this in.

@echo off
echo Encoding %1
"J:\a\mencode\mplayer\mencoder.exe" %1 -quiet -ovc lavc -oac mp3lame -ffourcc XVID -o %1encoded.avi
pause

save it as Encoder.bat or something. Drag a video clip into the newly create bat file and see what happens. I used to place batch files in the SendTo folder (C:\Documents and Settings\User\SendTo), so I could right-click a file, and “send to” encoder.

line 1 @echo off means dont display the lines of code in the batch files.
line 2 echo Encoding %1 echo means display. %1 is the file which is dragged/passed to the batch file.
line 3 "J:\a\mencode\mplayer\mencoder.exe" %1 -quiet -ovc lavc -oac mp3lame -ffourcc XVID -o %1encoded.avi
“J:\a\mencode\mplayer\mencoder.exe” is the path to my mencoder. -quiet is used when you do not want to see the status of the encoding (estimated encoded filesize, encoding fps, time remaining) -ffourcc changes the FourCC or encoding codec identifier used in the file. By default its “FMP4″, mplayer’s encoding. However this identifier will cause encoded files to be unplayable by older players or codecs. Changing it to XVID allows any xvid decoder to playback the file. DX50, codename for DIVX5) can be used also. %1encoded.avi appends encoded.avi to the specified the encoded output file.
line 4: pause Pause the screen and waits for key to be pressed before terminating. You can see some final statistics from mencoder.

Happy encoding, remember, since it pretty fast, if you are on a dual/hyperthreading processor, you can run 2 encoding sessions at the same time.

NOTE: I was confused by MPEG4, DIVX, XVID, ffmpeg, libavcodec terms at first. Mpeg4 is standards for this video compression format. DivX was actually a hack to improved microsoft implmentation of mp4 format. Xvid is a open source mp4 implmentation, (was a reverse engineered DivX - spell it backwards?). ffmpeg is a set of tools (at first on linux) which record, convert and stream digital audio and video. Included is libavcodec, LGPLed C coded codec libraries which encode&decode video&audio.

Dare to try more challenging switches?
-ovc copy -oac copy -ffourcc XVID is for “fixing” any files you encoded as “FMP4″.

-af channels=1 -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=400 -quiet -oac mp3lame -lameopts br=54:mode=2 -ofps 24 af does audio channel mapping. vbitrate sets video bitrate to 400kbits/s. br=54:mode=2, means mono at 54kbits/s for the audio. ofps is the output frame per seconds.

-oac copy -ovc lavc -of mpeg -mpegopts format=dvd -vf scale=720:576,harddup -lavcopts vcodec=mpeg2video:vrc_buf_size=1835:vrc_maxrate=9800:vbitrate=5000:keyint=15:aspect=16/9 -ofps 25 -vobsuboutindex 2
is to produce a mpeg II, DVD compatible video format.

For more, RTM! (Read the Manaul). Check out
http://tivo-mplayer.sourceforge.net/docs/mplayer-man.html and
http://www.mplayerhq.hu/DOCS/HTML/en/index.html

Converting to DVDs.
Cut the long story short, try the free software Avi2Dvd Yeah it supports dvd and svcd/kvcds.

Back on topic, using mencoder to convert?

Check http://wiki.clug.org.za/wiki/Making_DVD/SVCD/VCD’s_under_Linux using open source software to author a dvd.

http://gentoo-wiki.com/HOWTO_Mencoder_Introduction_Guide A very good walkthrough on mencoder also touches on dvd conversion.

As for how to burn using free tools, (eg. CD-R tools, CDBurnerXP pro), I havent figured that yet and am now in a rush. Maybe the next article in the series. Till then, tata.

Sidenote: If you are interested in creating subtitles, or manipulate them (like join, cutting, converting) try the free Subtitles Workshop or dl here.

ajax alternatives

Sometimes when I wonder too much about computer technologies in mind, I wonder if I would become a computer philosopher. Just like many computing theories were already established long even before computers were practical.

You are free to feel that AJAX is just a hype, or just a overrated term. Some of you might already know that it basically revolves round the XMLHttpRequest javascript object. Nevertheless, Ajax..

1. sounds nicer/cooler. Ajax is also the name of Greek Hero of the Trojan War. Removing r from Greek, now you can Geek.

2. is changing the way people develop and use Web Technologies.

What I like to touch on now is how can you accomplish the same stuff you do with ajax without ajax (that is before ajax came about).

1. Flash. Perhaps it was more popular before to use flash for server communication, now the developers are trying to redo their implementation in ajax.

2. New window. Javascripts popup a new window, closes it, then updates the main page. Javascript controls the new window, which sends and requests information from the server, then does some checks, updates the parent window, then closes the new window. Of course, popup blockers nowadays might pose a problem to this method.

3. IFrame. The cool little feature (started in IE) that can magically changes in a corner of your webpage. Of course, this was what lead to development of the “ajax” support in browser.

Now the last thought. Its cool that the ideas of widgets are gettig “in” (even for wordpress). Now if wordpress plugin writers all were to implement all ajax codings with their different libraries, and a wordpress user were to use them all, i think the mere load of the js/ajax libraries is a killer itself. Now, how do you implement a ajax library to download other libraries only when that ajax plugin/script is needed in that page?

sidenote: the 3 giants. google, yahoo, msn are fighting closer each day. In competiting with gmail (beta?), Yahoo! Mail beta and MSN Live Mail beta throws in more eye cindy, 3 pane outlook like style, and ajax. And google fights back with their Calendar.

Small Eat

Today I accompanied my church friend to buy a computer at Sim Lim Square. On the way back to the MRT, we walk thru Bugis and he introduced and treated me to many �� (xiao chi) stuff like 算盘�(suan pan zi) and others. (my stomach is bursting! and still got handful of packets to bring home)

I later dropped by PS (Plaza Singapura) thinking I would find the Mini-toon sale and walkies talkies.

Best Denki had some talkies. But I couldnt find a mini-toon outlet there. My memory swapped the Action City with Minitoons.

What I found was Carrefour book sale. I bought 3 chinese cooking books (herbal tea egg, hor fun, milk tea/shakes), 1 Malay cooking book of Singapore and Malaysian recipes. 2 books for nerds like me: “Just A Geek” by Wil Wheaton, “Build Your Own .NET Language and Compiler” by Edward G. Nilges published by A. Press.

Reason I wanted to buy the latter book was that it touched on lexical parsing. I found another book on cross-platform programing - .Net and MONO. The introduction quoted Steve Jobs saying Linux is good, Linus saying Microsoft issnt evil, and Bill Gates saying only Mac meets the standard. But I didnt buy the book. I bought a cheap dustpan and broom instead for $1.

Poor Man’s Dish

Today, the first time I cook at dish at home (with some help). Reminds me, cooking’s not only what you throw into the wok and dance over the fire. Its planning the dishes (steal some secret recipes), shopping for ingredients (”marketing”?), preparing the ingredients (wash, clean) and utensils, cooking, serving, clean up. I was a horrible student in my Home Economics class, but I covered up by my partner, a top student who didnt complained much (thanks jansy).

The dish I cooked? Char Kway Teow, “fried flat noodles”, ç‚’æžœæÂ?¡ is my favorite dish, also among Singaporeans, Malaysians, and maybe south-east Asians. Its nice, aromatic, but maybe not so healthy in the long run (oil!). As for links and recipes, wiki, Singaporean, Malaysia, Vitnamese recipe. I spent about $6 for more than 6 plates of serving. Its said that it used to be a cheap labourer’s dish. Nows its a delicacy with many different ingredients added.

My brother told me Pizzas was the food the poor could afford in Italy. My campmate says shark fins were given to the beggars by the fishermen in China last time. Anymore interesting poor’s person food?

Whats my next dish? Due to the extra packet of noodles I bought, maybe I’ll try Hokkien Mee or Hor Fun