MVC 4 bundling CSS and JS files

Published

MVC 4 provides an excellent tool to help with optimising your web application called bundling. The idea of bundling is quite simple, you tend to have multiple CSS and JavaScript files which can be rolled up into one CSS and JS file. The contents of the files is also minified to reduce the individual file size. It might seem odd at first to bundle all your files into one but the idea is to reduce the number of http calls made, because a web browser can only handle two - four http requests at a time. If you have a lot of request to different files this can make your web app appear slow.

How to change the hostname on Amazon Linux machine

Published

To change the hostname of a machine you can use the following command: “hostname mynewhostname”. - With out the quotes. Worth noting is this does not affect the DNS and this is only for the current session. By rebooting the server, this information will reset to whatever Amazon machine is configured to.

How to open file dialogue just using JavaScript

Published

Say for instance that you want to open the_ file select dialogue_ for a user to select an file to upload. Like a photo, pdf or any other file type. But you don’t want to use the standard file input HTML element but instead use a link or button to show the file window.

Using GIT FTP and GIT Python

Published

GIT is an excellent version control system with its GUI GIT Extensions. Something I was thinking about was finding a way to push only the project file changes to the live server. Ideally being able to choose a committed version to push live, or roll back too. There are ways like bundling the project into a .zip or .tar file and deploying it.

Stored procedures and obscure errors messages

Published

Recently found a extremely simple way to fix a problem in one of our projects at work in MySQL stored procedures. Hopefully saving everyone else the massive amount of time spent adapting the program to work.

Regex link removal script

Published

Need to remove links from your content? This regex patten should do the trick.

Can't add or edit contacts on iPhone iOS 5

Published

If you have recently upgraded to the new iOS 5 and opted to use the iCloud you might have noticed that you can no longer add or edit your contacts. If you are one of these people the fix is quite simple but some what annoying.

BBC iPlayer on PS3 not working?

Published

After installing the latest firmware version 3.70 for the PlayStation 3 I noticed that the TV option had disappeared. How the hell did that happen?! This of course means that I could not access the BBC iPlayer via the icon, not like it was an issue just annoying, since it was basically loading it in the browser. I don’t know if anyone has tried using the new version of the BBC iPlayer in the_ PlayStation browser_, it kind of doesn’t work. You can navigate using the D-Pad but you can’t actually click through to the actual video item. The essential bit! Then I thought I will just search for the item using Google, found the TV series clicked on it and was faced with a loading screen that did not load anything! I gave it two minutes more that enough time. Great can’t access that actual videos directly, this is unbelievably frustrating, I was about to explode!

Create your twitter feed using JSON

Published

This is carrying on from a previous post Twitter Feed using JQuery JSON. Originally, I just used JQuery JSON method to query the Twitter API which got essential bits of a user profile and their time line. It only returned the latest ten results which is sufficient enough with the nature of twitter, tweets get old quick but some are worth checking again. With the Twitter API there is no guarantee to get the exact amount of tweets you requested. What is new in this revised edition of the twitter feed is it will now take the tweets and save a local version of it. This has plenty of benefits like quicker response when querying, view older posts, improved usability and you can customise the output how ever you like. Here is a list of what is new:

Execute JavaScript after images have loaded in

Published

I found myself needing to run a script to make minor adjustments to the page based on the size of an image, to keep things tidy. The problem I was having was using JQuery’s $(document).ready the script was executing as soon as the DOM was ready which is too early. The other option is to use $(window).load which runs only when the whole page has loaded, guaranteeing that I will get the image width and I can make my adjustments. The script below is used to make the image caption the same width as the image.