Recent

Author Topic: Example projects window  (Read 54077 times)

wp

  • Hero Member
  • *****
  • Posts: 11833
Re: Example projects window
« Reply #60 on: January 16, 2022, 11:17:58 am »
li]I'll copy a user selected project into a dir tree under 'examples' in the Lazarus config dir.
Make this directory configurable by the user, like it is in OPM. I have numerous Lazarus installations on my HD, and I'd like to re-use the examples of one installation by another installation for example to check whether sample code is compatible between versions.

dbannon

  • Hero Member
  • *****
  • Posts: 2778
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Example projects window
« Reply #61 on: January 16, 2022, 01:23:09 pm »
Make this directory configurable by the user,....

Noted, makes a lot of sense.

Davo
Lazarus 2, Linux (and reluctantly Win10, OSX)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

dseligo

  • Hero Member
  • *****
  • Posts: 1180

dbannon

  • Hero Member
  • *****
  • Posts: 2778
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Example projects window
« Reply #63 on: January 17, 2022, 12:09:58 am »
It says 'Page not found'.

Sorry, I had left it 'private'. Fixed now.

Davo
Lazarus 2, Linux (and reluctantly Win10, OSX)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

dseligo

  • Hero Member
  • *****
  • Posts: 1180
Re: Example projects window
« Reply #64 on: January 17, 2022, 01:20:16 am »
I tried ExScanner application, you did a great work.

