Me Love You Runtime Code Monkey!

What's that duck for?

I’ve written about this before in my last, not so focused blog, but I’ll write it again. There are a few simple non-programming programmer rules I like to adhere to. These would be things like KISS (Keep It Simple Stupid) etc. Another lesser known one of these is Rubber Duck Debugging.

The duck on my desk

When you hit a conundrum while coding, it is very easy to sit and suffer, draw diagrams etc. Many (including myself) tend to internalise this and not speak it. Usually, if you then ask another programmer, by the time you have explained the problem you have worked it out because you have externalised the issue.

Rubber duck debugging gets round this (sort of). You get a rubber duck (you should always have one on your desk) and when you hit a conundrum, you pick the duck up and you explain the issue you are having. By doing this, you externalise the problem and it can really help. It feels daft, but it can really cure the issues of Cognitive Dissonance and make you feel much better.

Of course, asking someone else helps even more, but if they’re not about/you feel stupid asking because it feels like a simple issue, this is a great back up.

And that, ladies and gentlemen, is why I have a rubber duck on my desk.

Supersized Jquery library

I keep saying this: if .net and C# (or just back end technologies), then HTML, Javascript and CSS (front end technologies) are my mistress. I love to dabble with these lovely pieces of simple but great technologies.

One of my latest things is to take a library off Github (let’s not forget Bitbucket too!) and start playing with it. Recently, I needed a way of easily animating a background on a page and by chance stumbled across the Mishkin’s site: http://mishkins.co.uk/. Apart from ogling the food, the background transitions are amazing, even if you have low resolution images. I decided to peruse the source code to find they use a Jquery library called Supersized, a library which allows backgrounds to be loaded and displayed like a slideshow with lovely effects. It even handles stretching the image as you need and various other options.

Have a go. I love the way the web has progressed.

Remotely disconnect an RDP session

If you find someone doesn’t log off their session after using RDP and just disconnects, you may need to regularly ask them to log off, or force a log off. But you can also log off their session remotely by doing the following in your command line (this should work in your dev environments internally, it may not work on servers outside your domain etc.).

qwinsta /server:

You get results with who is logged in, a state and an id (session Id). Just remember the id.

Then type:

logoff  /server:

Fonts and MsDeploy

While trying to deploy a site this morning using MsDeploy triggered by my build server, most worked well, apart from the fonts I was using being pushed as well. Some fonts are called from the CSS and need to be in there too. These didn’t upload with the deploy at all. Well, one did, but I have 4. I realised that each of these files need to be set to be Content in Visual Studio and hey presto, fonts will go in the build.

This should work with other files if you’re having problems with them not being in the build.

Setting up SSH and Git on PC

Today at lunch, the tech team at work sat down for a lunch at learn to work out Git, which we are currently migrating to. We had a few learning issues with setting up SSH keys within Git Extensions, so I thought I’d write my findings down here.

For this, you’ll need to download Pageant and PuTTYGen from the PuTTY download page.

Once done with that, open PuTTYGen and click “Generate”. You’ll then need to run your mouse around until you have a random key. After this is done, click “Save private key” and save the file somewhere. At the top, there will be a Public key you can copy starting with ssh-rsa, copy all of this string.

Open Pageant (it may open in the System Tray, so if it doesn’t appear, just search for it there). Click to Add Key and select the private key you saved earlier.

Now log into your Github account and go to your account settings. In the account overview, you should find “SSH Public Keys”. Add a new public key, you can call the title anything. Then paste the public key you copied earlier into the “Key” field. You should now be set up to go with SSH.