ertank
Members-
Content Count
246 -
Joined
-
Last visited
-
Days Won
1
Everything posted by ertank
-
Didn't think of that. Opening only .pas file alone gives below error ANA_SAYFA.pas(1): Line endings were inconsistent and have been converted to CRLF. However, still no code displayed and it is an empty page. Something to check though. Thank you.
-
Delphi sqlite datatype IMAGE ??? does this really exists?
ertank replied to Al T's topic in Databases
Here is a link from official SQLite website https://www.sqlite.org/datatype3.html it says there is BLOB support. Here is another link from official SQLite website https://www.sqlite.org/changes.html you can find BLOB support is introduced with 2004-06-18 (3.0.0 alpha). Delphi already has TBlobField support https://docwiki.embarcadero.com/Libraries/Sydney/en/Data.DB.TBlobField -
I am not using FireDAC, but here is a similar question from a google search. https://stackoverflow.com/questions/24614480/delphi-xe6-firedac-master-detail-error BTW, you should provide more details as to your specific case. Reading above link, it is related to Master-Detail links.
-
Fiddler Telerik Classic (capable of decrypting https traffic) would be able to do that, too. It would be a local application and you won't be sending your credentials to a proxy server that you do not manage. If you are using TNetHTTPClient (or your choice of components do) you won't need any manual proxy setting. Just run Fiddler Telerik before you run your application that you would like to catch its traffic. If you are using TIdHTTP (or your choice of components do) you will need to manually set proxy to Your_Local_IP_Number:8888 for default settings.
-
Having no code shared, I am just speculating that you update data while all 15 charts are visible on the screen. If that is the case, you might try to fill data while charts are hidden. You might want to fill your data between begin/end update statements Chart1.SeriesGroups.BeginUpdate(); // data fill here Chart1.SeriesGroups.EndUpdate(); It is just a wild guess and I am not sure if this is the problem. You should at least have detailed debug logging for yourself with milliseconds accuracy to understand if it is reading from the database is slow or filling up the chart data or something else.
-
Is it possible for you to convert these files into a single HTML and load it as a file?
-
Hello, Is it possible to read XML processing instructions using TXMLDocument? Assuming XML I am trying to parse is as follows <?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="text/xsl" href="xsl_for_this_xml.xslt"?> <DATA xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> </DATA> I am trying to read "href" value in "xml-stylesheet". I will parse it as text if this is not possible to read using existing XML routines in Delphi. Thanks & Regards, Ertan
-
Thank you. When I do that, I can find 'xml-stylesheet' node. But, its attribute list is empty. I could read NodeValue though. I used below code for testing. uses Xml.XMLDoc, Xml.XMLIntf; const XmlData = '<?xml version="1.0" encoding="UTF-8"?>' + sLineBreak + '<?xml-stylesheet type="text/xsl" href="xsl_for_this_xml.xslt"?>' + sLineBreak + '<DATA xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">' + sLineBreak + '</DATA>'; procedure TForm1.Button1Click(Sender: TObject); var LXml: IXMLDocument; LNode: IXMLNode; begin LXml := NewXMLDocument(); LXml.LoadFromXML(XmlData); LNode := LXml.ChildNodes.First; while LNode <> nil do begin if (LNode.NodeType = ntProcessingInstr) and (LNode.NodeName = 'xml-stylesheet') then begin if LNode.HasAttribute('type') then begin ShowMessage('type: ' + LNode.Attributes['type']); end; if LNode.HasAttribute('href') then begin ShowMessage('href: ' + LNode.Attributes['href']); end; ShowMessage('NodeValue: ' + LNode.NodeValue); Break; end; LNode := LNode.NextSibling; end; end; That only display message NodeValue: type="text/xsl" href="xsl_for_this_xml.xslt". This also leaves a small text parsing.
-
When I test it, GET method redirects to URL https://qws.quartix.com/v2/api/auth and respond with "{"Message":"The requested resource does not support http method 'GET'."}" There is no 404 error. I have tried to use TRESTRequest and other relevant components in the past. I got a memory leak that had to be fixed by Embarcadero. After that incident, I directly communicate using HTTP component of my choice. You should have a swagger or postman document or a web link for explanation of endpoints. You also should have some test environment credentials in order to be able to build your integration. I could not see any publicly available API information. You probably need to apply for it.
-
TidHTTP under FMX for android does not work
ertank replied to JohnLM's topic in Network, Cloud and Web
I think Dave is trying to tell you to read highest scored Remy's answer there. I would say, it would be easier for you to use TNetHTTPClient on Android platform. -
Is there a reason for you not to check each XML item against these rules at the time of XML generation?
- 12 replies
-
Windows 11 22H2 lost batch file association
ertank replied to Angus Robertson's topic in Delphi IDE and APIs
I am on beta channel for Windows 11 and my build 22622.601 has no problem with BAT files. Actually, I have a couple BAT files in schedule running daily without any problem. -
AFAIK, it is not common to have support for such parsing in text editor codes. BTW, what you are trying to do is not a very simple task. You probably need to build it yourself even if you find a source to use as a base. It takes time and a lot of corner case fixes for your database of choice. You should consider having per database parsing like one for SQLite another for SQL Server, etc. Also consider following examples. They are FirebirdSQL specific. WITH CTE AS (SELECT EXTRACT(WEEKDAY FROM ADATE) AS DAYOFWEEK, PAYMENTID, PAYMENTMETHODID, AVG(GENERALTOTALPRICE) GENERALTOTALPRICE FROM TRANSFERS WHERE STATIONID = 1 AND (PAYMENTMETHODID = 10 OR PAYMENTMETHODID = 20 OR PAYMENTMETHODID = 50 OR PAYMENTMETHODID = 60 OR PAYMENTMETHODID = 205) AND (TARIH >= '2022-01-01' AND TARIH <= '2022-01-31 23:59:59.999') GROUP BY 1, 2, 3) SELECT DAYOFWEEK, SUM(GENERALTOTALPRICE) FROM CTE GROUP BY 1 UNION SELECT 7, SUM(GENERALTOTALPRICE) FROM CTE GROUP BY 1 Another example; set term ^ ; execute block as begin if (not exists(select 1 from RDB$RELATION_FIELDS rf where rf.RDB$RELATION_NAME = 'POS' and rf.RDB$FIELD_NAME = 'AGROUP')) then execute statement 'alter table pos add agroup varchar(100);'; if (not exists(select 1 from RDB$RELATION_FIELDS rf where rf.RDB$RELATION_NAME = 'FUEL' and rf.RDB$FIELD_NAME = 'AGROUP')) then execute statement 'alter table fuel add agroup varchar(100);'; if (not exists(select 1 from RDB$RELATION_FIELDS rf where rf.RDB$RELATION_NAME = 'PAYMENT' and rf.RDB$FIELD_NAME = 'AGROUP')) then execute statement 'alter table payment add agroup varchar(100);'; end^ set term ; ^ I do not know your user base but all these are valid SQL statements for FirebirdSQL and can be placed one after another, might also include "COMMIT" statements between which is another thing to control in your code if you are to parse and execute each identified block as its own. I did not check ZeosLib codebase. If they have any "parsing" and "identifying" SQL statement blocks. That would be a good starting point. Alternative is to force your users to use simple statements with default terminator at the end. Such SQL statements are pretty easy to parse.
-
Postgresql in the cloud, possible for Desktop App?
ertank replied to mvanrijnen's topic in Network, Cloud and Web
I am also suggesting a REST middleware for your purpose. If you insist to expose the database to the Internet, you should at least enforce SSL certificate access https://www.postgresql.org/docs/current/ssl-tcp.html -
Since you try to display an XML in a Memo control, I presume you are using considerable sized XML files and do not need things like coloring/styling. You can use a code like below to "pretty print" your XML and display it in a Memo object. uses Xml.xmldom, Xml.XMLIntf, // Interface Xml.XMLDoc; // TXMLDocument, FormatXMLData() procedure TForm1.Button1Click(Sender: TObject); var LXML: IXMLDocument; begin LXML := NewXMLDocument(); LXML.LoadFromXML('<?xml version="1.0" encoding="UTF-8"?><some_node><another_node>node value</another_node></some_node>'); LXML.XML.Text := FormatXMLData(LXML.XML.Text); Memo1.Text := LXML.XML.Text; end; Documentation says about TMemo "Under Win 9x, there is a limit of 64k of text for this control"
-
Since a new beginning, why not try https://github.com/synopse/mORMot2
-
Converting a very long text to concatenated strings?
ertank replied to PeterPanettone's topic in GExperts
Another alternative might be to use a text editor that can format your HTML and add quotes (possibly with the help of regex) Notepad++ https://notepad-plus-plus.org/downloads/ CudaText https://cudatext.github.io TextEditorPro https://texteditor.pro SublimeText https://www.sublimetext.com -
Hello, I normally use UniDAC with MARS. This time, I have to use FireDAC and I am not used to FireDAC at all. I checked MARS demo applications to prepare my INI file as below: [DefaultEngine] Port=8085 ThreadPoolSize=100 FireDAC.MAIN_DB.DriverID=FB FireDAC.MAIN_DB.Database="D:\rest_server\SAMPLE.FDB" FireDAC.MAIN_DB.User_Name=SYSDBA FireDAC.MAIN_DB.Password=mypassword FireDAC.MAIN_DB.Protocol=TCPIP FireDAC.MAIN_DB.Server=localhost FireDAC.MAIN_DB.Pooled=True FireDAC.MAIN_DB.POOL_MaximumItems=100 FireDAC.MAIN_DB.TxOptions.Isolation=xiReadCommitted When server tries to establish a database connection, client receives below error: Internal server error: [EFDException] [FireDAC][Stan][Def]-254. Definition [MAIN_DB] is not found in [] Server EXE is built as a windows service application. Fbclient.dll file with correct bitness and version is in the same directory as my EXE file. I have following in my code to make sure MARS uses certain definition in INI file. [Connection('MAIN_DB'), Path('token')] TTokenResource = class(TMARSTokenResource) Any help is appreciated. Thanks & Regards, Ertan
-
How to do base64 decoding then decrypt it with aes256
ertank replied to Fuandi's topic in Algorithms, Data Structures and Class Design
I am not good at such cryptographic coding. My limited knowledge, you will probably need to know "mode of operation" https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation I do not see any initialization vector (IV) information in your example so that might suggest you need ECB, but that is something you should clarify. I personally like CryptoLib4Pascal. Multi platform support (Lazarus, FMX, VCL, x64). Contains lots of features. Also includes Base64 routines. You will need to get codes from all three links below https://github.com/Xor-el/CryptoLib4Pascal https://github.com/Xor-el/HashLib4Pascal https://github.com/Xor-el/SimpleBaseLib4Pascal Sample AESCBC256 encrypt/decrypt code would look like as following. (AES128 or AES256 is auto determined by the length of Key parameter). You can take it as starting point and modify to your needs. uses ClpIBufferedCipher, ClpCipherUtilities, ClpIParametersWithIV, ClpParametersWithIV, ClpParameterUtilities, ClpEncoders, ClpSecureRandom, ClpISecureRandom; function EncryptAES(const Key, IV: TBytes; const PlainText: string; out CryptBase64Text: string): Boolean; var Cipher: IBufferedCipher; KeyParametersWithIV: IParametersWithIV; Buf: TBytes; CryptBytes: TBytes; begin try Cipher := TCipherUtilities.GetCipher('AES/CBC/PKCS7PADDING'); KeyParametersWithIV := TParametersWithIV.Create(TParameterUtilities.CreateKeyParameter('AES', Key), IV); Cipher.Init(True, KeyParametersWithIV); // init encryption cipher Buf := TEncoding.ANSI.GetBytes(PlainText); CryptBytes := Cipher.DoFinal(Buf); CryptBase64Text := TBase64.Encode(CryptBytes); except Exit(False); end; Result := True; end; function DecryptAES(const Key, IV: TBytes; const CryptBase64Text: string; out PlainText: string): Boolean; var Cipher: IBufferedCipher; KeyParametersWithIV: IParametersWithIV; Buf: TBytes; PlainBytes: TBytes; begin try Cipher := TCipherUtilities.GetCipher('AES/CBC/PKCS7PADDING'); KeyParametersWithIV := TParametersWithIV.Create(TParameterUtilities.CreateKeyParameter('AES', Key), IV); Cipher.Init(False, KeyParametersWithIV); // init decryption cipher Buf := TBase64.Decode(CryptBase64Text); PlainBytes := Cipher.DoFinal(Buf); PlainText := TEncoding.ANSI.GetString(PlainBytes); except Exit(False); end; Result := True; end; -
Definition [MAIN_DB] is not found in []
ertank replied to ertank's topic in MARS-Curiosity REST Library
I used templates from scratch and it worked just fine. I could not find what was wrong though. Thanks. -
example of multi-part form containing headers, body (parameters) and a file to upload
ertank replied to Brian Culverwell's topic in ICS - Internet Component Suite
Can you share some code that fails? With exact error message you receive? Thanks. Ertan -
SOAP - How to read incoming data when content type text/html
ertank posted a topic in Network, Cloud and Web
Hello, There is an application that consumes a SOAP web service. From time to time this web service is not stable and sending various html error messages instead of a valid response. Using Delphi 10.4.2 I would like to read incoming html data and display this to the user. Currently, all we can display is "Received content of invalid Content-Type setting: text/html - SOAP expect "text/xml" error message. I have searched the internet. Someone suggested to modify Soap.SOAPHTTPTrans.THTTPReqResp.CheckContentType and prevent it from raising an exception but this does not sound like a decent solution and might cause other troubles with other applications using SOAP. What I am after is a solution to be used just with this specific application of ours. I wonder if there is an alternative solution that can be used. Thanks & Regards, Ertan -
Hello, I am using Delphi 10.4.2. There is a type library that can be accessed using COM. I can import it and use some parts like login, disconnect, version. There are other parts to do database operations and it seems Delphi has problems using those parts of it. 1- No interface retrieved var LQuery: IQuery; begin LQuery := FMainConnection.NewQuery(); // Here LQuery still remains as nil end; 2- Access Violation var LInvoice: IData; LInvoiceLines: ILines ATime: OleVariant; begin LInvoice := FMainConnection.NewDataObject(doSalesInvoice); try LInvoice.New(); LInvoice.DataFields.FieldByName('TYPE').Value := 8; LInvoice.DataFields.FieldByName('NUMBER').Value := 'L0129002'; LInvoice.DataFields.FieldByName('DOC_NUMBER').Value := 'L0129002'; LInvoice.DataFields.FieldByName('AUXIL_CODE').Value := 'AUTO'; LInvoice.DataFields.FieldByName('DATE').Value := '29.01.2022'; FMainConnection.PackTime(12, 12, 12, ATime); LInvoice.DataFields.FieldByName('TIME').Value := ATime; LInvoice.DataFields.FieldByName('ARP-CODE').Value := '320.01.002'; // Here Access Violation raises LInvoiceLines := LInvoice.DataFields.FieldByName('TRANSACTIONS').Lines; However, If I try all of these using Visual Studio C#.NET, everything works. Since this is COM object, codes on both Visual Studio and Delphi are almost identical. Both Delphi and Visual Studio installed on my development computer. They are using same Type Library, same dll files and it is only Delphi fails to use its parts. I wonder if there is some catch to do with Delphi to fix such problems as I am not experienced much using type libraries. Any help is appreciated. Thanks & Regards, Ertan
-
It is a shame that I did not see that at all. Changing into ARP_CODE and there is no access violation on that line. Thanks. However, when I try to post an invoice, now I get "Catastrophic failure" error. Below is the final state of my test code. It works down to LInvoice.Post() I compared code with C# working code. Price, Code, quantity etc assigned are identical. They are test values anyway. LInvoice := FComConnection.NewDataObject(doSalesInvoice); try LInvoice.New(); LInvoice.DataFields.FieldByName('TYPE').Value := 8; LInvoice.DataFields.FieldByName('NUMBER').Value := '~'; LInvoice.DataFields.FieldByName('DATE').Value := '29.01.2022'; FComConnection.PackTime(12, 12, 12, LTime); LInvoice.DataFields.FieldByName('TIME').Value := LTime; LInvoice.DataFields.FieldByName('ARP_CODE').Value := '320.01.002'; LInvoiceLines := LInvoice.DataFields.FieldByName('TRANSACTIONS').Lines; LInvoiceLines.AppendLine(); LInvoiceLines[I].FieldByName('TYPE').Value := 0; LInvoiceLines[I].FieldByName('MASTER_CODE').Value := 'M.01.003'; LInvoiceLines[I].FieldByName('QUANTITY').Value := 5.5 + I; LInvoiceLines[I].FieldByName('PRICE').Value := 3.5 + I; LInvoiceLines[I].FieldByName('VAT_RATE').Value := 8; LInvoiceLines[I].FieldByName('UNIT_CODE').Value := 'KG'; if not LInvoice.Post() then // <--- Here Catastrophic failure begin if LInvoice.ErrorCode <> 0 then begin FLog.LogError('Cannot post invoice: ' + IntToStr(LInvoice.ErrorCode) + ', ' + LInvoice.ErrorDesc); Exit(); end; end; FLog.LogInfo('Internal reference: ' + LInvoice.DataFields.FieldByName('INTERNAL_REFERENCE').Value); Code is actually in try..except block, "Catastrophic error" is catched in except and logged. But I did not include it here IQuery is an interface from the COM library, yes. Below part is what I see in TLB file for IQuery. I can share whole TLB it in private message if you would like to look at different parts of it. It is almost 10k lines. // Initial definition IQuery = interface; // another line Query = IQuery; // function definition inside COM main interface function NewQuery: IQuery; safecall; // *********************************************************************// // Interface: IQuery // Flags: (4416) Dual OleAutomation Dispatchable // GUID: {3A1DB335-35DB-463B-AF5C-6BA2B143E65A} // *********************************************************************// IQuery = interface(IDispatch) ['{3A1DB335-35DB-463B-AF5C-6BA2B143E65A}'] function Get_name: WideString; safecall; procedure Set_name(const Value: WideString); safecall; function Get_Statement: WideString; safecall; procedure Set_Statement(const Value: WideString); safecall; function Get_Error: Integer; safecall; function Get_QueryFields: IQueryFields; safecall; function FieldByName(const fieldName: WideString): IQueryField; safecall; function Execute: WordBool; safecall; function OpenDirect: WordBool; safecall; procedure Close; safecall; function First: WordBool; safecall; function Next: WordBool; safecall; function Previous: WordBool; safecall; function Last: WordBool; safecall; function Get_SQLClause: ISQLClause; safecall; function GetDateString(ADate: TDateTime): WideString; safecall; function Get_DBErrorDesc: WideString; safecall; property name: WideString read Get_name write Set_name; property Statement: WideString read Get_Statement write Set_Statement; property Error: Integer read Get_Error; property QueryFields: IQueryFields read Get_QueryFields; property SQLClause: ISQLClause read Get_SQLClause; property DBErrorDesc: WideString read Get_DBErrorDesc; end; I doubt FMainConnection (now FComConnection) setting is wrong as I can do some other operations using it. Login, Disconnect, GetVersion, LastError, LastErrorString, GetTablename etc. But, it is a fact that I could not see that "hyphen" and "underscore" thing for a couple of days. Thanks & Regards, Ertan
-
Hello, My installation is directly open to the internet. Is it possible to identify incoming remote IPv4 numbers in MARS? Additionally, is it possible to allow permission to a method only for a specific IPv4 number? Thanks & Regards, Ertan