Serializing Anonymous DataMemeber

I've been working win MVC Web API and encountered an annoying problem. It does not, by default serialize anonymous data members.

When you try to serialize this kind of data you get this beautiful exception:

Converting anonymous type to a string also caused exception. But there is also JavaScriptSerializer:

Now using getter,...

One way object binding in JS

This is something I've been putting together this weekend. Due to the fact, that ASP.NET is quite reluctant to get an array of results, I've devised an alternative way of sending data to the server via Web.API. There are already several large frameworks that handle data-binding like Knockout and AngularJS, but these are rather heavy...

InverseProperty records not being savedin the database

In the code-first approach you can easily save object across multiple tables. This is great. However, today I tried saving an object with a set of other records:

In my controller I had simply:

However, the Items where not actually saved in the database. I just changed IEnumerbale to List and it worked...

WordPress 500 Error

Today, I was testing new themes for this blog. Unfortunately, something went wrong and I was greeted by 'Error 500' and no further details. The error occurred on every page and made the website completely unusable. This article will summarize the steps I took to fix this error. Make a back-up Once you connect to...

Publishing WCF Web Service on IIS

Today, I will show you how to to publish WCF Web Service on IIS. I assume your have a working version of your WCF on IIS Express and you want to "publish" it. Step 1 - Install IIS Go to: Control Panel Programs and Features Turn Windows Features On and Off There are 4 things...

Column '' in table '' is of a type that is invalid for use as a key column in an index.

I've tried to create a simple (unique) constraint across multiple columns:

However I was greeted by: Column 'Name' in table 'dbo.UserLocations' is of a type that is invalid for use as a key column in an index. This can be fixed by adding: [DataType("VARCHAR")] and [MaxLength(40)] on the string. The point is that MaxLength...

Using Bootstrap tooltip on disabled buttons

I've been trying to get a tooltip on a disabled button in bootstrap. Well that didn't work. So here is the trick: overlay the disabled buttons with a div:

Here is the JSFiddle

What do the attr_reader, attr_writer and attr_accessor messages do?

Just like in C#, in Ruby the access to the variables is set by setters and getters as oppose to methods getVar() and setVar(xx). These are usually defined like so:

This will simply return instance of the object "name" i.e. a getter. Let's have a look at the example. In Ruby we have...