Subject: Code snippet hosting?

From: Peter Eisentraut <[email-masked]>
Date: Thu, 19 Mar 2009 16:34:46 +0200

People often post a function, a script, or a complex query that is 
general enough to be worth keeping but perhaps not appropriate for 
pgfoundry or the documentation.  MySQL has a code snippet service for 
that: <http://forge.mysql.com/tools/>.  I think something like this 
would be quite useful for PostgreSQL as well.  Perhaps the wiki could be 
used for that; I'm not sure.

Ideas anyone?

---

From: Mike Ellsworth <[email-masked]>
Date: Thu, 19 Mar 2009 11:07:54 -0400

On Thu, Mar 19, 2009 at 10:34 AM, Peter Eisentraut <[email-masked]> wrote:
> People often post a function, a script, or a complex query that is general
> enough to be worth keeping but perhaps not appropriate for pgfoundry or the
> documentation.  MySQL has a code snippet service for that:
> <http://forge.mysql.com/tools/>.  I think something like this would be quite
> useful for PostgreSQL as well.  Perhaps the wiki could be used for that; I'm
> not sure.
>
> Ideas anyone?

No ideas for implementation - but it would be a great service to the
community and a big + for Advocacy.

---

From: "Gavin M. Roy" <[email-masked]>
Date: Thu, 19 Mar 2009 11:14:59 -0400

It wouldn't be hard for me to rebrand privatepaste.com and add the few
additional pieces (and perhaps remove others) for this.

On Thu, Mar 19, 2009 at 10:34 AM, Peter Eisentraut <[email-masked]> wrote:

> documentation.  MySQL has a code snippet service for that: <
> http://forge.mysql.com/tools/>.  I think something like this would be
> quite useful for PostgreSQL as well.  Perhaps the wiki could be used for
> that; I'm not sure.
>
> Ideas anyone?
>
> --
> Sent via pgsql-www mailing list ([email-masked])
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-www
>

---

From: Brendan Jurd <[email-masked]>
Date: Fri, 20 Mar 2009 02:15:31 +1100

> useful for PostgreSQL as well.  Perhaps the wiki could be used for that; I'm

Cool idea.  With a little massaging the wiki could accomodate this ...
there are syntax highlighting plugins we could install to get the code
snippets looking nice.  Wouldn't be as fancy as the MySQL site you
linked, but it would do the job.

Cheers,
BJ

---

From: Alvaro Herrera <[email-masked]>
Date: Thu, 19 Mar 2009 11:31:19 -0400

Brendan Jurd escribió:
> snippets looking nice.

+1

Just make sure there are appropriate category tags.

Maybe we should use a separate namespace for this?  Snippet: or
something like that ... not sure if this is a good idea.

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

---

From: David Blewett <[email-masked]>
Date: Thu, 19 Mar 2009 11:38:58 -0400

On Thu, Mar 19, 2009 at 10:34 AM, Peter Eisentraut <[email-masked]> wrote:

>  I think something like this would be quite

Django has something like that [1]. Just a thought.

David Blewett

1. http://www.djangosnippets.org/about

---

From: Brendan Jurd <[email-masked]>
Date: Fri, 20 Mar 2009 02:41:09 +1100

> Just make sure there are appropriate category tags.

Indeed.  If we use categories properly, that gives us (for free) an
alphabetical index of all available snippets.

> something like that ... not sure if this is a good idea.

I'm lukewarm about creating a namespace for it.  I reckon we could
just allow people to create pages for their snippets and if at some
future time we start getting into page name collisions, we cross that
bridge.  Another option, if the snippets start cluttering up the Main
namespace, is to make them subpages.

So, anybody got a useful code snippet they would like to volunteer as
a first test subject? =)  Failing that, we could write up the
Mandelbrot recursive query demo.

Cheers,
BJ

---

From: Alvaro Herrera <[email-masked]>
Date: Thu, 19 Mar 2009 11:45:00 -0400

> Mandelbrot recursive query demo.

I support the Mandelbrot query as the first snippet :-)

---

From: "Joshua D. Drake" <[email-masked]>
Date: Thu, 19 Mar 2009 08:52:06 -0700

> I support the Mandelbrot query as the first snippet :-)

Why wouldn't we just use the wiki for this?

Joshua D. Drake

-- 
PostgreSQL - XMPP: [email-masked]
   Consulting, Development, Support, Training
   503-667-4564 - http://www.commandprompt.com/
   The PostgreSQL Company, serving since 1997

---

