Jump to content

lynkfs

Moderators
  • Content Count

    661
  • Joined

  • Last visited

  • Days Won

    110

lynkfs last won the day on February 12

lynkfs had the most liked content!

About lynkfs

  • Rank

Profile Information

  • Gender
    Male
  • Location
    Australia

Recent Profile Visitors

2,995 profile views
  1. lynkfs

    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. lynkfs

    randomize

    Thanks for your 'Alea' digging. Your temp solution does work, however it still breaks my neural network component There might be some more dependencies than randomize and random only, or something else Wait till fix arrives (just realised that 'alea' is latin for 'gambling', good choice for a randomiser)
  3. lynkfs

    randomize

    The alea function was originally designed by Johannes Bagoe, as a means to improve generating random numbers The original posts (musings) from him are not available anymore, but some links remain : https://stackoverflow.com/questions/8554243/how-to-use-implement-alea-to-generate-better-random-numbers http://jsfiddle.net/rlemon/PZR4d/ If I copy the function in the links above into a smart project, it eliminates the runtime error. However it still doesn't work correctly so I'll wait till the DWS fix Randomize / Random is an integral part to the neural network component
  4. lynkfs

    randomize

    Since the latest alpha the Randomize function gives a runtime error (Randomize Sets the random generator seed to a random value). Error message : "Uncaught ReferenceError: $alea is not defined" Statement : Randomize; generated code : function Randomize() { Random = $alea() }
  5. lynkfs

    parseInt question

    yep, fixed the problem, all works as expected 👍
  6. lynkfs

    parseInt question

    Wonderful, thanks
  7. lynkfs

    parseInt question

    Correct, both snippets compile fine pre and post version 3.9 However the first snippet gives the runtime error in version 3.9, and not in versions before (tested it in all major browsers too) It's not a big deal, just happened to stumble across this minor change in compiler behaviour and true, snippet 1 is a bit confusing to read anyway.
  8. lynkfs

    parseInt question

    Apparently nested function declarations are no longer supported ? Changing the above code to below solves the problem function computeBrightness(color: Variant): Float; var R, G, B: Integer; begin function parseInt(s: Variant{String}; radix: integer = 0): integer; external "parseInt"; if(color.length=7) then color := color.substring(1); R := parseInt(color.substring(0,2), 16); G := parseInt(color.substring(2,4), 16); B := parseInt(color.substring(4,6), 16); Result := sqrt(R * R * 0.241 + G * G * 0.691 + B * B * 0.068); end; function Brightness(colour: String): Float; begin Result := computeBrightness(colour); end; hmmm
  9. lynkfs

    parseInt question

    Hmmm The code from @warleyalex above used to work for me for a long time function Brightness(colour: String): Float; function computeBrightness(color: Variant): Float; var R, G, B: Integer; function parseInt(s: Variant{String}; radix: integer = 0): integer; external "parseInt"; begin if(color.length=7) then color := color.substring(1); R := parseInt(color.substring(0,2), 16); G := parseInt(color.substring(2,4), 16); B := parseInt(color.substring(4,6), 16); Result := sqrt(R * R * 0.241 + G * G * 0.691 + B * B * 0.068); end; begin Result := computeBrightness(colour); end; However since 3.9 I get "Uncaught ReferenceError: computeBrightness is not defined" The compiled code does indeed not include the computeBrightness function What changed ?
  10. lynkfs

    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. lynkfs

    css styling

    Smart has its own layout system and Tailwind has some layout functions as well. So you're right, if you want to use them both, then you have to signal Smart what you want to do. 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 @jarto is looking at Bulma, which is sort of similar to Tailwind. Determining which of it's css functions would naturally fit into the ide is then the next question.
  12. The 'Open Recent' project list is now properly updated too 👍
  13. lynkfs

    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
  14. lynkfs

    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");
  15. lynkfs

    TXMLDocument in FPC

    there are also some browser built-in functions to handle (xml) parsing
×