This is a collection of code snippets collected mostly from questions and answers from the mailing list email@example.com.
We have already collected several code snippets and under the Code Snippet Base you can see the for what the snippets are good for!
How to Contribute
We strongly encourage everybody who asks a question on firstname.lastname@example.org and who gets sufficient answers to summarize the answers either with the snippet creator or manually in the following template and send the xml code snippet (DTD for validation) to email@example.com:
<!-- CodeSnippet DTD --> <!ELEMENT snippet ( keywords, authors, versions?, operating-systems?, question, answer, changelog ) > <!ATTLIST snippet language  ( OOBasic|Java|Cpp|Python|OLE ) #REQUIRED application  ( Writer|Calc|Impress|Draw|Office|Database ) #REQUIRED > <!-- Put as many sensible keywords into this secion as possible, each keyword in a separate element. --> <!ELEMENT keywords  ( keyword+ ) > <!ELEMENT keyword (#PCDATA)> <!-- List the initial writers in this form (with initial="true"). Initial Writers is a term from the PDL (License). If one of these authors assined copyright to somebody else, e.g. the company they are working for, use the attribute copyright="..." and name the copyright holder. --> <!ELEMENT authors ( author+ ) >  <!ELEMENT author (#PCDATA)> <!ATTLIST author id  ID #REQUIRED initial  CDATA #IMPLIED email  CDATA #REQUIRED copyright  CDATA #IMPLIED> <!-- Put the part of the question which should be part of the overview index, as a direct child of the
-  - Programming Language
- Name the programming language which is used for this code snipped, here. E.g. "OOBasic", "Java", "Cpp", "Python", ...
-  - Application
- Name the OOo application to which the code snippet applies, here. E.g. "Writer", "Calc", "Impress", "Draw", "Office", "Database". Use "Office" if it is generic.
-  - Keywords
- Put as many sensible keywords into this section as possible, each keyword in a separate element.
-  - List of authors/contributors
- Use for each author/contributor a separatr element.
-  - Id
- Use your OpenOffice user name here.
-  - Initial
- List the initial writers in this form (with initial="true"). Initial Writers is a term from the PDL (License). If one of these authors assigned copyright to somebody else, e.g. the company they are working for, use the attribute copyright="... " and name the copyright holder.
-  - Email
- Use your email address here.
-  - Copyright
- Insert here your copyright if necessary.
-  - Question
- Put the part of the question which should be part of the overview index, as a direct child of the <question>...</question> element. For further explanation you can use child elements, like <p>...</p> or <listing>...</listing>.
-  - Heading
- Insert a short heading (abstract) here to identify the snippet (e.g. in the navigation overview).
-  - Answer
- Put the answer below this tag enclosed into <p>...</p>. You could use as many <p>'s as you want, nesting of <p>-Tags is not allowed.
-  - Code Listing
- Use <listing>...</listing> for your code listing itself. This tag will include <pre>, thus line breaks in the source will be interpreted as such.
-  - Change
- Use this element to show changes.
-  - Author-id
- The ID of the author who has mamde the change.
-  - Date
- The date of the change.
-  - Version
- Use one or more version elements to show history.
-  - Number
- Used for the verison number
-  - Status
- Used to show the status of this version. Valid entires are "tested", "untested", "may_work", "can_not_work"
-  - Platform
- Used to idnetiy the platform. Ideally the snippet contains no platform specific code. Valid platforms are "Win32", "Linux", "Solaris", "MacOSX", "All".
Open-Source-Software is free as in free speech, not necessary free as in free beer. Thus, please pay those community members who answer your questions by contributing the summary. If most community members support this system of collecting code snippets, we soon will have a great collection of such.
Of course, if you answer a question, you are welcome to use the template as well.