post-icon How to reuse contacts from Live Messenger in Vista?

date July 15, 2007 23:35 by author Sukesh Ashok Kumar

Assume that you have a lot of contacts on Live Messenger which you would like to use in different applications provided in Vista.  By default you won't have direct access to contact due to security settings (encryption) to protect that information.

There is an easy tweak/option to enable this information.

In Windows Live Messenger go to
Tools -> Options -> Security (Uncheck the box shown below)

image

Now check your "C:\users\<login Name>\Contacts" folder, you will find a folder with your Live ID name and all your Messenger contacts inside that folder...



post-icon Understanding Vector Graphics

date March 22, 2007 06:22 by author Sukesh Ashok Kumar

During multimedia era (Windows 3.1 to Windows 95) I had conducted several talks on different elements of multimedia and vector graphics was one of them. Explanation provided below is tweaked to make sure everyone can understand easily.

What does this sample do?
Draw a circle with 100 pixel radius with a mid-point of (200,200)

Non-vector graphics scenario
So in the case of bitmap graphics (bmp/jpg etc) you draw the circle and then save the entire square area pixel-by-pixel (I'm leaving out compression related differences to not make this sample complicated) inside the file. When you zoom the image since it's increasing pixel resolution, so you see the clarity going from good => bad => worse.

Vector Graphics scenario
In the case of Vector graphics, you save (usually) formula and values required for implementing the formula. In our sample

Formula
x1 = x + r * Sin (angle)
y1 = y + r * Cos (angle)

//Sample code snippet
int centerX = 200;
int centerY = 200;
int radius = 100;

for (int i=0; i< 360;i++)  //move point from 0 to 360 degree
{
int x1 = centerX + radius * sin(i);
int y1 = centerY + radius * cos(i); 

DrawPixel(x1,y1); //drawing pixel on the screen
}

   

So going to XAML and lets see how we can implement this simple sample
This sample rotates a red circle around a circular path defined by "p_rot"

   1: <Canvas xmlns=http://schemas.microsoft.com/client/2007
2: xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
3: <Canvas.Triggers>
4: <EventTrigger RoutedEvent="Canvas.Loaded">
5: <EventTrigger.Actions>
6: <BeginStoryboard>
7: <Storyboard BeginTime="0" Duration="Forever">
8: <DoubleAnimation Storyboard.TargetName="p_rot" Storyboard.TargetProperty="Angle" From="0" To="360"
9: BeginTime="0:0:0" Duration="0:0:5" RepeatBehavior="Forever"/>
10: </Storyboard>
11: </BeginStoryboard>
12: </EventTrigger.Actions>
13: </EventTrigger>
14: </Canvas.Triggers>
15: <Canvas>
16: <UIElement.RenderTransform>
17: <TransformGroup>
18: <TransformGroup.Children>
19: <RotateTransform x:Name="p_rot" CenterX="200" CenterY="200" Angle="0"/>
20: </TransformGroup.Children>
21: </TransformGroup>
22: </UIElement.RenderTransform>
23: <Ellipse Canvas.Top="50" Canvas.Left="100" Fill="Red" Width="50" Height="50"/>
24: </Canvas>
25: </Canvas>

You can download the sample in Flash and WPF/E from the following URL

http://www.awesomeideas.net/community/Download/tabid/54/Default.aspx



post-icon Creating video of your cool application

date March 17, 2007 01:09 by author Sukesh Ashok Kumar

I have seen people using a number of tools to create screen captures of thier cool application for demos, blogs posting on video sites etc...
I have been using this tool for a long time, but it's existense is unknown to many. So here are the details

Windows Media Encoder

Home Page : http://www.microsoft.com/windows/windowsmedia/forpros/encoder/default.mspx

Download Page : http://www.microsoft.com/downloads/details.aspx?FamilyID=5691ba02-e496-465a-bba9-b2f1182cdf24&DisplayLang=en

How much does it cost?

It's FREE !!!

Glimpse of the options in the wizard 1st page (loads of options more...)

 

Is this tool only for screen capturing?
No way, go ahead and explore yourself

The output file is either WMA or WMV, and you can also select target profile like desktop, pocket pc etc...
Go ahead and showcase your applications & mashups live on those video sites :)



