Friday, 19 December 2008

Download Windows Updates for offline install

Recently I performed a complete reinstall of my desktop computer and now require to download all windows updates again. With only 1Gb of available download and upload a month it will be easy to quickly use up all of it if with these updates. For these who want to save distributable copies of patches Microsoft provides two web sites to download updates from.

It is possible to find windows updates for XP, Vista and any other windows flavour, just search for KB# like (KB956391) which is shown in Automatic Updates window.

WindowsUpdates

Saturday, 1 November 2008

Tip: Create simple "Hello World" Desktop Sidebar Panel Plug-In

In this post I would like to cover step by step instructions on how to create a Plug-in for Windows Desktop Sidebar using a Desktop Sidebar SDK and C# .Net 2.0.

Prerequisites

Getting Started

Download and install Windows Desktop Sidebar by following a link. After installation is done go to installed sidebar directory, by default it will be "C:\Program Files\Desktop Sidebar". Find and unzip dssdk.zip file into "C:\Program Files\Desktop Sidebar\dssdk" or any other location of your choice.

Simple Hello World Sidebar Plug-In

Now it is time to start on creating our simple "Hello World" Desktop Plug-in. It will have a "Hello World!" button on the panel and by clicking on it it will display a "Hello There!" label.

Start a Visual Studio IDE and select "Create Project ...". Select C# Windows Forms Control Library or Windows Control Library and name it HelloWorldSidebar. In Visual Studio 2008 make sure that .Net Framework 2.0 is selected. Click OK.

NewProject

New Solution and Project will be created. Set a reference to Desktop Sidebar SDK dsidebarpia.dll.

SetReference

Rename UserControl1.cs as HelloWorldPanel.cs. This will be a UI of the panel displayed in the sidebar.

solution

Double Click on HelloWorldPanel.cs and add label and button as shown. Lets name label and button as lblHello, btnHello. This will be our UI of the sidebar Plug-In.

PanelUI

Double Click "Hello World!" button and add the following code.

private void btnHello_Click(object sender, EventArgs e) { lblHello.Text = "Hello There!"; }

Now starts something more interesting. Add "using DesktopSidebar;" at the top of the HelloWorldPanel.cs file. In order for a panel to appear in the sidebar it need to inherit from IPanel, IPanelWindow and IPanelProperties interfaces. Add them to HelloWorlPanel class declaration as shown. We will implement these interfaces shortly.

