Juce Cookbook Idea


Juce is an awesome and very powerful C++ class library. I’ve been working with a lot of open source software, and there is nothing quite like it. Thank you.

What about having a Juce cookbook section of this forum or a special Wiki content section, where users can post implementations as “HowTos”, as code examples for solving a specific problem, or building a certain feature? There could be chapters or sections and then each submission could be categorized. I think this would help make Juce easier to use and even more popular. It’s already great, but the Tipping Point of sharing information on Juce in the form of example application projects, where users don’t have to search through the forums to find a specific problem (like looking for a needle in a haystack, and after all that time, not finding exactly what you need). Of course, you can build something yourself as a programmer, but this would be the way for a programmer to give back to the community, in the spirit of helpful, open communication. This would be a quick and easy way to find an example implementation for solving a programming problem. This could turn into something huge. I already know about the Juced google code project, and Haydxn’s very informative Juce tutorial. Was wondering if this “Juce Cookbook” example application would be useful to others, and if it’s something that could be 1) hosted by you, Jules, 2) hosted on the Google code project page, or 3) hosted by a 3rd party.

I guess what I am getting at is an idea for a Cookbook series for Juce, similar to the O’Reilly programming series cookbooks:

For any programming language, these books are very useful for helping someone solve a specific problem. You could do the same for the Juce C++ class library.


Good idea - if anyone wants to post that kind of stuff, I can put it into a forum or sticky posts, or whatever seems like a good way to organise it…

I am pretty sure lots of guys would be willing to share code for this. But before we start up on it, We had better decide on how we go about it. Do we post codes on how to use each Juce class or have few demo applications(with source) which uses Juce classes.

A special section for this would be ideal.

Yes it would be a good idea to agree on how to go about with this and organise it. The suggestion and idea I had in mind was to organise this as chapters, with each chapter grouping functional and useful juce demo applications that share a common feature theme within the chapter.

For example, here are some chapter listings, just off the top of my head:

  • Date and Time
  • Number
  • String and Text
  • Science and Mathematics
  • File Handling
  • Web Browsers
  • XML Applications
  • Internationalization
  • Multithreading
  • Audio
  • Video
  • Miscellaneous

Each author would scroll into a chapter and submit his sample application source code files or just post his code sample with the code display blocks, along with a title and short description for his sample application.

Jules could control the different chapter titles and creating new chapter titles / categories. There could be a “Miscellaneous” group until he figured out enough sample applications warranted creation of a new chapter.

I was thinking that it would be more useful to implement this as a separate, discrete website section or content URL from the Juce forums or documentation API. You could call it “Cookbooks” or “Sample Apps”, or whatever. It would really be a useful documentation project that would complement the existing documentation projects I’ve seen. The Juce tutorial is great, and documentation API is fundamental, and the forums are good for troubleshooting a specific issue. But this could be something to spread information and sample applications, which would benefit everyone, and help Juce become more prevalent. From beginner to juce expert, everyone learns in different ways. Having a sample application to compare against the tutorial and documentation api would help a lot of people, I think. Then if someone had a question or comment about that sample application, the forum would be the place to discuss it. Within the submission posting, there could even be a ranking feature where users could rank the applications as useful/not or give it a (1-5) star ranking - you could have most popular sample apps or something. Just spifballing here :smiley:

Would something like this be useful or workable for others? Any other ideas? Perhaps we should discuss more ideas on how to go about this and organise it, and submit a plan to Jules. If this is controlled and backed by Jules as a separate section, I think it would be the most instructive and useful.

Sounds interesting…

Ooh! Yes!

I’ve been so used to Adobe’s Livedocs having example chunks alongside their API docs. A cook book would be fun. I’d be very happy to put time into writing up things (I’m unemployed currently!) if people are happy to point out the errors of my ways, because I’d hate to misguide someone.

I can understand Jules’ reticence in handing over access to the code, but maybe if links were put into the headers for Doxygen to find so you could access a relevant page on a “cooking” wiki…? would that make it a little more cross referencable? Maybe only when and if the cook book gathers enough momentum.

If there are some tasks I could help with, put me down!

