Tuesday 15 June 2010

Deviation Alliance

Now I’m one of founders of a new blog initiative – Deviation Alliance. If you liked what you read here – you’ll like what we have there, at http://deviation-alliance.com.

Also, follow us on Twitter!

P.S. All my new posts will be available there and not here, sorry.

Friday 11 June 2010

What Developer Needs From a Bug Report?

a_bugs_life_2 Really – what information should be mentioned in a bug report? Yes, you know about these things with High, Highest, OurBusinessHasBeenDestroyed priorities and severities, everyone knows about them. But does anyone know what is really needed from a bug report? I had a nice time working as a QA engineer at the start of my career and I’ve learned some things that, combined with what I learned while being a developer and mixed with what I’ve read about, form this post.

Let’s all become goal-oriented and define a goal of any bug report. The final goal of each bug report is to eliminate the bug this report was written about. It doesn’t matter whether it will be fixed or considered not a bug but feature – the bug should be eliminated anyway.

The key to problem solving lies within understanding the problem. In case of a bug, bug report is used for that. Thus, it should contain all necessary information for understanding the problem. Two possible sides of detailing report are simplicity and complexity.

What’s the simplest bug report should contain? It should contain the description of the problem, it’s application. It’s like a smell. If someone enters a room with a nice perfume – you’ll smell it. The simplest bug report should just describe this smell. This way developer will have to spend much time reproducing the problem.

What’s the most complex bug report should contain? It should contain info about:

  1. Full description of bug, and more strange bug gets, more details QA should provide
  2. When did it appear, with millisecond precision?
  3. What actions caused it?
  4. Where was QA located in application map - page, screen, etc.?
  5. What environment caused the bug - OS, browser?
  6. Did QA do anything unusual before detecting the problem?
  7. What context produced this bug? Maybe it was during version update or hacker attack?

It should also contain information on how to reproduce – that’s very important. Describing steps for reproducing a bug is not easy at all:

  1. It should contain conditions that make the bug happen
  2. It should not contain conditions that do not affect bug appearing
  3. It should contain conditions on how to avoid bug

Moreover, instead of describing problem implications only, complex bug report should suggest problem roots. Yes it’s much harder but damn we’re talking about complex report! QA should analyze provided problem implications and suggest what could cause the problem.

Yes, complex bug report really differs from a very simple one – but using it for bug solving will be much easier and you’ll always get positive feedback from a developer. However, you should be aware of the 80/20 rule: 20% of work takes 80% time and vice versa. This means that you should always consider all options and just think – some information is much easier to get for developer, not QA. Don’t waste your time thoughtlessly – you may reach 90% complexity and this will be enough.

Test thoroughly and report well :)

UPDATE: updated bug description criteria to be more specific.

Thursday 10 June 2010

Windows Phone 7: Binding to ApplicationBar properties

I’ve been playing recently with WP7 development and transitions in particular. In some cases you need to change your ApplicationBar with respect to some ViewModel properties. Edit mode or some NullPattern for bindable list may be good examples for such situations. I wish that thing was easy or obvious (if it is easy but I could not find it :)), but I had to work around this issue with DependencyProperties and manual binding.

Let’s start of a dream:


This is an ideal variant: simple binding and everyone is happy. However, this particular example raises an ‘Invalid XAML’ error. This error makes me think that may be there is a correct way to do what I’m doing but I'’m satisfied for now with my solution.

So what are we going to do? We’re going to do the following:

  1. Detect DataContext change (this is our ViewModel we should update our ApplicationBar according to)
  2. Detect change of property we should bind to and update ApplicationBar respectively

We’re going to use dependency properties for handling necessary changes.

First, let’s handle DataContext changes:


Here we are defining a CustomDataContext property which is bound to DataContext property of our MainPage. We don’t specify binding property because it will default to DataContext – just what we need.

What should we do in our handler? We should start listening to desired changes and handle them. How? Quite the same – using yet another DependencyProperty:


We’ve defined what reaction we expect from ViewModel property change. Now we have to tie it together with some specific property in our data context. This action will take place in the DataContextChanged handler:


So here we bind our ExtraListNotEmpty dependency property to ListIsNotEmpty property of our ViewModel. Moreover, we explicitly call UpdateApplicationVisibility method that updates ApplicationBar visibility according to specific parameters. We have to do this because by default binding won’t ask for value until it changes – but we need this update at the very beginning.

Let’s finally have a look at the code all previous lines were supposed to support:

ListNotEmptyChangeHandler VisibilityUpdater

ListNotEmptyChanged handler is very simple – it calls UpdateApplicationBarVisibility method we’ve already talked about. This method takes current data context and decides whether we should display our application bar or not.

