Delphi is a language for rapid development of native Windows, OS X and iOS applications through use of Object Oriented Pascal. The name also refers to the Delphi IDE, which is used to help edit and debug Delphi projects more efficiently.

learn more… | top users | synonyms

1
vote
0answers
16 views

Password Entropy in Lazarus (Delphi-like)

My today's goal was to create a function, which would evaluate the entropy of a given string password. It's mostly about how random the password is. This little code is based on the C# code from Jeff ...
2
votes
0answers
84 views

LockBox TwoFish string encryption and decryption

I'm using TurboPower LockBox for the first time, and using the TwoFish algorithm to first encrypt a password, and later retrieve the password by decrypting the generated hash. I would like to know ...
1
vote
2answers
79 views

Delphi 2009 interface

I have this code and at the end of it, FastMM shows that there were memory leaks with all the objects of TSinc: ...
1
vote
0answers
56 views

Calculate and make a database of prime numbers

I recently created a program for finding a prime number. It's working great and doing it very fast but I was wondering if you can help me make it calculate the prime numbers faster. ...
5
votes
0answers
65 views

Precise timings with low jitter via RDTSC (for x86 and x64)

The Win32 API has a so-called 'high performance counter' (QueryPerformanceCounter() and friends) but often it is neither precise enough nor reliable enough, due to ...
8
votes
0answers
149 views

Delphi XE 7 project template for saving / loading form settings

I have developed small test project as a template for production project. In this template I've found a way that the application saves and loads its own settings (ini-file). Main Form1 will contain ...
4
votes
1answer
82 views

Parsing a command line

I've written an object which allows parsing and serializing a command line. I don't in any way consider this done, but this is the beginning of it. I know there are other implementations out there ...
3
votes
0answers
64 views

Delphi: convenience wrapper for GetSystemTimePreciseAsFileTime()

For some purposes it can be highly desirable to use GetSystemTimePreciseAsFileTime() whenever it is available (i.e. Windows 8+) because the accuracy of ...
2
votes
0answers
29 views

Write data with updateresources

I have developed this function but I'm not sure if this is the best (secure) way to write in resources without corrupt *.exe in case of fails. What is the best way to write resources to a *.exe file? ...
3
votes
1answer
64 views

Binary and linear search methods for a number-guessing game

This is a code written is Pascal (Delphi). It asks the user to think of a number between min_ and max_ and then guesses the ...
2
votes
1answer
84 views

Buttons switches in Delphi

I have an action on four buttons. I need to make a down (checked) button if it's pressed and other buttons up (unchecked). My button is TToolButton and the property ...
2
votes
0answers
210 views

Validating Card Number in Delphi

As part of processing card payments, before even attempting to process, I need to check and validate the card number to make sure it's valid. For this, I've encapsulated this validation in a record ...
4
votes
1answer
100 views

Passing variable pointer as string to another function

With Delphi 7 I need to create a TStream variable and use/free it in another part of the code. Unfortunately it cannot be passed as "normal" parameter. I created a ...
1
vote
0answers
134 views

Porting Delphi typed arrays to .NET generics

Currently I am porting piece of code from some old Delphi API to C# and smashed into weirdness of type definitions. As its schema fits perfectly with DLL it uses (because it also was made in Delphi ...
5
votes
1answer
215 views

Translating array pointer access from C++ to Delphi

I'd like to know if I translated a piece of code correctly from C++ to Delphi. It looks like it is working, but I have a feeling that I'm reading and writing into memory that I'm not supposed to using ...
2
votes
2answers
460 views

Write to files in Delphi

I'm doing a program in Delphi, writing in all kinds of files, either text or executable: ...
2
votes
0answers
137 views

Class derived from TXmlIniFile to save/read to/from XML

I have created this unit containing a class derived from TXmlIniFile. This class uses the common TCustomInifile methods to write to and read from an XML file. It comes from an idea of Chris Rolliston ...
3
votes
1answer
3k views

Function to split text

The following pascal function (compiled with Delphi) will split strings. It works perfectly, but how to improve the code? For example, to avoid using the repeat-until loop. ...
3
votes
1answer
164 views

Function to find text between two tags

I've just finished this function and wanted to know if anyone know another way to do the same: ...
2
votes
0answers
343 views

Get local Dropbox path with Delphi XE7

I've put together a function in Delphi XE7 which returns the Dropbox directory path on my machine, as this path can be customized by the user. This function currently works on my computer, but it ...
3
votes
0answers
80 views

Single level of abstraction

I am reading the "Clean Code" book and trying refactoring my source code according to the principles "single level of abstraction"/"separation of concerns". How would you refactor the following code? ...
3
votes
1answer
2k views

Converting Delphi colors between TColor, RGB, CMYK, and HSV

I wrote a record which encapsulates conversion of colors between TColor, RGB values, CMYK ...
4
votes
1answer
185 views

Efficient binary patcher

I am currently working on a little binary patcher. My current code works fine but I do want my code to be optimized (fast) and as clean as possible. Could you all please help me review this? IDE: ...
3
votes
1answer
54 views

Validating user's input before creating graph using TChart

The user enters coefficients into input boxes on a form, called GetFunction. Upon clicking an OK button on said form, the input is validated using ...
2
votes
0answers
909 views

What's the best approach to achieve two-way communication with TIdTCPServer and TIdTCPClient?

