Re: [fpc-pascal] Microsoft SAPI on Freepascal

2023-06-26 Thread Rik van Kekem via fpc-pascal

Op 25-06-2023 om 22:46 schreef James Richters via fpc-pascal:
I gave up on doing it directly, it seems SO convoluted to do with FPC 
with the COM unit and all this stuff I just don’t understand,
and it’s SO simple to do with a VBS script in just 3 lines and it just 
works!(it would only be 2 lines if I didn’t want Microsoft Zira)

You didn't mention the version of FPC/Lazarus you were using.

I had a simple example which worked for me (but your example also 
directly worked for me in trunk).


program Project1;
{$mode objfpc}{$H+}
uses
  Classes, ComObj;
var
  Voice: olevariant;
begin
  Voice := CreateOLEObject('SAPI.SpVoice');
  Voice.Speak('I am speaking.', 0);
  Voice.Speak('I am also speaking.', 0);
end.

I didn't even have the problem with any EZeroDivide exception.

--
Grtz,
Rik van Kekem
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] IRC channel for FreePascal support ?

2023-04-13 Thread Rik van Kekem via fpc-pascal

Op 13-04-2023 om 12:53 schreef Jacob Kroon via fpc-pascal:


Thanks for checking, but well, I just got contacted by "Joanna" 
privately on IRC, this is the chatlog:


The following topic might be of interest. You can view it without 
registering.

https://forum.lazarus.freepascal.org/index.php/topic,61328.0.html

There are more people who have the same problem with that IRC channel(s) 
and with 'Joanna'.

Especially the strict rules that are enforced.
(your chatlog doesn't stand alone, there are also multiple topics on the 
forum about this, besides the link given above.)


BTW. That IRC channel is not an official FPC/Lazarus channel.
(I think 'Joanna' is the founder of the channel and sole moderator there.)

--
Grtz,
/Rik/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Where to download OpenSSL (for windows 64 bit) that is used by fphttpclient

2018-04-19 Thread Rik van Kekem

On 18-04-2018 18:57, Dennis wrote:
From the wiki, it went to https://wiki.openssl.org/index.php/Binaries 
for the binary dll but I tried the link https://indy.fulgan.com/SSL/  in 
the wiki and it did not work.

Why didn't the fulgan.com link work for you?? It should.
Note: You can also use http (i.e. http://indy.fulgan.com/SSL/) for the 
fulgan link (because otherwise you couldn't download it automatically 
with your program because you need OpenSSL to download via https ;)


Anyone with a successful experience can give me a direct url for the 
openssl dll?

Try to figure out why the fulgan-link doesn't work.

By the way, for those zip files I tried, although they are named 
xxx-win64, the dll contained in them are named ssleay32.dll and 
libeay32.dll.

Is that normal for a win64 bit dll to be named xxx32.dll?

Yes, this is normal.

It's the same with the fact that system32 in C:\Windows has 64 bit DLLs 
and SysWOW64 has the 32 bit DLLs on a 64 bit OS machine.


Some background about the naming:
https://www.sepago.com/blog/2008/04/20/windows-x64-all-the-same-yet-very-different-part-7-file-system-and-registry

Rik
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Seek with text file

2018-04-03 Thread Rik van Kekem

Op 03-04-2018 13:58 schreef James Richters:

Thank you for the advice and for the example. I don't know what is considered a 
large file.. these files can be maybe about 1000 lines long, most will be less, 
would this solution be suitable for files of this size?

Is Tstringlist something like an array of strings?


Yes, TStringList is a TList with strings.
Internally it's indeed an array of strings.

From the code-snippet from Anthony you can see it's really easy to use.

1000 lines of about average 70 characters per lines would be
72*1000=70MB. For current computers with memory in the GB this is not 
large at all. TStringList would also be fast to read individual files.


If you however would need to do this for say 2000 files in a row, it 
could become slow and you would need to code it differently to make it 
more efficient. But for just a few individual files this is the easiest 
method.


Rik
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Seek with text file

2018-04-03 Thread Rik van Kekem

Op 03-04-2018 13:04 schreef Anthony Walter:

If the file is not to big you could simply write:

procedure ChangeLastLine(const FileName, NewLine: string);
var
   S: TStrings;
begin
   S := TStringList.Create;
   try
     S.LoadFromFile(FileName);
     if S.Count > 0 then
       S[S.Count - 1] := NewLine
     else
       S.Add(NewLine);
   finally
     S.Free;
   end;
end;
Don't forget the S.SaveToFile(FileName) just above the finally-line 
otherwise nothing is saved back to the file :D


Rik

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Seek with text file

2018-04-03 Thread Rik van Kekem

Op 03-04-2018 12:03 schreef James Richters:

So then I tried
Var Myfile: file of String;
Mydata:String;

  Assign(myfile,'test.txt');
  Reset(myfile);
  Seek(myfile,FILESIZE(myfile)-1);
  Write(myfile,'New Line'+mydata);
  Close(myfile);


And what do you think FILESIZE(myfile) holds?
You would only strip the last character from the file with - 1.

Besides... file of String isn't a thing because String is a pointer to a 
area with characters and you can't have a file of string. You could do 
file of String[80] but in that case you don't have a normal text-file 
anymore.


How large are the files?
The easiest is to just load it into a TStringList and replace the last line.

If you have very very large files you would need to scan for the last 
line. You could do that from beginning to end but it would be better to 
do it from end to begin and stopping at the first CRLF. You could do 
that by opening it as stream of Text and stepping backwards in the file.


But a TStringList is really the easiest for small to medium text-files.

Rik
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Function list for pascal in notepad++?

2018-03-17 Thread Rik van Kekem

On 17/03/18 15:35, Bo Berglund wrote:

Does anyone here have a working functionlist.xml file for Notepad++?


There was an attempt done to include it in Notepad++.
But it's not perfect.

You can find it here:
https://github.com/notepad-plus-plus/notepad-plus-plus/pull/3663/files

Discussion is here:
https://github.com/notepad-plus-plus/notepad-plus-plus/pull/3663

Rik
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Linux getifaddrs

2018-03-01 Thread Rik van Kekem

Op 01-03-2018 00:08 schreef Michael Van Canneyt:

On Wed, 28 Feb 2018, Brian wrote:


Has anyone translated* getifaddrs* function to Free Pascal ?

http://man7.org/linux/man-pages/man3/getifaddrs.3.html


Not to my knowledge. It's not a kernel function, but a Libc function, 
as far as I can see ?

You might find some more information here:
http://forum.lazarus.freepascal.org/index.php/topic,30062.msg190832.html#msg190832

(please note the type for libc.co)

There is also a function in Synapse (ResolveNameToIP()) which could 
resolve the localhost to all local IPs.

(and I'm sure there is also something in Indy)

Rik

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] TStringHelper.Split() issue?

2016-03-08 Thread Rik van Kekem

Michael Van Canneyt wrote:


On FPC, it returns 1, on Delphi, it returns 2. And debuging the "splited"
variable, on FPC I get only and "x" value, Delphi "x" and "y".

Is this a bug?


Yes. Quite strange, because I have testcases for this ?


And content: string = 'x:yb'; does work correctly.

The problem is in this line (Line 1196 of syshelp.inc):
  if (LastSep