iptables is a administration tool for IPv4 packet filtering and NAT, it's mainly in UNIX like operating system including, of course Linux. Here my iptables commands collection based on my own purposes:
- List applied filters
#iptables -L
- Blocking specific IP address
#iptables -I INPUT -s <address> -j DROP
- Unblocking specific IP address
#iptables -D INPUT -s <address> -j DROP
Wednesday, September 23, 2009
Sunday, September 20, 2009
Idul Fitri 1430H
This night we celebrate our winning day, congratulation for them who reach this great achievement. Meanwhile, I celebrate Idul Fitri's night in Kayu Putih, i got many Idul Fitri's messages via SMS tonight, I'm going to Aso's house today! and maybe stay there for about 1-2 more days.
Minal Aidin Walfaidzin
Happy Idul Fitri 1430H
Mohon Maaf Lahir dan Batin from me!
- Ardhan Madras, Jakarta
Minal Aidin Walfaidzin
Happy Idul Fitri 1430H
Mohon Maaf Lahir dan Batin from me!
- Ardhan Madras, Jakarta
Tuesday, September 15, 2009
Marshall MG DFX-30

Tonight, me and Dwi goto MG Music & Sport store at Kelapa Gading, looking for a guitar amplifier, i can say that this store has some cool guitar's thing, bacause even my PRS SE Singlecut sold there. My option is: Line-6 Spider 30, Roland X-Cube and Marshall MG DFX-30, i ask their store personnel to take a sound test with Marshall and Roland amp. My choice is Marshall, i just want a rock n' roll sound, you know Jim Marshall. This amp paid for Rp. 2.250.000, and plus a Proline cable for Rp. 95.000, you count the total cost ;p, now it's time to rock...
Monday, September 14, 2009
Back from Bandung
Yesterday took a Baraya Travel's bus from McD Pulo Gadung, Gunarto accompany me with a motorcycle (he has been seduced by a shemale when we are waiting the traffic light ;p). Arrived in Bandung for about 9.00pm then goto Jemmy's house in Antapani district. At Sunday afternoon, bought my iPod USB data cable and take a look some guitar amplifiers. Call Aat, fortunately she was in Bandung too, so i ask her to have dinner with me, she offer Dakken Resto and Cafe at Riau street. Im going there, not too long as least she came, order some foods and drinks and take a long conversation. This is our first meeting.
Aat offer me back to Jakarta together, we take train because as she said, travel was already full. I start from Jemmy's house in 4.00am to the Bandung's train station. Bought two seat Argo Gede train tickets for me and Aat. Aat then come, going around to the station to find something then taking our place in that train.
But shit, i got stomach-ache, waste them in the train's toilet ;p. After about 3 hours we have arrived in Gambir station, Aat get a cab and ask me to follow... but i stop at Cikini, take another cab and going to my place. Nice to meet you Aat ;p
Aat offer me back to Jakarta together, we take train because as she said, travel was already full. I start from Jemmy's house in 4.00am to the Bandung's train station. Bought two seat Argo Gede train tickets for me and Aat. Aat then come, going around to the station to find something then taking our place in that train.
But shit, i got stomach-ache, waste them in the train's toilet ;p. After about 3 hours we have arrived in Gambir station, Aat get a cab and ask me to follow... but i stop at Cikini, take another cab and going to my place. Nice to meet you Aat ;p
Sunday, September 06, 2009
Linux Termios

