Dept. of ETE community website released
Today I have finally released the community website for the department of ETE, RUET. I was planning this for about a week. Everyone is welcome. Link given eteruet.co.nr
Java ME along with Gauss Elimination == Simultaneous equations with any number of unknowns solved
Gauss elimination is an elegant method to solve system of simultaneous equations. The main idea consists of two steps (1) Forward elimination and (2) Backward substitution. I won’t attempt to teach Gauss elimination here.
Although elegant the method consists of repetitive calculations which is pain to carry out. A computer implementation of the algorithm can give us the benefit of having the computer consume the pain. But a computer is not always the thing at hand. So, here is a simple Java ME MIDlet which can be run on any CLDC 1.0, MIDP-2.0 device.

Download the jar from here (source included)
MATLAB report generator, simple way, smart output
In a previous post I had shown how to use MATLAB and the web command to use the power of HTML in MATLAB to display program outputs in a more fabulous manner.
But sometimes the complexity of the procedure doesn’t worth the effort it takes.
In cases where direct manipulation of HTML is not required there is a much simpler but
smarter way. The code is here. The code snippet responsible for generating the report
is highlighted.

Download source
Palindromes
Numbers such as 233332 are called palindromes. They have the property that they are same forward as backward. Interestingly enough if we start from any number and continuously reverse and add, it usually ends up in a palindrome.
For example we start with 7513:
7513+3157= 10670
10670+7601=18271
18271+17281=35552
35552+25553=61105
61105+50116=111221
111221+122111=233332
Thus we get a palindrome in six reverse and add operations.
Here is a simple python program to do the dirty reverse and add and give us the palindromes.
Notably, not every integer yields a palindrome this way. For example 196 does not.

Download the source
Renaming files downloaded from the web automatically for better readability using Python
Today I downloaded an mp3 with url:
http://music.music.com.bd/Music/S/Sumon%20&%20Anila/Ekhon%20Ami/02%20-%20Sumon%20&%20Anila%20-%20Ekhon%20Ami%20[music.com.bd].mp3
So the downloaded file (downloaded with Multiget) has the name:
02%20-%20Sumon%20&%20Anila%20-%20Ekhon%20Ami%20[music.com.bd].mp3
But it’s awesome so I renamed it to:
02 – Sumon & Anila – Ekhon Ami [music.com.bd].mp3
Which looks much prettier. But as I continued to download more mp3s it felt
labourus to rename every single file that I download. So I thought about some
automation script. Batch file (Windows) / Shell script (Linux) would be good
enough but that would require me to manipulate the name string directly to replace
the %20s with spaces. Not a big deal but the name could contain things other
than %20s (spaces) . So a better solution, I thought, would be Python’s url decoder.
Here is a snapshot of the code from my favourite editor IDLE and also a download link to the python source file.
Place the python script in the folder containing your files and double click on the
script to see it at work!

Here is the download link simply_rename.zip
How to feed PC music into the Microphone
While voice chatting on yahoo or talking over mobile using bluetooth voice gateway friends request me to let them hear the song I am hearing. I used to place the microphone close to the speaker so that, they can hear. But this is so uncomfortable and awesome specially when using a headphone. I looked for a smarter solution & I found. Here I show (Windows only)-
1. On the taskbar’s right corner (System tray) right click on the Volume Icon.

2. Click on Open Volume Control menu item.
3. A window titled ‘Front Speaker’ appears. From the munubar choose Options>Properties

4. In the ‘Properties’ window choose Adjust Volume for (Group box) Recording (radio button).

5. Chek ‘Stereo Mixer’ and ‘Mic’ and uncheck everything else and click OK.
6. A window with two sets of widgets seperated by a vertical line appears one titled Stereo Mixer & another titled Mic. Check Select of Stereo Mixer.

