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
56 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
0answers
84 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
108 views

Write to files in Delphi

I'm doing a program in Delphi, writing in all kinds of files, either text or executable: ...
1
vote
0answers
68 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 ...
2
votes
1answer
397 views

Function Split in Delphi

I have the following split function in Delphi works perfect the problem is I want to improve the code to not use repeat-until more but not that another way to do it. ...
1
vote
1answer
64 views

Alternatives to function in delphi

I've just finished this function and wanted to know if anyone know another way to do the same: ...
2
votes
0answers
169 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 ...
2
votes
0answers
52 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
631 views

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

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

Sync eye movements with external events

This solution was used to synchronize events between two applications: An eye tracking software, Python, and a stimulus control software, object Free Pascal/Delphi. It avoided a rewrite of the ...
3
votes
1answer
137 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: ...
0
votes
0answers
72 views

Is this a safe way to do my own embedded dialog and exception handler?

I'm developing a multi-platform app via Delphi XE7 with the Firemonkey framework. I wanted to eliminate the sloppy Windows exception modal window, so I created my own in-line modal prompt dialog. It's ...
3
votes
1answer
47 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
304 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
109 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
215 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 ...
5
votes
1answer
95 views

Factorial using trampolines

I've translated this Java code into Delphi code: ...
20
votes
1answer
323 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 ...
1
vote
0answers
58 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 ...
6
votes
1answer
154 views

Enhancing speed of looping cycle using Freepascal

I use Lazarus 1.2.4 and Freepascal 2.6.4. I have created a program that reads a disk in buffers of 64Kb (tried various buffer sizes) using a repeat...until loop. Each buffer is hashed using the SHA1 ...
6
votes
1answer
77 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
152 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
415 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
76 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
102 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
272 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
259 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
237 views

Am I getting the right information about installed SQL Server Instances?

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 ...
7
votes
1answer
1k views

Make it easier with color changing

How can I simplify this in Delphi? ...
4
votes
1answer
59 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 ...
2
votes
0answers
82 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
280 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
57 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 ...
0
votes
2answers
187 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
361 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
225 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
223 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
286 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 ...
3
votes
1answer
383 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): ...
1
vote
0answers
475 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. ...
3
votes
1answer
226 views

Just compare if is conversion correct

With the help of some users here, I finally terminated the conversion of this code from C: ...
5
votes
0answers
1k views

Fastest function for TCanvas.CopyRect

I want to scale some sub images from an original image. I need to use TCanvas.CopyRect function for about 5,000 times and it is very slow (from a simple BMP image). ...
1
vote
0answers
168 views

Internet Connectivty and Resolve host

This HostResolve procedure runs on a thread separately, to not interrupt other working functions. I would like to ask here if this procedure is correctly written or ...
3
votes
2answers
525 views

Defining a new Delphi Class with built-in Connection

Using Delphi XE2, I'm wondering if it would be usable to define a base object something like below. Class is prone to be used in multiple projects. I've chosen TSQLConnection as my starting point - ...
3
votes
2answers
2k views

Is Marshalling converters/reverters via polymorphism realistic?

I'm currently in the process of clearing out the final parts of this question here. Am I going about this the wrong way / could it be done smarter (interface perhaps) - or am I just plain silly, ...
2
votes
1answer
994 views

Parsing a page's source code for URLs

My code has to download the source code of a page and parse it for URLs. I want it to ask for number which is increased inside the critical section. My problem happens on thread termination. Main ...
2
votes
1answer
453 views

Asking for peer review of theses innosetup snippets

To fullfil a promise, I cooked the following script : ...
4
votes
5answers
712 views

Nested IF code in GUI Controls

I'm writing GUI controls and there are many places where there are many nested ifs checking for some result. ...