-
Content Count
290 -
Joined
-
Last visited
-
Days Won
3
Everything posted by KodeZwerg
-
Read-write protected, but read-only public property?
KodeZwerg replied to aehimself's topic in Algorithms, Data Structures and Class Design
Equal how you try, it end in a workaround since you publish it with a "write" property. -
Read-write protected, but read-only public property?
KodeZwerg replied to aehimself's topic in Algorithms, Data Structures and Class Design
that i mean, and within your class-code just adjust "_status" to whatever you like. or implement and publish a private setter to adjust only by code not by property if you know what i mean. TMyObject = Class(TObject) strict private _status: String; private procedure mysetter(const AValue: string); public Property Status: String Read _status; End; -
Read-write protected, but read-only public property?
KodeZwerg replied to aehimself's topic in Algorithms, Data Structures and Class Design
Why not dont publish "Read" "Write" at all and access internal the used Variable? -
Good quality Random number generator implementation
KodeZwerg replied to Tommi Prami's topic in Algorithms, Data Structures and Class Design
How about BCryptGenRandom from Windows Api? Is that random/quality enough for your needs @Tommi Prami ? -
@Geoff88: ShellExecute(Application.Handle, PChar('print'), PChar('A:\Path\to\a\file\to\print.pdf'), PChar(''), nil, SW_HIDE); you can let windows handle everything with that. this would open whatever programm is associated to print that file. //edit if you want full control, customized-printing-in-delphi, here you find everything you need.
-
good day, is someone willing to help me port those two c# snippets into working delphi (winapi/wininet) snippets please? the first one: var client = new HttpClient(); var request = new HttpRequestMessage { Method = HttpMethod.Post, RequestUri = new Uri("https://yandextranslatezakutynskyv1.p.rapidapi.com/translate"), Headers = { { "x-rapidapi-key", "1234567890" }, { "x-rapidapi-host", "YandexTranslatezakutynskyV1.p.rapidapi.com" }, }, Content = new FormUrlEncodedContent(new Dictionary<string, string> { { "apiKey", "1234567890" }, { "lang", "de-en" }, { "text", "dieser text soll übersetzt werden" }, }), }; using (var response = await client.SendAsync(request)) { response.EnsureSuccessStatusCode(); var body = await response.Content.ReadAsStringAsync(); Console.WriteLine(body); } and the second one: var client = new HttpClient(); var request = new HttpRequestMessage { Method = HttpMethod.Get, RequestUri = new Uri("https://systran-systran-platform-for-language-processing-v1.p.rapidapi.com/translation/text/translate?source=auto&target=en&input=dieser%20text%20soll%20%C3%BCbersetzt%20werden"), Headers = { { "x-rapidapi-key", "1234567890" }, { "x-rapidapi-host", "systran-systran-platform-for-language-processing-v1.p.rapidapi.com" }, }, }; using (var response = await client.SendAsync(request)) { response.EnsureSuccessStatusCode(); var body = await response.Content.ReadAsStringAsync(); Console.WriteLine(body); } thank you in advance!
-
can you help me port c# code to winapi/wininet please?
KodeZwerg replied to KodeZwerg's topic in Windows API
function Http_Get: string; const headerkey = 'x-rapidapi-key: 1234567890'; headerhost = 'x-rapidapi-host: systran-systran-platform-for-language-processing-v1.p.rapidapi.com'; var hInet: HINTERNET; hURL: HINTERNET; Buffer: array[0..1023] of AnsiChar; i, BufferLen: cardinal; begin result := ''; hInet := InternetOpen('', INTERNET_OPEN_TYPE_PRECONFIG, nil, nil, 0); try hURL := InternetOpenUrl(hInet, PChar('https://systran-systran-platform-for-language-processing-v1.p.rapidapi.com/translation/text/translate?source=auto&target=en&input=dieser%20text%20soll%20%C3%BCbersetzt%20werden'), PChar(headerkey + headerhost), 0, INTERNET_FLAG_SECURE, 0); try repeat InternetReadFile(hURL, @Buffer, SizeOf(Buffer), BufferLen); if BufferLen = SizeOf(Buffer) then result := result + AnsiString(Buffer) else if BufferLen > 0 then for i := 0 to BufferLen - 1 do result := result + Buffer[i]; until BufferLen = 0; finally InternetCloseHandle(hURL); end; finally InternetCloseHandle(hInet); end; end; this works, i get result = {"message":"You are not subscribed to this API."} now the code for post... thank you @mvanrijnen but i like to try with wininet. -
can you help me port c# code to winapi/wininet please?
KodeZwerg replied to KodeZwerg's topic in Windows API
function Http_Get(const Server: string; const Resource: string; const key: string): string; const headerkey = 'x-rapidapi-key: '; headerhost = 'x-rapidapi-host: systran-systran-platform-for-language-processing-v1.p.rapidapi.com'; var hInet: HINTERNET; hURL: HINTERNET; Buffer: array[0..1023] of AnsiChar; i, BufferLen: cardinal; begin result := ''; hInet := InternetOpen('', INTERNET_OPEN_TYPE_PRECONFIG, nil, nil, 0); try hURL := InternetOpenUrl(hInet, PChar('https://' + Server + Resource), {how to put header in here?}nil, 0, INTERNET_FLAG_SECURE , 0); try repeat InternetReadFile(hURL, @Buffer, SizeOf(Buffer), BufferLen); if BufferLen = SizeOf(Buffer) then result := result + AnsiString(Buffer) else if BufferLen > 0 then for i := 0 to BufferLen - 1 do result := result + Buffer[i]; until BufferLen = 0; finally InternetCloseHandle(hURL); end; finally InternetCloseHandle(hInet); end; end; i am somehow stuck... please need help -
Why not create one mail template and spread it out to those 10?
-
{$IF CompilerVersion >= 23} {$DEFINE NameSpace} {$ELSE CompilerVersion} {$UNDEF NameSpace} {$IFEND CompilerVersion} unit ppb1; interface uses {$IFDEF NameSpace} Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ComCtrls, Vcl.StdCtrls, Vcl.ExtCtrls, System.Threading, {$ELSE NameSpace} Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, ComCtrls, StdCtrls, ExtCtrls, {$ENDIF NameSpace} Thats a more generic approach for namespace handling.
-
{$IFDEF MSWindows} // code that run when windows is used {$ENDIF MSWindows} i really thought that was your question, find out other methods.
-
for windows i would use winapi, like that oneliner: Result := URLMon.URLDownloadToFile(nil, PChar('http://www.somewhere.com/something.gif'), PChar('a:\local\file.ext'), 0, nil) = 0;
-
How to Convert curl command line to Delphi code using IndyHttp or THttpClient.
KodeZwerg replied to amit's topic in Network, Cloud and Web
Very possible that you run into a version conflict. Check used Delphi Indy version and use for that proper libraries. //tip To find out the location of the "good" library (on your development pc), download a tool like ProcessHacker, run your application, let it load libraries, open ProcessHacker, doubleclick on your process, switch to "Modules" tab, either move mouse over library or doubleclick library, both result in telling you location. -
My way.
-
1. Hire a freelancer that teach 2. udemy has good learning courses, not free but worth the invest. (a free solution can be youtube, with proper search input you get okay output) Mix of both should be best practice.
-
Parse PIDL from Name located on portable device
KodeZwerg replied to 0x8000FFFF's topic in Windows API
strange activity you are performing. for myself havent tried it direct like you. if you like, you can try my FileShell tool on your device, it is basical a PIDL walker. -
if milliseconds are precice enough, two calls to Now and subratract like ms := MillisecondOfTheDay(SecondNow) - MillisecondOfTheDay(FirstNow); can do it?
-
Great program, mighty helper, cool creator, easy handling. Very nice!
- 3 replies
-
- resource compiler
- resource editor
-
(and 1 more)
Tagged with:
-
Proxy = No. Browser = Opera has internal VPN turned on. External (Windows) VPN turned off. Turning Opera internal VPN to off state will redirect to @david_navigator site, @Uwe Raabe is a genius, in no way I would have thought about that. Excuse me please, my intention was just to help.
-
This is what my Browser show by opening the link i posted. //edit Without being registered to that site sir.
-
You are welcome! (If this way is legal = I do not know, I am sorry!)
-
Excuse me Sir, I do not understand meaning of empty reply. If my tip aint good I feel sorry and will more think about it.
-
Licensing
-
Could you at least tell what solution was working well for you to enlighten others by reading your topic?
-
var MyMsg: TForm; begin MyMsg := CreateMessageDialog('put Message in here...', mtCustom, [mbOK]); MyMsg.Position := poOwnerFormCenter; MyMsg.ShowModal; end; Easiest solution this might be?