043 - Write a script to parse the changelog

Google's Highly Open Participation Program tries to get young students into Open Source and Joomla! specifically. Everyone is welcome, there are not limits. You can be a coder, documenter, tester, translator to help out. Jump in and start helping!
Locked
Draicone
Joomla! Apprentice
Joomla! Apprentice
Posts: 20
Joined: Sat Dec 01, 2007 7:33 am

043 - Write a script to parse the changelog

Post by Draicone » Sat Dec 01, 2007 9:17 am

Write some code to parse the CHANGELOG.php and present the information in
new ways.

The CHANGELOG.php file distributed with Joomla! and maintained in the SVN
repository contains much useful information about what has changed in the
Joomla! codebase over time. We'd like you to make this even more useful by
making it easier for people to find what they're looking for. For example,
references to forum posts and JoomlaCode tracker items could be
automatically turned into hotlinks. If we like it we will integrate it into
the API reference site at http://api.joomla.org.
Please see http://code.google.com/p/google-highly- ... tail?id=43 - I've built a functioning prototype with all of the main features I was hoping to implement. It requires PHP 5.2 at present, let me know if you want it modified to suit 5.1 - there's a call to strtotime() that's changed it's return value in between, and I believe a couple of other incompatibilities.

Everything's working quite nicely, and I'm happy with how it's turned out, but I've got a couple of changes still to make on the URLs, plus anything else you want implemented.

Regarding the artefacts referenced in the changelog entries, could you explain to me where these actually point to? I tried forge.joomla.org but it errored out while trying to assert that it was running on joomlacode.org, and I couldn't find any items in the tracker of the same IDs as the artefacts referenced - actually, the tracker gave me an "Access Denied" message each time (I was logged in, but didn't have any special privelages).

Anyway, please let me know what you think of it, what needs to be changed, what could be improved etc. Don't worry about the colour scheme, it's just to demonstrate that the data can be effectively and easily styled, if you choose to use this on api.joomla.org we can change the colour scheme to fit in.

By the way, according to Elin (IRC discussion), Wilco Jansen has agreed to mentor me, I've emailed him about my task and my progress.

Task claimed: Nov 28 Due Dec 12

Google Code

[me=AmyStephen]Changed subject slightly for sorting all threads to match against Google resource  :)[/me]
Last edited by AmyStephen on Tue Dec 18, 2007 4:35 am, edited 1 time in total.

User avatar
Chris Davenport
Joomla! Ace
Joomla! Ace
Posts: 1370
Joined: Thu Aug 18, 2005 8:57 am
Location: Shrewsbury, Shropshire, United Kingdom

Re: 043 - Write a script to parse the changelog

Post by Chris Davenport » Sat Dec 01, 2007 12:05 pm

Hi Draicone,

Just a very quick bit of feedback as I'm in a real rush at the moment.  I'll try to look in more detail later.

Firstly, well done.  I think your code looks well-formatted and commented, though I haven't examined it in detail.  Wilco, will probably want to comment further on the code itself.

I see you've colour-coded each entry, which is good.  But it's not easy to see what the colours mean.  Perhaps you could have a little icon to represent each type (change, remove, add, comment, etc).  This would reinforce the colour-coding and it would be less of a problem for people with colour-blindness.

In the code, the @copyright tag should indicate the copyright owner (which is you).  The @license is where you would indicate the license.  Please note that the license should be GNU/GPL v2 and not Creative Commons.  This is a requirement of the contest entry.

Definitely implement caching.  We'd like your code to run on http://api.joomla.org and we wouldn't want to increase the load on the server too much!

A good first effort.  Let's see if we can take it to next level.  :)

Chris.
Chris Davenport

Davenport Technology Services http://www.davenporttechnology.com/
Lion Coppice http://www.lioncoppice.org/

User avatar
mcsmom
Joomla! Exemplar
Joomla! Exemplar
Posts: 7897
Joined: Thu Aug 18, 2005 8:43 pm
Location: New York
Contact:

Re: 043 - Write a script to parse the changelog

Post by mcsmom » Sat Dec 01, 2007 1:10 pm

You were asking about artefacts, the urls are like this:


http://joomlacode.org/gf/project/joomla ... em_id=7396

for gforge.
So we must fix our vision not merely on the negative expulsion of war, but upon the positive affirmation of peace. MLK 1964.
http://officialjoomlabook.com Get it at http://www.joomla.org/joomla-press-official-books.html Buy a book, support Joomla!.

