Latest posts.

Useful Windows Apps

Here are some useful windows apps that almost no one knows about, but are just as useful as the most popular ones.

1. Battle Encoder Shirase

http://mion.faireal.net/BES/

BES lets you limit how much cpu a process can use.

BES is different from using the “Set priority” option in task manager, because you can stop a process from using 100% cpu. This is great for limiting programs that use all your cpu when it doesn’t need to. The only downside is that if the program has sound, you will get breakup because of how it works.

2. FTP Drive

http://www.killprog.com/fdrve.html

Use your ftp account like a regular hard drive. No more drag and drop through ftp programs. In my opinion, it could not be simpler compared to samba, nfs, and webdav, which I had problems with windows/linux compatibility.

3. Uniform Server

http://www.uniformserver.com/

Its the fastest way to get an industry grade webserver running on windows. All you really need to do is install and run. It also comes with php and mysql.

One comment... »


When Does Infinity Equal -2?

Remember in school, when your math friend showed you how 1 = 2?
Now you can amuse them too, except it doesn’t involve any math errors like dividing by 0, or the old
 0.99\overline{9} = 1

If you are a math major point your condescending look elsewhere.

Let’s Start

S   = 2^1 + 2^2 + 2^3 + ... + 2^\infty
S looks like it should be infinite right?

2*S= 2^2 + 2^3 + ... + 2^\infty
Multiply both sides by 2.

2S-S = -2^1
Subtract the two equations.

S = -2
???

The math experts told me in an unexcited manner: the explanation is here http://en.wikipedia.org/wiki/P-adic_number.

One comment... »


Chinese Olympics 2008 Scandal

Stryde Hax finds deleted official government documents pointing to fraudulent age revision by the Chinese. These documents are from the “General Administration of Sport of China” in 2006.

The Age Controversy

In the Olympic woman’s gymnastic competition, the participants must be 16 or older. However, some of the Chinese team members clearly look underage.

He Kexin 何可欣 Winner of 2008 gold medal for Uneven Bars

According to current Chinese records on the Olympics websites, her date of birth is 1/1/1992. Many people claim that she is 14 due to provincial news sources that have been censored by the Chinese government.

Google Censorship?

