Managed meets functional

Blog about programming and having fun with .Net

About me

 Venice, 2009

profile for Alexander Galkin on Stack Exchange, a network of free, community-driven Q&A sites

Project Euler

Greetings here in my blog!
My name is Alexander Galkin. I was born 1979 in Kazan, Russia, where I graduated in child medicine.
Since 2001 I live in Hamburg, Germany and work as a freelancer software and database architect and trainer for Microsoft technologies.

 Microsoft Certified Trainer
Microsoft Certified Professional Developer
MCTS Logo
MCITP Logo

Calendar

<<  February 2012  >>
MoTuWeThFrSaSu
303112345
6789101112
13141516171819
20212223242526
2728291234
567891011

View posts in large calendar

The Zen of live coding: Win7 Zoom feature and ZoomIt from Sysinternals!

If you have ever presented something to the developer audience you have definitely had to show some features or code samples live. I often combine live coding with slide presentations, not only because it makes people wake up, but also because it gives your presentation a professional and lively touch, helping you to win the audience in case if the topic does not seem to be extremely interesting to the majority of them.

During these live shows I often feel the need to zoom to certain area of my screen in order to emphasize the actions I am taking or the code menu items I choose. The easiest way to achieve it if you present on a foreign laptop is to use the new Win7 zoom feature. By holding Winkey (the key located between Ctrl and Alt on the left-hand side of keyboard) and pressing "+" and "-" on the additional keyboard (known as "Grey Plus" and "Grey Minus") you can zoom in and out respectively.

There are several zoom levels you can reach if you press these buttons several times, enabling you to focus on the tiny little part of your screen. Your system remains fully responsive during and after zoom, you can just continue typing or choosing menu item, the magnifier would normally follow the mouse cursor (this feature is called "live zoom") unless explicitly set otherwise. If you want to leave the zoom modus you have to left-click on the magnifying glass and close the magnifier panel.

This built-in option equips you with a very handy presentation tool working right out-of-the-box. However, you might sometimes need a little bit more than just zooming. During my live presentations I often have the situation where I need to freeze the screen content for a while and to explain something in more details. I was desperately looking for a free solution which would assist me here and found a very nice tool from Systeinternals webpage called ZoomIt.

This is a small single executable (about 500 Kb) which has to be started manually and which resides in your tray after start watching for the keystrokes. The default key-mappings (Ctrl + 1..4) collide with keyboard layout switch in my system that is why I changed those, in your case you may wish to do the same, you just have to right-click on the magnifying glass icon in the tray and choose "Options":

