View · Search · Index

Weblog

Showing 221 - 230 of 698 Postings (summary)

Oracle Notes

Created by Jade Rubick, last modified by Gustaf Neumann 16 Jun 2017, at 09:34 AM

How do I use a literal ampersand within a SQL statement for INSERT, SELECT, etc.?

This is a sqlplus issue, I believe. See this link for a workaround: http://www.jlcomp.demon.co.uk/faq/litampersand.html
If you're on a *nix box - yasql is a great replacement for sql*plus.

Is there an equivalent of PostgreSQL's vacuum analyze

No, not really, but you can do something similar to speed up a table:

 analyze table ticket_xrefs compute statistics;

This will look at the usage statistics, and update them. This can dramatically increase performance when the amount of data in a table has changed a lot.

Moving one Oracle instance to another server

Apparently, Oracle installations are fairly self-contained. In theory, at least, you should be able to move an installation from one server to another by shutting down the server, tarring up the /ora8 directory, sftp-ing it to another server, untarring it, and possibly running the setup_stubs.sh script.

Needless to say, this is much easier than reinstalling, exporting the database, and importing it back in. No guarantees on how well it works, however.

Turning on autotrace

Turning on Autotrace

Hierarchical queries and getting around join problem with CONNECT BY

https://openacs.org/forums/message-view?message_id=125969

Getting [too long] messages?

If you get an error message starting with SQL: [too long], then you need to read this. Sometimes, for long error messages, your error messages are truncated, which makes tracking down the errors more difficult.

Efficient updates

You can do this

UPDATE
  (SELECT col1, value
     FROM t1, t2
    WHERE t1.key = t2.key
    AND t2.col2 = :other_value)
SET col1 = value

Using lots of dynamic SQL (more than 32768 chars?)

You cannot use a clob, so use the dbms_sql package:

declare
    l_stmt          dbms_sql.varchar2s;
    l_cursor        integer default dbms_sql.open_cursor;
    l_rows          number  default 0;
begin
    l_stmt(1) := 'insert';
    l_stmt(2) := 'into foo';
    l_stmt(3) := 'values';
    l_stmt(4) := '( 1 )';

    dbms_sql.parse( c             =>   l_cursor,
                    statement     => l_stmt,
                    lb            => l_stmt.first,
                    ub            => l_stmt.last,
                    lfflg         => TRUE,
                    language_flag => dbms_sql.native );

    l_rows := dbms_sql.execute(l_cursor);

    dbms_sql.close_cursor( l_cursor );
end;
/

This is from Tom Kyte, Oracle God.

Online table updates

DBMS Redefinition package

PL/SQL exception handling

  • Exception handling in PL/SQL

    SPfile and Pfile startups

    $ sqlplus /nolog
    
    SQL*Plus: Release 10.2.0.1.0 - Production on Tue Feb 28 19:04:30 2006
    
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    
    
    19:04:34 > connect / as sysdba
    Connected.
    19:05:21 sys@vs> startup pfile=/u01/app/oracle/admin/vs/pfile/init.ora.192006104950
    ORACLE instance started.
    
    Total System Global Area  285212672 bytes
    Fixed Size		    1218992 bytes
    Variable Size		   92276304 bytes
    Database Buffers	  188743680 bytes
    Redo Buffers		    2973696 bytes
    
    Database mounted.
    Database opened.
    19:05:37 sys@vs> 19:05:37 sys@vs>
    19:05:38 sys@vs> create spfile from pfile='/u01/app/oracle/admin/vs/pfile/init.ora.192006104950';
    
    File created.
    

Troubleshooting Oracle Dates

Oracle has an internal representation for storing the data based on the number of seconds elapsed since some date. However, for the purposes of inputing dates into Oracle and getting them back out, Oracle needs to be told to use a specific date format. By default, it uses an Oracle-specific format which isn't copacetic. You want Oracle to use the ANSI-compliant date format which is of form 'YYYY-MM-DD'.

To fix this, you should include the following line in $ORACLE_HOME/dbs/initSID.ora or for the default case, $ORACLE_HOME/dbs/initora8.ora

nls_date_format = "YYYY-MM-DD"

You test whether this solved the problem by firing up sqlplus and typing:

SQL> select sysdate from dual;

You should see back a date like 2000-06-02. If some of the date is chopped off, i.e. like 2000-06-0, everything is still fine. The problem here is that sqlplus is simply truncating the output. You can fix this by typing:

SQL> column sysdate format a15
SQL> select sysdate from dual;

If the date does not conform to this format, double-check that you included the necessary line in the init scripts. If it still isn't working, make sure that you have restarted the database since adding the line:

[joeuser ~]$ svrmgrl
SVRMGR> connect internal
Connected.
SVRMGR> shutdown
Database closed.
Database dismounted.
ORACLE instance shut down.
SVRMGR> startup
ORACLE instance started.

If you're sure that you have restarted the database since adding the line, check your initialization scripts. Make sure that the following line is not included:

export nls_lang = american

Setting this environment variable will override the date setting. Either delete this line and login again or add the following entry to your login scripts after the nls_lang line:

export nls_date_format = 'YYYY-MM-DD'

Log back in again. If adding the nls_date_format line doesn't help, you can ask for advice in our OpenACS forums.

