Friday, December 30, 2011

Android nears 50% in the U.S.

Android is nearing the 50% market share in the United States. Apple also on the way up but still on the distant second place. All the others are on the way down. The period compared is from August to November 2011.

Sunday, December 18, 2011

Google URLs

Some Google services, like Tasks and Contacts have initially been integrated with other services like Gmail but now can be accessed directly. URLs are sometimes not so obvious, so I'm listing some of them here.

  • Tasks -
  • Contacts -

Saturday, December 17, 2011


A huge number of people is using Internet for voice communication, to talk about business or catch up with their dearest. And it sucks when the connection quality is not top-notch because cut-offs in conversation appear, distortions in voice, etc., missing on parts of conversation and so on.

Lately I experienced these problems when talking to multiple parties and it is really annoying. I monitored the network connection while the conversation was taking place and noticed that download was going OK for a few seconds and then dropped for a few. Most popular voice chat programs, like Skype or GoogleTalk, stream the voice continuously while connected. This is probably OK when the connection is good. The amount of data transmitted is pretty good. But the problem is that the channel between the two parties needs to be uninterrupted. 

This led me to look for a solution in line with my childhood experiences with radio-amateurs, where you need to push a button to talk. It made sense that, in conditions of poor connectivity, a better quality of voice communication would happen if we could control when to transmit. That way only the actual speech would get sent, rather than the silence periods, which take quite some time. Burst transfer versus continuous transfer. 

