Archive for the 'Fun' Category

News of the World

M. and I were just talking about how much the web has changed our lives. She can now find, read and print scientific articles for her work via large databases on the web; articles from bonafide, peer-reviewed magazines, that sometimes are not even published on paper anymore. In my own work, the web is indispensable as well: JavaDocs can be downloaded but are just as easily accessed online; and for most programming problems or weird error messages there’s an answer to be found via Google. We are all connected to an immense network of information and experience; connected to the world, it feels like. Next thing, I open up Bloglines, start reading the first post and wind up on this website (made in Holland I am proud to say) where the world map literally cries out its news flashes as they happen. Yesterday Campfire, today this; what will I find tomorrow? I love the web.



Screenshot from What’s Up. I guess, for Dallas, this is world news…

2006-02-18. No responses.

Ruby’s Exclamations: A Dream Come True

After writing the post about exclamation mark methods in Ruby yesterday evening, I couldn’t get to sleep (lesson learned: don’t go straight to bed after blogging). My mind was still churning away over the whole issue. And just before I fell asleep, in the short period of time when a lucid state of geniality bordering on insanity sometimes befalls you, when either the greatest ideas or the worst flops come to you — I dreamed up this code.

srand Time.now.to_i

class Ruby
    S = ['yes', 'no', 'absolutely not',
        'of course', 'you already know', 'of course not',
        'who knows?', 'I guess so...', 'I guess not...',
        'maybe', 'perhaps', 'certainly not',
        'positively so', 'try google', 'who cares?',
        'why not?', 'the answer is in your heart',
        'we may never know for sure']
    def self.exclamation_mark!
        @@r = rand
        Ruby
    end
    def self.is_redundant?
        q = @@r * S.size
        S[q]
    end
end

puts Ruby.exclamation_mark!.is_redundant?

2006-01-23. No responses.