Jump to content

lynkfs

Moderators
  • Content Count

    740
  • Joined

  • Last visited

  • Days Won

    146

Reputation Activity

  1. Thanks
    lynkfs got a reaction from jarto in md5 on win10   
    Sometimes downloaded files come with a md5 hash. Md5 is an algorithm which translates any string or any file into a 128 bit value. This value then can be used to verify the integrity of the downloaded file : just re-generate the md5 hashvalue with a proper utility and compare the generated and the published value.
    Apparently md5 is not that good, but that's beside the point. It is widely used.
    There are quite a few md5 checksum utilities available, but the other day I found out that this is baked into win10 as well. No need to download and install a separate utility for this purpose.
    https://onthefencedevelopment.com/2017/08/15/windows-10-builtin-md5-checksum-calculator/
     
  2. Like
    lynkfs got a reaction from IgorSavkic in md5 on win10   
    Sometimes downloaded files come with a md5 hash. Md5 is an algorithm which translates any string or any file into a 128 bit value. This value then can be used to verify the integrity of the downloaded file : just re-generate the md5 hashvalue with a proper utility and compare the generated and the published value.
    Apparently md5 is not that good, but that's beside the point. It is widely used.
    There are quite a few md5 checksum utilities available, but the other day I found out that this is baked into win10 as well. No need to download and install a separate utility for this purpose.
    https://onthefencedevelopment.com/2017/08/15/windows-10-builtin-md5-checksum-calculator/
     
  3. Thanks
    lynkfs reacted to jarto in DWS bugs in Alpha (was: randomize)   
    The reason this bug happens is, commit 5e92a541002cd781ad335f0e7a4cd64615ca0f0b in DWS:
    Here the code checks if SetRandSeed is used. If not, it uses Math.random instead of alea and removes Random from DWS's dependencies, which results in alea.js not being linked in. The problem is, that Eric should also have checked if Randomize is used, before removing the dependency. So I basically know how to fix this myself, but prefer to get an official fix from Eric.
    Currently you can trick DWS to work properly by adding a call to SetRandSeed before calling Randomize.
  4. Thanks
    lynkfs reacted to jarto in DWS bugs in Alpha (was: randomize)   
    Yep, this is a bug in DWS. I've reported it to Eric.
  5. Like
    lynkfs got a reaction from jarto in alignment   
    Since the ide is getting some pretty good improvements, I would like to make the following suggestion :
    it would be nice if it would be possible to align components in the designer similar to ms-powerpoint :
    select 2 or more components and align them vertically or horizontally,
    something like

  6. Like
    lynkfs got a reaction from jarto in parseInt question   
    yep, fixed the problem, all works as expected 👍
  7. Like
    lynkfs reacted to jarto in parseInt question   
    A little update: Eric found the bug and fixed it in DWS. I'll include the fix in the next update.
  8. Thanks
    lynkfs reacted to jarto in parseInt question   
    So the problem might be with parseInt itself and not nested functions. Let me have a look.
    Nope, the problem seems to be with Smart linking. If you have it enabled in Project Options, computeBrightness is eliminated from the generated JS.
    I'll have a look if this is a known bug in DWS and if not, report this to Eric.
  9. Like
    lynkfs reacted to jarto in Smart Mobile Studio 3.9.1 (1st Alpha release) is available   
    There's now also a new update available:
    Compiled with Delphi Rio More fixes to shutdown-issues.
  10. Like
    lynkfs got a reaction from Czar in alignment   
    Since the ide is getting some pretty good improvements, I would like to make the following suggestion :
    it would be nice if it would be possible to align components in the designer similar to ms-powerpoint :
    select 2 or more components and align them vertically or horizontally,
    something like

  11. Like
    lynkfs reacted to IgorSavkic in css styling   
    > It also makes life somewhat complicated. Easiest is just to forget about the layout functions in any css framework (positioning, sizing), and just
    > stick with the Smart layout system. That still leaves many css functions to do with colors, backgrounds, typography, borders, svg and effects
    It's probably matter of preference, I have very bad experience with SMS layout system in 2.2 version and to me it's preatty easy to get what I want with css. Haven't tried new one in 3.x version though.
    I'm not sure it can handle adjusting to different screen sizes or adding spacing between controls or width/height settings (2/3 of parent, 1/4+ 2/5 and similar stuff which are quite easy with css).
  12. Like
    lynkfs got a reaction from jarto in Smart Mobile Studio 3.9.1 (1st Alpha release) is available   
    The 'Open Recent' project list is now properly updated too 👍
  13. Like
    lynkfs reacted to jarto in css styling   
    Well, I've been thinking about how to support this as it'd be great to be able to use standard stylesheets from other frameworks. That way we could have access to a lot of ready made stylesheets. The one I had a look at earlier was Bulma.
    At the moment we do have background- and borderstyles like for example bsContainerBackground or btFlatBorder. What I'd like to test is to add a number of new styles and then create a mapping layer between them and the other frameworks. For example:
    Add a background like bsErrorBackground When a Bulma stylesheet is used, and bsErrorBackground is set, the mapping layer would translate that to Bulma's style: "is-problem" In the same way, bsContainerBackground could be translated to Bulma's "box" style etc.
  14. Like
    lynkfs got a reaction from Tim Koscielski in css styling   
    Various ways to do this. Probably easiest is to download the latest tailwind css file from
    https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css and store it in the lib folder and use the $R directive
    initialization Forms.RegisterForm({$I %FILE%}, TForm1); {$R 'tailwind.css'} This will automatically add a line like this to your index template file :
    <link rel="stylesheet" href="lib/tailwind.css"> Alternatively, either add a custom template in the Project Manager and add the css file link manually to it, or load the css file in code
    Apart from any $R directive, projectsource is the same as the official demo with the 5 one-liners added
  15. Like
    lynkfs got a reaction from IElite in css styling   
    Various ways to do this. Probably easiest is to download the latest tailwind css file from
    https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css and store it in the lib folder and use the $R directive
    initialization Forms.RegisterForm({$I %FILE%}, TForm1); {$R 'tailwind.css'} This will automatically add a line like this to your index template file :
    <link rel="stylesheet" href="lib/tailwind.css"> Alternatively, either add a custom template in the Project Manager and add the css file link manually to it, or load the css file in code
    Apart from any $R directive, projectsource is the same as the official demo with the 5 one-liners added
  16. Like
    lynkfs got a reaction from Tim Koscielski in css styling   
    One of the plusses of the (opensource) tailwind css library is that it does not have any pre-made components like buttons etc.
    Instead, any element can be styled using one or more of it's css 'functions'. So this also works for any of the standard SMS components.
    As an example, see here the new login demo (Featured Demos / Forms & Components / LoginDialog), but styled a bit differently

    Demo (see hover and focus effects)
    Usage is quite intuitive :
    -  Give the LoginForm a white background and rounded corners
    -  Display the 'Please login' label in dark grey using a small bold font
    -  Render the user name editbox with a shadow, rounded corners, dark grey text, a 3px lead and a shadow outline on hover and on focus
        etc
    in code, just 5 one-liners :
    procedure TLoginForm.InitializeForm; begin ...   self.handle.className := "bg-white rounded"; //dialog   W3Label1.handle.className := "block text-gray-700 text-sm font-bold"; //title   EditUserName.handle.className := "shadow appearance-none border rounded w-full px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline hover:outline-none hover:shadow-outline";   EditPassWord.handle.className := "shadow appearance-none border border-red-500 rounded w-full px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline";   LogIn.handle.className := "bg-blue-500 hover:bg-blue-700 text-white font-bold rounded focus:outline-none focus:shadow-outline"; //button end;  
    ( instead of manipulating the elements className directly by it's handle, use the rtl's built in TagStyle functions :
      self.TagStyle.Clear;
      self.TagStyle.Add("bg-white rounded");

     
     
  17. Like
    lynkfs reacted to jarto in Debugging a NodeJS -app   
    While debugging the httpsserver, I started wondering how NodeJS-apps are debugged. Here's how you do it with Chrome:
    1. Open your NodeJS Project, go to the Project Options' Execution-tab and add "--inspect" to Parameters (Notice, that I added --inspect followed by a space before %output%)

    2. Compile, Execute
    3. Start Chrome and go to chrome://inspect

    4. Click on "Open dedicated DevTools for Node"


    That's it. You can set breakpoints in the Sources-tab, inspect values etc.
  18. Like
    lynkfs reacted to Daniel Eiszele in NodeJS Route Manager   
    I am an engineering surveyor, currently working in an Electrical Design office providing "As Built" information to the Civil Construction Industry. The current iteration of this particular program is as an in house REST server, receiving mapping data (in SVG format) for inclusion in a POSTGRES database for later viewing in the browser. In a nutshell, it is a way for our office staff to tell the field staff what they need to do! The front end (my main application), is a hybrid Survey/Cad package written in Delphi; so all this web stuff is quite new to me.  Having said that, I think I have all the pieces now to extend the backend significantly and provide functionality I didn't originally plan on.  NodeJS really is a great platform and being able to access it with object pascal is icing on the cake.
    I'll upload my wrappers for POSTGRES and user Authentication too when I get them cleaned up a bit, as they may also be useful as a starting point for others.  Note that coding is not my day job, but a means to an end, so the code and documentation may not (please read "will not" ) be great.
  19. Like
    lynkfs reacted to jarto in Smart Mobile Studio 3.9.1 (1st Alpha release) is available   
    2nd Alpha release of the upcoming version 4.0 is now available. You can install it with SmartUpdate from the ALPHA-channel. If you have installed the first alpha release, you can simply run SmartUpdate in the same folder.
    Designer:
    If a component is added by just clicking, it's created at 96x32 size Prevent deletion of form IDE:
    Disable adding of units to uses-section when a form is opened Required units will still be added when a component is added to the form Add a message if the IDE's internal server can not start Bug fix to sorting of forum posts on the Welcome Page Small bug fix to Switch Comment
  20. Like
    lynkfs got a reaction from Tim Koscielski in css styling   
    Browsers are certainly talented as multi-language processors. They have to understand html, css, javascript, svg and lately web-assembly as a fifth language. XML and Json are format specifiers, but could be borderline categorised as languages as well.
    Smart elevates javascript to great heights, but sort of leaves the other ones at the periphery. Especially css.
    Css can be used for a) component styling including colours, fonts etc, b) visual layout of pages/forms and reacting responsively to screen size and orientation and c) interactivity in various forms. Some of this overlaps with the js domain. Smart basically uses css for a) but not for b) or c).
    Looking at various css frameworks out there, I would categorise these as
    on one end of the scale there are many UI kit frameworks where the emphasis is on components - buttons, accordions, cards etc. Sometimes as css stand-alone files, sometimes in conjunction with js. Most of these also have functionality for layout purposes, usually based on flexbox or internal grid structures. on the other end of the scale there are frameworks which forego the component focus, but instead provide a large number of elementary styling functions, which can be applied to any component. and many which occupy a space in between This post is about the open source Tailwind framework, belonging in the second category above, just to see how that would work in the Smart environment.
    Tailwind comes in 2 flavours : a static framework which can be accessed locally or from a cdn, and a more dynamic version. The latter can be tailored dynamically for any specific project and basically needs to be part of the build toolchain. To keep it simple I used the static version.
    Change the res/app.css reference to the tailwind css file (either just replace it or change the reference in the index.html file). Now any component can be made to use this styling. Because this is not more (or less) than a list of individual styling functions, the use boils down to defining what you want. Tell a story as in "give me a button with a green background, which turns to blue on hover, has rounded corners and white text and a shadow effect which makes it seem floating". In code :
      W3Button1.handle.className := "bg-green-500 hover:bg-blue-700 text-white rounded shadow-2xl"; The second button in the demo project (see below) has a different story (className sequence), which gives it a totally different look and feel.
    I kind of like this approach, it works very well with any component, thus also with the built in Smart components.
    It is a bit of a drag specifying these className sequences by hand, so it would be nice if this would be supported in the IDE. There are after all only a small number of categories of these elementary styling bits : backgrounds, typography, borders, spacing, sizing, svg, interactivity and effects. And a relatively limited list of functions per category (bg-green-500 means a green background, 500 is the fifth shade in the green colour scheme. So there will be a bg-green-600, a bg-blue-200 etc). Doable I think.
    Apart from these styling functions, Tailwind also has a number of layout functions. Smart has its own layout mechanism, however the Tailwind functions can be used as well. See the 'card' component in the demo.
    Demo and source
     
     
  21. Like
    lynkfs reacted to jarto in New Visual Designer for Smart Mobile Studio   
    If everything goes according to plans, before Christmas. I can't tell you a fixed date as there is a little competition going on about which will be released first: The Alpha or my 3rd child 😀
  22. Like
    lynkfs reacted to JimKueneman in Converting a Lazarus/Delphi library   
    With the help of Jarto and a few here I have almost 5000 lines of a Lazarus/Delphi library that implements a mature custom TCP protocol compiling with SMS with just a few {$IFDEF DWSCRIPT}'s required so far.  I have about 1000 more line to go before I can give it a full test but I do have a Websocket connected to the library and have sent messages to the library from a Lazarus program and it received and decoded them correctly.  I was only working on it for a few hours on and off yesterday so I am amazed and very happy.  Hopefully it will all run correctly in the end but at least the compiler thinks it should.
    The key websites that have helped me get handle on thing are here but so far I have not used them directly, SMS has handled everything in the compile so far but I do have a few dynamic byte array that I need to mimic which will need this information....
    https://jonlennartaasenden.wordpress.com/2017/06/04/smart-pascal-memory-and-pointers/
    https://jonlennartaasenden.wordpress.com/2015/03/07/system-interop-how-to-for-smart-mobile-studio/
    https://www.html5rocks.com/en/tutorials/webgl/typed_arrays/
    The ultimate goal is to create phone apps 
    Jim
  23. Like
    lynkfs reacted to jarto in Float 16   
    And here's a test of allocating a 8 byte buffer, change byte values in it and convert it to a 64 bit float:
    //Allocate 8 bytes var Addr8:=TMarshal.Allocmem(8); Writeln(Addr8.Size); //8 bytes Addr8.Segment[0]:=255; Addr8.Segment[1]:=56; Addr8.Segment[2]:=111; Addr8.Segment[3]:=10; Addr8.Segment[4]:=20; Addr8.Segment[5]:=30; Addr8.Segment[6]:=40; Addr8.Segment[7]:=50; WriteLn('Manipulation done'); WriteLn(TDataType.BytesToFloat64(TMarshal.ReadMemory(Addr8,8))); TMarshal.FreeMem(Addr8); If you want to see the memory contents in Chrome's developer tools, here's a neat trick:
    Compile and Execute Open DevTools, view source and search for "Manipulation" Put a breakpoint on the WriteLn-line Run again
  24. Like
    lynkfs got a reaction from jarto in Accessing W3IFrameHTMLElement URL Clicks   
    set <element>.NativeScrolling to true
  25. Like
    lynkfs reacted to jarto in Accessing W3IFrameHTMLElement URL Clicks   
    uses W3C; ... MyDiv.InnerHtml:='<a id="MyLink1" href="www.example.com/whatever">Click in me</a>'; var MyHandle:=BrowserAPI.document.getElementById('MyLink1'); if (MyHandle) then begin MyHandle.onclick:=procedure(event: JEvent) begin WriteLn('Click!'); event.preventDefault; end; end; Edit: And you can get the link by accessing MyHandle.href when that event fires.
×
×
  • Create New...