Category Archives: Development

Using AngularJS with a WordPress backend

Thanks to the WordPress JSON API plugin it’s really easy to make a WordPress theme using AngularJS, or use WordPress as a backend for your AngularJS application. In this post I’ll describe how to create a basic theme from scratch and fetch posts using AngularJS and the JSON API plugin. In order to follow this tutorial it’s useful to have some basic knowlegde about WordPress theme development and AngularJS.

Continue reading Using AngularJS with a WordPress backend

Relationships in Entity Framework Code First

In this article I will describe a common mapping problem with relationships in Entity Framework Code First. I once had this problem as well and got the answer from StackOverflow (if interested, see my question here).

Consider the following models:

And the following (psuedo)code to save a ClassA:

Continue reading Relationships in Entity Framework Code First

MSBuild task to compile LESS files

When you are using LESS to create dynamic style sheets the performance of your website will increase when you compile those files to CSS before uploading the webapplication to a server. In this post I’ll describe how to create a build task for MSBuild that will compile all LESS files in a directory. I use this task in my deployment environment for web applications. It is part of a series of tasks that build the application, copies all the files to a deployment directory and does some post processing (compressing JavaScript, images, etc.). Of course it is possible to compile LESS files dynamically using a HttpHandler as well, for more information visit dotless.org.

Continue reading MSBuild task to compile LESS files

Simple logger for NHibernate 3

A logger is a very useful tool when developing a (web)application, especially when you’re using an object-relation mapping solution such as NHibernate or Entity Framework. In order to improve the performance of your application it is useful to analyze the SQL queries and other information (e.g. warnings, errors, caching) about the object-relation mapping.

Since NHibernate 3 it is possible to implement a custom logger. Log4net is not necessary anymore. In this post I’ll describe how to implement your own logger.

Continue reading Simple logger for NHibernate 3

How to send an e-mail from your Android app

I’m developing an Android application where the user must be able to send a file stored on the SD Card to a specific e-mail address. By using Android’s Intent class this is very easy. The following code snippet will bring up an e-mail application choose dialog.

Fix .NET 4 SocketPermission for MySQL driver in Medium Trust

Most .NET 4 shared hosting providers offering their customers a medium trust environment. This is not a problem for most web applications unless the applications uses MySQL in combination with the .NET MySQL driver (MySQL.Data.dll). The MySQL driver connects to the MySQL database using a socket. However, sockets are not allowed in medium trust. The application will throw a SecurityException with the following message:

Continue reading Fix .NET 4 SocketPermission for MySQL driver in Medium Trust

Possible solution for NHibernate many-to-many criteria

In one of my .NET projects I’m using the NHibernate library for object-relational mapping. I’m mainly using the ICriteria interface to fetch data from the database. Unfortunately I ran into a function that got really complicated; how to query a many-to-many relationship. For example, I have a table containing posts and a table containing tags. The post datamodel contains a set with tags so in my mapping it’s a many-to-many relationship. I want my query to return all posts tagged with one or more specific tags. On this forum I found a solution. I’m not sure if this is the perfect solution, so feel free to suggest a better one.
Continue reading Possible solution for NHibernate many-to-many criteria

Using log4net to show NHibernate SQL in Visual Studio

I’m currently developing a web application in ASP.NET MVC and NHibernate. Since the application was very slow at some points I wanted to know which SQL queries NHibernate was executing. Since the log4net library was already included in the application I searched for a solution to output the SQL queries to the console in Visual Studio 2010 using log4net. I found the solution on this wiki and this blog post.

Continue reading Using log4net to show NHibernate SQL in Visual Studio

CodeIgniter simple CRUD improved

Currently I’m developing a web application in PHP using the CodeIgniter framework. Since I needed some admin functionality such as create, read, update and delete records (CRUD) I searched for CodeIgniter libraries. I came across this post by Henri. His solution is very simple and easy to understand and implement. In this post I’ll describe how to improve his solution so it’s possible to sort columns. I start with the files Henri provided in his post.

In order to enable sorting I first modify the get_paged_list function of the PersonModel class:

Continue reading CodeIgniter simple CRUD improved