User avatar
willebil
Joomla! Guru
Joomla! Guru
Posts: 762
Joined: Thu Aug 18, 2005 12:06 pm
Location: Netherlands

Re: 043 - Write a script to parse the changelog

Post by willebil » Sat Dec 01, 2007 4:16 pm

First let me say that this is very good, but not fully 100%. The following comments:
  • Licence needs to be GPL-v2. As discussed in IRC and also commented by chris in the forum. Make sure to licence the files properly.
  • Usage of JQeury. Within Joomla! we make use of Mootools, and not j!query. Would like to see you implement Mootools.
  • The JoomlaLogParse class is now included in the page that also does the page processing, would like to see them separated. Class file can then later be used in a module or component more easy.
Chris also hinted on the color usage. The idea is very well implemented, but some colors are just not read-able, icons with a legend would be advisable.

Next step for this logic (not part of this task btw) could be creating a module using this logic and provide RSS feeds, like I believe is already discussed with Elin before. Implementing caching would then make sense, and in fact will be pretty easy when you use the existing framework logic.

As mentioned, this is not part of this task, but when you create an (installable) module it will certainly give additonal credits  ;)

AmyStephen
Joomla! Champion
Joomla! Champion
Posts: 7018
Joined: Wed Nov 22, 2006 3:35 pm
Location: Nebraska
Contact:

Re: 043 - Write a script to parse the changelog

Post by AmyStephen » Sun Dec 02, 2007 5:00 am


Draicone
Joomla! Apprentice
Joomla! Apprentice
Posts: 20
Joined: Sat Dec 01, 2007 7:33 am

Re: 043 - Write a script to parse the changelog

Post by Draicone » Tue Dec 04, 2007 12:43 am

Okay, I've switched to Mootools, licensed both classes under GPLv2 (the rest might as well be public domain), split up the class and made it more configurable without modifying the class files themselves (URLs can now be freely modified, although the regexes are otherwise static to maintain consistency). I've optimised the code, and noted that the regexes are about half the script execution time - I've included a screenshot from my profiler. I've also added a solid caching system based largely of Rasmus Lerdorf's simple swap file caching code, with both RSS and standard output seperately cached. Speaking of which, I've also added full standards-compliant RSS functionality :) That just about rounds off the list of changes (I should really have kept a CHANGELOG, actually ;)).

You can view it in action at http://bitmeta.org/joomla/chglog/ and download it at http://bitmeta.org/joomla/chglog/ghop_joomla_043.zip.

AmyStephen
Joomla! Champion
Joomla! Champion
Posts: 7018
Joined: Wed Nov 22, 2006 3:35 pm
Location: Nebraska
Contact:

Re: 043 - Write a script to parse the changelog

Post by AmyStephen » Tue Dec 04, 2007 1:35 am

Fabulous!  8)

Really amazing work!
Amy :)

User avatar
mcsmom
Joomla! Exemplar
Joomla! Exemplar
Posts: 7897
Joined: Thu Aug 18, 2005 8:43 pm
Location: New York
Contact:

Re: 043 - Write a script to parse the changelog

Post by mcsmom » Tue Dec 04, 2007 1:51 am

Nice!
So we must fix our vision not merely on the negative expulsion of war, but upon the positive affirmation of peace. MLK 1964.
http://officialjoomlabook.com Get it at http://www.joomla.org/joomla-press-official-books.html Buy a book, support Joomla!.

Draicone
Joomla! Apprentice
Joomla! Apprentice
Posts: 20
Joined: Sat Dec 01, 2007 7:33 am

Re: 043 - Write a script to parse the changelog

Post by Draicone » Tue Dec 04, 2007 3:02 am

I've noticed there's a bug introduced by formatting inconsistencies in the changelog file - see the attached screenshot. Occasionally, in short bursts, people are using full month names, which breaks the parser (slightly). I could add a hack to account for this, however as with all hacks, it would be inefficient, breakable in itself and much less effective than solving the problem at the source. I understand the changelog is updated frequently, but could I possibly meet somebody with SVN access on IRC, fix up the changelog file, have them diff it and review it then push it back to SVN so that we avoid this?

Also, please ignore the colours used in the system, they're merely to demonstrate that using CSS there's a lot of power created by this seperation of data - for example, you may have noticed that all author names are uppercased using CSS, with no modification of the underlying author data should somebody else wish to traverse/screen scrape this. Obviously (or sadly, depending which way you look at it :)) we won't be depicting authors names in hot pink in the live version (I could probably integrate it into the site's theme).

