| I like Ruby |
[May. 26th, 2006|02:51 pm] |
Today merlyn (Randal Schwartz) posted this tidbit. Here it is in Ruby:
File.open('pidfile', 'w+'){ |fh| fh.print Process.pid }
Shorter, yet clearer - and that's the long version! I could have used '$$' instead of Process.pid, but I prefer readability. Even if you don't know Ruby you can still read this. I doubt you could say the same for Perl.
Yes, I like Ruby.
Update: As dagbrown pointed out on IRC, the Perl version leaks handles and uses Perl's autoflush feature. I also updated the code slightly to use print instead of puts, since you probably don't want a newline there. |
|
|
| Web 2.0 (TM) alternatives |
[May. 26th, 2006|06:36 pm] |
| [ | mood |
| | amused | ] | In light of the fact that O'Reilly is now claiming a trademark on the phrase "Web 2.0", I've decided to come up with some alternatives:
* Web: The Next Generation * Web::NG * Web++ * HAWC - HTML/Ajax/Web/CSS * Ultra Rich Web Content * Really Cool Stuff You Can Do With Web Pages
Ok, I'm floundering. In the meantime I'm off to trademark "Web 3.0". Gotta think ahead! |
|
|