Recent

Author Topic: How to contibute code examples  (Read 10815 times)

Windsurfer

  • Sr. Member
  • ****
  • Posts: 368
    • Windsurfer
How to contibute code examples
« on: March 09, 2013, 04:55:39 pm »
I have just spent several days understanding how TStringGrid works at a basic level. I now have a 8 column grid example hat shows how to work with all the button types, and store the results for each in a separate array, so that the results are sticky after the form is destroyed. (One is Auto plus an editmask, hence the extra column.)

It shows much that is not in the grid examples. Who should assess it and if suitable, add it to the distributed examples?

I have looked for guidance, but could not find anything recent.

Blaazen

  • Hero Member
  • *****
  • Posts: 3241
  • POKE 54296,15
    • Eye-Candy Controls
Re: How to contibute code examples
« Reply #1 on: March 09, 2013, 05:34:23 pm »
You can pack your demo to *.zip and create feature request on bugtracker.
Lazarus 2.3.0 (rev main-2_3-2863...) FPC 3.3.1 x86_64-linux-qt Chakra, Qt 4.8.7/5.13.2, Plasma 5.17.3
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: How to contibute code examples
« Reply #2 on: March 09, 2013, 06:08:17 pm »
What Blaazen said.

See e.g.
http://wiki.lazarus.freepascal.org/Creating_A_Patch
for more details
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

vfclists

  • Hero Member
  • *****
  • Posts: 1013
    • HowTos Considered Harmful?
Re: How to contibute code examples
« Reply #3 on: March 09, 2013, 08:16:54 pm »
Lazarus 3.0/FPC 3.2.2

Windsurfer

  • Sr. Member
  • ****
  • Posts: 368
    • Windsurfer
Re: How to contibute code examples
« Reply #4 on: March 10, 2013, 04:03:34 pm »
Thanks Guys,

I'll do as Blaazen suggests. It seems simplest. The Github route seems complex to me at the moment - I have to learn how to use it. From what I see of the blogs they seem to be more political or to duplicate what is in the forum.

vfclists

  • Hero Member
  • *****
  • Posts: 1013
    • HowTos Considered Harmful?
Re: How to contibute code examples
« Reply #5 on: March 10, 2013, 04:22:13 pm »
IMHO the unwillingness to blog is one of the major faults of the Lazarus/FPC community. It isn't always practical to have to check something out by having to sit in front a computer, go online, download in the browser, copy it into your testing folder, fire up your compiler just to see if it works, and lots of time it doesn't work the first time. You need to make some more enquires to see what has changed before you can run it.

Blogging simply creates confidence. You see it working, you see the key snippets that are required, and there are comments etc on how it can be improved. In short you know you don't have to spend an hour just to see if something that takes no longer than 10 minutes to get working if it is all up to date work. Lazarus/FPC community is infamous for hiding their lamps under bushels.

In short the community's style of communication does a poor job of leveraging people's spare hours.

Thanks Guys,

I'll do as Blaazen suggests. It seems simplest. The Github route seems complex to me at the moment - I have to learn how to use it. From what I see of the blogs they seem to be more political or to duplicate what is in the forum.
Lazarus 3.0/FPC 3.2.2

Windsurfer

  • Sr. Member
  • ****
  • Posts: 368
    • Windsurfer
Re: How to contibute code examples
« Reply #6 on: March 10, 2013, 04:37:12 pm »
I agree that it is much more difficult to look things up than it should be, and was in the heyday of Delphi. (I remember when Delphi was introduced, and after a week of testing we kicked VB out of the office for ever.) However, I am now a hobby programmer, like many, and am back on the learner curve. I'll look at the blogs to understand how they work. I have to create a safe environment in VirtualBox before I risk my production environment with svn, github or anything else.

Right now, I attach a zip file with the code for anyone to comment on. I hopeI won't be flamed for the wrong style of comments or not putting in the GPL yet.


BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: How to contibute code examples
« Reply #7 on: March 10, 2013, 06:19:09 pm »
IMO it's best to put things on the wiki in order to centralize information. The wiki contains tutorials as well as documentation etc.

I see no reason to blog about it on some external site.

To each his own.
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

vfclists

  • Hero Member
  • *****
  • Posts: 1013
    • HowTos Considered Harmful?
Re: How to contibute code examples
« Reply #8 on: March 10, 2013, 08:34:41 pm »
The difference between a wiki article and a blog are quite different.

First of all a blog gives more context and more freedom for self-expression. You have the opportunity for a better narrative. You are able to place your choices in context, and inform about the sources of your information and other alternatives that you tried and possibly rejected. Blogs have dates if it was something done years ago then it may not be very current. All these things are obvious. Blogs tell you who is doing what, when they are doing it and how well they are succeeding.

See how sometimes the wiki displays totally out of date information. The articles are not attributed. A single page may have about 10 different contributors and may contain outdated information which is over 10 years old. It is not obvious who wrote what and when it was written, or who deleted or edited something written by another. Some of the contributors may have not been involved with Lazarus for a long time, and you don't know if you can contact them to discuss or clear up some issues about the code. Blogs make you know that there is a living community involved with the software you are using.

