Jump to content

mvanrijnen

Members
  • Content Count

    492
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by mvanrijnen

  1. mvanrijnen

    read integer value from database, best practice ?

    or use COALESCE In interbase we don't have ISNULL(MyInt, 0) function, but we do have COALESCE which seems to do the same thing ?
  2. mvanrijnen

    LSP - Alexandria

    Did you change "HKEY_CURRENT_USER\Software\Embarcadero\BDS\21.0\LSP" to "HKEY_CURRENT_USER\Software\Embarcadero\BDS\22.0\LSP" ?
  3. mvanrijnen

    read integer value from database, best practice ?

    I have a helper for this kind of stuff (in real the helper contains some more methods : ) : TMyFieldHelper = class helper for TField public function AsIntegerDef(const ADefault : integer) : integer; end; function TMyFieldHelper.AsIntegerDef(const ADefault: integer): integer; begin Result := ADefault; try if (not Self.IsNull) then Result := Self.AsInteger; except {TODO -oOwner -cGeneral : check which to swallow ... } // swallow any exception end; end;
  4. mvanrijnen

    Custom text rendering

    Look impressive ! Especially the zooming looks good.
  5. mvanrijnen

    Enabling One-Click in Delphi 11 Welcome Page

    i already could click them? Ah, see it now πŸ˜‰ Good tip!
  6. mvanrijnen

    RAD Studio 11 Alexandria is now available

    ah full 4k support, time to ask the boss for new monitors πŸ™‚
  7. mvanrijnen

    RAD Studio 11 Alexandria is now available

    Installed it on notebook running Windows 11 Beta. Plain installation went ok, no exception orso, simple test projects are running ok. tomorrow test the codecompletion somewhat more.
  8. mvanrijnen

    Same project different platform base executable

    see also: delphi - XE4: How to change exe output name base on platform? - Stack Overflow
  9. Yes i have had the same, with invoice recognition software i wrote. And then you have the suppliers where the financial formats differ from the "data/content" format. So we had a base setting for the numeric formats per application, per supplier (inherited), per content fields/table (inherited).
  10. mvanrijnen

    Logging from RAD Server

    Somehow inserting code goes wrong sometime, my text of my post disappeared. You just need the EMS.ResourceAPI in your uses and then you can use the TEMSEndPointEnvironment.Instance.LogMessage('your log text'); In debugmode (running your RADServer package from the IDE), the logging goes into the radserver console window, where the radserver itself also logs. We are not in production yet, so i do not know at the moment where the logging goes in a production environment πŸ™‚ I use this in a logging framework, which also can log to file, database etc etc. Did not see the TEMSLoggingService before, have to inspect that, maybe it's the better way to work. [edit, added first code for the emsloggingservice) so, first tryout for the loggingservice: unit .......; interface uses ..... EMS.Services; type THSLoggerRADServerDebugTargetQueue = class(THSLoggerBaseTargetQueue) private femslogsvc : IEMSLoggingService; protected function HandleTargetItem(const AItem: THSLLoggerItem): Boolean; override; public procedure DoBeforeStart; override; procedure DoAfterStop; override; {TODO -oOwner -cGeneral : CheckCanStart wordt helemaal niet aangeroepen ???? } procedure CheckCanStart(var ACanStart: Boolean; var AMessage: string); override; end; implementation uses ....., EMS.ResourceAPI; { THSLoggerRADServerDebugTargetQueue } procedure THSLoggerRADServerDebugTargetQueue.CheckCanStart(var ACanStart: Boolean; var AMessage: string); begin inherited; ACanStart := True; end; procedure THSLoggerRADServerDebugTargetQueue.DoAfterStop; begin femslogsvc := nil; inherited; end; procedure THSLoggerRADServerDebugTargetQueue.DoBeforeStart; begin femslogsvc := nil; inherited; if TEMSServices.TryGetService<IEMSLoggingService>(femslogsvc) then begin if not femslogsvc.LoggingEnabled then begin femslogsvc := nil; end; end; end; function THSLoggerRADServerDebugTargetQueue.HandleTargetItem(const AItem: THSLLoggerItem): Boolean; var obj : TJSONObject; begin inherited; Result := False; try if Assigned(femslogsvc) then begin obj := TJSONObject.Create(); obj.AddPair('user', AItem.UserName); obj.AddPair('computer', AItem.ComputerName); obj.AddPair('datetime', DateToISO8601(AItem.DateTime)); obj.AddPair('message', AItem.LogMessage); obj.AddPair('position', AItem.Position); femslogsvc.Log(AItem.LogType.AsString, obj); end; Result := True; except on e: exception do begin // DebugLog('xx', 'xxxx'); end; end; end; end.
  11. mvanrijnen

    Logging from RAD Server

    unit MyUnit; interface {$IFDEF RADSERVER_PACKAGE} uses ..... EMS.ResourceAPI; type THSLoggerRADServerDebugTargetQueue = class(THSLoggerBaseTargetQueue) protected function HandleTargetItem(const AItem: THSLLoggerItem): Boolean; override; public end; {$ENDIF} implementation {$IFDEF RADSERVER_PACKAGE} { THSLoggerRADServerDebugTargetQueue } function THSLoggerRADServerDebugTargetQueue.HandleTargetItem(const AItem: THSLLoggerItem): Boolean; var line: string; begin inherited; ..... TEMSEndpointEnvironment.Instance.LogMessage(line); .... end; {$ENDIF} end.
  12. mvanrijnen

    Prevent OnClick to be handled twice

    If you want to prevent doubleclicking by users who still don't know the difference between single and double click (yes, they are still around, we have some overhere πŸ™‚ ), we use a simple trick. (Yelling to the users don't work πŸ™‚ ) You set a timer on enabled in the onclick, something like (at start of program you set the interval to like 250 orso,). not a beauty, but it works here. (not exact code we use, but similar just out of the head): const CNST_PREVEN_DOUBLECLICK_INTERVAL_MSECS = 250; procedure TForm1.Button1Click(Sender : TObject); begin if not Button1Timer.Enabled then begin Button1Timer.Interval := CNST_PREVEN_DOUBLECLICK_INTERVAL_MSECS; Button1Timer.Enabled := True; DoButton1Code(); end; end; procedure TForm1.Button1TimerTimer(Sender : TObject); begin Botton1Timer.Enabled := False; end; [/code] maybe just use a "global" var, to remember lasttime clicked, and compare msecs to that could also be possible.
  13. mvanrijnen

    TPopupMenu with group headers

    Isn't that why we have submenus ? (although they are an extra click away).
  14. mvanrijnen

    upcoming language enhancements?

    The classic code is unusable in big projects with many lines of sourcecode, and causes the IDE completely unusable. We have to choose between to bad options. Third option is disable all function in the IDE. Thats not why we pay a lot of money each year. Big problem is they bring updates which do not fix the bugs they say they do. So apparently they have to little people working on the product, or just shit on their customers.
  15. mvanrijnen

    upcoming language enhancements?

    Only the updates did not fix the problems they supposed to do. LSP/Codecompletion malfunctioning. If i look the the bugs which are still open and/or being reported it does not sound like a reasonable finished product. Like delivering a car from which the weels unexpected fall of. If you'r lucky you don't have a problem, i you'r unlucky you end the day after a few hours withouth wheels. Refactoring which stops working, suddenly freezes of the IDE, suddenly exiting of the IDE, making a mess of project files etc etc. Inserting events wrong in the sourcecoude (doubleclicking an event in the property inspector), i can go on and on. Very slow "getit" a failed ripoff from the packagemanagement from other IDE's, not working GetIt sometimes.
  16. Leaving Delphi 7, and keep hoping on a reasonable release of D10 was the biggest mistake for most Delphi programmers i think. πŸ™‚
  17. mvanrijnen

    upcoming language enhancements?

    I think all communication budget from EMB is spend by the marketeers who are putting out the worthless blogs. @Marco Cantu We did not get an invite for the Beta, nice window to subscribe by the way, 3 days???, called , we would get an invite a week ago, still no email from EMB. I really don't think they are gonna make it for long with this kind of attitude towards their customers. Why not publish some details about the coming Delphi 11 ? When we get a decent version of 10.4 ?
  18. mvanrijnen

    Parsing Text search expression

    Would be nice to have a common parser what you posted in your startpost, something with a base class which does the basic parsing of the query, and which can be extended in execution functionality .
  19. mvanrijnen

    Parsing Text search expression

    Maybe create a wrapper around: Welcome to the Lucene.NET website! | Apache Lucene.NET 4.8.0 ? Will be a lot of work i think.
  20. mvanrijnen

    memory usage of TJPGImage

    The TJPGImage has a TBitmap in it which will take the memory i think. This is a simple calculation, width,height,bits/pixel or am i mistaken? mistaken πŸ™‚
  21. Hey guys, i'm trying to implement something with attributes, which for the most works, but stumble on some problems with something. I have a setting class, which i use with class decoration, following works just fine: type TMyClass = class private fmyint : integer; public [Setting(666), SettingGroup('MySettingGroup1')] property MyInt : integer read FMyInt write FMyInt; end; So the property MyInt has a default value of 666, and through a SettingWorker class i can store and retrieve settings from json, ini's, database or whatever, that works just fine. (the SettingWorker class has methods like ApplyDefaults, LoadIni, SaveIni, etc etc) so now the challenge, i want to use this for some more complex properties (records like TPoint etc, this works: type TMyClass = class private fmyPoint : TPoint; public [Setting(), SettingGroup('MySettingGroup1')] property MyPoint : TPoint read FMyPoint write FMyPoint; end; so, i can store and retrieve the MyPoint value no problem, no i want to introduce the default value for this: This does not work: const CNST_MYPOINT : TPoint = (X: 35; Y: 55); type TMyClass = class private fmyPoint : TPoint; public [Setting(CNST_MYPOINT), SettingGroup('MySettingGroup1')] property MyPoint : TPoint read FMyPoint write FMyPoint; end; (i get: E2026 Constant expression expected) This also does not work: type TMyClass = class private fmyPoint : TPoint; public [Setting(TPoint = (X: 35; Y: 55)), SettingGroup('MySettingGroup1')] property MyPoint : TPoint read FMyPoint write FMyPoint; end; (i get: E2029 '(' expected but '=' found) Any thoughts, remark, ideas ?
  22. mvanrijnen

    Trim, SplitString

    declaration: type TStringArray = TArray<string>; TIntegerArray = TArray<integer>; TStringArrayHelper = record helper for TStringArray function ToIntArray() : TIntegerArray; end; TIntegerArrayHelper = record helper for TIntegerArray class function FromString(const AValue : string; const ASeparator : Char = ';') : TIntegerArray; end; implementation: { TStringArrayHelper } function TStringArrayHelper.ToIntArray: TIntegerArray; var idx : integer; begin SetLength(Result, Length(Self)); for idx := Low(Self) to High(Self) do Result[idx] := Self[idx].ToInteger; end; { TIntegerArrayHelper } class function TIntegerArrayHelper.FromString(const AValue: string; const ASeparator: Char): TIntegerArray; begin Result := AValue.Replace(' ', '', [rfReplaceAll]).Split([ASeparator], TStringSplitOptions.ExcludeEmpty).ToIntArray; end; usecase: procedure TForm1.Button4Click(Sender: TObject); const CNST_TEST_Value = '10 * 20 * 30'; var lValues : TIntegerArray; begin lvalues := TIntegerArray.FromString(CNST_TEST_Value, '*'); end; πŸ™‚
  23. mvanrijnen

    Trim, SplitString

    var numbers : TArray<string>; begin numbers := '10 * 20 * 30'.Replace(' ', '', [rfReplaceAll]).Split(['*'], TStringSplitOptions.ExcludeEmpty]); Trim removes only the starting or ending whitespace.
  24. ah ok, totally missed on that πŸ™‚ sorry for the confusion
Γ—