bernhard_LA
Members-
Content Count
18 -
Joined
-
Last visited
Everything posted by bernhard_LA
-
I need a solution to replace the shellexecute command for the windows platform If possible no external / 3rd party lib involved Can someone provide a working code here ?
-
I use DELPHI 10.3, my current - default installation of DUNITX seems to be incomplete, because I need to uncomment several units? what is the next step : a) ignore because some test projects are working ? b) install again from git, any instruction how to update installation program N_TESTS_VCLGUIAPP; {$R *.res} uses Vcl.Forms, System.SysUtils, // DUnitX.Examples.General, // DUnitX.Loggers.Text, DUnitX.Loggers.XML.NUnit, // DUnitX.Loggers.XML.xUnit, // DUnitX.MacOS.Console, DUnitX.Test, DUnitX.TestFixture, DUnitX.TestFramework, DUnitX.TestResult, DUnitX.RunResults, DUnitX.TestRunner, DUnitX.Utils, // DUnitX.Utils.XML, DUnitX.WeakReference, DUnitX.Windows.Console, // DUnitX.StackTrace.EurekaLog7, // DUnitX.Examples.EqualityAsserts, DUnitX.Loggers.Null, DUnitX.MemoryLeakMonitor.Default, DUnitX.AutoDetect.Console, DUnitX.ConsoleWriter.Base, // DUnitX.DUnitCompatibility, DUnitX.Extensibility, DUnitX.Extensibility.PluginManager, DUnitX.FixtureProviderPlugin, DUnitX.FixtureResult, DUnitX.Generics, DUnitX.InternalInterfaces, DUnitX.IoC, DUnitX.Loggers.Console, DUnitX.CommandLine.OptionDef, DUnitX.CommandLine.Options, DUnitX.CommandLine.Parser, DUnitX.OptionsDefinition, DUnitX.Banner, DUnitX.FilterBuilder, DUnitX.Filters, DUnitX.CategoryExpression, DUnitX.TestNameParser, DUnitX.Loggers.GUI.VCL, // DUnitX.Examples.AssertFailureCompare, DUnitX.Timeout, DUnitX.Exceptions, DUnitX.ResStrs, // DUnitX.Examples.UITest, ......... ; begin Application.Initialize; Application.Title := 'DUnitX'; Application.CreateForm(TGUIVCLTestRunner, GUIVCLTestRunner); Application.Run; end.
-
StrToFloat () all combinations of decimal separator and lang. settings
bernhard_LA posted a topic in Algorithms, Data Structures and Class Design
need a good and flexible solution to convert string to floats the string can be 1,99 vs. 1.99 the OS can be german or english or .... not working code goes like this :-( internalFormatSettings := TFormatSettings.Invariant(); Result := StrToFloat(FloatStr, internalFormatSettings); -
selected cell in a stringgrid FMX vs. VCL
bernhard_LA posted a topic in Algorithms, Data Structures and Class Design
in VCL I can get the selected cell with the Selection property. In FMX this property does not exist. how to change this code for FMX? aStatusBar.SimpleText := 'selected cell -> ' + strngrd_Point3D.Selection.Top.ToString + '/' + strngrd_Point3D.Selection.Left.ToString; -
what is the best method to convert a double value back into a real data type ? var x : double ; y : real ; y: = x ; what are the risk's ?
-
Adding libraries to a Python embedded installation
bernhard_LA replied to marcocir's topic in Python4Delphi
can you execute matplotlib code if you use you /python folder and python.exe inside this folder? how are you setting the reference to pythonDLL and pythonDLL path in your application? I followed the config of Tpythonengine from here .... because different PC's have many different python settings / also drives me crazy ... to get one application running on different CPUs. did not want to go for my own python installation to be distributed with my application ..... -
you need to download and install python4delphi components https://github.com/pyscripter/python4delphi there are many samples for start up
-
tkinter failure during execution of python script on linux
bernhard_LA posted a topic in Python4Delphi
I try to run that simple python script with my app using python4delphi components import matplotlib.pyplot as plt import numpy as np x = np.arange(0,4*np.pi,0.1) # start,stop,step y = np.sin(x) plt.plot(x,y) plt.show() compiling and execution of my app for windows is no problem , the LINUX version failed this failure ...... import _tkinter # If this fails your Python may not be configured for Tk ValueError: character U+68002f is not in range [U+0000; U+10ffff .... Error is EPyValure Error with above code -
I must convert a dunit project to a dunixX project, the following code does not compile any longer , how to include dunit leak checks into dunitX ? procedure TestClass_MemoryLeaks.Test_..........h; begin try G := TGraph<Char>.Create(normal_directed); GraphTestData(G); G.AddEdge...... finally G.Free; self.CheckTrue(not(self.GetFailsOnMemoryLeak), 'Failed on memory leak when Adding Repeated Edge on Directed Graph'); end; end;
-
open question : unit DUnitX.MemoryLeakMonitor.LeakCheck does not compile, because , of missimg include file {$I DUnitX.inc} where to get this file ?
-
thanks for this hint, in addition I found : https://medium.com/@Zawuza/delphi-leakcheck-2242270ef42d My dunitX installation does not come with a file DUnitX.MemoryLeakMonitor.LeakCheck , you need to copy from https://bitbucket.org/shadow_cs/delphi-leakcheck/src/master/External/DUnitX/ to this folder .....
-
following the samples from http://delphiprogrammingdiary.blogspot.com/2018/09/introducing-dunitx-new-unit-test.html we created now also 2 different delphi projects *.dpr for each test a) the consoleAPP for automatic execution within JENKINS and CI b) the VCLGUI app for debugging of our testcases we include the testcas.pas file inside both projects Q1 : any known issue while sharing the test case class (*.pas) between VCLGUI app and console APP ? Q2 : how to separate or select different test cases? we have test cases with a very short execution time ( below 1 min) and some with a very long execution time (several hours) if I could select the individual testcase via the GUI, this would help, I don' want to create a third App for the long test cases ....
-
Load a String from a file - returns strange char set
bernhard_LA posted a topic in Algorithms, Data Structures and Class Design
I'm almost sure that I already used the code below without any issues in previous application. Now a added this to a new app and dumped the Loadstring variable into a memo with memo.lines.add ( Loadstring ) ; All text is now displayed using chines char's , the file I#m reading for sure is ASCII and only latin chars ..... What went wrong ? var LoadString: AnsiString; FS: TFileStream; begin FS := TFileStream.Create(FileName, fmOpenRead or fmShareDenyNone); try SetLength(LoadString, (FS.Size div SizeOf(Char))); if FS.Size > 0 then FS.Read(Pointer(LoadString)^, FS.Size); finally FS.Free ; -
Load a String from a file - returns strange char set
bernhard_LA replied to bernhard_LA's topic in Algorithms, Data Structures and Class Design
thanks for helping - found also my mistake : after change from var LoadString: String; to var LoadString: AnsiString; code is working, with a typecast String(Loadstring) ; but now different issue .... this will now work for compiling under LINUX 😞 -
Basic Wish a) just start a executeable like ./myapplication and pass also command line parameters Advanced Wish b) a notification once the ./myappliaction is finished work around i) any solution using RAD C++ and Linux compile options ?? ii) call a phyton script from Delphi ???? iii) a dll written in Lazarus ?????
-
use indy in a console application
bernhard_LA posted a topic in Algorithms, Data Structures and Class Design
the windows GUI code for a simple INDY 10 tcp demo comes from here : https://github.com/tinydew4/indy-project-demos/tree/master/TCPIP Delphi %26 Indy10 Client Server Demo/1_sample Simple String Exchange I used this code to run the server in a cmd line application, but I fail with the function pointer assignment, what is the correct syntax I need here see the current not working code below program IndyConsoleApp; {$APPTYPE CONSOLE} {$R *.res} uses System.SysUtils, IdContext, IdSync, IdBaseComponent, IdComponent, IdCustomTCPServer, IdTCPServer, IdGlobal; type OnTCPServerExecutefct = procedure (AContext: TIdContext) of Object ; var IdTCPServer1: TIdTCPServer; TCPServerExecutefct : OnTCPServerExecutefct; procedure ShowStartServerdMessage; begin writeln('START SERVER @' + TimeToStr(now)); end; procedure StopStartServerdMessage; begin writeln('STOP SERVER @' + TimeToStr(now)); end; procedure TCPServerExecute(AContext: TIdContext); var LLine: String; begin TIdNotify.NotifyMethod( ShowStartServerdMessage ); // wrong LLine := AContext.Connection.IOHandler.ReadLn(); writeln(LLine); AContext.Connection.IOHandler.WriteLn('OK'); TIdNotify.NotifyMethod( StopStartServerdMessage ); end; begin IdTCPServer1:=TIdTCPServer.Create; try { TODO -oUser -cConsole Main : Insert code here } IdTCPServer1.Bindings.Add.IP := '127.0.0.1'; IdTCPServer1.Bindings.Add.Port := 6000; IdTCPServer1.OnExecute := TCPServerExecute ; /// wrong ! // TCPServerExecutefct:= assign(TCPServerExecute); readln ; except on E: Exception do Writeln(E.ClassName, ': ', E.Message); end; end. -
I want to evaluate the pressed button on a form with this code below, my form (aForm) should have 2 buttons which the property mrOK. If aForm.modalresult = mrOK then begin /// now evaluate which button has been pressed ??? .... .... end; what is the best solution for this issue?
-
best practise sharing : 2 buttons with mrOK on a form
bernhard_LA replied to bernhard_LA's topic in VCL
yes ... added simple integer values to the modalresult property, seems to work now