There\

2009-06-08

Keep libel laws out of science

Ok this is bad, a scientist, Singh, criticizes the The British Chiropractic Association because they insist they can cure ear infections among many other bogus claims. Those were his words

In the world of science when somebody criticizes the proper response is to show your research. Not for the BCA, they sued him for libel, the most ridiculous part is that right now the Singh is losing because the judge decided that when Singh sayd bogus claims he meant they are knowingly fraudulent, and Singh can't posibliy know that.

Yes that's right the BCA best defense against criticism is that you can't prove you are knowingly fraudulent.

And you kown what it means? It means I'm adding another button to my blog.

There. See ya later!


2009-05-27

ObjectMap

I like how Python ensures no library messes with my built-ins. The fact that neither I can monkey patch built-ins is however a pain, interestingly while built-ins can't be extended they can be decorated/overriden, and lo I present unto you, ObjectMap.


class ObjectMap(object):
def __init__(self):
"""Did you look what I did there?"""
self.map = map
def __call__(self, *args, **kwargs):
"""The original map call"""
return self.map(*args, **kwargs)
def __getattr__(self, name):
"""map.name(sequence, args) == [item.name(args) for item in sequence]
Here is the fun part"""
def fn(seq, *args, **kwargs):
return self.map(lambda item: getattr(item, name)(*args, **kwargs) , seq )
return fn
map = ObjectMap():
words = "red green blue".split()
WORDS1 = map(lambda word: word.upper(), words)
WORDS2 = [word.upper() for word in words]
WORDS3 = map.upper(words)
assert WORDS1 == WORDS2 == WORDS3


Needless to say, this shouldn't be used in production code (so use it copiously).

2009-05-17

CriticalExistenceFailure

Dicese del fenomeno que ocurre cuando un personaje de videojuego al que le queda un punto de vida muere inmediatamente al sufrir el mas minimo daño, pese a que estaba corriendo brincando y peleando perfectamente bien un instante antes...

Metal Gear Solid is legendary for a particular use of this - Solid Snake has cigarettes, which allow him to see hidden laser traps and keep his hands steady while sniping, at the cost of his HP bleeding down slowly. It's impossible for Snake to smoke himself to death - a small blip of health will always remain - but then, if he gets so much as touched, he dies (presumably of spontaneous lung cancer).

2009-05-05

The hairy dilemas of SF

 I read an awesome post about SF as a genre, specifically about how the terms Space Opera and Hard SF are often misused.

 The author mentions that Ian M. Banks' The Culture is mislabeled as Hard SF because it seems well written, but fails at teaching you any science.

 I was going to argue but after making an excellent case I now concur with the author.

 There are only a couple points of disagreement. At some point the author suggests that the difference between a Science Fiction story  and a "Space Fantasy" story, like Star Wars is that a real Science Fiction story is one that cannot be told in a different context, actually, I'll quote it:

I submit the critical test of whether a story is Science Fiction is; “Could you tell this same story in another genre?” If the answer is “no,” then it’s Science Fiction.

There, so, this is the part that bugs me, because, Clarke's Third Law implies that any story can be easily ported from one genre to the other. So, it's not that simple. You can replace any SciFi element with a Fantasy analogy. The question is not if you can, but, if you want. That to me is one of the great things about SciFi. SciFi is not different from Fantasy for the way it accomplishes its "magic" but because what particular "magic tricks" it chooses to use.

The thing is, science is a sportspoil. Compared with the infinite flexibility of Fantasy, science will force you to go certain routes that make storitelling awkwards for some writers.

For instance, let's say you preffer swords to guns. Thaks to Clarke's Third Law you can make the laser o magical swords, and you can make contrived explanationsfor why the characters aren't using guns in any setting. But in a SciFi setting, it wouldn't be believeable, it wouldn't be realistic.

SciFi has to be realistic and that puts a huge burden on what you can or have to do. Depending of the time frame and setting, good SciFi forces you to consider bioterrorism or AI or transhumanism, and at the same time prevents you from using cool stuff like swords.

This is to me the key difference between Science Fiction and Space Fantasy.

2009-05-03

Ubuntu file renamers

 I was planning to do an in-deep review of file renaming tools for Ubuntu, but instead I'll do a quick review.

 The best opensource file renamer for Gnome is Mètamorphose. It's hosted in Sourceforge, not the Ubuntu repositories, but still open source so it's cool, there is a deb file so it's super easy to install.

 It does, everything. It only lacks an scripting language but then again if you have python (or specially ipython) you have unlimited power, provided you are ready to write your own scripts and do your own rollbacks.

 It even does time  and date based renaming. And has plenty of options for special case selecting/unselecting, sorting, etc...

 It also has the best file browser, it doesn't have a context menu option in nautiulus but you can make your own one with the Nautilus Actions Configuration Tool.

 The only weird thing I've found is that trimming/croping is done with the options Search>Position>Replace>(empty string), but that's all.

 Now if you don't want to use software outside of the repositories (but it's worth it!) use PyRenamer.

 PyRenamer's file browser does use the theme icons but it doesn't show dot files/folders, it doesn't do regex. It has most of the options you could need, really, I do a lot of heavy duty renaming so PyRenamer was not enough for me, but it could be all you need.

 But, just the better file browser is enough to pick Mètamorphose.

 GPRename is a Perl/GTK+ option, but it's inferior to PyRenamer in every way, it doesn't do regexes, doesn't use icons at all, it can't HIDE dot files, this makes the file browser useless, it can't process directories and files at the same time, it has less options. Just no.

 Purr is the cutest of the file renamers here, it uses a little window with drag and drop support, which is cute and actually allows you to do renaming of files in disparate directories.

 But is doesn't provide any dynamic text modification options. It can add indexes without zero pading, it can change all extensions to another one, and it can replace every file name with a fixed string (plus an index number) it's simply not useful.

 So there it goes, after 221 days of delaying it I'm blogging about file renamers in Ubuntu.