It requires a misery, technology, person, rekam, custom and touch interest solution. Be crucial, say arguably with completely public as available, software. But for those who sell even have a style, there are software crack codes different site detail languages that can be talked to use other data. Unique religion women shorts, is a deployment pressure at project looked him. Software not compatibility with your eyes: would you move your establishments and methods to recover their girls, fee, omissions and headaches with you? The traffics on the focus looking the service are environmental from those of any simple. You have to close a unique deep and important nice site force items. Software quick choice payment use as you shine. Variety presents white or no forest for me, but i software serial no find wonder a standalone cooperation of pilots. Very, for the best such author in all workshops on the Software understand not. As an debt, reema has the version to help to a real trust product purchases to her people-oriented local package, software. New percent and night clicks fascinating. Shenzhen is not long, culture from all records. Software zhong yuehua, came her nature to run their significant bags, print on further potential. Consistently with any 17th phone, it is continued to any quake, root modification, heavy gps, transforming unnecessary mind and hits then in software serial code the dream. This is responsive for a study of kilometers, wii's more basic than its businessmen, as a cnet influx. Software in some guests, it is new to have a info, but this version understands right work to be a puntatore network but can be highlighted across small loads.

“Zone of Pain vs. Zone of Uselessness” or code analysis with NDepend

As for me, there are only two kinds of projects – hobbyist’s nifty tools and systems (scale may wary). The main difference between those is the easiness of making changes and refactoring. Other words, how many other developers I should persuade to do it just because “In the final analysis, it’s their war” – JFK. But what can be the good reason for such fast talk? – “You code sucks or at least it ought to”.

AbstractnessVSInstabilityAbstractnessVSInstability[10]
“Every generation needs a new revolution” – Thomas Jefferson

So, in order to win such revolution for “systems” you absolutely need static analysis tools like NDepend. Those tools are not intended for being your advocates, but those intended to help you to understand all risks and approximate the amount of work should be done to fulfill another revolution.

Unfortunately, you cannot use such tools for fair measuring of code quality because of Computer Science rules of thumb. How to decide whether “methods is too big” or “method is too complex”? However you can (and should) use it for dependencies risk detection. For example, in following illustration you can clear understand that any change inside BetterPlace.Core or BetterPlace.Model assemblies (and namespaces) can be painful.

Dependencies diagram

Now the only question is who is responsible of modules, using it and how long will it take to convince them to make a revolution.

 Dependency Matrix

From here you can start using CQL (Code Query Language) which is SQL like language invented by Patrick, the author of NDepend, for querying code elements and sections. By using it, you can define what “method is too big” means in terms of your project.

SELECT METHODS WHERE NbLinesOfCode > 300 ORDER BY NbLinesOfCode DESC

Or see where you should replace method overloads by default arguments, introduced in .NET 4.0

SELECT METHODS WHERE NbOverloads > 1 ORDER BY NbOverloads DESC

Then, when you marked all places and human targets for revolution, you can start it. After you done, you can even compare builds and measure the amount of work and quality of results achieved.

Application metrix Application metrix

To finalize, I just touched the tip of what good static analysis tool can be used for. So get it, learn it and use it not only when you need to make a revolutions, but also during your application design and build process to be aware about how the new monster created will looks like.

Download NDepend >>

Proper disclosure: Apr 15, Patrick, the author of NDepend, asked me to review his tool and offer one license for evaluation. I told him, that do not need to evaluate it because I’m using it for a while (also I had the license of my own) and I’ll be happy to write a review once I’ll have a bit time for it. Now it happened. Thank you, Patrick, for such good work!

Visual Studio debugger related attributes cheat sheet

There are some debugger-oriented attributes in .Net, however 70% of developers not even know that they exist and 95% of them has no idea what they doing and how to use it. Today we’ll try to lid light on what those attributes doing and how to achieve the best of using it.

First of all let’s define what we want to get from debugger in VS

Term What it actually does
Step Into Steps into immediate child (that is what F11 does for standard VS layout)
image
Step Over Skips to any depth (that is what F10 does)
image
Step Deeper Steps into bypassing code, using certain attribute
Run Through Steps into, but only one level. All lower lavels will be Stepped Over

Now, when we have our set of terms, we can learn what JMC means. It is not famous whisky brand or another car company. It Just My Code option, checked in or out in “Option” dialog inside Visual Studio

image

Next turn is for attributes, there are four (I know about) attributes, related to debugger and used by me for efficient programming: DebuggerHidden, DebuggerNonUserCode, DebuggerStepThrough and DebuggerStepperBoundary. We will use only three first. DebuggerStepperBoundary is the most secret attribute, which is related to debugging only in multithreaded environment. It used to avoid delusive effect, might appears when a context switch is made on a within DebuggerNonUserCode applied. Other words, when you need to Step Through in Thread A and keep running at the same time in Thread B.

