Jump to content

sp0987

Members
  • Content Count

    61
  • Joined

  • Last visited

Community Reputation

0 Neutral

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. sp0987

    Argument out of range Exception

    q.SQL.Add('DECLARE @MinEffDate date = DATEADD(DAY, -:dys, getdate())'); q.ParamByName('dys').AsInteger := 30; It works well in D11 without space too when the query has only this argument. If the query has more than one argument with the combination of "DATEADD(DAY, - :dys, getdate())');" , then it results in error
  2. sp0987

    Argument out of range Exception

    Was it an enhancement in D11? It was working good in D7
  3. Hi, We are using Db express components in our Delphi 11 IDE to connect to Database. We are getting Argument Out of Range exception under the following scenario 1. Note: dys parameter has an prefix of '-' to subtract the days from getdate(); In Scenario 1 , we are getting the exception "ArgumentOutOfRange. In Scenario 2 , we gave a space between the '-' operator and the dys parameter. In this case we didn't get any exception. Scenario 1: q.SQL.Add('DECLARE @MinEffDate date = DATEADD(DAY, -:dys, getdate())'); q.SQL.Add('DECLARE @MinRefDate date = :dt'); q.SQL.Add( 'select CONVERT(varchar(10), @MinEffDate, 101) AS MinEffDate,CONVERT(varchar(10), @MinRefDate, 101) AS MinRefDate'); q.ParamByName('dys').AsInteger := 30; q.ParamByName('dt').AsDateTime := StrToDateTimedef('2018-11-01 00:00:00', 2); Scenario 2: q.SQL.Add('DECLARE @MinEffDate date = DATEADD(DAY, - :dys, getdate())'); q.SQL.Add('DECLARE @MinRefDate date = :dt'); q.SQL.Add( 'select CONVERT(varchar(10), @MinEffDate, 101) AS MinEffDate,CONVERT(varchar(10), @MinRefDate, 101) AS MinRefDate'); q.ParamByName('dys').AsInteger := 30; q.ParamByName('dt').AsDateTime := StrToDateTimedef('2018-11-01 00:00:00', 2); Thankyou
  4. Am sorry... As per this was it ok for the exe to stay in the background for a period of time?
  5. Hi, We have a windows service sample application developed using D11. Observed that even after the service destroyed, the executable still showing in the background for 20sec's. When looked for help i found this "When a Windows service is destroyed , the service itself is removed from the running processes, but the executable file (.exe) might still appear in the process list because the underlying process hosting the service (often "svchost.exe") remains running, even if it no longer actively manages the service you deleted; essentially, the executable is still in memory but is not actively performing any service-related functions". Though it's a zombie exe, but still when we run the same exe multiple times , we could able to see the more than one zombie exe's in the process tab in task manager.
  6. Procedure GLog(Msg: String); var gLogger: TFileLogger = nil; begin if Assigned(gLogger) and Assigned(gLogger.Memo) then begin gLogger.fmLock.Enter; gLogger.Memo.Lines.BeginUpdate; while gLogger.Memo.Lines.Count > 600 do gLogger.Memo.Lines.Delete(0); gLogger.Memo.Lines.Add(Msg); gLogger.Memo.Lines.EndUpdate; gLogger.Memo.Perform(EM_SCROLLCARET, 0, 0); gLogger.fmLock.Leave; end; _Log(Msg); end; Upon my observation, when log prints all the requests from web page, there was no AV/ Invalid pointer Exception. Am not sure that log function was the culprit...
  7. procedure TVRMEditor.SendFileToClient(req: TIdHTTPRequestInfo; res: TIdHTTPResponseInfo); var doc, ext, Data, fname, err: String; b: boolean; rlst: TStringList; begin Data := ''; fname := req.Document; doc := ExpandFilename(self.RootDir + fname); if not FileExists(doc) then begin self.Log(fcomp_name + ': ' + fname + ' not in editor''s webroot!', LogServer); doc := ExpandFilename(fclirootdir + '\webroot\' + fname); if not FileExists(doc) then begin self.Log(fcomp_name + ': ' + fname + ' not found in any webroot!'); doc := ''; end; end; if doc <> '' then begin ext := UpperCase(ExtractFileExt(fname)); b := (ext = '.CSS') or (ext = '.HTM') or (ext = '.HTML') or (ext = '.JS'); if not b then begin res.ContentType := fMIMEMap.GetFileMIMEType(doc); res.ContentStream := TFileStream.Create(doc, fmOpenRead or fmShareCompat); end else begin try rlst := TStringList.Create; GetConstantGroup('Global_Skin', rlst); Data := LoadDataFromFile(doc); Data := ReplaceAllStringParams(Data, [rlst], '#S', '#', true); if not ReplaceForIncludFiles(Data, err, rlst, true) then self.Log(' #Include Replace Error: ' + err); res.ContentType := fMIMEMap.GetFileMIMEType(doc); res.ContentStream := TStringStream.Create(Data); finally rlst.Free; end; end; end; end; Code to sendfiletoclient
  8. I am writing an HTTP server (TIdHTTPServer) program that services GET requests for images. This 'OnCommandGet ' procedure of Httpserver, calls other procedures to do various tasks, and then finally gets back to the client via TIdHTTPResponseInfo. procedure TVRMEditor.HTTPServerCommandGet(AContext: TIdContext; req: TIdHTTPRequestInfo; res: TIdHTTPResponseInfo); var act, DocExt: string; begin try res.SERVER := 'VRM Editor'; res.ContentType := 'text/html;charset="UTF-8"'; res.ResponseNo := 200; act := UpperCase(copy(req.Document, 2, Length(req.Document) - 1)); DocExt := UpperCase(ExtractFileExt(act)); self.Log(fcomp_name + ': ' + copy(req.RawHTTPCommand, 1, Length(req.RawHTTPCommand) - 9), allowed); -- allowed is a flag to print all the req commands when set to true if DocExt = '.MAX' then begin self.ProcessResponse(req, res); end else self.SendFileToClient(req, res); -- access all the js/css/jpg/css files which are needed to open a web page except on E: Exception do begin self.Log(req.URI + ' : ' + req.Document + sLineBreak + E.ClassName + ' : ' + E.Message); end; end; end; When the Allowed flag is set to true, it prints al the request commands and opens the webpage without any error. If it sets to false, am getting AV / Invalid pointer and couldn't open the page. Am not sure whether you can get the log, but you can see the exceptions. Allowed = true.log Allowed=false.log
  9. Attaching a sample project. The project will create a json file, which when we try to use in javascript reults in error "invalid Json". can be run in bot 32-bit and 64-bit with few changes. The changes were mentioned in the respected .pas files as comments. TestJson.7z
  10. Am having issue with "u3<78" . Instead of "u1618", am getting "u3<78" in some areas. When we see the 32-bit , it was 'u00A0' all over.
  11. It was just a part of json file, not the whole thing.
  12. Hi, I am trying to create a .JSON file in Delphi 11 64-bit. While writing sample data to .json file , the &nbsp character was weird in 64-bit. In 32-bit version , it was like "u00A0" and when coming to 64-bit version it was like "u=<68" and sometimes "u3<78". When I parse this resulted json file in .JS files , it throws an error like "invalid JSON". Attached are samples from 32-bit and 64-bit. Please suggest. 32-bit.json 64-bit.json
  13. Much grateful for you response. It worked. The problem is with this LOC. Without stdcall it worked in D7.
  14. AM sure, it's not working. When the call the Now() after "Interceptcreate", then as we hooked the "gettbttime" it will go to GetTBTtime proc and then decode the date which was given in the code. And then it goes to function Now() in sysutils.pas. In that function , the SystemTime var will be filled with either '0''s or weird numbers. The same code when in debugged using D7, the SystemTime var in Now() of sysutils.pas was filled with the date given in "gettbttime"
×