Posts

Showing posts from May, 2010

Top Secret Code Snippets Test Code

For about three months now I've had some code that tests and exercises some of the snippets in the Code Snippets Database . But, if you don't get the Code Snippets newsletter, you won't know about it because I forgot to tell anyone else! Anyhow, the code is stored in my Delphi Doodlings Subversion repository on Assembla in the CodeSnippets sub-directory of the trunk. There are currently three test projects: TestDriveCat.dpr in the Src/Cat-Drive sub-directory. This is a demo program that exercises all the routines in the Code Snippets database's Drive Management category. This project was updated today to bring up to date with a new addition to the category. TestHexCat.dpr in the Src/Cat-Hex sub-directory This is a set of DUnit tests for all the routines in the Hex Utilities category. TestWinSysCat.dpr in the Src/Cat-WynSys sub-directory. This new demo program was added today and exercises all the routines in the Windows System category. I'm only u...

Decoding Base 64 encoded data

A while ago someone asked me how to go about decoding Base 64 encoded code in a single routine. Here's what I came up with. It uses the Indy internet component suite to do the grunt work and simply wraps the various Indy calls into a function. uses Classes , IdCoderMIME .. . function Base64Decode ( const EncodedText : string ) : TBytes ; var DecodedStm : TBytesStream ; Decoder : TIdDecoderMIME ; begin Decoder := TIdDecoderMIME . Create ( nil ) ; try DecodedStm := TBytesStream . Create ; try Decoder . DecodeBegin ( DecodedStm ) ; Decoder . Decode ( EncodedText ) ; Decoder . DecodeEnd ; Result := DecodedStm . Bytes ; finally DecodedStm . Free ; end ; finally Decoder . Free ; end ; end ; This function decodes the encoded text passed in EncodedText , which must contain only valid Base 64 encoding characters, and returns the resulting raw data as an array of bytes. We use I...

Delphi Tips Editor Virus???

There have been a few reports of a possible virus in the third party Delphi Tips Editor published on DelphiDabbler.com . Just to let everyone know that this is likely (but not guaranteed) to have been a false positive due to the exe compressor used by the author. However, to be on the safe side the offending code has been replaced by a recompiled version that passes all the tests at http://www.virustotal.com/ . If you're using the program please make sure you download the latest version here .