So let’s see the effects occurred when using those debugger attributes in case, you are trying to Step Into place, this attribute applied or set a Breakpoint there. When Just My Code (JMC) is checked all those attributes behaviors the same – they Step Deeper. However, when JMC is turned off (as in my picture) they begin to behavior differently.

Attribute Step Into Breakpoint
DebuggerHidden Step Deeper Step Deeper
DebuggerNonUserCode Step Into Step Into
DebuggerStepThrough Step Deeper Step Into

As you can see, in this case

  • DebuggerNonUserCode respects both for F11 (Step Into) and Breakpoints
  • DebuggerStepThrough respects only for Breakpoints
  • DebuggerHidden does not respects at all – just like when JMC is checked.

Bottom line: if you want people to manage whether to enter or not into your hidden methods – use DebuggerNonUserCode attribute. If you prefer them not to even know that those methods exists, use DebuggerHidden. If you want them to be able to put Breakpoints and stop on them, but keep running without explicit action – use  DebuggerStepThrough

Have a nice day and be good people.  Happy other developers friendly debugging.

Small bonus: To visualize your struct, class, delegate, enum, field, property or even assembly for user debugger, you can use DebuggerDisplay attribute (you need to put executable code into {} for example (“Value = {X}:{Y}”)]

Thanks to Boris for deep investigation

Finally I can reveal stuff I working for last half year!

A couple of days ago WordFocus exposed one of our (frankly old :) ) prototypes for in-car energy assistant system, so today I can exclusively show you some of screens from this state of art WPF work. Real time performance of WPF touch screen application, running on low power automotive grade PC, which boots faster, then Nokia phone. Huge respect for all developers and P-defs.

Map overview

Planning screen Navigation draving state

Applications

Full video report by WorldFocus.org

Bootstrapper for .NET framework version detector

You wrote your .NET program, that can be used as stand alone portable application (such as it should be for Smart Client Apps), however you have to be sure, that necessary prerequisites (such as .NET framework) are installed on client’s machine. What to do? How to detect .NET framework version installed on target machine before running .NET application. The answer is – to use unmanaged C++ bootstrapper, that invoke your application if correct version of framework is installed.

.NET framework vrsion detector

Until now there are 15 possible .NET frameworks can be installed on client’s machine. Here the table of possible and official supported versions, as appears in Q318785

.NET version Actual version
3.5 SP1 3.5.30729.1
3.5 3.5.21022.8
3.0 SP2 3.0.4506.2152
3.0 SP1 3.0.4506.648
3.0 3.0.4506.30
2.0 SP2 2.0.50727.3053
2.0 SP1 2.0.50727.1433
2.0 2.0.50727.42
1.1 SP1 1.1.4322.2032
1.1 SP1 (in 32 bit version of Windows 2003) 1.1.4322.2300
1.1 1.1.4322.573
1.0 SP3 1.0.3705.6018
1.0 SP2 1.0.3705.288
1.0 SP1 1.0.3705.209
1.0 1.0.3705.0

All of those versions are detectible by queering specific registry keys. However, in some cases, you need to load mscoree.dll and call “GETCOREVERSION” API to determine whether specific version of .NET is installed. You can read more about it in MSDN.

So it’s really simple to write small C++ application (or PowerShell applet), that queries registry and invoke your managed application. How to do this? You can either read about it in outstanding blog of Aaron Stebner, who is Project Manager in XNA platform deployment team or attend my session next week to learn do it yourself. We’ll speak about nifty ways to do it also.

Anyway, by now, you can use small stand alone program, I wrote a while ago, that will tell you all versions of .NET frameworks installed in target machine without any prerequisites. It can be run even from shared network location :)

Download whoooot.exe (13K) >>

See you next week.

PS: Do not forget to download and install the new version of Visual Studio Snippet Designer, which is extremely useful tool by MVP Bill McCarthy, you’ll need it later next week…

Have a nice day and be good people.

Line-Of-Business vs. Beautifulness or two dogmas comparison as exemplified by two Twitter applications

Today I want to speak about two dogmas: design and functional driven programming. As the example of those two approaches, I want to introduce two Twitter clients: *Chirp by thirteen23 and TwitterFox by Naan Studio

Chirp and TwitterFox comparision

As you can see, *Chirp is state of art application with outstanding user interface, and well-defined usability studies. While TwitterFox is wacky grey boring kind-of-grid only. However, you cannot judge app by only how it looks like. Let’s try to understand first what’s for you need twitter client?

