After wrestling nearly every possible bug, I have WCF is working with silverlight!1. wsHttpBinding won’t work. Set up your web.config for the service provider to use basicHttpBinding (just do a search on web.config, there should only be one place you need to change). This will cause the service to use SOAP 1.1 instead of SOAP 1.2 (not supported by Silverlight now)2. Cross domain access. Set up your clientaccesspolicy.xml in the root of your website to allow cross domain access (http://msdn2.microsoft.com/en-us/library/cc197955%28VS.95%29.aspx)Â 3. Cassini won’t work! Set up your web solution to use IIS. This is under the web tab, “Use IIS Web server”. Once I did that I needed to install a few more IIS6 compatibility options from add/remove windows components in the program manager. Once that was done also run “c:\Windows\Microsoft.NET\Framework\v3.0\Windows Communication Foundation\ServiceModelReg.exe -i” to set up WCF. Then restart IIS and everything should work.
posted by admin at 12:57 pm
I ran into a problem where we needed to send back some Javascript to a client who was updating other update panels (update mode always, not conditional). Our Silverlight graph needed updated node information during a lazy load which used update panels. Silverlight inside the graph was a big pain because of all the javascript that needed to get ran.Instead we kept the graph static (not the performance bottleneck, no need to lazy load) and send back only the javascript on update.First try: create a literal containing our inline javascript. This didn’t work because inline javascript isn’t automatically executed on update.Next try: ScriptManager.RegisterClientScriptBlock(). This works, but only if the target control is inside the UpdatePanel. Adding a dummy literal inside an update panel then attaching to that when adding client script:ASPX: <asp:UpdatePanel runat=”server” ID=”MyUpdatePanel”><ContentTemplate><asp:Literal runat=”server” ID=”DummyLiteral” /></ContentTemplate> </asp:UpdatePanel> Code behind:ScriptManager.RegisterClientScriptBlock(DummyLiteral, this.GetType(), this.GetHashCode().ToString(), “alert(’Hello, world!’)”, true)Now alert(’Hello, world!’) will execute every time the update panel is updated.Â
posted by admin at 12:17 pm
With the release of the source code for Silverlight 2.0’s controls we got much more than just the code. They stuck in a unit testing framework! No more hacks like linking your source files into a non-silverlight project, or homegrown solutions to do unit testing.The syntax is the same for MSTest (decorate with TestClass & TestMethod, and use the familiar Assert.* family) so you’ll free right at home. The only trick is getting up and running, so here are the steps I took:
- Â Create a new Silverlight 2 Application
- Add references to Microsoft.Silverlight.Testing and Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight. These are included in the source code release of the controls.
- Remove Page.xaml & Page.xaml.cs. The unit testing framework will create a page dynamically.
- In App.xaml.cs change the line where it assigns this.RootVisual in Application_Startup to:Â this.RootVisual = UnitTestSystem.CreateTestPage(this); (this is in the Microsoft.Silverlight.Testing namespace)
Now you’re ready to go. Creating a unit test is much simpler, but there is no IDE support:
- Create a new class for your unit test
- Decorate the class with TestClassAttribute ([TestClass])
- Create a test function and decorate it with the TestMethodAttribute ([TestMethod])
- Add a using for Microsoft.VisualStudio.TestTools.UnitTesting
To run the test right click on your test project and choose “View in Browser”.
posted by admin at 11:32 am
I love the extensibility of Subversion. Now we can use this to make life on a team project even easier by summarizing daily changes automatically and sending it out to the team.
Here is a quick PHP script that uses svnlook to go through  the changes for the past 24 hours and summarize them. I have this set up in my crontab to run daily at 6pm and send out the status email.
$repos = “/home/gzuchlinski/svn/bericograph/”;
$to = “subversion@acuityinnovation.com”;
$svnlook = “/usr/bin/svnlook”;
function getRevDate($repos, $rev)
{
global $svnlook;
return trim(shell_exec(”$svnlook date $repos -r $rev”));
}
function getRevisionInfo($repos, $rev)
{
global $svnlook;
$date = getRevDate($repos, $rev);
$author = trim(shell_exec(”$svnlook author $repos -r $rev”));
$log = trim(shell_exec(”$svnlook log $repos -r $rev”));
return “$author ($date)\n$log\n”;
}
$youngestRev = shell_exec(”$svnlook youngest $repos”);
$mintime = strtotime(”-24 hours”);
$today = strftime(”%D”);
$updates = ”;
for ($rev=$youngestRev; $rev>0; $rev-=1)
{
$date = getRevDate($repos, $rev);
$timestamp = strtotime(getRevDate($repos, $rev));
$day = strftime(”%D”, $timestamp);
if ($timestamp > $mintime)
{
$revisionInfo = getRevisionInfo($repos, $rev);
$updates .= “$revisionInfo\n”;
}
else
{
break;
}
}
if (!$updates) $updates = ‘No changes’;
$message = <<<_EOT_
Summary of changes for $today
——————————————————–
$updates
_EOT_;
mail($to, “Graph Changes for $today”, $message, “From: $to\r\n”);
?>
posted by admin at 7:21 pm