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





Wednesday, March 25, 2009

Finally my robotics studio works

i downloaded microsoft robotics studio 1.5 since last year, and suprisingly i couldn't even run a simple Hello project with it, it was given me a xml schema validation error, and i called on the help of every body i knew to help solve it, we were not able to fix it.

when the new version was released,i downloaded the express edition with the hope that it will be better this time, "na lie", it didn't work.

But thanks to God,without doing anything i finally got it to work yesterday after 3 installations and uninstallations. i don't know if it was a bug or not, but i'm sure glad it's working.

Now i can do something..

Wednesday, March 4, 2009

You know you are addicted to coffee when...

You are employee of the month at the local coffee house and you don't even work there. Your eyes stay open when you sneeze, you cherw on other people's finger nails,You can type sixty words per minute with your feet, you can jump start your car without cables. You don't sweat, you percolate.You've worn out the handle of your favorite coffee mug.

You walk twenty miles on your treadmill, before you realize it's not hooked up. you're so wired you pick up radio signals. your birthday is a ntaional holiday in brazi. you go to sleep just so you can wake up and smell the coffee. you namme your rats, "cream" and 'sugar'. your lips are permanently stuck in the sipping position, you have a picture of your coffee mug on your coffe mug.

you don't tan,you roast.you don't get mad, you get steamed .your cofee mug is insured by IGI insurance, you introduce your spouse as your coffee mate, you think CPR stands for coffee provides resusciation, you ski uphill,you get a speeding ticket even when you r parked. you haven't blinked since your last lunar eclipse, you just completed another sweater and you don't even know how to knit.

The Bible says "taste and see that the Lord is good".Here's an idea why not turn your coffee break into a time with God. carry a scripture with you. meditate while you sip, talk to God while you savor. doing this would transform your life.

Culled from a box of delights(J. John and Mark Stibble) and a word for today