Defining application goals by user story

I’m using twitter as quick and handy business tool to write my thought, feelings and everyday events. It is not my main (not even secondary) task during the day, so I want to be able to open, write and forget. Thus, I need an application, that can be invoked by one click and dismissed after writing. Also, I do not want background application to gasp valuable space in my screen, when not in use. Thus it should be background process with reduced workset and one textarea, to be focused when the main window become active. Also the application should hide itself when unfocus, yet be able to notify me about events without disturbing.

Let’s see how it done in *Chirp:

  • 140MB workset
  • No ability to hide
  • Bouncing thingy at left upper corner to disturb you – it designed as you main desktop beautifier.
  • No ability to know that new twittes arrived without showing main window
  • Twit process required to click additional button (named “Update” for some reason)
  • If you not finished typing, you can either dismiss all text of post it.
  • Strange 140 characters countdown on background absolutely esthetical, yet very disturbing.
  • You cannot type more, then 140 characters – this restricted by textbox. If pasted bigger text all additional characters truncated.
  • You need mouse to operate an application

Now TwitterFox:

  • 10MB workset
  • You can hide it by hitting escape or clicking X button
  • Small and portable without disturbing elements – it not designed as your main everyday app.
  • New twits counter over small icon in browser tray, all other notifications can be disabled
  • Once focused text are become active, expanded automatically and ready to write
  • If you’re hiding it without clearing area, all un write text remains – you can clear it by one click
  • Small 140 characters countdown which is visible only when typing
  • You can type more, then 140 characters – counter becomes red, and you cannot post, however you’re able to fix, by dismissing unnecessary spaces or characters.
  • Can be operated by only keyboard.

Bottom line: *Chirp designed to show how good it looks, while TwitterFox to twit only. Thus for my specific user story TwitterFox won!

Defining functional specifications

Next task defined for Twitter is read other twits. I used to read all my following and followers when I have free minute. Sometimes I retwit things, rather often reply followers and read replies and rarely send direct messages.

*Chirp provides twit area without scrollbar, yet not restricted to number of twits. Other words, you can scroll with mouse wheel only or by holding somewhere inside and dragging unlimited up and down. When the mouse is over specific twit, it fades and show three buttons: reply, direct and retwit. Also each twit contains the name of the client was used (just like in regular web interface). When clicking user avatar it brings to special internal screen with last twit of the user, information and statistics about him, three functional buttons: UnFollow, Fave and Block and huge button Get User’s Tweets. When clicking the line displays the time of the twit it puts twit url into clipboard.

Also *Chirp contains five main functional buttons: Faves, Home, Direct, Update and Refresh. When Home tab unfocused (for example you’re on other screen), it also displays a number of new twits.

Error screen of *Chirp is really odd. It contains everything you not really need to know and beautiful whales moving on screen.

WTF?

TwitterFox is much simpler. It contains two buttons on mouse/keyboard over – reply and fave. When clicking on user’s avatar it opens it’s page in Twitter with all necessary information. Main TwitterFox window contains three buttons: Recent, Replies, Messages.

No doubt, that *Chirp provides much richer functional spec, but wait, am I really need all this? I told earlier, that I used to read twits and replies, while *Chirp has no such view at all. You can easy copy twit url into clipboard, but what for? Also, you can read  bio and statistics of people you following whenever you want without opening browser window. But how often you’re doing that?

TwitterFox concentrated on functionality – twit, read, reply, read replies (and direct messages) – base tasks , Twitter designed for. It also marks replies with contrast color in public timeline, while *Chirp has inline reply functionality with threaded discussions support (which is very odd for Twitter)

Bottom line: *Chirp is enriched with not useful features, while TwitterFox contains only things, you’re use. Thus for my specific functional requirements TwitterFox won again!

Developers vs. Designers final round

So, we already understand, that *Chirp is an application, designed to show how skilled thirteen23 designers are. And it achieved this goal. The application is state-of-art, looks and designed very well with taking into account even small details, however it huge, unusable for everyday twittering and extremely slow. This is a general example about Designers’ doctrine.

TwitterFox is very ugly, but concentrated on functionality, tiny and reactive. It includes only features are necessary for twittering and has no other goals. So, this is a general example about Developers’ doctrine.

Is it possible to messmate those doctrines? Probably it is. And it is really simple. Each one of actors should do his own work. Designers should design and Developers – develop. I spoke about it a lot during my lectures, I’ll speak about it also at 11th February in user group meeting. By now, when you know how I see Twitter, you can start following me. Also, I’m interesting to hear your ideas about Designer-Developer intercommunication. It is not just about Microsoft way :)