post-icon What is Windows Vista Sideshow?

date January 29, 2007 21:33 by author Sukesh Ashok Kumar

I read a lot of news and comments about Windows Vista Sideshow. Several comments are in the lines of saying... hmmm what is the big deal about this new feature? Why would I need a small display on my laptop to see my meeting room or tasks, I already have them on my mobile... So I thought I'll just add some of my dreams and some reality about Windows Vista Sideshow since the above thoughts are from people who are not ready to dream about the usage scenarios.

First of all Windows Vista Sideshow is not a feature but a technology powered by Windows Vista.

For more proof of another use of this technology you can see the new Windows Vista MCE remotes launched during CES.

http://www.engadget.com/search/?q=vista+side+show+remotes

Now is this only for laptops and Media Center Remotes? I don't think so!

Lets dream a little and see what else can be done or how this technology can be taken to the next level...

Lets say in next couple of years we get to buy these mini devices powered by Wifi/Bluetooth and have support for Windows Vista Sideshow. Assume that by year 2009, these mini devices become dirt cheap like 5 devices for $100 or so. So people (like me) would go and buy 5 or 10 or more of these devices and would fix it everywhere in the house

  • On the refrigerator
  • On the main door
  • In the bed room
  • In the car
  • obviously in my MCE remote also and anywhere else you prefer...

and all these devices are being connected to the same computer running Windows Vista so that all the information required would be at your finger-tip anytime.

One of the differences with Microsoft Technologies is that you get a platform to develop and enhance it further. Which means that there are no bounds to how these mini devices can be used... for example these mini devices can be used in these scenarios (and many more which is limited by your ideas)

  • Home automation, to an extend of replacing all the switches in the house
  • Outlook calendar/tasks
  • Windows Live Email/Calendar/Messenger Buddies
  • Controlling music from your home theatre system (maybe Windows Vista MCE)
  • Stock Quotes

After reading the above do you really think Windows Vista Sideshow is just a small little display attached to one of those expensive laptops?



post-icon IE7 & Search provider for Microsoft Support Knowledge Base

date November 1, 2006 01:06 by author Administrator
I love cool stuff and this IE7 feature belongs to that category.  IE7 has a search feature and you can add Search providers to enhance your usage.  Initially when I saw the feature I used to wonder how is this tiny little box going to change the world of search.  But now I know it's a killer feature. 

What is so exciting about it? Huh! you can add your favourite search engine there?

Not just that but more! From my experience working in support I found search to be part of my life (I know it's become part of everyone's life). I'm sharing the feeling of my peers in IT world who uses search (any search engine) to find solutions to thier technical issues. Microsoft Knowledge base has tons of articles but I guess we didn't do a good job on indexing in the past to make it easily discoverable. But now that has changed by integrating Windows Live Search and now let us leverage it using IE7 built-in search.

So let us focus on "Topic Search" and steps for creating your own search provider for Microsoft Support Knowledge Base.

