Sat 13 October, 2007

add to del.icio.us. look up in del.icio.us.
add to furl
add to del.icio.us. look up in del.icio.us.
add to furl
add to del.icio.us. look up in del.icio.us.
add to furl
This release closes a JSON XSS vulnerability, fixes a couple of minor regressions introduced in 1.2.4, and backports a handful of features and fixes from the 2.0 preview release.
All users of Rails 1.2.4 or earlier are advised to upgrade to 1.2.5, though it isn’t strictly necessary if you aren’t working with JSON. For more information the JSON vulnerability, see CVE-2007-3227.
Summary of changes:- acts_as_list: fixed an edge case where removing an item from the list then destroying the item leads to incorrect item positioning
- deprecated calling .create on has_many associations with an unsaved owner (like post = Post.new; post.comments.create)
- backport array and hash query parameters
- fix in place editor’s setter action with non-string fields
- updated config/boot.rb to correctly recognize RAILS_GEM_VERSION
To upgrade, `gem install rails`, set RAILS_GEM_VERSION to ‘1.2.5’ in config/environment.rb, and `rake rails:update:configs`.
add to del.icio.us. look up in del.icio.us.
add to furlFri 12 October, 2007

add to del.icio.us. look up in del.icio.us.
add to furl
在InfoQ China发了一篇介绍XRuby的文章。其实,对于之前听过我介绍XRuby的人来说,这篇文章的内容并不新鲜,因为基本上,这篇文章的内容脱胎于之前介绍XRuby的讲稿。虽然讲了几次,但还是应该把这篇文章写出来。一来,到场听介绍的人毕竟是少数,写出来看到的人应该可以更多,也让更多的人有机会了解XRuby,再有,内容写成文章需要比演讲时有更多的思考。所以,整体来说,内容叙述应该会更加准确。
这是一篇早就该写的文章,至少最初答应霍泰稳写这篇文章还是5月份的时候,7月份录我InfoQ访问的时候,又答应了Floyd完成这篇文章,可真正发布已经是十月份了。不过,这样一拖再拖也不是完全价值。在这段时间里,我在Agile Day讲了一次Ruby on JVM,让我对这个方面有了些新的思考,特别是把Ruby放在 JVM上的价值,这一点已经体现在这篇文章里了。另外,XRuby自身在这段时间中也发生了很大的变化,特别是Annotation的加入,让代码在表现形式上得到很大的进步。至少在我看来,最终体现在文章中的示例代码是可以接受的。
我希望,这篇文章可以成为一个起点。一方面,它可以作为让更多人了解XRuby的起点;另一方面,XRuby团队把它作为一个起点,向其它人展示XRuby中非常优秀的一面。当然,XRuby现在已经有了不少不错的文档。
已经有朋友给我建议,写一些更深入的东西,这也是我所希望的,只探讨一些比较浅的东西不过瘾。在XRuby开发过程中,有很多有趣的思考,我很愿意与人分享那种开发中的快乐。再有,写东西会促使人思考,随之而来的往往是发现不足,这也是有益于XRuby进一步改进的。
如果你希望了解或参与XRuby,不妨告诉我们,你想了解什么,也许,我们之后的文章会满足你!
add to del.icio.us. look up in del.icio.us.
add to furl
add to del.icio.us. look up in del.icio.us.
add to furl
I'm allergic to people who willingly and without irony use the term "potty mouth" in adult conversation. The notion that a word like fuck can make your brain curl up and cry like a toddler is so pathetically disturbing that it makes my skin crawl. It has the plastic smell of a barbie playhouse and the repressed insecurities of casual friday khakis.
I can't fucking stand it.
But at least the potty mouth reaction is a useful leading indicator for personality fits. It's almost as good as the f-bomb reaction. Both are fake euphemisms that are actually much worse than the honest words they're trying to put a fig leave to. And if you're serious about using them, I'm serious about thinking you're too fucking lame to bother further debate with.
Which of course is ironic. Since the whole potty mouth fuzz is about distancing yourself from that foul person on the basis of words. Heh.
But at least us sailors recognize that the sea flows both ways. That by using wonderfully flexible joker words like fuck, we're sending a signal of distance to the inevitable crowd who takes offense from that. The potty mouth crowd seems shocked — shocked — that their language could have a similar effect in the opposite direction.
Anyway, fuck it (how great is this word? I seriously considered naming this post "Fuck: The Mother Word" but in the end my despise of the potty mouth term won out just slightly over my affection for the word fuck).
If you want to dive deeper into the wonderful world of cursing, I highly recommend What The Fuck: Why We Curse by Steven Pinker
P.S.: See also Fuck, a marvelous tour of the utility of this word.
add to del.icio.us. look up in del.icio.us.
add to furlThu 11 October, 2007