As you can already guess the from context menu, there are basically three different functions you can run by pressing keystrokes or from this context menu.

  1. Zoom

    Zoom works similarly to the Win7 zoom feature, except for the fact that there is no more mouse pointer visible; the screen zoom, however, follows your mouse movements until the first mouse click, which unveils the reason for such a strange behavior. Basically, zoom mode captures the screenshot of your desktop and you zoom to the still non-interactive image. Being in this modus you have two options: by clicking the right mouse button you fall back to the normal screen and can continue working, by clicking the left mouse button you enter the drawing mode and can now draw with your mouse pointer, depicted as a small cross.

    By clicking the right mouse button you can go one step back and continue to zoom throughout the screenshot of your desktop. You can go back to the normal working mode either by clicking right mouse button twice or just by pressing Esc in the draw zoom mode. There are multiple keystrokes you can use in the drawing mode; you get the full description if you go to the "Draw" tab of the "Options"-Form.

    Strangely enough, there is however one keystroke which is missing in this very detailed description (you'll however find this keystroke on the adjacent tab). If you press "t" in the drawing mode you can enter any text (it will be printed using the color of you pen) and finish the text entry by pressing Esc. This helps you to annotate the screenshots quickly.

     

  2. Draw

    Draw mode is practically the same we were describing just above, the only difference is that you don't need to zoom first and you the screenshot of your complete desktop as a template for your artistic exercises.

  3. Timer

    This is a nice option if you deliver talk or workshop where you have some assignments (like implementing "Hello, World!"). In order to dim down your presentation or IDE and to stress the importance of the exercise you can start the stop clock which would countdown the time (default for 10 minutes) until the deadline.

  4. LiveZoom

    Working only on the systems starting from Vista on this mode completely mimics the zoom feature of Win7, e.g. you have a completely functional desktop you zoom at and you can continue working (typing) whereas the part of your desktop is shown magnified. Even though it may be also handy to use it as alternative to the built-in feature, I feel myself often trapped while using this feature because it is not evident how to live this mode (since the Escape button does not help you). Just press the keystroke once more to go back.

In conclusion I can just recommend you to have ZoomIt on your memory stick together with your PowerPoint presentation, so you can start this handy tool every time you need to present something (there is no need for elevated privileges to start it). With some practice you will be able to produce rather complex annotations to your desktop using this tool only!


Categories: english | sysinternals
Permalink | Comments (0) | Post RSSRSS comment feed

How to disable password request on logon in Windows 2000 – Windows7?

Password protection is essential part of the security policy and you should consider disabling it as the uttermost measure. The possible scenario includes home machine with no domain identification used only at home by family members. Do not disable the password request on your laptop under any circumstances, you may probably want to configure your laptop not to re-request your password on wake-up, but it is essential for keeping your private data secured against undesired access in case of laptop being lost or stolen.

So, in order to disable logon password request you have to do the following:

  1. Download the Autologon utility from sysinternals collection from here:
    http://technet.microsoft.com/de-de/sysinternals/bb963905.aspx
  2. Start the tool with elevated privileges:
  3. Confirm the start with elevated privileges (using safe desktop if you have UAC activated on Vista/Win7).
  4. Accept the license agreement.
  5. Enter your computer name for logon as a local user or domain name for domain logon.
    Then enter your username (local or domain) and password (shown as asterisks).
  6. Click "Enable" to enable autologon.

From now on your system will logon automatically.

In order to disable autologon in the future you have to either change the password of your account or re-start the tool and click "Disable". A message window will prompt the new status of autologon (enabled or disabled).

This solution was tested on Windows XP Professional and Windows 7 Ultimate, reportedly it also works for Windows 2000.


Categories: sysinternals | english
Permalink | Comments (0) | Post RSSRSS comment feed

Sets and set operations in .Net or "Why do we reinvent the wheel?"

Resurrection of Delphi

As a dilligent subscriber of DotnetPro-Magazine (monthly developer magazine in German) I read in the last issue about the reincarnation of Delphi and Object Pascal undet the .Net platform. Before .Net Delphi was the language I had had most experience with, spending days and weeks trying to develop my own visual components and to develop something worth to show the others. Delphi is still the IDE of choice if you need to programm something, which should be compiled into the native code and should run on a variety of Windows Systems, starting from Win98SE on. In my last project where I had to programm the software which controls acoustic modem in marine research I had to use it again (in 2009, imagine!) in order to make sure that the final code will run on both old and new laptops they have.

Sets in .Net and C#

One of the articles of the actual issue was about "mimicking Object Pascal sets under .Net" by Bernd Klaiber, where he describes the class, developed by him in order to get a behaviour similar to what is called "sets" in Delphi. I was a little bit surprised to read about this implementation and even recommendation to use this "generic implementation with overloaded operators" implementation, which is somehow compared to the classical C# Flags. This is, a propos, the only point I agree -- the implemenation offers much more functionality compared to Flags, but do we really need this functionality?

Classical implementation from 2002

First of all there is a classical and well-known implementation of sets under .Net, which can be found and downloaded from CodePage. The implementation (and the article in the CodePage portal which supports it) was published as early as in 2002 and was revised in 2004, it implements a whole hierarchy of Set classes, implementing not only the classical set, but also dictionary and hash sets. The implementation does not overload any operators, probably because it was mainly implemented before this became possible in .Net (even though it is implemented as a generic class in the latest version available on CodeProject).

Drawbacks and what we actually need

I used this implementation in one of my projects at work and found it not so handy, because you have to deploy 2 separate DLLs together with your code (this is just one stand-alone DLL), even if you use just the smallest part of the overall functionality. By the way, when I think of sets, I basically think of the following features: ability to have a set of data where I can add to and remove from and check whether a certain element belongs to the set of not. Other operations like union or interseption are nice, but if I need them I rather use something in the direction of SQL-server or SQL-provider to implement this feature. That's why basically speaking of sets we need three operations:

  • Add something to set.
  • Remove something from the set.
  • Check, if something belongs to the set or not.

Flags

For static values one should take the classical C# flags, which are nothing more than a binary enum with possibility to check for certain bit. Here is just a small extract from my C# workshop demo project to illustrate the issue:


[Flags]
enum DaysOfWeek : byte
   { Monday = 1, Tuesday = 2, Wednesday = 4, Thursday = 8,
         Friday = 16, Saturday = 32, Sunday = 64 }

public static void FlagsTest()
{
   DaysOfWeek workingDays = DaysOfWeek.Monday | DaysOfWeek.Tuesday
                 | DaysOfWeek.Thursday | DaysOfWeek.Wednesday | DaysOfWeek.Friday;
   DaysOfWeek today = DaysOfWeek.Monday; 
   DaysOfWeek day1 = today;
   day1 |= DaysOfWeek.Sunday; // adding new day
   day1 |= DaysOfWeek.Tuesday; // adding another day
   day1 &= ~DaysOfWeek.Saturday; // removing one day
   if ((today & workingDays) != 0)
     { Console.WriteLine("Today is " + today + ", working day"); }
   else
     { Console.WriteLine("Today is " + today + ", holiday"); }
 }

What if we need more?

To some reason unknown to me there are quite a few who know that there is actually a full-fledged set class in .Net starting from the version 3.5. This is the hashset class, which implements all methods we need in order to manipulate elements and check for them. It supports .Add(), .Remove() (together with .Clear()) and .Contains(), the basic 3 operations I ever needed from a set. Besides, it also supports many real set operators like .ExceptWith() or .Overlaps(), which were so arduously implemented in the article.

Then I switched to this class in a newer implementation of my project at work the total project sized schrinked from about 800Kb down to 16Kb (imagine!) and I didn't have to deploy two separate DLLs with my project anymore (that was great!). The only method which I missed a lot was the .AddAll(T[] T) methods, which woud allow me to add the whole array of elements to the set at once, without implementing a loop. That's why I just briefly concocted the following class:


    class SetOfStrings : HashSet <string>
    {
        public bool AddAll(string[] newItems)
        {
            try
            {
                foreach (string newitem in newItems)
                {
                    base.Add(newitem);
                }

            }
            catch (Exception)
            {
                return false
            }
            return true;

        }
    }

Alas, this new class was not generic anymore (I did not care for it because I my set was hard typed), but it implemented the functionality I needed. Apparently it was the only difference between the CodeProject class and the hashset, since the rest of the code just worked without further correction. Now I use this code in several project I work at and I am fully satisfied with the execution speed and flexibility.


Permalink | Comments (0) | Post RSSRSS comment feed

Off we go!! // Auf die Plätze! Fertig! Los!

Everything seems to be ready, the server works, the blog engine is correctly installed and it is high time to write the first blog entry, but what should I write here? At all, do I need to write something here? A difficult question. At least you don't need to read it, that's good. :) Let me just briefly describe my motivation to start this blog, you may find it boring, if you continue to read, so be warned and don't complain afterwards!