I'm a newbie in Delphi and I'm trying to create a client/server application using INDY. I want to have a server that is capable not only of receiving messages and streaming, but also sending data to ...
6
votes
2answers
224 views

Is this an appropriate approach to “tweak” a color to a similar lighter/darker color?

I have written this function for the sole purpose to get a similar color either brighter or darker than any given color, depending on an average lightness/darkness. Essentially, I add up the R/G/B ...
4
votes
1answer
354 views

Stack-based mini-stack

I've created a MiniStack to assist in removing recursion from routines using a manual stack. Obviously if the stack is an object it lives on the heap and its ...
6
votes
1answer
141 views

Factorial using trampolines

I've translated this Java code into Delphi code: ...
20
votes
1answer
677 views

Executing large SQL script file with GO statements using ADO

I wrote a small component (still in the works but working) which takes a large SQL script file, splits it into different "blocks" based on GO statements, and executes them one by one. The only major ...
0
votes
0answers
64 views

Is this interface structure/setup correct?

I'm working on wrapping the last.fm web API. I'm trying to use Interfaces to be able to easily make calls via functions which return an interface (as opposed to an object which would need to be ...
7
votes
1answer
114 views

Drawing and Painting a Menu Component

I have produced a working menu component for a project I'm working on, but would like to reduce the amount of code used and improve the methods - especially in the Paint implementation - still ...
4
votes
0answers
288 views

Anonymous Events in Delphi

I wrote a anonymous event creator. I would like to ask if anyone can tell me if I did it the "right" or "best" way, or how I could make it better. Here is what I did: Declaration: ...
1
vote
1answer
834 views

Drill through and down the object properties with RTTI

I am in process of making debugging output better for client-side application. We have lots of auto-generated Protocol Buffers classes which are used for communication by our protocol. I am trying to ...
2
votes
0answers
80 views

Optimizing a thread library

Please give thoughts and optimization tips on my thread library. Update 1 : I have renamed the different method types. ...
6
votes
1answer
127 views

Handling packets and peers in a reliable UDP library

I am refining my reliable UDP library, its at its 3rd iteration now. It is quiet a bit multi-threaded with almost all major operations having dedicated threads. I need your opinion on the following ...
6
votes
3answers
524 views

Produce an array of strings from a single string

I have a function that reads a string like this (AnimalCount+HumanCount) and the result of this function is an array of strings ...
7
votes
1answer
353 views

Sleeping in Delphi

I am programming a rotator using Delphi, with two different angles: azimuth and elevation. Up to now I am testing, so I tried to move the rotator 1 by 1 degree in azimuth and elevation. The rotator ...
2
votes
0answers
395 views

Installer package using Inno Setup

I'm building an installer package for our software using Inno Setup. As a part of this, I'm also building a few different DLL's in Delphi XE2 to accommodate for some of the common tasks required by ...
10
votes
1answer
3k views

Make it easier with color changing

How can I simplify this in Delphi? ...
4
votes
1answer
64 views

Locating empty field groups for saving data

The aim of the code below is to see if selected fields are empty so data can be saved in that field. Since I'm making a library system, I wanted to record the basic info on one record (all the books ...
3
votes
0answers
101 views

TStickyLabel control anyone?

I was inspired with this question How I can detect when other control changes it bounds? and @Remy Lebeau's answer and decided to write my own control (based on ideas from ...
1
vote
1answer
366 views

Is it feasible to create a syslog server which writes to a client dataset?

I'm creating a simple syslog server in Delphi XE2 using Indy's TIdSyslogServer. I've decided to make it dump into a ...
2
votes
1answer
60 views

Optimizing an IP generation method

I have designed a proxy server which has the feature to manage miniature separate networks. Each network has space to have up to 500 nodes or 500 IPs. The code for getting a new virtual IP is based on ...
1
vote
2answers
292 views

Thoughts on my byte array library

Here is a small library which manages writing into and reading out a byte array. It uses TValue arrays to get and put data, its my first time using them. Its crudely written, and poorly optimized but ...
2
votes
2answers
788 views

Is this the right way to thread-protect an object?

I wrote an FAQ on a third-party website which pertains to thread-protecting objects in Delphi. What I'd like to know is if this thread-protection approach is accurate, or if I should change anything ...
0
votes
1answer
434 views

Is this legitimate for building a JSON file?

I have written a unit / component in Delphi which helps make it easy to write JSON data. I know there are already existing ways to do this, but the ways I've used are too awkward. I have used an XML ...
2
votes
2answers
226 views

Improve randomization function (from 1 to 2)

I am trying to do a randomize function. It randomly selects one person (from two) to insert something into the console. The second person goes next, and then they keep alternating until the loop ...
1
vote
0answers
375 views

Suggestions for Improvement, handling MouseEnter / MouseLeave Events for dynamically created objects.

Test version of my code for handling individual mouseenter / mouseleave events for objects created dynamically. The code emulates a seating cart for a bus, as you mouse over the objects it will ...
5
votes
1answer
525 views

Fastest fill memory with specified 64-bit value

I need to fast fill some memory block in C#, so I wrote something like this (in Ffree Pascal COmpiler + Lazarus in 64 bit mode): ...
2
votes
0answers
565 views

Performance Tuning Base64 encoding

I've been trying to get a relatively optimized version of base64 encoding that works against files. However, I've made several attempts and haven't gotten anything much faster than what I have here. ...