Tips and Tricks

How to calculate MD5 in C#

Not only wget but also MD5SUM, I have been asked how to implement this functionality in C#. Again and again, I wrote below code in Mono on Ubuntu Feisty.

How to implement simple wget in C#

.NET is such a good programming environment because it provides many useful standard libraries. Actually, this concept is very similar to battery included in Python. The best part of .NET is that we have Mono so it is possible to develop .NET application on Linux to run on Windows. I have been asked to find a solution for retrieving content from specified URL using HTTP protocol in C#. Here is the code.

Mandelbrot Set Viewer using wxPython

In previous post, I benchmarked several implementation of Mandelbrot Set in Python. To make it more complete, I port a Mandelbrot Set Viewer written in Ruby posted at Codenone using OpenGL to Python and wxPython.

Mandelbrot Set in Python

I found a good homework and posted at Codenone since last week. The first question is about Mandelbrot Set. Actually, this problem could be categorized in compute intensive which should be solved in low-level language to let it run as fast as possible. However, we are talking about alternative languages aka scripting languages like Python and Ruby so I will try to solve this problem in Python. For the solution in Ruby, please go to another post.

How to forward port in user space using socat

I was asked to help setting up a kind of traffic redirection through VPN. In particular, the VPN server is Cisco VPN so the client should be Cisco VPN client too. Since the client is Ubuntu Edgy, it is very easy to install and run cvpnd. Then I tried to forward a TCP port to another host on the same port using IPTables and DNAT. Unfortunately, it failed. Incoming TCP connection through this port always get "connection refused". I guess that the problem might involve the module cisco_ipsec. This module may hook packet routing somewhere in the kernel so DNAT will not work correctly through its network interface. However, I don't have enough to investigate deeper for more detail since the service must be available tonight. In other words, I have 15 minutes left. So I decided to use port forwarding tool running on user space instead. After searching for a while, I found socat. socat looks like an extension of netcat which provides extremely flexibility to all of us for forwarding anything and then redirect to anything.

How to convert video to FLV using Mencoder

One of the most popular video format in recent years is Flash Video or so called FLV because it supports streaming over the web architecture using normal http protocol. In another point of view, 3GP is widely used in mobile phone because it is very small and efficient for small screen like mobile phone. The technology is going to emerge someday. 3GP would be available on the web for massive distribution. The best approach for publishing video on the web is to use FLV. I will give an example of unattended command for converting any video files including 3GP to FLV using Mencoder.