marthijn. Rotating Header Image

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 →

Fix hMailServer 550 Invalid HELO string error

On a web server I’m running hMailServer to handle all e-mail traffic, especially SMTP. Today I noticed in some cases the e-mail hMailServer sent was rejected by the receiving party. It turned out the receiving party was a Microsoft Exchange environment. The hMailServer SMTP log stated the following:

550 Invalid HELO string

On the internet I found this topic. The solution to this problem is as follows: in the hMailServer administrator go to Settings > Protocols > SMTP > E-Mail Delivery tab. Enter the host name of your web server (e.g. a domain name) in the “local host name” field, and save the changes. Now the Exchange server will accept your e-mail.

 

How to set up a PPTP VPN server on Ubuntu

Nowadays free public WiFi networks are available in many areas, for example in airports, restaurants or public transportation. A major disadvantage of a public WiFi network is security. You can’t be sure no one stealing sensitive data by eavesdropping the connections. A solution is to setup a secure/encrypted channel to a Virtual Private Network (VPN). When using a VPN and you connect to for instance your webmail, the data is sent via the VPN. In this post I’ll describe how to set up a PPTP VPN server on Ubuntu. Using PPTP you can not only connect your laptop, but also your Android or iOS (iPhone or iPad) devices.

Continue reading →

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 →

How to fix the map change crash in Battlefield 3

Battlefield 3 owners could experience black (loading) screens during a map change when playing online. For me this only occurs when playing on Back to Karkand servers. I found this video explaining the solution: update PunkBuster manually.

Update Dec. 30 2011: Since my BF3 crashes at a map change again it seems the PunkBuster solution (as explained below as well) was only a temporary fix, and there’s no permanent one yet. An official bug report can be found here.

Continue reading →

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.

String filename = "file://" + Environment.getExternalStorageDirectory() + "/file.txt";
String email[] = { "foo@bar.com" };
Intent sendIntent = new Intent(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_SUBJECT, "My file");
sendIntent.putExtra(Intent.EXTRA_EMAIL, email);
sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse(filename));
sendIntent.setType("text/plain");
startActivity(Intent.createChooser(sendIntent, "EMail file"));

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:

Request for the permission of type 'System.Net.SocketPermission,  System, Version=4.0.0.0, Culture=neutral,  PublicKeyToken=b77a5c561934e089' failed.

Continue reading →

Building a Home Theater PC part 2

Today I finally assembled my HTPC. There were some stock issues with the case I ordered, so after a week I ordered another. Although the motherboard is passively cooled I decided to enable one of the two case fans. Unfortunately the fans are very noisy when directly connected to the motherboard, so I placed a simple Zalman fancontroller between the fan and motherboard.

After building the HTPC I first installed Ubuntu 10.10 using a USB stick. Then I used this guide to install XBMC.

Continue reading →

Building a Home Theater PC part 1

Last year I build a home server based on the Intel Atom platform. In my second post I mentioned building an HTPC with the same components, but I wasn’t really sure the current Atom processors and Nvidia ION platform could handle video decoding with a full HD resolution. Since a few weeks I’m looking for information how to build an HTPC running XBMC based on the latest Atom processors with Nvidia ION 2. I found this blog and I think I will use more or less the same parts because it’s a very good price/value solution.

Continue reading →

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 →