LiteratePrograms:Public forum

From LiteratePrograms

Jump to: navigation, search

This is the public forum, a place for open discussion among all members. Feel free to discuss anything. Please don't remove this notice.

Archives: 1


New Template?

If we take a look at Selection sort (Haskell) we can see {{codedump}} in use. There is, however, a bigger problem on that page. The code that's there cannot possibly compile. It makes use of a symbol "usun" which is not defined anywhere. Neither GHC's online docs nor the Hoogle search engine knows of it, so it looks to me as if someone cut-and-pasted a block of code that referenced something that didn't make it. Perhaps we could also have a {{incomplete}} or {{broken}} template to mark pages like this? MTR/严加华 23:13, 15 June 2007 (PDT)

Done. See {{incomplete}}. --Allan McInnes (talk) 14:53, 16 June 2007 (PDT)

Latex2mediawiki and noweb/funnelweb compatibility

If I use noweb to generate a latex document, is there a way to convert the latex document into the equivalent mediawiki syntax? May be to redefine the latex macro, to expand to its corresponding mediawiki syntax. (Assuming that the macro used in that latex document contains only a subset of macro that can be mapped to mediawiki syntax.) Anyhow, can the document written in mediawiki syntax be exported to pdf/html/etc., by the command line in batch mode? --Ans 02:21, 4 January 2008 (PST)

One more question. Does noweb and funnelweb have compatible syntax? --Ans 02:21, 4 January 2008 (PST)

Hmm, well, LaTeX is in general much more expressive than Mediawiki wiki syntax, and I'm not aware of any translation tools between the two (I don't believe it would be straightforward; some parts would probably have to get embedded in math tags). I haven't used funnelweb so I can't speak to compatibility there. Deco 06:44, 8 March 2009 (MDT)
A suggestion: Why not using latex2html (or something similar) to generate HTML and then convert the HTML code to Mediawiki code? --Sigbert 00:30, 21 July 2009 (MDT)

Page load problem

When trying to load Look and say sequence (sed), this results in

Catchable fatal error: Object of class Title could not be converted to string in /nr/web/literateprograms/includes/Database.php on line 1182

This problem seems to have appeared recently (the page has been changed two days ago, so at least then it probably loaded OK), so this probably is caused or triggered by a recent change. --Ce 03:57, 13 April 2008 (EDT)

As I just noted, this problem seems to be more general; basically all pages containing code seem to be affected. It's obviously not the brackets in the title because the (wrongly titled) page Ada Hello World doesn't load either. --Ce 04:05, 13 April 2008 (EDT)
Actually, pages without code also seems to be affected. Maybe all pages in main namespace are affected? This might be because of a software update somewhere in the system (f.ex. new PHP version). Anyway, there isn't much we can do as long as we don't have access to the server. Ahy1 10:54, 13 April 2008 (EDT)
Guess we'll just have to be patient. I'm sure Deco will take a look at it soon. -- Derek Ross | Talk 14:28, 13 April 2008 (EDT)
This problem is no longer reproducing and I'm not sure what was up. Please let me know if you encounter it again. Deco 06:42, 8 March 2009 (MDT)


Consider moving the sandbox to another namespace. LiteratePrograms:Sandbox, for instance. Codeholic 12:59, 23 April 2008 (EDT)

That wouldn't work currently, because the literate programming functionality is only turned on for pages in the main article space. Deco 06:41, 8 March 2009 (MDT)

Spam attack

Currently the vast majority of all edits seem to be insertion/removal of spam. The pattern of the spam is easy to recognice: An IP inserts lots of external links. Therefore I think automatic link creation should be prevented. The least intrusive (but probably the most complex to implement) would be to have captchas for every anonymous edit creating an external link (one could further make a whitelist of sites where a captcha is not needed, to further reduce the impact on anonymous users). In addition, Account creation would have to be protected with captchas.

If implementing captchas is too complex, maybe another solution would be to automatically reject edits which insert more than five external links at once. Given that legitimate edits usually don't need many external links (most don't even need any external link at all), this shouldn't be a too serious restriction. However there would be the danger of the spam bots adapting by making lots of edits to the same page, inserting a few links each time, which would be even worse than the current situation.

Disallowing link creation for anonymous users would be another solution. After all, an anonymous user can insert the URL as text and then ask a non-anonymous user to convert it into a link (or, alternatively, he can just register and add the link himself as registered user). However, in that case account creation would also have to be protected somehow (captcha, email confirmation, whatever), to prevent spam bots from creating random user accounts.

