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.
6
votes
2answers
49 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
[ "(" , "AnimalCount" , "+" , "HumanCount" , ")" ]
Now, I have ...
7
votes
1answer
66 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
41 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
46 views
Make it easier with color changing
How can I simplify this in Delphi?
Procedure colori1
Begin
if Temperatura<=15 then
begin
Form1.Label1.Font.Color:=clBlue;
Form1.Label2.Font.Color:=clBlue;
Form1.Label3.Font.Color:=clBlue;
...
-1
votes
1answer
79 views
Which code looks better? [closed]
I've got a question on what code style is better.
There are two arrays containing some codes. One array consists of string elements, the other consists of integer elements. The corresponding values ...
4
votes
1answer
52 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
35 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 ExtCtrls.TLabeledEdit).
Now ...
1
vote
1answer
69 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 TClientDataSet and display in a TDBGrid, but I'm skeptical about how well it would ...
2
votes
1answer
48 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
82 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
122 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
73 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
218 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
2answers
767 views
How to rewrite winning algorithm in Connect 4 game to be more effective? [closed]
Question is about how to rewrite this code:
bool CheckIfWinner()
{
std::size_t rowLength = 0, columnLength = 0, leftDiagonalLength = 0, rightDiagonalLength = 0;
for(std::size_t column = 0; ...
1
vote
0answers
125 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 ...
2
votes
1answer
180 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):
// ECX = Ptr64
// EDX = Count
// R8 = Value
PROCEDURE Fill64 (VAR ...
1
vote
0answers
314 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
199 views
Just compare if is conversion correct
With the help of some users here, I finally terminated the conversion of this code from C:
#include <windows.h>
#include <stdio.h>
#define IS_IN_SEARCH(mb, offset) ...
5
votes
0answers
725 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).
Do you know any other method ...
1
vote
0answers
104 views
Internet Connectivty and Resolve host
Well this HostResolve procedure runs on thread separately to not interrupt other working functions. i would like to ask here if this procedure correctly written or not any recommendation and ...
3
votes
2answers
295 views
Defining a new Delphi Class with built-in Connection. Is TSQLConnection a usable option?
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
588 views
Is Marshalling converters/reverters via polymorphism realistic?
First off - this is a TOTAL COPY from stackoverflow - where I was adviced to try this forum :-) so here goes:
Well now I'm almost at the end of my journey - expanding my base units :-)
I'm currently ...
2
votes
1answer
754 views
Please help me fix my Delphi 7 code [Threading issues]
My code has to do download source code of page and parse it for URLs.
I want it to ask for number which is increased inside the critical section.
So my problem happens on thread termination.
Main ...
2
votes
1answer
312 views
Asking for peer review of theses innosetup snippets
To fullfil a promise, I cooked the following script :
[Code]
var
BDS: string; // No trailing backslash path
BDSCOMMONDIR: string; // No trailing backslash path
BDSPROJECTSDIR: string; // No ...
10
votes
3answers
897 views
Fastest Parameter Passing in delphi 7?
I have a function that accepts a big amount of data as a parameter (sometimes 1 megabyte) I was thinking which would be the fastest way to pass that data, dunno if I got this right, but here is what I ...
4
votes
5answers
558 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. Example goes:
function TMyObject.GetCursor: TCursor;
begin
if CanDragX then
begin
...