Long Hiatus

Hello one and all!

It has been quite a while since I last made a post here. In the near future I plan on starting blogging about my experiences in programming (and other related topics) again. Hopefully I will be able to provide some information related to the “Learning Japanese” program that I am slowly putting together.

More to come in the near future, wish me luck!

Setting up a local web server with WAMP

Hi everyone.

This is something I recently had to do so I figured I’d share this with anyone else out there that may want to know. For a long time I’ve wanted to setup a local web server to build and test sites locally without the need to continually upload the files (and as a plus of course, local files are easier to back up). After some research and playing this is the process I eventually came up with to get the optimal configuration for what I need.

Firstly it was a choice between XAMPP and WAMP. I ended up choosing WAMP because I didn’t need Perl. Other than that they seemed about equal.

After downloading the EXE I installed it (obviously) and copied the files to the www folder (which is located in C:\wamp\www\ by default). I noticed a few problems right away however. .htaccess rewrites didn’t work as the module was enabled. To re-enable it I clicked on the icon in the task bar, clicked on “Apache”, then “Apache modules” and selected “rewrite_module”. I then had to restart the server by clicking on the icon once again and selecting “restart all services”.

That fixed most of the rewrites not not all of them worked. It turned out this was because I needed to add a virtual host for the project. Luckily this also wasn’t difficult to achieve.

First you need to pick a name for the virtual host, I picked tnda because that was the name of my project. That name will be used in my examples here. After picking the name you must then open the following file: “C:\Windows\System32\drivers\etc\hosts” in your favorite text editor. At the bottom of the file you need to add a line like this, substituting tnda with your chosen project name. Note that this name CANNOT include spaces! tnda

After doing that, save and close the file.

Next we need to modify the Apache virtual hosts file. This one is also luckily pretty simple. In the default WAMP install it should be located here:”C:\wamp\bin\apache\Apache2.2.21\conf\extra\httpd-vhosts.conf”. Of course the Apache version may vary depending on when you installed the program. Open this program in your favorite text editor and at the bottom of the file you need to add this. Substitute the path here “c:/wamp/www/tnda” with the path to the folder in which your project lies. You also need to replace the server name (TNDA here) with the name chosen in your hosts file above.

DocumentRoot "c:/wamp/www/tnda"
ServerName tdna

Options Indexes FollowSymLinks
AllowOverride All
Order Allow,Deny
Allow from all

Save and close the file. Now you again need to restart Apache. You will now find that you can use full mod-rewrite rules on that project and as a plus you’ll be able to use http://projectname to access the resources quickly locally when the server is active.

I hope this helps people simplify the process.

