Mocking application settings

Last time I showed a simple way of using application settings in our wpf application. This time I would like to present you my way of testing Properties.Settings, or rather mocking it in our application tests. First of all we need to make our application code independent of the concrete implementation of auto generated Settings class. Let’s define an interface which will contai…

By Mirek on (tags: mocking, settings, testing, categories: code)

Keep your temp folder clean

Temporary folders in your system are used to store temporary files obviously. Unfortunately those temporary files, very often, stays there for ever and makes your hard drive wasted. Indeed many applications uses temp folder to store auxiliary files but do not clear it causing temp folder grow and grow. In this post I would like to present my short code snippet to keep temp fold…

By Mirek on (tags: Process, Task, Temp, categories: code)

angular with foreign (jQuery) promises

When using angular turns out that it’s not as straightforward when it comes to foreign libraries. I needed to use jQuery $.post instead of angulars $http.post method (to reduce the friction between angular and asp.net mvc regarding request token validation) and I came across unexpected (though understandable once you get to the core problem) behavior. Here’s the angular version…

By on (tags: angular, javascript, jQuery, categories: web)

Where should I store settings of my application?

Where should I store user and application settings in my WPF application? Well, in Settings of course. Go to your WPF application properties and Settings tab. If there is nothing there but text in the middle, click on that text. This will create the Settings file in your project. Here you can add settings in the grid. The columns are: Name, Type, Scope and the Value. Name and t…

By Mirek on (tags: c#, settings, WPF, categories: architecture)

Ridiculously simple http server

There are times when you need to have a small, easy to set up http server. Most of the time, you’ll think – node and yes, if you have it – a great choice. But there’s another option… if you’re running python 3: if you’re running python 2: That spins up a http server in your current directory on port – yes, you guessed it - 8000 Cheers…

By on (tags: python, categories: tools)

Create unit test option is back

Few months ago I wrote here about the workaround for bringing back “Create unit test” option in Visual Studio 2012. Finally guys from Microsoft added this option to the Visual studio 2012 and 2013. More about new “Create unit test” option and natively supported test frameworks you can find on this video. To have that feature in Visual Studio you need to add the Unit test genera…

By Mirek on (tags: Unit test, categories: tools)

One collection – many views

Let’s imagine we have a huge collection of some objects (may be our data objects) and we need to filter this collection and display only a part of its elements in different places in our WPF application. Instead of creating many different instances of sub collection we can use the benefits of collection views. CollectionView is a wrapper around a collection that allows filterin…

By Mirek on (tags: CollectionView, WPF, categories: code)

REMs

REMs – the new hotness in css. They’ve been around for a while, but not very popular.  With the rising tide on responsive design, and mobile web usage, it looks like there may be more attention around this concept. Throw in a css pre-processor and using them becomes much easier. If you want to read up on the subject, here are 2 links that give you a short but thorough info…

By on (tags: css, categories: tools, web)

knockout cart

I recently had an opportunity to put some new knockout knowledge into use.  Tekpub has a very nice training video on the subject, which was a great starting point, so let me show you the result. First some quick requirements: Every product has a button that adds a fixed number of items (in my case 1) to the cart There is a separate cart page The cart has a possibility to c…

By on (tags: javascript, knockout, categories: code, web)