I'm considering turning this into a module, but I'm still getting my head around the J!1.5 framework, having never worked with it before, so this may have to come later or after GHOP finishes.
You do not have the required permissions to view the files attached to this post.
Last edited by Draicone on Tue Dec 04, 2007 8:20 am, edited 1 time in total.

AmyStephen
Joomla! Champion
Joomla! Champion
Posts: 7018
Joined: Wed Nov 22, 2006 3:35 pm
Location: Nebraska
Contact:

Re: 043 - Write a script to parse the changelog

Post by AmyStephen » Tue Dec 04, 2007 3:04 am

Draicone wrote: I'm considering turning this into a module, but I'm still getting my head around the J!1.5 framework, having never worked with it before, so this may have to come later or after GHOP finishes.
I thought about suggesting that. You seem talented enough and you have a month. It might eat away at you if you don't do it.  ;)

Amy

User avatar
willebil
Joomla! Guru
Joomla! Guru
Posts: 762
Joined: Thu Aug 18, 2005 12:06 pm
Location: Netherlands

Re: 043 - Write a script to parse the changelog

Post by willebil » Tue Dec 04, 2007 5:56 am

Draicone wrote: Okay, I've switched to Mootools, licensed both classes under GPLv2 (the rest might as well be public domain), split up the class and made it more configurable without modifying the class files themselves (URLs can now be freely modified, although the regexes are otherwise static to maintain consistency). I've optimised the code, and noted that the regexes are about half the script execution time - I've included a screenshot from my profiler. I've also added a solid caching system based largely of Rasmus Lerdorf's simple swap file caching code, with both RSS and standard output seperately cached. Speaking of which, I've also added full standards-compliant RSS functionality :) That just about rounds off the list of changes (I should really have kept a CHANGELOG, actually ;)).

You can view it in action at http://bitmeta.org/joomla/chglog/ and download it at http://bitmeta.org/joomla/chglog/ghop_joomla_043.zip.
I will take a look at the code tomorrow, but so far it sounds like a very well performed task! Hope switching to mootools did not give you too much troubled ;-) Any reason why yoou have not re-used the Joomla! caching libraries.

Draicone
Joomla! Apprentice
Joomla! Apprentice
Posts: 20
Joined: Sat Dec 01, 2007 7:33 am

Re: 043 - Write a script to parse the changelog

Post by Draicone » Tue Dec 04, 2007 8:29 am

@wilco: I was still working out how to implement them without creating all sorts of other problems e.g. either having to keep the libraries in a fixed relative position in the filesystem or maintain multiple versions (when run alongside a Joomla installation), creating dependencies on potentially unstable code etc. Rasmus' simple file caching system has its flaws, and occasionally runs into non-criticial race conditions, but besides a slight performance hit is simple and effective. I'm working on building a module/component/something at the moment and when I turn it into a component I'll definitely implement caching using the Joomla! framework's inbuilt system.

AmyStephen
Joomla! Champion
Joomla! Champion
Posts: 7018
Joined: Wed Nov 22, 2006 3:35 pm
Location: Nebraska
Contact:

Re: 043 - Write a script to parse the changelog

Post by AmyStephen » Sun Dec 09, 2007 7:10 am

Draicone -

How is your task proceeding? This is such fabulous work you have done already. As a reminder, your task is due Dec 12. We have a number of new development tasks you might be interested in trying next.

I look forward to hearing from you soon.

Thanks for your contributions to our community,
Amy :)

Draicone
Joomla! Apprentice
Joomla! Apprentice
Posts: 20
Joined: Sat Dec 01, 2007 7:33 am

Re: 043 - Write a script to parse the changelog

Post by Draicone » Sun Dec 09, 2007 10:10 am

Hi Amy, I'm currently working on building a Joomla! 1.5 (nightly build) module from the code, and it's going pretty well. Thanks for the reminder about the task deadline, I should be able to get it finished in time.

I've posted a thread and asked on IRC, but if any Joomla! developers read this, could you please briefly explain to me if including a template file under the tmpl folder of a module is required, simply good practice or entirely optional? I'm a little stuck on this, as I'll have to refactor my code slightly to manage a template file with separate presentation, although if it's good practice I'll do my best to manage it somehow.