So I found Loudtalks ( They have application for Windows and Android. The first test went quite well. It seemed a bit annoying to have to push the talk button every time but the fact that no parts of the dialogue got lost was more important. Then I thought how good it would be to have the transmission voice-activated and looked through the options. And it was right there - voice activated transmission with threshold settings was built in but not activated by default. Now this seems like a decent chat solution. Will have to test this in the coming period and in the longer conversations.

A really good thing about LoudTalks is that it keeps a history of voice messages, something like text chat, so you can listen to previous messages sent or received.

If you decide to use LoudTalks, the shortcuts (easy to find in Options dialogue) are: F7 = speak, Ctrl+F7 = hands-free (voice activation), Shift+F7 = repeat last message.

Internet Explorer Starts with Automatic Updates

Finally, Microsoft is moving the route other browsers adopted earlier and will start to automatically update Internet Explorer web browser on client machines. The main "excuse" mentioned for the decision was security but I find it more important being able to roll out new features and compatibility support for upcoming HTML 5.

This was the missing link as there are throngs of people still using old versions of Internet Explorer, making a huge barrier to adoption of HTML 5 as a platform. Fortunately, the share of old IE browsers on the web is dropping continuously, as seen on StatCounter's global stats.


Thursday, December 08, 2011

Proxy Switcher

Nice and simple two-clicks proxy switcher for Windows. Freeware.
Note: Free version is now called Lite.

As, with the later versions, this program is reducing the free options, I found an even better one:
This proxy switcher can automatically apply network settings depending on your location or other conditions on the network. Plus you can change manually with two clicks on the tray icon.

A Cool Date Library in JavaScript

After learning in a funny way that in Javascript

Date.parse(DateToValue) <= Date.parse(DateFromValue)

does not behave the way it was expected, using American date format in the DateXXValue parameters and having no ability to specify that, I looked into solutions for comparing the dates in the input fields.

There is a date.js library that is very useful in solving the above issue. I posted the links here.

Thursday, December 01, 2011

A Few Selenium-related Links

Here's a few interesting links related to the new Selenium 2.0, WebDriver, and running Selenium tests in a CI build (as a service / headless).

Official blog, lots of interesting links and announcements:

Documentation on 2.0 features and WebDriver:

Non-Sucking Service Manager:, used to install apps as services.

Wednesday, November 30, 2011

Open Source Alternatives

This morning I ran across two amazing pieces of software for the stuff that's commonly needed in a small office.

The first one is a mail/collaboration server and client - Zimbra. Technically, it is an alternative to MS Exchange or Lotus Notes:

The second one is a project management software - OpenProj, an alternative to MS Project:

Wednesday, November 23, 2011

xUnit Test Patterns

Great reference for unit testing: xUnit Test Patterns - Refactoring Test Code

Thursday, November 10, 2011

Arguments to functions in JavaScript

Watching Douglas Crockford's talk about functions in JavaScript, there were a few interesting moments where I learned some new things. One notable detail worth writing down is that every function in JavaScript always receives two arguments: this and arguments.

arguments is array-like but is not an array and contains all the arguments passed to the function.

this contains a reference to an object that contains the function.

Some references:

Tuesday, November 08, 2011

Modules in CoffeeScript

Here is a link to a module wrapper that enables encapsulating code into modules with CoffeeScript:

Tuesday, October 25, 2011

Web Developer on Chrome

One of the first developer add-ons for Firefox - the Web Developer Toolbar - is available on Chrome. I haven't really paid attention to it lately but now I find it very useful. It integrates several useful tools like color picker, ruler, and a host of other functions available in the Firefox version.
The functionality provided will probably end up in the dev tools inside the browser one day but, for now, the extension is extremely useful.

Monday, October 24, 2011

Could not register HTTP URL with WCF

Just had the following error:

HTTP could not register URL http://+:8000/. Your process does not have access rights to this namespace (see for details).

when trying to run a Windows Service that listens on localhost using HTTP protocol. This happens on operating systems >= Vista, meaning the Windows 2008 is affected. The solution (listed here) is to run the following command as Administrator:

netsh http add urlacl url=http://+:8000/ user=DOMAIN\UserName

Now, to execute the same thing in older operating systems (Windows 2003, for example), you would run:

httpcfg set urlacl -u http://+:8890/ -a D:(A;;GX;;;S-1-5-20)

Then check the results with "httpcfg query urlacl". Replace "set" with "delete" to remove the permissions. Given SID is for NTAuthority\NetworkService. 

Saturday, October 15, 2011

Android USB Tethering

After first using wireless hotspot mode on the Android phone and connecting a laptop through that, draining battery rather quickly, even more pain followed after getting a PC. Switching constantly the SIM card between the phone and the USB adapter on the PC was no fun at all.

After doing a bit of searching on USB tethering I was truly stunned to find that USB tethering has been available ever since Android 2.2. Having used Quick Settings application to access WiFi hotspot settings (mobile AP), I rarely wandered into the original Android Settings menu.

It was a true revelation to see USB tethering option natively supported by the operating system. This is now the ultimate solution - the phone is being recharged often and both the phone and the desktop PC are connected to Internet. Lovely jovely. 

Edit: Another option is to use PdaNet. There is a service on the mobile phone and a desktop client for the PC. This requires separate installation of Samsung USB driver, that includes ADB driver. For some reason, the one that came with Kies was not enough.

Tuesday, September 20, 2011

Git-TFS commands

Quick Clone

set branch=$/path/branch
set tfsserver=http://tfsserver:8080/tfs
set command=quick-clone
git tfs %command% %tfsserver% %branch%

Update from TFS

git tfs fetch
git rebase tfs/default

Creating an alias in .gitconfig:

tpull = !git tfs fetch && git rebase tfs/default

Checkin to TFS visually

Useful if the checkins need to be linked to work items or other policy rules.

git tfs checkintool

Other Settings

Set ignore settings in ".git/info/exclude" instead of creating .gitignore file

Reference: article

Monday, September 19, 2011


If there's something that would drive me away from Mercurial and closer towards Git, that would be Git-TFS. So far I'm using a Mercurial/TFS solution, as explained in Using Mercurial with TFS. However, this is not a 100% foolproof solution because (argh!) the solution file contains the "scc*" settings that every now and then get removed from the file when it is not bound to the TFS source control. And, of course, this happens all the time when the code I'm working on is in a cloned Hg repository.
The light seem to come from a project called Git-TFS. The documentation is available at the Wiki page in the project. There is also a newsgroup where questions can be answered.
I'm about to give it a test run but, reading more about it, I seem to have an idea that not using two Hg repositories but just one might work, too. Update to follow soon.

Good introductory text is here. My initial opinion is quite good.

Saturday, September 17, 2011


Folder2ISO does what the name says - it creates an ISO file from a directory. No installation, just download and run. Nice and simple.

Headphones/Speakers Switch

There's a great little program that switches between speakers and headphones (actually, any two sound devices configured in Windows) via simple click or hotkey combination:

SoundSwitch - v2.3, or v3.0dev

Monday, September 12, 2011

Deleting a network user profile on Windows 7

My profile on the current workstation is messed up and I want to recreate it. The account is not a local Windows account but an Active Directory one, making this a bit more difficult.

To start off, I created a new Windows account, giving it Administrator privileges by adding it to the Administrators group. Then, log on with that user and

  1. Move my user account files (c:\users\<xy> somewhere else)
  2. Remove user SID at 
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList
    The key to remove is the one that points to the above file location for the profile files. 
  3. Log off and then on as the above user to recreate the profile.

Monday, August 22, 2011

Windows Offline Updates

Another project that helps with updating offline or multiple Windows installations:

Thursday, August 18, 2011

Unit Testing Silverlight 4

Here is the first article in the series about unit-testing Silverlight 4 applications - link.

Unit Testing Framework for Silverlight is now included in the Silverlight Toolkit (link).

Unit-test runner - StatLight - can be downloaded manually or through NuGet.

Check the short tutorial here.

Monday, August 15, 2011

Testing IE in a VM

Microsoft has provided Virtual Machine images for testing sites with different versions of Internet Explorer:

Available are Win 7 with IE 8 and 9, Vista with IE 7, and XP with IE 6. Images are VHD. For use with Microsoft Virtual PC (or server versions).

Friday, August 12, 2011

Turning TFS Agile

UrbanTurtle is an interface that makes TFS useful and adapts to the agile workflow.

Wednesday, August 10, 2011

Visual Event for JavaScript

Great visual help for JavaScript developers. Such a neat and elegant way of displaying the JavaScript events on a page.

Tuesday, August 09, 2011

Using Mercurial with TFS

A recommendation in this day and age, when using TFS for team collaboration, is to use the help from Mercurial or other modern code versioning tools for local changes and offline usage. There is no need to list all the benefits of Mercurial right now. Suffice to say that it provides painless safety net with branching and merging support that allows easier work. 

An article at Los Techies describes the scenario how this can be accomplished. Basically, after checking-out the TFS project, create a Mercurial repository there. Get a MakeWritable extension. Clone the Hg repository into a working copy where you will be making changes and that's it. Use the scripts below to check-in/out from TFS.

source article

PowerShell scripts are located in an online repository.

Monday, August 08, 2011


Using Mercurial with .Net projects, there is a need to constantly create .hgignore file to disregard changes to files that should not go into the source control. The contents of this file are mostly the same for all projects. My list goes something like this:

syntax: glob

Not sure if the ones below should be ignored. Leaving them in for now.


Sunday, August 07, 2011

Caching Windows Updates

Since Microsoft never bothered to solve issues for small and home users who wanted to cache Windows updates, here is a very practical solution:

With AutoPatcher, you simply select which OS or a related technology (there is .NET, Adobe Reader, etc.) you want and it will download the files to your local drive, making them available offline. These can, then, be installed on multiple machines, avoiding redundant download in case the Internet connectivity is an issue.

Tuesday, August 02, 2011

Friday, July 29, 2011

Site Templates and Themes

A nice collection of web site templates and themes:

CSS, HTML, JavaScript, skins, etc.

Tuesday, July 26, 2011

Visual Studio 2010 loading package errors

After reinstalling Visual Studio 2010, service pack, and what-not, I started getting lots of errors about loading Visual Studio packages like RadLang, VSTS for Database Professionals, and other SQL-related stuff.

For now, running Visual Studio with the following option seems to have fixed the issue:

devenv.exe /resetskippkgs


Friday, July 22, 2011

Visual Studio Crashes on Open

After installing Internet Explorer my Windows Search stopped working and Visual Studio 2010 started crashing, reporting an exception in .Net 20r3 or something like that. The app would crash after opening a solution, right after the window "configuring solution" would close.

Fortunately, the fix was easy - deleting the .suo files made it go away the first time.

Problem details:

Problem signature:
Problem Event Name: CLR20r3
Problem Signature 01: devenv.exe
Problem Signature 02: 10.0.40219.1
Problem Signature 03: 4d5f2a73
Problem Signature 04: mscorlib
Problem Signature 05:
Problem Signature 06: 4d53693b
Problem Signature 07: 2c26
Problem Signature 08: 45
Problem Signature 09: KUTS43RW3WMPE3EWT1R1Z5M5MTM1NR04
OS Version: 6.1.7600.
Locale ID: 3081

Additional information about the problem:
LCID: 1033

However, now I could only open the project/solution but opening a file in the project or trying to recompile would crash the Visual Studio again. Running "devenv.exe /log" creates an xml log file:


One of the last entries contained the error message. According to forums, this could be related to Silverlight. So I removed all the installed components related to Silverlight. The problem is that Silverlight 4 Tools cannot be installed after the Visual Studio SP1. So I removed the Service Pack. Uninstallation requires reboot.

After that I installed the Silverlight Tools and reapplied the Visual Studio SP1. Since that bore no results, I reapplied Windows 7 Service Pack 1 and all the software above in various order.

However, it turned out that unplugging the (new) RAM sticks out and plugging them back in again fixed the problem!

Google Chrome Offline Installer

Here is the URL for Google Chrome Dev Channel offline installer. Or try the links on this page.

Since the above links are often not up to date, check the following answer, which contains direct links to particular binary releases. Basically, to download the latest versions manually, the download link pattern is this:
with the numbers "835.15" needing to be replaced with  the last two segments of the build number from the release notes blog. The actual URL of the latest update version can also be seen using Fiddler and trying out the Google Chrome update through the browser.
The link to Dev channel updates stream is here.

Tuesday, July 19, 2011

External Graphics for Laptops

Since my graphics card in a laptop sucks for 3D gaming, I'm looking for a solution that does not involve getting another PC. I've heard earlier that there are external solutions that plug into one of laptop's express slots and allow "upgrade" of the available graphics capabilities of notebook computers.

While I could not find many around on the net, here is one: ViDock

Thursday, July 14, 2011

UML with Visual Studio 2010 on Channel 9

There's a video series at Channel 9 on using the new UML features in Visual Studio 2010.

See Designing a project's physical structure (episode 6) - link, or the whole series (link) list.

Wednesday, July 13, 2011

WCF Tracing

To troubleshoot crazy WCF-related errors, a very good option is to trace all the events in the service. While the documentation on MSDN contains useful info, the changes required to actually enable tracing are not all listed there. 

The full settings, that are added to Web.config when enabling tracing through the WCF Configuration Editor, look like this:


<source name="System.ServiceModel" switchValue="Warning, ActivityTracing"
<add type="System.Diagnostics.DefaultTraceListener" name="Default">
<filter type="" />
<add name="ServiceModelTraceListener">
<filter type="" />
<add initializeData="C:\Projects\MyProject\App_tracelog.svclog"
type="System.Diagnostics.XmlWriterTraceListener, System, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089"
name="ServiceModelTraceListener" traceOutputOptions="Timestamp">
<filter type="" />

Languages that compile to JavaScript

Here is the list of languages that compile into JavaScript.

CoffeeScript seems to be getting quite popular lately.

Setting custom diff/merge tool in TFS/Visual Studio

In order to set Beyond Compare (or other custom tool) as the default tool for diff/merge operation in Team Foundation Server plugin for Visual Studio, do the following:




  1. In Visual Studio Choose Options from the Tools menu.
  2. Expand Source Control in the treeview.
  3. Click Visual Studio Team Foundation Server in the treeview.
  4. Click the Configure User Tools button.
  5. Click the Add button.
  6. Enter ".*" in the Extension edit.
  7. Choose Compare in the Operation combobox.
  8. Enter the path to BComp.exe in the Command edit.
  9. In the Arguments edit, use:
    %1 %2 /title1=%6 /title2=%7

3-way Merge (v3 Pro)

  1. Follow steps 1-6 above.
  2. Choose Merge in the Operation combobox.
  3. Enter the path to BComp.exe in the Command edit.
  4. In the Arguments edit, use:
    %1 %2 %3 %4 /title1=%6 /title2=%7 /title3=%8 /title4=%9

2-way Merge (v3 Std, v2)

Use the same steps as the 3-way merge above, but use the command line:
%1 %2 /savetarget=%4 /title1=%6 /title2=%7


Source: Beyond Compare support (link)

Friday, July 01, 2011

Selenium with SpecFlow

In addition to the SpecFlow and Selenium Quick Start, here are a few notes on using Selenium in SpecFlow scenarios and step definitions.

Check the files in the Support directory in SpecFlow Examples code (link). There is scaffolding that is very useful if you are using Selenium to simulate user behavior. The SeleniumSupport is linked to @web tag, which should be used for the tests that use the browser (i.e. user acceptance tests). This means that, when scenarios tagged with @web are run, it will trigger events to start and shut down Selenium, and make it available for custom tests in the meantime.

Inheriting from the SeleniumStepsBase makes implementation very simple:


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DoerSite.Tests.Support;
using TechTalk.SpecFlow;
using NUnit.Framework;

namespace DoerSite.Tests.SeleniumTests
    public class SeleniumStepsSample : SeleniumStepsBase
        public void test()


This implementation also depends on a couple of settings in the app.config:

    <add key="ReuseWebSession" value="true" />
    <add key="AppUrl" value="http://localhost:51598/"/>



SpecFlow and Selenium - Quick Start

Here are brief steps on how to get started with SpecFlow and Selenium. This scenario assumes an ASP.NET MVC web application as the "code" and NUnit as the "test project".

Web application

  1. Create new MVC web application

Test project

  1. Create a code library project. 
  2. Add reference to NUnit framework.


  1. Download Selenium IDE for Firefox. This component is used for generating tests by scripting user behavior.
  2. Download Selenium DotNet package. Add reference to this package into the Test project.
  3. Run Selenium IDE in Firefox and script your test with the web application. 
  4. Export the generated test into a C# file.
  5. Add this file to the Test project.
  6. Download Selenium Server and run with something like

java -jar selenium-server-standalone-2.0rc3.jar

This will start Selenium server on port 4444 by default. You can configure which browser you want the Selenium to start but by default this is Firefox.


  • Download and install SpecFlow. It will add new Items to the File->New menu in Visual Studio. The most important one is SpecFlow Feature item.
  • If you install SpecFlow NuGet package, it will add the minimum required settings to the app.config in the Test project. Apparently this is not required if the test runner is NUnit. Contents of the app.config look like this:
<?xml version="1.0" encoding="utf-8"?>
    <section name="specFlow" type="TechTalk.SpecFlow.Configuration.ConfigurationSectionHandler, TechTalk.SpecFlow" />
    <!-- For additional details on SpecFlow configuration options see -->
    <language feature="en-US" tool="" />

    <unitTestProvider name="NUnit" />

    <generator allowDebugGeneratedFiles="false" />

    <runtime detectAmbiguousMatches="true"
             missingOrPendingStepsOutcome="Inconclusive" />

    <trace traceSuccessfulSteps="true"
                   TechTalk.SpecFlow" />
  • Add reference to SpecFlow. This will be automatically added if you install NuGet package.
  • Create your first SpecFlow Feature, edit the content to set up your feature and scenario(s).
  • Run the test on the Test project. Copy the code from the error message into a new file in StepDefinitions directory.

That's it!

If you want to run Selenium in SpecFlow scenarios, check SpecFlow Examples on GitHub (link), specifically SeleniumSupport class (link). More on this in the follow-up post Selenium with SpecFlow.

VoIP Client of Choice

Looking for a VoIP client to install on a PC that did not have one, I did a quick lookout at what is out there. I used to use heaps of different clients only to move to the next one when I'd notice that the development has stalled and/or that there are new features offered by other clients. I've used XLite, native providers' applications, and lately Linphone. However, I ran into Blink and it is now my VoIP client of choice.

I will be using softphones a bit more, both on the desktop and on the mobile phone, as I have an Australian number with PennyTel and will use it to still "feel at home" when not in Australia. :)

