Thursday, July 20, 2006
Movie List
This is my movie list. I don't think I'll add to it in the coming month.
As I have said before, I have the whole "Friends" TV show, and the whole "Robotech" animation series. Plus a few dozen other films which are either on WORM media, or have sub-par quality.
Here it is:
Saturday, July 15, 2006
Winds of Change
OK, I admit. The title is not entirely accurate. Not only because the original thing is "Wind of Change" (singular,) but also because things are not changing, but things are happening.
I know, I haven't been writing anything interesting here for a while (have I ever?) but many things have been happening. Let me give you an overview.
My ADSL was out again. And it happened over the weekend so I just had two days without connectivity. It just came back on!
My phone was out for a month. I just checked and it was back too! Although it could have been back for a week.
My cellphone was disconnected because of a dispute between me and the telecom company. It's not resolved, but my service is renewed (because I paid the damn outrageous bill.)
We are holding another programming contest in IAUM (that's my university.) The contest is called "IAUM-CCC 3". It has three rounds. An Internet-based first round and two on-site rounds at the end of Mordad (second half of August.) Hope to see you then (I will see you then, because I already know every body who occasionally reads my babbling!)
The first part of my graphics programming tutorial is almost finished. It's awful! But I'll post it as soon as I can.
I'm thinking about writing a one-part tutorial about ripping a DVD and making a good-quality DivX file (XviD, rather) out of it. Is there any interest?
I've had several other (two actually) algorithm implementations (a GCD algorithm, and one for finding the nearest pair of points) lined up to post. Hadn't have the time to clean them up and organize my thoughts.
I have also written a cryptography library (a very simple, albeit useful one.) I brushed it up and made a manual for it. I will post more soon. The library is called "yCrypto" by the way.)
Well, that's it. For now. Over and out.
I know, I haven't been writing anything interesting here for a while (have I ever?) but many things have been happening. Let me give you an overview.
My ADSL was out again. And it happened over the weekend so I just had two days without connectivity. It just came back on!
My phone was out for a month. I just checked and it was back too! Although it could have been back for a week.
My cellphone was disconnected because of a dispute between me and the telecom company. It's not resolved, but my service is renewed (because I paid the damn outrageous bill.)
We are holding another programming contest in IAUM (that's my university.) The contest is called "IAUM-CCC 3". It has three rounds. An Internet-based first round and two on-site rounds at the end of Mordad (second half of August.) Hope to see you then (I will see you then, because I already know every body who occasionally reads my babbling!)
The first part of my graphics programming tutorial is almost finished. It's awful! But I'll post it as soon as I can.
I'm thinking about writing a one-part tutorial about ripping a DVD and making a good-quality DivX file (XviD, rather) out of it. Is there any interest?
I've had several other (two actually) algorithm implementations (a GCD algorithm, and one for finding the nearest pair of points) lined up to post. Hadn't have the time to clean them up and organize my thoughts.
I have also written a cryptography library (a very simple, albeit useful one.) I brushed it up and made a manual for it. I will post more soon. The library is called "yCrypto" by the way.)
Well, that's it. For now. Over and out.
Saturday, July 08, 2006
Congratulations, Ehsan!
Yesterday (Friday, Tir 16th, 1385) one of my best and oldest friends got married. The cruel fact of life was that the ceremony was in Tehran, and I couldn't be there, and between my own hectic life and his obviously busy schedule, I couldn't get in touch with him.
I know he doesn't read my weblog, and I know the chances for him to someday stumble upon this is infinitesimal, but here's to him:
Howdy old pal! I wish you and your wife a merry life. Sorry I didn't come and didn't call, and generally acted as if I didn't know you!
Congratulations again, Ehsan!
Sunday, July 02, 2006
IEEE 754
That's the floating point number format standard. What do you know about how floating point numbers are stored? (We are not talking about arithmetic.)
My experience with programmers is that many of them don't know anything about these formats. Sure, they know that the real numbers are stored as sign, fraction and exponent triplets, but nothing more. After all, who needs to know how computers actually work these days, right?
Well, if you think like that, I'm sorry for you. These line of thought may be practical (I hate that fact,) but it's not at all part of the hacker/geek spirit. Here's a brief description about how floating point numbers are stored, according to IEEE-754.
I thought there were 3 formats for floats, but as it turns out, there's four. They are 32, 43, 64 and 80 bits (who've ever heard of a 43-bit float? Honestly?) The most widely used form is the 64-bit, or "double precision" one.
This format (and all others) have a single sign bit (the MSB), with "0" for positive and "1" for negative numbers. Then comes an 11-bit exponent field. And after that, a 52-bit fraction part, for a total of 64 bits (it's 8 and 23 bits for the 32-bit single precision format.)
As you know, floating point numbers are stored as some for of scientific notation, with base 2. Basically, that means that the value is the result of the multiplication of a M by two to the power of E.
But that's not the whole story. First of all, you have to realize that every number you write in binary, has a '1' as it's leftmost bit. Think about it! Without zero-padding on the left, every number must have a non-zero digit at its left, and in radix-2, that means a 1. So we omit that 1 and save one bit. In our scientific notation, the M must be normalized to be greater or equal to 1, and less than 2.
Second of all, the E is not the exponent, but the exponent minus 1023. That is, if you want 2 as E, you have to set the exponent to be 1025. This way, you can accommodate negative values as well. You might wonder why the common two's-complement method why not used. Well, I don't know all the reasons, but one of them probably has been the side effect that using this method, and the field layout being what it is (first exponent, then fraction) you can compare normalized floating point values just as integers, using the bit pattern! (not considering the sign bit, of course.)
More precisely, the final number is calculated like this:
value = -1sign bit * 2exponent - 1023 * (1 + fraction / 252)
The above is used when 0 < exponent < style="font-style: italic;">normal number. There are also a few special case values that you need to know about as well:
- If exponent is 0 and fraction is 0, the value is ±0.0;
- If exponent is 0 but fraction is nonzero, the value is denormal and equal to ±F/21022+52;
- If exponent is 2047 and fraction is 0, the value is ±∞;
- If exponent is 2047 and fraction is nonzero, the value is ±NaN (Not a Number. There are 252-1 of these!)
Saturday, June 24, 2006
Updated Movie List
Hi people,
Here's the new list of my movies. I updated the last one quite a few times in place, but from now on, I'll post an entirely new list every couple of month or so, or when my collection has changed (grown, shrunk, etc.)
In addition to all these films, I also have the following :
- The TV series "Friends". Yeah, every single episode of all the 10 seasons! The whole thing is about 35 GiB in size!
- Currently, I'm acquiring the anime series "Robotech". It's 85 episodes and 14.4 GiB, and so far I have about 50 episodes (it's 3 seasons in total.)
Sunday, June 18, 2006
The Good Guys Make Cartoons Too!
Go and watch that one too. Remember, DRM (Digital Restrictions Management) is bad! Really Bad!
The Future of the Internet, or the "why" in "Why Learn More?"
First off, go and watch this flash animation about the "future of the Internet", so to speak. But remember to come back and read the rest. The SWF file is about 1.7MiB in size.
...
Now, what do you think about that? "Net Neutrality" is good or bad? You know, forget about net neutrality. What about the idea of major cable and telecom companies, controling the data that passes over their cables? Is it good or bad? The way it is presented in this animation, the future of Internet depends on it! According to the producers of this clip, if we give those pipe-providers control over what goes and doesn't go on their data routes, the world will become a Shangri-la of blessed connectivity!
Not so fast! The real story is not just that. You see, after the major -- I'm talking billions here -- success of companies like Google, that provide all their services over the Internet, connectivity providers (those major cable and telecom companies) started thinking along the lines that, why should Google reap all the profits? After all, it's their cables (or whatever) that carries the data and keeps the people connected. Basically, they thought that since it's them that connect the likes of Google to their source of income, they should have a piece of that pie too. But they just don't come out and say that. They say that they want to have different paths of Internet-traffic flow for different kinds of applications, but what's really going to happen is that they will be able to give priority to the traffic of anyone they want, say "CompanyEcks", who pays them top dollar for such a priority.
And the other online service providers will be forced to compete too, because suddenly, Google's website will load 10 times slower that CompanyEcks's (trust me, they will find a more subtle and more damaging way) and the people will go the "faster" or "better" service.
Then Google will be forced to pay for priority too, and that will cause the end-user prices to go up as well. In the end, you and I loose. (OK, you loose. I've already lost, because I don't have the power to protest to these kinds of my government's decision.)
So it's not the question of many smart pipes, or one dumb pipe to carry the data. The question is whether to have one indiscriminating pipe to carry whatever information you want, or many different pipes with the good ones carrying the information your ISP wants.
That's why we, the users, have to educate ourselves, so not to choose whichever pop-up window that was bigger. Choose smartly.
...
Now, what do you think about that? "Net Neutrality" is good or bad? You know, forget about net neutrality. What about the idea of major cable and telecom companies, controling the data that passes over their cables? Is it good or bad? The way it is presented in this animation, the future of Internet depends on it! According to the producers of this clip, if we give those pipe-providers control over what goes and doesn't go on their data routes, the world will become a Shangri-la of blessed connectivity!
Not so fast! The real story is not just that. You see, after the major -- I'm talking billions here -- success of companies like Google, that provide all their services over the Internet, connectivity providers (those major cable and telecom companies) started thinking along the lines that, why should Google reap all the profits? After all, it's their cables (or whatever) that carries the data and keeps the people connected. Basically, they thought that since it's them that connect the likes of Google to their source of income, they should have a piece of that pie too. But they just don't come out and say that. They say that they want to have different paths of Internet-traffic flow for different kinds of applications, but what's really going to happen is that they will be able to give priority to the traffic of anyone they want, say "CompanyEcks", who pays them top dollar for such a priority.
And the other online service providers will be forced to compete too, because suddenly, Google's website will load 10 times slower that CompanyEcks's (trust me, they will find a more subtle and more damaging way) and the people will go the "faster" or "better" service.
Then Google will be forced to pay for priority too, and that will cause the end-user prices to go up as well. In the end, you and I loose. (OK, you loose. I've already lost, because I don't have the power to protest to these kinds of my government's decision.)
So it's not the question of many smart pipes, or one dumb pipe to carry the data. The question is whether to have one indiscriminating pipe to carry whatever information you want, or many different pipes with the good ones carrying the information your ISP wants.
That's why we, the users, have to educate ourselves, so not to choose whichever pop-up window that was bigger. Choose smartly.
Wednesday, June 14, 2006
I'm Back (T3 Style!)
I lost my phone connection, Internet access and cellphone coverage in various times during last week and this one, due do a combination of mice and stupid people! (Talk about bad luck!)
My Internet is back while my phone is not quite (they both use the same line. How???!!!) I hope I can get my cellphone back too.
Now the point of all this is that if you tried to reach me in the past days, and you read this blog as well, you now know that you haven't been snubbed!
My Internet is back while my phone is not quite (they both use the same line. How???!!!) I hope I can get my cellphone back too.
Now the point of all this is that if you tried to reach me in the past days, and you read this blog as well, you now know that you haven't been snubbed!
Wednesday, June 07, 2006
Convex Hull
I don't know how do mathematicians define a Convex Hull, but informally, the (planar) convex hull of a set of point on the plain is defined as the smallest convex polygon that includes all the points.
If you think about it, the verteces of such polygon will have to be in the given set, and the convex hull will be unique (if we add the restriction that no three consecutive vertecs of the resulting hull can be on the same line. Which is not much of a "restriction", because if they are, we just simply remove the middle point of the three and voila!)
So, the problem becomes finding the smallest area, convex polygon one can construct with the vertices from the set that encompasses all the given points.
Finding a convex hull is an interesting problem by itself, and quite useful in many other planar geometry and pattern recognition problems.
Now, many algorithms exist for finding the convex hull efficiently but not too simple (except the divide and conquer one which I'm not going to go into here.) When it comes to implementing, most people may try the naive O(n2), which is not easy to get right in one go (if you're that kind of person who tries that and gets it right in the first try, leave my weblog immidiately. I can't stand people better than I here!)
The other easy-to-comprehend-but-hard-to-implement method is "Graham's Scan", but that needs a special and none-trivial sort. Graham's Scan runs in O(n log n).
The method I'm going to discuss here is a O(n log n), and easy to implement algorithm. I first saw it in a Python book, the title of which I can't remember.
It starts with a straightforward sorting of the points, based on the X coordinate then the Y coordinate. Then, we'll start from the leftmost point (least X) and work our way to the rightmost point, maintaining two lists of points. One is the botton run of the points between the min- and max-X points, and the other is the top run.
Here's C++ code that implements the algorithm:
#define TURN_DIR(p1,p2,p3) (p1.x * p2.y - p1.y * p2.x + \ p2.x * p3.y - p2.y * p3.x + \ p3.x * p1.y - p3.y * p1.x) #define LAST(cntnr) (cntnr).back() #define BEFORE_LAST(cntnr) (cntnr)[(cntnr).size() - 2] vector<Point> ConvexHull (vector<Point> & pts) { sort (pts.begin(), pts.end()); vector<Point> lower, upper; for (unsigned i = 0; i < pts.size(); ++i) { while (lower.size() >= 2 && TURN_DIR(BEFORE_LAST(lower), LAST(lower), pts[i]) <= 0 ) lower.pop_back (); while (upper.size() >= 2 && TURN_DIR(BEFORE_LAST(upper), LAST(upper), pts[i]) >= 0 ) upper.pop_back (); lower.push_back (pts[i]); upper.push_back (pts[i]); } lower.insert (lower.end(), upper.rbegin() + 1, upper.rend() - 1); return lower; }You should be able to make sense of this code without much difficulty, but be warned, I changed my implemented code to put it here, and I have not tested it (my data structures for points and for return values were different, and I removed the comments! >:-) ) So use at your own risk. Now, the challenge is this. Can you make it shorter? (It's possible to use recursion to do so, I think.)
Tuesday, June 06, 2006
The Day of the Beast
Since 59 minutes ago, has started the Day of the Beast! (In my timezone at least, GMT +3:30) I just noticed that a few minutes ago that today is 06/06/06. As close to the number of the beast as you can get in each century!
You see, I still remember (with a lot of nostalgia) that the default port for Doom multiplayer was 666. The original Dooms and Duke Nuken 3D were the first games I played on a network (it was experimental, over PPP, but the bandwidth was too low for actually playing.)
Anyway, enjoy today and wait for the antichrist!
You see, I still remember (with a lot of nostalgia) that the default port for Doom multiplayer was 666. The original Dooms and Duke Nuken 3D were the first games I played on a network (it was experimental, over PPP, but the bandwidth was too low for actually playing.)
Anyway, enjoy today and wait for the antichrist!
Friday, June 02, 2006
Wall-socket PC
A very cool thing I saw on Slashdot. It's a thin client PC, with the size of a hand. Just look at the picture. I think all the ports and connectors take more room than the chips!
Subscribe to:
Posts (Atom)