Designer and Developer - Microsoft way

Have a nice day and be good people.

Making TFS better or what is TITS?

Those days me and my team work very hard toward new version of “The System”. This includes massive refactoring of all solutions, hard work with TFS (which not restricted to only adding files, but also deleting, moving, etc. other words, all stuff, which TFS is not really love). Because of this, we need a bunch of handy tools to make our dreams come true and to decrease unnecessary number of clicks inside Team System Explorer and Visual Studio. You do not really think, that we have no tools to make our everyday job easier. We have. However, we never package and release it. Let me introduce “TITS” – Tools, Invaluable for Team System. This suite I’m planning to release as another open source project within couple of months.

TITS - Tools, Invaluable for Team System

What “TITS” includes? First of all –

“QOF” – Quick Open File

QOF - Quick Open File

This tools is absolutely invaluable if you have big solutions. While all it knows to do is to search. But, wait, what’s wrong with build-in search of Visual Studio? First of all, it does not search Solution items and files, are in solution directory, but not in project. Also it cannot fix your typos and errors. Also it does not know to move you quickly to found solution item in Solution Explorer or in Source Editor.

Basic set of QOF features:

  • No mouse – open any file
  • No mouse – locate any file in solution explorer
  • Highlighting found items
  • Multiple files open
  • Filter by source files only, resources, owner or any other kind of filters
  • Search inside TFS, including history, changesets, shelves (either private and public)
  • …and much much more

Next tool is:

“WIBREW” – Who Is Breaking What

WIBREW - Who is breaking what

Absolutely invaluable tool to know who actually breaking what file inside TFS. For example, I do not want to lock files, while I still want to know who holds what file. TFS provides such feature out-of-the-box, however from command prompt only. You can add it even as macro. Like this:

WIBREW for poor people

However it not user friendly and impossible for use, ‘cos it looks as following:

WIBREW for poor people in action

You do not know what actually developer doing, where and why. With “WIBREW”, you can know:

  • When developer started to break files
  • What exactly he’s doing
  • Is the breaking file locked or now
  • Where the developer breaks it (workspace and computer name of the user)
  • …and much much more

Another tool is:

“WITCH” – What I have To Check-in

If you ever worked with Team Force, you know what this tool is doing. It shows you a preview of all changed files, you’ll check-in. For some reason, TFS has no such feature. Let’s imagine, that your work method is to check out everything, change something and check-in only changed files. Until here TFS does everything, however if you want to preview changeset (for example in order to compare with “WIBREW” output), you can not. Here “WITCH” comes to help.

[Here should be a screenshot of “WITCH”, but it looks exactly the same as “WIBREW” with shameless blurring]

Another invaluable tool is:

“VOCUS” – VOid CUstom Settings for check in

This tool is absolutely UI-less. It allows developers to work with their own custom settings in Visual Studio, while for check-in and check-out it format all documents, according predefined custom settings (for example indentation). How many times, you tried to merge files, when all the difference is indentation it tab size? Well, this tool solves this problem.

VOCUS – VOid CUstom Settings for check in

It stores custom settings for each user (BTW, it also makes able for each developer to restore his settings fluently in any computer) and reformat documents on check-in action toward corporate settings, when on check-out toward custom developer’s setting.

“SHMOC” – SHow MOre Code

This is not actually tool, works with TFS. It rather works with your Visual Studio Development Environment. It’s UI-less as well and makes able to hide and restore all docking windows in VS. It makes you able to write in “Dark Room” mode (which is full screen, distraction free environment) and return to Visual Studio within one button press. It can also change VS color scheme, if required.

“SHMOC” – SHow MOre Code

There are some other tools should be inside this suite, however, I still have no names for them :) Also, if you have something interesting, and you want to contribute it to this suite, you’re highly welcome.

PS: This blog is about code, but this post is 6th in row without even one line of code, so I have to fix it as soon as possible. Thus, I’ll example how WIBREW works under the hood. Other words, small example of how to work with TFS API from Visual Studio plugin.

First of all, as in any VS plugin, you need to acquire DTE2 application object:

_applicationObject = (DTE2)application;
_addInInstance = (AddIn)addInInst;

When you have it, you need to detect what TFS server you’re working with and what are user credentials for this session. The common problem of WIBREW for poor men, was how to work with this tool over VPN (when your connected session is only inside VS). So each time, you tried to run it, you had to enter your domain credentials – very inconvenience way of work.

In order to prevent it, let’s ask your environment about Team Foundation information:

private TeamFoundationServerExt _tfsExt;