Useful Procedures

  • Dropping a tablespace

    • Run sqlplus as the dba:

      [oracle ~]$ sqlplus system/changeme
      
    • To drop a user and all of the tables and data owned by that user:

      SQL> drop user oracle_user_name cascade;
      
    • To drop the tablespace: This will delete everything in the tablespace overriding any referential integrity constraints. Run this command only if you want to clean out your database entirely.

      SQL> drop tablespace table_space_name including contents cascade constraints;
      

Creating an appropriate tuning and monitoring environment

The first task is to create an appropriate environment for finding out what is going on inside Oracle. Oracle provides Statspack, a package to monitor and save the state of the v$ performance views. These reports help finding severe problems by exposing summary data about the Oracle wait interface, executed queries. You'll find the installation instructions in $ORACLE_HOME/rdbms/admin/spdoc.txt. Follow the instructions carefully and take periodic snapshots, this way you'll be able to look at historical performance data.

Also turn on the timed_statistics in your init.ora file, so that Statspack reports (and all other Oracle reports) are timed, which makes them a lot more meaningful. The overhead of timing data is about 1% per Oracle Support information.

To be able to get a overview of how Oracle executes a particular query, install "autotrace". I usually follow the instructions for autotrace.

Make sure, that the Oracle CBO works with adequate statistics

 

The Oracle Cost Based optimizer is a piece of software that tries to find the "optimal" execution plan for a given SQL statement. For that it estimates the costs of running a SQL query in a particular way (by default up to 80.000 permutations are being tested in a Oracle 8i). To get an adequate cost estimate, the CBO needs to have adequate statistics. For that Oracle supplies the dbms_stats package.

 

Useful links

IMSLD Announcement Significance Draft

Created by Cesar Brea, last modified by Gustaf Neumann 16 Jun 2017, at 09:24 AM

In case you missed it, which of course is only true for a very small percentage of you, OpenACS/.LRN recently announced that it was the first software platform to support the new IMS LD standard.

What is this all about, and why should you care?  Here's the short version:

Online learning, whether as an extension of offline learning in a classroom or as a pure proposition itself, has become a big deal and will continue to grow in importance.  One of the things that will continue to drive this is the growing availability of free, open, high-quality educational content online.  A popular example of this is MIT's seminal OpenCourseWare initiative, which in addition to becoming an incredibly useful resource itself around the world has also spawned other similar efforts.  But OpenCourseWare initially consists largely of static content -- syllabi, tests, etc.  What about interactive learning materials?

To make sure that interactive content developed by one instructor could be "played" by other instructors using different learning management systems, The US Defense Department and several other organizations setting standards for information technology in education, including a 300-member consortium called IMS, published a specification called SCORM, short for Shareable Content Object Reference Model.  So if you have a "SCORM-compliant LMS", that means it can play interactive learning content, like self-guided tutorials, and certain simulations.  Very cool! .LRN's LORS package, authored principally by Ernie Ghiglione, is one example of a SCORM-compliant player.

Many learning experiences, however, are open-ended -- meaning it's the interaction between and among instructors and students, and other players in the learning experience (patients for example, in a medical setting, or clients in a law school moot court or business school project) that really drives the value students derive from a course.  SCORM doesn't do a very good job of modeling an open-ended process, or integrating the collaborative tools that participants use online to support such experiences.

Enter IMS LD ("learning Design").  This is a more sophisticated specification that provides a pedagogically neutral language for modeling such experiences.  And now OpenACS/.LRN is the first LMS to support the specification by providing a player for IMS LD-compliant content.  In addition to "expressing the "base content" itself, the OpenACS/.LRN player allows integration of the many collaboration tools our platform provides into the learning experience experienced through the player.

Professor Carlos Delgado Kloos of Madrid's Universidad Carlos III (UC3M) kindly provided this link to instructions for accessing a working instance of IMS LD running as part of a .LRN instance; this documentation for administrators on using the package is also very helpful to read.

Now why should you care?  Online massively-multi-player (MMP) gaming, online communities, and e-learning are all increasingly central to the worlds of education and entertainment, which themselves are inextricably intertwined, especially for younger generations.  And, IMS LD represents an effort to create a lingua franca for developing content for the nexus of these three phenomena.  What, concretely, do we mean?  Consider, for example, how such a capability might be used in a law school.  We could model the legal system, with "players" acting in different roles to advocate, adjudicate, and dispense justice, using collaboration tools like chat for lawyers to examine witnesses and present arguments, polls for juries to reach verdicts, and wikis for judges to write decisions collaboratively. 

Huge, right?  It's even more significant if this experience can be developed with the knowledge that it can reach a really broad audience, which is what an open specification makes possible.  The hard part is keeping things simple enough that people can learn the format and develop for it, while keeping it flexible and "abstract" enough to encompass a large enough "possibility set" that people won't be tempted to fork so far for their own tweaks that they can't get back to something everyone can run.  I'd expect a cottage industry will emerge in which participants will author libraries of "LD templates" of different pedagogical approaches that instructors could then easily configure for their teaching needs.  Right now, though, that's a bit further ahead in the future.

So we'll see how this unfolds.  See immediately below, as well as in the comments on this page for excerpts from some very helpful further comments by some colleagues in the .LRN community:

From Professor Jesus G. Boticario of the Artificial Intelligence Department of Spain's Universidad Nacional de Educacion a la Distancia (UNED):

