22
Sep 08

Thomas Keller’s Midnight Snack

I keep forgetting where this is. It’s Thomas Keller of the French Laundry, Bouchon, and Per Se. The voice-over inflates the sandwich (world’s greatest?), but it does look mighty tasty.

19
Sep 08

Body Navigation – Play Pong, get Fit!

I’m a big fan of Processing, and who can complain about a project involving dancers, a choreographer, and a programmer? I love the pong part. I gotta defrost my projector sometime and see what I can do with it.


Body Navigation by Recoil Performance Group from ole kristensen on Vimeo.

13
Sep 08

That’s not XTC! iTunes Store Feature Suggestion

I use the iTunes Store as a way to find and preview music, and I’ve purchased quite a bit of music and TV shows through it. I’ve seen several cases where music has been mis-labeled or mis-categorized. For example, the last two albums on this page for the UK band XTC:

I’m not the only one who noticed this particular problem.
More…

08
Sep 08

Batch Compiling with Aquamacs Emacs

I needed to batch compile some files recently, and I had to lookup how to do this with Aquamacs. It’s pretty simple. If Aquamacs is at /Applications/Aquamacs, then this will work:

/Applications/Aquamacs\ Emacs.app/Contents/MacOS/Aquamacs\ Emacs -nw -batch -f batch-byte-compile /path/to/elisp-file.el

05
Sep 08

Confusion Over Triple Equals (===)

Doesn’t everyone have concepts that they can’t keep organized in their heads? I frequently get values for certain keys mixed up in my head, especially ones that I don’t use very often. At the Lone Star Ruby ConferenceGreg and I were talking about the triple equals operator in Ruby recently (===), and I confused my notion of it in Ruby with what I thought was its function in Perl. Obviously I don’t use it very much. Hopefully I can clear this up though.

In Perl, there is no triple equals operator, based on the perlop Perl operator documentation. I was really mixing things up there.

In PHP, the triple equals operator is used to test whether two things have the same value and type, according to the PHP Manual.

<?php
    $a = "1";
    $b = 1;

    if ($a == $b) {
      print "$a == $b";
    }

    if ($a === $b) {
      print "$a === $b";
    }

?>

This code prints

1 == 1

In Ruby, triple equals (Object#===) is, “effectively the same as calling #==, but typically overridden by descendants to provide meaningful semantics in case statements,” based on the Object class documentation. So, for classes like Array, #=== is effectively the same as #==. I say effectively since I haven’t actually perused the source of array.c, though you can see in object.c that rb_equal (===) calls == and then checks id_eq if that doesn’t return true. And in the case of your own objects, triple equals can be used to provide your own equality tests for case statements.

04
Sep 08

Emacs Lisp – Block Commenting Ruby Code

These days I’m working to become proficient in Emacs (I’ve recently switched from Vim, as Greg mentioned on his blog). With that comes all kinds of things like org-mode, yasnippet, and lots of keyboard combinations.

A part of this current effort I’m learning Emacs Lisp right now. There’s probably a better way to do block comment cycling in Ruby, but this was good practice on writing some simple elisp functions.

(defun ruby-comment-region ()
  "In Ruby, comment out the current region with =begin/=end statements."
  (interactive)
  (save-excursion
    (goto-char (point))
    (insert "=end")
    (goto-char (mark))
    (insert "=begin\n")))

(defun ruby-uncomment-region ()
  "In Ruby, uncomment the current region -- remove =begin/=end statements."
  (interactive)
  (save-excursion
    (if (re-search-backward "^=begin")
        (replace-match ""))
    (if (re-search-forward "^=end")
        (replace-match ""))))
03
Sep 08

Bomomo for a bit of fun

If you’re in need of some doodling, try out Bomomo. I like the mass transit map feel that some of the drawing tools have.

And you can save your drawings too.

28
Aug 08

A Little Cluetrain Reminder

I was in a local Target the other day and I saw this improvised product review:

Isn’t it fairly clear that the Cluetrain people have a point? People are going to talk about your products, your company, your reputation. Corporations can’t stop that, and technology further empowers these kinds of exchanges. Corporations should work to foster the conversations and to be a part of them.

24
Aug 08

Squared Euclidean Distance on Hashes in Ruby

For some simple analysis I’m doing, I needed a routine to calculate squared Euclidean distance in Ruby on two hashes. The squared Euclidean distance d2 between two n-dimensional vectors x1 and x2 is:

Formula for squared Euclidean distance

I needed this calculation for values corresponding to the intersection of the set of keys for two hashes. I came up with a couple of ways to do this.

More…

21
Aug 08

Life Imitates Video Games?

As the recent conflict between Russia and Georgia has unfolded, faint but distinct memories of mine were triggered. Russia invades Georgia in 2008? Fighting in Tbilisi? Wait a minute—I know this!

Ghost Recon

(Image: shanewarne_60000)

It’s eerily (well, vaguely) close to the storyline of the original Ghost Recon, even the year.

« Older Entries
Newer Entries »

Copyright © 2010 ANDY PAYNE
Powered by WordPress and Theme Lab