Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation since 03/01/2020 in all areas

  1. 4 points
    lynkfs

    Performance due to compiler optimisation

    The other thing I noticed when comparing the same project generated by SMS3.0.0 and the latest alpha is a marked speed increase. I did some tests on the training phase of a neural network, with these results : SMS 3.0.0 : Training took 30810 milliseconds. SMS 3.1.9 : Training took 18937 milliseconds. SMS 3.0.0 : Training took 32611 milliseconds. SMS 3.1.9 : Training took 47272 milliseconds. SMS 3.0.0 : Training took 34233 milliseconds. SMS 3.1.9 : Training took 16627 milliseconds. SMS 3.0.0 : Training took 33177 milliseconds. SMS 3.1.9 : Training took 18275 milliseconds. SMS 3.0.0 : Training took 30762 milliseconds. SMS 3.1.9 : Training took 16734 milliseconds. SMS 3.0.0 : Training took ... milliseconds. SMS 3.1.9 : Training took 16062 milliseconds. Except for 1 outlier, the speed difference of the latest alpha is about on average 1.6 - 1.8 times faster This can only be due to compiler optimisation Impressive
  2. 2 points
    Try using BrowserApi.Windowobject.open( ) instead. Note that "window" is of type THandle which means you can utilise any valid javascript method/property on it, but code completion will not work. "Windowobject" on the other hand is of type Jwindow and is built with code completion in mind.
  3. 2 points
    lynkfs

    open external link in new tab of browser

    The other possible downside of using window.open is that it depends on the users browser setting whether it opens a new tab or a new window. This behaviour cannot be determined by js, it is dependent on the user. While chrome seems to favour using the tab-mechanism, other browsers don't. I've tested a couple which resulted in 'pop-up blocked' messages Also mobile browsers don't have tabs, so they will spawn a new window at best. (There is something called the tab-api, which gives granular tab processing under program control. This is used for developing browser extensions, which I have never done. It may or may not be possible to use that api in SMS, although I suspect that even if it does, it will have ramifications) Another possible option is of course using an iFrame element on the form. Depends on your requirements
  4. 2 points
    jarto

    SMS 3 + mORMot = Error

    @IgorSavkic Thank you for the exe. I got the server running and was able to debug the issue. The reason what the SMS Browser does not work here is due to settings. Go to IDE Settings and Internal Browser. Then have a look at option Web Security. Click on it until you get a Check Mark or a black rectangle on it. (Black rectangle means that we'll be using Chromium's default value) Click ok, restart the IDE and it works.
  5. 2 points
    jarto

    Control Alignments

    This is now fixed in the latest alpha. It required bigger changes but the end result should be better. Like I wrote earlier, the problem was that form1 (in this example) was hidden too early. Let me give you some background, so you guys know better about what's going on when an SMS app is starting: If you have multiple forms, they all are constructed during startup. The main form is easy: Just build it and there it is. The other forms are trickier as they need to be built off screen and then hidden. The construction of all forms have to happen with visible=true as ClientRect, ClientWidth and ClientHeight will not otherwise return correct values. In this example program, the form was built properly, but resizes were still going on when the form was hidden. That's because setting an alignment caused a delayed resize on the parent control. It has to be delayed as we don't want the parent control to realign all the child components right away when any of them changes alignment. That'd lead to flickering and tons of extra resizes. The solution I took was to block all resizes and alignments while the form is being built from form's sfm-file. When all controls have been created and properties set, I recursively call resize and align once on controls from bottom up. In my tests it has worked well. Please let me know if this breaks your code.
  6. 2 points
    New update available: IDE: Move setting of Align higher up in generated form sfm Take port for welcome page and form designer from IDE settings. RTL: Improvements to how forms are built from form sfm: Minimize resizes and alignments during construction Do not hide a form too early Add TVariant.Values (Thank you Daniel Eiszele) Bug fix to TVariant.ForEachProperty Compiler: Bug fix to Randomize in DWScript
  7. 1 point
    jarto

    Database development

    I've been doing some work to create data aware controls for SMS. I'm aiming to do a versatile solution, where you can access data from a TDataset by using a TDataLink, no matter what the data comes from. So it could be a cvs-table, json, sql query etc. I started by building a TW3DataSet (and fixing some bugs) and writing a simple TW3DataSource and TW3DataLink. Then a data-aware Label, which shows the data properly. It's pretty much the same mechanism as with Delphi and Lazarus. Today I started then adding SQLite. I started by downloading a database file with TW3HttpRequest and loading it from a stream. Again, a few bugs and improvements had to be made, but now it works and I have a nice mechanism for loading any binary data from a file. But now then... Making it possible to read the results of a SQLite query through a dataset.... Here I hit a little road block and don't know how to proceed. It's simple to make a select-query and access that data for results, but what's the best way for me to know what the fields are? Their names and datatypes?
  8. 1 point
    jarto

    Database development

    What I am now using for testing is to read the db-file to memory and accessing it there. After that, the db can be saved to a stream. However, when doing this infrastucture, it has to be versatile enough, so I don't restrict it only to a memory based sql database. It needs to be extendable so, that the sql-queries could just as well be sent to a remote server or a cloud based database.
  9. 1 point
    IgorSavkic

    Database development

    > Today I started then adding SQLite. I started by downloading a database file with TW3HttpRequest and loading it from a stream. Again, a few > bugs and improvements had to be made, but now it works and I have a nice mechanism for loading any binary data from a file. Is that for readonly sqlite databases? Or do you mean to store updated one in localstorage? > But now then... Making it possible to read the results of a SQLite query through a dataset.... Here I hit a little road block and don't know how to proceed. It's > simple to make a select-query and access that data for results, but what's the best way for me to know what the fields are? Their names and datatypes SQLite on desktop returns both fieldname and datatype, I guess that JS SQLite version doesn't return all that, so I think best is just to use Variant for all fields, and leave to user of Dataset to access it AsStr, AsInt, AsFloat... After all writer of that query should know what columns he'se selecting in query and what are datatypes.
  10. 1 point
    lynkfs

    Database development

    there is also the system.db.pas unit, which provides some db and sql based references
  11. 1 point
    jarto

    Database development

    Heh, well, this actually looks now a lot easier. Sqllite actually returns the parsed column names in the results. It even works with field aliases: lower(employees.FirstName) as Representative That was correctly returned as Representative
  12. 1 point
    jarto

    Database development

    Reading a bit of Lazarus source, it seems they don't have a full blown sql parser. For example, they don't allow updates if the select is from multiple tables or derived tables. So it's probably a good idea to aim at being able to show a dbgrid from a select-query and try to retrieve and parse the field names. I'd better add a possibility to provide or adjust field names as well. After all, if you use complicated SQL, you do know what your columns are and what you want to view.
  13. 1 point
    lynkfs

    Database development

    They must have some sort of an sql parser. Some links : Commercial vcl (delphi tokyo) parser : http://sqlparser.com/download.php http://sqlparser.com/dlaction.php?fid=gspdxe10_2_tokyo_trial&ftitle=General%20SQL%20Parser%20VCL%20for%20delphi%20XE10.2%20tokyo%20trial%20version and some really old ones https://torry.net/quicksearchd.php?String=sql+parser&Title=Yes http://www.felix-colibri.com/papers/db/sql_parser/sql_parser.html to write a complete sql parser from scratch might be a big job
  14. 1 point
    jarto

    Database development

    Seems like DBGrid in Lazarus can parse this properly as well: select lower(customers.FirstName) as FirstName,lower(customers.LastName) as LastName, lower(employees.FirstName) as Representative from customers,employees where customers.SupportRepId=employees.EmployeeId; The dataset used is chinook.db from here: https://www.sqlitetutorial.net/sqlite-sample-database/
  15. 1 point
    jarto

    Database development

    @lynkfs Thank you. It's possible to get the table fields with a query in SQLite as well. For example: select sql from sqlite_master where tbl_name="Employee"; That returns: CREATE TABLE [Employee] ( [ID] INTEGER PRIMARY KEY NULL, [Name] TEXT NULL, [Department] text NULL, [Seniority] INTEGER NULL ) So, if the query selects all fields from that table (select * from Employee....), it's quite simple to find the field name. However, when only some fields are selected (select Name, Department from Employee...), I'd need to analyze also, which fields are selected. Problem is, this can get pretty complicated. I have no control over what the sql-query is. There can possibly be joins, functions etc. For example: select Name,lower(Department) from Employee; select Name,lower(Department) as Position from Employee; When I test those, I notice that Lazarus' TDBGrid does add the second column as "lower(Department)" or "Position". So it seems that it analyzes the sql-query itself and creates the fields from there. Makes sense. Then, the next big question is editing data. In a simple "select *" it's easy, but I wonder if the other data aware controls simply prevent editing, when the field name is a function or an alias.
  16. 1 point
    lynkfs

    Database development

    I guess there are a couple of approaches : - Have access to the meta information when parsing results. Most SQL based rdbms's have type information stored in meta tables, which is accessible by a normal query. Unfortunately this is not standardised, so MySQL, Oracle, DB2, SQL server etc have differently named tables for that purpose. For SQLite see this link. - Let the developer define the meta data in the designer while setting up the data link, and store it somewhere persistently (TDatalink ?). Then parse the results with this stored meta data. - If you only want to know if a field is numeric or not (I don't think that's your question, but anyway) then there is the poor mans solution : just read the first 100 records or so, and if a field only contains 0-9 then assume that field to be numeric across the whole result set. Not recommended (but I did it once to figure out the left or right alignment of fields in a grid)
  17. 1 point
    lynkfs

    visual design

    I've been following this company for a while. They went from a startup promising a contemporary development product to a web design template producer. And I must say, I really like their designs. When I need some inspiration for app design, I do have a look at what they're offering https://famous.co/
  18. 1 point
    bestm80eva

    Roadmap 2020

    To whom it may concern, I purchased a license back in Jan 2019 for SMS, not really felt i could produce anything on business quality with it. I am thinking about purchasing again when and if version 4.0 comes out, if i haven't moved onto something else by then Not get me wrong i think what has been done for one person is great. Few points.:- 1. There is no upgrade prices on the store. 2. Documentation is very much needed. 3. I am using at present 3.0.2.20 and it still has the display issue on selecting an object on top of another object but i have worked out how to do this without causing crashes. . 4. I noticed in a post that you needed help and were willing to contract out some work as you didnt want to open source the IDE. Did this work out or didn't you go down that road. PS please dont take this as a negative post. I am very positive about your product just a little frustrated that i cant use it fully yet. But i am getting better at overcoming issues Dean
  19. 1 point
    jarto

    Roadmap 2020

    Hi Dean. I strongly suggest that you'd start using the Alpha-branch, which is the upcoming 4.0 -version. It is by far superior to version 3. Not only does it have the new visual designer, but also properly working anchors and align and lots of bug fixes. As you do have an active license, you can easily install it in another folder on your computer without having to remove the current version. As long as you have an active subscription, you can install all the new versions, including version 4. Hence, there's no upgrade prize. Yes, I do agree that documentation is needed. 😔 If you're interested to do contract work, please do send me an e-mail to jt at smartmobilestudio.com introducing yourself. I look forward to hearing from you 🙂
  20. 1 point
    jarto

    open external link in new tab of browser

    I need to have a look at the code completion/code insight. It's been on my bug list for quite some time. Have to see what I can do to that internal browser shutdown issue as well :-)
  21. 1 point
    jarto

    open external link in new tab of browser

    procedure TForm1.W3Button1Click(Sender: TObject); begin BrowserAPI.Window.open('https://www.google.com', '_blank'); end;
  22. 1 point
    Would something like this work? https://www.codexworld.com/how-to/open-url-in-new-browser-window-tab-javascript/
  23. 1 point
    jarto

    DWS bugs in Alpha (was: randomize)

    The alpha-channel contains now a fix for this.
  24. 1 point
    jarto

    DWS bugs in Alpha (was: randomize)

    Filed a bug report of this one with a simple test case: https://bitbucket.org/egrange/dwscript/issues/174/code-generation-error-while-declaring-and
  25. 1 point
    lynkfs

    DWS bugs in Alpha (was: randomize)

    Found the problem with my neural network component. It turns out it has nothing to do with the randomize function, but is an elusive compiler error in the latest alpha To illustrate this : This code (a matrix multiplication function) Function DotX(Matrix1,Matrix2:TMatrix) : TMatrix; var MyDotX : TMatrix; begin MyDotX := TMatrix.Create(Matrix1.NrRows,Matrix2.NrColumns); For var i := 0 to Matrix1.NrRows -1 do begin For var j := 0 to Matrix2.NrColumns -1 do begin var sum: float := 0; For var k := 0 to Matrix1.NrColumns -1 do begin sum := sum + Matrix1.GetValue(i,k) * Matrix2.GetValue(k,j); MyDotX.SetValue(i,j,sum); end; end; end; result := MyDotX; end; is compiled to the following javascript 3.0.0 function DotX(Matrix1$1, Matrix2) { var Result = null; var MyDotX = null; var i$24 = 0; var j$10 = 0; var sum = 0, k$2 = 0; MyDotX = TMatrix.Create$163($New(TMatrix),parseInt(TMatrix.NrRows(Matrix1$1),10),parseInt(TMatrix.NrColumns(Matrix2),10)); var $temp115; for(i$24=0,$temp115=TMatrix.NrRows(Matrix1$1)-1;i$24<=$temp115;i$24++) { var $temp116; for(j$10=0,$temp116=TMatrix.NrColumns(Matrix2)-1;j$10<=$temp116;j$10++) { sum = 0; var $temp117; for(k$2=0,$temp117=TMatrix.NrColumns(Matrix1$1)-1;k$2<=$temp117;k$2++) { sum+=Number(TMatrix.GetValue$1(Matrix1$1,i$24,k$2)*TMatrix.GetValue$1(Matrix2,k$2,j$10)); TMatrix.SetValue$1(MyDotX,i$24,j$10,sum); } } } Result = MyDotX; return Result }; which works fine in all SMS versions up to 3.0.0 In the latest alpha though, the line 'sum = 0' is omitted by the compiler, which breaks this function @jartoattributes this to an optimisation error in the compiler He'll get this fixed This error is not tied to matrix multiplication or anything, it will occur in all similar constructs where a variable is declared in the body of a function with a value of zero (in this function the line : var sum: float := 0)
×