

ChrisChuah
Members-
Content Count
115 -
Joined
-
Last visited
Community Reputation
0 NeutralRecent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
-
How to call functions with Interface name?
ChrisChuah replied to ChrisChuah's topic in RTL and Delphi Object Pascal
Hi Remy Thank you for your guidance. -
How to call functions with Interface name?
ChrisChuah replied to ChrisChuah's topic in RTL and Delphi Object Pascal
Hi Remy I think i got it. I need to create an instance of the TThriftHashSetImpl but the variable is an Interface itself var hashset : IThriftHashSet<TProduct_info_type>; product_info : IProduct_info; begin hashset := TThriftHashSetImpl<TProduct_info_type>.create; hashset.add(TProduct_Info_type.terminal_packaged_part_number); hashset.add(TProduct_info_type.terminal_packaged_serial_number); product_info := product_get_info(hashset); end; Another question: How can i free or release these instances that i have created? Wont there be any memory leak? regards chris -
How to call functions with Interface name?
ChrisChuah replied to ChrisChuah's topic in RTL and Delphi Object Pascal
Hi Remy the function function product_get_info(const info_type: IThriftHashSet<TProduct_info_type>): IProduct_info; requires a parameter which is an Interface of IThriftHashSet<TProduct_info_type> TProduct_info_type = ( terminal_packaged_part_number = 0, terminal_packaged_serial_number = 1, terminal_packaged_comm_name = 2, sensor_packaged_part_number = 3, sensor_packaged_serial_number = 4, specific_part_number = 5, license_identifier = 6, license_name = 7, mac_address_ethernet = 8, mac_address_wifi = 9, mac_address_3g_modem = 10, RFID_board_type = 11, terminal_cie_part_number = 12, travel_totem_serial_number = 13, travel_totem_product_number = 14 ); and this IThriftHashSet has a class like this ======== Start ======= IThriftHashSet<T> = interface(IThriftContainer) ['{733E2B57-C374-4359-BBD5-2B9CD8DF737C}'] function GetEnumerator: TEnumerator<T>; function GetCount: Integer; property Count: Integer read GetCount; function Add( const item: T) : Boolean; procedure Clear; function Contains( const item: T): Boolean; function Remove( const item: T): Boolean; end; // compatibility IHashSet<T> = interface( IThriftHashSet<T>) ['{C3CF557F-21D9-4524-B899-D3145B0389BB}'] end deprecated 'use IThriftHashSet<T>'; {$WARN SYMBOL_DEPRECATED OFF} TThriftHashSetImpl<T> = class( TInterfacedObject, IHashSet<T>, IThriftHashSet<T>, IThriftContainer, ISupportsToString) {$WARN SYMBOL_DEPRECATED DEFAULT} strict private FDictionary : TDictionary<T,Byte>; // there is no THashSet<T> in older Delphi versions strict protected function GetEnumerator: TEnumerator<T>; function GetCount: Integer; property Count: Integer read GetCount; function Add( const item: T) : Boolean; procedure Clear; function Contains( const item: T): Boolean; function Remove( const item: T): Boolean; public constructor Create( const aCapacity: Integer = 0); overload; constructor Create( const aCapacity: Integer; const aComparer : IEqualityComparer<T>); overload; destructor Destroy; override; function ToString : string; override; end; ====== End ===== How can i call this function product_get_info?? How to pass a IThriftHashSet into this function as parameter? The only thing i can see is to use the TThriftHashSetImpl<T> constructor to create After which, i cannot use the Add function as it is strict protected. Is there a example or sample which i can read on how to pass interface as parameters to functions for Delphi? please advise regards chris -
How to call functions with Interface name?
ChrisChuah posted a topic in RTL and Delphi Object Pascal
Hi Currently, i am having problem with using Interfaces in Delphi I need to call this function function product_get_info(const info_type: IThriftHashSet<TProduct_info_type>): IProduct_info; However, the parameters and return result are interfaces ====== Start IThriftHashSet ====== // compatibility IHashSet<T> = interface( IThriftHashSet<T>) ['{C3CF557F-21D9-4524-B899-D3145B0389BB}'] end deprecated 'use IThriftHashSet<T>'; {$WARN SYMBOL_DEPRECATED OFF} TThriftHashSetImpl<T> = class( TInterfacedObject, IHashSet<T>, IThriftHashSet<T>, IThriftContainer, ISupportsToString) {$WARN SYMBOL_DEPRECATED DEFAULT} strict private FDictionary : TDictionary<T,Byte>; // there is no THashSet<T> in older Delphi versions strict protected function GetEnumerator: TEnumerator<T>; function GetCount: Integer; property Count: Integer read GetCount; function Add( const item: T) : Boolean; procedure Clear; function Contains( const item: T): Boolean; function Remove( const item: T): Boolean; public constructor Create( const aCapacity: Integer = 0); overload; constructor Create( const aCapacity: Integer; const aComparer : IEqualityComparer<T>); overload; destructor Destroy; override; function ToString : string; override; end; ===== End IThriftHashSet ==== === Start IProduct_Info ==== IProduct_info = interface(IBase) ['{F9E8E7FC-6023-48F0-940E-4B2EBC9A2258}'] function GetTerminal_packaged_part_number_UTF8: System.UnicodeString; procedure SetTerminal_packaged_part_number_UTF8( const Value: System.UnicodeString); function GetTerminal_packaged_serial_number_UTF8: System.UnicodeString; ... ... end; TProduct_infoImpl = class(TInterfacedObject, IBase, ISupportsToString, IProduct_info) private FTerminal_packaged_part_number_UTF8: System.UnicodeString; FTerminal_packaged_serial_number_UTF8: System.UnicodeString; ... ... end ==== End IProduct_info ==== When i create a variable hashset = TThriftHashSetImpl<TProduct_info_type>.create; I could not call hashset.add(TProduct_info_type) Also how do i handle the return result IProduct_info? Should i also call product_info := TProduct_infoImpl.create?? Please help as i am not used to calling interfaces in Delphi regards chris -
GetIt installation does not work
ChrisChuah replied to PeterPanettone's topic in Delphi IDE and APIs
thank you. will try it out on the 12.1 community edition. have to get those files from github -
GetIt installation does not work
ChrisChuah replied to PeterPanettone's topic in Delphi IDE and APIs
how do i load the JEDI package into IDE? open the pkg, compile and install from there? -
GetIt installation does not work
ChrisChuah replied to PeterPanettone's topic in Delphi IDE and APIs
I just installed 12.1 community edition and try to install JEDI Visual Componnent Library 2023.11 It gave me an error that i must install jcl first. When i tried to uninstall it, it said that the jvclInstall.exe is missing. I downloaded jvcl from github and try to install locally, then it showed that this version of the product does not support command line compiling. aborting How can i install JEDI component into the 12.1 community edition via getit. Now, i removed the JEDI Component library and JEDI Visual component library from the CategoryRepository directory. GetIt now showed the install button and when i click on it, it state that JEDI is already installed. sigh.. anyone can advise on this? -
rectangle edge detection from image component?
ChrisChuah replied to ChrisChuah's topic in Algorithms, Data Structures and Class Design
hi So sorry that my search is quite limited. the search for OpenCV libraries is that it uses .Net or VC++ libraries and that will always lead me to windows. Cant find any fmx libraries for OpenCV. can guide me on where i can find resources where i can use OpenCV for Android and IOS using delphi? -
rectangle edge detection from image component?
ChrisChuah replied to ChrisChuah's topic in Algorithms, Data Structures and Class Design
hi thank you very much. However, i wish to develop the application on iphone or android. Hence, when using the iphone or android phone, i would want to use the camera function to capture the number of rectangular objects shown on the camera Any idea on how to do this? regards chris -
rectangle edge detection from image component?
ChrisChuah posted a topic in Algorithms, Data Structures and Class Design
Hi Is there a component whereby i can feed in an image file and it will scan the image for rectangle objects and returns a list of rectangles? please advise Best Regards chris -
Cannot Debug MacOS App for Delphi 11.1. Missing Python file
ChrisChuah posted a topic in Delphi IDE and APIs
I have re-downloaded the PAServer for Delphi 11.1 on MacOS and updated the XCode to 15.2 However, when i tried to run the mac app in debug mode, it gave me this error dyld[9049]: Library not loaded: /System/Library/Frameworks/Python.framework/Versions/2.7/Python Referenced from: <06D97208-31C1-324C-94F5-B231E630BF31> /Applications/PAServer-22.0_11.1.app/Contents/MacOS/lldb-x86_64/lib/liblldb.3.8.0.dylib Reason: tried: '/System/Library/Frameworks/Python.framework/Versions/2.7/Python' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/System/Library/Frameworks/Python.framework/Versions/2.7/Python' (no such file), '/System/Library/Frameworks/Python.framework/Versions/2.7/Python' (no such file, not in dyld cache) Is there an updated PAserver for 11.1 to fix this python link problem. The python frame work is found in /Library/Frameworks/Python.framework/Versions/2.7/Python rather than the /System library. I cannot create a link within the /System library as it is forbidden by Apple. Please help regards chris -
it seems that if i put a web browser on Form2 and Form2 is run-time called to be created, then there will be an access violation on RecreateBrowser function called. The way to go about it is to create a browser onCreate form2 function and insert the webbrowser component into it Not sure if anyone is having this problem
-
Hi Is there a function in Indy whereby i could get the Mac address of the interface card? Or is there any function in Delphi whereby i could obtain the MAC address of the NIC card for FMX app? regards chris
-
Oh Yes, now the browser can crash my application when i use a Navigate function. I place a try except block on the navigate function but somehow there is no exception error. Where can i get any information about the crash? regards chris
-
thank you very much. u