Showing posts with label dotnet

Who is getting all teh lolz?

Posted on 4/13/2009 by Glenn

Labels: dotnet programming

As much as man strives to seek out knowledge and try to understand his place in the universe, some questions remain as mysterious and profound as the day when they entered our collective consciousness.


Well today is a momentous day, as it is now possible to answer with certainty, Who is getting all the lolz, and where are the lolz occurring? If you feel underwhelmed by the scope of this achievement, don’t worry, its true significance will dawn upon you in the coming weeks.


lolmap is an application that uses the Google to find and geolocate the sources of the most popular lolz on all of the internets. Use it wisely, because after all internet lolz are serious business.


image[5]

0 Comments

Enter the Automaton

Posted on 4/2/2009 by Glenn

Labels: 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 installer and 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.

2 Comments

Hearing voices

Posted on 8/15/2008 by Glenn

Labels: 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 and binaries for this application here
0 Comments

Regarding the reconstruction of a site with additional dynamism

Posted on 6/20/2008 by Glenn

Labels: dotnet programming

Of late I've done a redesign of the home page for one of my side projects Junkship. While most of the site was simply static content that I migrated from PHP to asp.net on a new hosting environment, I did add a few new spiffy features around the sites image gallery. Because I'm not a fan of the bloated ASP.NET AJAX framework with its update panels and such, I went for a light weight approach to adding Ajax functionality (I would have liked to redo the whole site using the excellent ASP.NET MVC framework but alas my webhost only supports asp.net 2.0 sites).

 

image_thumb[6]

 

All Ajax postbacks are done using the prototype library which provides a simple and clean means to make Ajax requests to the server, at which point the server renders the desired controls and sends back the html, which prototype can then inject into the page DOM to be rendered.

Returning html controls from AJAX postbacks has a few nice advantages over returning raw xml data that has to be parsed and rendered on the client through JavaScript processing. Firstly it reduces the JavaScript processing that has to be done in order to update the page, as all the client has to do is inject the html subtree into the DOM rather than build its own by picking bits from the response xml. The other nice advantage is that the control rendering only needs to be written once on the server side, not duplicated on the JavaScript side.

 

An issue that comes up when designing Ajax enabled pages is the issue of the browsers back button, namely the breaking thereof. For my image gallery I wanted the back button to take you back a step, but not necessarily to the previous page as you can browse between many images on the same page via Ajax calls. To make this possible I tried to write my own solution by injecting anchor tags into the page via JavaScript, which worked.... on firefox and not much else :). I decided that surely someone else must have already written such a framework, but done a better job and made it cross browser, and it turns out I was right. Its called the RSH framework (Really simple history) and it allows you to specify when you would like to create a snapshot of the page that you would like to return to when the user uses the back or forward buttons. You can add as many of these points as you want and there is a callback system which notifies your JavaScript of page back/forward events and allows you to restore the desired page state based on the snapshot data. It works really well in practice (though I couldn't get it to work on Safari which isn't great because I use safari a lot now on my ipod touch) and means that the page behaves as you would expect.

 

You can view the gallery (and my awesome artwork :)) here

0 Comments

why do people split movies into 700mb blocks?

Posted on 1/19/2008 by Glenn

Labels: dotnet programming

For the love of god people, its 2008, I haven't burned a CD in at least 3 years, we all have hundreds of gigabytes of disk space, USB flash drives which hold multiple gigabytes, and high speed wireless LAN connections in our homes... So why is it that people still distribute movies split into 700mb blocks? who actually needs a movie to fit on a CD nowadays?

For me one of the most annoying things in the world is for a great movie to stop halfway through, right when you're immersed in the story and atmosphere, abruptly forcing you back into the mundane drudgeries of reality to get up off the couch, trudge over to the PC, find the second movie file and hit play. Its not that its a huge inconvieniance, its just that with today's storage technology we can quite happily distribute movie files in one multiple gigabyte file, using the 700mb CD storage limit is completely unecessary.

So anyway, whenever I get a movie split into ridiculous 700mb blocks I insist on merging them into one single file, VirtualDub is a great tool for this as it allows you to do a direct stream copy and append the second file to the first without having to re-encode the video or audio streams. This turns a job that can take upwards of an hour down to a few minutes and also means there is no loss of quality in the source material.

However I am a fan of foreign language films which more often than not come with external subtitle files (usually in .srt format) This means that if you want to merge the video files together you have to do the same for the subtitle files. The problem with this is that its a serious amount of work to do it by hand, so to ease my pain (and possibly yours) I wrote a tool which merges .srt subtitle files together. All you have to do is specify the two subtitle files to merge and also specify the first movie file (so the program knows how far to offset the subtitle timings in the second subtitle file by).

The binaries and source for this program are available here

Hasta Luevo.
0 Comments

c# project dependancy visualization

Posted on 12/16/2007 by Glenn

Labels: dotnet programming

Have you ever wanted a way to quickly visualize the overall architecture of a c# solution in the form of some sort of pretty diagram?

Well I had that thought yesterday, and figured that there must be some free tool out there that can take a solution file or directory and build a graph of all the underlying project files and dependancies. However to my dismay I found that there were no such tools (or they were commercial products or were completely over the top for what I wanted) so I decided to roll my own :)

The end result is an app which builds a graph of all the projects and dependancies in a directory (plus its subdirectories) as well as the relative sizes of those projects. In addition the graph is fully moveable by the mouse and all the nodes and points behave with realistic physics (I reused my Tarantula physics engine developed a while back)

dependancyAnalyzer

The app is written in c# 2.0 and is available in binary or source code form (under the conditions of the MIT license)

Download the source and binaries here

0 Comments