What the heck, ruby?

irb(main):004:0> {1 => 3, 3 => 5, 5 => 1}
=> {5=>1, 1=>3, 3=>5}
irb(main):005:0> puts {1 => 3, 3 => 5, 5 => 1}
SyntaxError: compile error
(irb):4: syntax error, unexpected tASSOC, expecting '}'
puts {1 => 3, 3 => 5, 5 => 1}
	from (irb):4
	from :0
irb(main):006:0> VERSION
=> "1.8.7"

I would understand, that a TypeError or anything similar occurs (“cannot put hash”), but syntax error?

What the heck, ruby?

Hjernevask documentary

In the TU Graz flames newsgroup somebody mentioned a Norwegian documentary about the differences of the sexes. Produced by Harald Eia and Ole Martin Ihle, in the documentary “Hjernevask” (engl. Brainwashing) several researchers and people from the streets get interviewed about certain aspects of our social lifes regarding genders. It consists of 7 parts:

  • The Gender Equality Paradox
  • The Parental Effect
  • Gay/Straight
  • Violence
  • Sex
  • Race
  • Nature or Nurture

It can be watched (Norwegian sound and English subtitles) on dailymotion. One little remark: It’s astonishingly frustrating how scientists insists that scientists with different opinions do bad scientific work.

Hjernevask documentary

OpenPGP verification failed after copy and paste of newsgroup posting

Tags: OpenPGP, GnuPG, C&P, copy and paste, signature, clearsign, newsgroup

I thought the following workflow is fine:

  1. Write a message as plain text file on your local machine as store it in a text file msg.txt
  2. Run gpg --clearsign msg.txt
  3. Copy the data from msg.txt.asc to Thunderbird and paste it for the new newsgroup posting
  4. Send the newsgroup posting to the server

Apparently, what you get back is Error – signature verification failed; click on ‘Details’ button for more information. This sucks and here is the reason why it fails:

If you write your text file, you won’t write the message in lines of maximum length 80 characters. The signature is created for those lines. If you now copy and paste it Thunderbird will display the message in a way which is still valid (from a cryptographic POV). However, when you send it, Thunderbird will break the lines and modifies the message. This break the signature and this is why you receive the error.


  • Use EnigMail
  • Don’t clearsign messages with lines with more than 80 characters.
OpenPGP verification failed after copy and paste of newsgroup posting

boxFilter and InputArray / OutputArray in OpenCV

Tags: OpenCV, cv::boxFilter, boxFilter, Mat, InputArray, OutputArray

Usually, such functions take Mat as parameters, but in some cases it’s more convenient to use std::vector<> (for a point set, for example) or Matx<> (for 3×3 homography matrix and such).

via opencv documentation

Well, boxFilter does not accept a Mat instance. However, images are usually represented as Mat matrices. So what is the correct datatype to provide an image as input data and get a Mat instance back?

Here is the solution:

    const cv::Mat& in = some_mat_instance;
    cv::Mat out;
    cv::boxFilter(in, out, ...); // whatever parameters you want to supply
boxFilter and InputArray / OutputArray in OpenCV