I’d love to have some kind of combined api docs / wiki arrangement, but don’t have any tools that could generate something like that…

Well, no. But I don’t think a cook book is something that you would generate automatically anyway (api in one end/functioning software out the other? awesome!).

I’m not sure exactly what Puckhead had envisaged, but I imagine some sort of MediaWiki based collection of bits and pieces.

I was thinking that with a bit of javascript in the top of the doxygen generated pages, I could use jQuery to pull relevant parts out a wiki and display them along side the api docs, or at least provide a link to a meaningful article. This way, the doxygen stuff wouldn’t have to be fiddled with too much, just grep a *.js include into the html.

I think a wiki would be good, as moderation of the content would be fairly open and not dependant on one person (I have a sense that Jules probably doesn’t want another project eating into guitar playing/pint drinking time), but after having a look through the wiki api, it’s probably not quite right, I think something that had more of an emphasis on tags would be necessary for pulling out articles (searching for Class::member() should probably find various “recipes” tagged “Class::member()” instead of just one wiki “Class::member()” page). I was thinking Wordpress might be an option, as you can tag posts, and it should have a decent API to drag stuff out with. By default, the moderation thing isn’t great, but maybe that can be fixed, there’s buckets of plugins. I should admit, I’m a bit of a wordpress fanboy and everything looks like a wordpress nail.

But overall, use ajax to extract posts that have been tagged with the appropriate Class::member() to display the results alongside the Doxygen material, with the administration of the posting system allowing discussion and multiple editors.

I might be completely wrong about what it should be like, though. I’m sure I’ll change my mind in the morning.

Well my suggestion on the Cookbook was a bit different, but I do like Assembler’s idea. Per vishvesh’s post, there are two different directions to go with this:

  1. Sample class implementation chunks that go with API documentation
  2. Sample Apps or “Cookbook” for solving a certain programming problem

I was suggesting #2 but I also think #1 would be useful. But why not some combination of both? #1 would be good for class implementation examples. What I had in mind for #2 was users being able to submit their own sample Juce application, under a certain chapter, and all of the sample apps would be grouped together having a similar functional element in common.

You can see my post above with some suggested Chapters for the different cookbook themes, but basically users can post their own apps. Apps could be very simple, code blocks inserts, or very complex, with multiple files. #1 would be good for showing how to implement a class, but I saw #2 as being much more expansive, where users could post more complex applications that would, of course, make use of more than one class, and other users could even rank the app. The apps could creatively show how to solve a certain programming problem. I think it would just be a really useful tool for others. It could really take off and users could post a ton of sample apps, and you would have a whole library of sample Juce apps.

See the O’Reilly Cookbook series of books, for each programming language. Here is the C++ one:

The cookbook sample apps could be also controlled from a wiki. You would have to set it up with the different chapters, and allow users to post their own applications under each chapter. Quoted from the site:

Ah. that makes sense then. I also think having a mixture of the two approaches would be good.

I imagine if the format is too restrictive one way or the other, then it may preclude some people from sharing their code (fears of “too long/too short”, perhaps?). The Juce community isn’t large enough sustain any "Thou Shalt"ing.

You could argue against the cookbook method taking the “creativeness” out of it, but after having just dropped in an AudioDeviceSelectorComponent and PluginListComponent, that would be quite hypocritical.

I like option 2, because getting a big picture of how something could go together is quite helpful. And not just the source, but a diagram or two and a bit of a running commentary. I know that there are multiple ways of doing things, but if there is a canonical example I can appropriate, fantastic. But I like option one also because hopefully we are all writing slightly different applications.

Any/all existing stuff should be collated “as is” unless contributor feel it worthy/have the time to rework parts, but I think if there was a movement towards the modularity of a cookbook, that might be good. By that, I mean if your sample app were composed of/dissembled into several class implementation chunks.

I look forward to integrating your sample code soon!

Yep, I like it and the idea of combining both. You’re right, it shouldn’t be too restrictive, allow the feature to take off on its own and see where it goes. Yes, not just the source. There could be multiple content elements, the title of the submission, commentary (including diagrams and even image insertions, showing a screen shot of the app). You could even have other users rank the application, like 1 - 5 juce stars…and sort the applications by “Most popular” section.

