Jump to content

Andrea Magni

Members
  • Content Count

    104
  • Joined

  • Last visited

Everything posted by Andrea Magni

  1. Andrea Magni

    Error during Execute in MARSCmd

    Weird... Let's assume you checked out MARS in a certain folder "MARS_BASE" (mine is 'C:\Sviluppo\Librerie\MARS'). You should have MARSCmd executable in MARS_BASE\Utils\Bin\Win32 Once you ran it, it should detect MARS base folder (it's printed in the bottom left part of the MARSCmd window) and suggest you to clone MARSTemplate from MARS_BASE\Demos\MARSTemplate, when you click Next, you should be able to change the "Replace With" value with the name of your new project, then click Next again and you should see the Destination folder valued to something like MARS_BASE\Demos\NAME_OF_YOUR_PROJECT I can see from your bug report that you are using Berlin as I am in this exact moment so I actually don't understand what's going wrong. Let me know please Sincerely
  2. Andrea Magni

    Token/Roles not working with TMARSNetClient

    Hi, I just made a quick test and everything run smooth here. Please post your code and we can investigate together. Here ( https://www.dropbox.com/s/1ak4fdru3lrs2my/TestRolesProject.zip?dl=0 ) you can find a simple project, built with MARSCmd from MARSTemplate and then I added a simple helloworld/json method allowed only for 'admin' role. The [Context] Token: TMARSToken get valued correctly and the client (included in the same groupproject) at designtime seems to work properly (you can authenticate but setting Username and Password [beware: password is the hour of the day you are running the demo] on the TMARSClientToken component and perform a POST request, inspect the Roles property and see them correctly valued) and then you can execute the helloworld/json resource (again, from the IDE clicking "GET" in the ObjectInspector) and see results (that includes an echo of Token.Username on the serverside as well as Token.Roles). The test project I attached has been built with 10.1 Berlin and then I tested it with 10.3 Rio without a glitch. Let me know, I will be happy to help you out
  3. Just made a quick test using ScaleMM2 ( https://github.com/andremussche/scalemm ) with MARS (MinimalConsole demo, https://github.com/andrea-magni/MARS/tree/master/Demos/MinimalConsole) and it seems to push performances something like from 100 to 170% 🙂 If you are using MARS and want to give it a try, let me know how it works for you.
  4. Andrea Magni

    ScaleMM2 with MARS: +70% performance boost :-)

    Thanks for the suggestions, I will give them a try but here we are a bit out of my comfort zone... Thanks @Stefan Glienke!
  5. Andrea Magni

    ScaleMM2 with MARS: +70% performance boost :-)

    @David Heffernan so I guess the fact I was just brute forcing 10k requests with ab.exe (Apache Benchmark) matters as the request served was a simple hello world thing. The setup time for the execution should be way more than execution time (physiologically). It was just a simple test, but I am open to better benchmarking. Thanks
  6. Andrea Magni

    ScaleMM2 with MARS: +70% performance boost :-)

    I am not actually an expert on this so low level topics but I am sure there is a big room for optimization in MARS. So far I always focused on functionalities and ease of use and there are a couple of spots I know I can easily optimize. It's on my todo list but not really a priority at this very moment. However, any help would be greatly appreciated, just in case somebody is willing to. 😉
  7. Just pushed: https://github.com/andrea-magni/MARS/commit/a0bcbce5c43dbb45648d89e6bc3a44b74e7996bd If you define a QueryParam or any other kind of param as argument of your method (or field of your resource), you can now enforce whether it is required or not. If a required parameter is not found, MARS will throw an exception while parsing the request. HTH
  8. Andrea Magni

    mORMot running on Delphi 10.3 Rio

    @Arnaud Bouchez Glad to read this! Any chance to see it compile for the Delphi (non-ARC) Linux compiler too? I am very interested as this would imply Linux support for mORMot-JWT (https://github.com/andrea-magni/mORMot-JWT) and I guess for dMustache (https://github.com/synopse/dmustache) as well. Sincerely
  9. Hi, I guess you mean TObjectDictionary<Key,Value> from Generics.Collections... Are you looking for a general solution or you can restrict Key or Value (or both) to some more specific type?
  10. It is just a small addition to MARS Client library capabilities but TMARSClientResourceJSON now implements REST.Client.IRESTResponseJSON interface (from Delphi's REST Client library). This basically means you can use a TMARSClientResourceJSON and materialize a dataset through the TRESTResponseDataSetAdapter component (from Delphi's REST Client library). Enjoy 😉
  11. BTW, I've just updated 10.1 Berlin packages (I am not sure I have VMs for earlier versions). If you are using Berlin, let me know if your problems are now solved. Thanks
  12. @Stuart Clennett, sorry! It's my fault, still need to improve myself in maintaining the library for older Delphi versions... Which one are you using? Thanks @Stefan Glienke
  13. Andrea Magni

    Web dashboard application

    And here is a fresh new (minimal) example of producing a Bootstrap page from a MARS server. The example includes a simple GET call performed through Ajax call. Link: https://github.com/andrea-magni/MARS/tree/master/Demos/Bootstrap HTH
  14. Andrea Magni

    Web dashboard application

    Actually he was looking to keep his VCL app (with data changes notification directly from the db) and add a (responsive) web application. No need to get into the push notification thing. BTW, I noticed I currently have no Boostrap specific example in MARS repository (although I myself have several production projects using this configuration). Will try to add one to the repo ASAP.
  15. Andrea Magni

    Web dashboard application

    Hi Davide, thanks for the quote. Your scenario really suggests for a REST server (whatever library you are going to use: from WebBroker/Datasnap to mORMot, passing through RAD Server as well [if you have an edition including a license]) and a client application (a web app). Obviously I would push for MARS: easy to learn, Delphi oriented, performs well (for maximum scalability and performance I myself would consider mORMot), easy FireDAC integration and support for server side content generation (html, JS or CSS) through dMustache and DelphiRazor libraries. For the frontend there are a number of possibilities. Personally I've done much with jQuery and Bootstrap (easy and effective). If you look for something more high level (components and similar) go for React or Sencha products, but consider the licensing. UniGUI and TMS WebCore are other (commercial) options that can be effective shortcuts to your development time and can help you not to delve too much into web technologies (offering a more stable environment where to work, that is particularly useful for larger or long lasting projects). This is my (possibly biased 🙂 ) idea on the topic. Sincerely
  16. Hi all, anyone here is using TFS for Delphi projects? I never used TFS but one of my newest customers has it as internal standard. Is there IDE plugins or integrations to work with TFS? If not, are there tools for using TFS outside VS? At the moment I am considering installing VS Community and use it just for the versioning stuff but I have no idea how this is feasible / handy... Any suggestion would be greatly appreciated! Thanks Andrea
  17. Andrea Magni

    Microsoft Team Foundation System and Delphi

    Many thanks, I will give it a try! Will let you know if I will be able to use it.
  18. Andrea Magni

    User contributed samples

    Feel free to put up a github repository with your project, I will be happy to review it and I will list your project in a dedicated file in the MARS repository. Sincerely
  19. Andrea Magni

    An elegant open-source calculator for Android

    An easy way to implement formulas is to rely on FireDAC expressions. It is very powerful (I built a simple spreadsheet-like application with very small effort!) Sincerely
  20. Andrea Magni

    Handling MultipartFormData

    Hi, there was no demo showcasing how to handle multipart/form-data on the server side with MARS. But, since a couple of minutes, there is! 🙂 Have a look here: https://github.com/andrea-magni/MARS/tree/master/Demos/MultipartFormData Build and run the demo, then use a browser to navigate http://localhost:8080/rest/default/helloworld/1 to have a simple HTML page with a multipart/form-data form. The last part of the URL can be 1, 2, 3 or 4. On the server side, you will notice four methods marked with the POST attribute, to handle the 4 requests. It is actually the same http request served through 4 different available ways in MARS (see here: https://github.com/andrea-magni/MARS/blob/master/Demos/MultipartFormData/Server.Resources.pas😞 1) ask the library to inject a dynamic array of TFormParam: [FormParams] AParams: TArray<TFormParam> Implementation of the REST method loops on that array to provide a result value; 2) target specific params (by name) using the following syntax: [FormParam('json')] AJSON: TFormParam; [FormParam('image')] AImage: TFormParam; FormParam is defined in MARS.Core.Utils and can represent both simple parameters and files; 3) push a bit more and ask for automatic deserialization of the first parameter into a TJSONObject. The methods has these arguments defined: [FormParam('json'), Consumes(TMediaType.Application_JSON)] AJSON: TJSONObject; [FormParam('image')] AImage: TFormParam; Note the type of the first argument is no more TFormParam but TJSONObject 4) last version takes advantage of JSON to record serialization (built-in with MARS): [FormParam('json'), Consumes(TMediaType.Application_JSON)] ARecord: TPerson; [FormParam('image')] AImage: TFormParam; All these four variations have a TMyResult record as return value. This record gets automatically serialized to JSON by the library. You should be able to build clients in any language (I tested with Postman and the HTML page, using Chrome). Let me know if everything is clear and working. Sincerely, Andrea
  21. Andrea Magni

    fast file searching, what do you recommend, please?

    Give a try to UltraSearch, I use it regularly and it is really good.
  22. Andrea Magni

    Alphabet Index for navigation on ListView?

    Ah, sorry, I didn't get your question right. I would use a second listview probably. The scrolling seems to be independent from your primary list (you might want to do some syncing but seems easy to do). What about this? If you are looking for something more similar to the standard index you get on the right edge of the listview, I would probably go for an extra layer on top of the listview (using a TLayout as a transparent container and probably implementing touch gestures) Nice topic
  23. Andrea Magni

    How to make a component available to all platforms

    A nice hack from @Dalija Prasnikar here: https://stackoverflow.com/questions/27486939/is-there-simpler-way-of-saying-that-delphi-component-control-is-supported-on-all HTH
  24. Andrea Magni

    Alphabet Index for navigation on ListView?

    Hi, is the listview bound to a dataset or manually filled? In the first case I would try to locate the next record in your dataset and have the listview sync'ed automatically. But probably you are in the second case (manually filled list). You can either find a way to build your index while filling the list (a sorted list may be useful here) so that you can let items be shown in the list following one sorting and yet have a second structure where you can find the next item and the corresponding listviewitem (or index). HTH Andrea
  25. In the MARS repository a new demo (check the Demos folder) is now available: https://github.com/andrea-magni/MARS/tree/master/Demos/EKON22 It is a project I created through the MARSCmd utility and used as a playground for my EKON 22 session, yesterday. There are a number of features showcased in this demo, from parameters passing to object/record/dataset serialization passing through FireDAC integration and MARS Client library components. To enable the FireDAC part of the demo, be sure to have a MAIN_DB FireDAC connection defined in your system, against the Firebird demo db (EMPLOYEEDB) or please adapt the simple SQL statements to your own database. I am available for questions or discussion. Sincerely, Andrea
×