Useful things when developing openacs! (the tips)

By Rocael Hernández (roc@viaro.net)

This tries to be a day to day development help (reminder) rather than an openacs full documentation, if you're looking for that go here.

Remember at Viaro.net we want to have this on mind when we develop:

 

Index:

 

Emacs:

doing SQL command inside emacs:


M-x oracle
M-x postgres
M-p for going up in sql command line
M-n down in sql command line

 

When developing I see myself opening a buch of buffers, and usually closes emacs and open it again the next day, so what I wanted is to use it with all the buffers that I was using.

first one time do this:
M-x load-library
and enter: desktop
M-x desktop-save
and enter the directory where the desktop will reside (you can just press enter)
from now on emacs will save the buffer state for you automaticly

the next time that you close emacs and then open it again just type:
M-x desktop-read

and you'll have again your buffers from your last session
(thanks to C.R. Oldham, resource in
http://www.bjclark.com/code/my.emacs.html)


CVS:

when adding files:
in your
ad_page_contract {
....
@cvs-id $Id: tips.htm,v 1.1.1.1 2004/09/21 17:24:44 viaro Exp $
} {
....
}
$Id: tips.htm,v 1.1.1.1 2004/09/21 17:24:44 viaro Exp $ is expanded by cvs

 

Have a look of what an update will do in your directory:

cvs -q -n update

To update a NEW directory (must have something inside):

cvs update -P -d <directory name>


Dealing with dinamic queries:

use in your-file.tcl


set extra_sql ""
if {something} {
set extra_sql [db_map inside_if_sql]
}
db_multirow get_level check_spec { *SQL* }

file.xql (or -oracle.xql or -postgres.xql)
<fullquery name="check_spec">
<querytext>
select my_original_query
from some table
where a=b
and enrollments.school_id=:object_id
$extra_sql
</querytext>
</fullquery>


<partialquery name="inside_if_sql">
<querytext>
and extra_stuff
</querytext>
</partialquery>


using ad_form:

(be patient, you'll learn how to use it, when you get used to, will be your
partner in doing things quick & robust)

http://jongriffin.com/static/openacs/ad_form/using-ad-form

http://www.thedesignexperience.org/using_ad_form.html

 

for putting:
comments--> :text(inform)
dates-->

 

Templating System:

While working with includes:

If you'd like to include a full page (that is, one which calls ad_page_contract) then instead of passing a parameter through <include>, you could use rp_form_put to add the variable to that page's form. For additional references, see how message-chunk is used throughout the forums package.


checking errors in your logs:


examining with less
(from http://openacs.org/forums/message-view?message_id=62976)

in you .tcl template put
/parameters
debug true

good development methods:

http://www.infiniteinfo.com/openacs/things2remember.html

RESOURCES

TCL:

for real openacs beginners: http://philip.greenspun.com/tcl/ or http://eveander.com/arsdigita/books/tcl/

wiki.tcl.tk (cool examples!, really helpful in syntax problems)

http://www.scriptics.com/


Oracle:
http://tahiti.oracle.com/


PG:
http://www.postgresql.org/docs/

or better! --->
Searching stuff in the toolkit:

find /path/name -name "*-oracle.xql" -exec grep whatever {} \; -print
(you can ommit /path/name)
(thanks to Markd)

Ask questions:

I would suggest in this order:

  1. bboards
  2. IRC http://hydrairc.sourceforge.net/ (I recommend to use this in you are on
    windows, quite good!, or use trillian)
  3. package specific look for the owner(s) and contact them .info file or in the
    APM

Helping openacs:

Reporting bugs:

Patches:

first create a bug then the patch http://openacs.org/bugtracker/openacs/patch-add

how we like the patches: http://openacs.org/bugtracker/openacs/patch-submission-instructions.html

 

Scalability tests:

On PG:

http://xarg.net/writing/tuning/forums-scale

And of course, my wimpy-point test (still a not fully finished)

On oracle:

set timing on
set autotrace on

Alternately, for queries that return lots and lots of rows and all you're really concerned about is the performance stats, you can "set autotrace traceonly" which supresses the output of the rows and only shows the stats.
(thanks to Doug Harris, World Bank)