Forum > Designer

Example projects window

<< < (30/30)

wp:

--- Quote from: dbannon on May 13, 2022, 01:49:31 pm ---1. For Unix users, the current system is utterly unworkable if Lazarus has been installed under /usr

--- End quote ---
I am aware of this, but the example subsystem should not force users of other systems in which Lazarus has been installed in a writeable folder (e.g. fpcupdeluxe) to use it. Note that all this is based on an installable package. What if a user does not install the "ExampleProjects" package? He is rather lost regarding examples.

Returning to the installation under /usr. This affects only the examples coming with Lazarus. When a third-party package, e.g. fpspreadsheet having lots of examples, is installed it goes into writeable space. Is the implication that your examples window supports only the examples distributed with Lazarus?


--- Quote from: dbannon on May 13, 2022, 01:49:31 pm ---Why have each example in its own directory ?
1. It makes the above possible.
2. Its just plain tidier and allows the beginner to see just what files belong to a given Example.
--- End quote ---
Of coarse, each sample project should be in its own folder. But I don't like all these folders to be at the same level. Before your changes, all the grid examples were inside the equally named subfolder of "examples". This way it was easy to find "all grid" examples at one glance. When this is not possible any more your new example window has a severe problem with scalability.


--- Quote from: dbannon on May 13, 2022, 01:49:31 pm ---The prime purpose of these changes was to make it easier for new users. I guess users like yourself were not really considered as needing Examples to be honest.
--- End quote ---
Sure, every effort to make life easier for new users is great. But not every user is a new user. I would not say that I don't need the examples - I am very happy to be able to look how something is solved which I am not familiar with. And on the other hand, I do maintain the examples which are interesting to me and which belong to the components that I maintain. Here the "copy in user space" is useless to me since my fixes are not in version control, and I have extra work to copy it back to git.

Sorry for this criticism. It does not mean that I don't like your work. In contrast, I think it is great that you take your time and do this, and you do this well, and this entire subject can become a great thing such as the Online Package Manager. But I just want to point out that focussing on "new users" alone should not introduce too many issues for old users.

wp:
At the moment I checking the TAChart_html demo. I modified the ex-meta file of this demo and uploaded it to gitlab. Afterwards I noted that I had not edited the description correctly, fixed it and - of course - introduced another error: I quoted a word incorrectly (it is not yet online). Trying to open the examples window now fails with some json error:

'ERROR EJSONParser- invalid JSON Error at line 5, Pos 96: Expected comma (,) or square bracket (]), got token "unusual".'

First wish: Would it be possible to display the name of the erroneous file? Now I know what causes the issue, but I could imagine that in many cases it would be helpful to know the filename.

Next, more severe problem: I changed the text, removed the quoted word. Saved. I still cannot open the examples window any more, always the same error. Did a clean rebuild of the IDE - no luck... Are there some cached files somewhere? How can I clear that cache?

When something like this happens, I think the parser should continue reading, skipt this project, and add the other projects. I am not too familiar with json, is this possible?

[EDIT]
Looking at the debug logs I found the offending file: (lazarus)/components/tachart/demo/html/backup/TAChart_html.ex-meta. Deleted it, and it works again.

Conclusion: Do not seek examples in the backup folders which Lazarus creates by default.

dbannon:

--- Quote from: wp on May 13, 2022, 03:07:32 pm ---I am aware of this (Unix read only issues), but the example subsystem should not force users of other systems

--- End quote ---
But the Unix Read Only problem is only one of the reasons that I mentioned. For the "average" user, its a good idea, maybe for you, not so good. But harmful ?


--- Quote ---Note that all this is based on an installable package. What if a user does not install the "ExampleProjects" package?

--- End quote ---
Yes, I agree. But I was advised it was 'policy' to use packages where possible. Making Lazarus more modular does make sense.


--- Quote from: wp on May 13, 2022, 03:07:32 pm ---Is the implication that your examples window supports only the examples distributed with Lazarus?

--- End quote ---
No, the Examples Window searches first the Lazarus source tree then the Lazarus Config dir, that way, picking up any compliant examples that have come in from, eg, OPM. It is my intention to make some metafiles for viable examples I find in, at least the OPM packages I use. Hopefully more.
Certain, pre determined directories in config are skipped, eg, we don't pickup working copies or the working copies backup directories there.


--- Quote ---Before your changes, all the grid examples were inside the equally named subfolder of "examples"...

--- End quote ---
Indeed, some were logically located. Most were not. You obviously feel very strongly about this, I don't so I will restore the ones in ~/examples that I can.


--- Quote ---... I do maintain the examples which are interesting to me and which belong to the components that I maintain. Here the "copy in user space" is useless to me since my fixes are not in version control, and I have extra work to copy it back to git.

--- End quote ---
I agree thats a backward step for you specifically. Maybe for others who do maintain some examples. My overall impression was that the examples where, on average, quite unloved.  But I wonder if you don't use the example window to find your Example, and I restore the ones important to you, it should be business as usual ?


--- Quote ---Sorry for this criticism.....

--- End quote ---
Not at all, I need constructive criticism because I want my contribution to be useful. Yes, my focus is on new users and unashamedly so but we cannot, in that process, make things harder to maintain. So, important that I be told if I am getting off track in any way.

// Other message
> error after editing the JSON, display the name of the erroneous file?
Yes, should be easy, I'll look at it.  As an aside, I have a tool I made to edit the meta files, checks for correctness before saving. But most casual editing will be done with vi or equivalent.

> Picking up broken metafile in backup dir.
Sounds like I should exclude files in backup, too easy.

> Proceeding after encountering an error in a metafile.
Yes, I agree, a more graceful recovery is a must. Should be easy, somewhat surprised about your experience. Will deal.

// Related
The issue with newlines in JSON under Windows has left me somewhat surprised. I now understand that "\n" in C is not the same as "\n" in Java and therefore JS. (and my respect for Java has dropped even further). I'll deal with that issue too.

(Sincerely) thanks for feedback !

Davo

dbannon:
I have lodged two merge requests dealing with the above.

 https://gitlab.com/freepascal.org/lazarus/lazarus/-/merge_requests/94
Will restore the ~/examples directory structure much like it was before I started this "project", not completely because -

* All example projects are now in a stand alone subdirectory, many existed as loose files all in the one dir previously.
* Some have been omitted as discussed.

and https://gitlab.com/freepascal.org/lazarus/lazarus/-/merge_requests/93

* Solves the  problem Windows was experiencing with newlines in Example Description.
* When the ExamplesWindow encounters a JSON error in a metafile, now handled gracefully and an attempt is made to display the actual file name. The file name is also reported to console as previously.
* The above error does not abort the scanning process any more.

Navigation

[0] Message Index

[*] Previous page

Go to full version