Besides that, I think it would be a good idea to remove pairs of revisions which consist only of spam insertion and subsequent removal, with no other change being made, from the history. They only clutter the history and don't provide any value. This could probably be semi-automated (i.e. a bot searching for obvious spam insertion and checking that the following revision is an exact rollback). Completely automating it might be too dangerous (but then, if the criterion for identifying spam is very strict, even that may be possible). --Ce 03:36, 2 September 2008 (EDT)

I think the ConfirmEdit extension would be helpful. It can be configured to require captcha only on account creation and link inertion, and it can also have a whitelist of urls for which cpatchas are not required.
I am not sure, however, if this site will survive unless more than one person has access to do these things. My impression is that the site owner has lost interest in the wiki, and will not even answer questions for which he is the only person who can answer. This is understandable. We should not expect one person to go on forever doing lots of work for free, maintaining a site like this. If it is possible, we should try to distribute the responsibility of maintaining/running this site among more persons. I would be willing to participate in this, but there should also be more volunteers. This, of course, depends on Deco's willingness to share this responsibility. Ahy1 06:07, 20 September 2008 (EDT)
Ce and Ahy1 both make very sensible suggestions here. We'll continue to remove the spam come what may, but prevention would be a whole lot better than cure. -- Derek Ross | Talk 11:40, 20 September 2008 (EDT)
Hey all, apologies for my very long delayed response. I am presently disabling anonymous editing and enabling CAPTCHAs on all edits to control the vandalism/spam problem. Deco 22:59, 7 March 2009 (MST)
Testing CAPTCHA again. DecoMortal 23:22, 7 March 2009 (MST)

Dump database

Has someone a dump of the lpwiki? I put a comment on Deco's pade, if you read it may be some of you could answer.

Lehalle 01:41, 28 November 2008 (EST)

I'll look at producing a proper dump right away. Deco 23:26, 7 March 2009 (MST)
Dumps are now working and you can view a valid one here. Deco 04:00, 8 March 2009 (MDT)


After seeing how hard you all worked to protect the wiki in my absence I feel really terrible for letting you down. I felt overwhelmed by other responsibilities, and felt like I had screwed up this project and was afraid to deal with it, but after dropping the ball on both database dumps and vandalism protection I didn't leave others a way forward. I promise you all I will remain responsive and helpful - I've added some additional contact info to my user page in case I don't check my talk page here. I'm also prepared to give shell access to any of you who wants to be an active developer and help deal with issues like this in the future. I'm very thankful to you all and I hope I can make up for my mismanagement now. Deco 04:35, 8 March 2009 (MDT)

Don't feel bad. This is just a hobby for all of us. And if more important issues arise (for any of us), they have to be dealt with first. -- Derek Ross | Talk 12:39, 8 March 2009 (MDT)
I have to agree with Derek here: While I'm indeed very glad that this site is online again, it's nothing our lifes depend on. If it were, I would have contacted you much earlier about it :-) Basically this site is a gift you give to us, and while we enjoy this gift and would have missed it if it had been gone, there's clearly no obligation for you to continue giving it. The more I'm thankful that we got it back. --Ce 12:17, 9 March 2009 (MDT)

Math images broken

The images generated by the <math>...</math> tags seem to be Error 403 Forbidden. --Spoon! 03:04, 11 March 2009 (MDT)

Woops - fixed, thanks! It also appears I'm missing latex and dvips, so new math tags won't work. I'll have to get them installed. Deco 13:55, 12 March 2009 (MDT)
It was a bit tricky, but new math notation will now work - I had to do a local install of LaTeX and convince Mediawiki to use it when it's not in the path. :-) Deco 21:42, 12 March 2009 (MDT)

Captcha kills summary

