Jump to content


  • Content count

  • Joined

  • Last visited

  • Days Won


lennart last won the day on July 18

lennart had the most liked content!

1 Follower

About lennart

  • Rank

  • Birthday 09/21/1973

Contact Methods

  • Website URL

Profile Information

  • Gender
  • Location
    Vestfold, Norway


  • Company name
    The Smart Company AS
  • Sector
    Information technology
  • Position
    Lead developer

Smart Mobile Studio

  • Edition

Recent Profile Visitors

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

  1. lennart

    loading images

    It is a standard property available for JS developers. There was no other reason for adding it than making it available also to Smart developers. It was unfortunate that it was initialized with "anonymous", which sadly is the cause of this mess. My apologies
  2. One thing I noticed is that you pass TRUE as the second parameter of RegisterForm -- This should only be done once. The TRUE defines that the registered form is the "main" form. So only one should have TRUE while all the others should be false. I also suspect that you should wait for the instance to finish before jumping (since you have modified the start code directlt): TW3Dispatch.WaitFor([form1,form2,form3], procedure () begin Application.GotoForm(bla bla bla); end);
  3. lennart

    Websocket Server Start Error

    Its actually one of the coolest things about node.js! Node also has clang (c++ compiler) built-in, so if you use native packages it will actually re-compile node.js on the spot (!) But the majority of modules are raw JS and can be safely copied between systems. So you can write a server on windows, and just copy it to linux without any change
  4. lennart

    Websocket Server Start Error

    Have you installed the websocket package in the output directory? You write "I installed nodejs websocket" but it has to be the "ws" package and it has to be in the same folder as the project compiled file. 1. Open shell (CMD) and cd to the project folder 2. CD into the output folder (just compile to create it) 3. in the shell window, type "npm install ws". Npm (node package manager) will now download and place the ws (websocket) package files relative to the compiled *.js file (your compiled project file). 4. then run the project Note: To build a dependency file, add the "--save" param to the NPM command, it will then create a packages file. This is cool when you want to push your code to amazon etc. because node will then notice this and install all the dependencies in one-go I tested your code and it worked on the first try after i installed the ws library
  5. lennart

    Date and Time Computations

    The system.dateutils unit have everything you need
  6. lennart

    compiled procedures

    Yep, i usually do this from the chrome console, but it works everywhere
  7. lennart

    Error compiling SmartNJ.Udp

    This is probably the only negative with partial classes, namely that you need to include the right units that have the functionality. I have cleaned up the units considerably in v3.0 that is entering testing now, so hopefully this wont be so dispersed in the future
  8. lennart

    Keeping track of forms

    True, this could be nice to have automated. What I usually do is just add an array of TW3CustomForm's to TApplication, and then use the Push() and Pop() to keep track. When you use the array as a stack its much easier and you can move back with a single call: Application.GotoFromByRef(Application.FormStack.Pop(), feToRight); Since its such a small thing we havent really given it much attention, but yes - ill keep that in mind!
  9. lennart

    Header Control and menu

    IElite is absolutely correct. Sorry if I misunderstood you, I was under the impression that it was the actual showing you had a problem with. Adding an event to the dialog form, or proper methods like IElite does - is the way to go.
  10. lennart

    Header Control and menu

    If you have designed the loginform via the normal designer (e.g "form2"), then you dont need to register it. All designed forms are auto-registered (if you right-click on the project node in the project-treeview, there is a "view source" option that shows the startup code for you). But, I think you want to use a modal dialog approach. In the Application, there is a modal-dialog function that can show a second form -over the present form. It will also grey out the real mainform (disabled), so it cant be clicked - until you have closed the modal-dialog. So typically you would have two edit-boxes, username + password, and a cancel or "login" button on that form. And the user wont get access to the underlying mainform until he has provided the correct password So in the loginform you would close it by calling: application.HideModal(mrOK); //or mrCancel if it failed And from the main form you would call this to show your modal-form (see code for better description of the params) Application.ShowModal(loginform, nil, nil, procedure (dialog: TW3CustomForm) begin // Write code to execute just after the dialog is showing end, procedure (Dialog: TW3CustomForm) begin // this code fires when modalresult = mrOK end, procedure (Dialog: TW3CustomForm) begin // this code fires when modalresult = mrCancel end);
  11. lennart

    NodeJS and HTTPS

    Javascript doesnt use a VMT, it is based on prototypes which works differently (object in javascript is more like a b-tree node, that in turn can contain any number of sub nodes or name/value pairs). Our model comes on the side of this, and we bypass all the cloning JS developers have to deal with. If you look at the compiled code, you will see that all methods has a hidden "self" parameter. A VMT means that the data of the object and the methods are decoupled, and that the compiler operates with a method-table. Normally in a binary executable, the VMT is maintained at runtime. But since JavaScript is a written, source based language - the VMT is used at compile time to link up the symbols. The reason this is powerful is because it allows inheritance and re-use of existing methods without copying. JavaScript forces you to clone everything (prototypes) which limits how inheritance is dealt with by JS coders (not too elaborate, usually ad-hoc "clone my ancestor" and thats it). Our model dont need cloning. Since we ship the instance data in as the "self" param, we are able to re-use existing methods directly. In our model only the instance data is created and passed around, not the methods and everything else. Had this been a compiled language then yes, then the VMT would be implemented inside the code as part of TObject (actually, just beneath the surface of TObject). But since JS is text based we link up symbols during the compilation. You can watch how this works if you run a program in the browser and set some breakpoints, then inspect the "self" parameter directly: You could say that the JS instance both is a VMT and is sculpted from a VMT. But the sculpting is naturally applied in JS. TObject doesnt magically shape itself so to speak.
  12. lennart

    POST by Sockets

    You probably want to use the ToJSON() function
  13. lennart

    NodeJS and HTTPS

    Thank you for the warm praise! Its taken a long time to make this and the challenges has been many, but like you I firmly believe that object pascal is a better language. I even wrote a kernel in freepascal which says something about the power object pascal has. So I am 100% onboard with your notes on Wirth, a brilliant man and scientist. Great to have you onboard as well, happy hacking buddy!
  14. lennart

    NodeJS and HTTPS

    Hi Dave! Im actually doing this now. Under node, http and https are implemented as separate modules - which are identical. So you are right that you should inherit from TNJCustomServer, but I think you can just copy the whole http-server unit and then make sure it uses https instead. Here are the docs: https://nodejs.org/api/https.html You just have to do a require("https") and import the module. Then define a "class external" for it. If you look at how we import the other modules it should be easy to understand. But - if you can wait for the update Ill try my best to have it ready for you. We were going to wait until the next update (not the one lined up now), but ill see if i can squeeze it into our build for you /Jon
  15. lennart

    databases and applications

    This is taken into account with the framework we are researching / making now. The objects you use to access data act more as "front-ends" to the mechanisms behind it, and just like the filesystem classes the operations are all async. This has the benefit of decoupling the consumer-part (i.e controls + bindings) from the producer aspect. To the consumer parts the database can be resident - or on the other side of the planet, it cares not where the data originates, only that its made available in a format that it can use. A typical middleware entity would be a node.js server that is connected to X number of databases. The client will use the framework and connect to the node.js endpoint, but neither the controls or bindings will have any clue about the data originating from a server. It will simply see a driver and issue calls to it. When the driver (or class) gets the data it will validate and dispatch it via its internal mechanisms. The nice part about this is that, a datasource can be almost anything. As long as someone implements the 3 core classes, it can be anything from a hardcoded file, local database or remote data server for that matter. I will go into more detail about these classes when we are a little closer, but you are quite right that old-school 1:1 endpoints is useless in the new paradigm