Archive for September, 2012

Storing Images in XML files using C#

September 29th, 2012

XML files contain data in the form of text. Any data can be stored in and retrieved from an XML file as long as you can convert the data to text before writing to the XML file and then convert the text from the XML file into the correct data type when reading it back.

To convert and image in to a string so that you can store the image in an XML file, there are a couple of steps to go through:-

1. Convert the image to an array of bytes.
2. Convert the array of bytes to a string.

For this second step there is already a standard encoding scheme – Base64 – for encoding binary (byte) data into a string format. Luckily for both these conversion steps, .Net already includes the necessary classes and methods to do the work for us.

Here is a C# example of converting a PNG file into a string that could then be stored in an XML file:

String TheImageFile = @”c:\about.png”;

Image TheImage = Image.FromFile(TheImageFile);

TypeConverter converter = TypeDescriptor.GetConverter(typeof(Image));

String TheImageAsString = Convert.ToBase64String((Byte[])converter.ConvertTo(TheImage, typeof(Byte[])));

Converting back from a string to an image is a matter of reversing the steps …

Byte[] TheImageAsBytes = Convert.FromBase64String(TheImageAsString);

MemoryStream MemStr = new MemoryStream(TheImageAsBytes);

Image I = Image.FromStream(MemStr);

If you have a document containing a mix of text and images that you want to tidily save into a single file, you can use code like the above to easily store any embedded images as well as the text.

Seven Advantages of Using Desktop Invoicing Software

September 9th, 2012

These days the big move is toward online Software As A Service such as online accounting and online invoicing software. However, in a number of aspects, desktop software still holds a strong position. Here are 7 areas where desktop invoicing software can still beat online invoicing software:-

1. Desktop software is more mature with respect to online apps. Although RIA (Rich Internet Application) technology is advancing, traditional desktop software still allows far more sophisticated and powerful user interfaces to be created.

2. The costs of desktop software are usually less than those for online software. With an online software, the software vendor always has to charge on an ongoing basis for the cost of hosting the application. This usually means an ongoing monthly subscription to continue to use the online web application. With desktop software, although the initial cost of purchase can be higher the costs are usually a one-off except for occasional upgrades.

3. The speed of operation of desktop software is often greater than that of online invoicing software. Even though broadband speeds increase annually, many web applications have a spongy feel, making the user wait for new pages to be loaded.

4. Many online software enforce data and bandwidth limits whereas most desktop software are only limited by the size of your hard disk. Online vendors need to enforce price breaks since the cost of hosting their web applications rises as users need to store more data or use more processor time.

5. Although the best online invoicing applications have rock-solid security, many users would still prefer their financial data to be held on their own PCs, entirely under their own control.

6. Desktop software is always available for use. If you load it on a laptop or portable computer you can use the software while travelling. Online software is only as available as an internet connection, e.g. arranging for an internet connection while on holiday on a remote farm in Tuscany is not always easy.

7. As long as you have an internet connection on your PC, a desktop package can offer as many possibilities as an online system for things like emailing invoices and purchase orders.

Deciding between online and desktop invoicing is not a black or white decision, each system will has pros and cons. Often it’s the specific features of a particular software package that will make the decision. To try out a free trial of SliQ Invoicing to see if it suits you and your business, please visit our downloads page.

Windows OS Usage as Windows 8 approaches

September 3rd, 2012

With Windows 8 due out in late October this year, I thought I’d summarise some stats on existing OS usage.

As the picture below shows the most, Microsoft operating systems still dominate the desktop market in the UK with OS X being the main Mac OS in use at 11% of the market. I’ve also included iOS (iPad) for comparison. A good proportion of the people we encounter using OS X also run Windows (usually Windows 7) under some kind of virtualisation software such as Parallels or VMWare which tends to weaken the figure for OS X a little. Showing stats for the mobile market would give a total reverse of course, with Apple OSes dominating while Microsoft OSes take the minority share.


The real success story in these figures for Microsoft is Windows 7 which has grown to half the market share in little more than 2 1/2 years where its predecessor Vista crept up to about 19% of the market in roughly the same time.

The latest news from Microsoft is that Windows 8 will be available as an upgrade for only £24.99 in the UK. What’s even more surprising is that the upgrade will be available to owners of Windows XP and Vista as well as Windows 7. This means that people who haven’t bought a Microsoft OS for nearly 12 years will be able to upgrade for a very small fee.

It’s exciting times for Microsoft OSes and developers over the next few months with Windows 8 and the new Microsoft Surface tablet being released. Personally, although my wife wanted an iPad for her birthday, I can’t wait to get my hands on a Surface tablet. There has been quite a lot of negative press about Windows 8, with a lot of complaints about the loss of the Start menu that has been a feature of every Microsoft Windows OS since Windows 95. As time has gone on though, I’ve now begun to think of the Windows Metro interface as the Start menu replacement and Windows 8 has begun to feel even quicker and more fluid than Windows 7.