FredS
-
Content Count
408 -
Joined
-
Last visited
-
Days Won
4
Posts posted by FredS
-
-
2 hours ago, Silver Black said:but it's not a new bug
Wasn't there in 10.3, so new to me with 10.3.1.
-
4 minutes ago, Stéphane Wierzbicki said:Is this with the new update?
Yup.
-
-
4 hours ago, Rollo62 said:Record destructors are a brand new feature sind 10.3 Rio.
This was about Record class destructors.
-
-
8 hours ago, Rudy Velthuis said:On 1/31/2019 at 7:15 PM, FredS said:At that point just change to a class.
Why?
To use the Class Destructor for cleanup.
-
For this I would simply use a Class Helper to separate the UI logic.
-
1 hour ago, Mike Torrettinni said:I don't really have the typical need for them
Fine for Global vars as long as you don't need to finalize. At that point just change to a class.
Pretty sure you don't actually want Global Instance data.. more like a snack without the preparation and cleanup 🙂//MMWIN:CLASSCOPY unit _MM_Copy_Buffer_; interface type TGlobal = record class var Id : Integer; RecName : string; Values : TArray<TValue>; class constructor Create; private class function GetNewProperty: Integer; static; class procedure SetNewProperty(const Value: Integer); static; public class property NewProperty: Integer read GetNewProperty write SetNewProperty; end; implementation class constructor TGlobal.Create; begin inherited; // TODO -cMM: TGlobal.Create default body inserted end; class function TGlobal.GetNewProperty: Integer; begin // TODO -cMM: TGlobal.GetNewProperty default body inserted Result := ; end; class procedure TGlobal.SetNewProperty(const Value: Integer); begin // TODO -cMM: TGlobal.SetNewProperty default body inserted end; end.
- 1
-
On 1/17/2019 at 1:17 AM, microtronx said:function my_RegExReplace(const Match: TMatch😞 string;
Certainly not executable code, you're using that function as input but never supply a TMatch parameter..
-
49 minutes ago, Ian Branch said:All very confusing
Try:
LTips := ChangeFileExt(Application.ExeName, '.Tips');
-
The format is \\<server>\<share>\<path>
Admin shares can be accessed with <drive letter>$.
After taking a closer look at what you are doing, why would 'c:' be a valid path inside a share?
-
OK,
sAppName := '\\192.168.1.35\F-TestServer\C:\TestArea\Testfile.Tips';
should be
sAppName := '\\192.168.1.35\F-TestServer\C$\TestArea\Testfile.Tips';
-
Some very old versions of Delphi had this issue, simple fix was to use:
function MyFileExits(FileName: string): boolean; var SearchRec: TSearchRec; begin if (FindFirst(FileName, faAnyFile, SearchRec) = 0) then begin SysUtils.FindClose(SearchRec); Result := True; end else Result := False; end;
-
On 1/2/2019 at 7:45 PM, pyscripter said:in Rio it seems to work OK
Modified your code to get a better look at the difference.
Both Executed in Berlin 10.1.2
Ideally #1 should reach a higher WorkerThreadCount during its two minutes of execution but still the same with Rio.#3 may be an issue (also in Rio), imagine running a pile of low intensity tasks first then executing something that loads Data Modules, Databases and whatnot.. starting at the same count you left off could cause out of memory issues unless dealt with (not tested).
#4 IMO is handled better in Berlin, the AverageCPUUsage delegates the Pool to drop below MinLimitWorkerThreadCount.
** RIO System.Threading unit, modified to compile in Berlin
#1 Slow increase, never reached full ActiveTask Count
00:02:13.8790372
AverageCPUUsage: 35
WorkerThreadCount: 34
MinLimitWorkerThreadCount: 4#2 Increased to 58 immediately, holds appropriate AverageCPUUsage
00:01:11.9777749
AverageCPUUsage: 90
WorkerThreadCount: 58
MinLimitWorkerThreadCount: 50#3 Starts off with #2 WorkerThreadCount and holds appropriate AverageCPUUsage
00:01:11.8997475
AverageCPUUsage: 89
WorkerThreadCount: 58
MinLimitWorkerThreadCount: 4#4 Does NOT hold appropriate AverageCPUUsage
00:01:35.0015869
AverageCPUUsage: 100
WorkerThreadCount: 99
MinLimitWorkerThreadCount: 99** Berlin System.Threading unit, modified with RSP fixes only
#1 Slow increase, never reached full ActiveTask Count
00:02:13.9110588
AverageCPUUsage: 34
WorkerThreadCount: 34
MinLimitWorkerThreadCount: 4#2 Increased to 58 immediately, holds appropriate AverageCPUUsage
00:01:11.4247095
AverageCPUUsage: 89
WorkerThreadCount: 59
MinLimitWorkerThreadCount: 50
#3 Starts off with #2 WorkerThreadCount and holds appropriate AverageCPUUsage
00:01:11.6894449
AverageCPUUsage: 88
WorkerThreadCount: 59
MinLimitWorkerThreadCount: 4
#4 Drops appropriately below MinLimitWorkerThreadCount to keep AverageCPUUsage
00:01:21.0234632
AverageCPUUsage: 88
WorkerThreadCount: 78
MinLimitWorkerThreadCount: 99program Project2; {$APPTYPE CONSOLE} uses WinApi.Windows, System.SysUtils, System.Diagnostics, System.Threading, System.Classes, System.TimeSpan; var SW : TStopWatch; ActiveTasksTicks : Int64; const SleepMs = 100; SleepCycles = 333; HighPrime = 100 * 1000; function IsPrime(const Value: Integer): Boolean; {$REGION 'History'} // 18-Jul-2018 - From a Parallel Task example {$ENDREGION} var Test, k: Integer; begin if Value <= 3 then IsPrime := Value > 1 else if ((Value mod 2) = 0) or ((Value mod 3) = 0) then IsPrime := False else begin IsPrime := True; k := Trunc(Sqrt(Value)); Test := 5; while Test <= k do begin if ((Value mod Test) = 0) or ((Value mod (Test + 2)) = 0) then begin IsPrime := False; break; { jump out of the for loop } end; Test := Test + 6; end; end; end; procedure TestParallel; var TaskArray: array [1..100] of ITask; Ticks : Int64; i : integer; begin for I := Low(TaskArray) to High(TaskArray) do TaskArray[I] := TTask.Create(procedure var s, p: integer; Succeeded : Boolean; {* GetActiveTasks *} function GetActiveTasks: integer; var i : integer; begin Result := 0; for i := Low(TaskArray) to High(TaskArray) do if (TaskArray[i].Status = System.Threading.TTaskStatus.Running) then begin Inc(Result); end; end; begin for s := 1 to SleepCycles do begin Ticks := ActiveTasksTicks; if (Ticks + TTimeSpan.TicksPerSecond) < SW.ElapsedTicks then begin System.AtomicCmpExchange(ActiveTasksTicks, SW.ElapsedTicks, Ticks, Succeeded); if Succeeded then begin Write(#13 + Format('ActiveTasks: %3.d, CPU: %3.d%%', [GetActiveTasks, TThreadPoolStats.Current.CurrentCPUUsage])); end; end; Sleep(SleepMs); for p := 1 to HighPrime do isPrime(p); end end).Start; TTask.WaitForAll(TaskArray); end; procedure TestTasks(AMinWorkerThreads : integer); var TPS : TThreadPoolStats; begin ActiveTasksTicks := 0; SW := TStopWatch.StartNew; TThreadPool.Default.SetMinWorkerThreads(AMinWorkerThreads); TestParallel; Write(#13 + StringOfChar(' ', 72)); WriteLn(#13 + SW.Elapsed.ToString); TPS := TThreadPoolStats.Default; WriteLn('AverageCPUUsage: ', TPS.AverageCPUUsage); WriteLn('WorkerThreadCount: ', TPS.WorkerThreadCount); WriteLn('MinLimitWorkerThreadCount: ', TPS.MinLimitWorkerThreadCount); WriteLn; end; begin TestTasks(TThread.ProcessorCount); TestTasks(50); TestTasks(TThread.ProcessorCount); TestTasks(99); ReadLn; end.
-
-
44 minutes ago, DelphiMT said:Most of these issues were reported during the beta phase
Same as before..
I see a bunch of bugs that occur on every first release of a new version, so no way is any of that run through any kind of testing.
- Throughout the year bugs reported outstrip bugs solved by anywhere from 5-8:1
- As was explained by another poster, we don't know the actual bugs on the internal system. Yet have become Alpha testers for new releases. Obediently posting bugs that where posted before because of internal testing failure.
- With the CE edition new releases are quickly evaluated and bugs are reported, my bet is that by the 30 day mark we will be close to equal on this chart: 30 Day Summary
- The thing is, there are some brilliant Delphi users, and when your read some of those Quality Central reports they come with ways to reproduce and in some cases needed code changes.. yet aren't implemented, sometimes for years..
Draw your own conclusion, your mileage may vary..
-
1 hour ago, Uwe Raabe said:Probably because that is what the customers see and work with
Nothing like a little 'Lipstick' 🙂
-
2 hours ago, Luis Madaleno said:every release is the same old thing
Sure, but your clients will understand that the most important part of developing is the new skins 🙂
- 2
-
-
On 11/23/2018 at 12:43 PM, Erix A. said:IDE is slower than 10.2.3.
That whole scenario becomes unusable if you RDP into a VM.. essentially they broke something that was working instead of fixing stuff that's been broken for years..
-
1 hour ago, Tom F said:Has the migration tool EVER worked for you?
Never, I use Beyond Compare, hook up to both registry trees and copy/merge at will. BC even allows me to alter the paths after I copy.
Been using that since Seattle.- 2
- 2
-
7 hours ago, Kryvich said:Can not find CodeSiteExpressPkg260.bpl. Forgot to include in the installation?
Removing the package via 'Component>Install Packages' then adding it back worked for me.
-
15 minutes ago, Uwe Raabe said:I simply see it as a way to make things work smoothly for me
Fair enough, of course Berlin works fine, at least after implementing a 'Clean' strategy I stumbled upon.
-
13 minutes ago, Uwe Raabe said:It is more a mixture of convenience and shortsightedness.
Normally I just leave things as they are because pushing a string gets really boring.
But in this case I'd like to clear a couple of things up, perhaps I'm not grasping the 'whole'..
-
Other than a few milliseconds lost by the compiler, is there any penalty in the final code?
Because I can't time it, I have spent a bit of effort on that and I see no issues. -
If that is the case then this whole cyclical issue falls right along with using 'with' doesn't it ?
I mean try and get a DX based project out the door without using 'with'.. -
We can't really have interface cyclical units because the compiler barks, yet we can't have implementation cyclical units because of CodeInsight?
What came first cyclical re-engineering cult or CodeInsight not working?
-
Other than a few milliseconds lost by the compiler, is there any penalty in the final code?
How to replace whole words in a string
in General Help
Posted
The code below will return: 'yes, yes.def'