Sunday, December 23, 2007

What is the difference between URL and URI?

A URL is the address of some resource on the web, which means that normally you type the address into a browser and you get something back. There are other type of resources than web pages, but that's the easiest conceptually. The browser goes out somewhere on the internet and accesses something.

A URI is just a unique string that uniquely identifies something, commonly a namespace. Sometimes they look like a URL that you could type into the address bar of your web browser, but it doesn't have to point to any physical resource on the web.

URI is the more generic term, and a URL is a particular type of URI in that a URL has to uniquely identify some resource on the web.

Via .Net Tip of The Day

Thursday, November 22, 2007

Ajax control toolkit updated for Visual Studio 2008

Ajax control toolkit has been updated and released to version version 3.5.11119.0

AjaxControlToolkit-Framework3.5.zip is the full release package with complete source code to all controls, the test framework, VSI, and more.

AjaxControlToolkit-Framework3.5-NoSource.zip contains only the sample web site and VSI and is for people who don't need or want the source code for the controls.

Download link

kick it on DotNetKicks.com

Wednesday, November 21, 2007

Visual Studio 2008 and .NET Framework 3.5 Training Kit

The Visual Studio 2008 and .NET Framework 3.5 Training Kit includes presentations, hands-on labs, and demos. This content is designed to help you learn how to utilize the Visual Studio 2008 features and a variety of framework technologies including: LINQ, C# 3.0, Visual Basic 9, WCF, WF, WPF, ASP.NET AJAX, VSTO, CardSpace, SilverLight, Mobile and Application Lifecycle Management.

Download Page

kick it on DotNetKicks.com

Monday, November 19, 2007

Visual C# 2008 Keyboard Shortcuts Reference Poster

Microsoft present keybinding reference poster for Visual C# in Visual Studio 2008 

Download page

kick it on DotNetKicks.com

Thursday, November 15, 2007

Add automatic updates to your application

This article explain  step-by-step how to add automatic update capabilities to application quickly and easily.

Click here

kick it on DotNetKicks.com

Wednesday, November 14, 2007

How to add ComboBox to PropertyGrid

Create new class which inherit StringCoverter, and 3 methods:

internal class List2PropertyConverter : StringConverter
{
public override bool
GetStandardValuesSupported(
ITypeDescriptorContext context)
{
//True - means show a Combobox
//and False for show a Modal
return true;
}

public override bool
GetStandardValuesExclusive(
ITypeDescriptorContext context)
{
//False - a option to edit values
//and True - set values to state readonly
return true;
}

public override StandardValuesCollection
GetStandardValues(
ITypeDescriptorContext context)
{
return new StandardValuesCollection(
new string[] {"test1", "test2", "..."});
}
}




Add variable and encapsulate it:
 private string testValue;
[Browsable(true)]
[Category("Category name")]
[TypeConverter(typeof(List2PropertyConverter))]
public string TestValues
{
get { return testValue; }
set { testValue = value; }
}




PropertyGrid has 4 attributes for a manage properties:


[Browsable(bool)] - Visible/Hide property

[ReadOnly(bool)] - Editing (true/false)

[Category(string)] - Group of properties

[Description(string)] - Description of the property

kick it on DotNetKicks.com

Regards,

Sunday, November 11, 2007

CAPTCHA Kinda Spam Prevention in ASP.NET

Spammers really bug me.

I've been working on this on-going sports related portal project (that probably will NEVER go live :)

I love of hobby community sites degrade quickly because they lack the moderation resources to keep the user submitted content quality high and I've been thinking about this problem.

I thought I would share some interesting links that I found on the subject.

 

by Joe Stagner

kick it on DotNetKicks.com

Template Method Design Pattern vs. Functional Programming

Simple and obvious example how to realize Design Patterns. A example based on Hot Drinks and presented design of the application with explanations.

Click here

kick it on DotNetKicks.com

Thursday, November 08, 2007

ADInsight - new utility by Microsoft

ADInsight is an LDAP (Light-weight Directory Access Protocol) real-time monitoring tool aimed at troubleshooting Active Directory client applications. Use its detailed tracing of Active Directory client-server communications to solve Windows authentication, Exchange, DNS, and other problems.

Homepage

Download (720kb)

kick it on DotNetKicks.com

BGInfo - display PC information on the desktop

How many times have you walked up to a system in your office and needed to click through several diagnostic windows to remind yourself of important aspects of its configuration, such as its name, IP address, or operating system version If you manage multiple computers you probably need BGInfo. It automatically displays relevant information about a Windows computer on the desktop's background, such as the computer name, IP address, service pack version, and more. You can edit any field as well as the font and background colors, and can place it in your startup folder so that it runs every boot, or even configure it to display as the background for the logon screen.

HomePage

Download

kick it on DotNetKicks.com

Calling delegates using BeginInvoke, Invoke, DynamicInvoke and delegate