Thursday, June 30, 2011

Convert Flash to HTML5

The time is *now*! Obviously the technology has matured enough that tools that automate transition from content in browser plugins into native support. In this case Flash to HTML5. It is (still) in Labs.

Monday, June 27, 2011

What to do when a phone is lost?

As my brother lost his phone on his biking trip, it was a good trigger to investigate the options for protecting the data that is kept on the phones these days. These links relate only to Android:

More to come.

VS Plugins

There are a few cool Visual Studio 2010 plugins to assist working with HTML5:

  • Image Optimizer (link)
  • Web Standards Update for Microsoft Visual Studio 2010 SP1 (link)


Friday, June 24, 2011

Custom Table Mapping with Entity Framework (EF) 4.1

I used EF 4.1 Code-First feature to develop a quick prototype for a QA team recently. Now more functionality is being added to the web application (ASP.NET MVC 3) and I need to display data from log4net's Log table. For that purpose I have to hook up another database, create a model with repository, and a new Data Context. Here I will list a few findings regarding conventions. They really become convenient only when known and also when a workaround is available for non-standard situations.

To add another database to the project, I simply copied an existing Data Context class and changed it's name. The class looked like this:


    public class MySecondSystem : DbContext

        public MySecondSystem()

        public DbSet<ESBStubMVC.Models.Log> Logs { getset; }



