Just a short post, maybe it will help someone. Lately, while working on a big PHP project, I was experiencing a problem with CPU usage. After some time of coding eclipse was using all four CPU cores, which resulted in general system slowness and quick eating my laptop battery.
As I don’t develop C# application at work anymore, I was finally allowed to switch from Windows to Linux. So I grabbed the 64-bit version of Mint Debian Xfce, installed it and moved my Thunderbird profile and my Python projects. After installing new Python virtual environment I launched the tests for our biggest project using Twisted. Tests passed, but it seemed to me that they run way too long. So I launched Windows once again and compared the time. Under Windows XP tests run for about 40 seconds and under Linux – for over 200 seconds. So I wondered how the hell was this possible, Linux can’t be 5 times slower than Windows.
A few weeks ago, while attending an IT conference, I heard one of the developers saying that the next version of their webapp will allow users to upload the files from their desktop using simple drag&drop. I immediately thought it’s a great feature in some scenarios:
- you can simply drop the file you working with to the browser instead of using the upload button and going through all you directory hierarchy to point it
- you can upload many files at once
- you get rid of those ugly upload fields and buttons
In one of the previous tutorials I described a simple solution that allows an application to check if a new version is available. The solution presented there has two major flaws:
- while doing the check the main application thread is blocked, thus making the application UI not responsive to user actions
- after finding a new version the user had to download and install it manually
A moderately skilled C# programmer should be able to solve these two problems easily. So in this tutorial we will learn how to implement our ‘check for updates’ option in a more advanced way. We will work with threads, events and delegates.
Lately I was told at work to create an installer for our new product. Till that moment I used to create exe installers with Inno Setup which has many advantages: it’s easy-to-use, powerfull and (the most important 🙂 ) I used it so many times that creating a new installer is a matter of minutes. But this time I heard a big ‘no-no’ for an exe – it had to be msi.
I created a simple “Setup Project” in Visual Studio, played with it for a while and hoped that will work as expected. Well, it worked, but I was told it needed some customizations (graphics, custom dialogs, launching the installed application after install). After doing some googling I was able to do all those things by editing the setup project and modifying the output MSI with Orca. But because every time I needed to create that installer for the new version I had to do some things (for example in Orca) manually – I really hated this solution. So I used google again and I found a really cool, freeware toolset called WiX which does everything I needed. You just create a XML-like file describing the installer and the toolset creates the MSI for you. Great!
Note: a free tool converting Metastock data to text files is available.
The source code is available on GitHub: git://github.com/themech/ms2txt.git.
Last week I decided to check how my trading system performs while playing on different foreign indexes. First I had to download the test data. I found a web page offering the quotations I was interested in – luckily it wasn’t expensive.The problem was (of course it occurred after I had paid) that the data was available only in Metastock format. Of course I use my own software (just as every other programmer 😉 ) that helps me to play stocks and futures and I don’t have Metastock. So I decided I would give it a try and I wrote a tiny program that reads Metastock files and generates text files with quotes. I used my beloved Python. You can find the source here.
Today I decided I would add a ‘check for update’ option to my Eyes Relax application. This is quite useful feature, especially when you host your application on many hosting servers (like download.com and others). In this case it can be difficult for the user to check if there is a newer version of your software available, because:
- the user does not remember where he downloaded the application from
- there is an older version on the hosting server, so the user is not aware that there is a newer version of your app available
- simple, but very common reason: the user is too lazy to look for the new version :P; and because it’s easier to simply select the ‘update’ option in your application, it may work for lazy users
Beside those reasons this is a nice, small feature we can practice our c# programming skills on :). At least for me, because I’ve spent last two years mainly developing server modules in Python. Two major subjects are:
- HTTP file downloading
- simple XML parsing (