-
Content Count
602 -
Joined
-
Last visited
-
Days Won
7
Everything posted by Tommi Prami
-
OpenFolderAndSelectFiles Open Widnwos Axplorer and select files
Tommi Prami posted a topic in Windows API
Only saw examples at online to select one file in explorer, and thought maybe someone else can also benefit from version that selects multiple files. Or harden this one if needed, -Tee- function OpenFolderAndSelectFiles(const AFileNames: TStringList): Boolean; procedure CheckFilesHaveSameRoot(const AFileNames: TStringList); var I: Integer; LDirectory: string; begin LDirectory := ExtractFilePath(AFileNames[0]); for I := 1 to AFileNames.Count - 1 do if not SameText(LDirectory, ExtractFilePath(AFileNames[I])) then raise EFileNotFoundException.CreateFmt('File "%s" is not in common root "%s"', [AFileNames[I], LDirectory]); end; var LDirectory: string; LPDirectoryItemID: PItemIDList; I: Integer; LFileArray: TArray<PItemIDList>; LDidInitCOM: Boolean; LAPIResult: HResult; begin CheckFilesHaveSameRoot(AFileNames); Result := False; LDidInitCOM := False; LDirectory := ExtractFilePath(AFileNames[0]); LPDirectoryItemID := ILCreateFromPath(PChar(LDirectory)); if Assigned(LPDirectoryItemID) then try SetLength(LFileArray, AFileNames.Count); for I := 0 to AFileNames.Count - 1 do LFileArray[I] := ILCreateFromPath(PChar(AFileNames[I])); while True do begin LAPIResult := SHOpenFolderAndSelectItems(LPDirectoryItemID, AFileNames.Count, @LFileArray[0], 0); if LAPIResult = CO_E_NOTINITIALIZED then begin LDidInitCOM := Succeeded(CoInitialize(nil)); if not LDidInitCOM then raise Exception.Create('Could not initialize COM'); end else Break; end; Result := LAPIResult = S_OK; finally ILFree(LPDirectoryItemID); for I := 1 to AFileNames.Count - 1 do ILFree(LFileArray[I]); if LDidInitCOM then CoUninitialize; end; end; -
That is different use case. I would like to make something hobby stuff, not just evaluate. Maybe better to use some open Source Variants. That's why I would be happy to pay some, let's say 50€, but 150€ for something I am just interested in, and maybe never ever finnish, is too much. And would never make money from it or publish. Could someone list what are out there (Orm solutions or something close to that): - mORMot - DelphiMVC ...
-
That is not even close accurate analogy. If I go to restaurant, there is free meal and normal paid meal, I suggest restaurant, if I pay only little of the regular meal as i only will eat just a some portion of it. And even that restaurant analogy is plain stupid, cause this is about having reduced price if not used to make money which is the point of full licence, it allows you to make money with it. As same way that there is community edition of Delphi, which is super smart. If you like to tinker with it, it is free, but not an cripple ware.
-
How is so, I just suggested that I would not want to use FREE version and would like instead to PAY something.
-
No Source code so quite different thing, and no support so difficult to investigate why something doesn't work as expected. I would rather pay little to get non commercial use license. -Tee-
-
Would be nice of Component vendors had also licence for non commercial use, I would pay something, but not full price if I just want to tinker something at home. -Tee-
-
Design Packages list is not resizable
Tommi Prami replied to PeterPanettone's topic in Delphi IDE and APIs
That windows desperately needs an filtering, it is very hard to find stuff from it. Adn sometimes important info is not at beginning nor end of the line. -
Problem with Form/Window Caption on HIGH DPI, Delphi 10.3 and VCLStyles SKIN
Tommi Prami replied to ivancx's topic in VCL
If got link to Bugreport, would be more than willing to vote. -Tee- -
Is there GIS library for delphi (Free or very cheap)
Tommi Prami posted a topic in Delphi Third-Party
Just to tinker as hobby at home. Would not like to learn some other language to do some tinkering at home as hobby (et this point) -Tee- -
https://quality.embarcadero.com/browse/RSP-23624 -Tee-
-
If got an code : uses Winapi.msxml, Winapi.MSXMLIntf; procedure TForm10.Button1Click(Sender: TObject); var LDocument: IXMLDomDocument3; LCurrrentValueNode: IXMLDOMNode; LNodeList: IXMLDOMNodeList; I: Integer; begin LDocument := CoDOMDocument60.Create; LDocument.async := False; LDocument.validateOnParse := False; LDocument.ResolveExternals := False; LDocument.PreserveWhiteSpace := True; LDocument.loadXML(Memo1.Lines.Text); if LDocument.parseError.errorCode <> 0 then raise Exception.CreateFmt('XML parsing error : %s at row %d position %d', [LDocument.parseError.reason, LDocument.parseError.Line, LDocument.parseError.linepos]); if Assigned(LDocument.documentElement) then LNodeList := LDocument.documentElement.getElementsByTagName('IBAN') else LNodeList := LDocument.getElementsByTagName('IBAN'); for I := 0 to LNodeList.Length - 1 do begin LCurrrentValueNode := LNodeList.Item[I]; Memo2.Lines.Add(LCurrrentValueNode.nodeValue); end; repeat LCurrrentValueNode := LNodeList.nextNode; if Assigned(LCurrrentValueNode) then Memo2.Lines.Add(LCurrrentValueNode.nodeValue) else Break; until True; end; and XML <?xml version="1.0" encoding="UTF-8"?> <Document xmlns="urn:iso:std:iso:20022:tech:xsd:camt.053.001.02"> <BkToCstmrStmt> <Stmt> <Acct> <Id> <IBAN>FI0434270410003403</IBAN> </Id> </Acct> </Stmt> <Stmt> <Acct> <Id> <IBAN>FI7542316072000169</IBAN> </Id> </Acct> </Stmt> </BkToCstmrStmt> </Document> Any idea why getElementsByTagName doews not return Tags it should (I think). Once you're set to do something pretty simple and nothing works. I remember now why I do not enjoy the M$Xml too much. Also if you can recommend better replacement XML libraries, feel free to do so.
-
(I use 10.3.1) If got an code : uses Winapi.msxml, Winapi.MSXMLIntf; procedure TForm10.Button1Click(Sender: TObject); var LDocument: IXMLDomDocument3; LCurrrentValueNode: IXMLDOMNode; LNodeList: IXMLDOMNodeList; I: Integer; begin LDocument := CoDOMDocument60.Create; LDocument.async := False; LDocument.validateOnParse := False; LDocument.ResolveExternals := False; LDocument.PreserveWhiteSpace := True; LDocument.loadXML(Memo1.Lines.Text); if LDocument.parseError.errorCode <> 0 then raise Exception.CreateFmt('XML parsing error : %s at row %d position %d', [LDocument.parseError.reason, LDocument.parseError.Line, LDocument.parseError.linepos]); if Assigned(LDocument.documentElement) then LNodeList := LDocument.documentElement.getElementsByTagName('IBAN') else LNodeList := LDocument.getElementsByTagName('IBAN'); for I := 0 to LNodeList.Length - 1 do begin LCurrrentValueNode := LNodeList.Item[I]; Memo2.Lines.Add(LCurrrentValueNode.nodeValue); end; repeat LCurrrentValueNode := LNodeList.nextNode; if Assigned(LCurrrentValueNode) then Memo2.Lines.Add(LCurrrentValueNode.nodeValue) else Break; until True; end; and XML <?xml version="1.0" encoding="UTF-8"?> <Document xmlns="urn:iso:std:iso:20022:tech:xsd:camt.053.001.02"> <BkToCstmrStmt> <Stmt> <Acct> <Id> <IBAN>FI0434270410003403</IBAN> </Id> </Acct> </Stmt> <Stmt> <Acct> <Id> <IBAN>FI7542316072000169</IBAN> </Id> </Acct> </Stmt> </BkToCstmrStmt> </Document> Any idea why getElementsByTagName does not return Tags it should (I think). Once you're set to do something pretty simple and nothing works. I remember now why I do not enjoy the M$Xml too much. Also if you can recommend better replacement XML libraries, feel free to do so.
-
Trouble with (very) simple XML-parsing
Tommi Prami replied to Tommi Prami's topic in RTL and Delphi Object Pascal
Did test with Xml.XMLIntf.pas IXMLDocument also. OmniXML as vendor or not. Made own recursive routine, based on OmniXML implementation, it'll find nodes just fine, but not node Values, which seems to be super weird. function GetElementsByTagName(const ADocumentElement: IDOMElement; const AElementName: string): TList<IDOMNode>; procedure InternalGetElementsByTagName(const ANode: IDOMNode; const AElementName: string; const ANodeList: TList<IDOMNode>); var I: Integer; LChildNode: IDOMNode; begin if ANode.HasChildNodes then for I := 0 to ANode.ChildNodes.Length - 1 do begin LChildNode := ANode.ChildNodes.Item[I]; if (LChildNode.NodeType = ELEMENT_NODE) and ((LChildNode as IDOMElement).NodeName = AElementName) then ANodeList.Add(LChildNode); InternalGetElementsByTagName(LChildNode, AElementName, ANodeList); end; end; begin Result := TList<IDOMNode>.Create; InternalGetElementsByTagName(ADocumentElement, AElementName, Result); end; -
Trouble with (very) simple XML-parsing
Tommi Prami replied to Tommi Prami's topic in RTL and Delphi Object Pascal
First test was there just to get an idea is there one and which it'll use. IT seems to depend on something. Done so many tests so can't really give specifics on that. At least that xpath down work, because structure of XML is not always same. It has to be more structure agnostic. -
Trouble with (very) simple XML-parsing
Tommi Prami replied to Tommi Prami's topic in RTL and Delphi Object Pascal
At least all the documentation I've found tells that it should. find others also. m$xml docs and also more generic DOM ones. What ever is the implementation is totally different story. -Tee- -
Trouble with (very) simple XML-parsing
Tommi Prami replied to Tommi Prami's topic in RTL and Delphi Object Pascal
With OmniXML dom I got slightly closer procedure TForm10.Button2Click(Sender: TObject); var LXMlDocument: IXMLDocument; LDomList: IDOMNodeList; LValueNode: IDOMNode; I: Integer; begin DefaultDOMVendor := sOmniXmlVendor; LXMlDocument := LoadXMLData(Memo1.Lines.Text); LDomList := LXMlDocument.DOMDocument.documentElement.getElementsByTagName(TAG_IBAN); for I := 0 to LDomList.length - 1 do begin LValueNode := LDomList[I]; Memo2.Lines.Add(LValueNode.nodeName + ': ' + LValueNode.nodeValue); end; end; it find the tags, but nodeValue returns empty. -Tee- -
Wrong Group... Sorry
-
Please don't hijack the conversation to offtopic.
-
Current 24" monitor with 1920x1200 has DPI/PPI (what ever) that makes most of the default fonts, like in Delphi ide too small (for me). Solutions I can think of Monitor with lower DPI but not smaller resolution (Cause now the desktop size is pretty limited). But all larger monitor seems to be 4K Way to change IDE font(s) to larger, not just code, which I use now size 12, but it gives me already just barely room horizontally to see code. Get large 4K display (if can) and raise DPI from windows. but at least previously et opened kind of can of worms. Delphi really should normalize the dfm always to the native 96 DPI, so it would be consistent and easy to compare. Is that a problem, are there teams that coders use different DPI? And if problems, does it really matter? Am I missing some obvious solution, than Quitting my job and move into wilderness, away from all the technology?
-
"Our current LTS release is 1.0.2, and it will be supported until the end of 2019." Seems that 1.0.x is close at its end of life. -Tee-
-
Lockfree approach on a Single reader, Multiple Writer queue
Tommi Prami replied to kokoslolos's topic in Algorithms, Data Structures and Class Design
My experience is that, if you are unlucky, bugs can lurk in multithreaded code way longer than in single threaded code. I have encountered (own and others) code, even single threaded, that should never have worked, but for reason or other, it always has been. Until it'll present it self in worst possible, time, place and way :D -Tee- -
Added: -x-fpr generates 3 times faster stack memory page probing code (RSP-19826) Added: Options -x-O1, -x-O2, -x-O3, -x-Ox that enable other optimization options More info.... Hope these optimizations would come to Delphi compiler directly. https://andy.jgknet.de/blog/2017/10/ide-fix-pack-6-1-released/ https://andy.jgknet.de/blog/2018/06/ide-fix-pack-6-3-released/
-
Solution(s) for coder with quite poor eyesight
Tommi Prami replied to Tommi Prami's topic in Delphi IDE and APIs
As stated above, using other Dpi than 100% is not good. Because it'll affect into Dfm-files. And you just can't know is there true changes between two, if edited with environments with different Dpi. If Delphi woulöd normalize the dfm into 100% font sizes, and Form editor would be totally Dpi agnostic, at design time, it would be way easier to work in a team with different Dpi environments, -Tee- -
Solution(s) for coder with quite poor eyesight
Tommi Prami replied to Tommi Prami's topic in Delphi IDE and APIs
How sharp was the text in that situation? -Tee- -
Solution(s) for coder with quite poor eyesight
Tommi Prami replied to Tommi Prami's topic in Delphi IDE and APIs
Any models available for those specs... That would be better than nothing. Not more desktop area tough. -Tee-