SqlExpress in UnitTesting

Found a couple of useful articles for setting up a test database using Sql Express




Very Simple MD5 File Hash Checker

You know those files that you download that have MD5 Hashes next to the download so that you can verify that you’ve got the correct, untampered-with version of the software that you are downloading…

I created a simple .NET tool to check the hash and the code is located here.

Apache2 – Only allow localhost

To ensure that a local version of apache will only take local connections, and therefore deny any requests from external computers, you can edit the /etc/apache/httpd.conf file and change the line that says:

Listen 80



Then restart apache: sudo /etc/init.d/apache2 restart

Ubuntu Fonts

On my system (at least it was a while ago) I could put custom fonts here: Put the font in the /home//.fonts

Run this at command line to get the system to update it’s cache (or something :S)
sudo fc-cache -fv

WordPress Pretty Permalinks

Just reinstalled wordpress after a computer malfunction a few days ago, and setup rewriting to allow pretty permalinks.

Note that these instructions are for Ubuntu (On 9.10)

Steps were

  1. Open a terminal and type “sudo a2enmod rewrite”. This will enable the mod_rewrite module in apache
  2. Open the httpd.conf file and put this in there: (Note the directory path at the top to the wordpress installation)
    <Directory /var/www/wordpress>
      Options FollowSymLinks
      AllowOverride All
  3. Open up wordpress’s administration page and Expand “Settings”
  4. Click on “Permalinks”
  5. Select the format that you alike (I chose “Day and name”)
  6. Click “Save Changes”
  7. If your .htaccess is writable (and exists) then you will probably be right to go. If it is not then you should create it and add the content that wordpress gives you underneath the save changes button…
  8. Restart apache (sudo /etc/init.d/apache2 restart)

The content of my .htaccess file for the “Day and name” option was as follows:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /wordpress/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wordpress/index.php [L]
# END WordPress

Clearfix Hack

Found this at PerisablePress.com.

    Clearfix hack
.clearfix:after {
    visibility: hidden;
    display: block;
    font-size: 0;
    content: " ";
    clear: both;
    height: 0;
* html .clearfix             { zoom: 1; } /* IE6 */
*:first-child+html .clearfix { zoom: 1; } /* IE7 */

Custom Page and User Control base Classes in MVC

Justin Grant’s solution to this was really appreciated.

I’ve just been having a bit of an issue with User Controls though. and found out that the Inherits attribute on page and control are not needed. When I inherited from the class on a page I was fine, but Inheriting from the User Control class gave me errors.

So the following will work and give you code completion…

For Pages:

<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" %>

For Controls:

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Example.ascx.cs" %>