To ensure that the setup is working, play your favourite music on your favourite player and open up Sound Recorder (Start>All Programs>Accessories>Entertainment>Sound Recorder) and start recording.
G2’s Poetic Python
This a favourite poem of mine. It’s about Python.
Programming is fun
When the work is done
if you wanna make your work also fun:
use Python!
হাবিব এর বলছি তোমাকে
আজ সকালে music.com.bd থেকে হাবিব এর নতুন এ্যলবাম বলছি তোমাকে download করলাম।এক কথায় অসাধারণ একটি এ্যলবাম।
Valentine’s day উপলক্ষে WARID sponsored এই এ্যলবামে ৯ টা গান আছে। সবগুলোই ভালো লেগেছে। গান গুলো হচ্ছে -
১। আকাঙ্খা
২। শুভ্র চাঁদ
৩। সূর্যমূখী প্রেম
৪। নিশি কাব্য
৫। একজনই
৬। একমুঠো ভালোবাসা
৭। কৌতূহল
৮। প্রাণ বন্ধুয়া
৯। গোধূলী লগন
Download link এখানে দিলাম। আমার বিশ্বাস বলছি তোমাকে সবার ভালো লাগবে।
DISPLAYING HTML OUTPUT USING MATLAB
Introduction
Matlab is a great tool for technical computing. For each computation we need to display the output and in most of the case the output is displayed in the console. But what if more flexibility is needed? What if we need to display data in tables or in more attractractive manner? We can do this using matlab web browser and the web command along with the text: protocol.
Commands
web
web http://asadujjaman.wordpress.com
web(‘text://<html><body>Hello world!</body> </html>’);
Prerequisite HTML knowledge
HTML is the language of the web. I assume that you already know what html is.
Now I show how to create a table in HTML:

The result is the following table:
| Header1 | Header2 |
|---|---|
| Data1 | Data2 |
The <tr> tag specifies a row, <th> specifies a header cell and <td> specifies an ordinary cell.
The Idea
We can exploit the web(‘text://<html>…</html> ’) command and our html knowledge to display html output in the matlab browser. We produce an HTML string as our computation proceeds and then pass the string to the browser.
A Numerical Example
Last week we solved the problem of computing the roots of a function using a numerical method called SIMPLE FIXED-POINT ITERATION in our computer lab (RUET). We needed to show results of each iteration. We just used disp(sprintf(‘…’ )). But I searched for something more pleasurable. And there is no doubt that I found some satisfactory idea.
The Code

Download SimpleFPI.m
Using the function
Suppose we need to find the roots of f(x) = 0 where, f(x) = e-x-x.
We arrange this in x=g(x) format and g(x) becomes e-x or exp(-x).
The SimpleFPI function takes three arguments:
The function g(x), maximum approximate error (ea) and maximum number of iterations in case the function doesn’t converge.
It outputs two results:
The root and an HTML string describing the process.
From MATLAB
>>> [root, html]=SimpleFPI(‘exp(-x)’,.001,100);
>>>web(sprintf(‘text://%s’,html));
The Output
| i | xi | εa(%) |
|---|---|---|
| 0.000000 | 0.000000 | 100.000000 |
| 1.000000 | 1.000000 | 100.000000 |
| 2.000000 | 0.367879 | 171.828183 |
| 3.000000 | 0.692201 | 46.853639 |
| 4.000000 | 0.500474 | 38.309147 |
| 5.000000 | 0.606244 | 17.446790 |
| 6.000000 | 0.545396 | 11.156623 |
| 7.000000 | 0.579612 | 5.903351 |
| 8.000000 | 0.560115 | 3.480867 |
| 9.000000 | 0.571143 | 1.930804 |
| 10.000000 | 0.564879 | 1.108868 |
| 11.000000 | 0.568429 | 0.624419 |
| 12.000000 | 0.566415 | 0.355568 |
| 13.000000 | 0.567557 | 0.201197 |
| 14.000000 | 0.566909 | 0.114256 |
| 15.000000 | 0.567276 | 0.064752 |
| 16.000000 | 0.567068 | 0.036739 |
| 17.000000 | 0.567186 | 0.020831 |
| 18.000000 | 0.567119 | 0.011816 |
| 19.000000 | 0.567157 | 0.006701 |
| 20.000000 | 0.567135 | 0.003800 |
| 21.000000 | 0.567148 | 0.002155 |
| 22.000000 | 0.567141 | 0.001222 |
The root is 0.567145
Conclusion
This is the very basic approach. More advanced technique like CSS can be used for better flexibility.
আজ একুশে ফেব্রুয়ারী
আজ একুশে ফেব্রুয়ারী। শহীদ দিবস। আমি ভাষা শহীদদের শ্রদ্ধাভরে স্মরণ করছি।



