Monday, September 20, 2010
Introducing BlogoRadio!
Tuesday, September 14, 2010
Using WCF Services with Silverlight in a Cross Domain Way
One of the useful features available for developingSilverlight applications is its ability to interact with server side datathrough the use of a conduit such as Windows Communication Foundation (WCF)services. Visual studio enablesapplication developers to easily connect to a service using “Project->Add ServiceReference”, then providing the address for the service. The various operations and data structuresmade public by that service are then exposed in the solution and can be viewedusing the object browser. When accessingthe service from a different domain, as in trying to access the service fromwithin a development running on the local machine and the service is notrunning on localhost, there is the potential for your Silverlight applicationto throw an exception if the server hosting your service has not explicitlyenabled a cross-domain access policy. Ifthis happens, the application exception may look something like this:
An error occurred while trying to make a request to URI 'http://kenwatts.net/Service.svc'. This could be due to attempting toaccess a service in a cross-domain way without a proper cross-domain policy inplace, or a policy that is unsuitable for SOAP services. You may need tocontact the owner of the service to publish a cross-domain policy file and toensure it allows SOAP-related HTTP headers to be sent. This error may also becaused by using internal types in the web service proxy without using theInternalsVisibleToAttribute attribute. Please see the inner exception for moredetails.
In order to get around this issue, a file named “clientaccesspolicy.xml”needs to be added to the root of the server where the service is running. This file can have the following contents toenable services from any subdirectory:
<?xml version="1.0"encoding="utf-8" ?>
<access-policy>
<cross-domain-access>
<policy>
<allow-fromhttp-request-headers="*">
<domain uri="*" />
</allow-from>
<grant-to>
<resourcepath="/" include-subpaths="true" />
</grant-to>
</policy>
</cross-domain-access>
</access-policy>
It’s important to point out that this file needs to belocated in the root of the server where the service is hosted. So if the Silverlight application is tryingto access this service:
http://www.mydomain.com/MyWcfService/MyWcfService.svc
Then the file “clientaccesspolicy.xml” needs to be locatedhere:
http://www.mydomain.com/clientaccesspolicy.xml
By enabling the cross-domain policy in this way, developerscan avoid this cross-domain exception when deploying a Silverlight applicationon a server that is different from the server hosting the data providingservice.
For more information about cross-domain access policiesrelated to Silverlight and WCF, check these links:
Monday, January 25, 2010
PC Surveilance Software: How to spy on your computer using free software
Async Monitor is a free utility that can be used to monitor activity on your PC asynchronously from any web browser. It's a low-overhead utility meaning it does not use very much of the system's resources when it is running. It also runs in the background, so it won't be seen by users of the PC when it's running.
How it works
Async Monitor can be downloaded for free here:
http://asm.pixelhat.com/
Sign up for a free account using your e-mail address. An account is required in order to use the software since your account will be used to upload screen captures to the web. After downloading and installing AsycMonitor, you will need to set it up by providing the e-mail address and password that was used to create your free on-line account. From this point, AsyncMonitor will run in the background, and it will automatically upload screen grabs to the web whenever anything on the screen changes. You can then log-in to your account at asm.pixelhat.com from any web browser on any other PC or web-enabled device and view images of what programs are being run on your PC.
In summary, Async Monitor offers a free solution to monitor activity on your PC in almost real-time. It could be a handy utility for security minded people.
Wednesday, March 25, 2009
Silverlight Market Penetration
This will come in handy for those of us interested in watching the rate at which the market penetration for Silverlight will grow after the official launch of Silverlight 2.
Tuesday, December 30, 2008
Designing and Implementing the Silverlight Digital Logic Simulator, Part 1
Part 1: Defining a class for logic devices
I'd like to point out that this particular project is one that I've been thinking about since I was an undergrad studying Computer Science many years ago. My inspiration was a great program for the Mac (OS 8 era), the name of this program escapes me but I'll be sure to insert it here along with a screen shot if I do manage to figure out what this program was called. But in short, it was great because it allowed the student to very easily connect various gates together in order to verify that a simple digital logic circuit worked as expected, according to its truth table. I always thought that this program was nicely done and I was also disappointed that an equivalent PC version was not available. At one point, I considered developing a program like this in Java so that it would be portable, but Java turned out to be a disappointment on many levels (which is a topic for another blog article). In any case, when I first started learning about Silverlight, I almost immediately realized that it would be the perfect platform for implementing a simulator like the one for the mac. On a side note, there was also a great Turing Machine emulator for the mac that had no good PC equivalent, and I think that this could be another great little project to work on in the future.
Going back to that old mac program and thinking about how it was designed, what I really liked about it was how intuitive it was to use. You could simply drag various logic devices onto the screen and position them however you wanted, and connect the devices by dragging the output of one device to the input of one or more other devices. When trying to decide how best to replicate this behavior from an object-oriented perspective, it makes sense to identify all of the properties and behaviors that are common to all digital logic devices that will be used in the simulator. After identifying as many of these that come to mind, they can be defined and generalized in a super-class from which specific logic devices, such as gates, can be derived. For this digital logic simulator, I defined a "Device" class which fulfills this purpose.
(To Be Continued...)
Wednesday, November 26, 2008
Silverlight Drum Pad
This is a simple drum pad. I wanted to test out Silverlight's sound sample playback capability and this seemed like a great project for doing that.
The corresponding keyboard keys are listed on each pad:
- Toms - A, S, D
- Crash - C
- Kick - Z
- Snare - X
- Hi-Hat - Open: K; Closed: M
Feel free to comment. Enjoy!
-Ken
Monday, October 20, 2008
LOLCats Slide Show in Silverlight
This is a simple slide show viewer written in Silverlight, currently featuring some lolcats images. The slide show viewer can be configured to view any images, I chose lolcats for this example just because of their popularity. Currently, this slide show viewer only supports a cross-fade style transition. In the future, I plan on added enhancements which will include a variety of transition types. This initial version serves as a decent baseline that can easily be built upon.
In this example, slides will automatically transition after being displayed for 5 seconds. In order to force a transition, simply click on the image.
The source code for the project can be found here.
Feel free to comment!
-Ken
Sunday, September 21, 2008
Koch Snowflake in Silverlight
This program builds on the Koch curve, with the key difference being the initial state contains an equilateral triangle instead of a single line segment, and the snowflake is constructed by generating the Koch curve on each side of the triangle.
The source code is available at CodePlex.
Feel free to comment!
-Ken
Saturday, September 20, 2008
Koch Curve in Silverlight
Here's another one of my favorite fractals, the Koch curve! Generating this is simple:
- Start with a straight line segment
- Insert an equilateral triangle in the center of the line segment
- Repeat this process for each new line segment
The source code is available at CodePlex.
Feel free to comment!
-Ken
Monday, September 15, 2008
Sierpinski's Triangle in Silverlight
Here's a fractal gem that's stuck with me since my discrete math days. Generating this fractal is simple:
- Pick a random point.
- Choose a random number from 1 to 3, each representing a point on a triangle.
- Plot the midpoint between the first chosen point and the randomly selected point on the triangle. The color of the point can be different for each of the three points on the triangle.
- Choose another random point on the triangle (1-3) and plot the midpoint between it and the previous point plotted.
- Repeat the previous step (forever!)
Note that the EditableImage class from Joe Stegman's Silverlight.Samples module was used in this project since it provides an efficient way to plot points on a 2-D plane. You can read more about it here.
The source code for this project is also available for download at CodePlex.
Feel free to comment!
Monday, August 18, 2008
Digital Logic Simulator in Silverlight
- Press "F" for full screen mode
- Click and drag digital logic devices onto the graph paper
- Connect devices by clicking and dragging from the output of one device to the input(s) of other devices.
- Double-click a device to select it for deletion
- Clicking "Delete" will delete any and all selected devices.
Motivation
The reasons behind creating this application are basically:
- This seemed like it would be a fun project to get started with learning about Silverlight.
- There are not any good digital logic simulators on the web, or at least I couldn't find anything that I thought was decent.
Update - 9/16/2008: I've posted the source code at CodePlex.