Month: November 2014

Setting default value for property in EF Code First

There few ways in which one can do it. The simplest way is via data annotations:

Continue Reading

The Output window in VS 2013

I accidentally closed the output 'window' in my VS 2013. I cannot believe it took me that long to find this, but hopefully it will save you some time:

Continue Reading

Bootstrap Tabs with Google Charts - how to make it work?

Today, I've encountered an interesting problem. It seems that when an object is hidden, it breaks the properties of width and height for Google Charts. Using Bootstrap 3.3, I had a set of tabs. Each tab contained a graph of some sort. In the initial tab, the chart was being displayed correctly. However, the charts

Continue Reading

"using", the safe keyword

Frequently, we don't really care what the exception is, but if it is thrown we want to finalise operations e.g. close the database connection or files. This is where using comes in. using keyword allows to make code a little bit more readable by omitting try-catch-finally clause. Instead, your object should implement IDisposable interface and

Continue Reading

Neat way of getting rid of nullable type in Linq

Nullable types can sometimes be a handful to work with. This 'billion dollar mistake' (as described by Tony Hoare who claims to have invented null) can, however, be convereted to r There is a need way of converting nullable type: ??. The example below selects some value from an object using Select method. YourVariable is

Continue Reading