May
30th | 2008

How to Find Memory Leaks With CLRProfiler

Posted by Shahar A |
Filed under C# |

We all know managed code can have memory leaks. You can find a good example here: A .NET memory leak you did not think about. Microsoft provides us with the CLR Profiler, an open source tool for analyzing the behavior of your managed application, which you can download here. It contains very good documentation about the different functions of the tool, however I still find it a bit hard to start with, so here is a simple step-by-step example of how to use it. After you finish downloadoing it , extract the files and open the directory. there you will find the manual, you can read it later… Navigate to CLRProfiler\Binaries\x86 (or x64) and run CLRProfiler.exe.


Continue Reading...
May
28th | 2008

Convert Your Vector Graphics Image to WPF/Silverlight Code

Posted by Shahar Y |
Filed under .Net, WPF, Web Development |

SVG (Scalable Vector Graphics) is an open W3C standard for graphics file format and Web development language based on XML. Those image are made up of lines, curves and other “smooth” elements so when you zoom in on a SVG it stays smooth (unlike GIF, JPEG, PNG). 

Imagine you can draw some of your user interface elements in a vector drawing application like: Adobe,   InkScape (free) or Skencil (free) and convert your work into WPF XAML or Silverlight XAML. ViewerSVG  (SVG to xaml converter) is your tool.

image


Continue Reading...
May
23rd | 2008

XHTML Sitemap Validation Tool 1.1 Version Released

Posted by Shahar Y |
Filed under .Net, Misc., Utilities, WPF |
imageXHTML sitemap validation tool allows you to XHTML validate your entire sitemap in one click, unlike the W3C markup validation service that let you validate one page at a time. This tool is also needed because XHTML validation is very important in the manner of SEO.
 
After releasing it a few days ago, Rob White from http://www.jacquelinewhite.co.uk/ wrote us that he had problems validating his site. Checking that issue, we found out that the default namespace on Robs sitemap is different than what we expected. During this bug fix, some other issues came up and we decided to release version 1.1 of our tool. The update includes:


Continue Reading...
May
20th | 2008

Validate Your Entire Web Site With This Free Open Source WPF XHTML Validation Tool

Posted by Amit |
Filed under .Net, WPF |

XHTML Validation Tool During the past couple of weeks we noticed that whenever we tweak our theme or change something in one of our posts, it causes some pages to become XHTML invalid. We came to think that you never know where it is going to hit you, so we sat down and created a small application which helps you keep all your pages XHTML valid. We checked it on our sitemap, and seems we have some HTML work to do :).

This application is written in WPF and is based on the .Net Framework 3.5.

It will allow you to validate you entire sitemap in one click. The validation is done through the W3C validation SOAP service, so you can trust it :).


Continue Reading...
May
14th | 2008

How To Add a MouseDoubleClick Event To Any WPF Control

Posted by Amit |
Filed under .Net, WPF |

Last week I was faced with a problem. I needed to implement a MouseDoubleClick Event on a WPF Grid. I said Ha, easy but as i went on to implement it i realized that the Grid has no MouseDoubleClick Event! So how am I supposed to implement it? I came up with 2 solutions and so here goes:

  1. the first thought i had was to create a User Control that held only a grid and implement the MouseDoubleClick on the User Control itself so what you will get is this Xaml code:
  2. <UserControl x:Class=”CustomDoubleClick.GridWrapper”
        xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation”
        xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml”
        Height=”300″ Width=”300″>
        <Grid>
    
        </Grid>
    </UserControl>
    Since the Grid takes the…


    Continue Reading...
May
13th | 2008

Beware of List.Find()

Posted by Shahar A |
Filed under .Net, C# |

List<T>.Find() returns the first element found that matches a given criteria. So lets say we have List<int> and we use the Find method on it. What will be the returned value? If a number in the list matches the criteria it will be returned, but what if not? what does the variable zero contains after executing this code:

List<int> listOfInts = new List<int>(new int[] { 1,2,3,4,5,6,7,8,9});
int zero = listOfInts.Find(
    delegate(int i)
    {
        return i == 0;
    });

It has the value of…


Continue Reading...
May
1st | 2008

Operator~ and BinarySearch

Posted by Shahar Y |
Filed under .Net, C# |

Usually, we use Array.BinarySearch to find a value in a sorted array, we all know that this method returns the index of the searched value in the array, if value is found. It turns out that the return value of BinarySearch is much more interesting and useful. Lets focus on what happens if the value is not found in the array.

Those who claim that if value is not found than a negative number will be returned, are absolutely right. But most of us don’t really know the whole truth about that negative number and how it can be used.

magnifying-glass


Continue Reading...
Apr
23rd | 2008

WPF DataTemplate for Interfaces? Not Supported

Posted by Shahar Y |
Filed under .Net, WPF |

DataTemplates are a great feature introduced in WPF, it allows to determine how data is presented and how data binding accesses the presented data. Just as we can apply a visual style to a specific UI control, we can do it for a specific data type. There is just one problem here, DataTemplates are good [...]


Continue Reading...
Apr
18th | 2008

Don’t Use Double.Nan

Posted by Shahar Y |
Filed under .Net, C# |

Comparison of a double with double.Nan (Not a Number) will always return false. Even (double.Nan == double.Nan) return false and indeed, from IEEE 754 specs: equality comparison between two Nan is always false. If we want to check whether a specific double is Nan, double.IsNan() shall be used. Lets look at how the IsNan [...]


Continue Reading...
Apr
15th | 2008

How to Create a Word Like Font Selection in WPF ComboBox

Posted by Amit |
Filed under C#, WPF |

If you are writing an application that uses font you will find this post very useful. Making a font selecting ComboBox that shows a preview of the fonts in WPF is very easy, here is how to do it:
First we will have to create the ComboBox Code, this is a regular ComboBox we have all [...]


Continue Reading...

Search Dev102