If someone find another way to do this – please tell me. I really want to replace all this code with the single binding line I’ve shown in the very beginning.

Tuesday 8 June 2010

Organize Your Bookmarks

bookmark I browse web on everyday rate, it’s a part of my professional education and I really praise the Web for opportunities it gives me. I surf through pages here and there and sometimes I find something really interesting I just have no time to read now or something that should be saved for later. That’s the case where bookmarks save the game.

Bookmark is a simple tool that allows you to save a link in your browser and access it later. This tool may seem so easy and obvious that people just stop paying attention to bookmark organization and they end up with UI mess. So what to do? I suggest using principles borrowed from people who work with papers every day. They have several folders on their desktop that contain different items. Let’s think how to apply it to bookmarks management.

First, we need some folder to contain all input not processed bookmarks. Let’s call it New folder. Any new bookmark you want to add but don’t know where exactly it belongs should be placed here. You should process this folder at least once a week to avoid cluttering. ‘Processing’ this folder means moving items from it to trash can or to other folders.

Second, we need some place to store links that we’ve read and want to save for future. Let’s name it Info folder and use it for these bookmarks. The problem is that usually we have a plenty of links of such type so we need inner categorization. As for me, I have folders ‘Windows Phone 7’, ‘Presentation’ and ‘Neural Networks’. When I place some bookmark to Info folder I decide whether it belongs to folder root or needs categorization. When there are too many items of same type in Info root I create an appropriate subfolder and move them there.

Third, there are links that require some action, like buying, downloading, blogging, etc. The Todo folder is a nice place for such items. My Todo folder contains such subfolders as ‘To buy’ (with yet another subfolder Books), ‘To download’ and ‘To blog’.

The only thing that remains uncovered is a bunch of links that we access every day, such as issue management dashboard, mail, RSS reader, etc. I have two main items: JIRA dashboard and AgileZen dashboard – so it’s rather logical for my folder to be named Dashboards. You may name it as you with.

So, we ended with the following categories:

  1. New – for new items
  2. Info – for items that need to be remembered
  3. Todo – for ‘call to action’ items
  4. Dashboards – for links that we access every day

Almost all modern browsers have out-of-box or extension-based bookmarks sync tools. I use Google Chrome and it’s really awesome to access my bookmarks at any PC I use (actually, three of them).

And just one more thing to remember: clean your bookmarks once a month. They may become outdated or not interesting to you. Don’t show mercy – eliminate them in the name of Order and Productivity.

Friday 4 June 2010

The Importance of Reading Books

Book The title of this post may seem rather obvious, but believe me – it’s not obvious for many many many programmers all over the world. These people ignore books as a source of information and by this they basically slow down their professional development to turtle speed. I hope you’re not one of them! :)

WHY do we need to read? From the primitive point of view, there are two ways to increase skills: theorize and practice. As with all opposite things it’s crucial to find a balance and is a complete mistake to shift entirely to one side only. People who theorize only will always fly in the sky with no practical implications of their knowledge. People who practice only will never have enough knowledge baseground for really full and hard practice. While programming provides you practice, reading is the only way to improve your theoretical background.

So, WHAT to read? One very important point to remember about reading is be balanced. Yes I know that’s just I said before, but in this time the edge cases are different. Programming books are only one edge but I recommend you to have a look at these ones:

  1. Fiction (science, fantasy, pulp) – fiction is a really good source of inspiration and relaxation
  2. Psychology – this one may be strange but listen to me. We all communicate on daily basis, communicate not only with computers, but also with real people. And if we think natural to improve our skills of working with computers – why not improve our skills working with other people? As for me, I read psychology books just because they are damn interesting!
  3. Art – from all points of view I prefer to think of programming as of an art. We create, we construct, we imagine, we innovate.
  4. Business – this category includes all books about time management, career management, success stories, marketing. You may think why you have to read books that cannot be directly applied to your profession but you’re mistaken about their implication. Most business books can be directly applied to programmer’s work. Success stories are about how to achieve what you want. Time management is the basis of project and team management.
  5. Project management – this one is very obvious – we all meet PMs every day and some of us are PMs :) Let’s try to understand these people and finally know what they want from us!
  6. Presentation – I differ these from Art category because they’re more about explaining, not expressing. Your idea is worthless if you can’t present it.

You may concentrate on two or three of these categories but I inspire you to pay attention to all of them and find your own areas of interest.

WHEN AND WHERE to read? I usually hear from many people - “When should I read these books? I have no time!”. When – any time you’re wasting your time waiting for someone or something, any time you are doing nothing useful – like moving in the underground. You can easily find time for books if you really want this.