Who am I?

A good question, I wish I knew it. Basically I can only tell you with some degree of certainty what I am and with even more certainty what I am not. 

I was bord many years ago in Kazan, Russia. That time it was still Soviet Union and I was happy to experience some of the benefits and disadvantages of that time. I was 12 when the regime fell and the time immediately following this event will always remain fresh in my mind. I never felt myself so uncertain about what is coming and what I am going to be as during this time in Russia, where we during one night lost our former identity and got nothing instead. But now this time is over and it may never come again!

Medical School in Russia

So, technically, I am a child doctor. Yes, it may sound redicular, but this is the only university degree I have completed as early as in 2002. I have never practised medicine since then except for numerous pieces of medical advice I am (even now) asked for. Strangely enough, being a good student during my medical school time, I just completely abandoned this activity and was never (or better to say, almost never) sorry for it. Medical school is a good school where I learn how to learn generally, for the only way to complete it is to learn everything by heart. This does not mean there is no logic in medicine -- surely there is -- but you are usually short in time to grap it while learning and the understand comes after you have stuffed everything into your head. That makes your brain just function perfectly and to infer the logic in the things which seemingly do not have any. This skill -- I don't know how to name it -- helps one further in the career.

Move to Germany

Having finished my medical school I didn't work a day. Next week after my graduation I moved to Germany to start my PhD which I was pursuing actively for 3 years and then switched to IT without actually completing it. I am still on my way to finish it and everything looks optimistic except for free time. Ultimately, I need to revise my priorities somehow...

Study of Computer Science