I've noticed that when editing a single section and adding something to the summary, then when the page with the captcha request appears, the summary is reset to the original value. If there's an easy fix for that, it would be nice if it could be fixed (it's not important, though, because after all, you can just enter the summary after the captcha) --Ce 13:23, 11 March 2009 (MDT)

Ah, I see what you mean. I've reproduced this now. I think I'm just going to worry about upgrading Mediawiki and the ConfirmEdit extension along with it, and I think it will probably go away. Deco 21:56, 12 March 2009 (MDT)

New policy

Because I think LiteratePrograms needs something to shape its direction and scope, I have created a new policy document called LiteratePrograms:Purpose and scope. I think it's very much in line with what we've been doing so far. I invite your comments on it. Deco 21:28, 30 March 2009 (MDT)

Seems pretty reasonable to me. -- Derek Ross | Talk 12:56, 31 March 2009 (MDT)
I agree with Derek. It nicely articulates what I've always thought this wiki was about. --Allan McInnes (talk) 00:44, 3 April 2009 (MDT)
Apart from the following minor roblem, I also agree:
The last bullet says:
"concerns such as efficiency and completeness should not take precedence over clarity of presentation."
What exactly is meant with "completeness" in this context? I'd intuitively expect it to mean that the code is compilable as is (i.e. you don't need to add anything or fill out gaps in order to compile it), but in that case, I'd think the examples should be complete. Completeness in this sense doesn't remove anything from the clarity; after all, the literate programming technique makes sure that you can move things like boilerplate into separate sections, thus not interfering with the description of the interesting parts of the code.
If something else is meant with "completeness", maybe it would be a good idea to clarify. --Ce 07:16, 4 April 2009 (MDT)
My interpretation, based on the beginning of that bullet stating that LP is "not a database of raw code snippets", is that efficiency and completeness refer to code that would be both quick enough and robust enough to put into production, while LP is better used to clearly present code sketches. Certainly the code here should be compilable — and runnable — as is, but as you can tell from articles such as Dijkstra's algorithm (Inform 7), Hello World (IBM PC bootstrap), or Quicksort (Sed), my bias has been towards trying to present one or maybe two interesting points per article rather than in collecting quotidian code. Dave 15:40, 4 April 2009 (MDT)
Yes, this deserves some clarification - I was thinking, for example, of detailed error handling, and other stuff that even if it's separated out may threaten to overwhelm the bulk of the article. I'll try a reword. Thanks for your comments. :-) Deco 14:32, 6 April 2009 (MDT)

Latest spam

I stupidly forgot to deny move permissions to anons (which also, it turns out, the CAPTCHAs don't protect). Fixed that, shouldn't happen again. Deco 15:43, 14 April 2009 (MDT)

Python imports

I think that imports like "from Module_name import *" should be discouraged in the Python codes because it makes the namespace confusing. Especially for beginner Python coders it can be very confusing to look at the code since it is hard to know what comes from where. Thanks.

IMHO that's what the descriptive text is for. BTW, please sign/timestamp your discussion entries (by adding --~~~~) --Ce 01:49, 8 May 2010 (MDT)


I'm working on a wiki extension for programming right inside a wiki. Maybe this is interesting to your project here too. You can play around with some examples here ProgrammingWiki (it's only in german, but you may use google translation or just concentrate on the interactive parts on those pages).

Indentation bug

While literating some python code, I've found a literateprograms bug with indentation which can be quite fatal to python code (while it will be mostly harmless to any programming language which doesn't assign semantics to indentation): Given

if condition:
    for value in list:
        loop body


<<loop body>>=

the generated code should look like this:

if condition:
    for value in list:

but actually looks like this:

if condition:
    for value in list:

As you can see, the do_more is incorrectly indented, and therefore in Python doesn't belong to the for, but only to the if, thus the semantics is broken. --Ce 01:59, 8 May 2010 (MDT)

RSS Feed

Most wikis have an RSS feed to publish updates. Is there a reason this on does not, or am I just not looking in the right place?

Hi! The RSS feed is available here: . The "Recent changes" page has a link to this and an Atom feed in the "toolbox" on left side. Ahy1 00:17, 7 December 2010 (MST)

Including code blocks from other pages

Hi, I published my first articles here: Extended Euclidean algorithm (C Plus Plus) and Modular Division (C Plus Plus). I am sure they are not perfect and will be happy for constructive criticism.

The modular division implementation uses the extended algorithm implementation, and I was wondering, is it possible to include code from one page in another page?

--Erel Segal 03:08, 19 December 2010 (MST)

Yes, that's possible: Use <<pagename#revision#chunkname>> for this, e.g. <<Extended Euclidean algorithm (C Plus Plus)#16991#eea>>.
You get the revision number through the permanent link (the URL then contains oldid=revision). You can also omit the revision number (i.e. use <<pagename##chunkname>>), but then you are vulnerable to edits of that other page which may break your code; nobody editing a page will look for other pages using it which that edit might break. --Ce 09:46, 9 January 2011 (MST)
Wow! That's impressive. I didn't realise that you could do that. -- Derek Ross | Talk 21:12, 9 January 2011 (MST)

Spam user pages

Lately, it seems like some user pages have been created with content that looks like spam. The corresponding users typically haven't done anything else than creating these pages. Normally, it is not acceptable to edit other user's user pages, but I think that in these cases we should delete them, to remove the spam links. Does anybody disagree on this? Ahy1 14:15, 5 August 2011 (UTC)