HOW to read? Of course you should read all books the way you prefer most, but you should remember some basic principles:

  1. If book has some points to think about like a patterns book – “schedule” some time to think about it. It’s not actually a time planning – just don’t read chapters one by one. Read several points and stop reading for some time. Think about these points when driving or anywhere else. Return to reading only if you are sure you have processed information you’ve already received.
  2. Don’t read trash books. Yes, there are horrible books and there are a plenty of them. Try to find book reviews before reading it or subscribe to some passionate reader who’s not lazy enough to write book reviews in his own blog (just like me :))
  3. Read only things that are interesting. If you’re reading something that is not interesting to you – you’re wasting your time because nothing of it will stay in your head after you close this book. However, if you know this book is damn important – change your attitude to it and make it interesting :)

And now, stop reading this and go find some interesting book!

Thursday 3 June 2010

Using AgileZen for your career management

logoWhat is your career if not yet another project? It has it’s own iterations, goals, results. So why not manage it like a project and don’t leave it uncontrolled? I do recommend you doing so and use any project management tool for that. In this post I’ll cover basics of career management using AgileZen as a wonderful example of project management tool.

Goals are main units of career management. You usually aim for something and try to reach it – that’s a nice thing to plan and control!

Basically there are several phases (or states) for your goals:

  1. Backlog – a pile of goals you haven’t yet assigned to any other phase. All new goals are placed into this phase automatically
  2. Permanent goals – this is something you have to keep in mind almost every day. These goals usually are abstract and have no concrete steps. “Improve communication skills” may be an example of such a goal.
  3. Long-range goals – such goals are something concrete like “Study Domain Driven Development” but you didn’t plan to reach them in the nearest future.
  4. Short-range goals – such goals are also concrete and differ from long-range goals only in execution period – they will be started in nearest future.
  5. In progress – such goals are executed right not, for example, you have started studying NHibernate
  6. Complete – such goals are history


Each goal starts in backlog. If it’s a permanent goal – it will reside in Permanent goals section and will most likely go directly to Completed phase in the future. If it’s something concrete that should be done – it will be moved to long-range goals, then to short-range goals, then it will be started and then moved to completed goals. This is an example of career board:


AgileZen is really useful for organizing these phases and usable for creating goals and moving them all around. Goals in AgileZen may have subtasks that can help you to structure your task and complete it step by step. What is awesome – AgileZen has a Free plan that is available for single project with a single person – just what we need for managing our careers.

I use AgileZen for my career management, blogging and education and I’m absolutely happy with it. Go try it and be in control!

Wednesday 2 June 2010

Book Review: The Back of the Napkin

Hey, you really like hovering images, don't you?Due to my profession I often find myself explaining something to someone and more and more times I catch myself on grabbing anything I can draw with and start visualizing my ideas. It’s just much easier to explain if you have some visualization points you can easily roll back to – just pointing at them with your finger. All I knew about visualization was intuitive so it was really great to find a book that covers visualization in depth – The Back of the Napkin by Dan Roam.

This book is very good in organizing your mess of intuitive visualization ideas into clearly distinguishable piles of sorted ready-to-use ideas. Dan is an expert in applying ideas visualization to solving business problems and throughout his long career he extracted some basic principles and patterns that are now presented in this book.

Dan explains the process of processing information and presenting it to other people. He describes how information enters our eyes, enters our brain, transforms into adequate understanding and then is presented to listeners. Then Dan looks at each phase in details, highlighting most important aspects of it. You’ll know what questions use to universally analyze any situation (the 6W principle), how to choose what edge to pick (SQUID system) and how to wrap this all with logic and defeat your current problem.

All these principles and patterns are wrapped with interesting real-life stories and are very easy to understand when reading the book. Go get one – you won’t regret it!

Wednesday 19 May 2010

jPageFlipper 0.9 released!

cars flipper Yesterday in the late evening I made my new project available as an open-source jQuery plugin. jPageFlipper is a page flipper implemented in JavaScript using HTML 5 <canvas> API. It requires no Flash or Silverlight – just a modern browser.

It is based on a page flipping technique described in a wonderful article by Rick Barraza so you can be sure pages move just as they move in real life :)

jPageFlipper is available under the MIT license at Codeplex website: http://jpageflipper.codeplex.com

It’s not ready for production as it needs some polishing and unification though it’s nice enough to say “Wow! It’s in JavaScript”!

P.S. What’s the most interesting, it works on iPad – though veeeeeery slow ;)

Friday 14 May 2010