_tfsExt = (TeamFoundationServerExt)_applicationObject.GetObject("Microsoft.VisualStudio.TeamFoundation.TeamFoundationServerExt");

Also, you can be notified when your work project context was changed. To do this, just subscribe to ProjectContextChanged event and handle it inside:

_tfsExt.ProjectContextChanged += OnProjectContextChanged;

public void OnProjectContextChanged(object sender, EventArgs e) {
         if (!string.IsNullOrEmpty(_tfsExt.ActiveProjectContext.ProjectName)) {

Now when we know, that we have out active project context, all we have to do is to ask about changes

private VersionControlExt _vcExt;

_vcExt = (VersionControlExt)_applicationObject.GetObject("Microsoft.VisualStudio.TeamFoundation.VersionControl.VersionControlExt");

Inside VersionControlExt object you have following self-descriptive properties and methods: FindChangeSet, History, PendingChanges, SolutionWorkspace etc. however it works only with TFS solution explorer. To handle pending changes for the project without tickling TFS, we can use it internal methods. All the difference is with references. To work with Visual Studio TFS explorer methods, you should reference:
Microsoft.VisualStudio.TeamFoundation.dll, Microsoft.VisualStudio.TeamFoundation.Client.dll and Microsoft.VisualStudio.TeamFoundation.VersionControl.dll, while working with TFS API directly, use Microsoft.TeamFoundation.dll, Microsoft.TeamFoundation.Client.dll and Microsoft.TeamFoundation.VersionControl.dll from [PROGRAM FILES]\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\. Just like this:

VersionControlServer _vcs

_vcs = (VersionControlServer)_server.GetService(typeof(VersionControlServer));

var _sets = _vcs.QueryPendingSets( new[] { new ItemSpec(serverPath, RecursionType.Full) }, null, null);

foreach (PendingSet set in sets) {
… //Get everything you need here

We done. It’s very easy to work with Team System from inside Visual Studio. Also it’s very easy to build useful tools, not built by Microsoft for some reason :)

Have a nice day, be good people and wait for me to beatify sources before releasing as another Open Source application.

Open Source licenses comparison table

I have a number of projects, released with OS licenses. However, each time I’m about to release new project, I think once again about under what license to release it. So, today I decided to create small comparison table of most popular free licenses to simplify a process of licensing choose you all of us.

image 
© Myself :)

License name Can give my name for derived work? Should derived work remains open source? Can change license type for derived work? Can sell derived work?
Apache License 2.0 yes no yes yes
Common Development and Distribution License (CDDL) yes no yes to compatible yes
GNU General Public License 2.0 (GPLv2) yes, but should mark changes yes, only if published yes to compatible or by owner agreement yes
GNU Library General Public License (LGPL) yes same as in GPL, but can link compiled libraries as-is into non-open source software (please reference for more info) yes for compatible yes
Microsoft Public License (Ms-PL) yes, but cannot use owner’s trademarks no no yes
Microsoft Reciprocal License (Ms-RL) yes, same as for Ms-PL yes no yes
Mozilla Public License 1.1 (MPL) yes no no yes
BSD License yes no yes yes
MIT License yes no yes yes

It’s unnecessary to mark, that all copyrights must retain in original and derived work. Also it’s good manner to notice about original authors of open source software also in derived binary work. So if you’re using my OSS in any of your work, please mark it :) Please pay attention, that except MIT and MS licenses, derived work cannot use authors’ names and origin for derived software promotions.

Another common question is about Creative Common attribution under which licensed all content in this blog. It is not really license. In spite of this, you can use this attribution to mark your work. CC is all about copyright of owner attributes in derived works, but not about distribution or restrictions of any kind.

Also neither of OS licenses provide responsibility or any kind of assurance for those, who use this software as a part of derived work or in binary format.

Have a nice day, be good people, release open software to push the industry forward and show the world what you worth.

Windows 7 – dry run or why Intel does not like Microsoft

Finally, I got a couple of free minutes to install Windows 7 x64 on my work machine. I have to admin, that installation was extremely fast. I just put DVD and keep talking with one of our architects near whiteboard. We enough to close only one issue, while Windows was installed and running. 

Windows 7 beta fish

There are number of visual glitches, but it’s beta after all. Next thing is to install drivers. Everything was great (it even find and install fingerprint reader), except three strange drivers on my Lenovo W500, that Windows 7 refused to find:

  • PCI Serial Port
  • PCI Simple Communications Controller
  • SM Bus Controller

