Archive for August, 2009

What’s wrong with this code?

Saturday, August 29th, 2009

I ran into a subtle an interesting error last week. See if you can spot the error below — and submit your guesses!

I ripped this out of a complex system, and had to add in quite a bit of scaffolding to put the relevant code snippet into some context.  The error is in the while loop — not the choice of string functions, use of naked pointers, return types, or variable names.


class CrtWrappers
{
public:
	static int strcmp(const char *str1, const char *str2, const char *strMessage = "")
	{
		if( !str1 || !str2 )
		{
			throw std::exception(strMessage);
		}

		return ::strcmp(str1, str2);
	}
};

struct thing
{
	char *m_cszJobName;
};

static std::set<thing%gt; collection;  // assume this is populated somewhere

const char * FindThisThing(const char *cpszJobName)
{
	const char * pszReturn=0;

	std::set<thing>::const_iterator citer = collection.begin();
	std::set<thing>::const_iterator citerEnd = collection.end();

	while(citer != citerEnd)
	{
		if(0 == CrtWrappers::strcmp(cpszJobName,(*citer).m_cszJobName), L"cpszJobName")
		{
			pszReturn = (*citer).m_cszJobName;
		}
		++citer;
	}

	return pszReturn;
}

Hollywood ‘Green’

Friday, August 28th, 2009

Now that Green Environmentalism is both Politically Correct and Religiously Acceptable (no matter what kind of church you do or do not attend), everybody is eager to be seen on the bandwagon.  I personally believe there’s a big difference between that which helps the environment, and that which mostly makes it look like you are helping the environment.

Politicians, I’m afraid to announce, tend to fall on the look-what-I-did side of the fence.

Dilbert.com

Don’t get me wrong, by the way. I believe it is our God given duty to care for the planet given into our safekeeping. I also believe that this is one of the few legitimate roles of government, as market forces alone will not preserve the common pond. I object to expensive policies that are based on poor science and are unlikely to accomplish the stated goal. See The Law of Unintended Consequences.

National Debt Road Trip

Friday, August 28th, 2009

“How do the Obama deficits compare with past presidents? And how did the national debt get so big anyway. This video tries to answer those questions by looking at the debt as a road trip and seeing how fast different administrations have been traveling.”
It looks like this video dates from back in May 2009…

The largest dead snake ever found, over 50 feet.

Thursday, August 27th, 2009

My son directed me to this video – a snake of titanic proportions.  It’s really rather startling.

When you are finished, you may hang up, or press one for more options.

Friday, August 21st, 2009

When you are finished, you may hang up, or press one for more options.

Yes, thank you.  Here in the 21st century, we all know what to do after leaving a voice mail message.

David Pogue examines these annoying voice mail tagalongs and droning menu options in ‘Take Back the Beep’ Campaign – Pogue’s Posts Blog – NYTimes.com

The conclusion is not surprising (they do it for money), but the magnitude is.

“If Verizon’s 70 million customers leave or check messages twice a weekday, Verizon rakes in about $620 million a year.” — just from the excessive windage.

How much is a trillion dollars?

Friday, August 21st, 2009

 Thanks to I Hate The Media for this simple, graphic illustration:

Ruth Madoff

Tuesday, August 18th, 2009

I thought this was an interesting twist on the standard Nigerian scam.  It’s based (loosely) on a real news article.”My husband is a thief.  I need your help to hide the stolen money he gave me.  God bless you.”

Mrs. Ruth Madoff

West, Liverpool,

London.

My Great Compliments,

I’m Mrs. Ruth Madoff, 67, wife to Mr. Bernard L. Madoff, of Bernard L. Madoff Investment Securities LLC, who pleaded guilty to operating a multibillion-dollar Ponzi scheme, is worth up to $826 million, according to a document filed with a federal court on Friday 13th March 2009.

My husband pleading stealing billions from investment from his clients and he was ordered to jail Thursday 12th March 2009, after pleading guilty to all 11 criminal counts in one of Wall Street’s biggest swindles.

Now the Federal investigators in the USA are working around the clock to freeze all my assets, fearing that I’m trying to flee the country which I have done shortly after my husband was sentenced, I have $93 million in my name beyond their reach.

 

The Securities and Exchange Commission is working with federal prosecutors in Manhattan to prepare a filing asking a judge to formally freeze all of my assets as soon as possible.

My husband deposited the sum of (USD$17.000.000.00 Million) in a Finance Firm in Europe some years ago in my name, I need you to collect this funds and distribute it to both of us since the Federal investigators are working around the clock to freeze all my assets. Meanwhile all documents related to transfer of this fund to your account is with my attorney Mr. Peter Chavkin, who is willing to help us process the release order from the UK bank.

Presently, I’m in a hard out here in UK as the Federal investigators as well the Securities and Exchange Commission is looking for me to freeze my entire asset as well prosecute me like my husband.

Please reply back to me on this e-mail as I will like if you contact my attorney directly so that he will direct you on the way forward. Please due send to me all your contact details as I will like to speak with you before we commence on the transaction.

Please keep this confidential. You can read my story on this website: http://www.nypost.com/seven/03152009/news/regionalnews/ruth_in_crosshair_159631.htm

God bless you.

 

Best Regards,

Mrs. Ruth Madoff

Blogging in my sleep

Tuesday, August 18th, 2009

I spent much of last night planning a post.  Sadly, when the time came to actually get up and do it, my enthusiasm for the subject drained away.  It involved something about photographs of email chains. about something interesting.

It is interesting how the big (or last) thing on my mind when I go to sleep often takes possession of my dreams.

Why does dream stuff seem to drain away like fog in the morning?  I read an interesting theory in Pragmatic Thinking and Learning: Refactor Your Wetware. Dreams live in the right (or Rich) brain – the creative half.  Language lives in the left (or Logical) half. The two halves cannot communication effectively with each other, especially in men.  As soon as you start explaining or analyzing the dream stuff, the L brain activates and chokes out the R brain — and the information it is trying to examine!

:: The Wendy House :: » Excel explains: popular people

Tuesday, August 4th, 2009

:: The Wendy House :: » Excel explains: popular people

Another  link.  Wendy uses Excel to explain the lack of comments on her blog.

I couldn’t help but notice that she has two comments on this one, single post.

The Old New Thing : A burglar tells you the best place to hide your money

Tuesday, August 4th, 2009

The Old New Thing : A burglar tells you the best place to hide your money

I like The Old New Thing.  Raymond mixes  interesting (to me) tidbits about Windows programming and history with, well, regular stuff.  And it continues to be interesting far more often than not.  Most of the blogs I have started reading have become stale quite quickly.

Anyway, this is the launching point for advice from a former burglar on where and where not to hide your money.

Best advice?

  • Leave some money somewhere – so the burglar will “win” and stop tearing your place up.
  • Leave a list in your desk drawer of the stuff you put in the safe deposit box at the bank.  Make one up :)
  • Tell your spouse where you hid the money!

In part two,  our burglar points out that real burglars are not like TV burglars.  (shocking!).  Most of them are feeding a drug habit.  While they are looking for your valuables, they will check for drugs.  Don’t hide your money where you would hide your drugs.  For those of us who don’t know where illegal drugs belong, don’t put your money:

  • In or around the toilet
  • In the refrigerator
  •  In the medicine cabinet
  • In a cereal box

And finally, if you have a secret-compartment-in-an-ordinary-object piggy bank, put it where the ordinary-object belongs.  “When you find a Campbell’s soup can in the bedroom, you have a pretty good idea there is money inside”