Wednesday, March 9, 2011

MVC 2 in IIS 7. No default.aspx page?

I ran into a few problems while trying to deploy an Asp.Net MVC 2.0 project. The MVC team has removed the default page which was present in MVC 1.0 (They said it caused more harm than good), so my hosting server could not process my site.
Looking online i stumbled upon this article  by the team, you can check check it out, i am sure it will help.

Thursday, February 17, 2011

Accessing WCF Services from JQuery


Sridhar Subramanian has a very good article on accessing wcf services from JQuery, take a

Wednesday, February 16, 2011

Creating a timer with JQuery Timer

Just found a great plugin that allows me create a timer with jquery instead of using pure javascript.
You can download the plugin here Jquery Timer.
To use the plugin to create a timer,use the everyTime function like this,
$('#timer').everyTime(1000,'label',function(){


                     //add timer tick function here
                    $('#span1').html(count);
});
The everyTime function allows you to use a label,so you can create and stop separate timer instances.

To stop the timer, call stopTime.
 $('#timer').stopTime('label');
 and thats it.
download sample code Here


Monday, February 7, 2011

Using Linq with SQL Server Compact Edition

Hi,

Somebody recently brought to my notice that you cant use SQl Server Ce with LINQ. on investigation i found this to be partailly true.

You cannot use the VS 2008 ORM designer with the sql server ce the way you could use it with any other sql server version. It seems the LINQ Db designer does not support the sql server ce provider( don't know why).
So whats the work around, just use the sqlmetal command line interface to create the dbml, and add that to your solution, after which you can now use the design view to carry out any further changes.
You can use the sqlmetal from your visual studio command prompt.
e.g
SqlMetal.exe "e:\products.sdf" /dbml:e:\products.dbml /namespace:Common.DataLayer

Monday, November 29, 2010

How to route your wcf service through your web proxy

This post just shows you a simple way to allow you allow your client applications connect to your wcf service through a proxy.

Lets look at the binding element for a simple service

<wsdualhttpbinding>
                <binding bypassproxyonlocal="false" clientbaseaddress="http://localhost:8188/clientCallback" closetimeout="00:01:00" hostnamecomparisonmode="StrongWildcard" maxbufferpoolsize="524288" maxreceivedmessagesize="265536" messageencoding="Text" name="WSDualHttpBinding_IMainService" opentimeout="00:01:00" receivetimeout="00:10:00" sendtimeout="00:01:00" textencoding="utf-8" transactionflow="false" usedefaultwebproxy="false">
<readerQuotas maxDepth="32" maxStringContentLength="18192" maxArrayLength="116384"
                        maxBytesPerRead="44096" maxNameTableCharCount="16384" />
<reliableSession ordered="false" inactivityTimeout="05:10:00" />
</binding>

</wsdualhttpbinding>

Notice that the useDefaultWebProxy property is set to false so as to allow the wcf proxy to use whichever proxy you now set. To allow your connection to go through a service all you have to do is add a proxyAddress property to your binding, so it becomes

<wsdualhttpbinding>
    <binding bypassproxyonlocal="false clientbaseaddress="http://localhost:8188/clientCallback"
 closetimeout="00:01:00"
 hostnamecomparisonmode="StrongWildcard"
 maxbufferpoolsize="524288"
 maxreceivedmessagesize="265536"
 messageencoding="Text" name="WSDualHttpBinding_IMainService"
 opentimeout="00:01:00" receivetimeout="00:10:00"
 sendtimeout="00:01:00" textencoding="utf-8" transactionflow="false"
 usedefaultwebproxy="false" proxyaddress="http://192.168.0.1:3028">
<readerQuotas maxDepth="32" maxStringContentLength="18192" maxArrayLength="116384"
                        maxBytesPerRead="44096" maxNameTableCharCount="16384" />
<reliableSession ordered="false" inactivityTimeout="05:10:00" />
</binding>

</wsdualhttpbinding>


but now what you just have is a service with a static proxy address. but lets say you want to do something fancy like let the user set and change his proxy, then you can just programmatically get acces to this binding and change the proxy address to whatever the user inputted.

you do this by

        WSDualHttpBinding binding = new WSDualHttpBinding("WSDualHttpBinding_IMainService");
        binding.ProxyAddress = new Uri(newProxyAddress);

where "WSDualHttpBinding_IMainService" is the name of your binding from your config file. Also newProxyAddress is the proxy address the user entered.

Lastly, remember that WCF has several bindings, not all bindings support a proxy, but your http binding types all allow proxies. So have fun using this.

P.S. if your proxy requires username and password, then check out this Link

Thursday, June 3, 2010

Configuring WSDualHttpBinding on Windows 7

This is a follow-up to Wenlong Dong'g blog, How to use WSDualHttpBinding for Hosted Services .


In an Internet scenario valid HTTP requests and responses only travel in one direction, HTTP is designed as a one-way protocol. When using the WSDualHttpBinding WCF therefore creates a seperate HTTP channel for callbacks.


To enable the service callback, you have to add the clientbase address as mentioned by wenlong.
But then you also have to register the address namespace, in windows xp and server 2003,you will have had to use the httpcfg utility, but in recent versions of windows you have to use netsh as shown below


netsh http add urlacl url=http://+:80/MyUri user=DOMAIN\user

e.g netsh http add urlacl url=http://+:2040/clientbaseaddress user=Users

i hope this helps

Monday, March 30, 2009

Some Fun Robots to Play with

Some robots you can use for your research


  • Alpha Rex
    See More...
















  • WowWee Rovio
    Conscious Robots - Monday, 30 March 2009







  • Aldebaran NAO
    Conscious Robots - Monday, 30 March 2009








  • WowWee Robopanda
    Conscious Robots - Monday, 30 March 2009











  • AMOUSE The Robotic Mouse
    Conscious Robots - Monday, 30 March 2009







  • Robotic Carp
    Conscious Robots - Monday, 30 March 2009






  • Huggable


    The Huggable Robot
    Conscious Robots - Monday, 30 March 2009