Posts

No Silverlight?

I'm trying to view this page in Firefox. When it loads the browser tells me I need Silverlight, so I download and install it and then restart my browser only to be told I need to install Silverlight. That's not impressive at all!

Delphi flickers

My app has a wizard approach, the current control appears within a panel with Align set to fill the hosting panel. My first wizard step control merely had an image on it which resizes with its parent control. When I resize the form the host panel resizes, which resizes the wizard control, which resizes the image; and boy does it flicker! I just had to spend some time upgrading my old Delphi DIB controls to D2009 just to get an image that doesn't flicker, crazy! By the way, I tried the same thing in VS2008 and there was no flicker at all, and I thought Delphi was supposed to be the tool that produced fast UI apps.

Synchronising downloads and updates (2)

There was a potential deadlock in the last piece of code. When you obtain any kind of lock you will mostly use a try..finally block to ensure the lock is released when you have finished with it. The using() command expands to a try..finally block so the original code might look okay, however if you mentally expand the code you will see the problem. using (FileLockingService.FileReadLock(product1.ID)) {     //Some code here } This becomes var disposable = FileLockingService.FileReadLock(product1.ID); try {     //Some code here } finally {     disposable.Dispose(); } So why is this a problem? In a single threaded application it isn't, but this is a website so there are multiple threads running at the same time. Now take into account the fact that a web request has a timeout, what if the thread is aborted after the lock is obtained? Ordinarily this isn't a problem because the acquisition is followed immediately by a "try", but if we expand this code further it is ev

Synchronising downloads and updates

Apparently my boss used to be annoyed with something on his old website. When he wanted to upload an updated binary he often couldn't because his product was so popular that someone was always downloading it at the same time. He'd have to continuously hit Delete in his FTP client until eventually he'd slip in and manage to delete it before updating the new version. This obviously isn't an ideal solution because: He constantly had to sit there for around an hour trying to delete it. Once deleted from the disk any user attempting to download would get a 404 – Not Found error. During upload any user attempting to download would get an Access Denied error of some kind. For this website I have decided first of all to only update the files via a HTTP form post. So firstly any long running upload will not deny access to the currently available file, this eliminates problem 3. Additionally, using a form post means I can overwrite the existing file, so this eliminates problem 2.

The best tool for the job

If I had to write a large business app which accessed a DB, or a website, I would use .NET without hesitation. When it comes to small apps (less than 10MB) that will be downloaded by home users what should I use? I have such a project coming up soon, my boss has bought D2009 and wants me to use that because he is paranoid about people reverse engineering the binaries. I'm a little hesitant but I must admit that I think in this case Delphi 2009 probably is the best tool for the job, and I like to use the best tool for the job rather than the tool I like to use best for my job. Hopefully things will go smoothly, it will be nice writing apps in two different languages.

Music to fight to

An odd title for a coding blog I know, but I love martial arts too, especially competitive ones. I'm just putting together a CD for my car. The tunes on the CD music really make my adrenaline pump, so I am putting together a compilation of tunes which make me want to win a fight...with style! Nirvana – Smells like teen spirit. Fat boy slim – Right here right now. William Orbit – Adagio for strings (Ferry Corsten Remix with first 2 mins cut off). The Prodigy – Breathe. The Prodidy – Firestarter. Chemical Brothers – Block rockin' beat. Chemical Brothers – Setting Sun.

PayPal doesn’t do discounts

I can't believe it, I really can't! I'm writing a shopping cart for a website. One of the features required is to give the user an X amount discount off their next order when they buy a specific product. So let's say the user has a £20 discount on their next order, how does PayPal let me apply that? Simple answer, it doesn't! You can't send a cart line with a negative price "Discount for 20 GBP", nor can you send a cart line with a positive price but a negative quantity (that was desperation). The way to do this apparently is to send a cart total. YES! By sending the entire order aggregated into a single order line. NOOOOOOO!!!!!! So PayPal wants my user to order £100 of goods, click Check-out, and then be presented with "Total for your order £100 (£20 discount)", that's it? In my opinion, that's not very good. In fact, considering PayPal is probably the largest Internet payment organisation in the world I consider this to be