using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Text; using System.Windows.Forms; using DesktopSidebar; namespace HelloWorldSidebar { public partial class HelloWorldPanel : UserControl, IPanel, IPanelWindow, IPanelProperties { public HelloWorldPanel() { // Comment this out to enable panel refresh in the sidebar // InitializeComponent(); } private void btnHello_Click(object sender, EventArgs e) { lblHello.Text = "Hello There!"; } } }

Moment of the truth! Make sure that InitializeComponent(); in HelloWorlPanel() constructor is commented. It took me one day to workout why sidebar was not repainting.

Implementing Interfaces

To create Interface methods and properties use a shortcut provided by Visual Studio to Implement Interfaces. Use Implement Interface entry to auto-create them.

ImplementInterfaces

IPanel Members

Here we need to use 3 Win32 API functions defined in Win32API Declarations region - SendMessage, SetParent, GetParent.

using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Text; using System.Windows.Forms; using System.Runtime.InteropServices; using DesktopSidebar; namespace HelloWorldSidebar { public partial class HelloWorldPanel : UserControl, IPanel, IPanelWindow, IPanelProperties { .... #region IPanel Members protected Sidebar sidebar; protected IPanelParent panelParent; protected IPanelConfig panelConfig; protected int panelCookie; protected int parentWnd = -1; #region Win32API Declarations public const int WM_CLICK = 0x00F5; public const int WM_LBUTTONDOWN = 0x0201; public const int WM_LBUTTONUP = 0x0202; [DllImport("user32.dll", CharSet = CharSet.Auto)] private static extern int SendMessage(IntPtr hWnd, int wMsg, IntPtr wParam, IntPtr lParam); [DllImport("user32.dll", EntryPoint = "SetParent")] static extern int SetParent(int hwndChild, int hwndNewParent); [DllImport("user32.dll", ExactSpelling = true, CharSet = CharSet.Auto)] public static extern IntPtr GetParent(IntPtr hWnd); #endregion Win32API Declarations public void Close() { //throw new NotImplementedException(); } public void Create(int hwndParent, Sidebar Sidebar, IPanelParent parent, IPanelConfig config, ICanvas canvas, IXmlNode configRoot, IXmlNode panelConfig, IXmlNode settingsRoot, IXmlNode panelSettings, int cookie) { panelParent = parent; panelCookie = cookie; this.panelConfig = config; parentWnd = hwndParent; SetParent((int)Handle, hwndParent); panelParent.SetCaption(panelCookie, "Hello World Sidebar!"); this.SetStyle(ControlStyles.DoubleBuffer, true); this.SetStyle(ControlStyles.AllPaintingInWmPaint, true); InitializeComponent(); Application.DoEvents(); } public void Save(IXmlBuilder panelItem, IXmlBuilder settingsRoot) { //throw new NotImplementedException(); } public bool Tick(bool minute) { return false; } #endregion IPanel Members .... }

IPanel Window Members

#region IPanelWindow Members public int GetFitHeight(int width) { return Height; } protected delegate System.IntPtr DelegateGetHwnd(); public IntPtr GetHwnd() { if (this.InvokeRequired) return (System.IntPtr)this.Invoke(new DelegateGetHwnd(GetHwnd)); return Handle; } #endregion IPanelWindow Members

IPanel Properties Members

#region IPanelProperties Members public void ShowProperties(int hwnd) { //throw new NotImplementedException(); } #endregion IPanelProperties Members

Plugin class

In order to attach our Panel to Sidebar we need to create a Plugin class that inherits IPlugin and IPanelCreator interfaces. Add a C# class file to project and name it plugin.cs. Also you need to find and add a bmp image file that can be used as panel.bmp to display as an icon in the panel. Add panel.bmp file as existing Item to a project and set BuildAction property to "Embedded Resource".

using System; using System.Collections.Generic; using System.Text; using System.Drawing; using System.Windows.Forms; using DesktopSidebar; namespace HelloWorldSidebar { public class Plugin : IPlugin, IPanelCreator { public Plugin() { } #region IPlugin Members public void Load(out string author, out string authorEMail, out string description, out string website, int sidebarBuild, Sidebar Sidebar, IXmlNode pluginConfig, int pluginCookie) { AppDomain.CurrentDomain.AppendPrivatePath(@"plugins\HelloWorldSidebar"); author = "My Company Name"; authorEMail = "mail@mycompany.com"; description = "Hello World Sidebar"; website = "www.mycompany.com"; Bitmap bmp = new Bitmap(GetType(), "panel.bmp"); ImageList imageList = new ImageList(); imageList.Images.Add(bmp, Color.FromArgb(0, 255, 0)); Sidebar.RegisterPanel( "HelloWorldSidebar", "Hello World Sidebar", "Hello World Sidebar Plugin", (int)imageList.Handle, "0", "Hello World Sidebar", "0", "", "", pluginCookie); imageList.Dispose(); bmp.Dispose(); } public void OnPluginLoaded(string plugin) { //throw new NotImplementedException(); } public void Unload() { //throw new NotImplementedException(); } #endregion IPlugin Members #region IPanelCreator Members public void CreatePanel(ref IPanel panel, string panelClass) { if (panelClass == "HelloWorldSidebar") { panel = new HelloWorldPanel(); } } #endregion IPanelCreator Members } }

HelloWorldSidebar.dsplugin file

Desktop Sidebar knows about it's plug-ins from *.dsplugin files. Add new xml file to a project and name it HelloWorldSidebar.dsplugin.

<?xml version="1.0" encoding="utf-8" ?> <plugin progid="HelloWorldSidebar.Plugin" compatible="61" > <defaults> <panel name="HelloWorldSidebar" > <item name="decorated" value="1"/> <item name="frequency" value="1"/> </panel> </defaults> </plugin>

Project Properties

Our Sidebar plug-in is almost ready to be built and used. Lets edit Project Properties to set where our sidebar should be copied after build and what exe to run on debug.

Project Post Build Events

Open Project Properties, Build Events and Edit "Post Build Events". Copy the following lines.

mkdir "C:\Program Files\Desktop Sidebar\plugins" mkdir "C:\Program Files\Desktop Sidebar\plugins\$(ProjectName)" copy "$(TargetDir)*.*" "C:\Program Files\Desktop Sidebar\plugins\$(ProjectName)" copy "$(ProjectDir)*.dsplugin" "C:\Program Files\Desktop Sidebar\plugins\$(ProjectName)"

Project Build and Debug

In Project Debug select Start external Program and set path to sidebar executable.

C:\Program Files\Desktop Sidebar\dsidebar.exe

In Project Build tick Register for COM Interop box. This change will not have any affect if we do not set ComVisible property to true in AssemblyInfo.cs file.

[assembly: ComVisible(true)]

Running Hello World Sidebar Plug-in

Lets start our sidebar plug-in by hitting F5. If everything was done correctly sidebar will appear on the right side of the screen. Our Panel is not visible yet and we need to add it to a panel. Right mouse click on the Sidebar and select "Add Panel ..." from menu. Select "Hello World Sidebar" from the list.

AddNewPanel

And here it is in the list.

HelloWorldSidebar

Monday, 13 October 2008

Internet Services to Search for Free E-Books and Manuals

Recently I was looking for ways to find programming books and manuals. Below is a list of sites that help to make this easier.

Search Free E-Books

PdfGeni.com - Free PDF e-book Search Engine

PDF Search Engine - Free E-Book Search

Data-Sheet - PDF e-book data-sheet manual search engine

Scribd - Share your documents online

 

E-Book Collections Online

Gutenberg - the first producer of free electronic books (e-books)

FreeComputerBooks.com - Free Computer, Mathematics, Technical Books and Lecture Notes, etc.

FreeTechBooks.Com - Free Online Computer Science and Programming Books, Textbooks, and Lecture Notes

OnlineComputerBooks.com - Free Computer Books, Free e-books and Books Online

Saturday, 27 September 2008

Free Add-ins for MS Office 2007

Below are MS Office 2007 Add-ins and converters.


Save As PDF - this add-in allows you to export and save to the PDF and XPS formats in eight 2007 Microsoft Office programs. It also allows you to send as e-mail attachment in the PDF and XPS formats in a subset of these programs.

ODF Plugin - allow to read, edit and save documents in ODF format after SP2.

Thursday, 21 August 2008

Tip: Release Version Management

During my work on Software Development one of the issues I had to consider is a way of numbering different software releases. Below is a list of examples specifying different releases and their corresponding versions. Number in brackets corresponds to internal version of compiled assembly. Number before brackets displayed in About Box or Splash Screen for a user.

V1.0 RC1 (1.0.0.1) This is a Release Candidate 1 or Beta Version 1 sent to testers
V1.0 RC2 (1.0.0.2) Testers found errors and development team released fixes in Release Candidate 2
V1.0 (1.0.0) First Stable Release which deployed to production
V1.0.1 RC1 (1.0.0.1) Fixes made to production version sent to testers in Release Candidate 1
V1.0.1 RC2 (1.0.0.2) Fixes made to errors found by testers and released in Release Candidate 2
V1.0.1 (1.0.1) Version with fixes released to production
V1.1 RC1 (1.1.0.1) New features are introduced and sent to testers in Release Candidate 1
V1.1 RC2 (1.1.0.2) Fixes made to errors found by testers and released in Release Candidate 2
V1.1 (1.1.0) Stable Release with new features deployed to production

And so on ....

Now you may notice a couple of unusual records. First, testing release start from 1.0.0.1 and second, stable release internal version has only 3 digits. For Windows Environment Variables Manager (EnvMan) I implemented a code that displays RCx wording depending on internal assembly version and so for it not to get confused about when to  remove leading 0s Beta versions start from 1. See code sample below.

/// <summary> /// Gets the package version. /// </summary> /// <value>The package version.</value> public string PackageVersion { get { string VERSION_SEPERATOR = "."; Version version = Assembly.GetExecutingAssembly().GetName().Version; string build = (version.Build == 0) ? string.Empty : VERSION_SEPERATOR + version.Build; string revision = (version.Revision == 0) ? string.Empty : " RC" + version.Revision; string packageVersion = "V" + version.Major + VERSION_SEPERATOR + version.Minor + build + revision; return packageVersion; } }

Second unusual statement: For stable releases can be a problem when trying to install it on top of beta version. MSI Windows Installer may get confused between versions. I haven verified this yet, but it will be safer in this case to remove any Beta versions before installing production release.

I am happy to hear any feedback, please share your experience in the comments.

Tuesday, 19 August 2008

Better way to work with Remote Desktop Terminal Services

As a developer I need to be able to remotely access and control different development and testing computers. Remote desktop for Microsoft Terminal Services is one of the solutions which already built into Windows XP or Vista.  I did try different remote access managers that allow to maintain access using different connections, which are VNC and Terminal Services, but I am not going to cover them here. I will show a simple and easy way of creating a Remote Desktop shortcut. Advantages of this method are that it is easy to change short cut properties and tweak different Remote Desktop settings.

We are going to use mstsc.exe tool. This is the name of the Remote Desktop application, and is required for the shortcut to work properly. It has a number of parameters we can use to setup our connection.

image

Now we are going to look at different examples of using this tool.

1. Create remote desktop connection in full screen.

mstsc.exe /v:192.168.x.x /f

2. Create remote desktop connection in fixed screen resolution.

mstsc.exe /v:192.168.x.x /w:1152 /h:864

Wednesday, 13 August 2008

SQL Server Tip: Login failed for user 'username'

After Installing new instance of SQL Server 2005 I run into a problem with logon exception "Login failed for user 'username'. The user is not associated with a trusted SQL Server connection. (Microsoft SQL Server, Error: 18452)". After googling on Internet I found a couple of links, which explain and show how to solve a problem.

This exception happens when SQL server was configured to operate in "Windows Authentication Mode (Windows Authentication)" and doesn't allow
the use of SQL accounts. To fix it change the Authentication Mode of the SQL server from "Windows Authentication Mode (Windows Authentication)"
to "Mixed Mode (Windows Authentication and SQL Server Authentication)".

Tuesday, 12 August 2008

Free Multimedia Resources for Developers

When developing software or web pages one of the dificulties is to find nice icon and sound files that could be used for User Interface. Bellow is a list of links to web resources for GUI.

Soundsnap.com - is the best platform to find and share free sound effects and loops- legally.

Free Icon Collections

Wednesday, 2 July 2008

Free Translating Internet Services and Tools

My first language is Russian and it is very helpful to be able to translate uncommon English words and sentences or even from any other language. I found few good translating services and desktop applications.

Free Translator Internet Services

Windows Live Translator

Bebel Fish Translator

Reverso - Online Translator

Google Translator

PROMT - Online Text Translator

Free Desktop Tools


JaLingo - is a free OS independent dictionary application.

Monday, 16 June 2008

Free Internet Services and Tools

Below is a list of Internet Tools and Services I found interesting and useful

Free Internet Tools


EMule - is a peer-to-peer file sharing client.

Skype - is software that allows users to make telephone calls over the Internet to Telephone line and other Skype clients.

WinSCP - Open source freeware SFTP, FTP and SCP client for Windows.

VoIP Discount - with this VOIP client you can make free calls over the internet to any of your online friends, as well as various popular destinations.

Free Internet Services

Torrent2Exe - Convert your torrents into stand-alone EXE files.

ADrive - online storage and backup solution. Store up to 50GB.

Clear Check Book - is a web tool for managing your finances.

MyBloop - is yet another service that lets users upload and share unlimited number of files. The only limit is maximum upload file size is 1 GB.

Contactify - It's email. Without the address.

Online Invoices - Online Invoices for Small Businesses: Intuit Billing Manager from the makers of QuickBooks.

PrintWhatYouLike - is a Web Page editor that lets you control how webpages look when printed.

Mind Map Internet Services

Mind42.com - collaborative mind mapping in the browser.

Minddomo - Web-Based mind mapping software

Thursday, 12 June 2008

Free Visual Studio 2008 Add-ins and Tools

I started to work with Visual Studio 2008 and first my question was. What Visual Studio 2005 Add-ins work with Visual Studio 2008. Below is a list of free Add-ins that work with Visual Studio 2008.
GhostDoc - is a free add-in for Visual Studio that automatically generates XML documentation comments for C#.

Ankh SVN - is a Subversion plugin for Visual Studio

Smart Paster - StringBuilder and Better C# string handling.

MRU Projects list Clearner - removes not used projects and solutions from Visual Studio MRU list.

PowerCommands - is a set of useful extensions adding additional functionality to various areas of the IDE.

Source Outliner Power Toy - provides a tree view of your source code's types and members and lets you quickly navigate to them with filtering inside the editor.

Windows Installer XML (Wix) - s a toolset that builds Windows installation packages from XML source code.

Monday, 2 June 2008

Free Visual Studio 2005 Add-ins and Tools

Functionality of Visual Studio can be extended using Add-ins. Below is the list of Visual Studio Add-ins I use.

Free Visual Studio Helper Add-ins and Tools


GhostDoc - is a free add-in for Visual Studio that automatically generates XML documentation comments for C#.

VS 2005 Team Edition for Database Professionals Add-on - Tools for building SQL databases in a managed project environment with support for versioning, deployment, unit testing, refactoring, and off-line SQL development. This Add-on will work only with Team or Enterprise Editions of Visual Studio 2005.

Ankh SVN - is a Subversion plugin for Visual Studio

Windows Installer XML (WiX) toolset - is a toolset that builds Windows installation packages from XML source code.

Resource Refactoring Tool - provides developers an easy way to extract hard coded strings from the code to resource files.

Visual Studio Cool Commands - many commands for Visual Studio to make developer's life cool.

VS 2005 IDE Enhancements - are a set of Visual Studio extensions provides tools to effectively use Visual Studio resources.

VS MRU List Editor - Removes not used projects and solutions from Visual Studio most recently used project list.

VSCmdShell - combines the command window and the command prompt and makes them available in a single window.

Smart Paster - StringBuilder and Better C# string handling.

Visual Studio Extensions for ASP.NET and AJAX programming

If you want to program ASP.NET using AJAX you will need to download and install extensions below.
ASP.Net AJAX Extensions - is a set of technologies to add AJAX (Asynchronous JavaScript And XML) support to ASP.NET. It consists of a client-side script framework, server controls, and more.

ASP.Net AJAX Control Toolkit - is a joint project between the community and Microsoft. Built upon the ASP.NET 2.0 AJAX Extensions, the Toolkit aims to be the biggest and best collection of web-client components available.

Visual Studio .Net 3.0 extensions

If you want to program for .Net 3.0 platform using Windows Workflow Foundation (WF), Windows Presentation Foundation (WPF) and Windows Communication Foundation (WCF) programming models download and install extensions and SDK below.
Visual Studio 2005 extensions for .NET Framework 3.0 (Windows Workflow Foundation) - is the programming model, engine, and tools for quickly building workflow-enabled applications on Windows.

Before installing extensions for WCF and WPF install Windows SDK for Windows Server 2008 and .Net 3.o.
Windows SDK for Windows Server 2008 and .NET Framework version 3.5 - provides the documentation, samples, header files, libraries, and tools (including C++ compilers) that you need to develop applications to run on Windows Server 2008 and the .NET Framework 3.5.

The Visual Studio 2005 extensions for.NET Framework 3.0 (WCF & WPF), November 2006 CTP - provides developers with support for building .NET Framework 3.0 applications using the WCF and WPF programming models.

If you are using Windows Vista as your development platform you can install Windows SDK Update for Windows Vista, which is much smaller in size than SDK for Windows Server 2008.
Windows SDK Update for Windows Vista - provides documentation, samples, header files, libraries, and tools designed to help you develop Windows applications using both native (Win32) and managed (.NET Framework) technologies.

Saturday, 26 April 2008

Free Internet Explorer Add-ons

Below is a list of IE add-ons I use.
Google Toolbar - take the power of Google with you anywhere on the Web.

Inline Search (IEForge) - is an extremely useful free add-on for Internet Explorer that mimics Firefox's search behaviour. It turns searching in a web page into a non modal research experience coupled with a find as you type facility.

IE7Pro - is an add-on for Internet Explorer which adds a lot of features and extras which make your Browsing faster,More Responsive and Sleek.

Repair IE - is free powerful repair software for Internet Explorer® with over 60 essential and easy to perform repairs!


Friday, 11 January 2008

.Net Development Tips

I found very handy site called ".NET Tip of The Day". It has posts with heaps of good tips. Below is the list of tips I find very useful for my own use and future reference. I will expand this list as I go through it. Feel free to comment and suggest your own tips.