Book Review: Adrenaline Junkies and Template Zombies


I like books about patterns. Really. They’re not about some silver bullets that can save people, they’re the essence of experience of people who are smarter than I am – and I like it.

I like books about management. Not just project management, but bringing order into chaos – that sort of things.

So what about book about management patterns? I just love it! Really, it’s wonderful. I could buy this book for only its authors but after reading it – I should have bought it even If I didn’t know any of the authors.

This book is a compilation of patterns of project behavior that authors have observed throughout their careers in projects of different sizes and methodologies. There is no complete story – it’s just a set of patterns that can be read from the beginning or from the end – but they should be read. Some things are rather obvious like Dead Fish and some are not like Telling The Truth Slowly. Some are with humor, some are rather sad. Some gave me ideas on how to organize things in my own company (if I ever run one) like Food++. Some are just useful.

Like any other pattern books – it should not be read once and put away. No, it should be read from time to time – at least once a year – just to remember what’s written there. I know I have not much management experience so surely I’ll look at some patterns differently when reading them next time.

As any other pattern it can not be directly applied to any project case. It should be adopted, changed and tuned for each particular case. What’s the use of it then? You have the starting point – you know the idea of what should be done and implementation will follow.

So now, stop reading this and go get one.

Wednesday 5 May 2010

A small test of HTML 5 canvas

I just want to try whether I can post HTML 5 canvas tricks to my blog :)

UPD: Nope, I can't :(

Monday 26 April 2010

Expression Blend 4 RC Installation – “File is corrupt”

I’ve downloaded Expression Blend 4 RC two times: from Google Chrome and from Download Master. Each downloaded executable behaves the same: it breaks on unpacking with an error “File is corrupt”.


I’ve googled about it but the only case I’ve found was exactly the same case with Expression Blend 3 installation. The only possible reason for that error was low system memory. I’ve closed all apps and even restarted my laptop but it didn’t help.

What’s the problem, guys?

Thursday 15 April 2010

Opera in AppStore – What’s Next?

firefox_iphone_fakeSo Apple has finally allowed some other browser to enter AppStore. What can be a result of this? When there was only one browser – it seemed fine. But when there are two of them – the third and fourth places are logical to come.

The most probable candidate for next iPhone browser is Mozilla with their Firefox/Fennec. It is now available for Nokia’s Maemo platform only but Mozilla mobile department have nice plans for other platforms too. So why not consider iPhone? Yes, it will be risky, but it will be worth it – iPhone/iPad as a platform is a really nice piece of cake.

Wednesday 14 April 2010

Opera Mini Hits App Store


Yes, Apple has allowed Opera to push their new mobile browser to AppStore. To be short: it’s AWESOME. Safari loses on every point I’ve checked for about half of an hour. Opera Mini is FAST, has a plenty of options, it can save pages locally and access them without Internet access.

Go get it in AppStore for FREE!

Tuesday 13 April 2010

Apple vs Adobe: Success Story

These days only lazy keeps silent on the hottest ‘companies war’ topic: Apple has completely kicked Adobe out of iPhone/iPad devices. I won’t dive deep into this sole fact as you may read about it here and there:

  1. mashable.com/2010/04/10/steve-jobs-adobe/
  2. billmackin.com/2010/03/can-apple-kill-flash/

The question is: how can this end? Let’s have a look at the best possible (but though realistic) variant. At the end we need two happy companies: Apple and Adobe. What will make Adobe happy:

  1. Adobe Flash on iPhone/iPad – directly or via indirection layer
  2. Access to Mac OS X hardware acceleration API – for Flash Player

What will make Apple happy (keeping in mind same points for Adobe):

  1. Jobs gets his revenge
  2. Mac OS X gets fast and stable Flash Player

This maybe only a shallow view but it covers main points that bother us, users. How can both companies become happy in this conflict? If Apple gives Adobe their p.2, Adobe will provide p.2 that Apple needs. If Apple has nice and fast Flash Player on Mac OS X, why not put it to iPhone/iPad?

The only uncovered point is Jobs’ revenge and it’s the hardest point to answer. Maybe he’ll get satisfied if Adobe products will release for Macs a month before Windows release or some other candy from Adobe that fits his specific taste.

Are these points too hard to match for two mature companies? I think not. So why the hell users suffer the most?

Tuesday 16 March 2010

Windows Phone Development Follow-Up

Yesterday at MIX 10 Microsoft has finally announced development details for their new Windows Phone 7 mobile OS. So what do we know now?

1. We may use Silvelight OR XNA to build applications for WP7!  Silverlight will be used mostly for business applications and simple games and XNA will be used for building heavy 3d games.

