I've implemented a new plugin for Crunchy which may be of interest to some: a reStructuredText editor with live preview inside the browser window. Each time a key is pressed in the editor (html textarea), an ajax request is sent to the Python backend with the entire content of the editor. This is processed by docutils with the result sent back to the browser as a full html page displayed inside the browser as illustrated below.
I expected this to be slow (make that very slow) and for the first prototype I wrote, I only sent the ajax request when "enter" was pressed. After playing with it for a while, I realized that there was no need for this.
If you type fast enough, the previewer does not keep up for each key press, but this does not hinder in any way the speed at which you can enter text in the editor. By the way, the editor (html textarea) can be converted into a true embedded editor which can save and load files, etc. - otherwise, it would not be a very useful tool for working with reStructuredText documents. When doing so, the live preview is turned off. I've also included the possibility to save the html file produced so that one does not have to invoke docutils separately. And this also incorporates the two custom directives (crunchy and getpythonsource) used by Crunchy and crst2s5.
This is included in the newest release (1.1.2) of Crunchy.
Sunday, September 13, 2009
Thursday, September 03, 2009
Wednesday, September 02, 2009
Upcoming Pycon and crst2s5
In a few months, many pythonistas will be converging to Atlanta to take part in the next Pycon. I'm hoping to be able to attend it as I have been really inspired by the many people I met in two previous conferences. While I most likely won't be presenting anything this time, I thought I would try to contribute to some presentations in an indirect way.
A while ago, Ned Batchelder wrote about presentation tools - more specifically about how he found all of them lacking. In the comments section, many people made various suggestions - including one suggestion by Steve Holden which read as follows:
In his post, Ned addresses some of the weaknesses of the tools he looked at. In particular, he mentioned S5 about which he wrote:
- slides on the projector
- two views stay in sync
- presentation controlled from either display
rst2s5 is based on S5 version 1.1. A new version (1.2 alpha) is available which addresses some of the shortcomings of version 1.1 with the addition of speaker's notes which are in a separate window (e.g. on the laptop screen) while the slides themselves are in a different window (which can be on the projector) with the two synchronized.
I have decided to hack at the source (I don't like javascript...) and adapt S5 1.2 in ways which address some of Ned Batchelder's criticisms about the line spacing, etc, by disabling the automatic font scaling. I incorporated it in a new program called crst2s5 which can be thought of as a Crunchy-extension to rst2s5. crst2s5 on its own can produce standalone presentations (like rst2s5). I consider it to be an improvement to rst2s5 ... time will tell if others share my opinion.
However, where crst2s5 can yield really interesting results is when you view the html output with Crunchy. For now (version 1.1), when you do so, the automatic synchronization of speaker notes and slides is disabled - this will be addressed hopefully in the near future. You can either try it by downloading the code or have a look at this sneak preview which I put together in one quick take as an experiment:
Original location: 'Crunchy'
at ShowMeDo from the Python category.
Now, if only I had better graphical skills to design good looking slides...
A while ago, Ned Batchelder wrote about presentation tools - more specifically about how he found all of them lacking. In the comments section, many people made various suggestions - including one suggestion by Steve Holden which read as follows:
Crunchy? http://code.google.com/p/crunchy/While I, of course, approve of any positive support of Crunchy, I had to admit to myself (and mention in a subsequent comment) that Crunchy was really not up to the task - at least not yet.
HTML plus live Python - what could be better?
In his post, Ned addresses some of the weaknesses of the tools he looked at. In particular, he mentioned S5 about which he wrote:
S5 (A Simple Standards-Based Slide Show System) is all HTML, CSS, and Javascript, runs in the browser, and was created by Eric Meyer, a very nice pedigree. Remarkably, the thing I like least about it is that when I display the slides in a full-screen Firefox, they look horrible. The text is either too small or too large, and the line-spacing too tight, while the slide title overlaps the text in the wrong way, exposing some of the structure of the divs.Still, S5 is used for quite a few presentations by pythonistas thank to rst2s5, the docutils script that transform reStructuredText files into S5 presentations. If I can summarize, rst2s5 strengths are as follow:
I would have hoped that a CSS-based slideshow by the king of CSS would be a shining example of how information could be cleanly authored and then sparklingly displayed. S5 seems to miss this mark, especially since there don't seem to be many themes available for it, another surprise given how CSS should have made it accessible to lots of designers. Also, although (or perhaps because) the format is native to the web, it's not possible to get the slides as illustrations.
- uses reStructuredText as source - easier to write than html
- produce html files - thus easy to post and share -see link above.
- use well known S5 slides (version 1.1 designed by Eric Meyer) to switch between "full paper"/slides. It is possible to include extra notes in the "full paper".
- From rst2s5's own documentation, it is impossible to have:
- slides on the projector
- two views stay in sync
- presentation controlled from either display
- like most (all?) slide-based presentation, content on one slide is limited to a given number of lines ... which makes it ackward to show long-ish code samples.
- as Ned Batchelder alludes to, the automatic scaling done by S5 often yields unsatisfactory results in terms of line spacing, etc.
- Finally, no interactive Python code in presentation ;-)
rst2s5 is based on S5 version 1.1. A new version (1.2 alpha) is available which addresses some of the shortcomings of version 1.1 with the addition of speaker's notes which are in a separate window (e.g. on the laptop screen) while the slides themselves are in a different window (which can be on the projector) with the two synchronized.
I have decided to hack at the source (I don't like javascript...) and adapt S5 1.2 in ways which address some of Ned Batchelder's criticisms about the line spacing, etc, by disabling the automatic font scaling. I incorporated it in a new program called crst2s5 which can be thought of as a Crunchy-extension to rst2s5. crst2s5 on its own can produce standalone presentations (like rst2s5). I consider it to be an improvement to rst2s5 ... time will tell if others share my opinion.
However, where crst2s5 can yield really interesting results is when you view the html output with Crunchy. For now (version 1.1), when you do so, the automatic synchronization of speaker notes and slides is disabled - this will be addressed hopefully in the near future. You can either try it by downloading the code or have a look at this sneak preview which I put together in one quick take as an experiment:
Get the Flash Player to see this movie.
Original location: 'Crunchy'
at ShowMeDo from the Python category.
Now, if only I had better graphical skills to design good looking slides...
Sunday, August 23, 2009
New plugin for Crunchy ... and bug fixes
Crunchy has a new plugin: getsource. What it does is enable a tutorial writer to embed a "link" to a python module inside an html file, or a class within that module, or a function or method, and have the source code being extracted by the inspect module and inserted within the html page.
Crunchy being Crunchy, it can also embed an interpreter or an editor right below the code source so that a user can interact with it.
And since not everyone likes to write documentation using straight html, a custom docutils directive is supported so that it works from reStructuredText files too.
The docutils directive looks as follows:
..getsource:: relative/path/to/module[.function] [linenumber] [editor or interpreter]
with a similar syntax for html files.
This plugin (which still has some minor bugs) is included in release 1.0.1 of Crunchy, which contains other minor bug fixes (as compared with release 1.0).
Crunchy being Crunchy, it can also embed an interpreter or an editor right below the code source so that a user can interact with it.
And since not everyone likes to write documentation using straight html, a custom docutils directive is supported so that it works from reStructuredText files too.
The docutils directive looks as follows:
..getsource:: relative/path/to/module[.function] [linenumber] [editor or interpreter]
with a similar syntax for html files.
This plugin (which still has some minor bugs) is included in release 1.0.1 of Crunchy, which contains other minor bug fixes (as compared with release 1.0).
Crunchy 1.0 released!!
Crunchy 1.0 has finally been released. :-)
Crunchy 1.0 is compatible with Python 2.4, 2.5, 2.6 ... and 3.1. It is also compatible with Jython 2.5 modulo some bugs when trying to work with examples containing unicode strings.
Crunchy, for those that are not familiar with it, is a one-of-a-kind application. It is an application designed to transforms otherwise static html Python tutorials into interactive session viewed within a browser. Currently Crunchy has only been fully tested with Firefox. Crunchy should work with all operating systems - it has been tested fairly extensively on Linux, Windows and Mac OS.
In more details, here's what Crunchy does:
1. It loads an existing html file (or reStructuredText file) containing some Python code; this file can reside locally, or anywhere on the web.
2. It removes any existing javascript code & embedded interactive elements (applets, flash apps, etc.).
3. It further transforms the file by inserting some extra elements, including some custom javascript code.
4. It sends the transformed file to your browser of choice (read: Firefox).
5. It establishes a communication between the browser and the Crunchy back end and wait for user interaction.
Crunchy can embed Python interpreters and code editors (and more!) within an html page, enabling a user to enter (or edit) some Python code inside a browser window, send it to the Crunchy back end for execution, and observe the result back in the browser window.
In a sense, Crunchy is a Python programming environment embedded within a browser. However, it does not require a custom format for interactivity: for html files, as long as the Python code is included in a pre-formatted element (<pre>), Crunchy will recognize it, style it, and include the appropriate interactive element.
Crunchy comes with a fairly complete tutorial and supporting documentation. It is highly configurable.
Release 1.0 is NOT the end of the road for Crunchy. Future plans include support for interactivity with languages other than Python.
Crunchy 1.0 is compatible with Python 2.4, 2.5, 2.6 ... and 3.1. It is also compatible with Jython 2.5 modulo some bugs when trying to work with examples containing unicode strings.
Crunchy, for those that are not familiar with it, is a one-of-a-kind application. It is an application designed to transforms otherwise static html Python tutorials into interactive session viewed within a browser. Currently Crunchy has only been fully tested with Firefox. Crunchy should work with all operating systems - it has been tested fairly extensively on Linux, Windows and Mac OS.
In more details, here's what Crunchy does:
1. It loads an existing html file (or reStructuredText file) containing some Python code; this file can reside locally, or anywhere on the web.
2. It removes any existing javascript code & embedded interactive elements (applets, flash apps, etc.).
3. It further transforms the file by inserting some extra elements, including some custom javascript code.
4. It sends the transformed file to your browser of choice (read: Firefox).
5. It establishes a communication between the browser and the Crunchy back end and wait for user interaction.
Crunchy can embed Python interpreters and code editors (and more!) within an html page, enabling a user to enter (or edit) some Python code inside a browser window, send it to the Crunchy back end for execution, and observe the result back in the browser window.
In a sense, Crunchy is a Python programming environment embedded within a browser. However, it does not require a custom format for interactivity: for html files, as long as the Python code is included in a pre-formatted element (<pre>), Crunchy will recognize it, style it, and include the appropriate interactive element.
Crunchy comes with a fairly complete tutorial and supporting documentation. It is highly configurable.
Release 1.0 is NOT the end of the road for Crunchy. Future plans include support for interactivity with languages other than Python.
Thursday, April 16, 2009
Python textbooks wanted
Python textbooks wanted(1). Actually, what I'm mostly interested in are links to textbooks and other resources that would be useful to educators either teaching Python as a programming language or other courses where Python feature prominently. The reason behind this request is that I volunteered to be responsible to take care of the edu-sig page on the Python site. Through no one's fault in particular, the old page (2) had gone stale and only one textbook was listed. We're now up to six and I am sure I have not included them all. By ensuring that up to date and complete information is available on that page, we can facilitate the adoption of Python as a language taught in High Schools, Colleges and Universities.
So, if you know of any useful information that should be added to the edu-sig page, please let me know.
(1) Actually, this is not exactly correct ... but if you want to send me some for reviews, I won't say no. ;-)
(2) The page linked here will eventually disappear...
So, if you know of any useful information that should be added to the edu-sig page, please let me know.
(1) Actually, this is not exactly correct ... but if you want to send me some for reviews, I won't say no. ;-)
(2) The page linked here will eventually disappear...
Friday, April 10, 2009
Learning paths at ShowMeDo
ShowMeDo is a great site to learn about Python (and a few other subjects) by watching screncasts. One of my favourite videos is Learn Django: Create a Wiki in 20 minutes, which taught me the basic concepts so that I was later able to adapt and play around with Google App Engine. Many authors on ShowMeDo have multiple screencasts (I made a few on RUR-PLE and Crunchy a while ago), some of which (not mine) are very professional looking. Such series of videos give the viewpoint of a given author, introducing some concepts in a logical sequence.
The newest addition to the ShowMeDo site is called Learning Paths. The idea of Learning Paths is to improve upon the existing series by including videos from multiple authors into a coherent sequence. While this concept is very much in its infancy, it promises to become a great addition to what is already a fantastic site.
In case anyone were wondering: I have no financial interest whatsover in ShowMeDo; I am just a satisfied user who considers this site a very good resource, well worth exploring. If only I had more time...
The newest addition to the ShowMeDo site is called Learning Paths. The idea of Learning Paths is to improve upon the existing series by including videos from multiple authors into a coherent sequence. While this concept is very much in its infancy, it promises to become a great addition to what is already a fantastic site.
In case anyone were wondering: I have no financial interest whatsover in ShowMeDo; I am just a satisfied user who considers this site a very good resource, well worth exploring. If only I had more time...
Subscribe to:
Posts (Atom)

