View · Index
No registered users in community rubick
in last 10 minutes

Weblog Page

Showing 51 - 60 of 66 Postings (summary)

Virtual Hosting in 10 Minutes or Less

Created by , last modified by Gustaf Neumann 20 Dec 2008, at 10:56 AM

This method isn't perfect, but it is very easy to do.

It doesn't require recompiling Aolserver, or anything really that complicated, and lets you share an IP address among multiple servers. You don't even need another instance of Aolserver. Just the main server needs to have OpenACS on it.

The only downside is that you get the port numbers in the address.

Try it with http://rubick.com or http://www.rubick.com

You should be redirected to http://rubick.com:8002

Here's how it works:

  • you have a main server that does the redirects (this has to have OpenACS on it). Let's call this abc.com
  • go to /admin/
  • set up a package mounted at any old directory. Let's say /redirect
  • go to Host-Node Map on the admin page
  • set up def.com to go to the /redirect directory
  • unmount the application in the redirect directory
  • create a /redirect directory under /www/redirect
  • inside this directory, put an index.vuh file.

Copy this inside it:

ad_page_contract {
   redirect

   @author Jade Rubick
   @creation-date 2003-04-24

   Helpful .vuh example at
   http://www.arsdigita.com/bboard/q-and-a-fetch-msg?msg_id=000JTn
} {
}

set path [ad_return_url]

set page_loc "http://rubick.com:8002$path"

set page "<html><title>Redirecting to Rubick</title><body>Moving to Rubick.com site<meta HTTP-EQUIV=\"REFRESH\" CONTENT=\"1;URL=$page_loc\"></html>"

ns_write $page

Substitute your port in for 8002.

One issue I had was getting www.rubick.com to work as well as rubick.com. The reason is you can't have two sites going to the same directory. To get around this, you'll have to create a redirect and redirect2 directory.

I wanted to use ad_returnredirect, but there is a bug in IE that prevents me from using it. Unfortunately, this means I have to slow down all users..

Other solutions

Edit this page: user documentation

Created by , last modified by Gustaf Neumann 20 Dec 2008, at 10:56 AM

Introduction: Edit-This-Page

This is a brief introduction to Edit This Page, a web-based program which allows you to edit web pages using your web browser.

You've probably been referred to this webpage by someone who has set you up with the ability to edit web pages.