2. Development tools for Windows Phone 7 are absolutely and totally FREE! Following this link you may download Windows Phone Developer Tools CTP that includes the following tools:

  • Visual Studio 2010 Express for Windows Phone CTP
  • Windows Phone Emulator CTP
  • Silverlight for Windows Phone CTP
  • XNA 4.0 Game Studio CTP

Yet another (but not required) tool that can be used for WP7 development is Expression Blend 4. It’s not free but users of version 3 may freely upgrade their installations.

3. You may develop your applications in emulator or at your real phone as many times as you wish. If you want to place your application to Windows Marketplace – you’ll have to pay $100 for a developer license. It’s not really a huge sum keeping in mind that people who post applications to Marketplace will get a 70%-off from price of any application there.

4. Microsoft has also provided a free e-book on WP7 development written by Charles Petzold. It’s not finished yet but has first six chapters that are quite enough to dive into the topic.

5. First phones from Windows Phone 7 Series will appear on market in August. It gives us enough time to learn Silverlight WP7 development and publish our shiny new applications to Marketplace.

It’s really juicy and provides great opportunities for .NET developers. Let’s ride that wave!

Friday 12 March 2010

MIX sessions I want to have a look at

I’ve browsed all upcoming MIX sessions and chose several worth watching:

Open Standards
HTML5 Now: The Future of Web Markup Today
The Mono Project
SVG: The Past, Present and Future of Vector Graphics for the Web

Design Fundamentals for Developers (and Other Non-Designers)
Great User Experiences: Seamlessly Blending Technology and Design
Designing Rich Experiences for Data-Centric Applications
Total Experience Design
The Elephant in the Room
An Hour With Bill Buxton
The Laws of User Experience

Ruby, Python, PHP
IronRuby for the .NET Developer
Pumping «Iron» on the Web: IronRuby and IronPython


Six Things Every jQuery Developer Must Know
How jQuery Makes Hard Things Simple
Building a Next-Generation Web Application with Microsoft ASP.NET MVC 2 and jQuery

Cloud Computing

Designing and Delivering Scalable and Resilient Web Services
Opening Up Opportunity with Twitter
Lap around the Windows Azure Platform
Building Platforms and Applications for the Real-Time Web
Microsoft Silverlight and Windows Azure: A Match Made for the Web

Windows Phone 7

Overview of the Windows Phone 7 Series Application Platform
Windows Phone UI and Design Language
Building Windows Phone Applications with Silverlight
Windows Phone Application Platform Architecture
Silverlight Performance on Windows Phone
Development and Debugging Tools for Building XNA Games for Windows Phone
Distributing and Monetizing Windows Phone Applications and Games
Building Windows Phone Games
Building a High Performance 3D Game for Windows Phone
Designing and Developing for the Rich Mobile Web


Microsoft Silverlight 4 Boot Camp
Microsoft Silverlight 4 Overview: What's in Store for Silverlight 4?
Authoring for Microsoft Silverlight 4 with Microsoft Expression Blend
The Microsoft Silverlight Analytics Framework
Stepping Outside the Browser with Microsoft Silverlight 4
Building the eBay 2 Minute Lister with Silverlight
Microsost Silverlight 4 Business Applications
An Introduction to Developing Applications for Microsoft Silverlight
Debugging Microsoft Silverlight Applications
Introducing the Silverlight Rough Cut Editor
Developing with WCF RIA Services Quickly and Effectively
Unit Testing Silverlight and Windows Phone Applications
Building an Accessible Microsoft Silverlight Experience
Securing Microsoft Silverlight Applications
Microsoft Silverlight Optimization and Extensibility with MEF
Principles of Microsoft Silverlight Graphics and Animation
Developing Multiplayer Games with Microsoft Silverlight 4
Flash Skills Applied to Microsoft Silverlight Design and Development
Developing Natural User Interfaces with Microsoft Silverlight and WPF 4 Touch
Building Large-Scale, Data-Centric Applications with Silverlight
Search Engine Optimization for Microsoft Silverlight
Accessing Web Services in Microsoft Silverlight
Building Finance Applications with Microsoft Silverlight 4
Creating Effective Info Viz in Microsoft Silverlight
An Enterprise Perspective on Silverlight 4

Internet Explorer 9

In-Depth Look at Internet Explorer 9
High-Performance Best Practices for Web Sites
Internet Explorer Developer Tools