"Let me add that I'm looking forward to reading the comments from Luis and Jopez on this. I presume that they will clarify a key issue regarding IMS-LD, which is the description, in a non-dependent pedagogical way (i.e., open to any pedagogical approach) of learning activity workflows. Moreover, this opens up a standard approach to deal with a recurrent open problem in learning, which is to take into account individual needs and preferences while interacting with learning activities. In particular, the LD designer can describe a learning activity to be delivered, using any pedagogical approach applicable (e.g., a very simple one: first provide the examples then a related explanation, or the other way around, first introduce the subject at hand then provide examples, and provide one or the other considering if the learner has an inductive or deductive learning style).

Furthermore, the fact is that the IMS-LD specification expands opportunities for re-use of learning designs by enabling interoperability among compliant learning management systems is what makes it so powerful (Buzza, Bean, Harrigan & Carey, 2004). Available at: http://www-jime.open.ac.uk/articles/10.5334/2005-17/

 IMHO, another relevant issue here is to remark the R&D projects which have been using IMS-LD in conjuction with dotLRN. On our side these are as follows:

- EU4ALL (October 2006-September 2010)
European Unified Approach for Assissted Lifelong Learning
Funded by the EC under the 6th FP: IST-2005-034778
http://cordis.europa.eu/project/rcn/80191_en.html

- ADAPTAPlan (January 2006-December 2008)
Adaptation based on machine learning, user modelling and planning for complex user-oriented tasks
Funded y the Spanish Ministry of Science and Technology: TIN 2005-08945-C06-01
http://adenu.ia.uned.es/adaptaplan/

- FAA (February 2005 – July 2007)
Open and Accessible Training
Funded by the Xunta of Galicia (Spain): PGIDIT-05-SIN-011-E
http://adenu.ia.uned.es/faa

- aLFanet (May 2002-April 2005)
Active Learning for Adaptive Internet
Funded by the EC under the 5th FP: IST-2001-33288 to cover de full life cycle of adaptive e-learning
http://alfanet.ia.uned.es

Cheers,
Jesus"

 

From Professor Gustaf Neumann, Head of the Department of Information Systems at Vienna University of Economics and Business Administration:

"Hi Folks,

A few comments from my side concerning IMS LD.

 - first of all, i think that it is great, that we have one of the best IMS LD supports
  available in .LRN

 - however, we should not overemphasis it, since IMS LD has as well many weaknesses, at least for university usage with a blended learning approach:

 * most teachers are not able to develop a useful IMS LD design in the time they want to devote for this

 * IMS LD is designed with an "ex-ante course design" in mind, which is "re-played" in a class situation. At least in our university, this would not work, since we seldom run the exact same design multiple times. It looks to me, as if the mindset behind IMS LD is that the course designer is typically not the teacher  in a class.

  * The suitability of IMS LD might be much better for highly standardized courses such as for driving licenses, ecdl, etc. or for university targeting on distance education.

 - in our environment agile content development and flexible content reuse together with some learning-activity management (similar to ad-hoc work flows) are much more important. Teachers want to react immediately to pot. weaknesses in their materials and course designs...

Interesting enough, the community base approach of .LRN makes it easy to define online learning communities,which are suitable for both, distant and blended learning. So I would recommend emphasizing this aspect as well sufficiently.

best regards
-gustaf

 

From Jose Pablo Escobedo Del Cid at UC3M:

"Hi, Jesus,