From: Alvaro Herrera <[email-masked]>
Date: Thu, 19 Mar 2009 11:54:58 -0400

> Why wouldn't we just use the wiki for this?

Please go have some coffee and reread the thread :-)

---

From: Brendan Jurd <[email-masked]>
Date: Fri, 20 Mar 2009 02:55:53 +1100

> Why wouldn't we just use the wiki for this?

Um.  That's ... what we're talking about?

The conversation you're quoting was about which piece of code we might
use, to start playing with a wiki implementation.

Cheers,
BJ

---

From: "Joshua D. Drake" <[email-masked]>
Date: Thu, 19 Mar 2009 09:03:41 -0700

> use, to start playing with a wiki implementation.

Oh. Well I think I will go do what Alvaro just suggested.

Joshua D. Drake

---

From: Josh Berkus <[email-masked]>
Date: Thu, 19 Mar 2009 10:04:24 -0700

On 3/19/09 7:34 AM, Peter Eisentraut wrote:
> that: <http://forge.mysql.com/tools/>. I think something like this would
> be quite useful for PostgreSQL as well. Perhaps the wiki could be used
> for that; I'm not sure.

Yeah, this was *supposed* to be a feature of GForge when we adopted it. 
  It wasn't until after we lit up GForge and moved the accounts over 
from GBorg that Tim let me know that the snippets stuff didn't work and 
he was planning on dumping it.

In theory also, Roberto Mello was going to come back a year ago and 
re-build the function repository, but he never did.

So let's use whatever we can get up quickly.  If we're going to use a 
wiki for this, though, can it be a separate wiki from 
wiki.postgresql.org?  If I'm searching for a specific function, I don't 
want to hit dozens of pages about database conversion and commitfests.

--Josh

---

From: Greg Smith <[email-masked]>
Date: Thu, 19 Mar 2009 13:06:19 -0400 (EDT)

On Fri, 20 Mar 2009, Brendan Jurd wrote:

> a first test subject?

The snippet I use the most is already on the Wiki in the admin section:
http://wiki.postgresql.org/wiki/Disk_Usage

I was recently poking at the now defunct PostgreSQL CookBook: 
http://web.archive.org/web/20031207045017/http://www.brasileiro.net/postgres/cookbook/

Two problems with grabbing a bunch of those:  the licensing is unclear for 
code submissions to that old site, and not everything will still work 
against a current release.

But it does suggest some useful categorization for organizing a collection 
of snippets.

--
* Greg Smith [email-masked] http://www.gregsmith.com Baltimore, MD

---

From: "Joshua D. Drake" <[email-masked]>
Date: Thu, 19 Mar 2009 10:30:52 -0700

> want to hit dozens of pages about database conversion and commitfests.

I disagree. I think we should keep it under the main wiki. Just create a
new section.

Joshua D. Drake

---

From: "Greg Sabino Mullane" <[email-masked]>
Date: Thu, 19 Mar 2009 18:51:34 -0000

> wiki.postgresql.org?

Ugh, please no. We have too many domains and sites as it is: we should
be moving towards consolidation, not expansion.

If the wiki needs something to get the code snippets looking nice, etc.,
let me know, I've gotten pretty handy with MediaWiki lately. Speaking
of which, we should upgrade the wiki to a recent stable version (and upgrade
the PG backend as well)

- --
Greg Sabino Mullane [email-masked]
PGP Key: 0x14964AC8 200903191449
http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8

---

From: Selena Deckelmann <[email-masked]>
Date: Thu, 19 Mar 2009 11:59:06 -0700

+1

A nice format, with an easily distinguishable tag would be sweet.  Then we
could publish a feed of the changes, and let people re-mix/re-format as
they'd like.

Greg - could you make something based on the 'show highlighted code'
example? That included a section for tags, and a description?

i.e. http://forge.mysql.com/tools/tool.php?id=85

> of which, we should upgrade the wiki to a recent stable version (and

+10 (I'm not volunteering to do it, however.)

-selena

-- 
Selena Deckelmann
Open Source Bridge - http://www.opensourcebridge.org
PDXPUG - http://pugs.postgresql.org/pdx
Me - http://www.chesnok.com/daily

---

From: Alvaro Herrera <[email-masked]>
Date: Thu, 19 Mar 2009 15:11:35 -0400

> i.e. http://forge.mysql.com/tools/tool.php?id=85

This should be just a matter of installing a syntax highlighter
mediawiki extension, like enscript, GeSHi or ASHighlight

http://www.mediawiki.org/wiki/Extension:Enscript
http://www.mediawiki.org/wiki/Extension:SyntaxHighlight_GeSHi
http://www.mediawiki.org/wiki/Extension:ASHighlight

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

---

From: Peter Eisentraut <[email-masked]>
Date: Thu, 19 Mar 2009 21:52:56 +0200

> I support the Mandelbrot query as the first snippet :-)

Alright:

http://wiki.postgresql.org/wiki/Snippets
http://wiki.postgresql.org/wiki/Snippets/Mandelbrot_set

Now someone install all the plugins to do the syntax highlighting on the 
subpage and produce some kind of recently-added or most-often-viewed index on 
the superpage.

Or scrap it if you have a better idea. ;-)

