Ioan Lazarciuc's Weblog I program, therefore I exist.

1Jun/0823

Auto Complete for Textboxes in WPF

Introduction

It is very common when entering a search string in a textbox to get a small list of valid search results that match the search string entered so far. This feature is called auto complete and it has been widely used in web pages and desktop applications alike.

From the developer's point of view, the auto complete feature has been implemented as part of the TextBox control in Windows Forms. That being said, I had a bit of a surprise when I could not find the functionality in the Windows Presentation Foundation TextBox control. Upon further online searches on the matter, I discovered that, in fact, auto complete has not been implemented for textboxes in WPF. The purpose of this post is to suggest (no pun intended) an implementation for the missing feature.

Functional Description

The entity we wish to create is a WPF user control that can be instantiated both through Xaml and code (C# or VB). We can either inherit from TextBox and add properties and methods required for auto complete, or we can create a control that can "wire up" the auto complete feature for any targeted TextBox control. The first approach not recommended due to the fact that a ListBox must be added to a TextBox. I chose to follow the second approach, perhaps being inspired by the AutoCompleteExtender in the ASP.NET AJAX Control Toolkit and also because it requires minimum intervention on existing WPF code (no need to change the type of many TextBox controls). Also, I did not include the targeted TextBox inside the custom control, in order to be able to apply this functionality on already existing code. The variant with the TextBox included can be found here.

A finite number of suggestions should be displayed as soon as a minimum number of  characters are typed, and then the suggestion list should be updated with each new modification to the search string. The maximum number of suggestions displayed should be configurable by means of a property. The user should be able to highlight a suggestion using the up/down keys, and be able to select a suggestion by pressing Tab or Enter in order to set the text of the target TextBox to that value. The means by which the suggestions are returned (from a web service, or simple method, etc.) should be as configurable as possible.

20Jan/081

Managing "Global Constants" with a Database

Introduction

There always comes a time while developing an application when a programmer has to introduce some "constants". These may be Id's, names, time intervals. The first action is to just put the literal constant where it's needed first.

Once the value of the constant is needed in additional places, a decision has to made: where to store the "constant". The really bad answer would be to just reuse the literal constant. A better approach would be to create a "const" or "readonly" field with the required value. This is perfectly fine if the constant has a very little chance of changing it's value (due to specifications change some of the constants may change). Changes to constants defined in this way can only be performed by recompiling the code and redistributing the new build.

Sometimes the probability of change for a "constant" is so high, that it actually becomes a "global variable" (even though it may continue to be called a "constant"). Recompiling the whole solution now becomes unfeasible.

27Dec/070

Iron Maiden in Romania

After about 2 years of sobbing because none of the big band names I like were even considering a visit in Romania, something finally changed. On the 4th of August 2008 Iron Maiden is coming to Romania. Tickets are very reasonably priced, so get your's while they're cheap and available here.

Rock on.

1Nov/0714

Creating a Windows Vista Sidebar Gadget

I think this post should begin with a few sayings: "Never say never", "When hell freezes over", "Once in a blue moon", "I would rather shoot myself", "Over my dead body", but the best suited one for this post comes from Ciprian Jichici, the Microsoft Regional Director from Romania: "In this line of business, there's no room for talibanisms".

I will be talking about developing Sidebar gadgets. These Sidebar gadgets are small applications that offer useful information, do frequent tasks more easily, or just offer a good laugh for the Windows Vista user. Until recently, I've been trying very hard to stay away from technologies like JavaScipt and PHP because it is my personal opinion that they fall miles away from a proper programming language (C#, VB.NET, C++). I won't go into the details of why I dislike these languages.

Microsoft launched a competition for Sidebar gadget developers with some very nice prizes. The competition takes place in several countries, including Romania. So, I decided to participate. The only problem is that the only fully supported programming model for developing Sidebar gadgets is HTML application + JavaScript.

30Sep/070

FineTune

In my last post I presented a online radio service that chooses playlists based on a mood setting. Since then I've also discovered a online radio service that lets you build your own playlists. It's called finetune and it is free. The quality of the sound is better than that of musicovery, but not studio quality. There are some constraints on a playlist: at least 45 songs (a solution to fill the remaining list is available) and no more than 3 songs from each artist. Once the playlist meets the minimum requirements, you can start enjoying your very own radio station. The songs are played out in random order. There is also a desktop flash application for finetune which you can download. You can also embed a playlist in your blog/website. In addition to custom made playlists, you can declare yourself a fan of a certain artist. This adds that artist to your favorite artists list. Each artist has it's own radio station that plays music from that artist and other similar ones. There is also a tag based radio station system. Here are a few snapshots of the desktop application:

Finetune Desktop Favourite artists

Filed under: I recommend No Comments
16Sep/072

Musicovery

Yesterday I found something very neat on StumbleUpon: musicovery. This is an online radio service in which you configure the playlist by setting your preferred music genres , the mood on 2 axes: Calm-Energetic and Positive-Dark, a timeframe and flags for hit song and new song. Based on these choices, the service compiles a playlist for you which it follows. I must say that I was amazed at how accurate the generated playlist reflected my input. The best thing is that this service is for free in LO-FI version and the HI-FI version costs only about 10 euros/year.

Playlist configurator Playlist

Filed under: I recommend 2 Comments
11Sep/075

Microsoft Student Partner

Yesterday┬áI received the invitation email to create an account on the MSP website. This means I got accepted in the program ­čśÇ It also means I have to keep up working on making Microsoft more accessible and easier to understand to students at my university and to anyone else who is willing to listen.

Wish me luck!

Filed under: Beginnings 5 Comments
6Sep/073

Microsoft Community Bootcamp

Fantanita Haiducului

 

During 30.08.2007 and 02.09.2007 I attended the 4th edition of Microsoft's Comunity Bootcamp as a MSP wannabe. All members of the MSP and MVP programs from Microsoft were invited. In addition, several employees from Microsoft Romania were present there. The location for the event was the Fantanita Haiducului Inn (The Outlaw's Fountain) near Sibiu. Myself, Cornel and Adi shared a car (Cornel's) to get there.

We arrived 15 minutes before dinner, just enough time to check-in. The first thing we noticed was the excellent service from the hotel. At check-in, each of us received a gift bag from Microsoft containing a bootcamp T-shirt, a pc game from Microsoft Game Studios(Halo 2, Rise of Nations or Age of Empires 3), the Microsoft Academic Resource Kit, and the schedule for the 4 days spent there. During dinner we met some of the many people there(less than 5 out of about 80). We already knew the MSP's from MAP (Microsoft Academic Program) center of our university and spent most of the time talking to them.

23Aug/075

Rendering Web Hosting Futile in Windows Server 2008

Prologue

About 4-5 days ago, me and Cornel thought it would be a good idea to try out Windows Server 2008 beta 3 and while at it, install Visual Studio 2008 Team Foundation Server (TFS 2008) beta 2. This is supposed to be 99% feature complete and the last version before RTM. Sounds promising. The next 2 days were spent obtaining the install kits for Windows Server 2008 beta 3, TFS 2008 and Visual Studio Team Suite 2008 beta 2. Before proceeding any further, I have to mention that I am not a sysadmin, but Ihave previously managed to install TFS 2005 with no difficulties.

Step 1: Installing Win Server 2008

After obtaining the installation kits and the product key (for Windows Server 2008) from the Microsoft website, the installation process was straightforward: burn image to DVD, backup one partition of the hard drive, format said partition, reboot from installation DVD, enter product key, choose destination and finally, wait for about 30 minutes until Windows installs. I have to acknowledge Microsoft's new achievements in making the installation time shorter.

21Aug/073

Hello world! (V2)

I guess I am just starting to become a person since I just started my first blog. I created this blog at the recommendation of Tudor Salomie and Tudor Vlad. My main topics on this blog will be technology and programming.

Here are a few things to know about me: MANY people call me Cretz (all my friends, professors I have research projects with, my boss, etc.) even though my name is Ioan (John in English). I am a student in Computer Science at the Technical University of Cluj Napoca, Romania, expecting to graduate in 2009. I currently work at a company that develops solutions for securities firms based on Microsoft technology. My main interests are technology, 3D art and music (more on what kind of music I enjoy you will find in the about page).

This concludes my introductory statement and I hope to come back soon with another post.

PS. The post is in V2 because I previously had a blog on www.wordpress.com but I switched to a hosted blog, but could not manage to import the old blog.

Filed under: Beginnings 3 Comments