The original context's name had "Context" suffix but I removed that. The convention for finding a connection string is that a Connection String with the same Name will be loaded from Web.Config. Since there was already a Connection String with name "MySecondSystem" used for other purposes, adjusting the class name was the quickest way to make it use the same connection string. However, adding providerName to the connectionString tag is required for Code-First to work:




Class Log represents existing log4net Log table:


    public class Log
        public int Id { getset; }

        public DateTime Date { getset; }
        [StringLength(255, ErrorMessage = "The {0} must be at least {2} characters long.")]
        public string Thread { getset; }
        [StringLength(50, ErrorMessage = "The {0} must be at least {2} characters long.")]
        public string Level { getset; }
        [StringLength(255, ErrorMessage = "The {0} must be at least {2} characters long.")]
        public string Logger { getset; }
        [StringLength(4000, ErrorMessage = "The {0} must be at least {2} characters long.")]
        public string Message { getset; }
        [StringLength(2000, ErrorMessage = "The {0} must be at least {2} characters long.")]
        public string Exception { getset; }



In the LogRepository, created by MvcScaffolding, I just changed the data context class since it had picked up an old, existing one:


    public class LogRepository : ILogModelRepository
        MySecondSystem context = new MySecondSystem();


Now, to actually read from Log table, as opposed to Logs - plural is used by convention - I had to add a custom mapping. This is easy enough to set by overriding OnModelCreating:


        protected override void OnModelCreating(DbModelBuilder modelBuilder)

            // Custom mapping.
            modelBuilder.Entity<Log>().Map(c => c.ToTable("Log"));