---

From: Josh Berkus <[email-masked]>
Date: Thu, 19 Mar 2009 13:05:45 -0700

> I disagree. I think we should keep it under the main wiki. Just create a

Can you search just a section?

--Josh

---

From: Alvaro Herrera <[email-masked]>
Date: Thu, 19 Mar 2009 16:45:08 -0400

> subpage and produce some kind of recently-added or most-often-viewed index on 

Okay, Stefan was kind enough to install the syntax highlighter
extension.  I gave it a try and it seems to work great -- thanks, Stefan.

I don't know how to create an index of subpages in the superpage, but I
added category tags so you can see the snippet index here:
http://wiki.postgresql.org/wiki/Category:Snippets

---

From: Brendan Jurd <[email-masked]>
Date: Fri, 20 Mar 2009 08:06:35 +1100

> extension.  I gave it a try and it seems to work great -- thanks, Stefan.

Nice.  It does a good job of highlighting the SQL.

I took the liberty of adding the results of the Mandelbrot query to
the page while I was there =)

We could also make a template for a snippet "infobox" that appears
floated to one side and shows some pertinent attributes of the
snippet, such as what language it's in and which version of Postgres
it works with, any dependencies, etc.

> http://wiki.postgresql.org/wiki/Category:Snippets

Probably relying on the category index is the right way to go ... the
superpage could just give an intro explaining what snippets are, and
maybe how to go about adding them, and link to the category page.

Cheers,
BJ

---

From: Alvaro Herrera <[email-masked]>
Date: Thu, 19 Mar 2009 17:12:09 -0400

> it works with, any dependencies, etc.

+1 to that too!

(Note that I added a category tag for the language too.)

> maybe how to go about adding them, and link to the category page.

Sounds good.

---

From: Peter Eisentraut <[email-masked]>
Date: Fri, 20 Mar 2009 10:19:33 +0200

> http://wiki.postgresql.org/wiki/Category:Snippets

Maybe the subpages approach isn't so great then, because the 
alphabetical index in the category listing puts everything under "S" now.

I suggest that we keep /Snippets as a kind of info and index page, but 
move the rest to the top level and rely on the category tag exlusively.

---

From: Brendan Jurd <[email-masked]>
Date: Fri, 20 Mar 2009 21:28:04 +1100

On Fri, Mar 20, 2009 at 7:19 PM, Peter Eisentraut <[email-masked]> wrote:
> Maybe the subpages approach isn't so great then, because the alphabetical
> index in the category listing puts everything under "S" now.
>
> I suggest that we keep /Snippets as a kind of info and index page, but move
> the rest to the top level and rely on the category tag exlusively.
>

+1

---

From: Alvaro Herrera <[email-masked]>
Date: Fri, 20 Mar 2009 10:30:12 -0400

> > the rest to the top level and rely on the category tag exlusively.

Done.

---

From: David Fetter <[email-masked]>
Date: Sat, 21 Mar 2009 08:59:13 -0700

On Fri, Mar 20, 2009 at 10:30:12AM -0400, Alvaro Herrera wrote:
> > > I suggest that we keep /Snippets as a kind of info and index
> > > page, but move the rest to the top level and rely on the
> > > category tag exlusively.
> > 
> > +1
> 
> Done.

How do we add language categories?

Cheers,
David.
-- 
David Fetter <[email-masked]> http://fetter.org/
Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
Skype: davidfetter      XMPP: [email-masked]

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

---

From: Alvaro Herrera <[email-masked]>
Date: Sat, 21 Mar 2009 18:21:56 -0400

> How do we add language categories?

I just added some instructions in the snippets talk page.

---

From: David Fetter <[email-masked]>
Date: Sat, 21 Mar 2009 18:38:18 -0700

> I just added some instructions in the snippets talk page.

Thanks :)

Cheers,
David.

Remember to vote!