sharpoblunto

Over the event horizon, toward the singularity

Enter the Automaton

Posted on Apr 2, 2009 dotnet programming

If you’re anything like me, you have a compulsive desire to link, network and otherwise connect every electronic apparatus in the house to every other electronic apparatus in order to create a complicated web of interconnected appliances.

The most obvious example of this is the TV-PC connection to allow me to run media center or XBMC from my PC to my TV in the lounge. While this is pretty standard stuff for any self respecting geek, the geographic distance of my PC to my TV (PC’s up stairs, TV is downstairs in the lounge) means I have to run 5 cables (5.1 surround sound is largely to blame for the cablefest) out of my study, down the stairs and across the lounge to the TV and speakers. This is all well and good, and combined with the XBMC iPod app means I can control the Media center via my iPod or the infrared remote without having to go upstairs to my PC.

However I still have to switch the monitor inputs from my usual dual monitor setup to a cloned desktop with one monitor and TV out before I can see anything on the TV downstairs. Up until now I would go upstairs and do this manually if I wanted to play anything on the computer while I was in the lounge… but obviously this will not do and in the word of infomercial protagonists from time immemorial, “There has to be a better way!”

My solution was to code my way out of this conundrum by writing a nice bit of home automation software I call “Automaton”. Its an http server that runs on my main PC and allows me to submit commands to my PC from any mobile device with a web browser (an iPod touch in my case). It uses a plug-in architecture so I can easily add more automation commands in future as I find myself getting progressively lazier.

The first command I implemented does the following, start media center (or XBMC), switch the monitor configuration to TV out, and when media center is closed revert the monitor configuration back to what it was before.

The other commands are to close the currently active application (i.e media center to revert the monitor configuration), and to shut down, or put the computer into standby. This means that as long as my PC is running I can turn on media center, turn it off and turn my PC off from downstairs… now all I need to to is find a way to turn my PC on remotely and I’ll never have to get up again (I should check out some of the iPod Wake on LAN apps for this purpose methinks)

below is a screenshot of it in action, as usual you can find the source code here.

Note: By default the server runs on port 8086 (This can be changed in the configuration file) so to navigate to the server you should go to http://localhost:8086/

image_thumb[7]

Writing extra plug-ins should be fairly self explanatory (if you know c#) if you have a look at the source. but if its not, let me know :) and I’ll try to help you out.

Silverlight 2.0 released to the internets

Posted on Oct 25, 2008 silverlight programming

I’ve just finished work on upgrading my Silverlight based amazon search engine app "Tarantula" to use the final release of Silverlight 2.0. Its taken a year and a half since what was first known as Silverlight 1.1 was released as an alpha (and coincidentally my first blog post here) to this latest release. In that intervening time I’ve had to upgrade the application 4 times to alpha refresh, beta 1, and beta 2 and finally to the release version.

To be honest, this latest upgrade was probably the simplest, as there were relatively few breaking changes between beta 2 and the final release, owing to the fact that Silverlight had become pretty mature and fully featured by the time the second beta rolled around. If your interested, check out Tarantula here and see the results of my efforts and frustrations :)

New Zealand leading the way in draconian copyright infringement law

Posted on Oct 18, 2008

Us New Zealanders pride ourselves on being innovative and ahead of the world. We are the first to see the light of a new day, we were the first to give women the vote, and now we have the dubious honour of being the first country in the world to pass into law a three strikes and you’re out approach to online copyright enforcement.

Essentially the bill states that ISP’s are now responsible for "reasonably implementing" a policy to disconnect users internet services in "appropriate circumstances". As you can see from the wording of the act it is vague to the point that ISP’s are unsure of how they are even supposed to enforce the new law. According to Telecommunications Carriers Forum chief executive Ralph Chivers, “Section 92A has achieved one thing, and one thing only, uniting the ICT sector and others who will be affected in an unprecedented show of solidarity against it”. He went on to say “The Act gives no guidance on what ‘reasonably implement’ or ‘in appropriate circumstances’ mean. This leaves the door wide open to those who seek disconnection of an alleged repeat infringer based on flimsy evidence, or worse, allegations alone.”

