DataGridView Bug

This nightmare began when I clicked row two cell two. Row two cell two is a ComboBoxCell. I have several more such cells in this grid, and all of them are just fine, except this one. Each time I attempt to enter this cell, I get: “Operation is not valid because it results in a reentrant call to the SetCurrentCellAddressCore function”.
I checked each and every event of the grid. I tested (again) to see which event fires before which, as I have code in: CellBeginEdit, CellEndEdit, CellEnter, CellLeave, CurrentCellDirtyStateChanged, DataError and EditingControlShowing, only to find out that the problem is only in the CellEnter event, and only when the cell in row two cell two is accessed.

Do I really have to say that this took hours on hours of debugging?

Eventually, at 1:15 AM, I switched field two with field three (which is a TextBoxCell). Now the ComboBoxCell is in row three cell two, and row two cell two is a TextBoxCell. The problem is gone. Vanished. Nada. Both cells are behaving just fine.

So is this a DataGridView bug, or is it just me?

Published in:  on August 23, 2009 at 9:28 am Comments (1)
Tags: , , , , , , ,

A Joke Named BBC

The BBC has a website: See for yourself. It is interesting, diversified, and contra to everything the Internet represents. These guys think that this is a newspaper. Well, online newspaper, but still a newspaper. The best example is the “Have Your Say” thing, where you can commets on issues on the news. So, you write a comment, click the “Submit” button, and in six, seven hours max, your comment is published, if, and only if it can make its way through the “Moderators”. Oh, the Moderators. This is a group of editors who basically decide if the comment is within the BBC guidelines.
Once they had this topic: Does God have a role in the world today?. So I commented that “God died at Auschwitz”. The comment was rejected, of course. Only that the moderators didn’t know that this is a common phrase among survivors of the Holocaust, among them Haim Cohen, Chief Justice of the Israeli Supreme Court, and a survivor himself. But ignorance aside, if it takes six or seven hours for a comment to publish, then what’s the point?
Today I commented on someone elses comment. Now this was a real adventure: For one, there is no way to comment on comments. You have to quote the original comment. However, you are limited to a certain number of characters in your comment, so quoting the original one does not leave many characters for your own comment. Further more, if my comment, which was meant to comment on somebody elses comment, is published six hours later, who is gonna make the connection?
This is anti-Internet at its best. These guys simply do not understand the media.
FWIW.

Published in:  on April 20, 2009 at 3:57 pm Leave a Comment
Tags: , , , , , ,

Reflections Over a Chicken Soup

I read this today in the Washington Post about the risk of eating red meat. As if we didn’t know. I was once a dairy manager. No really. I was. I know almost everything you need to know about cows and milk and red meat, or at least I used to. By the way, in case you were wondering, I was coding before, during and after my term as a dairy manager. Anyways, its a long story, maybe some other time. So here I am, sitting in front of my monitor, having a large bowl of homey chicken noodle soup (I will post the recipe later this week), reading… “The study of more than 500,000 middle-aged and elderly Americans found that those who consumed about four ounces of red meat a day (the equivalent of about a small hamburger) were more than 30 percent more likely to die during the 10 years they were followed, mostly from heart disease and cancer.”… and “The take-home message is pretty clear,” …  ”It would be better to shift from red meat to white meat such as chicken and fish, which if anything is associated with lower mortality.”
So lets do the math. If eating red meat decreases your life expectancy by 10 years (take or give a few), then eating chicken, fish and turkey will do the opposite, right? Does it work that way? I mean, if you eat 8 ounces of red meat a day, is it equal to cutting your life expectancy by 20 years? And respectively, if you eat 8 ounces of chicken, or fish, or turkey daily, will you live for ever?..
Guys, There is nothing, I mean nothing, equal to a Tennessee Prime Rib, roasted to perfection, with real hot horseradish and a glass of Merlot, except maybe a large bowl of homey chicken noodle soup.

Published in:  on March 24, 2009 at 6:39 pm Leave a Comment
Tags: , , , ,

Homey Vegetable Soup

Serves 8 (or keep refrigerated. If you do, then always heat in a saucepan. Never in a microwave). Prep Time: 20 minutes. Cook Time: 5 hours.

Ingredients:
1 cup chickpeas
1 cup red beans
1/2 cup barley
2 zucchinis sliced
3 carrots sliced
2 potatoes sliced
2 onion chopped
1 celery chopped
6 garlic cloves sliced
1/2 cup parsley
1 tbsp butter
3 tbsp Olive Oil
14 cups water
1/6 tsp dry Thyme
1/6 tsp cumin
1/2 tsp dry garlic
salt and pepper

Preparation:
Soak chickpeas and red beans in separate dishes for 6 hours.
Heat oil in large saucepan, Saute onion for 5 minutes, add garlic and continue for 2 more minutes.
Add zucchinis, carrots, celery, potatoes and parsley, add 12 cups of water and bring to boil. Add butter.
Reduce heat to medium low and cook covered for 30 minutes.
Add 1 cup of water, bring to boil and add chickpeas, red beans and barley. Bring to boil.
Add thyme, cumin and dry garlic. Salt and pepper to taste.
Reduce heat to medium low and cook covered for at least 4 hours.
Half way through (after 2 hours) add 1 more cup of water.
Stir occasionally.

Serve hot, in large bowls, with a few drops of olive oil on top, and heavy slices of rye bread and butter on the side, and a bottle of good red Shiraz.

Published in:  on March 23, 2009 at 12:08 pm Leave a Comment
Tags: , , , , , ,

.Net Namespace – Usage Suggestion

Some of us out there are looking for a rigid standard for namespaces in .Net architecture. I don’t think we need a rigid standard. Instead, I would prefer to look for guidelines, or a framework, which makes sense. Something that can help finding your way in the code without too much of a hassle. So before we move to the actual idea, we need to define who, actually, needs namespaces, and who is going to benefit the most from their existence inside the code.

Who needs namespaces
Really, who needs namespaces? Definitely not me. I mean – you – the coder. The code is obviously in our heads and we know our way with our eyes shut. Definitely not our team. All of us navigate as if it was our back yard (BTW: I will challenge anybody who agrees with this statement–  I think we all need namespaces, no exception, for the reasons below).  So who?
I would say that namespaces are essential for team newcomers, and other teams in the organization, seeking code already written and tested, to implement in their project.

How do I use namespaces
In a nutshell — CompanyName.ParentProcess.Process.SubProcess — where CompanyName is your company, to make sure nobody mistakes this namespace root with Microsoft (ha ha). And then:

MyCompany.Accounting.Receivable.Invoice
MyCompany.Accounting.Payable.Invoice

Where:
CompanyName = MyCompany
ParentProcess = Accounting
Process = Receivable / Payable
SubProcess = Invoice

Or:
MyCompany.Inventory.Receiving.PutInWH
MyCompany.Inventory.Releasing.PullFromWH

Where:
CompanyName = MyCompany
ParentProcess = Inventory
Process = Receiving/ Releasing
SubProcess = PutInWH / PullFromWH

The basic idea behind this is that in 97.6% of the cases, processes do not vary between companies, and the code can be reused in different projects. When you invoice your customer, you follow a simple basic accounting rule. The same applies when you receive an invoice from your vendor. In the same way, receiving into your warehouse is the same process almost anyware. It is down to quantity, location and shelf life. You got the idea, didn’t you…

Published in:  on March 18, 2009 at 2:19 pm Leave a Comment
Tags: ,