Tag: howto

  • Pinning Eclipse to the taskbar with Windows 7

    Eclipse is a brilliant programming interface for many languages but when using a Windows 7 based PC you may have issues when pinning the shortcut to the task bar. As you can see below when I launch eclipse via the shortcut instead of using the pinned icon it creates a new one.

    If you right click the active icon you do not get a “Pin this program to taskbar” option like you would with other programs. Eclipse on the left and Microsoft Word on the right.

    All we need to do is add 2 simple lines to our Eclipse configuration file so that Java is detected correctly which then enables us to pin the application to the task bar. First we need to go to the directory where we have placed the Eclipse files, in my case this is “C:/Program Files/eclipse” but this will differ between everyone.

    If you can’t find the files try right clicking any shortcuts you have and select properties that will tell you where the actual files are.

    There is a file called “eclipse.ini” open it in Notepad it should look something like this.

    Add the following to the top of the file and save it. The second line needs to point to your Java installation bin directory; this may differ on your computer.

    You can normally find all the Java installations in the following location “C:\Program Files\Java\”, if you have a older or new version of java than me or using the JDK version then the name may differ from”jre7”.

    You can now start Eclipse and right click the icon on the task bar where you will now see the “Pin this program to taskbar” and when you open Eclipse it will no longer create a new icon.

    If you receive the following error when trying to start Eclipse then you have provided a invalid file location for Java. Try the other locations or in my case it was due to me pointing it to the 32bit version instead of the 64bit version (Program Files (x86) instead of Program Files).

  • Redirect requests for files & folders which dont exist with .htaccess

    Normally if a visitor requests a file or folder which doesn’t exist your web server will respond with a 404 file not found error message, this isn’t the best looking error message and so it’s common to setup a redirect so instead of the web server showing the default page you can use a custom page which normally fits in with your websites template.

    The htaccess is a powerful file and any modifications can stop a website from working correctly. If you receive 500 error messages after modifications you have done something wrong and should revert to a backup.

    For example if you go to the following URL on my website you will receive a 404 error message but it is within the normally style of my website, if the redirect wasn’t present you would receive an empty white page with text telling you the file wasn’t found.

    http://shanerutter.co.uk/moo

    We will be using the .htaccess file which is part of the Apache web server to setup this redirect. You can read about this file here.

    http://shanerutter.co.uk/2011/07/31/apache-htaccess-file/

    HTaccess

    The follow code needs to be placed into your .htaccess file there is two versions of this code please see the differences below. These redirects will only occur if the requests file or folder doesn’t exist. Simply replace http://newdomain.com with the domain you want to redirect to.

    Example 1

    Domain: http://origionaldomain.com/moo
    Redirects to: http://newdomain.com/moo

    Example 2

    Domain: http://origionaldomain.com/moo
    Redirects to: http://newdomain.com

    Extra

    The two examples above require specifying the domain you wish to redirect to but in some occurrences you may not want this especially if you’re installing on multiple domains as the two examples above will need adjusted on a per domain basis to work correctly. The following is the same as example 2 but it redirects to the websites root directory and so you don’t have to specify a domain.

    For example this will redirect any requests to http://domain.com/my_fake_file.txt to http://domain.com/ as long as my_fake_file.txt doesn’t exist.

    Remove Query String

    It has come to my attention that the redirects will still contain the query string so a request to http://mydomain.com/fake_file.php?action=123 would redirect to http://mydomain.com/action=123, to remove the query string simply add a ? to the end of the redirect location. Below is an example using the example code above.

  • CSS & Javascript Minify / Compression

    Optimization is a key part of any website we need to keep it loading quickly for the sake of keeping visitors and also for lowering server stress. With internet connections becoming faster most developers skip optimization but mobile broadband and phones are growing rapidly which still have a relatively slow connection when compared to the common household internet connection.

    Even if a website has a quick loading speed why not try to shave of half a second loading speeds it might not seem allot but it is noticeable especially on a mobile connection.

    Minify (also known as compacting or compression but its not true compression) is a method used to lower the file size of text based files by removing unneeded white space, line breaks, comments and placing the code as compact together without disruption functionality. This can turn those 100KB files into 2KB files and it’s the simplest thing to do it could take your 5 minutes.

    CSS Compression

    I use the following website to compress my CSS files its simple and quick to use.

    http://www.csscompressor.com/

    You simply copy your CSS into the big text field and selection the options you want for best compression I would suggest ticking all boxes and changing compression mode to greatest. Here is a comparison of my websites main style.css file on the left we have the uncompressed version and then the compressed version.

    Its only 12,310 bytes difference but that’s now 12,310 bytes less each of my visitors need to download, 12,310 bytes less bandwidth I use each time then download this file and a speed increase especially for mobile devices.

    JavaScript Compression

    I use the following website to compress all my JavaScript files its simple and quick to use just like the css compression website.

    http://javascriptcompressor.com/

    This works very similar to the CSS compression website you simply paste your JavaScript into the top text field click compress and then your new code appears bellow. There isn’t any options but it does exactly what I need which is strip all white spaces, line breaks, comments and compact it together. Here is an example of one of my Javascript files, uncompressed on the left and compressed on the right.

    As you can see there is a 12,000 bytes difference.

    Issues

    The only issues I have found is due to programming errors such as missing “;” characters, due to all the code being compressed onto one line you must make sure that at the end of all CSS and JavaScript lines you have a “;” character which you should be doing already.

    You should always keep a copy of the uncompressed file but for those who lose this file you can always uncompress it using the following websites.

    http://www.javascriptbeautifier.com/

    http://mabblog.com/cssoptimizer/uncompress.html

  • Creating an SSH connection using password authentication

    Creating an SSH connection using password authentication

    SSH is a secure shell command line technology allowing a user to connect to a second computer and perform many tasks securely. I have written a post which is found here which tells out all about the SSH technology. In this post I am showing you how to connect to a SSH server in Windows and Linux operating systems using password authentication, if you are using public/private key authentication please read this post. I would recommend everyone to use public/private key authentication because it increases security dramatically, a SSH client can on connect to the server if they have the correct private key and a private key can be encrypted using a password increasing security even further. (more…)

  • How to create VMs (virtual machines) using VirtualBox

    How to create VMs (virtual machines) using VirtualBox

    Virtualisation is used to run multiple operating systems on a single computer, if you want to know more about virtual machines (vm), virtual private servers (vps) then please read this post. In this guide I will be teaching you how to install, setup and start a virtual machine using some software called VirtualBox, there is alternative software available but I have chosen this one due to its ability to run on most operating systems such as Windows, Linux and it’s free. (more…)