I have been writing TCT smartcard reader module, using communication protocol that shipped with the reader, the reader actually provide API for Linux, the API is good, but not so good. It's closed code means we can't do more hacks. One thing that was a big issue which force me to write the module is API's ability to determine timeout I/O operation. For example, we send command to the reader, but let say the reader power has fail or something error occurred then the API will wait and block for uncertain of times because there are no respond from the reader.
Then i write the module from scratch, i got some weird problems, the reader will not reply for certain type of byte (character), 0xD (CR), 0xA (NL), 0x11 and 0x13. This problem has made me crazy and temporary ask me to use simple ASCII protocol. The termios structure contains input/output flags that determine serial communication characteristic.
By default (and at least i solve this problem, thanks you all), Linux serial API perform CR to NL and NL to CR for both input and output, so when i write a CR, it was actually converted to NL and vice versa, this translation also inherited for output. To remove this setting, do bit operation with control setting as follow:
struct termios opt;
/* open device and read current setting */
opt.c_iflag &= ~(INLCR | INCRNL);
opt.c_oflag &= ~(ONLCR | ONCRNL);
Now the CR-NL and NL-CR translation has been resolved, what now? i got another headaches, the same problem with character 0x11 and 0x13 on input, after do some man tcsetattr i see Linux also interpreting this as a special character, the XON/XOFF option flag has been enable by default, it's serial line hardware flow control, so i disable this in input control setting:
opt.c_iflag &= ~(IXON | IXOFF);
...and everything is fine, there are no unresponsive actions by the reader caused by invalid data sequence, hey.. i just beginner serial communication programmer, and thanks to the ACR-120 reader, thanks for let me know this issues.
Friday, September 04, 2009
Bit packing/upacking

Our TCT require to store and read information on a smartcard, each transaction, officer and engineer identification will use a smartcard. For example to store and read transaction information the card management use a value block, it's a 32 bit unsigned integer, some informations will be packed into this integer, for example with this informations:
MSB LSB
5 bit | 6 bit | 4 bit | 6 bit | 8 bit | 3 bit (32 bit integer)
info1 | info2 | info3 | info4 | info5 | info6
Given the value for 0xa082abc8 or 2692918216 in decimal, to unpack the informations we simply do bit shift and masking:
info1 = value >> 27 & 0x1f;
info2 = value >> 21 & 0x3f;
info3 = value >> 17 & 0xf;
info4 = value >> 11 & 0x3f;
info5 = value >> 3 & 0xff;
info6 = value & 0x7;
and for packing from the informations:
((info1 & 0x1f) << 27) | ((info2 & 0x3f) << 21) | ((info3 & 0xf) << 17) | ((info4 & 0x3f) << 11) | ((info5 & 0xff) << 3) | (info6 & 0x7)
another way is to create bitfield, as follow:
union {
struct {
unsigned int info6 : 3;
unsigned int info5 : 8;
unsigned int info4 : 6;
unsigned int info3 : 4;
unsigned int info2 : 6;
unsigned int info1 : 5;
} bit;
unsigned int val
} data;
The bitfield already packed, so we only need to assign a value to val member and access bitfield info member as informations. To assign a bitfield member, it's like we do in a generic C structure. But be carefull with bitfield, different machine maybe has different a byte-order convention. Intel CPU follow litle-endian and other CPU like Motorola use big-endian convention, the above bitfield was intended to be use in a litle-endian system, if you want more portable code use bit shifting and masking, for bitfield, use compiler preprocessor directive such as __LITTLE_ENDIAN in GCC.
http://en.wikipedia.org/wiki/Bit_field
http://en.wikipedia.org/wiki/Endianness
Thursday, September 03, 2009
PRS SE Singlecut

Sorry for being vacuum to write into this blog, okay one thing i have been missing is to tell about my new PRS SE Singlecut guitar, i bought this from my friend, he is a PRS custom distributor from the eBay ;p, PRS SE Singlecut comes with 2 model, one with Tremolo bar and with no Tremolo bar. Lucky me, i got the first option yes with the Tremolo bar. The SE series is Korean made, it has Tobacco Sunburst color, Mahogany body and neck, Rosewood body, PRS moon inlay design, standard SE humbucker pickups, volume, tone and 3-way toggle. This guitar sounds good and comfortable, although this is not a standard PRS series, at least i have a PRS guitar. Thanks for my friend for give me a flexible payment method.
prsguitars.com
Subscribe to:
Posts (Atom)