:::: MENU ::::

Adding a prompt option to Html.Select in ASP.NET MVC

Digging around the source code to the ASP.NET MVC Source Refresh, I discovered a useful extension to the Html.Select helper method.

Say you want a select dropdown with a NULL case, which instructs the user to make a selection.

Eg: You want your first option to be:  ==Select==

To do so, call Html.Select with a htmlAttribute of prompt=”==Select==”


<%=Html.Select((“Quote.ClientId”), ViewData.Clients, “Name”,”Id”, ViewData.Quote.ClientId,0,false,new {prompt=”==Select==”})%>


Some thoughts on alternatives to the Visual Studio Team System for building webapps:

  • Requirement gathering
    • I like Axure (axure.com) for HTML prototyping ideas, and Visio is okay for architecture diagrams
  • Code editing
    • VS Pro + Resharper is pretty good. One of the best “step though debuggers” I’ve used
  • Source control
    • Subversion + TortoiseSVN. Any played with Git? Is there a good Git GUI tool?
  • Continuous Integration
  • Jetbrains TeamCity
  • Issue tracking / project website
    • I quite like Trac – wiki, milestones, good SVN integration. Have to maintain Python app though.
  • O/R mapper
    • NHibernate? DataSets? LINQtoSQL? What do you use?
  • TDD / BDD
    • ASP.NET MVC looks like its going in the right direction; but still early days
    • nUnit / mbUnit / VS built-in? Is there anything that comes close to rSpec in the Rails world for elegance?
    • Mocking frameworks? Moq has a nice syntax – most of the others seem overly complex (record/replay?!)
    • TestRunner? www.gallio.org looks like a good start, but still early days
    • Functional testing? Selenium? WatiN?
    • Continuous Integration server? Is there anything prettier than CruiseControl?
    • Load testing?
  • Logging
    • Log4Net>
  • Monitoring
    • Current favourite is Webperform
  • Support email handing
    • SupportSuite from QualityUnit has a nice Gmail style interface + KB

Trac & Nginx on Ubuntu Feisty

Install trac

apt-get install trac python-mysqldb

Update ClearSilver


apt-get install python-dev
wget http://www.clearsilver.net/downloads/clearsilver-0.10.5.tar.gz
tar xvzf clearsilver-0.10.5.tar.gz
cd clearsilver-0.10.5/
./configure –disable-wdb –disable-compression –disable-perl –with-python=$(which python)
cd python
cp -i neo_cgi.so /usr/lib/python2.5/site-packages/neo_cgi.so

Trac Environments Directory

You’ll need a directory for Trac’s environments to live that should be writable by the default tracd user:

sudo mkdir /var/lib/trac
sudo chgrp users /var/lib/trac

Create a MySQL DB
Create a new database (trac) and user with full rights to that DB (trac). Make sure the database character set is latin1_bin (UTF8 will cause key length problems; throwing “Specified key was too long; max key length is 1000 bytes” errors during trac setup)

Your connection string will be:
mysql://trac:[email protected]:port/databasename

Configure Trac

trac-admin /var/lib/trac initenv

Follow the instructions.

Correct locale errors
If you get locale errors:

apt-get install localeconf
localedef -i en_US -c -f UTF-8 en_US.UTF-8



S3 Backup options: s3sync & duplicity

a ruby rsync command line tool, that mirrors folders on S3.

* S3 directories readable by any S3 browser (including standard HTTP calls)
* Bandwidth heavy; non encrypted

HOWTO; http://blog.eberly.org/2006/10/09/how-automate-your-backup-to-amazon-s3-…

GNU tar style backup tool, with many backing stores (SCP, FTP, S3).

* Fast, bandwidth efficient deltas
* Encrypted

HOWTO: Symfony 1.0.8 with Nginx on Ubunty Feisty VPS

Get Symfony

# pear channel-discover pear.symfony-project.com
# pear install symfony/symfony

Using the command:

# pear config-show

we find the symfony libraries have been installed in:

$php_dir/symfony/ /usr/share/php/symfony/ main libraries
$data_dir/symfony/ /usr/share/php/data/symfony/ skeleton of symfony applications, default modules and configuration
doc_dir/symfony/ /usr/share/php/docs/symfony/ documentationCreate / configure a new symfony application

# mkdir /var/www/myproject
# cd /var/www/myproject
# symfony init-project myproject
# symfony init-app myapp

# ln -s /etc/nginx/sites-available/wattprint.org /etc/nginx/sites-enabled/wattprint.org
# /etc/init.d/nginx restart