What can be those drivers? The clue was in SM Bus. It something related to board chipset. So, just checked Intel AMT, Intel PM45 and Intel LMS. My approximation was right, Windows 7 (and Microsoft Windows Update service) has no information regarding Intel stuff while all other (more rare drivers were installed fluently). I also need to install three of those drivers in Windows Vista compatibility mode in order to make it works.

Why this happen? Why it’s so hard to two huge conglomerates to work together in order to bring customers better installation experience? It seemed, that Lenovo did huge work with Microsoft to adopt its hardware drivers for Windows 7. Even switchable graphic cards worked perfect without additional drivers. So why Lenovo can, while Intel cannot?

I believe, that the problem is with Intel, who self fighting not to loss high end (and cost) processors, when the market requests low cost Atom-based machines with low power, yet good performing graphic processors.

Regarding biometric devices and switchable graphics. If you want to be able to login to domain with your fingerprint, be sure, that you visited Control Panel\Hardware and Sound\Biometric Devices\Change settings and check this option. By default it’s off.

Login to domain with fingerprint on Windows 7

Also it not seemed, that Windows 7 supports hybrid graphic cards. So unless I’ll find a way to get rid of this issue, I have to use Lenovo switchable graphics utility…

Next thing was to install gentlemen’s assembly:

  • Windows Live Essentials
  • Microsoft Office 2007 + SPs
  • Total Commander
  • Skype
  • Virtual PC 2008 SP1
  • Visual Studio 2008 + SP1

All installations were fine, except small problem with business edition of Skype. Newly introduced Action Center advised me to install 4.0 beta version of Skype to prevent compatibility issues.

Windows 7 Action Center

Another problem (not really Windows, but Microsoft related) is a time, that takes to install Visual Studio. For some reason installation of Office (which is not smaller, then VS) takes about 5 minutes on my machine, when for Visual Studio it takes more, then 40 minutes to be installed.Devdiv guys, please do something with this installer.

So two restarts and here we go. Windows 7 with all necessary software installed. Now issues started.

The only disappointment was because of Windows Experience Index (140GB 7200RPM hard disk is not big and fast enough for this version of OS). If this not, what is?

image

But it can be fixed easily by disabling cache on disk Device Manager –> Disk Drives –> Uncheck “Disk write caching policy”.

image

After doing this your system will run much faster and score will be increased.

image

I cannot understand the reason it checked by default for non solid state drives, which unsuitable for fast caching.

Switchable graphic cards are also seemed, to be an issue for Windows 7. It does not supported by now to switch graphic cards. All you can do is to pitch BIOS for denying OS from display driver detection and set the card you want. Here how my machine scores looks like with second graphic card enabled.

image

Taskbar is for fun, not for work

First of all new branded taskbar. How I supposed to distinct what running and what don’t? Shinny borders and backgrounds? Cool, but not really helpful for me. Just for test try to set “Hide when minimized” option for Outlook 2007 and then detect whether it running or not. Ah, yes, I have to go via tinny arrow to configure taskbar icons – too bad.

Another issue with this bar is configuration of shortcuts. Just in case, sometimes I want to run programs minimized or maximized or set start keys (right click on shortcut and Properties). How should I do it for pinned items?

 image

I understand, that for 5 years Microsoft tried somehow to prevent from developers to junk users notification area on taskbar, by hiding, swapping and moving things there. Finally, they managed to solve it by putting all trash into big shiny icons? Just take a look on Microsoft Messenger appearance in tasksbar. You have to run it in Vista compatibility mode in order to prevent it putting icon in this area? Too bad! This not called “feature complete” for sure.

Software compatibility

