All Activity
This stream auto-updates
- Past hour
-
qiyulin joined the community
-
Hi, In my VCL application I send a request to server and receive a data that encrypted by php openssl_private_encrypt. Now I want to decrypt it with public key. How should I do that? Is there a third-party component to do that? what difference between using openssl library to decrypt data with public key and decrypting it using other library or pure RSA?
- Today
-
Circular references with API design
Darian Miller posted a topic in Algorithms, Data Structures and Class Design
In a codegen project I am working on, I am importing an API and creating the Delphi code to utilize it. I prefer working with records so most of the codegen is creating record types for the request/response objects exposed by the API. However, about 5% or less of this large API types involve circular references between types. I tried a few different approaches and couldn't come up with a decent solution with records so I starting to use forward declaration with classes, at least for this 5%. That seems to work, but now I think I need to make all the types classes instead of having a mixture. I ventured into Variants and even implemented my own custom type via TInvokeableVariantType to get some properties defined but generic variant custom record types don't work. It was a cool side trek but didn't solve this problem. After stewing on this for a while, I thought I'd ask for any feedback. Would you prefer a large API with 95% simple records and some occasional class-based request/responses due to a funky API design, or would you want to see it consistent throughout and only use classes? Or would you implement an alternative approach? TRecordA = record Field1:Integer; Field2:TRecordB; Field3:string; TopX:TRecordC; end; TRecordB = record Field4:Integer; Field5:TRecordA; end; TRecordC = record Items:TArray<TRecordA>; end; -
New mem manager test using indy http, json, memtables, etc
Remy Lebeau replied to RDP1974's topic in RTL and Delphi Object Pascal
You can't edit a post after some time has passed. And you can't delete a post, but you can flag a post and ask a moderator to delete it for you. -
What exactly have you tried that is not working for you? Please show some code. Which API are you using to enumerate running processes? CreateToolhelp32Snapshot(), EnumProcesses(), EnumWindows()? Have you tried APIs like GetModuleFileNameEx(), GetProcessImageFileName(), QueryFullProcessImageName()?
- Yesterday
-
You need a 64-bit obj file for that. Is this for a C++-Builder or a Delphi project?
-
I you are running the IDE on a monitor with scaling set to anything other than 100% it matters if you have enabled high DPI support for the form designer or not (the latter is equivalent to launching the IDE via the Delphi (DPI unware) shortcut the installer provides in the start menu group. You can find the relevant setting in the Tools -> Options dialog:
-
I am trying to create a list of applications that are running and visible, similar to Windows "Task Manager" in simple view. I have been successful except for applications that are running elevated. I am trying to get the "File Description" property and as long as I can get the file name and path I can get the description. Is there a way to get the file description directly or a way to get the name and path of an elevated application? I have been searching but everything I have come across so far does not work.
-
New mem manager test using indy http, json, memtables, etc
RDP1974 replied to RDP1974's topic in RTL and Delphi Object Pascal
I feel dumb, want edit first post, can't find how to want erase one post, seems impossible! 😕 -
Bug: Access violation when libcrypto-1_1.dll is missing and loSslInfo is set
w0wbagger replied to jaenicke's topic in ICS - Internet Component Suite
Thanks, Angus. Until I can get the new version working with C++ Builder (Been crushed at work and haven't had time to get at it), I have to use 8.x, where someone else might have this issue. Sorry, I should have mentioned that I had this issue with 8.x, not 9.x -
The form is rather small in the IDE making it hard to work with. Is there a way to adjust the size of the form in the IDE? Could I make it the same size as it is when the program is run? I am using version 11.2.
-
Double, default value
Brandon Staggs replied to Skrim's topic in Algorithms, Data Structures and Class Design
Yup, which is just one more reason why safety through automatic initialization is illusory. -
Double, default value
Stefan Glienke replied to Skrim's topic in Algorithms, Data Structures and Class Design
Which - fun fact - does not happen on the method call (unless it's a virtual method) but when accessing any member inside of it. You could still have some method which does not access any member and it will not AV at all. We can argue all day about this - any runtime behavior one might slap onto it will not save the language from being inherently unsafe. It needs to be built into the language/compiler itself (Hi, Rust) -
Thanks, it works ! (I had been looking for it for days).
-
With this: uses Androidapi.JNI.Os; LHasAccess := TJEnvironment.JavaClass.isExternalStorageManager; Note that this applies from Android 11 onwards only, so you should use TOSVersion.Check(11) to determine whether or not to manage that permission
-
I'm using Delphi 12.1 and have the option to give my App the option to "Access all files". To do this, I check "Manage external storage" under Uses Permissions. I will display the System Setup screen in which this permission data can be data.: uses Androidapi.JNI.GraphicsContentViewText, Androidapi.JNI.Net; var LIntent: JIntent, LUri: Jnet_Uri; Begin LUri := TJnet_Uri.JavaClass.fromParts(StringToJString('package'), TAndroidHelper.Context.getPackageName, nil); LIntent := TJIntent.JavaClass.init(TJSettings.JavaClass.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION, LUri); LIntent.addFlags(TJIntent.JavaClass.FLAG_ACTIVITY_NEW_TASK); TAndroidHelper.Context.startActivity(LIntent); end; But how can I ask whether this Permission has been given ? (sorry for my bad english)
-
Double, default value
dummzeuch replied to Skrim's topic in Algorithms, Data Structures and Class Design
But you can easily check for nil, while that's not possible for "uninitialized". And you can also easily spot them in the debugger. Also, referencing a non-initialized object reference does not necessarily result in an access violation, while referencing nil definitely does. -
As I mentioned in my first reply, you could use the code from TNotificationCenterAndroid.CreateNativeNotification as an example. Inside that is this: function GetDefaultIconID: Integer; begin Result := TAndroidHelper.GetResourceID('drawable/ic_notification'); if Result = 0 then Result := TAndroidHelper.Context.getApplicationInfo.icon; end;
-
Delete First & Last Character
Henry Olive replied to Henry Olive's topic in RTL and Delphi Object Pascal
Thank you so much Jon, Remy -
Hi the forum, Thanks Patrick for your help and your answer. So finally, I have proceed like that : In the Frame constructor i remove all the objects names of the Frame I memorized the "ComponentIndex" of the object of the Frame I'm interested to interact When I need to use it, I'm casting by the class and use the good index! For example: TLabel(Components[IndexMemorized]).Text := 'MyText'; I'm joining you my final solution package. Again thanks a lot to everybody for your help. TestD3.zip
- 17 replies
-
- fmx component
- onclick not firing
- (and 1 more)
-
Double, default value
JonRobertson replied to Skrim's topic in Algorithms, Data Structures and Class Design
That's an odd opinion, considering that a "pointer variable" or object reference with a nil value still results in an Access Violation if used before it is assigned a valid (allocated) memory reference. Using a local pointer variable before it is assigned a value is an error, regardless of whether the variable "defaulted to NIL". As Stefan stated, by not defaulting a value, the compile will give a warning (which I change to an error for every project). This code would not give a warning (silly example, but still): var MyForm: TForm := nil; MyForm.Show; -
Delete First & Last Character
Remy Lebeau replied to Henry Olive's topic in RTL and Delphi Object Pascal
The SysUtils unit in Delphi's RTL has AnsiDequotedStr() and AnsiExtractQuotedStr() functions for that exact purpose. -
python4delphi Add extra components without touch DelphiVCL
pyscripter replied to shineworld's topic in Python4Delphi
This is not correct. When P4D is used in an extension module it uses LoadDllInExtensionModule which just uses the dll loaded in the python process. It does not load or initialize the python dll. The calling process does that. So you can have more than one Delphi generated pyd files without issues. -
Delete First & Last Character
JonRobertson replied to Henry Olive's topic in RTL and Delphi Object Pascal
There is a lot of information and documentation available about string handling in Delphi. Here are two quick references: http://www.delphibasics.co.uk/ByFunction.php?Main=Strings https://www.thoughtco.com/string-handling-routines-delphi-programming-4092534 And here is a very basic solution to your request. Your actual purpose may be different from your description, but this code does what you asked: var str := '''abc'''; WriteLn(str); if str[1] = '''' then Delete(str, 1, 1); var last := Length(str); if str[last] = '''' then Delete(str, last, 1); WriteLn(str); ReadLn; -
Good Day Str := 'Abc' or could be Abc First, I want check if first char = ' then i want to delete it Second I want check if Last char = ' then i also want to delete it that is, if Str='Abc' then the result should be Abc if Str = Abc then i dont need to do anything Thank You
-
Thanks for the correction; I missed the "and ..." part.