Stryde Hax first searches Google for “site:cn 何可欣 filetype:xls 1994″. He gets one result (http://www.sport.gov.cn/files/jts/reg2006/zctc.xls) and finds out that the file has been deleted. But then he uses the Google “View as HTML” option. It works, but strangely He Kexin has disappeared from the list even though her name was on the search engine summary.

As of posting this, Google has completely removed the entry from its search engine. I laugh inside when I think of their “Do no evil” motto that has won them acclaim.

Searching in the Chinese Google Clone “Baidu”

His next search uses the Chinese search engine which for some reason looks exactly like Google, but in Chinese. Using the same keywords, he finds the damning evidence on the

618,”何可欣“,”女”,”1994.1.1″,”湖北”
The 2nd column is the name “He Kexin”. The 3rd column “Female”. The 4th column indicates that she truly is 14 years old. The 5th is the province “Hubei”.

Here are the links to the documents in the Baidu cache, though I suspect they will be deleted as soon as China wakes up. Link 1 Link 2

In case they do get deleted, I’ve saved the html. And here is a screenshot:

Baidu Cache of Chinese Government Documents showing Kexin to be 14.

Baidu Cache of Chinese Government Documents showing Kexin to be 14.

That’s not all.

If think, oh its just one person, think again.

Yang Yilin 楊伊琳 (center)

Yang Yilin 楊伊琳 (center)

Helping her team win gold with their tiny, and less prone to fall hard body, Yang Yilin is 1 year too young.
Here is the Baidu cache of her age. And a screenshot.

Lastly competitor Jian Yuyuan, is supposedly underage as well. New York Times and other major news outlets found this in official documents within China.

What is sad is that there is no official investigation into this matter. The IOC has said that the passports issued by the Chinese government is proof enough.

Leave a Comment »


Morton Codes

Morton codes (or Z-order curves) are a way to hash coordinates in 1 dimension. This is useful for problems such as “which stores are 10 miles away from me?” without searching through all the stores in existence.

Why Not Use A 2d Array?

You might ask, why not just store the information in a 2d array in C or Java? The problem is caching.

      y=0              y=1         y=2            y=3           ....    y=99
[1,2,3,4...99] [1,2,3,4...99] [1,2,3,4...99]  [1,2,3,4...99]    ....

How a 99×99 2d array could be stored in memory.

Lets say you try to find some stuff closest to x=5, y=1. The cpu then loads the nearby arrays y=0, y=1 and y=2 for speedy access, because that is how modern cpus work. The problem is when you search for a “close” coordinate such as x=5 y=20, its too far away from x=5 y=1.

To you , it looks like its only 19 units away, but in the computer its 19 x 99 units away because each y-array between y=1 and y=20 has 99 slots.

Generating Morton Codes

Generating a Morton number is easy. All you do is convert the x and y coordinate numbers into binary. Then “interleave” the bits to get the Morton number. It does not matter which goes first, but you must be consistent.

Example

-0-0-1 : 1 in binary
1-0-1- : 5 in binary
xyxyxy

100011 : 35 Your interleaved Morton number

My interleave function for python:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
def interleave(x, y):
    result = 0
    position = 0
    bit = 1
 
    while bit <= x or bit <= y:
 
        if bit & x:
            result |= 1 << (2*position+1)
        if bit & y:
            result |= 1 << (2*position)
 
        position += 1
        bit = 1 << position
 
    return result

Using Morton Codes

6 |20  22  28  30  52  54  60
5 |17  19  25  27  49  51  57
4 |16  18  24  26  48  50  56
3 |5   7   13  15  37  39  45
2 |4   6   12  14  36  38  44
1 |1   3   9   11  33  35  41
0 |0   2   8   10  32  34  40
   --------------------------
   0   1   2   3   4   5   6

A table of Morton codes on a 2d graph. The x coordinate is interleaved in front of the Y coordinate.

Now lets say you would like to find all the objects 1 unit away from x=1 y=1. Find the upper bound number by finding the Morton number at x=2 y=2 (12). Then do the same for the lower bound at x=0 y=0 (0). So now you will need to search for any objects from 0 to 12.

This limits the search space. But it is not perfect, so you will have to verify each one manually.

As you can see, the numbers 5, 7, 10, 11 are out of bounds, but are between 0 to 12.

Our 2d Cartesian graph, with the Morton order (Z-curve) in red from lowest to highest. As you can see here, as the Morton number grows, the space covered expands in a zig zag fashion, from the bottom left to right.

You can use Morton codes in higher dimensions as well. For example in 3d, you might interlace coordinates as xyzxyzxyz. Hilbert codes supposedly have better locality, but is harder to compute.

5 comments... »


Javascript Tricks

Javascript enjoys its presence on the internet due to its age and wide support.

Here are some snippets that you may find useful.

javascript:document.body.contentEditable='true'; document.designMode='on'; void 0

Paste this over the url of a webpage, and you will be able to edit the text like notepad. The source code will be updated when you save it as a file. Tested in IE7 and Firefox 3.




javascript:document.getElementsByTagName("embed")[0].SetVariable("moviename.somevariablename", 12345)

This snippet will allow you to change the variable inside a flash movie. To find out what the movie or variable names are, you will need the source code, or use a flash decompiler.

Note that if the flash file isn’t in the “embed” tag, then you will need to find the appropriate tag name.

The [0], indicates that it is the first embed tag on the page. If you are trying to locate the 5th embed tag, then you would replace [0] with [4].

Leave a Comment »


Recaptchas - Internet Torture

Computers were supposed to make our life easier.

With the deluge of spammers these days, more and more websites are using Captchas.
Unforunately, because of fear that spammers have already conquered those, people are now using Recaptchas.

The problem was that spammers were using people to solve them. So even if there is a switch to Recaptcha, the spammers still succeed.

This is a recaptcha I personally encountered. These unreadable blobs are a common occurrence.

It sometimes infuriates me when I fail these a couple times in a row. In addition to making your internet experience even harder, you are being exploited by Carnegie Mellon University. They are using your labor to scan books that their computers can’t read.

Fortunately, you can just type in a single word, and leave the other one blank. However, you can’t tell if its the first or second word. But a 50/50 chance is good enough for me.

For fun, here is a list of 10 horrible captchas:

http://www.johnmwillis.com/other/top-10-worst-captchas/