Microsoft ASP.NET MVC Boot Camp
Beyond File | New Company: From Cheesy Sample to Social Platform
What's New in Microsoft ASP.NET MVC 2
The HaaHa Show: Microsoft ASP.NET MVC Security with Haack and Hanselman
Driving Experiences via Services Using the Microsoft .NET Framework
Building Great Standards-Based Websites for the Big Wide World with Microsoft ASP.NET 4
Web Deployment Made Awesome: If You're Using XCopy, You're Doing It Wrong
Improving Software Quality for the Modern Web

Labs, New tech, Tools

Designing Bing: Heart and Science
Advanced Web Debugging with Fiddler
Reactive Extensions for Javascript


Media Processing Workflow
Microsoft Silverlight «Media»: Moving at 60fps


Understanding the Model-View-ViewModel Pattern
Build Your Own MVVM Framework


A Case Study: Rapid WordPress Design and Prototyping with Expression Web 3
Dynamic Layout and Transitions for Microsoft Silverlight 4 with Microsoft Expression Blend
Prototyping Rich Microsoft Silverlight 4 Applications with Microsoft Expression SketchFlow


Designing Corporate Web Sites using SharePoint 2010
Building Rich and Interactive User Experiences in SharePoint
Designing an Internet-Facing Web Site Using SharePoint 2010

Thursday 11 March 2010

Wonderful Microsoft Gears

Picture provided by Victor Lazarevich:


Guess, will this system work? :)

Tuesday 9 March 2010

My small PowerShell presentation

This is my presentation from Intetics internal workshop:

Saturday 6 March 2010

Using Push-Location and Pop-Location in PowerShell

All popular shell environments have a wonderful tool named directory stack. It allows you to jump there and here in different directions and be able to return to some saved points. This feature really rules when you have to intensively work with command line. It’s really nice that PowerShell designers have implemented it with Push-Location and Pop-Location cmdlets. These cmdlets have standard pushd and popd aliases that are familiar to all *n?x and CMD gurus.

pushd is similar to cd with the only difference that it saves your previous location before moving to a new one. popd is a pair for pushd because it pops the last saved directory and changes your current directory to it. This concept is really simple, isn’t it? :)

So how to ease learning these commands? As for me I’ve:

1. Added my custom aliases to these commands

Set-Alias pd pushd
Set-Alias ppd popd

This allows me to use pushd as easy as cd. popd is a bit more complicated (1.5 times!) but it’s a good point for not losing your context accidentally.

2. Modified my prompt to display current directory stack depth

  $_locationStackDepthString = New-Object string ([char] '+'), (Get-Location -Stack).Count

Now each time when I dive deeper into directory stack I get a ‘+’ sign in front of my prompt and when I pop out I return to previous prompt state:

PowerShell pushd popd


Friday 5 March 2010

My PowerShell prompt

Just wanted to share it :)

function prompt
  $_locationStackDepthString = New-Object string ([char] '+'), (Get-Location -Stack).Count

  $color = 'Yellow'

  Write-Host '>> ' -nonewline -ForegroundColor $color
  Write-Host $(Get-Date -Format T) -ForegroundColor 'Green' -NoNewLine
  Write-Host " " $PWD.Path -ForegroundColor 'Cyan'
  Write-Host ($_locationStackDepthString + '>') -nonewline -ForegroundColor $color

  return " "

It shows current time, folder, uses a separate line for commands and displays current depth of pushd/popd commands (I use them rather intensively).

Thursday 18 February 2010

Using XmlPeek and XmlPoke in PowerShell

<xmlpeek /> and <xmlpoke /> commands in NAnt are really useful when it comes to changing configuration files during your automated build process. But do we do when we need that functionality in PowerShell? I did not find any native implementation but it's really easy to implement your own. Here it goes:

