Thursday, March 6, 2014

I would like to introduce you to Cookie Clicker. This game has single handed brought down the productivity of companies all around the world. It is an OCD nightmare. It starts off small, but before you know, you've lost hours, days or even weeks.

The point of the game is to click cookies. You can buy "add-ons", like grand mothers to help you produce cookies without clicking cookies yourself. The more you buy, the more expensive the items get. You reach a point where cookies and Grandmother run the world. It all sounds mundane, but believe me, it is hard to stop clicking, not to try and get all of the achievements. If you are an achievement addict, this is the game that will ruin your life.

Wednesday, February 9, 2011

At the current time of writing I'am working on a project using the .net 3.5 sp1 Framework.

I encountered a strange error while trying to return a DataTable from a webservice using WCF. If the DataTable is initialized with the default constructor and no parameters are given then WCF cant serialize to object and return it to the client, the error thrown will look something like this:

An error occurred while receiving the HTTP response to *SERVICENAME* . This could be due to the service endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). See server logs for more details.

Luckly the work around is easy :

just initialize the DataTable with the constructor where you specify a tableName, and then walla, the serialization works :)

Alternatively you can added the DataTable to a DataSet and return that to the client.

Tuesday, January 25, 2011

When the value in the datepicker has changed, the datepicker will Invalidate the control to get the current value. This will cause .net to reevaluate the control which in turn fires the bindings and converters etc., as well as the LostFocus event.

When evaluating the current value the DatePicker will try to parse the current value as a DateTime?. Because a DateTime object is aware of time as well as the current Date, it will realise that the property that you have bound to has changed, because the current time of the control has also changed. This will fire all the bindings again to notify that the property has changed.

The event will also force the focus property again and will try to Invalidate the control to get the current value again, based on your binding.

The result is an infinite loop or a stackoverflow exception.

This rarely happens, but is the result of the binding. This especially happens when the binding property NotifyOnSourceUpdated = true and UpdateSourceTrigger= OnPropertyChanged.

In my case I had to create a multi-binding and the properties were just firing all over the place.

The datepicker wants a DateTime? (nullable date time), because it accepts a text value, and a text value can be an invalid date. Normally we bind to a DateTime object because we want a definite value. The binding mentioned above will then cause constant conversion and the propertychanged event to fire repeatedly.

Luckily the solution was easy for me: Bind to a DateTime? and cast the value to a DateTime.

Because a DateTime? can take in a null value if the conversion failed, you don’t have to worry about an invalid value Invalidating the control again.

Thursday, December 30, 2010

R&B star Usher has found himself in the middle of an bizarre plagiarism claim -- with people saying he's ripped off a song by Homer Simpson. Below is the YouTube video. It actually does sound the same. I can't help but laugh, Homer is a musical genius. :-P

Tuesday, December 28, 2010

It's Christmas week and there is only three of us at the office. What a bunch of dumbasses. :-) My friends already phoned me to let me know they are sleeping in, playing play station and eating take away. And me? Work work work. Guess I've got one thing to say: Unlucky!