The Blog

Listener Design Pattern

Listener design pattern (also known as Subscriber/Observer) is a 'well-proven' technique for asynchronous message passing. It is used when the client needs to be notified when 'something interesting' happens to another object (of class X) in a passive manner (i.e. the client is not checking every so often (pulling) in the state has changed). The

Continue Reading

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

Continue Reading

Footer from database in MVC ASP.NET

I've been struggling for a while to find a sensible way of getting the footer. Well... This is where partial views come useful. There are several ways to solve this problem. I've created a controller:

In the Shared folder I've added _FooterPartial.cshtml and in the layout this line:

It worked so awesome.

Continue Reading

Partial View not being published

I encountered a bit of a problem today. I've added a partial view manually to the project (i.e. it wasn't generated by the VS). To my annoyance, when I deployed the application to the test server the *.cshtml was not copied. After a bit of digging around, I found the problem. It turned out that

Continue Reading

Overriding onClick event in jQuery

Interesting problem today, I tried to override behaviour of an image. The simple approach of replacing behaviour obviously didn't work:

Neither $("#game-image").removeAttr('onclick'); did anything. There is a function unbind.

This can be followed by the 'overriding' function:

Continue Reading

Speeding Up Gradle (just a little bit)

If you do any sort of Android Studio Development you might find these two lines quite useful. There is a noticeable speed up in building time.

Continue Reading

Razor with JavaScript

Today I had a problem of adding markers onto a google map. I didn't really want to create a service to handle the request and return an array. So instead I tried doing something simpler.

This obviously didn't work. Razor was getting confused; it didn't know which one was the script and which one

Continue Reading

MVC File Upload - Access to the path is denied

An interesting problem occurred yesterday when I was trying to upload a file to the server. I was getting: Access to the path '' is denied The problem wasn't actually caused by the file upload but by my attempt to create a directory to put that file there. After reading a bunch of answers on

Continue Reading

ASP.NET Automatic Migrations

Understanding migrations can be a bit tricky. Hopefully, this article will resolve at least some of the questions you might have. First things first - What are migrations? Well... If you built your website using first code approach every time you change your model you need in order to keep the database in sync. There

Continue Reading

Mapping to a new new Type with ASP.NET Web API and LINQ

As you would expect Microsoft is trying to make your code as clean and need as possible. This is an example of a search query. The key element of this query is select new {Title = m.Name}. It allows you to map a your model to a new type without having to declear a custom

Continue Reading