So, the final Data Context class looks like this:


    public class MySecondSystem : DbContext

        public MySecondSystem()

        public DbSet<ESBStubMVC.Models.Log> Logs { getset; }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)

            // Custom mapping.
            modelBuilder.Entity<Log>().Map(c => c.ToTable("Log"));



Wednesday, June 22, 2011

AppHarbor .NET Hosting and Mercurial

AppHarbor offers free .NET hosting for small projects, just what some people need in order to deploy their hobby application, low-traffic site, a prototype, or something along those lines and have it available "out there".

Out of the box, AppHarbor works with Git as the code versioning system and makes it really easy and convenient to deploy your site by just pushing the source code. While this could prompt Mercurial users to try fiddling with hg-git, there is a better way. Mercurial is supported by using BitBucket as the code hosting provider.

Check AppHarbor instructions on how to link everything together - here, while instructions on how to do it via hg-git are here.

Monday, June 20, 2011

Software Repositories

With the lack of a better term to describe this type of web sites, here is the list of software repositories that contain links to the latest versions of free software. FileHippo also has an application that will check your installed software and notify you if there are any new versions.

These sites allow easy download of the latest versions of software updates. Hopefully all the software manufacturers start using something similar to the distribution process for Google Chrome.

Friday, June 17, 2011

World Wide Telescope

Here is the link to the World Wide Telescope (I keep opening the site that sells telescopes, all the time):

It used to be, which was a bit confusing.

A nice feature is the ability to share links to views. This, however sucks in Google Chrome because it is impossible to just copy the URL from the message that pops up, without taking a snapshot of it and running it through an OCR. :)

Crab Nebula

Friday, June 03, 2011

Resharper Keyboard Shortcut for Import Namespaces

After fiddling with Visual Studio setting, installing and reinstalling different Resharper nightly builds and stable builds, I just had a weird case where the keyboard shortcut combination for importing the namespaces disappeared.

In the settings, I could not find anything that even remotely resembled the setting I was looking for. After reinstalling the application again, it turns out that Alt+Enter combination is stored under


key. I'm posting it just in case it happens again. :)

Thursday, June 02, 2011

Tuesday, May 31, 2011

Quick Windsor Example

Castle.Windsor, an IoC container, can be implemented in multiple ways. Here is one of them. I find it rather simple and flexible. Here is a quick example on how to get it up and running in a project.

The code is only a few lines:

        private void RegisterIoC()
            var container = new WindsorContainer(
                new XmlInterpreter(new FileResource("castle.config")));

            var outboundMessageHandlerStrategy = container.Resolve<IOutboundMessageHandlerStrategy>();

The configuration is read from castle.config file, where the components are configured. This allows for flexibility and making the module replacement a configuration change instead of code change.

The castle.config looks like:

<?xml version="1.0"?>
    <component id="taxcalc.service" 
               type="IoC.Tutorials.Part1.TaxCalculator, IoC.Tutorials.Part1" />