I wanted to write about delegates this month. There are different ways in which you can invoke delegates to get either a synchronous or an asynchronous behavior. But from what I noticed, the delegate model provides you very less control when you invoke it asynchronously. The caller cannot easily abort or terminate the operation.

If you want to execute a delegate asynchronously and still want to have good control from the caller then invoke it explicitly from a thread. The sample below demonstrates multiple ways you can invoke a delegate and each has its own features with it. Till I wrote this, I didn’t realize that there are 6 ways to invoke a delegate and I am sure there are a few more that I am missing here. It was also interesting that when you execute a delegate on a thread then it cannot return a value as the caller of the thread is gone when the thread returns. If you want to pass parameters to the delegate in the thread you can use the ParameterizedThread option which is very useful.

 

Click here to continue...

kick it on DotNetKicks.com

Sunday, October 28, 2007

Care about Event Memory Leaks with Delegate.GetInvocationList()

Subscribed events are one of the most common reasons of memory leaks in .Net. This means that if you have an object that has an event

and there are other object that are subscribed to that event, the original object won't be properly disposed until all events are unsubscribed since

an event is a strong reference.

 ....

public partial class MyForm : Form
{
public event EventHandler OnDoMyFormThing;

public MyForm()
{
InitializeComponent();
}

private void button1_OnClick
{
MessageBox.Show(
"Test of OnDoMyFormThing event"
);
OnDoMyFormThing(this, new EventArgs());
}

protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
foreach (EventHandler eventDelegate
in
OnDoMyFormThing.GetInvocationList())
OnDoMyFormThing -= eventDelegate;
components.Dispose();
}
base.Dispose(disposing);
}
}



 


To full  article click here

Tuesday, October 23, 2007

Convert UTF-8 to Unicode

private static string Utf8ToUnicode(string utf8)
{
    return Encoding.Unicode.GetString(
        Encoding.Convert(
        Encoding.UTF8,
        Encoding.Unicode,
        Encoding.UTF8.GetBytes(utf8)));
 }

LINQ solution:
private static string Utf8ToUnicode(string utf8)
{
  return   Encoding.UTF8.
       GetString(input.Select(item => (byte)item).ToArray()); 
}

Strategy Pattern in C# 2.0

Strategy pattern can very handy when a system designer or architect wants to separate algorithms from the system implementation. Also with strategy pattern approach it is very easy to select between different algorithms on the fly. With the introduction of generics in .NET 2.0 implementing strategy pattern is even more easy.

Click Here

 

 

via DotNetKicks.com

Sunday, October 21, 2007

Full guide to create Installer class in VS.Net 2005

6 pages of amazing guide by devCity.net explains all point of deployment project and include follow parts:

  • Requirements 
  • Terminology
  • How to create an Installer Class
  • Un-written rules
  • Unpleasent features
  • Using these events (about Installer Class events)
  • Using the Commit event to change the target directory permissions.
  • Using the Uninstall event to clean the target directory
  • Where is the "NT AUTHORITY\SERVICE" account coming from?
  • Exceptions and Exception handling in your installer class.
  • Adding user interfaces (forms) to your installer class.
  • Launching your application after installation.
  • Conclusions.
  • References.

To read "Visual Studio 2005 Setup and Deployment Installer Classes and Custom Actions" CLICK HERE

kick it on DotNetKicks.com

Listas - new feature from Microsoft

At Live Labs, we are always experimenting with new ideas that we think will be useful.  Today we are releasing our latest technology preview:

Listas (http://listas.labs.live.com)

Listas is a tool for the creation, management and sharing of lists, notes, favorites, and more. It allows you to quickly and easily edit lists, share them with others for reading or wiki-style editing, and discover the public lists of other users.  We encourage you to try using it for meeting notes, bookmarks, shopping lists, to plan a night out, or whatever other creative ways you can think of....

kick it on DotNetKicks.com

Sunday, October 14, 2007

Sharp Cache Session Manager

The SharpCacheSessionManager is a HttpHandler that allows to display the entries stored in the Cache, Session and Application object. You can view the data stored inside the objects and you can also remove the objects from the corresponding storage. To download the SharpCacheSessionManager click HERE

via Christopher Steen

 kick it on DotNetKicks.com

Wednesday, October 10, 2007

Monday, October 08, 2007

Find and get list of controls on page

If you want to find list of controls on Page you can use this method:
private List<T> GetControls<T>() where T:Control
{
List<T> list = new List<T>();
foreach (Control rootControl in Controls)
{
foreach (Control control in rootControl.Controls)
{
if (control as T != null)
{
list.Add(control as T);
}
}
}
return list;
}
And a using is very simple. In example you can see how to change background to all labels:
List<Label> list = 
GetControls<Label>();
list.ForEach(
delegate (Label lab)
{
lab.BackColor =
System.Drawing.Color.Pink;
}
);

 


kick it on DotNetKicks.com