Multiple Values For The Same GET or POST Parameter in ASP.NET MVC

There are situations where you need to pass multiple values for the same parameter to the server, here are some patterns.

  • Multiple checkboxes to pick the values for the same purpose.
    • Select columns to show in the table
    • Select post categories
  • User can add as much values as he/she likes.
    • Add new tag
    • Add language
  • User can remove multiple items from a list.
    • Remove items from shopping cart

This can be handled by passing many values in one parameter with a common delimiter, or by passing multiple values as the same parameter. Here are examples with the GET method, for the POST it works the same.

Continue reading “Multiple Values For The Same GET or POST Parameter in ASP.NET MVC”

Converting Word Document to HTML

Microsoft Word happens to be the text editing application of choice for many of my clients. And they would like to post the content to web, so I still find myself in a situation where I need to export a Word document to HTML.

There is an option to “Save document as Html” in Word that results in big, convoluted, HTML file full of errors. Also, there is a bit of inline formatting where I would like the format to concur to the website formatting instead.

So, a good result would have no or very little formatting, and as simple as possible markup.

Continue reading “Converting Word Document to HTML”

Run NUnit for the current VisualStudio project

On a lot of projects, I use NUnit for unit testing, usually I create a separate project that contains only the tests.

There tools that integrate fully with the Visual Studio, like ReSharper or TestDriven.NET, but they cost money and you can’t run them on Express editions.

So I’ve made this useful shortcut to easily run it for the current (test) project. Screenshots are made on Microsoft Visual Studio 2010 Professional running on Windows 7.

Continue reading “Run NUnit for the current VisualStudio project”

Formatting date, time, currency in various cultures

In today’s interconnected world, it’s important that online applications support different cultures.

Even if most of us that spend a lot of time online are accustomed to the USA date and number formats, people always prefer to see numbers and dates formatted in a familiar way. People don’t like to think about if the date’s first digit is day or month, or if it’s decimal delimiter or digit grouping mark.

The date 03/02/2010 means completely different thing in Australia and USA – it’s February the 3rd in the former and March the 2nd in latter! (dd/mm/yyyy vs mm/dd/yyyy)

Even if we assume that the common internet user can read the shown format based on the website’s supposed location, localization and internationalization (i18n) could greatly improve readability and usability.

Continue reading “Formatting date, time, currency in various cultures”

AutoHotkey Scripts

As I have already stated, one of my favourite tools that I install right away on a fresh machine is the AutoHotkey.  It makes life a bit easier shortening the way to perform common tasks. Among other features, it provides a way to associate keyboard shortcuts with a scripted outcome.

Continue reading “AutoHotkey Scripts”

Searching from browser – Firefox quick searches and Chrome search engines

Search engine web site can be skipped

Some new browsers have a Search field (Firefox, Internet Explorer, Opera, f.ex.), it’s located at the top right part of the browser window, next to the address bar. This is a nice little feature, you can select a search engine, type the search terms and submit. Then search engines site is opened with results. Usually suggestions are shown as you type.

Continue reading “Searching from browser – Firefox quick searches and Chrome search engines”