You are right about the pedagogical issue. The IMS-LD specification provides a generic and flexible language to capture the pedagogic structure of an online learning experience and it is designed to enable many different pedagogics to be expressed. (More info on how to model different didactical scenarios can be found here: Daniel Burgos, Rob Koper, 2005, "Practical pedagogical uses of IMS Learning Design's Level B http://dspace.ou.nl/handle/1820/471) ". IMHO, the flexibility of the IMS-LD spec, not being bound to any pedagogy, is one of its major advantages. The levels B and C (which introduce the conditions, properties and notifications) enable the automation of learning flow activities, which are triggered by the completion of tasks and the value of the properties that change during the run, rather than the learning flows being pre-planned by the course designer. A consequence of this dependence on runtime events is that the activities set to learners are no longer wholly predictable, they depend on the course of the collaboration.

I hope this helps!

Regards,
Jopez"

Dynamic Object Type

Created by Lee Denison, last modified by Gustaf Neumann 15 Jun 2017, at 02:58 PM

Package Specification Summary for Package: dynamic-types

Summary: Dynamic Object Type management API
Description: Allows creation, manipulation and ui generation of dynamically generated object types.
Maturity: New Submission or Maturity Unknown
This package depends on: acs-kernel acs-content-repository acs-translations
Packages that depend on dynamic-types: project-manager
Package parameters: None


Bug Tracker Summary for Package: dynamic-types

There is no package with the name "dynamic-types" known to bug-tracker.



Code Metrics Summary for Package: dynamic-types

# Tcl Procs 0
# Tcl Lines 0
# Tcl Blank Lines 1
# Tcl Comment Lines 0
# Automated Tests 0
# Stored Procedures PG: 0 ORA: 0
# SQL Lines PG: 0 (blank 1 comments 0) ORA: 0 (blank 1 comments 0)
# ADP pages 0
# ADP lines 0
# Include pages (dynamic-types/lib/) 0
# Documentation pages 0
# Documentation lines 0
Browse Source Not installed
Github Repository: https://github.com/openacs/dynamic-types/tree/oacs-5-10

 

cvs head version of project-manager requires dynamic-types

What does dynamic-types do?
Dynamic types allows you to create new OpenACS Object Types and add attributes to them through a Tcl API.

When should I use dynamic-types?
Dynamic types supports several use cases:

  • Container Applications - meta-applications which define the necessary data model and code to perform a useful function but the extended data is decided by the administrator.
  • Extending existing packages with dynamic data. As an example project manager has dynamic types support which allow third packages to add attributes to projects and tasks which can be edited using the standard interface for project manager.

Creating a Dynamic Type (Declaration)
There are three main ways to create dynamic types:

  • As a user, through an application user interface.
  • As a system administrator, through install.xml actions.
  • As a programmer, through the Tcl API.

notes:

a 2005 implementation example

Running Applications built on dynamic-types

The project manager package (latest version in HEAD) relies on dynamic types to allow custom applications and other packages (like invoices, logger) to extend the basic attributes of a project and a task. This is in use by three clients of cognovís.

Solution Grove has been exploring helping clients build dynamic data models with dynamic types.

Two examples we have are about bulk data collection, aggregation, and analysis. In both cases, data is uploaded to the system, where a web user interface is providing for viewing and aggregating the data.

In the first case, there is an administrative user interface to define a new type, and arbitrarily many types can be created. Each new type of data collection gets a different table/dynamic type in the database. Here we are mainly using the dynamic type system to programatically build new tables for collection. We also use the dynamic type definitions to build the user interface to explore the data after it has been uploaded. Storing all the data in a specific table, instead of generic storage, makes the reporting and dynamic analysis of the data much easier to code for. Doing sum, average, etc calculations on the data is greatly simplified. In this case we are collection many different types of data, and doing unique analysis on each type, so the ability to create the types, and build a user interface to it, on the fly is very helpful. The data collection is done through transfer of XML files with an external application. Using the dynamic-type attribute info we are able to map the XML structure to the various dynamic data collection types.

For another client, we are using dynamic types to give the site administrators more flexibility in developing their application. The client wants to allow users to upload specialized data files, but then to organize these files in ways that make sense to the client and their users. So, we developed 4 dynamic-type objects (institution, ward, glucose_file and glucose). An institution can have multiple wards, which can have multiple glucose_files which can have multiple glucoses. The attributes of each object is set by the site-administrator, and the plan is to adjust them over time as the site's needs change. Because everything is done with the Web UI, the administrator can make changes as they need to. The add-edit pages respond automatically to any changes in the attributes - there's no need to recode them when you add an attribute to an object.

A third application we have developed is a generic resource database, where a form can be generated to collect information such as a list of businesses, or other resources. The dynamic UI here can be integrated with categories to build a dynamic form for data entry. We also built a dynamic UI to view lists and individual entries.

 

Xarg Examples 

Xarg have developed two 'products' which are installed for multiple clients. In each case we used dynamic types to handle sections of data which are expected to be different for each client installation. Dynamic types allowed the system to handle the different data sets without needing to modify the code for each client.

dotCommunity: In our dotCommunity product users are able to create community websites by filling in an application form.  The system supports multiple community 'types'.  Dynamic types allows each clients to collect and display different data for each community type on a per installation basis.

dotConsult: This is our e-consultation product which uses dynamic types to store a flexible set of demographics information for the users taking part in the consultation.

Future Directions

The current APIs of dynamic-types are under revision, a much more consistent, and less abstract API is under development. It does not appear an upgrade from the older API will be easy to write.  In the long run support for "lists" as AMS has them would be a nice feature in addition to the option to store the additional types and attributes in a meta database (as AMS does) or in the primary tables (as dynamic types does currently). Dynfield (an application from Project Open) supposedly does exactly that, but for reasons unknown to me (MS) it has never made it into proper OpenACS and therefore any of it's packages.

 

Difference to AMS

 

The AMS package allows you to extend any object_type with additional attributes. These attributes are stored in a meta table, allowing you to quickly change the makeup of you objects without the need to change anything in the database. Additionally, through the support of "lists" for object_types, you can compose the entry forms for objects in multiple different ways, thereby allowing many different views on the same object_type.

Emacs as an OpenACS IDE

Created by OpenACS community, last modified by Gustaf Neumann 13 Jun 2017, at 10:30 AM

emacs integrated development environment for OpenACS

emacs documentation: http://www.gnu.org/software/emacs/manual/html_node/

Emacs uses major and minor modes that provide a UI context for editing various file types. Here are some useful ones for working with OpenACS:

CVS Mode Emacs with OpenACS

I use M-x cvs-examine to update and check in code when I am working with OpenACS. One thing that is a pain with CVS is that cvs diff does not tell you what you are going to get if you update, it only tells you what is changed in your local copy.

You can use M-x cvs-examine and then type "d e" next to any of the files in your checkout in the *cvs* buffer to open ediff mode and then interactively merge what's in CVS with your local changes. In ediff mode you use n/p to got to the next/previous difference. You can copy changes from the CVS buffer to your local copy using a/b to copy the the buffer marked A to B or B to A. Type ? on the ediff window to get a list of other commands.

OpenACS Mode for Emacs

See historical page describing oacs.el http://web.archive.org/web/20040621200046/www.thecodemill.biz/services/oacs/

 

Download: oacs.el.tar updated 2006-08-15 . The lastest version includes nXML mode support in addition to PSGML support. There are good installation instructions in the INSTALL.txt file. A quick install guide for Debian


 


sudo su -
cd /usr/share/emacs/site-lisp
wget http://www.emacswiki.org/elisp/color-occur.el
wget https://openacs.org/storage/view/xowiki-resources%5C/oacs.el.tar
tar xf oacs.el.tar
apt-get install psgml mmm-mode

# Alternatively compile manually
wget http://www.lysator.liu.se/~lenst/about_psgml/psgml-1.2.5.tar.gz
tar xfz psgml-1.2.5.tar.gz
cd psgml-1.2.5
./configure
make install
cd ..
wget http://switch.dl.sourceforge.net/sourceforge/mmm-mode/mmm-mode-0.4.8.tar.gz
tar xfz mmm-mode-0.4.8.tar.gz
cd mmm-mode-0.4.8
./configure
make install

After this login as the user who is doing the development and edit you .emacs file.

 (add-to-list 'load-path "/usr/share/emacs/site-lisp/oacs")
 (require 'oacs)
 (setq user-full-name "<yourname>")
 (setq user-mail-address "<your email>")
 (add-to-list 'auto-mode-alist '("\\.vuh" . tcl-mode))
 (add-to-list 'auto-mode-alist '("\\.adp" . html-mode))

For recent Emacs versions (> 2008), modify oacs-nxml.el in the downloaded tarball:

 line 30: (load "nxml-mode.el")  instead of (load "rng-auto.el")

See http://lists.gnu.org/archive/html/emacs-devel/2008-01/msg00947.html

Also, you may need to modify adp.rnc to the correct path to the xhtml.rnc schema on your installation. On OS X, for example, line 5 should read:

include "/Applications/Emacs.app/Contents/Resources/etc/schema/xhtml.rnc" 

 

The following was written by Bart the author of oacs.el

OpenACS lacked a good Integrated Development Environment and as I use Emacs for almost everything it was only natural to fill the void. The Emacs OACS module is an extension to GNU Emacs, the extensible, customizable, self-documenting real-time display editor.

Development status

Emacs OACS's development is driven by the needs I encounter in my OpenACS projects. Development takes place in my spare time. At this stage the code is the documentation. I lack the time to write a proper article. However, as Emacs OACS addresses the issues described in articles XQL Document Type Definition and Replacing SQL bind vars in Emacs some background information can be found in those articles.

Forum thread: Beta Emacs OACS module available

Useful commands

Formating TCL

  • M-o ft to re-format Tcl code. See code for details.
  • M-o fh to reformat Html or Adp code.
  • M-o fs to reformat Sql code.
  • M-x oacs-format-separate-tags to separate adjacent tags. E.g. <tr><td>
  • M-x oacs-format-includes to place all include attribubtes on a separate line.
    
     

Code navigation

  • M-o oo to search for any custom regular expression.
  • M-o on to search the log for Notice oacs-dbg messages. That is a Notice level message created with the macro 'oddbg'.
  • M-o od to search the log for Debug oacs-dbg messages.
  • M-o oe to search the log for Error oacs-dbg messages. Etc for all other ns_log levels.
  • M-o op to browse Tcl libraries for procedure definitions. This is by far my favorite way of navigating a library!
  • M-o fp (find-file-at-point) to NSD error log mode.
  • M-o rl to revert the logfile
  • M-o ml to to open an error log file and monitor the changes to the log. 

 

Editing docbook xml

 

editing via Muse mode

editing via nXML mode

See https://openacs.org/doc/nxml-mode.html

psgml mode

See:

Developing with emacs

To make emacs display .vuh files similar to .tcl files, add to .emacs file:

 (add-to-list 'auto-mode-alist '("\\.vuh" . tcl-mode))

 

To make emacs display .adp files similar to .html files, add to .emacs file:

 (add-to-list 'auto-mode-alist '("\\.adp" . html-mode))

 

Common command shortcuts

Minor Modes

 M-x global-font-lock-mode highlights syntax using colors
 M-x transient-mark-mode   shows a highlighted text region
 M-x show-paren-mode       shows matching parentheses (and when the do not)

Move, Search and Replace

 M-x goto-line             go to a specific line in a file
 M-x goto-char             go to a specific character number in a file
 M-C-f                     search forward for matching brace
 M-C-b                     search backward for matching brace
 M-x replace-regexp        search/replace using regular expressions
 M-x query-replace-regexp  query/search/replace using regular expressions
   note \\( and \\) for start and end subgroups
 M-x grep                  grep creates new buffer with results
                           for fast loading/editing search hits

Useful "sleepers" (not found in many shortcut sheets)

 fg<cr>                    restart a suspended emacs session from commandline
 C-q <key press>           add a key without emacs interpreting the key binding

You can configure emacs to create 4 spaces when you press the tab key--important for meeting coding standards. Add this to your .emacs file:

(setq-default tab-width 4 indent-tabs-mode nil)

other useful quicksheets

PostgreSQL Administration

Created by OpenACS community, last modified by Gustaf Neumann 13 Jun 2017, at 10:27 AM

Finding and fixing expensive queries

Probably the most important thing you can do to improve performance is rewriting queries to run quickly. Explain analyze is your friend. OpenACS also includes tools to track down slow queries, and you can ask PostgreSQL to give you information about queries as well.

First you should install the acs-developer-support package on a development or staging server. In general its not a good idea to keep the develop support tracking features running constantly on a production system, but you can turn it on temporarily to diagnose a problem on a production system. Once Developer Support is installed you can visit /ds/ on your site and turn on the developer support toolbar and database statistics. This will give you a total of the time for all queries for a page in the toolbar at the top of the page. If you click on the timing information you can see a page that lists every query run for that page. It should be easy to spot the slow running query in the list.

Once you find the slow running query you can copy it to your clipboard. Next you want to open a psql session on the database server, or use M-x sql-postgres most in emacs. Type "explain analyze" and paste the query after that. This will tell PostgreSQL to run the query and show the query plan it will use.  The first thing to look for is a "Sequential Scan" on a large table. If the table is small (hundreds instead of thousands of rows, for example)  it is probably cheaper to scan the table than to load an index, but on large tables like "acs_objects". "users", "cr_items", a sequential scan is a sign of trouble.

PostgreSQL does not seem to generate good plans if you do a join with a view. In this case you should try to recreate the query using the tables in the view explicitly. This can speed up many queries. A common example is the cc_users view, or the cr_revisionsx view or the (x) view automatically created for subtypes of cr_revisions.

If you can't figure out why the query plan is slow, post it somewhere on the OpenACS forums or ask for advice in the #openacs irc channel. (https://openacs.org/irc/) 

This will help you is you know which page is slow. If you don't know which is slow, but notice a high load on PostgreSQL on your server. You'll need to turn on the stats collector and command string collector in PostgreSQL. In the postgresql.conf file set

   stats_start_collector true

and

   stats_command_string true

and then do /etc/init.d/postgreql reload or pg_ctl reload to turn it on.

Once this is on you can execute "select * from pg_stat_activity" to see if there are any long running queries. Most queries will finish too quickly to notice in this table. The table includes the start time of the query and the process id of the backend executing the query. Sometimes you'll find a particularly bad query has been running for a very long time. Sometimes hours. If this happens you can stop the query by issuing a SIGINT signal to the process of the backend that is running that query. This will execute a cancel request to the backend and is the only safe way to stop a long running query. Do not kill the process or try to stop AOLserver. If you stop AOLserver the query will continue to run in the PostgreSQL backend process.

Tuning PostgreSQL

Tune PostgreSQL. (OPTIONAL). The default values for PostgreSQL are very conservative; we can safely change some of them and improve performance.

  1. Change the kernel parameter for maximum shared memory segment size to 128Mb: DAVEB: How current is this? Do modern 2.4 or 2.6 kernels have such low settings? This is highly dependent also on the amount of RAM on your server, most servers have gigabytes of RAM so adjust accordingly.

    [root root]# echo 134217728 >/proc/sys/kernel/shmmax
    [root root]#

    Make that change permanent by editing /etc/sysctl.conf to add these lines at the end:

    # increase shared memory limit for postgres
    kernel.shmmax = 134217728
  2. Edit the PostgreSQL config file, /usr/local/pgsql/data/postgresql.conf, to use more memory. These values should improve performance in most cases. (more information) 

    #       Shared Memory Size
    #
    shared_buffers = 15200      # 2*max_connections, min 16
    
    #       Non-shared Memory Sizes
    #
    sort_mem = 32168            # min 32
    
    
    #       Write-ahead log (WAL)
    #
    checkpoint_segments = 3     # in logfile segments (16MB each), min 1
    

    Restart postgres (service postgresql restart) or (/etc/init.d/postgres restart) so that the changes take effect.

Performance tuning resources:

more information about PostgreSQL

Vacuuming multiple databases

If you are frequently creating and dropping various databases, using this in your crontab can help simplify setup:

vacuumdb --all --verbose

 Debugging queries

You can work directly with the database to do debugging steps like looking directly at tables and testing stored procedures. Start emacs. Type M-x sql-postgres. Press enter for server name and use $OPENACS_SERVICE_NAME for database name. You can use C-(up arrow) and C-(down arrow) for command history.

Hint: "Parse error near *" usually means that an xql file wasn't recognized, because the Tcl file is choking on the *SQL* placeholder that it falls back on.

*nix operating system

Created by OpenACS community, last modified by Gustaf Neumann 13 Jun 2017, at 10:24 AM

*nix operating systems

OpenACS works on most any operating system that behaves in a manner similar to UNIX. (see "Unix-like" by Wikipedia). For example: (links to features lists of OSes)

YUI Project

Created by Ryan Gallimore, last modified by Gustaf Neumann 11 Jun 2017, at 10:33 AM

Notes on an OpenACS wrapper for YUI

  • There is some consensus to use YUI over other JS libraries, e.g. jQuery.
  • Use most complete version - YUI library
  • YUI Loader for dynamic loading.  Each wrapper function in OpenACS loads only the YUI components that it needs.  This is preferable to sending the full 250 KB gzipped library for every page.
  • Download YUI sources from package directory or Yahoo's CDN.
  • Always combine sources into one HTTP download if using CDN
  • UI tests (Selenium IDE/RC) should be written for all wrappers to facilitate testing during development and when YUI is upgraded.
  • Wrappers will be defined by specific tasks like perform an AJAX request and return the response into a div.  The wrapper will take care of loading all required sources into the page.

YUI Theme [Suggestion]

 

 

  • Provide a package openacs-theme-yui, which is based on the YUI CSS Foundation

nlunt: A word of warning regarding YUI Loader:
While it sounds like a good idea to load only the modules that are needed, my experience has shown that there may be more benefit to loading a single gzipped file for the javascript and css portions of YUI for a total of 250K that is cached after the first load. This sounds like a lot to load for every page, however, loading just the base modules of YUI may exceed that amount because the individual JavaScript and css files for each module are not gzipped. Loading all of YUI uncompressed is about 1M, so there is considerable benefit in loading the files compressed.

OpenACS/dotLRN Windows Installer Instructions

Created by Byron Linares, last modified by Maurizio Martignano 07 Jun 2017, at 05:34 PM

NOTE: Currently (06/2017), the best option to get OpenACS 5.9.* running on Windows is to use the native windows installation Windows-OpenACS by Spazio IT (Maurizio Martignano).


This page describes the installation of (quite old) components based on cygwin, but might still be useful for people, that can't use Maurizio's implementation for whatever reason:

  • OpenACS 5.2.3
  • DotLRN 2.2.0

Included Software

  • AOLServer 4.0.beta10_2003
  • PostgresSQL 7.4.3
  • OpenACS 5.2.3
  • DotLrn 2.2.0
  • Cygwin

Installer Download :

The installer is available in openacs community page.
Available versions:
 

  • OpenACS/dotLRN installer
  • OpenACS 5.2.0 installer


Installation Instructions:

Run the "OpenACS/DotLRN Installer" called setup.exe, read the license document before continuing, the installer will ask for some information, this will be used to make the automatic installation.

There are to ways to install the components; manually or automatic

Components
 

  • dotLRN Manual and openACS Manual:
  • In this modality the entered personal data in the installer will be omitted and will be necessary to retake the installation from a browser window and enter the necessary data to continue the creation of the data modeling.
  • dotLRN Automatic and openACS Automatic
  • In this modality the installer its in charge of all the work, when finishing creating the data model the following step would be to reinitiate the service and continue with the use of the platform.
  • Source Code:
  • The installer will put in the installation folder the source code of the same one.


Select what you want to install and click next. After the installer places all the files, a browser window will be opened and the installation have to be continued from here, if the automatic mode has been selected wait to the installation finishes. When the installation finishes restart the server and type in a web browser "http://localhost"

 Access Icons:

  • OpenACS on the web: access to http://localhost/
  • Start Server: Bach file to initiate the server (aolserver, postgresql, cygwim)
  • Stop Server: Bach file to stop the server (aolserver, postgresql, cygwin)
  • Unistall OpenACS: Uninstall all

Diagnostics
 

  • Check if CygWin: Please execute the file server/cygwin/cygwin.bat.  You should get a black screen with some green text saying: "yourusername@yourcomputer" and the "$".
  • Check PostgreSQL: in the cygwin window typy psql -l , You should get the names of all data base.
  • Check AOLServer: ps -alW | grep nsd , You should get some thing like this
  • 2312 0 0 2312 ? 0 07:52:20 C:\OpenACS\nsd4\bin\nsd.exe


Full guide

 

 

developed at the Galileo University (www.galileo.edu) by Byron Haroldo Linares Roman bhlr@galileo.edu as part of the E-LANE project (www.e-lane.org)

 

 

related forum threads

OpenACS/dotLRN installer for MSWindows

Bulk Upload

Created by OpenACS community, last modified by Gustaf Neumann 07 Jun 2017, at 11:02 AM

Status

pre-release  (part of the ecommerce-g2 project)

Introduction

There is little consistency between packages for uploading data. Most packages do not offer an import feature. The current practice is to use the database import features directly. This also means creating small scripts or using intermediate applications to manipulate the data prior to import, and using shell commands to get the data into the right security context and location. Mistakes in the import usually have to be corrected with hand-written sql updates. A data importer likely needs to have admin level access and unix level competency, which is beyond the usual skill set required to manage a website application. A bulk-upload package would standardize and ease barriers to setting up and managing OpenACS packages.

Vision Statement

A package that provides standardized UI and import services for bulk uploading data (tables and lists) into existing tables of other packages

Requirements

  • provide import modes
    • insert rows with new keys only
    • update where rows already exist
    • report any unchanged rows?
    • ignore or error if importing a field not found in tables or specified sets
  • import to multiple tables from the same upload
  • option to print or log ignored or rejected rows/fields
  • use the status_bar feature, that tells when a file is uploaded, and when it is being processed (helps in cases where connection times out)
  • Use this framework to create a UI for managing ACS reference data ( en:acs-reference ) --importing, updating, editing, reporting. (for en:ecommerce-g2 )

Implementation Notes

see also: https://web.archive.org/web/20071007211200/http://jongriffin.com/articles/openacs-relevancy/

Exsiting ecommerce bulk upload of custom fields represents the most flexible at this point, because it handles inserts and updates, and builds the sql as well as uses the xql query files: https://raw.githubusercontent.com/openacs/ecommerce/master/www/admin/products/extras-upload-2.tcl

Perhaps a dumbed-down spreadsheet data model would work well, to allow for tables of most any number of columns or rows without having to create/expose code that modifies db tables.

DAVEB: In addition to any generic storage of imported data, I think it would be useful to support importing into specific storage tables. The easiest, best examples are the content repository, or dynamic types defined tables and views. There are Tcl apis to insert/update these tables and it makes sense to support this as well.

Don Baccus has other implementations which complement this and may provide an overall development path for a preliminary general bulk upload.

Feature requests

 

Installing OpenACS on FreeBSD with ports

Created by Gustaf Neumann, last modified by Gustaf Neumann 07 Jun 2017, at 10:28 AM

NEW:  For the impatient users there is a quick-and-dirty install guide for FreeBSD

OpenACS and .LRN are included in the current FreeBSD ports tree.
The ports are tested with FreeBSD production version 6.2-RELEASE, old stable 5.5-RELEASE and the development branch 7-CURRENT.

Installation requirements:

  1. FreeBSD operating system with root access rights.
  2. Installed and updated FreeBSD Ports Collection (for updating see Appendix A below)
    (alternative: installing from packages, see Appendix B)

To install OpenACS or .LRN from the FreeBSD ports tree, follow the instructions below.

1. Installing and configuring PostgreSQL

NOTICE: If you have a PostgreSQL server installed and running, skip to Section 2.

If you desire to use a local PostgreSQL server (most users do), install the server first.
We recommend using PostgreSQL version 8.2 from the databases/postgresql82-server port


 

# cd /usr/ports/databases/postgresql82-server # make install clean

 

NOTICE: As an alternative, you may install PostgreSQL server from a binary package. See Appendix B below

The plperl language is required for OpenACS/.LRN. This can be installed from the ports with the following commands:


 

# cd /usr/ports/databases/p5-postgresql-plperl # make install clean

To install the OpenACS/.LRN database, your PostgreSQL server must be running.
You need to enable it in your /etc/rc.conf (or /etc/rc.conf.local) by adding the following line:

postgresql_enable="YES"

After installing the PostgreSQL server, you have to initialize your data store:

# /usr/local/etc/rc.d/postgresql initdb

To start the PostgreSQL server, issue the following command:

# /usr/local/etc/rc.d/postgresql start

You can check if the server is up and running with:

# /usr/local/etc/rc.d/postgresql status

 

2. Installing OpenACS / .LRN

2.1 Installing the OpenACS or .LRN port 

OpenACS can be installed directly from the FreeBSD ports tree, www/openacs:

# cd /usr/ports/www/openacs
# make install clean

.LRN installation, www/openacs-dotlrn:

# cd /usr/ports/www/openacs-dotlrn
# make install clean

NOTICE: If you want to make changes to the default configuration, the AOLserver configuration files for OpenACS/.LRN files are located at:
/usr/local/openacs/etc/openacs-config.tcl
/usr/local/dotlrn/etc/dotlrn-config.tcl

NOTICE: If you installed both OpenACS and .LRN ports, you have to change the default port of one of the installations. See the configuration files in the previous notice.

 

2.2 Creating the OpenACS/.LRN database 

For this step, you require an installed and running PostgreSQL server (see Section 1) and installed OpenACS/.LRN (see Section 2.1)

First we need to adjust the PostgreSQL configuration (this applies for server versions 8.1.x and higher):

# /usr/local/share/doc/openacs/adjust_pgsql_conf.sh

or if .LRN was installed: 

# /usr/local/share/doc/dotlrn/adjust_pgsql_conf.sh

NOTICE: You can adjust the configuration manually (standard location: /usr/local/pgsql/data/postgresql.conf)
Please see en:How_to_install_in_Postgres_8.x.

The PostgreSQL server needs to be restarted after changing the configuration:

# /usr/local/etc/rc.d/postgresql restart

Next, we can create a default OpenACS database by running the following script:

# /usr/local/share/doc/openacs/create_sampledb.sh

To create a default .LRN database, run the following script:

# /usr/local/share/doc/dotlrn/create_sampledb.sh

 

 

2.3 Starting OpenACS/.LRN and finalizing installation 

To make use of the automatic startup script OpenACS/.LRN has to be enabled in /etc/rc.conf (or /etc/rc.conf.local):

openacs_enable="YES" 

 

or for .LRN:

dotlrn_enable="YES" 

To start OpenACS, use the following command:

# /usr/local/etc/rc.d/openacs start

To start .LRN, use the following command:

# /usr/local/etc/rc.d/dotlrn start

Now you can login to your OpenACS/.LRN system and finalize the installation.
The default port is 8000. URL:

http://<your-ip>:<port>

After filling your e-mail address, password and other important information OpenACS/.LRN gets installed, but the server stops.
You have to start it again (see above).

 A. Updating the FreeBSD ports tree

To get the latest versions of the OpenACS, .LRN and other FreeBSD ports, it is recommended to update the FreeBSD ports tree on a regular basis. The easiest way to to perform this task is using the portsnap(8) command.

For documentation, refer to the following FreeBSD Handbook chapters:
Using the Ports Collection
Using Portsnap

 

B. Installing from binary packages

PostgreSQL, OpenACS, .LRN and all dependent ports may be installed from binary packages, too.
This installation can be performed from a submenu of FreeBSD's sysinstall(8) command: Configure/Packages

OpenACS and .LRN are located in subcategory www, PostgreSQL is in subcategory databases.

 

C. Contact information and bug reporting

Please send bug reports and feature suggestions to the port maintainer of OpenACS/.LRN FreeBSD ports:
Martin Matuska <mm_at_FreeBSD_dot_org>

Next Page
previous December 2026
Sun Mon Tue Wed Thu Fri Sat
29 30 1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31 1 2

Popular tags

17 , 5.10 , 5.10.0 , 5.10.1 , 5.9.0 , 5.9.1 , ad_form , ADP , ajax , aolserver , asynchronous , Azure , bgdelivery , bootstrap , bugtracker , CentOS , COMET , compatibility , conference , CSP , CSRF , cvs , debian , docker , docker-compose , emacs , engineering-standards , exec , fedora , FreeBSD
No registered users in community xowiki
in last 30 minutes
Contributors

OpenACS.org