Here are simple instructions you need to follow, yea it's really simple.

  1. Goto the following link (you can get this link from "Get more search providers" option from IE7 search box
    Add Search Providers to Internet Explorer 7
  2. Goto "Create Your own" section
  3. Provide name as "MS KB Search" in the box for 4th point
  4. This is main portion of the trick
    1. Goto http://support.microsoft.com
    2. Enter "TEST" (without quotes) in the box below "Search Support(KB)" and hit ENTER
    3. Once the results come up, copy & paste the url into 3rd point on "Create Your own" section in the provider page
  5. Now click "Install" and bingo it prompts you to add the provider you just created to IE7 search bar.

Next time you wanna search something on Microsoft Knowledge Base you can do it right inside IE7 search and select the new search provider you just created called "MS KB Search"

Read more about AddSearchProvider in IE7 here

The idea of Search Providers are not restricted to web search... I have found Domain name search provider on godaddy.com website!



post-icon CardSpace (InfoCard) samples not working with RC1

date September 7, 2006 18:10 by author Sukesh Ashok Kumar

If you are excited about CardSpace and wants to dirty your hands with .NET 3.0 RC1 bits, you will realize that CardSpace samples are broken. What "broken" means here. All of those samples are meant to work with "Self Issued Cards". But due to change in namespace from RC1 bits, CardSpace Identity selector prompts for a managed card.

Current samples uses the following

<object type="application/x-informationcard" name="xmlToken">
<param name="tokenType" value="urn:oasis:names:tc:SAML:1.0:assertion" />
<param name="issuer" value="http://schemas.microsoft.com/ws/2005/05/identity/issuer/self" />
<param name="requiredClaims" value="http://schemas.microsoft.com/ws/2005/05/identity/claims/givenname
http://schemas.microsoft.com/ws/2005/05/identity/claims/surname
http://schemas.microsoft.com/ws/2005/05/identity/claims/emailaddress
http://schemas.microsoft.com/ws/2005/05/identity/claims/privatepersonalidentifier" />

But starting with RC1 you need to change "schemas.microsoft.com" to "schemas.xmlsoap.org". Just a find and replace is good enough.

So with the changes it should look like

<object type="application/x-informationcard" name="xmlToken">
<param name="tokenType" value="urn:oasis:names:tc:SAML:1.0:assertion" />
<param name="issuer" value="http://schemas.xmlsoap.org/ws/2005/05/identity/issuer/self" />
<param name="requiredClaims" value="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname
http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname
http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress
http://schemas.xmlsoap.org/ws/2005/05/identity/claims/privatepersonalidentifier" />

While writing this post, neither sample posted on www.identityblog.com has been updated nor any of the other samples available, including SDK documentation.



post-icon Redirecting from http to https in IIS7

date September 4, 2006 07:20 by author Sukesh Ashok Kumar

I was thinking to write an HttpModule for IIS7 and wanted a simple, useful and easily understandable scenario. Working with IIS customers for last 3 years one of those common scenario came into my mind, Redirecting http traffic to https. Although this is pretty straight forward requirement, till IIS6 it was difficult to achieve. Check the following KB 839357 (specifically for OWA scenario) which explains the cumbersome steps .

(If you are looking for same functionality in prior versions of IIS, find it at the bottom of this post)

HttpModules are not something new if you are an ASP.NET developer. But there are some differences. In IIS7 because of integrated pipeline, HttpModule applies to any request not just ASP.NET and that includes htm,jpg,asp,aspx,asmx,php,jsp...

So let us get into action (I'm using C# for this sample)

  1. Download and Install IIS7 Managed Module Starter Kit
    (Not really a requirement but it would make developing IIS7 modules easier)
  2. Rename the default class name created to "redir.cs" and rename project/solution/namespace to "http2https"
  3. Add the following code in "Init" method

    // register for the BeginRequest event
    application.BeginRequest += new EventHandler(OnBeginRequest);

  4. Add the following method to implement "BeginRequest" event

    //BeginRequest implementation
    public void OnBeginRequest(Object sender, EventArgs e)
    {
    HttpApplication app = (HttpApplication)sender;
    string HttpUrl = app.Request.Url.ToString();

    if (HttpUrl.StartsWith("http:"))                                       //Redirection done only if URL starts with http:
    {
       HttpUrl = HttpUrl.Replace("http:", "https:");
       app.Response.Redirect(HttpUrl.ToString(), true);      //Redirecting (http 302) to the same URL but with https
       app.Response.End();                                                   //We don't want to any further so end
    }
    }

  5. Make sure you have the following in your web.config inside configuration tag
    <system.webServer>
    <modules>
    <add name="redir" type="http2https.redir" />
    </modules>
    </system.webServer>

Your http to https redirection sample is ready!!!


How to deploy the HttpModule
There are multiple ways you can deploy this component (I'm assuming that it's being deployed for "default website")

Method 1
Create a folder called "App_Code" inside "%systemdrive%\inetpub\wwwroot"
Copy "redir.cs" file into "App_Code" folder
Copy "web.config" file inside "%systemdrive%\inetpub\wwwroot"

Method 2
Create a folder called "bin" inside "%systemdrive%\inetpub\wwwroot"
Compile "redir.cs" into "redir.dll" and copy it into "bin" folder (to compile -> csc.exe /out:redir.dll /target:library redir.cs)
Copy "web.config" file inside "%systemdrive%\inetpub\wwwroot"

If you open IIS7 UI and go to Modules you can see your HttpModule listed there.

Redirection options for prior versions of IIS below (you need to search for these)

- ASP.NET URL mapping capability (HttpContext.RewritePath)
- IIS v6.0 Resource Kit includes the UrlRemap tool
- IISRewrite
- ISAPI_Rewrite - includes a "lite" version available for free.
- Mod_Rewrite 2
- Ionic's ISAPI Rewrite Filter

***** Updated code snippet and source download is here *****
http://www.awesomeideas.net/page/IIS7-http2https.aspx 



post-icon ABC's of Appcmd (command line administration in IIS7)

date May 25, 2006 02:50 by author Sukesh Ashok Kumar

So what is Appcmd.exe?

This is "one" command line tool to administer IIS7.  In IIS6 several of admin task were done using several scattered VBS script files. This made it difficult to find out what script needs to be run for eg. to get list of worker processes.

So IIS7 is powered with Appcmd.exe which provides all the options you need to administer IIS7.

Following are the options/categories available from a high level

SITE Administration of virtual sites
APP Administration of applications
VDIR Administration of virtual directories
APPPOOL Administration of application pools
CONFIG Administration of general configuration sections
WP Administration of worker processes
REQUEST Administration of HTTP requests
MODULE Administration of server modules
BACKUP Administration of server configuration backups
TRACE Working with failed request trace logs

Lets see how we can use it with an example

When I installed LH Server Beta (I rebuild my box quite frequently) I wanted to see how it's like to have 1000 websites running on IIS7.

So I created 1000 websites on my box.

Good scenario to use Appcmd.exe and also my MS-DOS experience. No I'm not gone nutts to create it using the UI :)

Steps required

  1. Wanted separate folders for each website
  2. Wanted to use same IP address and port for all websites
  3. Type a command and leave the box to create all the websites

Keep in mind I'm not talking about Server but my desktop machine. Yea its got 2GB RAM though.

Steps below

  1. Created a folder - E:\Websites
  2. I wrote a batch file (createsite.cmd) with the following
    MD E:\Websites\Site%1
    appcmd add site /name:"Site%1" /id:%1 /bindings:http/:*:80:site%1 /physicalPath:"E:\Websites\Site%1"

    appcmd start site "Site%1"
  3. Now the command to trigger the batch file where my MS-DOS experience came handy
    C:\FOR /L %i IN (2,1,5) DO createsite.cmd %i

FOR command is a batch file loop which simply works like 'for' loop in your favorite language

FOR /L %i IN (2,1,1000) DO createsite.cmd %i

is equivalent to the following in C

for ( i=2; i <= 1000; i++ ) 
   createsite( i );

I started value of 'i' from 2 because "Default Website" has Site ID 1.

Hit enter and wait till the folders and websites are created for each iteration.

Bingo !!! 1000 websites ready to be administered or tested.

So the result would be
E:\Websites folder would have folders called Site2, Site3 etc... and in IIS there would be sites with name Site2, Site3 etc...

Lets revisit the appcmd command above once again

appcmd add site
/name:"Site%1" // website name
/id:%1 // Site ID
/bindings:http/:*:80:site%1 // site would have "All Unassigned" including host header with the site name
/physicalPath:"E:\Websites\Site%1"
// Pointing to the physical folder for that site

appcmd start site "Site%1"  // pretty straight forward, it starts the website

What else can I do to extend this scenario?

  • Create Application Pools separately for each website
  • Create a simple ASP page and drop it in every folder created
  • Use TinyGET utility (available with IIS6 Resource Kit) to simulate request

Some other useful command options

Create Backup
C:\>appcmd add backup "backup before screwup"
BACKUP object "backup before screwup" added

List Backup
C:\>appcmd list backup
BACKUP "backup before screwup"

Restore from Backup
C:\>appcmd restore backup "backup before screwup"
Restored configuration from backup "backup before screwup"

Currently Executing Requests
C:\>appcmd list  request
REQUEST "fa00000080000487" (url:GET /highcpu.asp, time:1903 msec, client:localhost)

Will add more of this later...

 



post-icon IIS Community Portal is here... !!!

date May 24, 2006 18:35 by author Sukesh Ashok Kumar

I'm super excited to add this post to announce the release of IIS Community Portal - www.iis.net . To tell you, I've been waiting for it to be public so that I can blog about the site and open up on IIS7 features, tips & tricks.

You might think why a community site for a server product? How are administrators going to contribute to a community site. Will it be asking questions and providing answers ? Then why a portal and why not just a forum?

With the release of IIS7 (available in beta on Vista & Longhorn Server builds) and also on the CTP (Community Tech Preview) releases of the OS, there is a lot of meat added to developers.

Prior to IIS7 it was VC++ developer friend because they could write ISAPI Filters & ISAPI Extensions to extend features of prior versions of IIS till IIS6. Then came ASP.NET and HTTP Handlers & Modules.  But then with the architecture of IIS6, the control of http request processing was handled 1st by ISAPI's (you know why VC guys feel so proud) and then given a chance to .NET counter parts.

Now with IIS7 the door is open for "Managed Code Developers" as well. Can you believe that?

hmmm so now you're getting some hint on why we need IIS portal and not just a forum. So challenge would be for developers both managed & unmanaged world, to be creative and start developing your ideas into components like never before !!!

So am I just talking about the same HTTP Handlers & HTTP Modules?

Noooo, you can, not only change the way existing stuff works (like before) but also REPLACE default components.... Isn't that awesome power for us (developers) to dive in?

Best example would be the sample Bill Staples showcased on how to change the look and feel of "Directory browsing" with cool image thumbnails... (See the video available at www.iis.net)

But replacing features are not at all limited to the above mentioned sample but your creative thinking. Everything becomes easy because now you can use your favorite .NET language for developing.

 



post-icon Articles (Completed & baking...)

date May 20, 2006 02:52 by author Sukesh Ashok Kumar

Loads of IIS7 related stuff...

  • DebugDiag : Introduction
  • DebugDiag : Troubleshooting Process Crash
  • DebugDiag : Troubleshooting Process Hang
  • DebugDiag : Troubleshooting High Memory/Memory Leak
  • Windbg Basics (Windows Debugging Tool)
  • Live Debugging
  • Critical Sections & Critsec Issues
  • Stack & Stack Overflow/Corruption
  • Heap & Heap Corruption

So stay tuned...



Author

Sukesh Sukesh Ashok Kumar
Escalation Engineer @ Microsoft
More...

Chat with me!
who's online

Disclaimer

All opinions posted here are those of the author and are in no way intended to represent the opinions of his employer. All posts are provided "AS IS" with no warranties, and confers no rights. © Copyright 2010

Recent Comments

Comment RSS

Sign in