My first dalliance with variadic templates

I just hacked together some code that I believe folks will find useful. It takes advantage of c++11’s variadic templates.

bool inList(T a) { return false; }

bool inList(T a, T b, Args... args)
if (a==b) return true;
return inList(a,args...);

You can use it to say something like:

int v = 23;
if (inList(v,12,55,23)) { do_something(); }

I wrote it in response to code I’ve had to write which repeatedly had to compare a variable against several alternatives.

Related Posts:

  • No Related Posts
Posted in Programming | Tagged , | Comments Off on My first dalliance with variadic templates

Rethinking Adric

I have been rethinking Adric lately. I don’t mean a complete 180 on my thinking, but rather a refinement. Perhaps he isn’t the utter tool I originally believed, but rather that he is in it entirely for the Lulz.

I have had friends tell me that Adric isn’t so bad and I should give him a second chance. I have always held him directly responsible for the death of the 4th Doctor. In the finale of Logopolis, it is when the Doctor looks down at his companions below that he makes the decision to let go of the telescope and fall to his death. I have always felt that he couldn’t tolerate one more moment with his current companions. His persona at the time couldn’t stomach cold-bloodedly pushing them out into the vacuum of the continuum, so perhaps he felt that his next regeneration could handle it better. It was practically suicide.

Adric was smart. He earned his gold star in maths. I think he did it all for the lulz.

Related Posts:

  • No Related Posts
Posted in Humour | Tagged , , | Comments Off on Rethinking Adric

TestNG Confusion

I love me some TestNG, yes I do, but recently it went completely haywire on a test…

Expected :null
Actual :null