The type name and namespace do not match the code above, btw, but the principle is there.

Another other option would be to use fluent interface to configure the container, as below.


At the moment, this is the work in progress. I'll get to finalize this example when I'm back to the task that involves Windsor.


Saturday, May 28, 2011

MP3 AudioBooks in iTunes

I just found a piece of advice that seems quite useful for MP3 versions of audiobooks:

There is no need to download or convert to bookmarkable (remember your place in the book where you were there last) mp4 (.4mb) format for i-Pods or i-Phones. 

If you don't want to download or convert to 4mb here is what to do if you want your mp3 Audiobook files to be "Bookmarkable". (Look Like Audiobooks)

Open iTunes, click on "File" tab and select "Add Folder to library". Click the mp3 file or files in i-Tunes, choose get info, go to the options tab, tick "Audiobook in Media kind ", and then tick "Remember position" & Skip When Shuffling".

Job done.

Friday, May 27, 2011

Code-First, EF 4.1, SQL Compact

Entity Framework 4.1 now fully supports SQL Server Compact for Code-First Development with ASP.NET MVC 3. There are a few gotchas still, especially considering that CTP versions of libraries had workarounds and are therefore incompatible with the RTM. But since they are still available as NuGet packages, this might be confusing for the beginners. It certainly was for me.

So, here are the steps:

  1. Create an MVC 3 application.
  2. Create Model classes.
  3. Scaffold the controllers and views.
  4. Add the connection string to Web.Config
  5. Adjust Global.asax Application Start 

Connection String





                new System.Data.Entity.DropCreateDatabaseIfModelChanges<WithCompact.Models.WithCompactContext>());

This option tells the EF to recreate the database if model changes. Tip: make sure you don't already have the database file created when working with SQL Server Compact, otherwise the following errors pops up

Model compatibility cannot be checked because the database does not contain model metadata. Ensure that IncludeMetadataConvention has been added to the DbModelBuilder conventions.


MIX 2011 Videos

Presentations from MIX 2011 are available at Channel 9:

Wednesday, May 25, 2011

Coexisting WebForms and MVC

In addition to my previous post on the topic, here are the steps to take if MVC is to be added to an existing WebForms project:

  • Add references to
    • System.Web.Routing
    • System.Web.Abstractions
    • System.Web.Mvc
    • System.Web.Helpers
  • Add directories to the existing site root
    • Controllers
    • Views
    • Content (optional) for images and CSS
    • Scripts (optional) for JavaScript
  • Update web.config to load the above assemblies at runtime and register the UrlRoutingModule
  • Set route(s)

If you decide to keep the default route then either copy (from a blank Mvc project) or create a new HomeController and the view(s) for the actions. The best way is to do the above tasks manually and then copy the content, like controllers, views, and scripts, from a starter Mvc site.


These are the settings to add to web.config:

    <compilation debug="true" targetFramework="4.0">
<add assembly="System.Web.Abstractions, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Helpers, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Routing, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Mvc, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.WebPages, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />

and also

<add namespace="System.Web.Helpers" />
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Routing" />
<add namespace="System.Web.WebPages"/>


Code-First Development with Entity Framework 4.1

Entity Framework 4.1 is delivered with MVC 3 (Tools Update). It allows for easier Code-First Development, which means creating custom busines objects/entities and repositories (data context), and then mapping them to the database. Rather than the other way around, which is usually the case (unless you use NHibernate and have known about this for years :).

One issue that I ran into when using Code First Development was that I tried to add my own objects to the project that already had an .edmx model generated from the database. For some reason EF goes nuts and things just don't work.

The solution to that is to remove .edmx in some way. Either rewrite the objects to use Code First or separate them into separate assemblies.

For more info, see

All the code that needs to be written is the Model. I use the following classes as a start:


public class WorkItem
        public int Id { getset; }
        public string ItemName { getset; }
        public int WorkOrderId { getset; }

        public virtual WorkOrder Order { getset; }
    public class WorkOrder
        public int Id { getset; }
        public string Title { getset; }
        public DateTime? OrderDate { getset; }

        public virtual ICollection<WorkItem> Items { getset; }


SQLite AutoIncrement columns


I'm using SQLite for data storage in the quick proof-of-concept sites. One thing that is convenient to have is autoincrement Id field so one does not have to write own code to maintain the uniqueness, having more time to focus on actual work that the application is supposed to do.

While I've been trying different keywords, from different suggestions over the web, it turns out the AutoIncrement functionality is already built in SQLite and kicks off automatically when the Id field is of type Integer. Also, bear in mind that Integer here is int64 so there's plenty of values for most of the common scenarios.

Short answer: A column declared INTEGER PRIMARY KEY will autoincrement.


Entity Framework

Since I am using Entity Framewok to work with the data in SQLite database (MVC Scaffolding makes it so easy to utilize this), I ran into an issue where inserting the first row works but any subsequent row will get rejected by the SQLite. The reason for this is that EF sends 0 (zero) in the Id field while SQLite expects NULL. See below link for more details.

The solution for this is to explicitely mark the Id field with AUTOINCREMENT. To do this, I use SQLite Manager, Mozilla Firefox plugin, which allows me to get the SQL DDL for the table, manually add the 'autoincrement', drop and recreate table by issuing SQL commands.