You are missing closing single quote in line 154 of unit1.pas (EditLocalExamples.Text := Home + '\AppData\Local\lazarus\;) and in line 156 I changed the number to 32866275 (32480729 was probably old repo number).

Stand alone application is OK, but I think it would be best if ExScanner is turned into a package and put in OPM. This package would add menu entry in Lazarus to start ExScanner window. Then anybody could install package from OPM, and then browse and use online examples. This way it would be easy to add this functionality to existing Lazarus (since it would probably take a lot of time for this to be built-in Lazarus).

Oh, and is it possible to delete project1 file from gitlab, it's 25MB binary?

dbannon

  • Hero Member
  • *****
  • Posts: 2778
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Example projects window
« Reply #65 on: January 17, 2022, 04:01:28 am »
You are missing closing single quote in line 154 of unit1.pas
Thats pretty careless, thanks.

Quote
(32480729 was probably old repo number).
Indeed, just about to do another commit, trying to break apart the user from Admin content.

Quote
Stand alone application is OK,

Standalone is only a development stage. Its intended that a version of it will replace the Examples Window in Lazarus but I need something to work with now that allows easy viewing.

Quote

Oh, and is it possible to delete project1 file from gitlab, it's 25MB binary?
OK, thats happened when I pushed it all up again. Quite silly !  I will sure fix that.

I will shortly push up a version addressing the above but also restructured so its easy the see the (proto) Examples Window as an end user will see it and, separately, provide the tools someone administering the project can use.

Thanks for your feedback.

Davo
Lazarus 2, Linux (and reluctantly Win10, OSX)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

dbannon

  • Hero Member
  • *****
  • Posts: 2778
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Example projects window
« Reply #66 on: January 22, 2022, 01:47:51 am »
Some Progress -

I now have the app that demo's the prototype Lazarus Examples Window also provide a number of tools to manage the process of attaching a metadata file to each Example. Works OK but only superficially tested. So we are now at the stage where -

* Testers and their comments very welcome.
* Contributors willing to review Examples and write the very minimal metadata file needed.

Fine the app in https://gitlab.com/dbannon/laz_examples/-/tree/main/Utility/ExScanner

Its self documenting (yeah, and pigs might fly) ....

Davo
Lazarus 2, Linux (and reluctantly Win10, OSX)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

dbannon

  • Hero Member
  • *****
  • Posts: 2778
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Example projects window
« Reply #67 on: February 12, 2022, 04:14:00 am »
OK, time for a Stage Report.

--- Examples Done ---
So far, I have reviewed, occasionally edited, made a metadata file for and added to my gitlab repo just over a 100 examples, all sourced from <laz-dir>/examples . Thats just about all viable examples in that dir. I have excluded a number, most because they are "old school", built without ObjectInspector. Yes, I know its viable and even, some times a good thing to do it all in code but for someone looking for a specific example, its a distraction. I suggest one or two examples of that approach is all thats needed.

Some projects made it to gitlab with the keyword "Need Work", ones that need better docs or some other fix. I have taken the liberty of fixing some obvious ones myself.

If you want to look through the list, in random order, see https://gitlab.com/dbannon/laz_examples/-/blob/main/projects.md

--- Tools ---
I have a viable tool to help with this processing that also launches a potential "Examples Window", what the end user will see if it makes it into Lazarus. The Examples Window will download a master metadata file (if required) and displays the contents, allows selecting by category and allows searching by keyword. And will download an indicated project if required.

Should build cleanly for most people but most will need to alter the default directories I use. Easy for anyone on this list.

https://gitlab.com/dbannon/laz_examples/-/tree/main/Utility/ExScanner

--- Other Examples ---
The Lazarus bundle has a large number (maybe 200 or so) more projects scattered through the tree, mostly associated with particular components. Here I need some discussion of what should be included.

Tests - lots of what is currently considered Examples are in fact Tests, sometimes for a specif bug and sometimes to exercise a particular component or set of components. Some are useful as examples and some are not, maybe because they focus too much on testing and have no educational intention.

I believe Tests should stay where they are and ones that are useful as Examples be also copied to the Examples system.

Non Tests - ones intended as examples, some are good, some broken, some irrelevant. Quite a lot depend on optional units but without metadata user has not idea. Some appear to depend on units that are now part of other, default installed, units. In other words, its going to be time consuming and ideally done by someone with some familiarity with the specialized component, DBase, LazReport, Chart etc.

--- Questions ---

* Am I on the right track ?

* Am I correct in excluding all but a few example projects that don't use the Object Inspector ?

* Am I being too ambitious ? Should we leave the Example code where it is and just graft on the metadata somehow ?

Davo


 

Lazarus 2, Linux (and reluctantly Win10, OSX)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

howardpc

  • Hero Member
  • *****
  • Posts: 4144
Re: Example projects window
« Reply #68 on: February 12, 2022, 06:59:37 am »
* Am I on the right track ?
Yes and no. I don't see how you can be motivated to do much more work on this without closer collaboration with the developers. Why not start from the existing Tools > Example Projects... dialog and improve it?
Remove the tests and bugs "examples" (they should be placed somewhere else in the tree by the developers, if they are still needed).
Provide metadata for each example considered worthy to be kept, and provide a tool for local editing of that metadata and the example itself, and prune the examples to remove the outdated and unhelpful ones, and a tool for uploading the improved example with its metadata to your temporary repository.

Quote
* Am I correct in excluding all but a few example projects that don't use the Object Inspector ?
Certainly. There could be a category in which you place a couple of good examples of non-RAD, code-only utilities, useful for people who are no longer beginners.


Quote
* Am I being too ambitious ? Should we leave the Example code where it is and just graft on the metadata somehow ?
I think you need to work more closely with the developers, or you risk all your work just being rejected or ignored.

dbannon

  • Hero Member
  • *****
  • Posts: 2778
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Example projects window
« Reply #69 on: February 13, 2022, 08:02:34 am »
Yeah, thanks Howard.  I understand your message.

I felt that this was/is the best approach but that I (or someone) needed to get some partially working model happening to demonstrate its practicality.

Where it is up to now would be relatively easy to scale back from, to make a version that is not on-line for example, it would be a case of replacing the existing examples dir with my one, it has a number of edits and a meta file for each project. And it has projects moved into their own unique directory. But would all work with the existing Lazarus Examples Window (as it works now). When all such Examples are to treated, work could start on the Examples Window.

Grafting my prototype Examples Window onto Lazarus would also be relatively easy (I think) but I think it all would be a huge diff file so would need reassurance there is some interest and, sensibly, some parallel testing.

Making incremental changes, firstly to the existing examples, then to the Lazarus Examples Window is a possibility and perhaps, a lot less risky.

Davo
Lazarus 2, Linux (and reluctantly Win10, OSX)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4458
  • I like bugs.
Re: Example projects window
« Reply #70 on: February 15, 2022, 02:59:37 pm »
Sorry for the delay, I had some other activities. (*)

Yes, we need online example projects. IMO you are on the right track. There are 2 separate things now:
1. The GUI to download and run example projects.
2. Improving the actual example projects.
These two can be done in parallel.
Sometimes a big revamp is needed.
It turned out many example projects are old and don't use .lfm files which are quite essential in RAD. Most of them should be updated. Of course there can be an example of how to do it in Pascal code only, but that is more like an advanced topic.
Do we need the "examples" directory under Lazarus sources at all? Should all projects be moved to an online repository? I think they should.
It is good to think out of the box so to speak. Projects under "examples" directory should be copied to a writable directory in standard *nix system installs which is clumsy. We do things in clumsy way? From an online repo they will always go to a writable directory.
Some components will have their own examples included. Should the GUI support them somehow? I don't know. Those examples can always be opened manually.
These are my thoughts, other developers may see things differently.
BTW, currently the Lazarus Code and Component Repository (CCR) also has example projects.

@dbannon, you should fork Lazarus sources in GitLab and create an IDE integration package. The settings should be registered as a new page under the global options window. OPM should do the same thing BTW.
Your GUI must replace the existing Example Projects ... window. It can be merged to trunk (main branch) when everybody agrees. The trunk can be under construction sometimes, no problem.
If you want to maintain a standalone app, then you need 2 packages. One for the example manager functionality and one for registering the IDE integration. Both the standalone app and the IDE integration package would use the first package.
A standalone app may help with debugging, otherwise it has very little usage.
Later you will need more rights for Lazarus sources. You clearly have energy and motivation now for this project. It should not be wasted.

Juha

(*) I bought a 18" bar (X-Force) and chain (X-Cut) for my Jonsered CS2152 saw and did some lumber jack stuff as the picture proves:
 https://drive.google.com/file/d/1sNfKzB-1zmwUl9FWEWv2m3BUts9AXgpG/view
I also bought some forest. It is now or never. I am getting old. When I get very old, I will not be able to work in a forest any more.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

Thaddy

  • Hero Member
  • *****
  • Posts: 14169
  • Probably until I exterminate Putin.
Re: Example projects window
« Reply #71 on: February 15, 2022, 05:40:03 pm »
Sorry for the delay, I had some other activities. (*)

(*) I bought a 18" bar (X-Force) and chain (X-Cut) for my Jonsered CS2152 saw and did some lumber jack stuff as the picture proves:
 https://drive.google.com/file/d/1sNfKzB-1zmwUl9FWEWv2m3BUts9AXgpG/view
I also bought some forest. It is now or never. I am getting old. When I get very old, I will not be able to work in a forest any more.
Serious power tool! Can I rent it? We have a piece of forest in Lithuania (inherited, 7 Ha) Should be right next door across the Baltic  :D
( Now playing "when I'am 64" have to wait till Monday....)
« Last Edit: February 15, 2022, 05:46:05 pm by Thaddy »
Specialize a type, not a var.

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4458
  • I like bugs.
Re: Example projects window
« Reply #72 on: February 15, 2022, 06:44:18 pm »
Serious power tool! Can I rent it? We have a piece of forest in Lithuania (inherited, 7 Ha) Should be right next door across the Baltic  :D
( Now playing "when I'am 64" have to wait till Monday....)
Wow!
I added a follow-up thread with details here :
 https://forum.lazarus.freepascal.org/index.php/topic,58345.0.html
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

ASBzone

  • Hero Member
  • *****
  • Posts: 678
  • Automation leads to relaxation...
    • Free Console Utilities for Windows (and a few for Linux) from BrainWaveCC
Re: Example projects window
« Reply #73 on: February 15, 2022, 07:01:36 pm »
Yeah, thanks Howard.  I understand your message.

I felt that this was/is the best approach but that I (or someone) needed to get some partially working model happening to demonstrate its practicality.

Davo

Awesome work, Davo

I agree with the need for dev support to move forward, but I also agree that what you did to get is jumpstarted was likely needed as well.
-ASB: https://www.BrainWaveCC.com/

Lazarus v2.2.7-ada7a90186 / FPC v3.2.3-706-gaadb53e72c
(Windows 64-bit install w/Win32 and Linux/Arm cross-compiles via FpcUpDeluxe on both instances)

My Systems: Windows 10/11 Pro x64 (Current)

balazsszekely

  • Guest
Re: Example projects window
« Reply #74 on: February 15, 2022, 08:24:25 pm »
@Davo

To save a few hours of work I attach a package. After compile/install/rebuild, you can access the main, for now empty, form via LazMenu->Tools->Online Example Projects(Ctr + Alt + E). What is now laz_examples(ExScanner) should go into main form and main_examples(ExScanner) should be an options dialog accessible from laz_examples aka. package main form. It sounds confusing, but you know what I meant to say.
Please consider adding a tree structure, replacing the listview, like in the attached picture, also master.ex-meta does not pass an online json validator. For translation purposes, each and every caption/text should be a resourcestring, please see uconst.pas for more details.


Other then this it's an excellent start. Good luck with the example project!


« Last Edit: February 15, 2022, 08:32:13 pm by GetMem »

 

TinyPortal © 2005-2018