FireShot – A Really Good Webpage Screen Capture Tool

Working in the web industry and having the opportunity to develop a wide variety of websites, I like to take a snap-shot of a few pages for my portfolio (working on that!). But I generally come into issues when taking a screen-shot of a very long webpage. In fact, I always experience issues when screen grabbing a scrolling page.

Luckily, I found a really useful add-on to Firefox called Fireshot. Fireshot makes it really easy to screenshot an entire page. Once you have made a screenshot, you can carry out the following tasks within the comfort of your browser:

  • Upload to Facebook, Picasa, Flickr.
  • Saved to disk as PDF/PNG/GIF/JPEG/BMP
  • Sent to clipboard
  • Print
  • E-Mail
  • Export

I was expecting this tool generate a screen grab really slowly. Even on long pages with a lot of content, images are generated quickly. Take a look at the screen-shot I made of "http://www.theverge.com" here.

Definitely try it out.

HTTP Request Script

In one of my website builds, I needed to output around a couple thousand records from a database permanently into the .NET cache. Even though I set the cache to never expire, it will get cleared whenever the application pool recycles (currently set to every 24 hours). As you can expect, if a user happens to visit the site soon after the cache is cleared, excess page loading times will be experienced.

The only way I could avoid this from happening is by setting up a Scheduled Task that would run a script that would carry out a web request straight after the application pool was set to recycle.

Luckily, I managed to find a PowerShell script on StackOverflow that will do exactly that:

$request = [System.Net.WebRequest]::Create("")
$response = $request.GetResponse()
$response.Close()

HTTrack - Website Copier

One of my colleagues pointed my to a really useful tool called HTTrack, that has the ability to download a website from the internet to a local directory by simply copying and pasting the site URL of your choice.

I found this tool helpful when working on an existing site where I was unable to 100% recreate the files and directory structure within my local development environment. For example, you could be developing a new micro-site for an existing online site you may not currently have in your local environment.

HTTrack has the ability to build recursively all directories, images and other files from the server to your computer. What’s even better, HTTrack arranges the original site's relative link-structure.

My First PowerShell Script - Moving Files From One Directory to Another

Microsoft’s new command-line tool, PowerShell has been out for quite a few years now and I thought today will be the day I would start using it. I needed to write a script that would move n number of files from one directory to another. This job seemed a perfect fit for PowerShell.

#Get 'n' number of files
$FileLimit = 10 

#Destination for files
$DropDirectory = "C:\Drop\"

$PickupDirectory = Get-ChildItem -Path "C:\Pickup\"

$Counter = 0
foreach ($file in $PickupDirectory)
{
    if ($Counter -ne $FileLimit)
    {
        $Destination = $DropDirectory+$file.Name

        Write-Host $file.FullName #Output file fullname to screen
        Write-Host $Destination   #Output Full Destination path to screen
        
        Move-Item $file.FullName -destination $Destination
        $Counter++
    }  
}

From the get go, I was really impressed with the flexibility of the scripting language. This is where command line fails. It is sufficient for simple tasks but not so much for complex jobs.

As you can see from the code above, I can implement complex operations that supports variables, conditional statements, loops (while, do, for, and foreach), and that’s just the start. I don’t know why I hadn’t used PowerShell sooner. If I didn’t have the option to use PowerShell, I would have probably created a C# service or executable to do the exact same thing. Time saver!

Since PowerShell is built on the .NET Framework, Windows PowerShell helps control and automate the administration of the operating system and applications that run on Windows. So if you are a C# programmer, you should feel comfortable in writing PowerShell scripts. All you need to be aware of is syntax differences when declaring variables and keywords.

To end with, I will quote an amusing forum post I found when researching the difference between good ol’ Command Prompt and PowerShell:

PowerShell has a default blue background and Command Prompt has a default black background.”

Speed Up Firebug

I noticed recently that Firebug was running very slow whilst inspecting elements or debugging client-side scripts. In the past when noticing performance issues in Firefox, a straight-forward opening and closing the browser normally resolved any issues.

What I found after investigating this problem online is that Firebug keeps a record of all breakpoints and sites where Firebug was used. As you can imagine, this will accumulate over time. To remove all history, go to your Firefox profile directory which can be found here:

C:\Users\<Windows User Account Name>\AppData\Roaming\Mozilla\Firefox\Profiles\<Firefox Profile ID>.default\firebug

You will find two files within Firebug folder directory:

  • annotations.json - contains a history of website browsing.
  • breakpoints.json - contains currently set breakpoints.

Close all running instances of Firefox and delete both files within the directory.

Judging by posts from other users online, there could be other contributing factors to Firebug's sluggishness at times. Hopefully, by carrying out the steps above you will notice a difference.

Stay out of trouble! Backup your files with RoboCopy

robocopyApologies for making a reference from the social-satire/sci-fi film that is RoboCop (1987) in my post title. It just had to be done when talking about some tool called RoboCopy. For those who aren’t aware of what RoboCopy is, where have you been? In all honesty, I myself never heard of it until a few days ago.

RoboCopy is a command-line run tool that allows you to copy files from one directory to another. One of its most popular uses for RoboCopy is it’s ability to copy large volumes of files quicker than carrying out a manual copy and paste through a GUI, making it ideal for backup jobs. So you could easily write a backup script to run via a Schedule Task on a daily basis.

I managed to backup around 80Gb of files in less than an hour. What’s even more impressive is that I could run numerous RoboCopy scripts at the same time. Currently, I have only run two scripts simultaneously just to be on the safe side.

