## Life

### Learning by Doing: Programming Razz Simulator

on February 4, 2010 - 7:54pm

As a final assignment in my Languages for Scientific Computing class, I develop a Razz Simulator (http://github.com/eus/razz_simulation). Basically Razz is the inverse of Poker in which you try to come up with the worst hand (http://en.wikipedia.org/wiki/Razz_(poker)). The game is well explained in the slide for the first and second lectures and in the sixth assignment foud in http://www.cs.utexas.edu/users/pauldj/lectures.html. The first problem on Razz was at the end of the first assignment: given A, 2 and 3 to start with, what is the probability of getting a hand with rank exactly 7? Well, no one answered that correctly until the professor showed an elaborate calculation in Mathematica that resulted in 0.143008. One important message is that people don't do such an elaborate calculation in reality. Rather they use a simulation (i.e., play as many Razz games as possible with the given starting cards and count the number of times you score 7). So, the last assignment is about developing the simulator that can simulates as many games as possible in the shortest time possible. The most interesting thing about the assignment is that the program is neat enough to show some interesting software engineering principles in action beside telling you that Razz is not as simple as it seems to be.

### Seeing It as a Relationship: <-> beta-reduction

on January 29, 2010 - 2:36pm

Last week I got a question that asks me to show that the following statement about Y combinator (http://en.wikipedia.org/wiki/Fixed_point_combinator#Y_combinator) in LaTeX is correct:

Y z \leftrightarrow^{*}_{\beta} z (Y z)

where \leftrightarrow{\beta} = \rightarrow{\beta} \bigcup \leftarrow{\beta}


### What does mrproper in "make mrproper" stand for?

on January 23, 2010 - 11:44am

Last Friday the morning session of my Languages for Scientific Computing class was about Makefile. Well, largely there was nothing interesting since I know how Makefile works already. But, still the teaching assistant could surprise me with: make mrproper.

### The Difference between LEA and MOV OFFSET

on January 23, 2010 - 10:33am

The other day a friend of mine asked me to code a decimal-to-hex-converter in MASM using DOS ISRs (Interrupt Service Routine) for I/O. Well, I just gave her the equivalent C code since I am not into proprietary software. But, anyway I googled for some materials related to MASM syntax and DOS ISRs for I/O [0]. Upon reading some examples of using DOS ISR 21h, I stumbled upon the use of LEA dx, var and MOV dx, OFFSET var. So, I decide to have a look into them and come up with the following conclusion.

### Alternative power for LED head light

on January 19, 2010 - 7:09am

I've bought a LED head light some time ago. Battery turned to be absolutely useless. It runs only 15 minutes instead of 12 hours. It has two holes inside, but there’s no liquid. Maybe all went off, and thus there’s no power… Even if had something, I don’t know what to put there, acid, alkali, water?..

### Selling Copy-lefted Free Software Encourages More Copy-lefted Free Software

on January 9, 2010 - 6:39am

Free software does not mean public distribution. Free software means that the licensees have all of the four essential freedoms (http://www.fsf.org/licensing/essays/free-sw.html) with the software. Selling free software means that you license the software with a fee to a buyer under a free software license.

### Massively Distributed Systems I (One Semester at RWTH Aachen)

on December 27, 2009 - 9:22am

The course in Massively Distributed Systems I: Peer-to-peer makes me able to appreciate the power of P2P networking in providing a scalable censorship-resistant robust network as well as the basic know-how to engineer one. The course is very enlightening for me who had only one course in Computer Networking and didn't realize how limited a server is.

on December 24, 2009 - 1:43pm

I am following an interesting class on Languages for Scientific Computing (http://www.cs.utexas.edu/users/pauldj/lectures.html) taught by Prof. Bientinesi (http://www.cs.utexas.edu/users/pauldj/). Just a week ago he explained about the theoretical peak performance of a processor that is none other than: n_cores * frequency * ops_per_cycle_per_cpu. But, that is not the practical one.

### broken

on November 14, 2009 - 3:22am

Friday the 13th struck...I was changing the oil in my Suzuki GS500F, and as I was putting the oil filter cover back on, and cinching up the acorn nuts, I broke one of the studs that holds the filter. Of course, that really sucks, because now I either have to wait on a replacement stud, or try and get one after midnight.

### Why It is Called Counting in Discrete Mathematics

on October 17, 2009 - 3:01pm

When I learned Discrete Mathematics, I was curios why it is called "counting" the chapter that discusses permutation and combination. Isn't that mathematics about counting after all? But, I didn't think about it further until I need to revisit Discrete Mathematics again today.

### Mapping German Keyboard to U.S. Keyboard in GNU/Linux Debian

on October 14, 2009 - 8:05am

The first thing that I did when I needed to access the Internet through one of the PCs in the PC Pool of RWTH Aachen is to transform the German keyboard to an English keyboard. This is usually the first thing that people do when they are faced with foreign keyboards that their fingers are not accustomed to. The operating system used in each of the PCs in the PC Pool is GNU/Linux Debian 4.0.

### The Queers...also, Pulseaudio sucks

on October 7, 2009 - 7:15pm

I went to see The Queers last night in concert. It was a decent show, and TA80 was there from Tucson (a great bunch, BTW), as well as The Leftovers (from Maine; also a cool bunch).

### The 2009 entry

on September 15, 2009 - 6:51pm

Well, I can clearly see that I maintained things here. I'm not sure why I don't blog anymore. I feel like I have less time these days, and I'm not sure if that's reality, or if I'm just not very good at time management. The answer is probably somewhere in the middle.

### How to Get the Length of a UDP Datagram/Packet

on September 2, 2009 - 10:33pm

While developing the logger for GNU/Linux Anywhere USB Controller (https://savannah.nongnu.org/projects/awusb/), I needed to know the length of the UDP packet to be read so that I could do malloc()' with the appropriate size. Aproposing for datagram length' and googling for how to get the length of a UDP datagram' didn't return any result. But, I found the answer when I tried man 7 udp'.

### Getting the File Name from a File Descriptor (fd) or a File Pointer (FILE *)

on September 2, 2009 - 9:51pm

While developing the logger for GNU/Linux Anywhere USB Controller (https://savannah.nongnu.org/projects/awusb/), I created the following function that will store a FILE *' into a global table for a later retrieval:

static int
save_open_file (FILE *log_file);


I thought I could take the name of the file through FILE *' or its fd (file descriptor) using a libc (C library) function like `fstat'. But, I was badly mistaken.