How to edit a page

  1. Go to the URL of the page you've been told you can edit.
  2. Log in to the website (usually, there is a link on the page which says Log in
  3. Go to the bottom of the page, and click on Edit This Page
  4. You'll see a page that says, Title, Desription, and Content.
    • Title: what is shown on the top of your window
    • Description: show on pages linking to this web page
    • Content: the bulk of the web page.
  5. Click on the edit link next to the Content.
  6. You'll see lots of codes, and the text of the webpage. It will look something like <B>Hello world</B> These codes are called HTML. Here is a quick reference, if you need to figure out what a particular code is. The basic idea is that the codes are in <code> brackets. Here are a few examples: <I>italics</I> <B>bold</B> and so on.
  7. You can edit the text and codes. Try not to be intimidated by the codes. You don't have to learn HTML to edit the webpage, but to do anything like add pictures or links, or control the appearance, you will have to use HTML. Future versions of Edit-This-Page will dispense with having to use these codes, but for now, this is what we're stuck with.
  8. Once you've edited it to your satisfaction, click on the Submit button
  9. Click on Preview Changes to see what the web page will look like.
  10. If you like it, go back one page, and hit Submit your Work. This will make your changes go live. Now the whole world can see your web page!
Note that all versions of the document you edit are saved, so you don't have to worry about breaking anything.

Creating a Dev Server

Created by , last modified by Gustaf Neumann 20 Dec 2008, at 10:56 AM

The dev server is rubick-dev, the server is rubick. I've put the CVSROOT at /var/cvs

4 cvs -d /var/cvs co rubick
5 ls
6 createdb rubick-dev
7 env |grep EDITOR
8 emacs .bashrc
9 exit
12 env |grep EDITOR
19 crontab -e
21 ls
22 mv rubick rubick-dev
23 ln -s rubick-dev/ website
28 emacs website/etc/config.tcl
29 emacs website/etc/config.tcl
30 emacs website/etc/daemontools/run
35 cd
36 cd website/database-backup/
37 cp ~rubick/website/database-backup/backup_2004-06-22.dmp .
42 cp backup_2004-06-22.dmp backup_2004-06-22.dmp.bkup
43 perl -pi -e "s/^\\connect rubick$/\\connect rubick-dev/" backup_2004-06-22.dmp
44 less backup_2004-06-22.dmp
(this is only necessary before postgres 7.4)
45 psql -f ~/website/packages/acs-kernel/sql/postgresql/postgresql.sql rubick-dev
48 psql -f backup_2004-06-22.dmp rubick-dev
52 cd
57 cd website/etc/daemontools/
59 ./run
60 less ../config.tcl
61 cd ..
62 ls
63 cd ..
64 ls
65 cd log
66 less error.log
67 emacs ../etc/config.tcl
68 cd
69 less website/log/error.log
70 cd
71 cd website/etc/daemontools/
72 ./run
73 less ../../log/error.log
74 fg
75 less ../../log/error.log
79 emacs ../config.tcl
80 ./run
81 exit
82 emacs website/etc/config.tcl
83 svc -t /service/rubick-dev

Excellent user and group management

Created by , last modified by Gustaf Neumann 20 Dec 2008, at 10:56 AM

SQL Constraints Naming Conventions

Created by , last modified by Gustaf Neumann 20 Dec 2008, at 10:56 AM

Conventions I've adopted for naming constraints:
table foo (
  bar   integer constraint foo_bar_pk primary key
)

_pk  primary key
_fk  foreign key
_nn  not null
_ck  check
_uq  unique

Categories

Created by , last modified by Gustaf Neumann 20 Dec 2008, at 10:56 AM

Using tree_sortkey for hierarchical queries in Postgres

Created by , last modified by Gustaf Neumann 20 Dec 2008, at 10:56 AM

Using tree_sortkey for hierarchical queries

Tree_sortkey is a method of making hierarchical queries. It is built in to OpenACS, and is the prefered equivalent to Oracle's CONNECT BY statement. I believe you can even make joins with tree_sortkey, which is an improvement on CONNECT BY.

I've written a newer version of this that will be included in the OpenACS documentation, in the advanced tutorial section. So I'd use that before I used this.

Hierarchical queries seem like scary things, but they're surprisingly easy with Postgres. If you have a table or view with a parent_id column, this will work:

Examples

        SELECT
        item_id,
        repeat(:indent_pattern, (tree_level(tree_sortkey) - 2)* :indent_factor) as indent,
        project_name
        FROM pm_projectsx 
        ORDER BY tree_sortkey
Here's a simplified definition for this view:
                 View "public.pm_projectsx"
       Column        |           Type           | Modifiers 
---------------------+--------------------------+-----------
 item_id             | integer                  | 
 project_name        | character varying(255)   | 
 tree_sortkey        | bit varying              | 
It looks like that's all you need to make it work. You will need to add the tree_sortkey column to your table, of type bit varying.

Here's a tree_sortkey with a join in it:

        SELECT
        p.item_id,
        repeat(:indent_pattern, (tree_level(p.tree_sortkey) - 5)* :indent_factor) as indent,
        p.parent_id as folder_id,
        p.project_name
        FROM pm_projectsx p, cr_items i
        WHERE p.project_id = i.live_revision
        ORDER BY i.tree_sortkey

And another one, from Don Baccus:

Here's an example, pulling all of the children for a given parent:

  select children.*
  from some_table parent, some_table children
  where children.tree_sorktey between parent.tree_sortkey and tree_right(parent.tree_sortkey)
    and parent.tree_sortkey <> children.tree_sortkey
    and parent.key = :the_parent_key;
This example does not include the parent. To return the entire subtree including the parent, leave out the non-equals clause:
  select subtree.*
  from some_table parent, some_table subtree
  where subtree.tree_sorktey between parent.tree_sortkey and tree_right(parent.tree_sortkey)
    and parent.key = :the_parent_key;
This rather long thread explains how tree_sortkeys work. This paper describes the technique for tree_sortkeys, although the OpenACS implementation has a few differences in the implementation, to make it work for many languages and the LIKE construct in Postgres.

Thanks to Ola, Dan, and Don.

Misc.

Note that you can use the tree_level() function to determine what the level you are at is.

Setting up and administering your website

Created by , last modified by Gustaf Neumann 20 Dec 2008, at 10:56 AM

Notes on OpenACS permissions

Created by , last modified by Gustaf Neumann 20 Dec 2008, at 10:56 AM

Limiting your installation to use SSL

Created by , last modified by Gustaf Neumann 20 Dec 2008, at 10:56 AM

(I think this should be a default for OpenACS, but I think right now it is not)

http://openacs.org/forums/message-view?message_id=99556

Next Page