Recent

Author Topic: New sub forum for sharing small code snippets or small programs  (Read 2309 times)

JiaXing

  • Jr. Member
  • **
  • Posts: 75
I got this idea from the FreeBASIC forum. Our forum lacked a sub box like that. It's for beginners and old people migrated from Turbo Pascal and doesn't good at Lazarus to share their old school small programs or code snippets.
I'm subscribed to the church of 440bx. Say no to OOP  :P

Thaddy

  • Hero Member
  • *****
  • Posts: 14373
  • Sensorship about opinions does not belong here.
Re: New sub forum for sharing small code snippets or small programs
« Reply #1 on: April 28, 2020, 06:48:21 pm »
Well, it may be a good idea to just filter out the programs from this forum, because a lot of some people already write full and working examples over the history of this forum.
There are some real gems. And they are more or less tied to a topic.
« Last Edit: April 28, 2020, 07:40:05 pm by Thaddy »
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9869
  • Debugger - SynEdit - and more
    • wiki
Re: New sub forum for sharing small code snippets or small programs
« Reply #2 on: April 28, 2020, 08:34:16 pm »
IMHO a forum is not a good tool to maintain a snippet/code database.

Though I also have no idea what tools there are for this (nor do I know, how much work any of the actual server admins are willing to put into this).

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: New sub forum for sharing small code snippets or small programs
« Reply #3 on: April 28, 2020, 08:46:00 pm »
I would prefer seeing code snippets/examples about some feature in the corresponding wiki page. For "general" kind of things we might also create a page or category in the wiki.

In a sub forum or topic those type of posts would tend to get lost quite quickly. Though maybe not as quickly as now  :)

Whatever the case, it would need some curating to maintain the general quality, subjective as that is, wouldn't it? Any volunteer? :D

ETA: BTW, wasn't there a similar topic before? I kind of recall having seen this quite recently, in the last month or two ...
« Last Edit: April 28, 2020, 08:49:50 pm by lucamar »
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

440bx

  • Hero Member
  • *****
  • Posts: 4030
Re: New sub forum for sharing small code snippets or small programs
« Reply #4 on: April 28, 2020, 09:09:36 pm »
IMHO a forum is not a good tool to maintain a snippet/code database.
In a way I agree but, one thing that really bugs me is that it is not possible to search the forum for posts that have attachments.

If that were possible then the entire forum would be a way for everyone to share small code snippets or programs.  Lots of members have attached interesting examples and there doesn't seem to be a way to get a list of them.  One great advantage of the forum is that it is free form and very dynamic.  The wiki requires being a bit more "organized" and formal and, in addition to that, there is no directly associated thread where a related question can be posted (a new thread can always be created but, it's not quite the same as asking the question directly in the thread where the attachment resides.)

Maybe a "solution" might be to adopt a convention whereby anyone who attaches something to a post, includes a string like "[attachment]" (or something along those lines) in the post.  That way, searching for that string would produce a list of posts that have attachments... it's just a thought.  The ideal solution would obviously be for the forum software to be able to search for posts with attachments.



(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: New sub forum for sharing small code snippets or small programs
« Reply #5 on: April 28, 2020, 09:19:57 pm »
In a way I agree but, one thing that really bugs me is that it is not possible to search the forum for posts that have attachments.

Yep, +1 to that. Also would be nice if there were a way to search for post with embedded code i.e. with one or more [code=pascal] blocks.
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9869
  • Debugger - SynEdit - and more
    • wiki
Re: New sub forum for sharing small code snippets or small programs
« Reply #6 on: April 28, 2020, 10:12:50 pm »
Yep, +1 to that. Also would be nice if there were a way to search for post with embedded code i.e. with one or more [code=pascal] blocks.

Have you tried to put exactly that in the search box (no quotes)?  + any other words to search for

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11452
  • FPC developer.
Re: New sub forum for sharing small code snippets or small programs
« Reply #7 on: April 28, 2020, 10:23:20 pm »
Then it just needs a team to collect snippets on a github repo, and then use the FPC fultext search engine to index it? Lightweight, and most elements are there already.

Then you can also do as add some metadata in comments, and track it over time, build indexes etc.

avra

  • Hero Member
  • *****
  • Posts: 2514
    • Additional info
Re: New sub forum for sharing small code snippets or small programs
« Reply #8 on: April 29, 2020, 12:53:54 am »
I have not seen a good online code snippet system which supports Pascal. Especially not a forum based one.

Until then maybe these offline solutions can be of assistance to someone in need:
https://github.com/taazz/CodeLibrarian
https://github.com/delphidabbler/codesnip
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

lainz

  • Hero Member
  • *****
  • Posts: 4468
    • https://lainz.github.io/
Re: New sub forum for sharing small code snippets or small programs
« Reply #9 on: April 29, 2020, 05:18:47 am »
I search the forum with Google and most times I find the code that I need in the first results.

AsleyCruz

  • Jr. Member
  • **
  • Posts: 99
    • Graphic and web designer
Re: New sub forum for sharing small code snippets or small programs
« Reply #10 on: April 29, 2020, 05:36:54 am »
Like lainz, I use Google too.

Example for browsing just on the forum:
Code: Text  [Select][+][-]
  1. the title site:forum.lazarus.freepascal.org

-

Is there any section (on the forum only) to share our applications? Like showcase
Graphic & web designer

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9869
  • Debugger - SynEdit - and more
    • wiki
Re: New sub forum for sharing small code snippets or small programs
« Reply #11 on: April 29, 2020, 03:01:52 pm »
Is there any section (on the forum only) to share our applications? Like showcase

Not really, and for a reason.

If people actually search the forum before asking their question, the results should not include lots of stuff about other peoples app.

Unless the 3rd party tool is a add on package to the IDE. 
Or otherwise related to using the FPC/IDE, like fpcupdeluxe.
Or, chats that are not so much about the product, as they are about the techniques used to code them (as that again may be something that helps others in their coding experience)


I do know that the wiki pages (for showcasing) have very little exposure. So they do not really appeal much for that purpose.

They also do not have an option for commenting. However, mind you that "commenting" here, should explicitly refer to something like a thumbs up/down (or 1 to  5 stars), with a real short bit of text.
The forum does not offer such a vote-system.

If you put the showcase on the forum, you end up with long discussions. Yet, if someone wants to discuss there product at length, then for that they should have their own forum. (exception are the above mentioned rules).
This forum is about the FPC and the Lazarus IDE, and it should be kept like that.

(Yes there are probably 1 or 2 exception that slipped in, it will be monitored, and if need arises it will be addressed)


Our main homepage features the  "random project" and a link to https://wiki.freepascal.org/Lazarus_Application_Gallery

The selection of "random projects" from that page is currently really small.
If anyone wants to improve that (collect projects, make concise descriptions, prepare the image in the correct size, pack it all together to ONE update every now and then), please get in contact with me. (Don't, if you have just one single app you want to get added. I am not looking to get flooded by everyones individual request ;) )

Same for the "tip of the day"

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2020
  • Former Delphi 1-7, 10.2 user
Re: New sub forum for sharing small code snippets or small programs
« Reply #12 on: April 30, 2020, 01:43:27 am »
ETA: BTW, wasn't there a similar topic before? I kind of recall having seen this quite recently, in the last month or two ...

Indeed, and it was implemented. See the Wiki How-to Demos Portal.

 

TinyPortal © 2005-2018