So… ISP’s don’t want it, consumers obviously don’t want it, as usual the only organization driving the adoption of these sorts of laws is the Recording industry MAFIAA, in this case the New Zealand equivalent, the RIANZ. In a quote that pretty much sums up his contempt for the very people who keep his industry in business RIANZ CEO Campbell Smith said that it would be"impractical and ridiculous" for copyright owners to prove the guilt of infringers in court before demanding they be cut off from the Internet.

Whatever happened to the idea of being innocent until PROVEN guilty? It seems that once again rather than reinvent their business and distribution models, in a way that benefits thier consumers, the MAFIAA would rather play the role of McCarthy, accusing us all of being communists pirates based on frivolous and spurious allegations until we fall into line.

With elections coming up on November 8th, make repealing or reworking this act an issue and ensure that we don’t lead the world when it comes to eroding our rights to appease industry lobby groups.

…Or failing that, send a few hasty accusations of copyright infringement the RIANZ’s way, see if they like being disconnected without proof :)

Hearing voices

Posted on Aug 15, 2008 dotnet programming

A quick post about a fun little app I wrote a few days ago (with potential to cause all sorts of awesome pranks to the unsuspecting). It allows you to remotely send text to the host computer which will then be read out on the speakers using microsoft text to speech. Its essentially just a windows service which runs an http server, to send speech you just need to make an http get request to the server url and enter the text as a query string e.g.

http://localhost:8080?text=hello world

The http server also accepts http POST’s and assumes that the contents of the post contains the text to speak. This tool is not only useful for pranks, its easy to integrate it into notification systems i.e. broken build or code check-in notifiers.

You can find the source for this application here

Silverlight, one step forward, one step sideways

Posted on Jul 11, 2008 silverlight programming

I finally got around to updating my silverlight Amazon.com search engine Tarantula to work with silverlight 2 beta 2 (see it in action here). This update included some relatively minor (as opposed to the wholesale changes from 1.1 alpha to 2.0 beta 1) though essential enhancements. Most of the changes that have been made have been in the area of control templates which were a bit lacking in the first beta release. The introduction of the visual state manager is great and allows for smooth transitions from one control state to another, so I could re add the nice button highlight effects present in the original alpha version of tarantula but which I had to remove in the first beta.

However the reason that I took so long to update Tarantula to work with beta 2 is that Microsoft in their wisdom decided to change the format of remoteaccess.xml files which silverlight applications will accept. To cut a long story short this means that the remoteaccess.xml files used by the amazon.com web services and many other web service providers is now incompatible with silverlight beta 2 clients, rendering those services inaccessible.

So to remedy this I had to write a proxy for the amazon.com services that was hosted on an accessible domain. However I could not be bothered writing a wrapper for the Amazon.com web services (like I did for the alpha version of silverlight) So I wrote a general purpose soap proxy component to do the work for me.

It works as an ASP.Net httphandler and maps local proxy endpoints to their real locations elsewhere on the net. To get it working all you need to do is have an ASP.Net website that will operate as the proxy, add a few config elements to the web.config, then point the silverlight client to the proxy address, and it will all just work as if you were communicating with the services hosted on an inaccessible domain.

In addition to the usual web.config changes to add an httphandler (detailed in the instructions bundled with the soapproxy components download) I had to add the following config entry to the tarantula.sharpoblunto.com site to map the proxy end point to the real amazon service endpoint

<soapProxyComponent>    
 <endPointMappings>     
  <mapping proxyEndPoint="amazon.ashx" remoteEndPoint="http://soap.amazon.com/onca/soap?Service=AWSECommerceService" />     
 </endPointMappings> 
</soapProxyComponent>

Then in Tarantula I had to change the service endpoint in the ServiceReferences.ClientConfig to point to the proxy address instead of the real endpoint.

<endpoint address="http://www.sharpoblunto.com/amazon.ashx"    
 binding="basicHttpBinding" bindingConfiguration="AWSECommerceServiceBinding" 
contract="Tarantula.AmazonWebService.AWSECommerceServicePortType" name="AWSECommerceServicePort" />

In practice it’s worked perfectly. I hope this tip comes in handy for those trying to access third party web services from silverlight beta 2 apps.

Latest tweet

News Archive