function xmlPeek($filePath, $xpath) {
    [xml] $fileXml = Get-Content $filePath
    return $fileXml.SelectSingleNode($xpath).Value

function xmlPoke($file, $xpath, $value) {
    $filePath = $file.FullName

    [xml] $fileXml = Get-Content $filePath
    $node = $fileXml.SelectSingleNode($xpath)
    if ($node) {
        $node.Value = $value


It accepts FileInfos so it can be easily used together with Get-ChildItem:

Get-ChildItem P:\MyProject -Include *.config -Recurse | %{ xmlPoke($_, "/configuration/connectionStrings/add[@name='MainConnectionString']/@connectionString", "DataSource=MyDB") }

Enjoy! :)

Tuesday 16 February 2010

What is Windows Phone 7 Series for developers?

Internet is buzzing all around about new Windows Mobile OS - Windows Phone 7 Series. Presentations are awesome, UI is nice and usable. At last Windows fans have something mobile to be proud of :)

But what is this event for us, developers? As an iPhone user and .NET developer I was rather anxious to people who could write programs for their phones and sell them at market. But looks like things have changed. We'll have a nice .NET environment at new phones - that's a fact. However, base technology still remains uncovered. According to Scott Guthrie:

re: Windows Phone 7 development: I can't say more right now other than we'll discuss it at MIX - and that it is very, very cool.

I'm not sure but I think Silverlight will be this technology. As I can judge from presentations it is already supported at WP7S devices. All needed is to allow Silverlight applications to run out of mobile browser and become an application that user can run just like Mail or Calendar. And that feature is already present in Silverlight 3 so guys have to work just a little bit more to make us very happy.

What will be next? I think I'm not the only one who wants to write mobile .NET applications so perhaps we'll see a mobile development boom in .NET community. More Silverlight developers, greater Windows Phone adoption, huge popularity raise for Expression Blend and Visual Studio - wonderful situation for Microsoft.

All these are just suggestions and we'll have official details only at MIX that will take place in March 15-17 in Las Vegas. Keeping in mind that we'll see Internet Explorer 9 there - it will be an Event.

Friday 12 February 2010

What do I need from Internet Explorer 9?

That's a really interesting question. I did not use any Internet Explorer as my main browser before Internet Explorer 8. IE8 changed my mind a bit and I've been using it for about a month and a half. Why did I jump off:

  1. Tabs opened slowly
  2. Pages loaded slowly
  3. No nice CSS features like border-radius
  4. Misses some FireBug features (although see next p.1)
  5. Too large header bars (comparing to Chrome)

What I liked:

  1. Wonderful tool for developers, it's my favorite at the moment (better than FireBug!)
  2. Tab grouping
  3. Extensibility

After IE8 I've tried to return back to Firefox but I could not stand it's strange behaviors anymore so I've switched to Chrome. What do I like in Chrome:

  1. Damn it's fast
  2. It's fast
  3. Did I mention it's fast?
  4. It has neat interface

So, what do I want from IE9? That's what:

  1. Please fix what I disliked in IE8
  2. Please add what I like in Chrome

This is a simple recipe, isn't it? :)

Saturday 6 February 2010

Mock or stub?

When I was just getting into unit testing the subject question was rather hard to me: it’s not actually obvious for a novice. The answer to it came from a unit testing book I think is very nice and useful - “The Art of Unit Testing” by Roy Osherove.
Mock or stub?

So what’s the core difference between mock and stub? The answer is: mocks can fail tests and stubs can not. You may think this minor point is not important but it is. Basically when you test something you have the following two components: code under test (CUT) and test itself. There are two different cases for testing:

1. You may run CUT and validate it results – it’s actually testing CUT internals

2. You may run CUT and validate how it communicated with some external service – it’s actually testing CUT externals

The first case usually accompanied by stubs – some stub objects that you use to pass initialization information to CUT. They just provide data and do nothing more.

The second case is usually accompanied by stubs and a mock. Let’s say you have some IExternalService your CUT communicates with. After running CUT you want to be sure that two IExternalService methods were called with some valid parameters. You can write some custom class that implements this interface but the simplest option is to use a mock. Mock allows you to specify what methods in what order with what parameters should be called. After CUT run you can validate mock and see whether it fits your expectations.

The rule of thumb here is to have one mock in your test at max. Why is that? The answer is simple: when you use two mocks and validate both of them in a single test it means that you test two different pieces of logic in one test. That may be a result of scattered logic (violation of Single Responsibility Principle) or just a bad test design – anyway it’s a bad practice. What though should be remembered is that you can use as many stubs in your test as you wish – they just provide initialization data and can’t fail your test.

Wednesday 3 February 2010

The Law of Leaky Abstractions

The concept of leaky abstractions was introduced by Joel Spolsky in his blog 7 years ago, but it's not as widely known as it deserves. So here is the basic definition:

All non-trivial abstractions, to some degree, are leaky

This simply means that if you're trying to hide something beneath your abstraction layer - it will almost always show itself up. These errors are hard to detect and have severe consequences. There are many examples of leaky abstractions:

  1. Some SQL queries are thousand times slower than their logical equivalents - DB implementation leaks into SQL
  2. SQL, in its turn, has abstractions over itself like NHibernate or Linq to Sql - and rather often you have to deal with SQL directly losing many abstraction benefits
  3. When you program GWT and write your code in Java it is later on translated to JavaScript. And what can be more confusing than having a JS error from running your Java code? :)
  4. .NET is an abstraction over Win32 and it has leaks sometimes - rarely, but these rare cases make people mad
  5. Any component framework like ASP.NET or JSF hides HTML/CSS and JS beneath them - guess what problems you may have?

