Applied computer science
Friday, May 22, 2009
"Don't worry about people stealing an idea. If it's original, you will have to ram it down their throats." It looks like one of those optimistic sentences that are supposed to lift spirits. And some people must believe in it, I suppose, because otherwise it would not circulate.
Each time I stumble upon it, it reminds me of NP problems. In general: finding a creative solution to a problem seems to me to be a lot like finding a solution to an instance of a NP problem.
Just a reminder, an NP problem is such for which there exists a nondeterministic Turing machine solving it in polynomial time. Most people think that P!=NP, so problems that are in NP and not in P require exponential time to solve, but just polynomial time to check if a solution is correct.
So here, a whole class of problems, for all of which it is hard to find a solution, but easy to see that a given solution is good. Boy was it worth taking those computational complexity classes at the university ;).
Sony PRS 505 ebook reader review
Saturday, May 16, 2009
I use Sony PRS 505 for more than a month now (see how it compares with other readers). It came with 100 classic books, all of which look very tempting. I have already read over 1000 pages of David Copperfield.
(BTW, the Reader shows the beginning of the first chapter of the new "IronPython in Action" book, by my colleagues Michael Foord and Christian Muirhead.)
They say that the battery life is 5000 page turns, but mine died after about 1000 pages of mentioned David Copperfield. I have been playing with it, and sometimes going back and forth, but for sure that was not 4000 page turns worth of playing. Anyway, the battery life is very good, but the 5000 page turns is misleading at best.
The device comes with software for windows. It is not really a problem for a Linux user, because you can mount the reader like a usb stick, and copy the books directly - that is how I do it at least. There is calibre project that is supposed to be heaps better software for the reader than the official one, but it doesn't start on my system and I don't see any reason to investigate -- I'm fine with cp.
I have it for over a month and think it was worth every single pound I payed for it. I write the review now, because I have finally bought an ebook on-line and put it on the reader. That feels right. Although, in the meantime I had to buy one dead tree book simply because there was no ebook available. Hopefully that will not happen often as amazon's Kindle gains popularity.
My biggest wish is that the screen was larger. Looks like the upcoming Kindle DX is going to be the right size, though it is going to have a lower resolution than the Sony Reader. I bet that other manufacturers are already working on a larger version to compete with DX.
The small size is not really right for books with code and mathematical formulae (most cs papers and technical books). I found that putting the reader into horizontal mode (buried down in the settings) helps a lot with that.
Labels: review
Unlock Huawei E220 - soap on a rope
Sunday, May 10, 2009
I have successfully unlocked myself a T-Mobile Huawei E220 modem. I followed the tutorial at unlockE220.com. However, at step 4 I could not find the specified string. I suspect that might be due to firmware upgrade on the device. Anyway, I have worked around it, so please follow the tutorial, and if you get stuck at step 4, read what follows here.
The unlock code is supposed to be string of 8 digits. First let's find all the strings in the Flash.bin, created in one of the former steps; I used the strings command line program (in cygwin) to do it.
strings Flash.bin > 'code-candidates.txt'
Now, the code-candidates.txt contains all the strings, one per line. We are only interested in the ones composed from digits and at least 8 character long. Here is a python code that reads the file and prints all possible codes.
for l in open('code-candidates.txt').readlines():
l = l.strip()
if not all(map(lambda x: x <= '9' and x >= '0', list(l))):
continue
if 8 <= len(l):
print l
Assuming you saved the above code fragment as find.py, the command line to print the codes is:
strings Flash.bin > 'code-candidates.txt' python find.py
In my case it printed 10 or so codes. Try them with the unlock program provided at unlock220.com. Surprisingly, the unlock program reported success for 3 of the codes, but only after I tried the last one had my sim card got accepted.
Popular
- Beautiful Code: Resolver One
- Debugging memory leaks in IronPython apps
- Why Vim's modes frustrate newbies
- Four-monitor desktop
- xmonad
- Antipattern: static subject to observer map