Also, in the EF model, I set the Id columns StoreGeneratedPattern value to 'Identity', while some even suggest to use 'Computed'. 

Tuesday, May 24, 2011

Passing quick data to Views with ViewBag

The new ViewBag is a dynamic wrapper around ViewData that allows passing the data from controller to the view. One of the issues at the moment is that ViewBag contents can't be passed to HTML Helpers as parameters directly.

The workaround for this is to explicitely cast the ViewBag property to the expected type.

So, instead of

@Html.TextArea("customXml", ViewBag.CustomMessage, new { @style = "width: 100%; height: 400px; " });

you'd have to write

@Html.TextArea("customXml", (string) ViewBag.CustomMessage, new { @style = "width: 100%; height: 400px; " });

Passing data with RedirectToAction

This might be a result from the WebForms-centric way of thinking and a dirty habit, but I need to have the following flow on the web site:

  1. User clicks a button (or submits some data in another way)
  2. This posts the form to the Home controller.
  3. Home controller transfers the data to another controller's action

I tried using the default route's 'id' parameter but this puts a long XML into the address field in the browser and, besides, just doesn't work.

The right option for this scenario is using TempData. This translates to simply using 

            TempData.Add("customMessage", xmlContent);
            return RedirectToAction("Index""CustomMessage");

in the Home controller, and 

            var xmlContent = (string) TempData["customMessage"];

in the receiving controller. (Passing the same data to the view is another matter. Using ViewBag is the 'quick & dirty' way. See related post.)

"The TempData property value is stored in session state. Any action method that is called after the TempDataDictionary value is set can get values from the object and then process or display them. The value of TempData persists until it is read or until the session times out."  


dotPeek - .Net Decompiler from JetBrains

dotPeek is a free .Net decompiler being developed by JetBrains.

Monday, May 23, 2011


Knockout is the Model-View-View Model pattern for JavaScript UI. It encapsulates data and behavior into a view model, which provides a foundation for data-binding of DOM elements and frees the developer from manually wiring the data to the UI elements.

Sunday, May 22, 2011

MVC Visual Studio Helpers

If you mix Web Forms and MVC in the same project, Visual Studio helpers for MVC come in really handy when adding Controllers, Views, and so on. It is as easy as right-clicking the Controllers directory and the Add menu will display "Controller" at the top of the list. This is really convenient. Depending on the context, the destination of the right-click, different options will be displayed in the Add menu.

However, if you are modifying an existing Web Forms project to work with MVC, these options will not be available by default. The fix is simple.

In your existing Web Forms project's .csproj file, locate line


and add one more guid at the front, so that it looks like this:


Now all the options available at the MVC project will be available in the (previously) Web Forms Application project.


Mixing ASP.NET WebForms and MVC

MVC is a wonderful framework to work with. Unfortunately, there is lots of existing material and sites that are written using WebForms and these require maintenance. Going by the maxim "never leave the code untouched", I reckon that these sites and code shoud be refactored bit by bit and transitioned towards using MVC.

It is, of course, not practical nor beneficial to rewrite whole applications but adding new functionality and refactoring the old should also encompass replacing bits and pieces with MVC framework. So, in that regard, here are some pointers as to how to mix multiple existing technologies, all hosted on IIS:

  • Plug-In Hybrids: ASP.NET WebForms and ASP.MVC and ASP.NET Dynamic Data Side By Side, Hanselman (link)
  • Mixing ASP.NET Webforms and ASP.NET MVC, PacktPub (link)
  • and webforms co-existing, Stack Overflow (link)

Saturday, May 21, 2011

Synergy - Share your mouse and keyboard

As my PC was unreliable just when I needed it the most, I got a laptop to do software development. Now it looks quite cumbersome to switch keyboards to work on the two machines so I was looking for a solution that would enable me to use my keyboard and mouse on both computers. And, here, the solution is Synergy.

Synergy is Free and Open Source Software that lets you easily share your mouse and keyboard between multiple computers, where each computer has it's own display. No special hardware is required, all you need is a local area network. Synergy is supported on Windows, Mac OS X and Linux.

The first thing I liked about their site is that they are using Redmine! :)

Wow! Now that I've installed it, I can't believe it is this simple and easy! Screens are configured graphically, as per their physical location in relation to one another. Then, simply move the cursor over the edge of the screen and you're on another computer! Mouse and keyboard work on the selected workstation. Of course, only the Server's response to keyboard and mouse events is perfect, while the rest travels over the network but, for all sakes and purposes, it is decent enough for standard use. I can hardly notice that these are not the two computers anymore. The feeling is as this really *is* a single platform.

Awesome work, guys!

One problem I've noticed is if you open Resource Monitor on Windows 7, that somehow kills Synergy on that screen/computer (I only have one screen per workstation so can't tell for sure). If you had Resource Monitor (RM) open before starting Synergy, then both will work fine, except that you won't be able to operate or close RM window. :) 
This happens if you run Synergy as as ordinary user and then open an application that requires elevated privileges to run. So, in order to not experience these issues simply run Synergy "As Administrator". 

Another beautiful thing that feels natural when you work in this fashion is that Copy/Paste works across the workstations. This works for text (and maybe some other clipboard content) but not files. File transfer is quite cool with Dropbox LAN sync or just sharing folders through Windows.

Monday, May 16, 2011

