Archive for the ‘library’ Category

Scripting Engine Unit Template

Thursday, April 10th, 2008

I must say, Delphi Live Templates and the Scripting Engines are REALLY amazing.  I wanted to make a new scripting engine, but then I got to thinking that my scripting engines had a lot of similar code, so I figured I would make a Live Template to create Scripting Engines.  I based it on Nick’s BaseScriptingEngine from his article on Creating a Live Templates Scripting Engine.

I then created a Template Project for the Scripting Engine Package.  So I can pop out a scripting engine now faster then you can say “Delphi Rocks”.

I thought I would share my Scripting Engine Unit Template.  You will probably want to make your own Scripting Engine Package Template Project, but if there is enough interest I will share mine out.  You will most likely want to modify this template to suite your own framework.

[Scripting Engine Unit Template]

Note: This references my general scripting engine to create a new GUID.  You will need to do that manually until I dress up my general scripting engine for public consumption.

BITS TLB and Headers

Tuesday, March 18th, 2008

If you want to program with Microsoft’s Background Intelligent Transfer Service (BITS) then you will need the TLB or header files. These can be generated from the IDL files that come with the Windows XP SP2 Platform SDK, or any of the subsequent platform SDKs, the latest being Windows SDK for Windows Server 2008 and .NET Framework 3.5. You will need MIDL to generate the needed files. It is rather a pain to download that whole SDK and then generate the useful files.To make your life easier I have generated the useful files, and also ran them through Delphi RAD Studio 2007 for Win32 to create Object Pascal wrappers for your Delphi programming pleasure. Then I wrapped it all up in a zip for easy downloading. Much quicker to download.

As a note, you do not need to deploy any of these files, or the files in the SDK with your application. You just need to ensure that the Background Transfer Service is running on the target machine.

For more information, I have created a hub page on Advanced Downloads with Delphi that I will update with more information as I gather it.

Enjoy!

[Download C, TBL, H, PAS archive]

Technorati Tags: , , , , ,

BITSAdmin

Friday, November 2nd, 2007

If you are doing much development with BITS, then I suggest you download the BITSAdmin tool.  It comes with Vista and the XP SP 2 Platform SDK, or you can download it in a smaller tools pack.  It gives you complete command line control over BITS, which is really cool.

You will also want to write a utility to clear your Queue of dead jobs that will get left behind as you are developing.  Trust me, you will need it.

MREWS and Threading in the Night

Monday, October 8th, 2007

So I wanted to look up what exactly MREWS is (I had a vague idea) and found this great resource: Multithreading – The Delphi Way by Martin Harvey version 1.1.

The introduction states:

This guide is intended for anyone who is interested in improving performance and responsiveness in their Delphi applications by using threads. It covers a range of topics from absolute beginner to intermediate level, and some of the real world examples raise issues bordering on the advanced. It assumes that the reader has a reasonable knowledge of Object Pascal programming, including simple object orientation, and a working understanding of event based programming.

A lot of really good information on threading there, and Chapter 11 even covers MREWS. Despite being last updated in 2000, I would say it is still a good reference.

It would appear that Martin Harvey originally published his paper elsewhere, but then the original site went down. Now it is mirrored on another server.

FTP Chunker

Sunday, March 18th, 2007

This is the FTP Chunker class and example I wrote for my Code Rage 2007 presentation.

It allows the retrieval of any part of a file via FTP. The FTP server must support the REST command, which most do.

Uses Indy 9 – Written and tested on Delphi 2007.

ftpChunk.zip

Programming with BITS in Delphi

Sunday, March 18th, 2007

BITS is Microsoft’s Background Intelligent Download Service. It was added in XP to allow downloading of security patches in the background. In the Platform SDK Microsoft provided a COM interface to allow developers to work with BITS. Unfortunately it is a bit of a pain to actually get to the interface, especially if you are not using Visual Studio. To make it easier for Delphi developers to work with BITS, I am providing my imported Type Library for the BackgroundCopyManager.

Alternatively you can use the JEDI Win32 API Library available on Sourceforge. It has the Bits interface (version 1.5) split into a few different files (JwaBits1_5.pas, JwaBits.pas, JwaBitscfg.pas, and JwaBitsMsg.pas [although they reference other included files]) and cleaned up a little bit. In addition it includes a number of other useful Delphi wrappers for Win32 API’s. I recommend this library over the raw TLB import. My demo will work with either one.

UPDATE: I recreated the demo and added it to the archive!

(more…)