By the way, thankyou to Wilco and Elin for all their help with this task, I couldn't have managed any of this without them :) There isn't much documentation on module development, when I get my head around it I'll definitely contribute some to the wiki to help out others facing the same challenges.

Thanks guys!

Draicone

annerajb
Joomla! Intern
Joomla! Intern
Posts: 62
Joined: Tue Sep 04, 2007 8:59 pm

Re: 043 - Write a script to parse the changelog

Post by annerajb » Mon Dec 10, 2007 5:29 am

well the best pratice afaik is to separate the template from the content that way if you wanna change the template some way you dont need to change the code. so i quess you could give it a shot. create some functions and call it from the template ;)

Draicone
Joomla! Apprentice
Joomla! Apprentice
Posts: 20
Joined: Sat Dec 01, 2007 7:33 am

Re: 043 - Write a script to parse the changelog

Post by Draicone » Mon Dec 10, 2007 8:06 am

Hello all,

Okay, I've built an installable module that Joomla! 1.5 accepts fine when Legacy plugins are enabled; but I'm not quite sure of an issue regarding presentation: how do I make the content appear in the main content area? Modules seem to be confined to sidebar elements and I can't work out how to get around this. The size of the content needs the space and I couldn't work out how to reposition the module to somewhere appropriate or create a new position, any assistance with this would be greatly appreciated.

Thanks!

Draicone

AmyStephen
Joomla! Champion
Joomla! Champion
Posts: 7018
Joined: Wed Nov 22, 2006 3:35 pm
Location: Nebraska
Contact:

Re: 043 - Write a script to parse the changelog

Post by AmyStephen » Mon Dec 10, 2007 1:36 pm

You could use the Load Module plugin inside of an article.

Code: Select all

{loadposition XXX}
XXX = the position you assigned to your module in the module manager.

Also, make certain the Load Module plugin is enabled.

HTH,
Amy :)

Draicone
Joomla! Apprentice
Joomla! Apprentice
Posts: 20
Joined: Sat Dec 01, 2007 7:33 am

Re: 043 - Write a script to parse the changelog

Post by Draicone » Mon Dec 10, 2007 10:38 pm

Thanks Amy! *hugs*

I tried it on the breadcrumbs and it worked fine, as long as people have a method for displaying the changelog data it should work fine. I'm just finishing it off now, it should be ready right on time :)

Draicone
Joomla! Apprentice
Joomla! Apprentice
Posts: 20
Joined: Sat Dec 01, 2007 7:33 am

Re: 043 - Write a script to parse the changelog

Post by Draicone » Sun Dec 16, 2007 2:23 pm

Sorry for a bit of miscommunication here -- after discussions via IRC, Elin and I agreed to seek Wilco's (+Chris') opinion(s) on the task, as I was unsure where the code was to be used (which would determine if I should develop the module version or the standalone version) (had a few different opinions from the various GHOP mentors involved).

Anyway, the task is essentially complete; I've finished the final standalone version, and submitted it to the code.google.com page due to size constraints on forum uploads -- you can find it at http://code.google.com/p/google-highly- ... ?id=43#c18. I have also finished an installable module (well, if we can't decide one or the other, why not do both? :)); this is available at http://code.google.com/p/google-highly- ... ?id=43#c21. Due to the confusion with task submission, and this being technically outside the task submission deadling + grace period, it is up to the J! GHOP mentors as to whether they wish to accept this.

There's still a lot of work that can be done on the installable module (e.g. parameters, proper file stores for the icons) -- I'll get in touch with both Wilco and Chris again and we can work out what they want to do with it, then go from there.

Again, a big thankyou to everyone who's helped me put this together -- Amy, Elin, Wilco, Chris, as well as 'annerajb' and 'fealebenpae'. Looking forward to working on more coding tasks with Joomla :)

AmyStephen
Joomla! Champion
Joomla! Champion
Posts: 7018
Joined: Wed Nov 22, 2006 3:35 pm
Location: Nebraska
Contact:

Re: 043 - Write a script to parse the changelog

Post by AmyStephen » Tue Dec 18, 2007 4:37 am

Draicone -

This is really great work and much appreciated! Thanks for your contributions to the community. I will mark this task and your Google task, as closed. You are free to select another task, if you wish. I hope you do as you are very, very talented.

Thanks, again, for your efforts!
Amy :)


Locked

Return to “Google's Highly Open Participation Contest”