ReSharper 6.0 Nightly Builds

ReSharper 6.0 nightly builds are available from the link below. These are used as an evaluation. The JetBrains instructions state:

Evaluation license
If your evaluation has expired, please install the lates build and choose 'Free evaluation' option on the License Information dialog
You can also use the following evaluation license:
User Name: ReSharper EAP User
License Key: 0-i5LycolHMT9ahzFH4R2Bt8gGiS40VYmU
Valid until: 05/30/2011


Sunday, May 15, 2011

MvcScaffolding: One-to-Many Relationships

Recently I've looked again at the most rapid way to implement basic CRUD for a relational data, using web application in .Net. From experience I knew that Web Forms had ways of getting this sort of thing done in a quick (and dirty) way. That was made even easier with recent version of WebForms. Now, looking at what MVC can do, I was quite pleasantly surprised.

A couple of weeks ago I looked at Scott Hanselman's presentation where he demonstrates some MVC Scaffolding templates. This was the missing bit but the things are falling into place. T4, NuGet, and now scaffolding. There are templates for a few things already and there will obviously be more in the not-so-distant future.

Here is an article in an excellent series about MVC Scaffolding. Steve Sanderson explains how to do one-to-many relationship and CRUD through a scaffolding template. He is using Entity Framework Code First approach to generating the data model. The templates do the rest in generating controllers and views, as well as the model.


A range of interviews I've had in the past several wees prompted me to create a reference list of books and material every developer/architect should know. The list of material is available here.

A few books that I was really delighted with are Robert C. Martin's series - Clean Code: A Handbook of Agile Software Craftsmanship, and Agile Principles, Patterns, and Practices in C#.

All the material at the Books page is excellent and contains the core of what one needs to know in their everyday work. It is also a good refresher for people who have been focused on a small set of solutions and technologies at any given time. Happy reading.

Monday, May 09, 2011


A cool tool for generating test data. From the project description:

Through a fluent, extensible interface, NBuilder allows you to rapidly create test data, automatically assigning values to properties and public fields that are of type of the built in .NET data types (e.g. ints and strings). NBuilder allows you to override for properties you are interested in using lambda expressions.

NBuilder is an open source project, hosted on google code

As stated above, this software generates data that can be used for testing when you need lists of random data.

Tuesday, May 03, 2011

Galcon Fusion

I've just been introduced to this cool game. It is a great thing to play on iPad either in a duel or collaboratively. 

There is also an online version available and it includes multiplayer! Check out:

Thursday, April 28, 2011

Run apps on Spoon offers a cloud hosting service for desktop applications. Quite an innovative approach but in the age of virtualization things rarely surprise us anymore. It requires an installation of a .Net plugin to run on Windows, which may make it unusable at some locations, like internet cafes. Hopefully, issues like this get solved with advancing technology. It feels weird being able to run Notepad++ in the cloud! :)

Well, actually, the app gets downloaded in the background and runs in a virtual machine / sandbox on your PC. This makes me wonder what happens with apps that require registry access. Something to try out with, for example, Quicken.

Wednesday, April 27, 2011

IBM Enterprise Architect Kit for SOA

A great set of resources related to Service-Oriented Architecture (SOA). For most organizations I've seen, even knowing the very definitions would make a huge difference. :)

"Understanding SOA: Key Terms

Service: a repeatable business task, such as check customer credit or open account

Service orientation: a way of integrating your business processes as linked services, and the outcomes that these services bring

Service Oriented Architecture (SOA): an IT architectural style that supports service orientation

Composite application: a set of related and integrated services that support a business process built on SOA"



Great overview of HTML5, what it is and, more importantly, what it is not. :)

Grid vs Cloud

Cloud computing vs. Grid computing explained in IBM's paper from 2009. It explains how cloud computing is an extension to grid computing. An evolution, a natural progression, if you want. The term 'utility computing' is also explained and this is what today's services are becoming more and more like - paying for what one uses on a shared infrastructure.

Cloud computing represents Infrastructure as a Service (IaaS), as opposed to Platform as a Service (PaaS) or Software as a Service (SaaS) concepts.

Further to that, some great Cloud computing resources available at

Tuesday, April 26, 2011


A good and brief explanation on A-GPS and how to enable it on Android is available here. Detailed sources, as always are on Wikipedia: GPS, and A-GPS.

In brief, to enable A-GPS, turn on "use wireless networks" in GPS settings (Location and Security). 

Google MapMaker

Similar to, Google has allowed the public to add and edit content on Google Maps. MapMaker is the service where one can edit the map and/or review the changes made by others.

This is quite useful, especially for areas that have rather low Google Maps coverage, like Bosnia and Herzegovina. However, editing areas outside the US is not enabled yet.

Thursday, April 21, 2011

Glimpse! - server debugging on the client

Thanks to Scott Hanselmann, I've just been introduced to some serious brain-damage. :) Things like Glimpse do not pop-out every day and so it was really weird to see a framework that - in your browser - displays debugging information from the server, executing the MVC web application on .NET stack.

This is really groundbreaking, but at the same time quite needed, technology that lets you know what is going on with your application. Kinda like debugging on production servers. :) Head there to find out more.

"What Firebug is for the client, Glimpse does for the server... in other words, a client side Glimpse into whats going on in your server."