What can be a conclusion of all above? It's all in Joel's original post!

Never hire a developer for working with some abstraction if he doesn't know direct underneath layer of it

It may sound strange or may be offensive for some of us but it's rather obvious: you should not hire an ASP.NET developer if he is scared of JavaScript or hire a so-claimed NHibernate guru if he doesn't know what 'DISTINCT' is?

Sunday 31 January 2010

Book Review: “The Passionate Programmer” by Chad Fowler

I’m a huge fan of books and from now on I’ll write a review on each technical (or may be not) book I read. The first book reviewed will be a wonderful book by Chad Fowler: "The Passionate Programmer”. Actually, it’s full name is “The Passionate Programmer: Creating a Remarkable Career in Software Development”. This is what this book is about – your career.

Chad Fowler is a great programmer, Ruby practitioner, musician and conference organizer. He recently lived and worked in India, setting up and leading an offshore software development center. He is co-founder of Ruby Central, Inc., a non-profit corporation responsible for the annual International Ruby Conference and The International Rails Conference, and is a leading contributor in the Ruby community.

As the author highlights, your career is the most important project in your life and you, as it’s result, is the most valuable product of it. That really makes sense if remember that your time is the most valuable resource: you can’t replenish it.

As Chad assumes you are a product, he splits his book into parts on how to promote this product:

  1. Choosing Your Market
    Here Chad describes what you should be and what niche you should take, what skills to develop and what technologies to specialize in.
  2. Investing in Your Product
    This part is about how to develop yourself, not what but how. How you should sharpen your skills, how you should choose a mentor.
  3. Executing
    Where to apply yourself, how much you are worth, how to behave in stress situations – you are a product and this part is about how to execute you and produce value.
  4. Marketing… Not Just for Suits
    Advertise yourself, make people believe you’re the one they need, be public – the marketing of product from all practical aspects.
  5. Maintaining Your Edge
    You’re at the top, you’re the king – but what next? Chad devotes this part to you-product maintenance: looking for future employments, planning your next career steps.

This book is good. Very good. My favorite statement from it is “Be the worse” – be the worse in your team meaning that all around are better than you. In this case you’ll grow up much faster than in any other case.

Thursday 28 January 2010

Joining your social bits in one service

I'm using Twitter as my main way to express myself to other people. It's ultimately nice for sharing links and thoughts. However, I had also two other services that I could not synchronize with Twitter... since now.

Welcome, here come the TwitterFeed! Wonderful tool for joining all your services into one:
1. Google Reader - I share items time to time and now they are automatically reposted to Twitter. Step-by-step tutorial on how to configure TwitterFeed to get your Google Reader items - http://goo.gl/s0NK
2. Blog - my monthly posts rate is extremely low these days but I promise I'll speed up :) This post will be the first one automatically reposted to Twitter.

Also TwitterFeed plays nicely with OpenID so feel free to expose your Google or MSN account to it.

Sunday 10 January 2010

Fixing Twitter for Chrome with User JS

I'm a rather conservative Twitter user and prefer web interface to all the others. The only thing in it that have been bugging me since I've started using it was impossibility of submitting tweet with Ctrl + Enter shortcut. And today I've fixed that (yeap, I'm damn proud of myself!) using User JS script for Chrome.

Yes, it only fixes Twitter in Chrome and may possibly fix it in Firefox with GreaseMonkey (I did not check it!).

So, first of all - make your Chrome accept User JS.

1. Switch to development channel of Chrome
2. Enable User JS in Chrome using "--enable-user-scripts" shortcut flag as it is described here
3. Restart Chrome
4. Copy this code and paste it to file named Twitter.user.js :

// ==UserScript==
// @name Twitter extensions script
// @description Short script that gives some features I really miss like Ctrl + Enter way to submit tweets.
// @version 0.1
// @include http://*twitter.com/*
// ==/UserScript==

console.log('Started Twitter script');

var txtStatus = document.getElementById('status');
if (txtStatus == null) {
txtStatus.onkeypress = function (e) {
e = e || window.event;
var keyCode = e.keyCode || e.which;

var ctrlKeyPressed = e.ctrlKey;
var enterKeyPressed = keyCode == 13 || keyCode == 10;

if (ctrlKeyPressed && enterKeyPressed) {
console.log('trying to submit tweet...');
var submitTweetButton = document.getElementById('update-submit');

return false;

5. Drag and drop this file to opened Chrome
6. Accept script installation
7. Enjoy Ctrl + Enter shortcut in Twitter web interface! :)