Any ideas on how to implement this in a content management system or Wiki? Web application dev / tools or automated content creation tools is definitely not my area…

Something like tikiwiki or drupal could fit I guess.
We could have 2 sections, as per puckhead post :
"1. Sample class implementation chunks that go with API documentation
2. Sample Apps or “Cookbook” for solving a certain programming problem"
and every forum member would be able to create/edit pages in either section, a-la wikipedia.

However, if we don’t want to have a big mess, we have to use some self-discipline, and only submit code & explanations which have been tested, which compile, write which version of Juce was used and so on …

I like this cookbook idea, because we’d have a central place, which could be empty at the begining, and where everyone could contribute, GPL-style.

What about trac? I’ve used it about a year ago… it can link up with the git repository, and has a wiki.



Today’s cookbook related activities: Doxygen & Wordpress

Juce Cookbook WordPress sample
Juce’s GlowEffect Doxygen page (with extras!)

This is all I injected into the head of the Doxygen page, this would have to be grepped into each page, or maybe it could be hacked into Doxygen itself

<link href="doxypress/doxypress.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="doxypress/jquery-1.4.2.min.js"> </script>
<script type="text/javascript" src="doxypress/doxypress.js"> </script>

it uses JQuery to alter the Doxy page, and then a plugin for WordPress to serve up some JSON to read.

the Class::Member structure suffered a little (and will probably have to do so more later) with Class::~Destructor becoming Class__-Destructor, to make it URL friendly

Currently, only links to posts show up, but maybe with a little extra metadata, one liners/short chunks could be displayed with links to longer articles.

As always, it’s “Just an idea™”

If you want to muck around with the Wordpress, PM me and I’ll build you an account (send preferred user/pass!)

Another idea.
We can post our codes and application and link them to classes like tags. If i submit an application which uses ActiveXControlComponent and BlowFish, while submitting it I can add ActiveXControlComponent and BlowFish as tags. If anybody needs some code for BlowFish class can select blowfish class which should show uploaded items having blowfish as tags.

We would also need a rating system, so that items not used remains at the bottom.

That’s pretty neat - I wonder if it’d be possible to do something similar using maybe a special area of this forum (don’t fancy installing wordpress or requiring people to use two different log-ins on the website).

It rocks man, good job !

P.S. : which extras did you add to dowygen though ?

if you have a look at the top of the html of the altered classGlowEffect page ( I chose it because it was a cute little class!) then you can see toward the top there are three links with reference to “doxypress”, a css file, a jquery file and a *.js file. the js file is where the magic is, but it is dependant on the jquery magic. Does that make sense, Dinaiz? With a green light, I’ll happily chip away at it, but Jules isn’t real keen on this just yet.

Hang on… did you follow the link to the doxy page? and then compare it to the real one? where the explanations of the members are, there should be some extra links popping up .

or… I altered the result of the doxygen output, not doxygen itself.

… what’s the question again?

I agree the multi login thing can be frustrating. I found “WP United”, a sticking together of WordPress and phpBB… which could be… well, I dunno (something about attractive cousins).

WordPress is an utter joy to use, it’s simple, that’s what I put my mum on (my real mum, not my code hacking mum), but I can understand your reluctance to deal with another CMS.

phpBB by itself doesn’t take tags, has no external api, and doesn’t allow for article versioning / multiple editors per article.

There appear to be a few projects like Drupal/Joomla that integrate with phpBB with some level of hackery, but I haven’t used them, so I might ask here for any experience others have had.

I suppose a bit of php could be hacked up to sit between the jquery and phpBB’s database as a third party api, but the publishing tools (lack of tags, multi-edit) would be a little average. the tag bit could be done by some self imposed metadata within the phpBB post, or maybe by indexing things, but it’s fairly foggy how it would work at the moment. Just the thought of doing the same ajaxy thing only with phpBB makes my eyebrows go all wrinkly. Assuming that you guys would want something like that, I might be missing the point. Anway, that’s my two bob.