Jump to content

Search the Community

Showing results for tags 'delphi'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Delphi Questions and Answers
    • Algorithms, Data Structures and Class Design
    • VCL
    • FMX
    • RTL and Delphi Object Pascal
    • Databases
    • Network, Cloud and Web
    • Windows API
    • Cross-platform
    • Delphi IDE and APIs
    • General Help
    • Delphi Third-Party
  • C++Builder Questions and Answers
    • General Help
  • General Discussions
    • Embarcadero Lounge
    • Tips / Blogs / Tutorials / Videos
    • Job Opportunities / Coder for Hire
    • I made this
  • Software Development
    • Project Planning and -Management
    • Software Testing and Quality Assurance
  • Community
    • Community Management

Calendars

  • Community Calendar

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Delphi-Version

Found 227 results

  1. robertjohns

    Removing String

    I have a string like This is (string) which need to (remove) How can I delete strings (string) and (remove) so that result should be This is which need to
  2. Hi, i work in IT Support, and i'm trying to configure a delphi-based to run in RemoteApp. I do not have any access to the code, but when this software is open via RemoteApp it has errors in some parts, this is the error: It ONLY creates an error when its ran by RemoteApp, via RDP it works normally. I just want to know if it is something of Windows or inside Delphi, so i can talk to the programmers.
  3. How to delete all the files just in case you need to, for some unknown reason. Manual uninstall of RAD Studio/Delphi/C++Builder 12.0 Athens Launch the License Manager from the bin folder (by default “C:\Program Files (x86)\Embarcadero\Studio\22.0\bin\LicenseManager.exe”) and delete any trial or beta (Test Field) license that you can find. Check it under “License Details” in the center column. Under your Control Panel’s Program and Features Add/Remove Program uninstall the following entries: RAD Studio 12 version 23.0 Please follow these instructions to remove any leftover files: 1. If Windows 64-bit, remove the C:\Program Files (x86)\Embarcadero\Studio\23.0 directory (or the custom folder you had used). 2. Remove the C:\Users\Public\Documents\Embarcadero\Studio\23.0 directory 3. Remove the C:\ProgramData\Embarcadero\Studio\23.0 directory. 4. Remove the %APPDATA%\Embarcadero\BDS\23.0 directory. 5. Remove the HKEY_CURRENT_USER\SOFTWARE\Embarcadero\BDS\23.0 registry key 6. If Windows 64-bit, remove the HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Embarcadero\BDS\23.0 7. If Windows 64-bit, remove the following files from C:\Windows\SysWOW64: BDEAdmin.* CC32*.DLL Midas.* Xerces*.DLL If you had problems in the second step (uninstalling from Windows Control Panel), try this Microsoft tool to solve un-installation problems: https://support.microsoft.com/en-us/topic/fix-problems-that-block-programs-from-being-installed-or-removed-cca7d1b6-65a9-3d98-426b-e9f927e1eb4d
  4. For some time I was wondering how I could create a nice output from data I have. One day I was looking at some learning video or website--I can't remember. And I saw how some easily create an output that included text and images. If I recall, he used HTML at the time, but I'm not sure since it was a long time ago. Then, today, I was looking at some items in the GetIt portion of the welcome screen. Then, moments later I decided to click on the 'getit package manager' and that's when it hit me, again, the idea of creating a custom output view similar to that. So, I was wondering if I could create something similar in Delphi with the built-in components I already have--be it HTML code (howto) or a combination of components already in Delphi, for VCL and FMX/Mobile. * This D12 getit pkg mgr snippet taking from my tablet and down-resized 1920x1200, 50% * notice the output on the right side pane area, that is the design output I am seeking to create Does anyone have any suggestions on how I can proceed in this endeavor? What are your methods? TIA
  5. HI there i just made a try, i started there! To work on the Android platform using compile directives, i needed to make some modifications to the code in several files. Lets focus on 'svn.overbyte.be/svn/icsv9/Source/OverbyteIcsUtils.pas'.The classTIcsIntegerList is essentially a wrapper around the TList class, since this code was designed for use in a Windows platform target, on a different platform, i needed to make some adjustments. type TIcsIntegerList = class(TObject) private FList : TList<Integer>; // Use TList<Integer> instead of TList function GetCount: Integer; function GetFirst: Integer; function GetLast: Integer; function GetItem(Index: Integer): Integer; procedure SetItem(Index: Integer; const Value: Integer); public constructor Create; virtual; destructor Destroy; override; function IndexOf(Item: Integer): Integer; function Add(Item: Integer): Integer; virtual; procedure Assign(Source: TIcsIntegerList); virtual; procedure Clear; virtual; procedure Delete(Index: Integer); virtual; property Count: Integer read GetCount; property First: Integer read GetFirst; property Last : Integer read GetLast; property Items[Index: Integer] : Integer read GetItem write SetItem; default; end; // ... other codes { TIcsIntegerList } function TIcsIntegerList.Add(Item: Integer): Integer; begin Result := FList.Add(Item); // No need to typecast Item to Pointer end; procedure TIcsIntegerList.Clear; begin FList.Clear; end; constructor TIcsIntegerList.Create; begin FList := TList<Integer>.Create; // Use TList<Integer> instead of TList end; procedure TIcsIntegerList.Delete(Index: Integer); begin FList.Delete(Index); end; destructor TIcsIntegerList.Destroy; begin FList.Free; inherited; end; function TIcsIntegerList.GetCount: Integer; begin Result := FList.Count; end; function TIcsIntegerList.GetFirst: Integer; begin Result := FList.First; // No need to typecast FList.First to Integer end; function TIcsIntegerList.GetLast: Integer; begin Result := FList.Last; // No need to typecast FList.Last to Integer end; // ... other codes but i faced a lot of errors when i target android platform and compiled, it gives me errors like: [DCC Error] OverbyteIcsUtils.pas(5931): E2023 Function needs result type [DCC Error] OverbyteIcsUtils.pas(5933): E2003 Undeclared identifier: 'FList' [DCC Error] OverbyteIcsUtils.pas(5933): E2003 Undeclared identifier: 'Item' [DCC Error] OverbyteIcsUtils.pas(5938): E2004 Identifier redeclared: 'TIcsIntegerList' [DCC Error] OverbyteIcsUtils.pas(5940): E2003 Undeclared identifier: 'FList' [DCC Error] OverbyteIcsUtils.pas(5945): E2037 Declaration of 'TIcsIntegerList' differs from previous declaration ...: So how to fix it? Or can anyone point me to the right direction?
  6. Hi, I just realized that I am installing the wrong Delphi version on a new tablet. Embarcadero was quick to supply me a registration bump (from 2 to 3) and I was able to begin the installation of Delphi 12.., or so I thought. However, I grabbed the wrong .iso file folder "RADStudio_11_2_10937a" and began installing it. It should have been the "RADStudio_12_0_4915718.iso" file. Being so used to the Rad Studio 11 logo, I over looked it--twice! I am currently at the "specify location" dialog. Is it too late for me to stop and cancel the install and restart but with the "RADStudio_12_0_4915718.iso" file?
  7. Greetings! The NetHTTPRequest component has two properties. ClientCertificatePassword ClientCertificatePath Does anyone know how to set the "ClientCertificatePath" properly? Currently, I'm populating it with the path to the PFX file that was exported from the certificate store. EXAMPLE: C:\Certificate\nameofcertificate.pfx Likewise, I'm providing the password for the certificate in the "ClientCertificatePassword" property. The documentation on these properties is lacking not only online, but RAD Studio's local help files. I'm currently using RAD Studio 11.3 Enterprise with all the updates.
  8. Toast Notification Manager | WinForms Controls | DevExpress Documentation I need that component in Delphi. Is their any component like that i can buy for Delphi 10.2? Money does not matter right now. I need the functionality like it is in the DevExpress-Component. Thanks in Advance!
  9. Using a string grid, (but I may also use a dbgrid later) how do I get the *column* number when I right-click on a column ? I've searched around but could not find the answers. Below, shows column 2 was right-click-selected. The purpose of this is to allow me to right-click on a column and a pop-up menu with options for (copy_column, create_table) will show. 1. I want to copy the text of the column to the clipboard. 2. or, create a table out of the selected column's text. (I know how to do these parts.) TIA
  10. PawelPepe

    How to free TListView Objects (String)

    Hi, I got a problem with TListView and Data. It seems that I got memory leaks, because Data pointers are not released (if I understand it well). Let me show you what I do: Here is a simple TListView (LV_Data). I add few items to the list (Report Style) into 3 Columns. var i : Integer; ListItem : TListItem; PObject : PChar; for i := 0 to 3 do begin // Caption ListItem := AList.Items.Add; ListItem.Caption := 'My Caption' + '_' + Inttostr(i+1); // Language Name ListItem.SubItems.Add('Language' + '_' + Inttostr(i+1)); // User Name ListItem.SubItems.Add('User Name' + '_' + Inttostr(i+1)); // User Data Path PObject := StrAlloc(250); StrPCopy(PObject, 'PATH_TO_USER_DIRECTORY' + '_' + Inttostr(i+1)); ListItem.Data := PObject; end; As you can see, I also add "hidden" data (in this example a path to directory, as string). I can use it in program, without displaying it to user in listview. I can read it in simple way (for examle, in ListView OnClick event:) var sPath : string; if (LV_Data.Items.Count > 0) AND (LV_Data.ItemIndex <> -1) then begin sPath := StrPas(PChar(LV_Data.Items[LV_Data.ItemIndex].Data)); end; Everything works very nice... but, when I close program, I see there are some memory leaks. --------------------------- Unexpected Memory Leak --------------------------- An unexpected memory leak has occurred. The unexpected small block leaks are: 473 - 520 bytes: Unknown x 3 --------------------------- OK --------------------------- As far as I know, I have to free those List View Data bymyself. How to do this? procedure TMainFrm.LV_DataDeletion(Sender: TObject; Item: TListItem); begin if Item.Data <> nil then begin FreeMem(Item.Data); Item.Data := nil; end; end; Above code not working (why!?), got Invalid Pointer Operation. Could you please tell me how to free this data to avoid memory leak? Thank you in advance, -Pawel
  11. Specs: Win7, Delphi 11.2, VCL I wrote some functions to convert string to byte and byte to string. These functions work. For testing, I added several tbuttons and a memo on the form and began testing my ideas shown below. function str2byte(str: string): TBytes; begin setlength(str,length(str)); result := TEncoding.utf8.getbytes(str); end; function byte2str(byt: TBytes): string; begin result := TEncoding.ascii.getstring(byt); end; usage: procedure TForm1.Button1Click(Sender: TObject); var strs: string; bytes: TBytes; begin bytes := str2byte('ABC'); // string strs := byte2str(bytes); // bytes memo1.Lines.Add(byte2str(bytes)); // show it strs := byte2str([68,69,70]); // bytes bytes := str2byte(strs); // string memo1.Lines.Add(byte2str(bytes)); // show it end; Now, I'd like to extend that to include an additional parameter to the encoding format (ansi, ascii, utf-16-big-endian unicode, utf-16 unicode, utf-7 and utf-8) as found here: https://docwiki.embarcadero.com/Libraries/Alexandria/en/System.SysUtils.TEncoding (And then later, possibly extend upon it by building a class component of it (and other library functions/procedures that I build)). The issue I am having now is how to give the parameters their name. I do not know if there are already built-in types for these and don't want to cause issues later on. But so far, I thought about using these: (_ansi, _ascii, _utf7, _utf8, _utf16be and _utf16u). Or, maybe create an enumerated list, i.e., type TMyEncoding = (_ansi, _ascii, _utf7, _utf8, _utf16be, _utf16u); And rewriting the above output snippet: type TMyEncoding = (_ansi, _ascii, _utf7, _utf8, _utf16be, _utf16u); function _byte2str(byt: TBytes; enc: TMyEncoding): string; begin case integer(enc) of 0: result := TEncoding.ascii.getstring(byt); 1: result := TEncoding.ansi.getstring(byt); 2: result := TEncoding.utf7.getstring(byt); 3: result := TEncoding.utf8.getstring(byt); // ... end; end; procedure TForm1.Button4Click(Sender: TObject); var strs: string; bytes: TBytes; begin bytes := str2byte('_ansi'); // string strs := _byte2str(bytes,_ansi); // bytes memo1.Lines.Add(_byte2str(bytes,_ansi)); // show it // strs := byte2str([68,69,70]); // bytes // bytes := str2byte(strs); // string // memo1.Lines.Add(byte2str(bytes)); // show it end; So I am looking for some advice/suggestions on how to implement the names for each of the encodings that will not interfer with Delphi's built-in names. TIA.
  12. Hi, In this project I must use Delphi XE with dbExpress. I'm connecting against a SQL Server 20xx.... There's a customer requesting a TLS 1.2 only setup. Using sslscan I get this result: SSL/TLS Protocols: SSLv2 disabled SSLv3 disabled TLSv1.0 disabled TLSv1.1 disabled TLSv1.2 enabled TLSv1.3 disabled With this setting I'm unable to connect my sample project ( TSQLConnection only ). When activating the connection an error is raised (attached image) When reactivating the other verions : SSL/TLS Protocols: SSLv2 disabled SSLv3 disabled TLSv1.0 enabled TLSv1.1 enabled TLSv1.2 enabled TLSv1.3 disabled Everything works fine. I'm searching the web, but the only two parameters I found out, are not working with the XE version of dbExpress. I wondering if there's any way to connect to SQL Server via TLS1.2 only setup. (https://stackoverflow.com/questions/65050540/tls-1-2-sql-server-and-delphi-client) Are there any other parameters I can try? Tia, Clément
  13. Dear visitors, We like to inform you that new version of NextSuite6 is released. Click here to read the release news. New changes The update introduces our NextLayout6 component: NextSuite includes always growing set of VCL components. Most important components are: NextGrid6 (StringGrid/ListView replacement, written from scratch). NextDBGrid6 (Db variant of the grid) NextInspector6 - An object inspector component. Next Collection 6 - A set of smaller components that are both useful and easy to use. Next Canvas Application - a drawing application that wysiwyg convert your drawings into a valid Delphi TCanvas code.   and many more.  Few screenshots:     Download big demo project from: http://www.bergsoft.net/downloads/vcl/demos/nxsuite6_demo.zip  Boki (BergSoft) boki@bergsoft.net | LinkedIn Profile -- BergSoft Home Page: www.bergsoft.net Members Section: bms.bergsoft.net Articles and Tutorials: help.bergsoft.net (Developers Network) -- BergSoft Facebook page -- Send us applications made with our components and we will submit them in news article. Link to this page will be also set on home page too.
  14. I have been searching via google but not turned up any answer to this. 1. Say I have multiple files of similar text and I save them. 2. Then, when I load (or open) any of those text files in TMemo, I want to maintain the last screen layout (line) within the dimensions. I am comparing structures of column (hex/ascii) data in these text files and if I am in the middle of the file in the tmemo and I decide to load another file to quickly compare back/forth with, I want the layout the remain the same but not start from the top of the text file. I know I have to save the last topmost line in a variable but I don't know how to go further in this. TIA. Fig A - this is the layout that opens by default for every load. But I want Fib B if I am scrolling down and stop and decide to load another file. Fig B - if I open at the last layout position this is what I want to see.., not Fig A.
  15. Hello everyone, I am a technician in a company who is making business in Healthcare material. A long time ago, an employee programmed softwares for this company with Delphi 2009. Due to bugs we begin to have, I am in charge to upgrade the apps. But my boss doesn't want Delphi but C++. So I would like to know if I can import the source project into RAD Studio and convert it in C++ to upgrade it. I also began a new app in Delphi but my boss really wants C++, he thinks that Delphi is not good (because he has a friend who is programmer and said Delphi sucks ... very open-minded programmer, indeed). So I need your help to convert all stuff I have in Delphi to C++. It's fine if it's not perfect, I know that I will need to adapt many things, I just don't want to begin with a blank project. I wish you an exellent day and I am waiting for your replies !
  16. Rafael Dipold

    Error on read-only transaction

    Hello friends, Would anyone have a tip why the read-only error happens when I run the FireDAC commands in this order, like the MRE below? //READ ONLY TRANSACTION LTransactionRO := TFDTransaction.Create(nil); LQueryRO := TFDQuery.Create(nil); try LTransactionRO.Connection := FDManager.AcquireConnection('MY_DB', ''); LTransactionRO.Options.ReadOnly := True; LQueryRO.Connection := FDManager.AcquireConnection('MY_DB', ''); LQueryRO.Transaction := LTransactionRO; LQueryRO.Open('SELECT * FROM mY_TABLE'); //OK finally LQueryRO.Free; LTransactionRO.Free; end; //READ WRITE TRANSACTION LTransactionRW := TFDTransaction.Create(nil); LQueryRW := TFDQuery.Create(nil); try LTransactionRW.Connection := FDManager.AcquireConnection('MY_DB', ''); LTransactionRW.Options.ReadOnly := False; LQueryRW.Connection := FDManager.AcquireConnection('MY_DB', ''); LQueryRW.Transaction := LTransactionRW; //ERROR: cannot execute UPDATE in a read-only transaction. LQueryRW.ExecSQL('UPDATE MY_TABLE SET COLUM1 = COLUM1 WHERE 1 = 1'); finally LQueryRW.Free; LTransactionRW.Free; end; if I comment the line `//LTransactionRO.Options.ReadOnly := True;`, the SQL UPDATE run without errors. Thanks for any tips!
  17. Is there a way to back up my keychain and certificates and my project on the MacBook ? I am not familiar with a Mac just got one to compile Delphi apps I use git on windows to back up the Delphi project code just asking u guys to see if u have any tips or best practice for backing up the Mac with all the keychain ,certificates,ect Thanks for any suggestions
  18. I usually work in low light and it gets a little difficult sometimes to see certain characters when using the dark theme for the IDE. (Some of the colored fonts like blue/red/green get fuzzy looking under my laptop's 1366x768 screesize) I thought it would be a quick and simple method of Ctrl+Wheel-up/down, but that did not work. Is there a quick shortcut to enlarge/decrease the font at will? TIA.
  19. SPECS: Delphi 11.2, Galaxy S10+ phone (Android 12) (screen size is 6.4 inches) Issue: I want to change the view in the IDE to match my phone but the closest one is the 'Android 5" phone', and when I add componets on the form in that view, after compiling, the controls don't fit the screen and/or are sometimes off the view of the screen. In Delphi XE7, in the View's drop-down list, there is a custom setting option. I think I only used it once for a tablet years ago, but could not figure it all out and gave up. However, in 11.2, there is no listing for custom. So, I was wondering if there are downloadable views, or does the developer has to figure it out manually by eye/try. I've been searching around but cannot find any answers. TIA.
  20. Dear visitors, We like to inform you that new version of NextSuite6 is released. Click here to read the release news. This update introduces a new column type - grid column. NextSuite includes always growing set of VCL components. Most important components are: NextGrid6 (StringGrid/ListView replacement, written from scratch). NextDBGrid6 (Db variant of the grid) NextInspector6 - An object inspector component. Next Collection 6 - A set of smaller components that are both useful and easy to use. Next Canvas Application - a drawing application that wysiwyg convert your drawings into a valid Delphi TCanvas code.   and many more.  Few screenshots:     Download big demo project from: http://www.bergsoft.net/downloads/vcl/demos/nxsuite6_demo.zip Boki (BergSoft) boki@bergsoft.net | LinkedIn Profile -- BergSoft Home Page: www.bergsoft.net Members Section: bms.bergsoft.net Articles and Tutorials: help.bergsoft.net (Developers Network) -- BergSoft Facebook page -- Send us applications made with our components and we will submit them in news article. Link to this page will be also set on home page too.
  21. Can I use managed C# DLL in unmanaged Delphi application ? Thanks
  22. Delphi 11.2, Windows 7 Home Prem 64bit To my knowledge, this was the first time this has ever happened to me. When I opened a project from a window's folder by the .dproj file, I received this pop-up message, "Please enter a valid Embarcadero serial number" I tried opening other projects in this same way and received the same message. I normally open projects through Delphi but I was searching my folders for a project and opened it this way. Is this a known bug?
  23. I have a problem with Delphi Alexandria and it's JSON methods, maybe I just do it wrong and would like to get help. Here is my demo project that show the problem. program Project12; {$APPTYPE CONSOLE} {$R *.res} uses Winapi.Windows, System.Classes, System.SysUtils, System.IOUtils, System.JSON; type TMyJsonRec = packed record MyInteger: Integer; MyInt64: Int64; MyUInt64: UInt64; MyDWORD: DWORD; MyDouble: Double; MyBoolean: Boolean; MyString: string; end; procedure SaveJsonToFile(const AJsonObject: TJSONObject; const AFileName: string); var JsonText: string; StreamWriter: TStreamWriter; begin JsonText := AJsonObject.ToString; // is this the problematic part? StreamWriter := TStreamWriter.Create(AFileName, False, TEncoding.UTF8); try StreamWriter.Write(JsonText); finally StreamWriter.Free; end; end; procedure SaveRecordToJson(const ARecord: TMyJsonRec; const AFileName: string); var JsonObject: TJSONObject; begin JsonObject := TJSONObject.Create; try JsonObject.AddPair('MyInteger', TJSONNumber.Create(ARecord.MyInteger)); JsonObject.AddPair('MyInt64', TJSONNumber.Create(ARecord.MyInt64)); JsonObject.AddPair('MyUInt64', TJSONNumber.Create(ARecord.MyUInt64)); // this does not work as I would have thought it does, when it exceed Int64 range it break JsonObject.AddPair('MyDWORD', TJSONNumber.Create(ARecord.MyDWORD)); JsonObject.AddPair('MyDouble', TJSONNumber.Create(ARecord.MyDouble)); JsonObject.AddPair('MyBoolean', TJSONBool.Create(ARecord.MyBoolean)); JsonObject.AddPair('MyString', ARecord.MyString); SaveJsonToFile(JSonObject, AFileName); finally JsonObject.Free; end; end; function LoadRecordFromJson(const AFileName: string): TMyJsonRec; var JsonObject: TJSONObject; begin JsonObject := TJSONObject.ParseJSONValue(TFile.ReadAllText(AFileName)) as TJSONObject; try Result.MyInteger := JsonObject.GetValue('MyInteger').AsType<Integer>; Result.MyInt64 := JsonObject.GetValue('MyInt64').AsType<Int64>; Result.MyUInt64 := JsonObject.GetValue('MyUInt64').AsType<UInt64>; // this does not work as I would have thought it does, when it exceed Int64 range it break Result.MyDWORD := JsonObject.GetValue('MyDWORD').AsType<DWORD>; Result.MyDouble := JsonObject.GetValue('MyDouble').AsType<Double>; Result.MyBoolean := JsonObject.GetValue('MyBoolean').AsType<Boolean>; Result.MyString := JsonObject.GetValue('MyString').Value; finally JsonObject.Free; end; end; var MyRecord1, MyRecord2: TMyJsonRec; begin // Initialize the record MyRecord1.MyInteger := High(Integer); MyRecord1.MyInt64 := High(Int64); MyRecord1.MyUInt64 := High(UInt64); MyRecord1.MyDWORD := High(DWORD); MyRecord1.MyDouble := 123.456; MyRecord1.MyBoolean := True; MyRecord1.MyString := 'Hello, World!'; Writeln('Original record:'); Writeln('MyInteger: ', MyRecord1.MyInteger); Writeln('MyInt64: ', MyRecord1.MyInt64); Writeln('MyUInt64: ', MyRecord1.MyUInt64); Writeln('MyDWORD: ', MyRecord1.MyDWORD); Writeln('MyDouble: ', MyRecord1.MyDouble); Writeln('MyBoolean: ', MyRecord1.MyBoolean); Writeln('MyString: ', MyRecord1.MyString); SaveRecordToJson(MyRecord1, '.\test.json'); MyRecord2 := LoadRecordFromJson('.\test.json'); // Output the loaded record Writeln('Loaded record:'); Writeln('MyInteger: ', MyRecord2.MyInteger); Writeln('MyInt64: ', MyRecord2.MyInt64); Writeln('MyUInt64: ', MyRecord2.MyUInt64); Writeln('MyDWORD: ', MyRecord2.MyDWORD); Writeln('MyDouble: ', MyRecord2.MyDouble); Writeln('MyBoolean: ', MyRecord2.MyBoolean); Writeln('MyString: ', MyRecord2.MyString); ReadLn; end. I am unsure if it is the saving part or the reading part.
  24. I found some nice Python code on WWW.SBERT.NET that perfectly suited my need to find the best matching images in two file sets. The file sets are related to each other: they origin the same celluloids, but were created with different quality of scanning equipment. In addition, cropping and tilting may have taken place, and in different ways. I modified the example code to create a file with information on the best fitting high-quality-version of the low-Q image, as well as the three top score values. Here is the code that runs perfectly in Python, version 3.10. I am using PyScripter: great! You can easily test it with your own files, though it may require a series of Python modules to be installed before it runs. from sentence_transformers import SentenceTransformer, util from PIL import Image model = SentenceTransformer("clip-ViT-B-32") f = open("E:/Fotos/testmap/ListMatchingFotos.txt", "a") lijst = ["E:/Fotos/File_nr1.JPG","E:/Fotos/File_nr2.JPG"] # this is the list of low quality images. image_names = ["M:/Fotos/negatieven 001.jpg","M:/Fotos/negatieven 002.jpg","M:/Fotos/negatieven 003.jpg","M:/Fotos/negatieven 004.jpg","M:/Fotos/negatieven 005.jpg","M:/Fotos/negatieven 006.jpg","M:/Fotos/negatieven 007.jpg","M:/Fotos/negatieven 008.jpg"] image_names += lijst encoded_image = model.encode([Image.open(filepath) for filepath in image_names], batch_size=128, convert_to_tensor=True, show_progress_bar=False) processed_images = util.paraphrase_mining_embeddings(encoded_image) threshold = 0.99 near_duplicates = [image for image in processed_images if image[0] < threshold] L = len(near_duplicates) for j in range(len(lijst)): # narrow the list of pairs to consider only the files in the "Lijst" searchresults = [] for i in range(0,L): score, image_id1, image_id2 = near_duplicates[i] idf = image_names.index(lijst[j]) if (( (image_names[image_id1] == image_names[idf] ) and (image_id2 != idf) ) and (not (image_names[image_id2] in lijst))) or (( (image_names[image_id2] == image_names[idf] ) and (image_id1 != idf) ) and (not (image_names[image_id1] in lijst))): searchresults.append( near_duplicates[i] ) ls = len(searchresults) score1 = 0 score2 = 0 score, image_id1, image_id2 = searchresults[0] if ls > 1: score1, image_id11, image_id21 = searchresults[1] if ls > 2: score2, image_id12, image_id22 = searchresults[2] if image_id1 != idf: image_id2 = image_id1 if score < 85/100: f.write( image_names[idf] + " " + image_names[image_id2] + " Score1: {:.3f}%".format(score * 100) + " Score2: {:.3f}%".format(score1 * 100) + " Score3: {:.3f}%".format(score2 * 100) + str(" NO MATCH OR VERY POOR \n")) else: f.write( image_names[idf] + " " + image_names[image_id2] + " Score1: {:.3f}%".format(score * 100) + " Score2: {:.3f}%".format(score1 * 100) + " Score3: {:.3f}%\n".format(score2 * 100)) f.close() However, the very same code doesn't run in Python4Delphi, although it uses the same PythonEngine.dll and path and libraries. I got the error message "Project .... raised exception class EPyAttributeError with message 'AttributeError: 'NoneType' object has no attribute 'flush'". The error is generated in the very first line "from sentence_transformers import...", on both modules, either combined or in separate lines. Here is my delphi version of the code above. Function TPyForm.Picture_Matching_using_Python(Foto_bestanden : String; VAR Zoeklijst :TArray<string>; TekstBestand :String; TargetScore : integer) : Boolean; VAR Mem :TStringList; Lijst, BeterLijst: String; Fotos : Tarray<String>; begin If Foto_bestanden = '' then exit; Fotos := Foto_bestanden.Split([',']); Lijst := '['; BeterLijst := '['; for Var Bestand : String in Fotos DO Lijst := Lijst + '"' + B2F(Bestand) + '"' + ','; Lijst := copy(Lijst,1,length(Lijst)-1)+ ']'; for Var Bestand : String in Zoeklijst DO BeterLijst := BeterLijst + '"' + B2F(Bestand) + '"' + ','; BeterLijst := copy(BeterLijst,1,length(BeterLijst)-1)+']'; TRY Mem := TStringList.Create; With Mem DO begin Add('import os'); Add('from PIL import Image'); Add(' from sentence_transformers import SentenceTransformer, util'); Add('model = SentenceTransformer("clip-ViT-B-32") '); Add('f = open("' + B2F(TekstBestand) + '", "a")'); Add('lijst = '+ Lijst ); Add('image_names = '+ BeterLijst ); Add('image_names += lijst'); Add('encoded_image = model.encode([Image.open(filepath) for filepath in image_names], batch_size=128, convert_to_tensor=True, show_progress_bar=False)'); Add('processed_images = util.paraphrase_mining_embeddings(encoded_image)'); Add('threshold = 99/100'); Add('near_duplicates = [image for image in processed_images if image[0] < threshold] '); Add('l = len(near_duplicates) '); Add('for j in range(len(lijst)): '); Add(' searchresults = [] '); Add(' for i in range(0,l): '); Add(' score, image_id1, image_id2 = near_duplicates[i] '); Add(' idf = image_names.index(lijst[j]) '); Add(' if (( (image_names[image_id1] == image_names[idf] ) and (image_id2 != idf) ) and (not (image_names[image_id2] in lijst))) or ' + ' (( (image_names[image_id2] == image_names[idf] ) and (image_id1 != idf) ) and (not (image_names[image_id1] in lijst))): '); Add(' searchresults.append( near_duplicates[i] ) '); Add(' ls = len(searchresults) '); Add(' score1 = 0' ); Add(' score2 = 0' ); Add(' score, image_id1, image_id2 = searchresults[0]'); Add(' if ls > 1: score1, image_id11, image_id21 = searchresults[1] '); Add(' if ls > 2: score2, image_id12, image_id22 = searchresults[2] '); Add(' if image_id1 != idf: image_id2 = image_id1'); Add(' if score < ' + TargetScore.tostring + '/100: '); Add(' f.write( image_names[idf] + " " + image_names[image_id2] + " Score1: {:.3f}%".format(score * 100) + " Score2: {:.3f}%".format(score1 * 100) + " Score3: {:.3f}%".format(score2 * 100) + str(" GEEN OF TWIJFELACHTIGE MATCH \n"))'); Add(' else:'); Add(' f.write( image_names[idf] + " " + image_names[image_id2] + " Score1: {:.3f}%".format(score * 100) + " Score2: {:.3f}%".format(score1 * 100) + " Score3: {:.3f}%\n".format(score2 * 100))' ); Add('f.close() '); end; TRY Result := True; PythonEngine1.ExecString( ansiString( Mem.text ) ); Except Result := False; END; FINALLY Mem.Free; END; end; I have no idea how to proceed, and do hope that anyone does. I would very much appreciate any help. Jan
  25. IMG SPA

    Delphi To IOS Deploying error

    Hello, I'm trying to deploying a Delphi FMX application to iPhone IOS. I have no problems on connecting with the MAC but I have an internal API error on executing (please see attached file) Delphi version: 11.2 Patch 1 IOS version: 16.6 X-code version: 14.3.1 Can anyone help me? Thanks
×