Placement reflections – 2 Months in!

So i’m 2 months in to working for Inspire Tech UK LTD, an online Ecommerce business based in salford. One thought that came straight to mind when writing that was, GEE HOW TIME FLIES! I’m not going to lie, the first few weeks where quite difficult, but i’m writing that off as nerves and  trying to impress from the get-go. The past few weeks however have been brilliant, and looking back, I can safely say that I’ve learned far more than I had anticipated.

Despatch Manager Online – Why did you give me such a headache?

One of the projects that stands out the most was the Migration from using Royal Mail’s Despatch Express to the new and not so improved (wait, did i say that out loud?) Despatch Manager Online. After getting access to the company’s account to begin development, It seemed like it was going to be a simply integration process. I thought that all I needed to do was modify our existing code, to generate a slighly different flat file (.txt). Oh how wrong I turned out to be. Not that writing the code was difficult, but that DMO’s rules on exactly what information goes in each field is far too restrictive. I’ll write another blog post to further explain this in detail, however for now lets just say foreign characters and certain other well used characters, such as a forward slash, are disallowed. The system doesn’t attempt to remove or replace them (like DE did), it instead just throws an error message when trying to import. Since we trade online, we get a lot of orders from overseas countries where International Accent Marks and Diacritics are used for addresses. So what was my solution? A very hacked together mess that ‘works’. I’m still not overly happy with it and when I get some spare time, I’m going to revisit the problem and try develop a more suitable solution. However I was on the clock on this one, and ‘It works for now’.

Basic Image Editor – A terribly named, yet neat tool (if I do say so myself)

More recently, just a few days ago in fact, I looked at how my manager edits and resizes product Images for use on our website and eBay etc. At the moment there is a partially automated solution, in that there is a macro set up in Photoshop to resize the images. My manager complained that it used far too much in terms of system resources (i.e CPU and RAM), and took a while doing multiple images. Plus we needed a solution to upscale images to a slightly higher resolution without causing Pixelation. Today, I’ve finished writing a new tool to take care of all this. Basic Image Editor (Look at how awesome I am with names….) can take single or an entire folders worth of files and either resize them, or add additional white space around the original images. My main objective here was efficiency. I wanted the tool to take care of several files in next to no time at all. I wrote the solution over the past couple of days, and spent a few hours today optimising it and fixing memory leaks. The result actually surprised me quite a lot.

We have a folder, containing approximately 6,800 500×500 jpg images (Perfect for testing). I expected the tool to process maybe 5 images per second before trying it. The first run actually achieved 10 images/second. Not bad. But I wanted to push it further. After optimising certain parts of my written logic and going for a second run it achieved… wait for it… 100 images/second. This includes the entire process of reading, editing and writing the output file (quite a demanding I/O operation). Current resource usage on my development machine peaked at 40% CPU (expected) and just 60MB of RAM! Needless to say I am pretty damn proud of it and can’t wait to properly demonstrate it to my manager tomorrow!


There have been other things that I’ve been up to as well such as website tweaks, fixes and additions, however If I was going to share everything I’ve been up to, then this would be a rather lengthy post. Needless to say I am thoroughly enjoying my time at Inspire tech, my colleagues are great and I’ve become very passionate about the programming work I do. The sense of satisfaction I get from seeing something I’ve spent time and effort developing, finally working and being used in the production environment is wonderful. It’s definitely giving me the motivation to want to learn more and become an better developer. Choosing to do an Industrial Placement as part of my degree, has already proven to be one of best decisions I’ve ever made. 🙂

Uploading a file via FTP C#

As web developers we all communicate with FTP servers. Desktop applications such as, my personal favourite, FileZilla allow us to manage our files between our PCs and the Server. But the downside is that a user needs to be present to select which files to upload, and to initiate the transfer process.

In many occasions, such as one I faced at work, we need a way of uploading a file to an FTP server without a user having to manually go about doing it. Wouldn’t it be great if we can write into our applications, a method automating the process? Well, the .NET framework allows you to do just that.

The FtpWebRequest class as part of the System.NET namespace, allows us to connect and upload flat files (eg text files, csv files etc) to an FTP server. The example shown below is one usage of the FtpWebRequest class. I put this method in it’s own class so that I could use it at various points throughout my project without having duplicate code.

The class:

using System;
using System;
using System.IO;
using System.Net;
using System.Text;

/// <summary>
/// Simple static class for uploading a file to an FTP server.
/// </summary>
public static class fileUpload
    public static string uploadFile(string file)
        // Get the object used to communicate with the server.
        FtpWebRequest request = (FtpWebRequest)WebRequest.Create("");
        request.Method = WebRequestMethods.Ftp.UploadFile;

        // This example assumes the FTP site uses anonymous logon.
        request.Credentials = new NetworkCredential("username", "password");

        // Copy the entire contents of the file to the request stream.
        StreamReader sourceStream = new StreamReader(file);
        byte[] fileContents = Encoding.UTF8.GetBytes(sourceStream.ReadToEnd());
        request.ContentLength = fileContents.Length;

        // Upload the file stream to the server.
        Stream requestStream = request.GetRequestStream();
        requestStream.Write(fileContents, 0, fileContents.Length);

        // Get the response from the FTP server.
        FtpWebResponse response = (FtpWebResponse)request.GetResponse();

        // Close the connection = Happy a FTP server.

        // Return the status of the upload.
        return response.StatusDescription;


Basic Usage:

This can be used at any stage in the project without the need of creating a new object, since both the class and the method are defined as static.


A better implementation may to be pass the connection and file destination variables as parameters to the uploadFile method, so that the code can be used in a static context with different FTP servers. If anyone would like to know how to achieve this drop a comment below, however this code should get you well on your way 🙂