File Shredder Code Sample (C# 4.0)

It has been a while since I last posted a code sample. So here is one for you guys to take a look at. Below is the file/directory shredder class.

class FileUtilities
    private static Random Randomizer = new Random();

    public static bool Shred(string directoryPath, bool shouldDelete = true)
        bool success = true;
            string[] files = Directory.GetFiles(directoryPath, "*", SearchOption.AllDirectories);
            foreach (string file in files)
                success &= FileUtilities.ShredFile(file, shouldDelete);

            string[] directories = Directory.GetDirectories(
                str =>
                str.Split('\\').Length - 1
            foreach (string directory in directories)
                success &= FileUtilities.ShredDirectory(directory, shouldDelete);

            success &= FileUtilities.ShredDirectory(directoryPath, shouldDelete);
            success = false;
        return success;

    public static bool ShredDirectory(string directoryPath, bool shouldDelete = true)
        bool success = true;
            DirectoryInfo directoryInfo = new DirectoryInfo(directoryPath);

            string[] directoryBits = directoryPath.Split('\\');
            directoryBits[directoryBits.Length - 1] = FileUtilities.RandomName(directoryInfo.Name.Length);

            string newDirectoryPath = String.Join("\\", directoryBits);

            if (shouldDelete)
            success = false;
        return success;

    public static bool ShredFile(string filePath, bool shouldDelete = true)
        bool success = true;
            FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Write);
            for (long i = 0; i < fs.Length; i++)
                fs.WriteByte((byte)Randomizer.Next(0, 255));


            FileInfo fileInfo = new FileInfo(filePath);
            fileInfo.MoveTo(fileInfo.DirectoryName + @"\" + FileUtilities.RandomName(fileInfo.Name.Length));

            if (shouldDelete)
            success = false;
        return success;

    private static string RandomName(int length)
        string fileNameChars = "abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ~!@¤#$£§%^&()+`={}][;,";
        string newFileName = String.Empty;
        for (int i = 0; i < length; i++)
            newFileName += fileNameChars[Randomizer.Next(0, fileNameChars.Length)];

        return newFileName;

The usage calls for these functions as as follows:

bool success = FileUtilities.Shred(@"D:\Temp"); // This method will recursively shred a file / folder.
bool success = FileUtilities.ShredDirectory(@"D:\Temp"); // This method will shred the contents of a folder and the root folder.
bool success = FileUtilities.ShredFile(@"D:\Temp\test.txt"); // This method will shred a specified file.[

I will not go through the code line-by-line to explain it as I feel most of the code is pretty self-explanatory. However if there are any questions feel free to post a comment.

Image Encryption – Completed!

It has been a while since I posted so here is an update for you guys. I should (hopefully) have some time to post some more blog posts detailing my current projects over the next week or so.

My image encryption tool (now known as PGIE – Pretty Good Image Encryption) is finally completed. Anyone wishing to test it is welcome to ask me about it.

Here is a little description that I threw together about the program.

Have you ever had a secret you wanted to hide in plain sight while still feeling secure? If so PGIE is just the program for you!

PGIE uses an innovative and unique mix of new and traditional encryption techniques to store data within a randomly generated pixel image that can only be decoded using a special key file.

How It Works:

PGIE first encrypts the data using a Rijndael symmetric algorithm. The key used to encrypt the data is a randomly generated 1024-bit binary key that is unique to each encode.

The encrypted data is then split into sections and stored within the image. The data is then further secured by modifying the file based on the information stored within the key file. Finally the image is modified to make the original entry point unreadable.

If either the key file or encoded images are modified or damaged then the encryption is one way.

In order for a brute force attack to be successful on this encryption the whole key file image would have to be guessed precisely; every red, green, blue and alpha component would have to match the original in order for the decryption to occur successfully. This would take a very, very long time to achieve with modern computers. See the technical details section below.

Technical Data:

There are a set of 65,535 possible characters that can be used in the encryption key and the key is 1024 characters in length. This means that there are 65535^1024 possible key sets to choose from – one very large number! In the simplest terms possible – if a computer can generate a billion keys per second then it would take far, far longer than the universe has existed to forcibly break.

There are four channels for data within a PNG pixel, red, green, blue and alpha. Each of these can range in value from 0-255. That means that there are 256^4 possible colour values per pixel (4,294,967,296). As the image size grows more pixels need to be correctly guessed in order to decode the image. As such each added pixel makes the image more difficult to decode again, making it virtually impossible to forcibly break.

CSIT – Round 2

Hi everyone.

It has been a while since I last posted. Unfortunately my recent work with CCC has kept me busy and away from my personal projects. However as I currently have some spare time I have decided to revive the old CSIT project and revisit the idea.

I will be starting work on the project in short order (probably tomorrow or later next week). The project will probably still be called CSIT (Complete System Information Tool-kit) and will be similar to the old ideas for CSIT but not identical.

I am currently working on the plans for the design and core code ideas. The project will be based around C++, ASM, C# and WPF.

TNDA – A new tool site for Neopets

Hi everyone!

Just a quick update. Firstly happy new year since this is my first post for this year.

I’m currently working on a new site that will give Neopets users some interesting new tools to play with. I will post more details about it as I decide what features will be there – but in the mean time any suggestions and requests are welcome.

I will be focusing much of my efforts on statistic related items – trying to determine how the random events and so fourth work.

US – The Worlds Copyright Police – Update

This is a follow-up to the article I posted earlier this year.

The US have now started seizing domain names, against the wishes of their own people and the rest of the world. They need to be taught a lesson, that they are not gods and do not control the fate of the internet. The WORLD Wide Web should remain as such, a global system. Allowing one country to selectively control and censor it would make the internet far less useful and would become a politician weapon.

This needs to stop, right now. For the moment they have started taking control over torrent site domain names, which can be easily corrected by using the hosts file – which I will describe in a later post.

To anyone living in the US who may be reading, if you value freedom on the internet please protest to whomever you think can help.

You can read the full article on torrent freak here.

TCE – Website Edition

Hi everyone!

I have moved the TCE project from being a C# program into a web based project instead, I am currently working on a basic design and implementation before I release the website for public viewing.

If anyone is interested in helping or beta testing the project then please feel free to contact me.

New Project – TCE – The Chemistry Explorer

Hi everyone!

Here I am, writing about yet another one of my projects. This time I have decided to work on a program relating to a subject that is both close to my heart and one that some people find difficult to understand – chemistry.

I am thus building a tool to help people understand and solve chemistry related issues, it comes with a periodic table (as shown below) a chemistry calculator as well as some other features. As always I am open to suggestions and help should you wish to contribute either.

I will post developments on this project as I complete or start work on various parts of it so stay tuned for more! (Yes, I did copy the colours from the Wikipedia Periodic Table but I am colour blind so that was the best I could do under the circumstances!)

Current Periodic Table Display (v1)

Image Encryption Tool – Data Format

Hi Everyone!

In an earlier post I said I would explain a little about the the format used in my new data encoder and so here it is.

The images are stored in PNG, not any other type of format, because PNG supports full alpha transparency. The data is encoded by converting the text into binary data and then these are converted into pixels of colour, with the data stored in one of the 4 colour components (red, green, blue, alpha).

Certain operations are then done on this data to make it harder to recover and the remaining spaces are filled in with randomly generated pixels.