

Skrim
-
Content Count
58 -
Joined
-
Last visited
-
Days Won
1
Posts posted by Skrim
-
-
What do you mean by "Send"?
1) Producing the XML file and then send
or
2) Just distribute an XML file to the Access point?
-
I have just subscribed to an AI service.
I already have working code for a REST service. Tested with code fram AI and OMG it looked impressive.
My question was "How can I connect to REST service xxxx using Delphi 12.2?" AI gave me three times the amount of code I already use and the AI code does not work, even after several corrections.
Non programmers making programs using AI, I think not :)
-
1
-
-
I have never made my own classes before and I have just started to learn.
There is one field FName in the class below. What if I have 50 different Fxxxxx? Do I have to write Setter and Getter for every field?
Can I declare a record inside the class?
Type
TEmployee = class
private
FName : string;
//FSalary : Currency;
Function GetName : string;
Procedure SetName(Const Value : string);
public
Property Name : string read GetName write SetName;
end;implementation
{$R *.dfm}
Function TEmployee.GetName: string;
begin
Result:=FName;
end;Procedure TEmployee.SetName(const Value: string);
begin
if value='' then
raise Exception.Create('Name must have a value');
FName:=value;
end;-
1
-
-
var
aNumber : Double;
begin
aNumber:=0;
aNumber:=strtofloat(grid.Cells[3,arow]);...
...
Are floatvalues automatically initialized as 0 (zero)?
Is the first code line unnecessary?
If I understand the Help file correctly, global variables are and local variables are not?
-
1 minute ago, DelphiUdIT said:If you have thirdy parts component installed try to delete them.
If this don't help, you can try to do a clean install.
After you have disinstalled RAD STUDIO !!!, do those steps:
1) Delete the Windows registry (and all subfolders of course):
- HKEY_CURRENT_USER\Software\Embarcadero
- HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Embarcadero
2) Delete the folders (and subfolders) of your disk (YOURACCOUNTNAME is the name of your account):
- C:\Program Files (x86)\Embarcadero
- C:\Users\YOURACCOUNTNAME\AppData\LocalEmbarcadero
- C:\Users\YOURACCOUNTNAME\AppData\Roaming\Embarcadero
- C:\Users\Public\Documents\Embarcadero\Studio\23.0\Bpl
- C:\Users\Public\Documents\Embarcadero\Studio\23.0\Dcp
- C:\ProgramData\Embarcadero
Take care about you are doing.
Thanks, great advice
Kind regards
-
I have decided to do a complete clean reinstall.
No wonder things fail from time to time, 2068 Registry keys were leftover from the uninstall
-
-
try
aDialog:=TMyDialog.Create(self);
......
finally
aDialog.Free;
end;I keep getting warnings about a dialog created inside a Try/Finally, why is it bad practise?
-
1 hour ago, corneliusdavid said:If you hit F1 on the warning, you'll get the following explanation:
LOL, I have been using Delphi since version 2 and I did not know that
I always declare string as aString : string; never aString : string[3]; But a lot of these string values are saved to a database field declared in the database as a string with a fixed length, could that be the reason for the error?
Kind regards
-
See the topic, what does this warning mean? Does it matter? If no, can I turn it off?
I declare a string variable like this S : string;
-
On 3/17/2024 at 5:31 PM, Remy Lebeau said:Depends on the context. The compiler thinks you are using J's value before you have actually assigned any value to J. Sometimes the compile makes a mistake on this, sometimes not, so it may or may not be a false positive. How are you actually using J exactly? Can you show that code?
Here is my code, also could it be done easier/more elegant
// String 000001203 to 1203
// Numbers of zeros to the left could be 1..n
function RemoveZeroLeft(var s : String) : string;
var
i, j : integer;
beginfor i:=1 to length(s)do
begin
if s<>#48 then
begin
j:=i;
break;
end;
end;result:=copy(s,j,length(s));
end;
-
I get this warning, what does it mean?
[dcc32 Warning] HovedUnit.pas(13295): W1036 Variable 'j' might not have been initialized
J is an integer.
Do I have to do, J:=0;
-
D12
When I doubleclick in Event OnGetEditText to make an event handler in a stringgrid I get this error.
"Property and method MyGridOnGetEditText are not compatible."
The event is empty. It had some code earlier, but that is deleted together with its declaration.
From Delphi Help file
"You are assigning a method to an event property even though they have incompatible parameter lists. Parameter lists are incompatible if the number of types of parameters are not identical. For a list of compatible methods in this form, see the dropdown list on the Object Inspector Events page."
Any ideas how to solve this? -
4 minutes ago, Uwe Raabe said:Many people think that patience is a sign of weakness.
I think this is a mistake. It is anger that is a sign of
weakness, whereas patience is a sign of strength(Dalai Lama)
Nice
I'll quote that one next time I cannot deliver on time and I'm facing fines (Usd 100 per. customer per day) for not delivering by the deadline.
-
7
-
-
11 minutes ago, Uwe Raabe said:Ehm, no!
Why then isn't GetIt up and running?
For a company within the IT industry it should be simple enough, right?
In my industry (finance) we are required to have plans for downtime situations to minimize the damage. Doesn't Embarcadero have plans for such cases? Or is the philosophy, let's just wait and see what happens should something arise-
2
-
-
I think I know what is going on.
Embarcadero have abanonned GetIt?
-
Hi
How can I send an email with attachement from my Delphi Win32 app via Thunderbird?
I can sendt directly from my app using Indy and via Outlook, but would like Thunderbird too.
Links or sample code?
Kind Regards
-
Thanks Remy, appreciate your answer. I will try it out.
Regards,
Ole
-
Solved.
On those pc's giving an error both libeay32.dll and ssleay32.dll were missing.
Would be nice with a message "Cannot find file xxxx.dll", not just -1 🙂
-
2 hours ago, Remy Lebeau said:What exactly is reporting that error? Can you provide the exact and complete error message? And what does your code look like?
The error code is just -1. Nothing more, not very helpful
From Windows?
-
Several clients connect to one remote server/service.
Some clients receive error, most works just fine. Clients are on several dfferent locations. Could it be the clients firewall is blocking sending?
Here is some of my code.
procedure TFormSend.HttpFinish(ASender: TObject);
begin
LogMemo.Lines.Add(Format('Finished. Http status code : %d',[(ASender as TxxxxxUpload).ResponseCode]));
if (ASender as TxxxxxUpload).ResponseCode=201 then
showmessage('Invoice delivered')
else
showmessage('Error : Invoice could not be delivered');
end;procedure TMyClient.SendFile;
var
tmpstream: TStringStream;
Params: TIdMultipartFormDataStream;
FIdSSLIOHandler: TIdSSLIOHandlerSocketOpenSSL;
FidHttp: TIdHTTP;
FIdURI: TIdURI;
FURL: string;
beginHttpStart(Self);
FResponseCode := 600;
if DoCheckParams then
begin
Params := TIdMultipartFormDataStream.Create;
FidHttp := TIdHTTP.Create(nil);
FIdSSLIOHandler := TIdSSLIOHandlerSocketOpenSSL.Create(nil);
FIdURI := TIdURI.Create(FEndPoint);
tmpstream := TStringStream.Create(Trim(FDocumentID));
try
with FidHttp do
begin
ReadTimeout := 30000; // 0
ConnectTimeout := 30000;
HTTPOptions := [hoKeepOrigProtocol];
// hoKeepOrigProtocol,hoForceEncodeParams
HandleRedirects := true;
RedirectMaximum := 5;
ProtocolVersion := pv1_1;
AllowCookies := true;
OnWork := WorkEvent;
OnWorkBegin := WorkBegin;
OnWorkEnd := WorkEnd;
OnStatus := StatusEvent;
with Request do
begin
UserAgent := FUserAgent;
BasicAuthentication := true;
RawHeaders.FoldLines := false;
Accept := 'application/xml';
Connection := 'keep-alive';
end;
end;
with (FIdSSLIOHandler as TIdSSLIOHandlerSocketOpenSSL) do
begin
with SSLOptions do
begin
Method := sslvTLSv1;
SSLVersions := [sslvTLSv1];
Mode := sslmUnassigned;
VerifyMode := [];
VerifyDepth := 2;
end;
port := 443;
host := FIdURI.host;
end;
FidHttp.IOHandler := FIdSSLIOHandler;
Params.AddFile('file', FXMLfile, 'application/xml');
Params.AddFormField('SenderID', FSenderID);
Params.AddFormField('RecipientID', FRecipientID);
Params.AddFormField('ChannelID', FChannelID);
Params.AddFormField('ProcessID', FProcessID);
Params.AddFormField('DocumentID', '', '', tmpstream).ContentTransfer := '8bit';
FIdURI.Username := FUser;
FIdURI.Password := FPassword;
FURL := FIdURI.GetFullURI();
Params.Seek(0, soFromBeginning);
try
FidHttp.Post(FURL, Params, FResponse);
FResponseCode := FidHttp.ResponseCode;
FResponse.Seek(0, soFromBeginning);
except
on E1: EIdHTTPProtocolException do
begin
FResponseCode := FidHttp.ResponseCode;
ErrorEvent(Self,'IdHTTPProtocol Protocol Exception:' + #$D#$A + StringReplace(E1.ErrorMessage, #10, #$D#$A, [rfReplaceAll]));
ErrorEvent(Self,'IdHTTPProtocol RawHeaders=' + #$D#$A + FidHttp.Request.RawHeaders.Text);
end;
on E2: Exception dobegin
FResponseCode := FidHttp.ResponseCode;
ErrorEvent(Self,'IdHTTPProtocol Unknown Exception: ' + E2.Message);
end;
end;
finally
Params.Free;
FIdSSLIOHandler.Free;
FidHttp.Free;
FIdURI.Free;
tmpstream.Free;
end;
end
else ErrorEvent(Self,'Some required params are missed');
HttpFinish(Self);end;
-
I upload Xml files to a remote service using Indy.
Most of the time it's working just fine, but sometimes there is an error returning error code -1.
(Unknown error?)
When I say "not working" the file connection/transfer is not accepted by the remote service.
It's just on a few pc's it's not working, could it be those pc's are missing required files (dll)?
Using OpenSSL/Indy, what files do I have to distrbute in my Win32 application?
uses
SysUtils,
IdIOHandler,
IdIOHandlerSocket,
IdSSLOpenSSLHeaders,
idHTTP,
IdContext,
IdLogBase,
IdLogFile,
IdSSLOpenSSL,
IdHTTPHeaderInfo,
IdMultipartFormData,
IdURI; -
Time to sum up this thread
- The enduser is not the most important part
- Most important, the "computer guy" Zero deployment, no local installation etc.
- Most developers are not capable of reviewing a program from the enduser's perspective
-
well, the web app is stateless... then each requirement is the only one... no exists "before"... exists "now" and only this.
for sure, it's not appreciated but is this...
Exactley why I "hate" to do work using a browser. I wold estimate my workload has increased by 30% over the last two or three years because of "The world is moving to the web".
Even worse, a lot of software companies no longer offer support by phone, you have to talk to a robot or fill in a contact form, lucky you if you get an answer in only 1-2 days
I'm so glad my main program is developed in Delphi by myself 🙂
EHF Invoice Norway
in General Help
Posted
You should not/cannot send an Ehf invoice directly to the customer, it must be directed via an approved accesspoint. So the first thing I would do is to choose this.
Also, read the documentation for the ehf invoice standard carefully. Take care to get the latest version EHF 3, there is old no longer valid information out there.
An Ehf invoice might be technically valid, but you need to validate the contence as well. A tiny litle "glitch" and the invoice will not be forwarded and some accesspoints will charge you for the missing/not valid contence.
So there is a lot of work to be done