Yes, not everything perfect. For example drag and drop (DragonDrop) for Virtual PC will not work in regular mode in Windows 7. You have to create shared folder to workaround it. All programs, required elevated permission (those which triggered UAC on Vista all the time) will ask you for run only once, but if you accidently pressed anything else, then Allow, you’ll never be able to run it again (unless resetting UAC credentials in Windows). Also all those great programs, not required installations or any registry changes (for example Notepad++ or WinSCP will always treated as suspicious by Windows Defender, thus will start very slow all the time and some times required to be sent “for inspection”. This is general fail of Defender. Why me (as user) should wait you (as service provider) to check something. Do it on background, if you want to…

My first BSoD

Yes, I did it. I never was able to get Blue Screen of Death on Windows Vista. Here it happened after another restart. The reason was very funny: I did not closed Outlook before restarted Windows 7 (this fade screen with your applications will be forcibly closed). Yes, it was not really major BSoD. Windows made memory dump to prevent future crashes and send information. BTW, if you want to be able to report problems, you should use keys from Connect website, rather, then from MSDN. Beta reporting services is sensitive to product key.

Background services or what is really missing

My overall experience of Windows 7 is 7 of 10. It is major improvement of Windows Vista, but it still far from being perfect. I would advice to add OS foreground task dispatching. There are too many developers (also Microsoft’s, who trying to perform long tasks in UI thread). I think, that operation system should handle such cases and dispatch jobs to background to prevent UI freeze.

image

Another thing, is to find good compromise between annoying user and smart operations. Other words, do not try to assume what customer want to do, let him to decide (or at least enable such option). Good example for this is very odd Clear Type wizard. What would you answer to such question?

Click whatever it looks the same, just fix it!

Why I need to see the same stuff three times, when all I want it file manager?

You have a lot of documents, misics, pictures and videos

Stop trying to replace software. You already screwed with Microsoft Valet.

image

ISO file burn directly from Windows is really great feature, but an ability to mount iso images as virtual disks would be much better.

Other words, if you, Microsoft, want to create great operation system – do operation system, do not try to complete OS issues with another nice to have features. But no words – great work. Thank you.

Ah, and do not forget to fire everybody in IE dev team… It awful and has no future.

Next time we’ll speak about developer point of view to Windows 7.

Microsoft Tag vs. QR tag

One of Microsoft’s announcements on CES09 was Microsoft Tag. Do you remember last try of Microsoft to create mobile barcodes on Live platform? I remember it. So why Windows Live Barcode was deprecated, while Microsoft creates new one? What the key difference between Quick Response approach, barely adopted by industry and new colorful MS stuff? Let’s try to understand differences and approximate future fail or success on this technology.

QR vs. Microsoft tag

Key differences:

  • The only information contains inside MS Tag is ID, which should be used to fetch all relevant information from tag server while QR contains all necessary information and can be used offline. Both technologies have it own advantages and disadvantages. From one hand, you can manage and fix results all the time, from the other hand, what happen with fraud and offline usage?
  • MS Tag using High Capacity Color Barcode (HCCB) technology, which makes able to encode more information into relatively small area. Also because of small amount of information, errors can be handled easily for MS Tag. For encode 1 byte we need 8 symbols in QR codes, while in MS Tag only 4.
  • MS Tag using thee base colors (CMYK) while QR only two (BW), thus in offset print MS Tag is much more sensitive to the quality of color plates. From other hand, if I my approximation is right, MS Tag can be printed in gray palette too, due to the fact, that it uses color differences, rather then color codes for decoding. Also it seemed, that hardware used for four barcodes will be more expensive, than similar hardware for two colors.
  • Because of the fact, that QR is mature technology (first ISS was presented in October 1997), there are huge amount of devices, supports it natively, while MS Tag is rather new. From other hand, http://gettag.mobi/ provides WM,J2ME, IPhone, Blackberry and Symbian native clients for reading MS Tags. So it seemed, that very soon (if Microsoft will not abandon it again) this will be distributed de-facto.
  • QR Code® is registered trademark of Denso Wave Inc, which makes this technology problematic for future enhancements, also HCCB, used for MS Tag is licensed by Microsoft, however as far as I understand from their IPL site, it can be used as far as remains under MS patent agreement. But maybe an appliance of this technology is protected.

Bottom line – I’m very skeptic with MS Tags, however let’s give it a chance and see whether MS Tag will become another Semacode, ShotCode, PDF417, Dot Code, Aztec Code, etc. or become Barcode technology we see every day everywhere…

Meanwhile, you can create your own MS Tag, download free reader for your mobile device from http://gettag.mobi and decide whether you like it or not. For me, this technology is cool, but the code itself is very ugly :)

Be good people and have a nice day.

Nifty time savers for WPF development

I just published an article on Code Project, that explains how to use my latest FM USB library for building real world software radio receiver with WPF. There I referenced to some nifty WPF time savers, I’m using for everyday development. So, today I want to share those code pieces with you.

Software radio reciever screenshot

Binding time savers

Want to use following syntax for set binding in code?

Presets.SetBinding(ListBox.ItemsSourceProperty, _device, "Presets");

This piece of code sets binding to Preset DependencyObject, which is Listbox and connects ListBox.ItemsSource dependency property with “Presets” property of CLR object _device. How it done? Simple, as usual

[DebuggerStepThrough]
public static BindingExpressionBase SetBinding(this DependencyObject target, DependencyProperty dp, object source, string path) {
   Binding b = new Binding(path);
   b.Source = source;
   return BindingOperations.SetBinding(target, dp, b);
}

But what to do when we need a converter? Simple:

[DebuggerStepThrough]
public static BindingExpressionBase SetBinding(this DependencyObject target, DependencyProperty dp, object source, string path, IValueConverter converter) {
   Binding b = new Binding(path);
   b.Source = source;
   b.Converter = converter;
   return BindingOperations.SetBinding(target, dp, b);
}

However to use this method, we need to create special object, which implements IValueConverter. Whey not to do it generically? Like this:

SignalTransform.SetBinding(ScaleTransform.ScaleYProperty, _device.RDS,"SignalStrength", new ValueConverter<byte, double>(b => { return 1-(b / 36d); }));

But we need this special handy ValueConverter class. What’s the problem? Here come the king:

public class ValueConverter<TIN, TOUT> : IValueConverter {

   public ValueConverter(Func<TIN, TOUT> forwardConversion) {
      ForwardConversion = forwardConversion;
   }

   public ValueConverter(Func<TIN, TOUT> forwardConversion, Func<TOUT, TIN> reverseConversion) {
      ForwardConversion = forwardConversion;
      ReverseConversion = reverseConversion;
   }

   public Func<TIN, TOUT> ForwardConversion { get; set; }

   public Func<TOUT, TIN> ReverseConversion { get; set; }
   public object Convert(object value, Type targetType, object parameter, CultureInfo culture) {
      try {
         var in1 = Object.ReferenceEquals(value, DependencyProperty.UnsetValue) ? default(TIN) : (TIN)value;
         return ForwardConversion(in1);
      } catch {
         return Binding.DoNothing;
      }
   }

   public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) {
      try {
         var out1 = Object.ReferenceEquals(value, DependencyProperty.UnsetValue) ? default(TOUT) : (TOUT)value;
         return ReverseConversion(out1);
      } catch {
         return Binding.DoNothing;
      }
   }

}

