NinethSense oWnZ mE!: Praveen’s drawing book

Choose a Topic:

Wed
11
Jun '08

C# 3.0 New Features

Here is a useful link on “C# 3.0 New Features” - by Dhaval Faria (Microsoft MVP).


URL: http://www.learnitonweb.com/Articles/ReadArticle.aspx?contId=4&page=1

Following is the list of new features that he explained in this article:

1 - Automatic Properties
2 - Object Initializers
3 - Collection Initializers
4 - Implicitly Typed Local Variables and Implicitly Typed Arrays
5 - Extension Methods
6 - Lambda Expressions and Expression Trees
7 - Query Expressions
8 - Anonymous Types
Tue
3
Jun '08

A simple ISAPI extension with C#

 
using System;
 
namespace ConsoleApplication1
{
    class Program
    {
         static void Main(string[] args)
        {
                 Console.Write(“Content-type: text/html\n\n);
                 Console.Write(“Hello World!”);
        }
    }
}
 


After the build-ing, you will get an executable file. If you try to execute it from console, you will see some text printed out - inluding a ‘hello world!’.

Now the configuration part :)

1. Invoke your IIS - Internet Information Services.
2. On the website, click right button -> Properties
3. Home Directory Tab
4. Configuration Button. ‘Applicaiton Window’
5. Click ‘Add’
6. Now you point your new exe file and give your own extension
7. done :)
8. For testing, create a dummy file with the extension you provided. (content can be anything or empty file)
9. Call it from your browser - like http://localhost/test.cgix
10. You should see ‘Hello World!’ :)




Note: This is not a standard ISAPI extension. Miles to go …
Fri
9
May '08

Encoding - converter

Here is a sample code in c# to convert a file with UTF-7 encoding to ISO-8859-1 encoding. You can change these values to make any to any converter.

 
            Encoding FromEnc =  Encoding.UTF7; // from
            Encoding ToEnc = Encoding.GetEncoding(“ISO-8859-1″); //to
            TextReader tr = new StreamReader(@“C:\from.html”, FromEnc);
            TextWriter tw = new StreamWriter(@“C:\to.html”,false, ToEnc);
            tw.Write(tr.ReadToEnd());
            tr.Close();
            tw.Close();


Make sure you imported System.IO.
Wed
23
Apr '08

Beginner’s WPF Animation Tutorial - on Codeproject

My “Beginner’s WPF Animation Tutorial” articke on CodeProject available at http://www.codeproject.com/KB/WPF/WPFAnimation.aspx



(I reported this here earlier with another link which was under - non-edited contributions of codeproject)
Fri
18
Apr '08

DataSets vs. Collections

There is a good article on DataSets vs. Collections by Dino Esposito

If you read this article, you will start using (Generics) Collections instead of DataSet/DataTable for database access. :)


Here is the URL: http://msdn2.microsoft.com/en-us/magazine/cc163751.aspx
Mon
7
Apr '08

C# & Visual Basic Language Specification

C# 3.0 Language Specification Word Document can be downloaded at http://download.microsoft.com/download/9/5/0/9503e33e-fde6-4aed-b5d0-ffe749822f1b/csharp%203.0%20specification.doc

Same way, you can download Visual Basic 9.0 Language Specification at http://go.microsoft.com/fwlink/?LinkID=102846
Mon
11
Feb '08

How to disable button after submit - ASP.NET

 
Button1.Attributes.Add(“onclick”, ClientScript.GetPostBackEventReference(Button1,“”) + “;
this.value=’Please wait…’;this.disabled = true;”);


If you check the source after rendering, it will look like this:
 
onclick=“__doPostBack(’Button1′,'’);this.value=’Please wait…’;this.disabled = true;”
Fri
8
Feb '08

Word Automation with .NET

First refer COM objects - Microsoft Office xx.xx Object Libraryand Microsoft Word xx.xx Object Library

Here is the C# code for reading a word document:
 
Microsoft.Office.Interop.Word.Application oWord = new Microsoft.Office.Interop.Word.Application();
object ofilename = @“C:\testdoc.doc”;
object o = System.Reflection.Missing.Value;
object oreadonly = true;
object ovisible = false;
Microsoft.Office.Interop.Word.Document oDoc = oWord.Documents.Open(ref ofilename, ref o, ref oreadonly
    , ref o, ref o, ref o, ref o, ref o, ref o, ref o, ref o, ref ovisible, ref o, ref o, ref o, ref o);
 
textBox1.Text = oDoc.Content.Text; // contents available here
 
//Do not forget to quit other wize it will keep running in background
oDoc.Close(ref o, ref o, ref o);
oWord.Quit(ref o, ref o, ref o);
Wed
30
Jan '08

Free Image Resizing Tool

An image resizing tool made by me is available for you… for free.

Download from here



This is programmed with Visual C# Express 2005 (.NET 2.x)
Mon
28
Jan '08

Beginner’s WPF Animation tutorial




My article for ‘Beginners WPF Animation’ is availble on codeproject.com.

Check the CodeProject article at http://www.codeproject.com/KB/WPF/WPFAnimation.aspx
The CodeProject Microsoft Developer Network Official ASP.NET Forums Microsoft .NET Framework Community Microsoft Most Valuable Professional Kidoos forums Microsoft Visual Studio Developer Home Professional Information Technology Solutions Microsoft Research Home Trivandrum Microsoft Users Group Community Website