add to del.icio.us. look up in del.icio.us.
add to furl
Ad hoc alarm clock
sleep 7.hours %x(open ~/heaven-sent.mp3)
add to del.icio.us. look up in del.icio.us.
add to furl
add to del.icio.us. look up in del.icio.us.
add to furl
I got bitten today by the fact that Objective-C strings in Cocoa programming are not the same things as plain old C strings. The problem is that Objective-C is essentially an object-oriented veneer on top of plain old C; sometimes it matters that you remember this, and other times it doesn't. This was one of the times it mattered.
A little background. A while back I wrote and released ExportToArchive, a somewhat useful plugin for iPhoto. It allows you to select photos from your iPhoto library and export them into a few different archive formats. About three days after releasing it, I got an email from a guy who had just tried to export his entire library, 756 photos, into a single archive. He was perplexed because iPhoto just seemed to hang/lock up. The problem was that when I wrote the thing, I never considered that anyone would try to archive more than a few photos at a time. Thus, once you made your selections and started the export, I copied each file to a temporary directory, and then archived the copies. That works great for 10 or 20 photos, but not so well for 756.
The answer to that problem was not to copy the files, but to make a symlink of each photo into that temporary directory and then archive the files by dereferencing the links. It's still going to take a while to archive the photos, but there will no longer be a copy phase, which should make things faster.
Which leads to today's adventure. There's not a native Obj-C or Cocoa method to create a symlink. There is a method on NSFileManager called linkPath:toPath:handler: but that creates a hard link, which won't span file systems. So I was forced to use the C function symlink which takes two arguments: the source path and the destination path. This seemed easy. I would pass the absolute path name to the original file as the source argument, and the generated name for the link as the second. Easy-peasy.
Well, not really. Since symlink is a C function it, like most other C functions, tells you bugger-all about why a failure occurs. The return value when I tried to call it was -1 which means, "something bad happened." I then had to consult the C value errno to get more info. The value of errno was 22 which, according to the header file errno.h means:
#define EINVAL 22 /* Invalid argument */An invalid argument. OK. How about telling me which argument is invalid since I did, after all, pass in two arguments.
I tried escaping spaces and quoting the entire string, but nothing worked. Finally, it dawned on me: Objective-C strings are not C strings. symlink was expecting a plain old C string, but I was passing in something completely different: instances of the Obj-C class, NSString. So, the way to fix this was to pass in C strings, and how do you get C strings from NSString instances? Right, call UTF8string on them. Thus my call to symlink went from
rc = symlink([source UTF8String], [dest UTF8String]);to
rc = symlink([source UTF8String], [dest UTF8String]);and all seems to be working properly now.
I'm going to do a bit more testing on this, but I will probably release this new version tomorrow.
add to del.icio.us. look up in del.icio.us.
add to furlWed 10 October, 2007