If you know nothing about Lazarus a blog roll or aggregator will tell you about what is happening with Lazarus. It is important for people who nothing about Lazarus and may be interested in trying it.

And I said earlier, wiki it, github it, but blog it first, ie tell us more about what you were doing and how you came to do it in the way you did and you discoveries along the way. It may be basic or trivial, but someone even less knowledgeable will learn something from it.

IMO it's best to put things on the wiki in order to centralize information. The wiki contains tutorials as well as documentation etc.

I see no reason to blog about it on some external site.

To each his own.
Lazarus 3.0/FPC 3.2.2

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: How to contibute code examples
« Reply #9 on: March 10, 2013, 08:38:54 pm »
Wiki has a history. You can see all changes, who edited etc.

Wikis get updated with new information; old blog posts don't.

Edit: oh btw, have you read any of the tutorials on the wiki? Do you think they should be moved to blog posts?

Etc etc.

As I said, to each his own ;)

« Last Edit: March 10, 2013, 08:44:43 pm by BigChimp »
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

Nebula

  • Jr. Member
  • **
  • Posts: 88
Re: How to contibute code examples
« Reply #10 on: March 10, 2013, 11:14:54 pm »
I put some work in on the wiki when I felt it needed updating or clarifying, but I can see the advantage of a more narrative style on a blog too. Trouble is, it's such a pain in the seat to set up a blog  :D

If freepascal.org would allow users to blog on their server, that could help, I guess.

But why not just start a forum thread for any discoveries you wish to share? I did that once, when researching how to query an MS SQL database and show the results in the Laz. version of a datagridview. When I was happy with what I'd come up with, I added the code to the forum thread. It's still there if anyone wishes to read it!
Newbie testing Lazarus v1.0 - very impressed
Win 7 at work, XP and Linux Mint at home.
It all started with a ZX80 on a b/w telly........
Code: [Select]
Uses Smiles, GoodHumour, WantsToHelp;
{ never liked C - curly brackets are for comments! }

vfclists

  • Hero Member
  • *****
  • Posts: 1013
    • HowTos Considered Harmful?
Re: How to contibute code examples
« Reply #11 on: March 11, 2013, 12:13:04 am »
You can get a free blog at WordPress or blogger or wherever.

I put some work in on the wiki when I felt it needed updating or clarifying, but I can see the advantage of a more narrative style on a blog too. Trouble is, it's such a pain in the seat to set up a blog  :D

If freepascal.org would allow users to blog on their server, that could help, I guess.

But why not just start a forum thread for any discoveries you wish to share? I did that once, when researching how to query an MS SQL database and show the results in the Laz. version of a datagridview. When I was happy with what I'd come up with, I added the code to the forum thread. It's still there if anyone wishes to read it!
Lazarus 3.0/FPC 3.2.2

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: How to contibute code examples
« Reply #12 on: March 11, 2013, 07:34:53 am »
Right now, I attach a zip file with the code for anyone to comment on. I hopeI won't be flamed for the wrong style of comments or not putting in the GPL yet.
Thanks!

Some tips/ideas/remarks:
1. You don't need to add the .o, .obj etc files and the backup folder. A good way of zippig only the relevant source files is by going to Project/Publish project, publish it to an empty directory and zip that up.
2. Noticed your batch file. You can also use lazbuild to build Lazarus projects from the command line
3. Who cares about the comment styles - glad to see a nicely commented program ;)
4. You can use the Source/JEDI Code Format tool to format the code uniformly (indentation, I believe capitalization of keywords etc). Not saying it looks bad right now, but just FYI
5. Looks like a nice way of demonstrating various grid contents - perhaps a good candidate to add to an issue report and place it somewhere in $(lazarusdir)\examples\gridexamples\customgridstyles. I would add a readme.txt that introduces the example.
6. If you're going to add it to examples, I would license it as modified LGPL same as Lazarus, for clarity.

Thanks!
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

Windsurfer

  • Sr. Member
  • ****
  • Posts: 368
    • Windsurfer
Re: How to contibute code examples
« Reply #13 on: March 11, 2013, 09:35:52 am »
Thanks Bigchimp,

I'll follow your suggestions. I have also just discovered the Validate event, so will look at adding a filter to constrain the time format to 24:59:59.

Windsurfer

  • Sr. Member
  • ****
  • Posts: 368
    • Windsurfer
Re: How to contibute code examples
« Reply #14 on: March 11, 2013, 10:45:22 pm »
Have done the things suggested by BigChimp. Good learning experience - thanks. The attachment is the result. I'll look at the next steps - Github and adding an example in $(lazarusdir)\examples\gridexamples\customgridstyles - in a few days.

Laz 1.06, FPC 2.60, Windows 8, 64bit

 

TinyPortal © 2005-2018