at org.testng.Assert.failNotSame(
at org.testng.Assert.assertNull(
at org.testng.Assert.assertNull(
at com.comapny.tests.SimpleTest.testExpectedNull(

Expected null, actual null? Well those look the same, how can they not be? Simple. I was doing a conversion with String.valueOf.

defaultValue = String.valueOf(defaultValue);

The valueOf(null) is the literal string “null”, something that looks the same in any printed representation. Checking for an actual null, instead of converting it, solved the problem. Like so:

defaultValue = (null==defaultValue) ? null : String.valueOf(defaultValue);

Related Posts:

Posted in Programming | Tagged , , , | Comments Off on TestNG Confusion

A Handy Tip

If you have a RocketFish 90W Universal AC adapter for your laptop and you have a Gateway NV7309u, then the correct tip appears to be 32. They do not have this combination listed in their documentation, so I had to bust out a meter and check the voltages and polarity. I’m putting this here so others who have a similar set up can benefit.

Related Posts:

  • No Related Posts
Posted in How I Roll | Tagged , , , | Comments Off on A Handy Tip

The Path to Faith

Ahhh… science…

On the perceived conflict between science and religion, how pondering the imponderable can be a path to faith:

There once was a man from Trinity,
Who took the square root of infinity.
The number of digits
gave him the figits
So he dropped maths and took up divinity

Related Posts:

  • No Related Posts
Posted in Final Thought, Humour | Tagged , , , | Comments Off on The Path to Faith

Works On My Machine

In a similar vein to my last post, John Grueber suggests the following label be added to software so that folks know that it did work when you tested it.

Related Posts:

  • No Related Posts
Posted in Humour | Tagged , | Comments Off on Works On My Machine

Top 20 Programmer Replies

I don’t have a source for this, it is in my old “humour” files.

  1. “That’s Weird…”
  2. “It’s never done that before.”
  3. “It worked yesterday.”
  4. “How is that possible?”
  5. “It must have a hardware problem.”
  6. “What did you type in wrong to get it to crash?”
  7. “There is something funky in your data”
  8. “I haven’t touched that module in weeks!”
  9. “You must have wrong version.”
  10. “It’s just some unlucky coincidence.”
  11. “I can’t test everything!”
  12. “THIS can’t be the source of THAT.”
  13. “It works, but it’s not been tested.”
  14. “Somebody must have changed my code.”
  15. “Did you check for a virus on your system?”
  16. “Even though it doesn’t work, how does it feel?
  17. “You can’t use that version on your system.”
  18. “Why do you want to do it that way?”
  19. “Where were you when the program blew up?”
  20. “I thought I fixed that.”

Related Posts:

  • No Related Posts
Posted in Humour | Tagged , | Comments Off on Top 20 Programmer Replies


I’ve noticed that when I’m down, I invariably start using liquid Dr. Bronner’s soaps instead of the bar kind. My favorite Dr. Bronner bar is lavender, but it doesn’t compare to liquid Peppermint.

See, Dr. Bronner was this guy who lost his wife, went blind, and then had this revelation where God told him to create the perfect soap. And he did. At least, I think the soap rocks… not just because it’s great soap, but because of the psychotic rants about how the only cosmetics you need are this soap and enough sleep, and being clean will unite the whole world in a single faith created on the foundations of the Moral ABC.

Now, I don’t buy all of that, but it’s a fun read, and the soap leaves my all of my parts feeling keen and tingly. All of them. That’s the peppermint oil, I suppose. Anyhow, check out the website, they’ve got the labels for all the soap for download. Not only that, but it’s made with hemp oil. I mean, they call the guy “THE POPE OF SOAP”, how can you beat that?

Related Posts:

  • No Related Posts
Posted in Humour, Incoherent Ramblings | Tagged , , , | Comments Off on ALL-ONE!

Final Thought: Candidiasis


The term “candidiasis” refers to an infection with yeast, usually Candida albicans. Do not do a google images search on the word. It will give you unspeakable terrors. Seriously.

In any case, awhile back, I went on a slight bender… if a word rhymed with yeast, it got replaced with the term. This led to such wonderment as:

  • Beauty and The Yeast
  • Maggie and The Ferocious Yeast
  • The Number of The Yeast
  • Sexy Yeast
  • The Yeast Within
  • Walking with Prehistoric Yeasts
  • Futurama: The Yeast with a Billion Backs
  • Shadow of The Yeast
  • Legacy of The Yeast

Beauty and The Yeast works particularly well, as I can just envision Angela Lansbury belting out a ditty about it…

Related Posts:

  • No Related Posts
Posted in Final Thought, Humour | Tagged , , | Comments Off on Final Thought: Candidiasis

Miracle Fruit

Synsepalum dulcificum 091109-0970

Unlike beans, the musical fruit, Synsepalum dulcificum is the “Miracle Fruit”. It alters the way foods taste to seriously jack up the sweetness! I was asked about it recently, and sadly haven’t tried it yet. Although I can’t talk with authority yet, here’s what Wikipedia has to say about it:

The Miracle Fruit Plant, sometimes known as Miracle Berry, Magic Berry, Flavor Berry (Sideroxylon dulcificum/Synsepalum dulcificum) is a plant first documented by an explorer during a 1725 excursion to its native West Africa. Marchais noticed that local tribes picked the berry from shrubs and chewed it before meals. The plant grows in bushes up to 20-feet high in its native habitat, but does not usually grow higher than ten feet in cultivation, and it produces two crops per year, after the end of the rainy season. It is an evergreen plant that produces small red berries, with flowers that are white and which are produced for many months of the year. The seeds are about the size of coffee beans.

The berry is sweet, and contains an active glycoprotein molecule, with some trailing carbohydrate chains, called miraculin. When the fleshy part of the fruit is eaten, this molecule binds to the tongue’s taste buds, causing bitter and sour foods (such as lemons and limes) consumed later to taste sweet. This effect lasts between thirty minutes and two hours. It is not a sweetener, as its effects depend on what is eaten afterwards, but has been used to cause bitter medicine to taste sweet.

Related Posts:

  • No Related Posts
Posted in Biogeekery | Tagged , , | Comments Off on Miracle Fruit