Google has added more cities to its Street View map tool. Among them is Phoenix, AZ.
In fact, you can use this to see the new offices of Rising Tide Software (also home to Tornado Web Design).
Neat.
add to del.icio.us. look up in del.icio.us.
add to furl
看这种一系列的文章很过瘾,还没过足瘾。。。 ...
add to del.icio.us. look up in del.icio.us.
add to furl
计算机能够认识的只是01串,所以,我们编写的源代码要想真正启到应有的作用,必须经过转换,转换成一种可执行的格式,然后,由专门的执行引擎将它运行。
解释,通常是将源代码解析为一个中间形式(比如抽象语法树,AST),然后,经由一个软件的执行引擎执行这个中间形式,产生对应的结果。这种做法的好处就是可以把执行逻辑独立处理,无须为每个平台编写不同的代码,所以,这种做法的可移植性很好,于是,它成了不少程序设计语言最初的选择。不过,随之而来的问题就是这会降低执行速度,毕竟,这个软件执行引擎的性能无法与硬件相比。所以,以硬件作为执行引擎的“编译”会让程序拥有更佳的性能。
采用编译的方式,我们可以将代码编译成可以由硬件直接执行的二进制代码。因为不同硬件和不同操作系统的二进制格式是不同的,所以,如果希望语言得到广泛应用,那便需要针对不同平台实现平台相关的编译器后端,理论上说,这不是一件不能完成的任务,但这意味着巨大的工作量。虽然编译语言的数量不在少数,但事实上,真正能够跨越各种软硬平台的编译语言似乎只有C。
虚拟机的出现让人们找到了在软硬件执行引擎之间的一个折衷。一方面,编译器只要生成针对虚拟机的代码,而不必为各种各样的软硬件平台费心,另一方面,虚拟机不断的优化可以让程序在不受编译器的影响下越跑越快。所以,许多程序设计语言走上了这条路,比如Java,比如Python。这些语言大多采用的是自行设计的虚拟机,但这个做法虽然可以充分的将语言特性与虚拟机结合起来,但无疑也意味着大量的重复工作。Parrot希望成为一个集大成者,为众多动态语言搭建一个共同的平台,只是不知何年何月才能实现它宏大的目标。
Java虚拟机(JVM)的普及为这个问题提供了另外一种选择。因为主流软硬件平台上基本都有自己的JVM实现,所以,只要生成针对JVM的代码——字节码,便意味着可以运行在大多数平台上。当然,虚拟机也是一种软件实现,所以,性能上也会有一些损失。不过,从Java平台的广泛应用也证明了,这样的损失在实践中是可以接受的。随着JVM技术上的不断进步,性能损失越来越小。再者,作为一种为静态语言设计的平台,目前,JVM自身并不支持动态语言特性,所以,要想让动态语言语言运行在上面,需要额外做一些工作,搭建一套支撑动态语言的结构。不过,随着一些动态语言逐渐被移植到JVM上,人们也意识到了这个问题上,开始考虑在JVM中增加动态语言的支持。
除了执行性能之外,编译带来的好处还在于保护源代码。因为解释方式通常不会保留的其中间形式,所以,产品发布意味着将源代码也发布出去。对于需要保护知识产权的公司和个人而言,这是他们所不愿意看到的。通过编译的方式,我们将源代码转成了二进制,这样,源代码可以得到有效保护。当然,破解二进制也是有可能的,不过,那就是另外的故事了。
add to del.icio.us. look up in del.icio.us.
add to furl
Rails For All is doing a Rails conference under the banner of acts_as_conference in Florida from February 8th through 9th. They’re currently open for proposals and you can sign up already too. It’s $100 for the two days.
add to del.icio.us. look up in del.icio.us.
add to furl
add to del.icio.us. look up in del.icio.us.
add to furl
“ What’s it like being you? ”
David Thewlis in Naked
add to del.icio.us. look up in del.icio.us.
add to furl
add to del.icio.us. look up in del.icio.us.
add to furlTue 09 October, 2007

add to del.icio.us. look up in del.icio.us.
add to furl
add to del.icio.us. look up in del.icio.us.
add to furl
add to del.icio.us. look up in del.icio.us.
add to furl
add to del.icio.us. look up in del.icio.us.
add to furl
2. Rhetoric Understatement for rhetorical effect (especially when expressing an affirmative by negating its contrary); for example saying ‘I was not a little upset’ when you mean ‘I was very upset’.
add to del.icio.us. look up in del.icio.us.
add to furl
add to del.icio.us. look up in del.icio.us.
add to furlMon 08 October, 2007

add to del.icio.us. look up in del.icio.us.
add to furl
add to del.icio.us. look up in del.icio.us.
add to furl
add to del.icio.us. look up in del.icio.us.
add to furl
add to del.icio.us. look up in del.icio.us.
add to furl
add to del.icio.us. look up in del.icio.us.
add to furl
add to del.icio.us. look up in del.icio.us.
add to furl
add to del.icio.us. look up in del.icio.us.
add to furl
Halloween is creeping up, and as expected Daniel Davis has captured the mood.
Daniel has created a set of ultra-cool Halloween T-shirts that are not to be missed.
add to del.icio.us. look up in del.icio.us.
add to furlSun 07 October, 2007

“ If you like like, you’re going to love love. ”
Miranda July
add to del.icio.us. look up in del.icio.us.
add to furl
add to del.icio.us. look up in del.icio.us.
add to furl
add to del.icio.us. look up in del.icio.us.
add to furl
JRuby语言内部报道:重要的软件开发混合(Hybrid)技术Swiby
- 项目说明:
Swiby项目可以创建网络应用软件,也可以创建桌面应用软件。 - 项目技术:
Swing技术和JRuby语言 - 项目首页:
http://swiby.codehaus.org/index.html - 什么是混合(Hybrid)?
http://www.lycom.de/past/2007/3/5/DSD-Crasher2007-03-05_230757/
http://www.lycom.de/past/2007/3/27/hybrid-mashups-20070327/
add to del.icio.us. look up in del.icio.us.
add to furl
add to del.icio.us. look up in del.icio.us.
add to furl
add to del.icio.us. look up in del.icio.us.
add to furl
add to del.icio.us. look up in del.icio.us.
add to furl
add to del.icio.us. look up in del.icio.us.
add to furl
add to del.icio.us. look up in del.icio.us.
add to furlSat 06 October, 2007

add to del.icio.us. look up in del.icio.us.
add to furl