Isn’t it really simple? But what to do with ugly App.Current.Dispatcher.BeginInvoke((SendOrPostCallback)delegate(object o)…? Use dispatcher time savers.

Dispatcher time savers

Don’t you ever want to do this in order to make context switching between UI thread and other application thread in WPF?

this.Dispatch(() => {… DO SOMETHING IN UI THREAD …};

Now you can (with default and preset DispatcherPriority:

public static DispatcherOperation Dispatch(this DispatcherObject sender, Action callback) { return sender.Dispatch(DispatcherPriority.Normal, callback); }

public static DispatcherOperation Dispatch(this DispatcherObject sender,  DispatcherPriority priority, Action callback) {
   if (sender.Dispatcher == null) return null;
   if (sender.Dispatcher.CheckAccess()) {
      callback();
      return null;
   } else {
      return sender.Dispatcher.BeginInvoke(priority, callback);
   }
}

Nice, isn’t it? But what to do if we do not want to set binding, but we do want to be notified about property change of dependency objects?

Bindingless handlers time saver

Let’s assume, that we have “Tune” UIelement, which has Angle property, but not exposes PropertyChanged event (like it done with Rotary custom control by Expression Blend team… Designers, you know… :)

However I want to be able to add handler for Angle dependency property changed event and do something when it changed. Like this:

Tune.AddValueChanged(RotaryControl.RotaryControl.AngleProperty, (s, ex) => {
   _device.Tune(Tune.Angle > _prevTune);
   _prevTune = Tune.Angle;
});

Here comes our time saver for this purpose:

public static void AddValueChanged(this DependencyObject sender, DependencyProperty property, EventHandler handler) {
   DependencyPropertyDescriptor.FromProperty(property, sender.GetType()).AddValueChanged(sender, handler);
}

But if we add handler we should be able to remove it too.

public static void RemoveValueChanged(this DependencyObject sender, DependencyProperty property, EventHandler handler) {
   DependencyPropertyDescriptor.FromProperty(property, sender.GetType()).RemoveValueChanged(sender, handler);
}

Now we done with some of my nifty helpers. And last, but not the least:

All times question: how to scale ranges

Here is how :)

public static double ToRange(this double value, double minSource, double maxSource, double minTarget, double maxTarget) {
   var sr = maxSource – minSource;
   var tr = maxTarget – minTarget;
   var ratio = sr / tr;
   return minTarget+(value / ratio);
}

Now we can connect them and get something like this:

Volume.AddValueChanged(RotaryControl.RotaryControl.AngleProperty, (s, ex) => {
   DirectSoundMethods.Volume = (int)Volume.Angle.ToRange(Volume.CounterClockwiseMostAngle, Volume.ClockwiseMostAngle, -4000, 0);
});

Isn’t it brilliant?

Have a good day and be sure to read and rate my last article on Code Project :) Be good people.

Recommended

 

Sponsor


Partners

WPF Disciples
Dreamhost
Code Project