Thursday, February 4, 2010

Exposing your local IIS to network in Windows XP.

Introduction

Hi, in this post I am going to share a simple knowledge about IIS. The knowledge is about how to expose local IIS to network, so that other network users in team can access and use the functionality.

In a web application development team we might want to check our web sites not only in our local pc but also from other team members machine. That's why its necessary to expose IIS to network environment. Lets say we have a web application called "myweb" normally while development if we use iis we access the myweb as "http://localhost/myweb" well it works all the time.

Lets say our developers PC is "MYDeveloperPC" we can expose the local IIS to share with team members as "http://MYDeveloperPC/myweb". If we have windows firewall enabled by default its not exposed to network. so we got to expose it explicitly. Bellow I am providing a simple screen cast.

Step 1:

Go to control panel and open windows Firewall. Now switch to advance tab, now select "Local Area Connection" and click on the settings button. After that advance settings tab will popup.

Step 2:

Bellow the advance settings window is displayed. Now select the services you want to expose to network and click ok to commit. That's it your local iis now exposed to network and your team members can access it from there pc.

Key Notes

Its a relatively pretty simple knowledge, almost every developer knows it. But still I took the liberty to share it because, one day one of our senior developer complained that his IIS can not be accessed out side his pc. Then I showed to him, where to pock.

A things must be considered, this post is related to the problem of windows firewall. If third-party firewall is installed in the developer pc. user must allow in the third-party firewall as well.

Best of luck and happy programming.

Thursday, January 7, 2010

Using the Build event of visual studio 2008

Background

Some times we need to execute some custom task just before we build our solution or project, I have no idea how others IDE do that, but recently we have gathered some experience about Visual Studio 2008, and doing these kind of task became pretty easy.

In one of our project we had to use a custom third-party component, the component is easy to incorporate in the project, but we have a problem, the component uses a d-com component which can not be added in the project, but if we keep the com component in bin directory the program runs okay. so our challenge is to copy the component before build in the bin directory of output project from the other projects bin.

Visual Studio 2008 Build Events

In Visual studio 2008 we have two build event, prebuilt event command and post build event command, post build event can be controlled with various parameters for example, post build event will raise when a successful build is happened.

image 

Figure: Visual Studio 2008 Build tab under Project properties

In our particular case we solved our problem in using pre-build event, now let us discuss a little bit more about pre-built event, you can use almost any kind of command in command line, provided that the commands don't require special permissions for executions.

In our case we have used "xcopy" command to solved the problem, there are lot of macro for execution. we used target directory as output macro, and source directory as solution macro, since its a simple problem we set the relative path of the DLL from solution path. worked okay, when we published the project we found that in publish version also contains the DLL, job done with very good time and in a good way.

Post build is almost similar like pre-build except it has some extra control, user can specify when to raise it, in the above screen shot you can see that there is a large combo at the bottom.

Here is a small example command in the for pre-build command.

If we want to copy all output files of a project to a deployment folder after post build event we have to put down the following command in the post build command line,

""xcopy "$(TargetDir)*.*" "c:\output" /S /I /F <NUL:""

Bellow i have put down a pre-build event command line input window with macro.

image

well that's all for now, please visit the references for more information, best of luck and happy coding.

 

References

  1. http://msdn.microsoft.com/en-us/library/42x5kfw4.aspx
  2. http://geekswithblogs.net/dchestnutt/archive/2006/05/30/80113.aspx
  3. http://dotnetperls.com/post-pre-build-macros
  4. http://skysanders.net/subtext/archive/2009/09/05/visual-studio-2008-build-event-xcopy-bug.aspx

Thursday, December 3, 2009

How to add scroll viewer with WPF ItemsControl?

How to add scroll viewer with WPF ItemsControl? Here is the trick. The bellow example is for displaying vertical scrollbar only. Some times we have little space and want to have scrollviewer support in ItemsConrol.

Note that to work correctly the ItemsControl need a fixed height. 

<ItemsControl ItemsSource="{Binding}">
<ItemsControl.Template>
<ControlTemplate TargetType="{x:Type ItemsControl}">
<ScrollViewer CanContentScroll="True" VerticalScrollBarVisibility="Auto"
HorizontalScrollBarVisibility="Disabled">
<ItemsPresenter></ItemsPresenter>
</ScrollViewer>
</ControlTemplate>
</ItemsControl.Template>
</ItemsControl.ItemsPanel>


I guess code explains everything, note that this will work on xbap, WPF, Silverlight.

Thursday, November 5, 2009

How to check if WPF control is in design mode

Probably you all know it, still sharing it with the community. The trick is pretty simple and worth knowing. Here is the summery.

Problem: The wpf designer can not render the control

Reason: In constructor of the control some data service is been called which is available only in runtime.

A method from System.ComponentModel.DesignerProperties would save our soul this time, the method name is “GetIsInDesignMode”. Using this method you can check if the control right now is been in design mode or not, and don’t call any data service if its in design mode, Isn’t it pretty simple. Bellow a sample uses is given.

if (DesignerProperties.GetIsInDesignMode(new DependencyObject()))
{
     ///your code goes here
}

References

http://msdn.microsoft.com/en-us/library/system.componentmodel.designerproperties.getisindesignmode.aspx

Friday, October 2, 2009

Turn Spell check on your WPF Text input controls.

Probably all of you know it, still want to share this simple trick that I learn, and it is “How to turn spell check on your wpf text input controls”.

What property do turn it?

SpellCheck.IsEnabled = “True”

This functionality is defined it System.windows.controls.spellcheck class, and the attach property SpellCheck.IsEnabled can be used with Textbox and RickTextBox control.

Note that appropriate language pack should be installed in the system to get full spell check support.

Unfortunately didn’t find defaults for adding new item to the dictionary, but found some articles on the net to handle the add to dictionary.

Happy coding.

Thursday, September 3, 2009

How to work in really local repository with svn.

Two things, First “I don’t want to install a source control repository”, second, “I want the source control in my local machine” finally “I want the facility to check in, check out and keep source history”, That’s actually three things, well what come in my mind is the Tortoise SVN facility.

Create A local repository

Here is how we can do the local repository, first install TortoiseSVN, its totally free so no need to worry about any licensing issue. After successful installation, select any folder from your file system, and right click on that repository. Now from TortoiseSVN menu select “Create repository here”.

image

It is going to take only a second to finish the process, Walla your local repository is created. And you will get a confirmation  like the bello window. After that you can choose to created default folder structure. Next step is to add a solution to this local repo.

image

Adding source in source control

Open your desired solution in your visual studio ide. right click on solution explorer solution file, and select Add solution to Source control. Since I have a VS plugin for svn I will get window like bello screen. It’s recommended that you add a visual studio svn plugin like Visual SVN or Ankh SVN in your development machine.

image

Click on to finish the process and you will get log message entry window.

image

Type your comment and then click ok, that’s it you have a local repository up and working for you.

Check in and checkout

Bellow I have provided the pending checking window screenshot, after adding the project you might want to add every thing un-committed to the source control.

image

History

Since you have your source control you can now check in and checkout any file, and also keep history and ability to revert the changes if anything goes wrong.

image

More over you can track history to find out any changes that is done in the source control.

image

Its fun and no worry to loose your code anymore. But I would recommend that you use a svn server, because your machine could crash, but server will have backup facility.

Until next time, me signing out cya.