Prior to RoboCopy, I was using another command-line tool: XCopy. For my backup purposes XCopy did exactly what I wanted it to do until I came across a misleading error message: “Insufficient memory”. You would think this message would mean the destination directory to where your files are copying to is full or not enough memory resources. In matter of fact this error only happens when the fully qualified file path is longer than 254 characters. Unfortunately, I couldn’t get around this error due to the nature of how my directories are structured. Luckily, RoboCopy doesn’t have this limitation.

One of the major strength’s of RoboCopy is the number of useful options you have at your disposal. A few example’s are:

  • Moving files.
  • Exclude certain files and file types.
  • Detailed logging that tells you new the files that have been copied or over-written.
  • Parameterised scripting.

Example Script

@ECHO OFF

ECHO PROCESSING BACKUP ...

robocopy \\work\Projects\ F:\Projects\Backup\ /mir /sl
/log:"F:\Logs\Projects-%date:/=%.log"

ECHO BACKUP COMPLETED!

The script I have provided is what I use to backup files through a Schedule Task that runs at the end of every day. This script mirrors the source drive exactly. So any files that have been deleted, updated or created will have the same effect on the backup drive. In addition, a log file is created when RoboCopy is running.

More Information

EaseUS Todo Backup Disk Clone Tool…It’s Good!

Earlier today, I decided to upgrade my laptop’s hard drive to a larger capacity disk. As we all know, the most straight-forward method of carrying this out is by cloning the existing drive onto your new disk of choice. Originally, I was planning on purchasing “Acronis True Image” since this is something I’ve used it in the past and makes cloning any disk a cinch!

I decided to look for some freely available cloning software available online, instead of having to pay £30 for software I won’t be using that often. Yes I am that tight! :-) In all honesty, I wasn’t expecting to find anything substantial but I was surprised to find a great piece of cloning software called “EaseUS Todo Backup” free edition. EaseUS Todo Backup software not only had the ability to clone a disk but also had the following useful features:

  • Backup – on selected files, partitions or your entire computer
  • Recovery
  • Scheduled backup plan

I am happy to report that I managed to clone the whole of my disk drive successfully within 2.5 hours (based on 126GB of data). Whoever said nothing in life is free!

You can download EaseUS Todo Backup here.

Cannot Delete File: The file is in use by another program or user

Arrrgh!!! Microsoft has to be the yearly winner for the “Most Stupid Error Message” award for displaying the most excruciatingly annoying error messages in any of their products. The main reason for their annoyance is because majority of the error messages tells you something is wrong, but not the source of the error. A good example of this is: “Cannot delete file. This file is in use by another program or user”.

I am not expecting the error message to tell me the exact cause of the error but at least some meaningful information on what could be the issue. Anyway, back to the error at hand…

I found a really great bit of free software that fixes the problem. Its called Unlocker and you can download it here. It allows you to see exactly what processes are currently using the file you are trying to delete, edit or move. What’s even better is that Unlocker can kill the processes within its UI.

Mac OS X Snow Leopard VMware Environment Freezing

Over the last week or so, I have had the most frustrating time creating a Mac OS X Snow Leopard environment using VMware. I won’t go into the whole process I went through to create my Virtual Machine. There are many online articles for you to Google (or Bing :-P) that show you the step-by-step procedures on how to create a Mac OS virtual environment.

All I can say it took a lot of blood, sweat and tears! You may find that you need to cross-reference between a few sites in order to get the winning combination for a working VMware environment.

Anyway, if you are one of the lucky ones to have successfully built a Snow Leopard environment, you may have come across an issue whereby your VMware environment randomly freezes for no apparent reason. Now this is quite annoying. After much searching and constant VMware configuration changes, I could not get to the bottom of the issue. I knew that it could not have been to do with the setup, after all I had a fully functioning Mac environment.

What I noticed is that my environment would never freeze whilst I was using it. It only froze if I left it idle for long periods of time. You are now probably thinking:

GET TO THE POINT! HOW DID YOU FIX IT???

Well the cause of the environment to freeze is due to the Energy Saver settings found under System Preferences in your Mac OS (Apple icon > System Preferences > Energy Saver). You will find that it is default to 15 minutes idle time before going into sleep mode. All you need to do is set both Computer Sleep and Display Sleep to Never. As a precaution I also unticked the “Put the hard disk(s) to sleep when possible"

MacOSEnergySaver

Sign An Assembly In Visual Studio 2003

I needed to create a custom web part using Visual Studio 2003 for a SharePoint 2003 client intranet, something I have never done before. As fellow SharePoint developers will know, you need to strongly name your project assembly whenever you need deploy a custom made web part.

Visual Studio 2005 and onwards allows you to easily create a strongly named key through the graphical user interface. In Visual Studio 2003, you will need to use the Visual Studio 2003 Command Prompt. You can find the Visual Studio 2003 Command Prompt by going to: Start > Program Files > Visual Studio 2003 > Visual Studio.NET Tools > Visual Studio .NET 2003 Command Prompt.

Visual Studio 2003 Command Prompt

Once the command prompt window has opened all you need to do is enter the following to create a SNK:

Setting environment for using Microsoft Visual Studio .NET 2003 tools.
(If you have another version of Visual Studio or Visual C++ installed and wish
to use its tools from the command line, run vcvars32.bat for that version.)
 
C:\Documents and Settings\Administrator\Desktop>sn -k MyKey.snk
 
Microsoft (R) .NET Framework Strong Name Utility  Version 1.1.4322.573
Copyright (C) Microsoft Corporation 1998-2002. All rights reserved. 
 
Key pair written to MyKey.snk
 
C:\Documents and Settings\Administrator\Desktop>

As you can see from my command prompt example above, I am creating a new SNK file called MyKey.snk. This SNK file will be generated on my Desktop.