

mvanrijnen
Members-
Content Count
477 -
Joined
-
Last visited
-
Days Won
1
Everything posted by mvanrijnen
-
Here the same, only for O365 i have build a "proxy" in C#, we use EWS for that now. (Exchange Web Services (EWS) Managed API reference | Microsoft Docs)
-
Can't you be a little more specific which problems you'r having with Indy ?
-
main problem is that we have now a buggy D11, but they don't look back and fix the D10 version, there a lot of bugs that they could fix, but they just don't. i thought part of the subscription program was that they would fix bugs from a previous release. They entered a path where they never gonna get a (reasonable) bug fixed product. very very disappointed.
-
yes, you'r right, i think it's because this: i got cought up in that. So what i can see is that intenral in his code he's storing the dates as strings, got a little bit mixed up with the DB, easy, easy, easy, take a breath.
-
Okay, so you DB is ok, it's a DateTime field (or timestamp field), then the main problem is probably the storage in the tree, is this a visual treeview thing? best is to take a look at that, if you can improve the storage of the datetime value with the tree item, and keep a record or a pointer to a class instance with the correct data, so you can use your file datetime as a real datetime, then you won't have the problems with the strtodatetime thing when quering the database. it's only a tip, or let's say positive critisism 😉
-
then use the function DateTimeToStr and StrToDateTime with the format options, already mentioned before. i would be sure then, to keep a fixed format in the database if it has to be a string like YYYYMMNNHHNNSS, or use ISO8601 to store and retrieve. but keep the points of conversion as minimum as possible, there will be a point where it's gonna bite you, been there, done that 🙂 But at the end, it's something you have to figure out yourself. I would go back and take a look if you can change the >>> DateTimeToStr(FileInfo.TimeStamp)); >>> this to tree > to DB to FileInfo.TimeStamp----->Database ------>Visualize DateTimeToStr()
-
Why keep converting a Date(Time) to a string, keep it a a date and let FireDac worry about the conversion to the correct db format. (as said before, keep away from datetime to string conversion (or viceversa) with something like this) What code you now have, the whole SQL statement and the assignment of parameter values?
-
take a look at: System.SysUtils.FileDateToDateTime - RAD Studio API Documentation (embarcadero.com) (assuming you get the filedatetime with a standard delphi function).
-
just for the example: var myDate : TDate; begin myDate := EncodeDate(2021, 10, 3); .... // Make sure that myDate only contains the Date part, even when you declare a var as TDate it still can contain a time part !! // so thats why i make sure in the assignment, it depends on you own code if you need the DateOf() here. FDQuery2.Params.ParamByName('MyDateFrom').AsDate := DateOf(myDate); FDQuery2.Params.ParamByName('MyDateTill').AsDate := IncDay(DateOf(myDate)); ..... end;
-
haha, the StrToDate shit, is just taken from the topicstart, ofcourse in realworld we do not use this in realcode.
-
FDQuery2.SQL.Add('Select * from Projects'); FDQuery2.SQL.Add('WHERE MyDateTime>=:MyDateFrom'); FDQuery2.SQL.Add(' AND MyDateTime<:MyDateTill'); FDQuery2.SQL.Add('ORDER BY MyDateTime'); FDQuery2.Params.ParamByName('MyDateFrom').AsDate := StrToDate('03/10/2021')); FDQuery2.Params.ParamByName('MyDateTill').AsDate := IncDay(StrToDate('03/10/2021')); FDQuery2.Open; please keep forum in english.
-
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 ?
-
Did you change "HKEY_CURRENT_USER\Software\Embarcadero\BDS\21.0\LSP" to "HKEY_CURRENT_USER\Software\Embarcadero\BDS\22.0\LSP" ?
-
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;
-
Look impressive ! Especially the zooming looks good.
-
Enabling One-Click in Delphi 11 Welcome Page
mvanrijnen replied to Uwe Raabe's topic in Delphi IDE and APIs
i already could click them? Ah, see it now 😉 Good tip! -
RAD Studio 11 Alexandria is now available
mvanrijnen replied to Darian Miller's topic in General Help
ah full 4k support, time to ask the boss for new monitors 🙂 -
RAD Studio 11 Alexandria is now available
mvanrijnen replied to Darian Miller's topic in General Help
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. -
What everyhing else do you put under source control, apart from Delphi projects?
mvanrijnen replied to Mike Torrettinni's topic in General Help
Database DDL's -
Same project different platform base executable
mvanrijnen replied to Clément's topic in Delphi IDE and APIs
see also: delphi - XE4: How to change exe output name base on platform? - Stack Overflow -
StrToFloat () all combinations of decimal separator and lang. settings
mvanrijnen replied to bernhard_LA's topic in Algorithms, Data Structures and Class Design
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). -
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.
-
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.
-
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.
-
Isn't that why we have submenus ? (although they are an extra click away).