Jump to content

Yaron

Members
  • Content Count

    79
  • Joined

  • Last visited

  • Days Won

    1

Yaron last won the day on November 13 2018

Yaron had the most liked content!

Community Reputation

13 Good

Technical Information

  • Delphi-Version
    Delphi 10.3 Rio

Recent Profile Visitors

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

  1. Yaron

    The 9 Hints in MARS

    I did, but it will get overwritten the next time I pull the code to get the latest version...
  2. Due to Delphi's inability to register changes in included ({$I filename}) files when performing a standard compile, I am forced to do a full build which brings up warning/hints from underlying units. With MARS, I always see these 9 Hints: [dcc32 Hint] MARS.Core.JSON.pas(264): H2443 Inline function 'TJSONArray.GetValue' has not been expanded because unit 'System.Generics.Collections' is not specified in USES list [dcc32 Hint] MARS.Core.JSON.pas(384): H2443 Inline function 'TJSONArray.GetValue' has not been expanded because unit 'System.Generics.Collections' is not specified in USES list [dcc32 Hint] MARS.Core.JSON.pas(473): H2443 Inline function 'TJSONObject.GetPair' has not been expanded because unit 'System.Generics.Collections' is not specified in USES list [dcc32 Hint] MARS.Core.JSON.pas(822): H2443 Inline function 'TJSONArray.GetValue' has not been expanded because unit 'System.Generics.Collections' is not specified in USES list [dcc32 Hint] MARS.Core.MessageBodyWriters.pas(129): H2443 Inline function 'TJSONArray.AddElement' has not been expanded because unit 'System.JSON' is not specified in USES list [dcc32 Hint] MARS.Core.MessageBodyWriters.pas(275): H2443 Inline function 'TJSONArray.AddElement' has not been expanded because unit 'System.JSON' is not specified in USES list [dcc32 Hint] MARS.Core.MessageBodyReaders.pas(302): H2443 Inline function 'TJSONArray.GetValue' has not been expanded because unit 'System.Generics.Collections' is not specified in USES list [dcc32 Hint] MARS.Core.MessageBodyReaders.pas(366): H2443 Inline function 'TJSONArray.GetValue' has not been expanded because unit 'System.Generics.Collections' is not specified in USES list [dcc32 Hint] MARS.Data.Utils.pas(213): H2443 Inline function 'TJSONArray.AddElement' has not been expanded because unit 'System.JSON' is not specified in USES list Any merit to these hints?
  3. Any chance you can make a tutorial video showing your preferred deployment method?
  4. I am using MARS as a back-end for a Web Application (processing post/get requests from HTML forms and outputting HTML based on the form input). I am currently deploying MARS as an IIS module DLL simply because I already have an IIS7.5 server installed and I wanted the free SSL security that comes with this type of setup. However, I had one instance where I was getting a "500" error from IIS and the only way to resolve it was to restart the application pool. Assuming my code is bug-free, what is the most reliable and best performance (for concurrent usage by multiple users) method to deploy MARS with SSL on a windows machine?
  5. Thank you Peter & Remy, I wasn't aware that TCanvas was sharing resources, the D7 documentation on lock/unlock refers to use lock to prevent other threads from writing to the canvas, but since my code wasn't accessing the canvas from outside the thread, I didn't think locking was mandatory. I have now changed the code to lock all 3 canvases outside the thread loop. Sherlock: It's funny how one person's confusing syntax is exactly the opposite for another person, I hate using "not" in any boolean check because for me it's confusing with logical (bitwise) operators. John Kouraklis I'm not sure what you mean. I use "csThumbRenderer" TCriticalSection in a try/finally block to copy over the contents of TBitmaps from the main thread. I use the same critical section in the main thread as well when accessing these bitmaps, so there should be no case where the bitmaps are used concurrently by more than one thread.
  6. I wonder if anything in my code is not thread safe as I get the occasional random freezes in the copy-background code (bitblt functions) when using multiple threads. As you can see, all the bitmaps are created within the thread's execute function and their source data is coming from bitmaps in the main thread that is copied over within a critical section. This is using Delphi 7. procedure TThumbRendererThread.Execute; var thumbBitmapDarkL : TBitmap; backgroundBitmap : TBitmap; WorkBM : TBitmap; begin thumbBitmapDarkL := TBitmap.Create; backgroundBitmap := TBitmap.Create; WorkBM := TBitmap.Create; WorkBM.Width := thumbWidth; WorkBM.Height := thumbHeightTotal; BackdropChanged := True; While (Terminated = False) do Begin If BackdropChanged = True then Begin csThumbRenderer.Enter; Try // Copy bitmaps from main thread (within Critical Section) thumbBitmapDarkL.Assign(LibNavForm.thumbBitmapDark); backgroundBitmap.Assign(s_mlBackground); Finally csThumbRenderer.Leave; End; BackdropChanged := False; End; DebugLog('Copy backgrounds (before)'); BitBlt(WorkBM.Canvas.Handle,0,0,thumbWidth,thumbHeight,thumbBitmapDarkL.Canvas.Handle,xOfs,yOfs,SRCCOPY); BitBlt(WorkBM.Canvas.Handle,0,thumbHeight,thumbWidth,thumbHeightTotal-thumbHeight,BackgroundBitmap.Canvas.Handle,xOfs,yOfs+thumbHeight,SRCCOPY); DebugLog('Copy backgrounds (after)'); // Do other things End; WorkBM.Free; backgroundBitmap.Free; thumbBitmapDarkL.Free; end;
  7. Is it possible to make a sort of "catch all" for all "GET/POST" commands that use a path not specified through mars? For example, I have mars specified to return a page using "http://website.com/rest/info" However, If the client opens the unspecified "http://website.com/rest/none" path, MARS throws an exception. Instead of the exception, I want to catch all unspecified paths and return an HTML result (and keep a record of the unspecified path in my debug logs). Is this possible?
  8. I believe that I solved this issue, I was missing enctype="multipart/form-data" in the form's statement.
  9. I am trying to upload an image from an html form (see below) to a MARS server. Previously, I was able to get this working when the client was written in Delphi, but now the client is a standard browser and the code fails (LParam.isFile returns false). HTML form: <form method="post"> <input type="text" name="ImageName" required><br> <input type="file" accept="image/jpeg" name="ImageFile" required> </form> The code I used to get the image that doesn't seem to work in this case : var lParam : TFormParam; mStream : TMemoryStream; begin For lParam in aParams do Begin If (SameText(lParam.FieldName, 'ImageFile')) then Begin If (LParam.isFile) then Begin mStream := TMemoryStream.Create; mStream.Write(lParam.AsFile.Bytes,Length(lParam.AsFile.Bytes)); mStream.Position := 0; Try mStream.SaveToFile('d:\test.jpg'); Finally mStream.Free; End; End; End; end; Any ideas?
  10. Is there a way to shorten the URL required to access the MARS server? What I did so far was to modify FEngine.AddApplication('DefaultApp', '/v', [ 'Server.Resources.*']); in "Server.Ignition". Ideally, I would like to eliminate the "/rest" and application name entirely, so the entry point would be whatever I define in [Path('')].
  11. For reasons I don't understand, the issue in the screenshot occasionally shows up. Then, when an exception is raised or when I place breakpoints, it causes them to trigger/show on the wrong line of code. Any idea how to resolve this issue?
  12. Is there documentation on how to use MARS to embed data in a cookie and retrieve it on subsequent calls? And of course, any additional sample code would be a blessing.
  13. I am writing a server using MARS with the client being a web browser (e.g. firefox) sending form data to the server. I don't want every user to be able to access the form, so I need to implement a login/authentication system. The authentication demo code I've seen ('MARS-Repository\MARS\Demos\Authorization\') seems to require using MARS client-code, which I don't think is possible if the client is a web browser. Do I need to write my own authentication code or is there some way I can leverage MARS's authentication code for this purpose?
  14. Please ignore this post, the issue was a combination of a bug and the user's inability to find the output log.
×