备忘:linux下文件名中出现空格的处理

find 中的print0会使用nul字符来做分割结果。 xargs中又-0参数,可以获取结果。 find . -type f -print0 | xargs -0 -I {} mv {} {}.bak 一些复杂的处理可以用while+read来做 /usr/bin/find /usr/dirName -type f -mtime 0 \ | while read LINE; do cp -rf "$LINE" /home/BackupDirName done 我处理sony 505阅读器里的文件,为了防止丢书,需要给每个文件名前加个英文字符。 ...

January 4, 2010 · notsobad

I want to learn haskell.....

http://learnyouahaskell.com 今天看到这个网站,很有意思,技术的网站也能做的这么可爱。 是一个haskell的教程,看了这个导致我对haskell也有点兴趣了,呵呵,想学下。 其它一些资源 http://zh.wikipedia.org/wiki/Haskell http://zh.wikibooks.org/zh/Haskell

January 4, 2010 · notsobad

灌水

这才叫灌水,往SCI里灌水…… http://news.163.com/10/0104/06/5S5PCGUR0001124J.html

January 4, 2010 · notsobad

2010.1.3 备忘 django的get_absolute_url

django的get_absolute_url,还是挺有用的。 参考[这里](http://docs.djangoproject.com/en/dev/ref/models/instances/#get- absolute-url) from django.db import models @models.permalink def get_absolute_url(self): return ('people.views.details', [str(self.id)]) Or: (r'/archive/(?P<year>\d{4})/(?P<month>\d{1,2})/(?P<day>\d{1,2})/$', archive_view) @models.permalink def get_absolute_url(self): return ('archive_view', (), { 'year': self.created.year, 'month': self.created.month, 'day': self.created.day})

January 3, 2010 · notsobad

推荐韩娱《青春不败》

昨天晚上11点发现的这个娱乐节目。一连看了七集,到今天凌晨6点才睡的觉。 故事背景是:集合了几个当红美女组合中的若干成员,到首尔附近的一个村庄自力更生体验生活。让这些一直以来生活在聚光灯下的明星们体验一下农村的真实生活。 故事中。美女们需要团结协作,自力更生。通过帮助当地农民干活来换取一些生活必需品。自己做一些食物到市场去卖。其中不乏搞笑的片段。 故事中的主要明星有: 金泰宇(男) 金申英(女) Yuri(少女时代) sunny(少女时代) 荷啦(KARA ) 善花(Secret) 孝敏(T-ara) 玄雅(4minute) ...

January 3, 2010 · notsobad

How many things happened when I am sleeping?

又下雪了,今天12点多醒的时候,感觉窗户外边很亮,一看果然是下雪了。出去买东西的时候顺便拍了几张雪景的照片。 雪下的很大,已经可以埋住脚了,路上也堆满了积雪。 这三天每天都睡到12点以后,在我睡着的时候发生了多少事情啊!

January 3, 2010 · notsobad

Python不是java

Python不是java 同样,php也不是java, 用一种语言的思路来写另一种语言的代码,最后肯定是四不像。 有感。 原文: I was recently looking at the source of a wxPython-based GUI application, about 45.5KLOC in size, not counting the libraries used (e.g. Twisted). The code was written by Java developers who are relatively new to Python, and it suffers from some performance issues (like a 30-second startup time). In examining the code, I found that they had done lots of things that make sense in Java, but which suck terribly in Python. Not because “Python is slower than Java”, but because there are easier ways to accomplish the same goals in Python, that wouldn’t even be possible in Java. So, the sad thing is that these poor folks worked much, much harder than they needed to, in order to produce much more code than they needed to write, that then performs much more slowly than the equivalent idiomatic Python would. Some examples: * A static method in Java does not translate to a Python classmethod. Oh sure, it results in more or less the same effect, but the goal of a classmethod is actually to do something that’s usually not even possible in Java (like inheriting a non-default constructor). The idiomatic translation of a Java static method is usually a module-level function, not a classmethod or staticmethod. (And static final fields should translate to module-level constants.) This isn’t much of a performance issue, but a Python programmer who has to work with Java-idiom code like this will be rather irritated by typing Foo.Foo.someMethod when it should just be Foo.someFunction. But do note that calling a classmethod involves an additional memory allocation that calling a staticmethod or function does not. Oh, and all those Foo.Bar.Baz attribute chains don’t come for free, either. In Java, those dotted names are looked up by the compiler, so at runtime it really doesn’t matter how many of them you have. In Python, the lookups occur at runtime, so each dot counts. (Remember that in Python, “Flat is better than nested”, although it’s more related to “Readability counts” and “Simple is better than complex,” than to being about performance.) * Got a switch statement? The Python translation is a hash table, not a bunch of if-then statments. Got a bunch of if-then’s that wouldn’t be a switch statement in Java because strings are involved? It’s still a hash table. The CPython dictionary implementation uses one of the most highly-tuned hashtable implementations in the known universe. No code that you write yourself is going to work better, unless you’re the genetically-enhanced love child of Guido, Tim Peters, and Raymond Hettinger. ...

January 2, 2010 · notsobad

How about xml?

Some people, when confronted with a problem, think “I know, I’ll use XML.” Now they have two problems.

January 2, 2010 · notsobad

爱上生活爱上你

爱上生活爱上你 http://v.youku.com/v_show/id_XMTE3MTQ5NzMy.html 每天早上都被这个给吵醒。。。。。

January 1, 2010 · notsobad

2010.1.1

2010年1.1日 一年的第一天,不知道今年会怎么样 关于2009,Dot’t ask, Don’t tell.

January 1, 2010 · notsobad