So, from 2005 on I pursue my IT career as a database and software developer. 2007 I was enrolled to the Technical University Hamburg-Harburg, initially as a student of General Engeneering Sciences (GIS, AIS in German), but during my first term I switched to Informatics and Engeneering Sciences (IIW in German) and completed my basic studies (Grundstudium) early in 2009. Even though my course is called "Informatik-" in German, I am apt to think that Computer Science would be an adquate name for it as well. It is just historically called informatics, from the time when everything what touched computers was called so.

This does not mean I started right from scratch in 2005, not at all. I had some experience of application development for Windows before, I developed several rather sophisticated applications for Windows using Borland Delphi 3 and 5 during my time as a medical student I used in my scientific work at the Department of Human Physiology of my medical school. We used them for data acquisition and modelling. That was a good start already, I knew the basics of OOP and had a broad scope in IT when I started, to say nothing about the tremendous interest to the whole area.

Career

I was lucky to find my first IT job rather quickly, thanking to my wife who spotted the correct ad on the pinboard during one of her sporadic visits to our university cantine. As of know I have over 2 years of experience as database and application developer and this experience motivated and helped me to obtain the certifications I hold now. After first 1-2 months of euphoria of working as a developer I ultimately got the feeling I am on the right place now, I do something I was always eager to do, and I can do it well enough to be paid for it. That was like a big alleviation after 10 years of pursing somebody else's career, not mine. Even being probably a not so bad physician, I feel a sort of calling for informatics and mere practisizing it makes me happy.

Microsoft Academic Programm

In almost a year after my enrollment to the TUHH I came across an event which was arranged by Microsoft Student Partners. It was a 4 days workshop about not yet officially released MS technology called Windows Presentation Foundation and was held by two ordinary (e.g. undergraduate) students of TUHH, Pawel and Björn. Inspite of my initial prejustice the workshop might be not of such a high quality if prepared and held by students it was absolutely great. I saw people who were really interested in the technology they were delivering and were able to infect others with their enthusiasm. This event became the key point which finally brought me to Microsoft Academic Program.

Microsoft Academic Program is just another student society under the auspices of Microsoft where technology enganged students can pursue their certifications and career of a trainer for Microsoft technologies. The flat hierarchy, so common for US, was rather new for me here. And obtaining benefits for the things I would normally rather pay myself for was also a very nice surprise to say the least. Thanking to this program I could start pursuing my certifications, to develop my soft skills as a trainer and coacher, to see something close to the global goal of my career. And this is the Academic Program, which inspired me to start this webpage and this blog.

In that respect you may consider me biased for Microsoft technologies and solutions. It is only partially true. Yes, I am prone to use MS technologies because I know them and I hold certifications for them, that means I used to study them fundamentically from books. But I am open to every new technology, I have a LPIC-1 certification (Linux Professional Institute), Linux is installed on every machine I use and I develop much for Linux as well. But even here I try to use technologies, originally suggested or developer by MS, like Mono, for example. So, I may be just a little biased, not more, I admit it!

Why this blog?

Why to start a new blog? This is not my first blog, I have been blogging for 7 years using gradually degrading livejournal.com service. But this is a personal blog where I write primarily about myself and events which are directly related to me. Here I would like to have a sort of "career diary", blogging about the events from IT which seemed interesting to me and worth to be written about.

An attentive reader would ask -- why to blog in English if it is not my primary language? And I am not going to blog only in English here. I do realize that some entries would require German as I live in Germany and it would be rediculous to blog about events which are intimately related to and probably also confined to Germany in any other language. I would, however, try not to use further language I can speak here, for it would hinder you from following me. I assume that every reader of my blog (and there are none at the moment :) ) would understand some English to get the information he or she is looking for, still I will reply to every comment written in the language I can understand.

What is this blog about?

At the moment I am trying to become an expert in the area of database development and administration. I use .Net for application logic and MS SQL Server 2008 as RDBMS, and I will probably blog about them. I will also blog about the articles and books I read, about the wiki-dot.net webpage and the wiki which is going to emerge here in the nearest future. I will also blog about something I find interesting for you to read or useful to know.

But I will not blog about my personal life, about my wife and son, about my trips etc. If you want to know it, welcome to my personal blog at livejournal. I also promise not to blog much about local topics which may be interesting for German readers only. I will try to balance, let's see if I manage it.

The first enry is menacing to grow beyond any boundary of politeness, that's why I want to call it a day.

So, off we go!


Categories: english | general
Permalink | Comments (1) | Post RSSRSS comment feed