Wednesday, December 29, 2010

Visual Studio 2010 vs. Inconsolata font, part 2

Recently, someone notified me that TTF version of popular Inconsolata font had released and is accessible here. There were some troubles with the OpenType version of the font, so you had to convert it manually to TTF format in order to use in Visual Studio 2010.

So, I’ve downloaded and installed it immediately. The font appeared in Visual Studio 2010 font list. Good. I’ve set it as a default font for text editor and what I’ve seen? Something unexpected:

Inconsolata in Visual Studio 2010

All kind of braces are being rendered in bold, the same goes for semi-colon and comma symbols. But wait, may be the problem is not in VS2010 and the font has troubles? Let’s check the hypothesis and do the same in VS2008:

Inconsolata in Visual Studio 2008 

Looks amazing!

Checking the hypothesis in Notepad:

 Inconsolata in Notepad

Again, no problems. The font is really awesome.

So what are the problems with that Visual Studio 2010 text editor? What were the reasons to change the bug-free and greatly working component from Visual Studio 2008 to this unreliable child of modern technologies? I don’t know.

P.S.
If you find a workaround, please, notify me. Thanks.

Tuesday, December 21, 2010

NetMonitor. Choosing MVVM framework

In the previous post I created a sketch of my small application with the help of Microsoft Expression Blend 4. Among other great features of the development suite there is a one that makes Blend outstanding -- it produces working XAML files, so every single UI screen in your sketch is represented as a separate UI control and the corresponding XAML is more or less ready for copy-pasting to the real application. This makes Blend the most preferable suite for sketching of WPF applications.
Let’s go further. When we are speaking about WPF we mean MVVM pattern and vice versa. What is MVVM? It is a concept that is derived from Model-View-Presenter (Model-View-Controller) pattern. There are several great articles about it, for example, I’d recommend this one and this one. AFAIK, there are two featured MVVM frameworks: GalaSoft MVVMLight & Caliburn, both of them are targeting WPF & Silverlight. I chose the first one, MVVMLight, as a base for my application because it is said that the framework supports designing in Blend, and that’s what I want.
So, I installed MVVMLight and created a new project based on MVVMLight WPF Template, added HostViewModel class, which describes the required information about a host and its health, and MainViewModel class that contains a collection of HostViewModel instances and a pair of commands, Start & Stop, which are derived from RelayCommand. After that I adapted the above-mentioned “Screen_1.xaml” from the sketch project. Here it is:
NetMonitor 02
For now, commands do nothing and the hosts information is static rather than live. Nevertheless, after a short period of work I’ve got a prototype that is written on WPF & MVVM and even shows something.
So, the UI part of the requirements is almost done. In the next posts I’ll try creating a Ping service and make use of it with the help of Start and Stop commands.

Friday, December 17, 2010

NetMonitor. Prototyping with Expression Blend 4

In the previous part I listed the requirements to the application. According to the good practice of program development, I’ve decided to start with UI and make a sketch of main application window.
Earlier I used to play with 2 superior mockup tools, Balsamiq Mockups and Evolus Pencil, but today I’ve decided to try Microsoft Expression Blend 4 because it was specifically designed for WPF-based application development. After several tryouts I’ve managed to make a sketch of the application. Main window has 2 buttons and a list with hosts, each of them contains 4 pieces of information (Host name, IP address, Response time and Health). The sketch looks as follows:
NetMonitor Sketch
I know that there are some troubles with text alignment and may be many others but don’t forget that this is only a sketch and the only purpose of it is to show how the application might look like without extra details.
Here is the main window of Expression Blend 4, as it was in the middle of the sketching process:
Expression Blend Full.
As you may notice, in the left lower corner is the structure of the application. I’ve put a DockPanel inside the LayoutRoot and inserted there a ToolBar with Docking=Top & a ListView, which automatically took the rest of space. After that I’ve created a sample data source and bound it to the ListView. That’s it, my sample data immediately appeared in the ListView. During these operations I saw nor XAML neither C# code.
The sketch is ready, it even can be run in special Sketch Player (another great feature of Expression Blend 4) so customers can play with it, make comments and criticize. The next step will be transforming the sketch into a real application and start building network services.
In case anyone is interested in the source code, I’ve opened a public repository at the bitbucket.org, so anyone could get the sources, play with them and even add any valuable stuff.

Thursday, December 16, 2010

Express Software Releasing Challenge

I’ve been thinking that Chrome browser team is the champion in super fast release building. According to Wikipedia, they managed to deliver 5 major revisions, from 4.0.249 to 8.0.552 within 2010 year, and I’m not sure that they won’t release the 9.0 before the New Year.

I’ve been thinking so until I opened my RSS reader today and found out that there is another pretender to this title, and its name is: Opera browser team, my congratulations! They managed to deliver 3 Release Candidates within a day. Here is the proof:

Opera RC

Frankly speaking, I’ve never seen anything like this in my whole life. What a speed!

Sunday, December 12, 2010

Comprehending WPF. NetMonitor

About a month ago I wrote a post about the overall complexity of WPF technology, steep learning curve and other things that might be perceived as roadblocks, especially for novices or old-school WinForms programmers.

After that I had several intensive discussions with my colleagues on the subject and they told me one important thing, the main idea was that the technology just seems to be overcomplicated, especially from the first look, when you don’t see the overall picture how it is built, how it works and how it should be used. Another thing that is worth mentioning is that the architecture is reasonable, because it gives a UI designer the required flexibility and power, which WinForms just can’t provide and this very fact can only be seen on complicated UI scenarios, not on simple ones.

As a result, they persuaded me to take a closer look on the platform and give it another try. And I did so. They say that abstract theoretical knowledge can’t compare with practical one, so I decided to make something small but more or less useful on WPF and therefore, get some practical knowledge of the technology.

I’ve set my choice on a little handy tool that will monitor and report the health of my network. For now the most quick and simple way to check the health is to open several Command Prompt windows and run a Ping command to various hosts in the network starting from my own router, then gate, VPN server, etc. and ending up with globally available hosts like google.com or similar. So you have to look at all those console windows, process and aggregate their logs and make a conclusion where the real problem is. As you might imagine, this way is neither convenient, nor informative, and finally, I’ve decided to create a better solution.

I’ve started with requirements. What are they?

The most important thing is to invent a codename. I’ve chosen a self-describing name — NetMonitor, why not?

UI

  • The main window shows a predefined read-only list of hosts and an average response time from Ping command.
  • Each host has a name and a valid internet address.
  • Two buttons start and stop the process of pinging.

Internals

  • In order the UI thread not to be frozen while waiting for Ping command response, each host pinging procedure must run in a separate thread.
  • Sending a Ping request once a second will be enough for monitoring tasks.
  • List of hosts for pinging should be configured from outside the application code, say, in app.config file or something. Personally, I don’t like xml configuration files, so i will try using ini file instead.

That will be enough, at least for the first version.

In the next posts I’ll write about the process of building the application.