Write your own jQuery widget

Here are some good articles of how to write your own jQuery Widget:

http://bililite.com/blog/understanding-jquery-ui-widgets-a-tutorial/

http://net.tutsplus.com/tutorials/javascript-ajax/coding-your-first-jquery-ui-plugin/

Posted in JavaScript, Links, jQuery | Tagged , , | Leave a comment

Configuring IIS hosted WCF services runtime

In the SVC file of your service there is Factory attribute. To reach it right click on your service svc file and click “View Markup”. Then modify it.

In my case is used descendant of WebServiceHostFactory. In this class you would want to create your own WebServiceHost descendant and configure it the way you want.

When hosting your service, every time you hit the service the MyWebServiceHost class you implemented will be created for serving your request.

Your service svc file should look like this :

<%@ ServiceHost Language="C#" Debug="true" Service="name.space.myService"   
CodeBehind="name.space.myService.svc.sc" Factory = "name.space.WebServiceHostFactoryEx, assembly.name"  %>

The WebServiceHostFactory will be created for every service hit and will recreate your host the you want it.

You will also need to inherith WebServiceHost and create it the way you need it with certain endpoins, behaviors, addresses, etc settings – whatever you like.

There is very nice post from Michele Bustamante here.

I am using this in IIS hosted enviroment for couple of services that are initialized same way.

Posted in IIS, WCF | Tagged , , | Leave a comment

Debugging WCF services

I had a problem today. a WCF service was failng to return “OK” while the host process was running properly with no indications of failing. So i started the to look for solutions. Here are some usefull links that  might save your day.

How To: Debug a Self-Hosted WCF Service – http://msdn.microsoft.com/en-us/library/bb157685.aspx

Read More »

Posted in How To, WCF | Tagged , , , | Leave a comment

How To: Regular expression to match url.

Here is a regular expression to validate an url :

string regexpattern = @”((http|ftp|https):\/\/)?[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&amp;:/~\+#]*[\w\-\@?^=%&amp;/~\+#])?”

Matches following urls:

https://www.somecompany.com http://www.someothercompany.com
subdomain.domain.com
subdomain.domain.co.uk/test/
What (not recognized)

source

Posted in How To | Tagged | Leave a comment

Write better web

Here is the Yahoo best practices for writing better web .

Posted in Web | Tagged , , , | Leave a comment

How To: Localization in ASP.NET

Here is couple of links that may kick off the localization of your project faster.

http://msdn.microsoft.com/en-us/library/aa905797.aspx by Michèle Leroux Bustamante

http://msdn.microsoft.com/en-us/library/hy4kkhe0.aspx – the globalization element in web.config

http://msdn.microsoft.com/en-us/goglobal/bb896001.aspx - National Language Support (NLS) API Reference

Posted in ASP.NET | Tagged , | Leave a comment

Losing session while touching ASP.NET website structure

Modifying the directory structure under your website web directory will cause your web app to restart. Therefore losing your sessions. For more infromation look here.

However there is workaround. You can always use Path.GetTempPath(); and do what you do there.

Update: The cause of this is explained here – http://blogs.msdn.com/b/toddca/archive/2006/07/17/668412.aspx by Todd Carter and I got there from a good article on Web App recycle article – http://blogs.msdn.com/b/tess/archive/2006/08/02/asp-net-case-study-lost-session-variables-and-appdomain-recycles.aspx by Tess Ferrandez.

So if you have Directory.Delete(<path>); try to change it to a file bases delete and leave the directory as is even empty.

Posted in ASP.NET | Tagged , , | Leave a comment

ASP.NET Web Sites on Linux with Mono

Getting the Virtual machine

Download preinstalled VM from http://www.go-mono.com/mono-downloads/download.html. I have been working with SuSE 11.1.

Read More »

Posted in ASP.NET, Linux, Mono | Tagged , , , | Leave a comment

XHTML Validation Tool

Check this link where Josh Twist make XHTML Validation look elegant.

Posted in ASP.NET | Tagged , | Leave a comment

ASP.NET Page Life Cycle

If you are just like me , i.e. having trouble remembering the page life cycle here is good way to do it :

S – Start
I – Initialize
L – Load
V – Validate
E – Event Handling
R – Render

Source : http://msdn.microsoft.com/en-us/library/ms178472.aspx#5

Posted in ASP.NET | Tagged , | Leave a comment