Think In Geek

In geek we trust


Routing a hiearchical path in ASP.NET MVC

If you wonder how to make a GitHub (and other websites) like routes to access to hierarchical paths or files, here’s the way to do it in ASP.NET MVC. GitHub is a GIT hosting service, and allows you to browse the repositories. When doing so, it uses a path as a routing parameter, as seen […]


Get the number of days in a month in .NET

If you’ve ever wondered how to get the number of days for a given month in .NET, the solution is pretty easy: System.DateTime.DaysInMonth(int year, int month)System.DateTime.DaysInMonth(int year, int month) Hope it helps!


Execute javascript code every time a form is loaded via Ajax.BeginForm

If you’ve ever used the Ajax.BeginForm code to render a form in ASP MVC using Ajax (via jQuery, for example), you may have wondered there’s an object you can pass to the call called AjaxOptions. This object allows you to pass the BeginForm call some interesting options to further enhance the form when it’s rendered. […]

, , , ,

Creating and consuming JSON data in MVC 2

Recently I started working in a project using MVC 2. I found out a very useful feature to retrieve JSON data from the server using an Action in a Controller. This feature is in the base Controller class, which we inherit when we create a new controller. If you take a look into the different […]

, , ,

C#, the “and” operators and lazy evaluation

Today at work we found a bug. My workmate, not used to C#, usually uses the & operator to compare boolean values. However, in C#, the & operator does not use lazy evaluation. One curious thing about C# is that it can use two different operators to calculate an and expression: the & operator and […]


Creating and testing a Linked List based Queue in C# using Nunit

The Queue<T> class (and Stack<T> too) of the .NET Framework from Microsoft is implemented using an array. While this is a perfectly good approach, I think that a Linked List based implementation could be desired in some situations (specifically when the size of the queue is not fixed). Since the implementation alone would be rather […]

, ,

Using IronPython to extend your .NET applications

One of the interesting new things on the .NET platform is the recent addition of Python and Ruby to the CLR. Both versions for .NET are called IronPython and IronRuby respectively, and they provide some new and good things to the platform. Python and Ruby lovers will see now that they can use all the […]

, , , , ,

Full view of ComboBox drop-down list components in C# 3.0

By default in C# 3.0 ComboBox controls don’t provide support for showing drop-down list items if they exceed the width of their parent ComboBox, like this one: This is annoying because users cannot read properly the information. To solve that problem, all we have to do is derive the ComboBox class and override the DropDown […]

, ,

C# and the StringBuilder class

This morning I was working on a project at work. It’s a Web Application using the ASP .NET 2.0 framework and C# as a code behind language. My friend Ioannis came over to see what was I doing and when he saw I was appending some strings together he asked me this question: “are you […]

, , ,

The Double Check Design Pattern

One of the deficiencies of actual programming languages, specially those ones still widely used that are old, such as C or C++, is that they were designed having in mind the sequential programming paradigm. This usually means that those languages don’t have standard ways to work with multithreading features, and you usually have to rely […]

, ,