Jade's weblog

Valid characters in a tcl proc definition

It appears you can include ! and ? in proc names in Tcl. So you can do nice Ruby-like proc names, such as

valid?
proc_with_side_effect!

Interesting.

01:52 PM, 30 Jan 2008 by Jade Rubick Permalink | Comments (0)

Dream Job [docs.google.com]

Looking for an exceptional senior developer. Must like having a dream job.

02:28 PM, 28 Aug 2007 by Jade Rubick Permalink | Comments (0)

Very useful.

11:16 AM, 11 Jan 2007 by Jade Rubick Permalink | Comments (0)

It looks like there is a bug in the configuration script for tDOM 0.8.0 that is revealed by bash 3.1, included with Fedora Core 5.

Fun.

Okay, let's see:

cd
mkdir bash3
cd /usr/local/src
wget http://ftp.gnu.org/gnu/bash/bash-3.0.tar.gz
tar xzf bash-3.0.tar.gz
cd bash-3.0
./configure --prefix=/home/jade/bash3
make install

Wow, wasn't that fun.

Now use /home/jade/bash3/bin/bash instead of the normal bash and it should work.

It didn't.

10:39 AM, 17 Jul 2006 by Jade Rubick Permalink | Comments (0)

Open source icons [openacs.org]

Open source icons

12:17 PM, 09 May 2006 by Jade Rubick Permalink | Comments (0)

OpenACS 5.1.5 to 5.2.2 upgrade experience

Upgrade notes:

Got errors in the upgrade on my staging server, so rebuild the database and did every stinking upgrade script manually. I should note that I do appreciate the work that these developers do, and many of these folks are very good programmers. But I did want to post where the problems occured, and who would be responsible for fixing them.

  • acs-content-repository (author davis@xarg.net) -- harmless because it recreates these foreign key constraints.
    psql -f upgrade-5.2.0d2-5.2.0d3.sql
    psql:upgrade-5.2.0d2-5.2.0d3.sql:4: ERROR: constraint "cr_folder_type_map_fldr_fk" does not exist
    ALTER TABLE
    psql:upgrade-5.2.0d2-5.2.0d3.sql:9: ERROR: constraint "cr_folder_type_map_typ_fk" does not exist
    ALTER TABLE

  • acs-content-repository (author timoh or daveb)
    psql -f upgrade-5.2.0a1-5.2.0a2.sql
    psql:upgrade-5.2.0a1-5.2.0a2.sql:221: ERROR: cannot drop view download_archive_descsi because other objects depend on it
    HINT: Use DROP ... CASCADE to drop the dependent objects too.

    I tried changing the text from create view to create or replace
    view in case that would help. I have no idea if it will.

  • acs-content-repository (author daveb)
    psql -f upgrade-5.2.1d1-5.2.1d2.sql
    psql:upgrade-5.2.1d1-5.2.1d2.sql:930: ERROR: cannot drop view download_archive_descsi because other objects depend on it
    HINT: Use DROP ... CASCADE to drop the dependent objects too.

  • news-aggregator (this package never worked for me anyway, so I dropped it using their drop scripts and rebuilt it. There was a typo in one of the drop scripts.) It seems like this might actually be functional now... cool.

07:23 PM, 01 May 2006 by Jade Rubick Permalink | Comments (0)

An excellent reference.

03:33 PM, 07 Dec 2005 by Jade Rubick Permalink | Comments (0)

Public shame as motivation to work out

I wrote an exercise reminder program, which emails you when you have't worked out in a couple of days. I also placed it on my home page, so that I feel the public pressure to work out.

Anyone is free to sign up. It's free, and I plan to add in a public shame page, which will show how long it's been since you last worked out.

06:44 PM, 22 Jul 2005 by Jade Rubick Permalink | Comments (0)

Helpful.

01:20 PM, 01 Jun 2005 by Jade Rubick Permalink | Comments (0)

I'm flagging this for reading. A PDF version is available.

07:02 PM, 20 Jan 2005 by Jade Rubick Permalink | Comments (0)

Google stops link spamming [www.google.com]

We'll need to update some OpenACS packages to support this.

12:59 AM, 20 Jan 2005 by Jade Rubick Permalink | Comments (0)

Log response times in Aolserver

Dossy turned me on the fact that you can easily log the amount of time each request takes in Aolserver.

I've commited this to oacs-5-1, so it will start appearing in OpenACS soon.

I believe I can use this in conjuction with Analog to produce reports on the amount of time each request takes...

07:53 PM, 18 Jan 2005 by Jade Rubick Permalink | Comments (0)

Problems with Postgres not starting up right

This morning, I received an email from a monitoring service that let me know that one of the sites I am responsible for was not responding.

The message on the server's main page said that the database was down.

So I log into the server, take down Aolserver, and attempt to restart Postgres:

svc -d /service/servername

www:~# /etc/init.d/postgresql restart
Stopping PostgreSQL database server: postmaster/usr/lib/postgresql/bin/pg_ctl: kill: (30083) - No such process
pg_ctl: postmaster does not shut down
.
Starting PostgreSQL database server: postmaster ((null) already running.).

www:~# su - postgres
postgres@www:~$ pg_ctl stop
waiting for postmaster to shut down...2005-01-17 10:26:12 [1548] LOG:  received smart shutdown request
.2005-01-17 10:26:12 [1590] LOG:  shutting down
..2005-01-17 10:26:15 [1590] LOG:  database system is shut down
done
postmaster successfully shut down
postgres@www:~$ exit
logout
www:~# /etc/init.d/postgresql start

01:10 PM, 17 Jan 2005 by Jade Rubick Permalink | Comments (1)

Apparently, you can add in photos to lars-blogger via Flikr.

08:11 AM, 04 Jan 2005 by Jade Rubick Permalink | Comments (0)

Patch to edit-this-page to allow templating code

Index: edit-this-page/templates/article-index.tcl
===================================================================
RCS file: /var/cvs/ibr/packages/edit-this-page/templates/article-index.tcl,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- edit-this-page/templates/article-index.tcl  6 May 2004 23:59:35 -0000       1.1.1.1
+++ edit-this-page/templates/article-index.tcl  8 Apr 2004 18:46:24 -0000       1.2
@@ -20,3 +20,9 @@
 
 etp::get_page_attributes
 etp::get_content_items
+
+# customization as per 
+# http://www.thecodemill.biz/publications/blog/one-entry?entry_id=9879
+# to allow includes, etc.
+eval [template::adp_compile -string $pa(content)]
+set pa(content) ${__adp_output}

06:20 PM, 02 Dec 2004 by Jade Rubick Permalink | Comments (0)

Documents how to set up a production server with Arch.

07:12 PM, 30 Nov 2004 by Jade Rubick Permalink | Comments (0)

How to turn on statistics command on Postgres

12:34 PM, 29 Nov 2004 by Jade Rubick Permalink | Comments (0)

Error while loading shared libraries with Aolserver

If you get an error like this:

/usr/local/aolserver/bin/nsd: error while loading shared libraries: libnsd.so: cannot open shared object file: No such file or directory

Try ldd:

/usr/local/aolserver/bin# ldd nsd
        libnsd.so => not found
        libnsthread.so => not found
        libtcl8.4.so.0 => /usr/lib/libtcl8.4.so.0 (0x40018000)
        libdl.so.2 => /lib/libdl.so.2 (0x400ba000)
        libpthread.so.0 => /lib/libpthread.so.0 (0x400bd000)
        libm.so.6 => /lib/libm.so.6 (0x400d1000)
        libc.so.6 => /lib/libc.so.6 (0x400f2000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)

It looks like the libraries are not being found.

Try this:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/aolserver/lib

Vinod's entry fixes it here:

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

You may need to edit your /usr/local/aolserver/nsd-postgres file to include Aolserver's lib directories.

07:15 PM, 23 Nov 2004 by Jade Rubick Permalink | Comments (0)

Good to file away for later. This was written by Joel.

05:41 PM, 17 Nov 2004 by Jade Rubick Permalink | Comments (0)

How to allow someone to join a mailing list

When people register on an OpenACS site, you can give them the option to join a mailing list:

Index: user-new.tcl
===================================================================
RCS file: /var/cvs/safe4all/packages/acs-subsite/lib/user-new.tcl,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 user-new.tcl
--- user-new.tcl        22 Jun 2004 21:06:53 -0000      1.1.1.2
+++ user-new.tcl        5 Oct 2004 17:41:39 -0000
@@ -39,6 +39,20 @@

ad_form -name register -export {next_url user_id return_url} -form [auth::get_r
egistration_form_elements]

+# safe4all.org extention
+
+set checked_p [list checked ""]
+
+ad_form -extend -name register -form {
+    {join_announce_p:text(checkbox),optional
+        {label "Receive weekly news?"}
+        {help_text "You can opt out at any point, and we do not give out your email address."}
+        {options {{"" "on"}}}
+        {html $checked_p}
+    }
+}
+
+
if { [exists_and_not_null rel_group_id] } {
    ad_form -extend -name register -form {
        {rel_group_id:integer(hidden),optional}
@@ -81,6 +95,21 @@
                                      -secret_question $secret_question \
                                      -secret_answer $secret_answer]

+        # safe4all.org
+
+        if {[string equal $creation_info(creation_status) "ok"]} {
+            if {[string is true $join_announce_p]} {
+                ns_sendmail \
+                    "safe-announce-subscribe@mail.safe4all.org"; \
+                    $email \
+                    "join safe-announce mailing list" \
+                    "I would like to join the SAFE-announce mailing list. Infor\
mation on subscribing and unsubscribing are available at http://www.safe4all.or\
g/forums/forum-view?forum%5fid=13394"
+
+            }
+        }
+
        if { [string equal $creation_info(creation_status) "ok"] && [exists_and
_not_null rel_group_id] } {
            group::add_member \
                -group_id $rel_group_id \

12:01 PM, 16 Nov 2004 by Jade Rubick Permalink | Comments (0)

.

03:23 PM, 10 Nov 2004 by Jade Rubick Permalink | Comments (0)

Problems with hostname on OpenACS site?

[15:10] > what could I have done in my config.tcl file?
[15:10]  *csari* change this line: set hostname                  [ns_info hostname]
[15:10]  *csari* to 'set hostname www.usbakery.com'
[15:10] > ahhh, that makes sense!

05:58 PM, 01 Nov 2004 by Jade Rubick Permalink | Comments (0)

Ruby on Rails video [media.nextangle.com]

Interesting to look at for comparison to the developmental practices of OpenACS. We're getting closer to a vision of something like this, but we're not quite there yet. Matthew's new AMS package allows us to have the plumbing for this sort of thing -- it really finishes some of the form problems OpenACS never resolved. Exciting stuff.

01:49 PM, 28 Oct 2004 by Jade Rubick Permalink | Comments (0)

Randy posted a useful tip for ad_form validation

01:23 PM, 07 Jul 2004 by Jade Rubick Permalink | Comments (0)

.

08:23 PM, 06 Jul 2004 by Jade Rubick Permalink | Comments (0)

Analyzing queries in Postgres [www.databasejournal.com]

Good article on logging and analyzing queries in Postgres, thanks to Jeff.

12:15 PM, 30 Jun 2004 by Jade Rubick Permalink | Comments (0)

The link doesn't actually go to the after-mount callback, but it shows how it's added into the .info file.

11:54 AM, 28 Jun 2004 by Jade Rubick Permalink | Comments (0)

.

01:51 PM, 23 Jun 2004 by Jade Rubick Permalink | Comments (0)

Perl script to rename Postgres user in dump file

perl -pi -e "s/^\\connect olduser$/\\connect newuser/" filename

Thanks, Dave, Dossy, and Til.

To load in the database dump:

psql -f filename dbusername

12:44 PM, 22 Jun 2004 by Jade Rubick Permalink | Comments (0)

I updated my easy virtual hosting document. I finally fixed the most major problem I was having with it.

12:39 PM, 20 Jun 2004 by Jade Rubick Permalink | Comments (0)

Refreshing an ad_form

Ad_form has a facility for allowing you to pull in new values from the database while the form is being edited. This is a really cool feature if you know how to use it.

Basically, all you have to do is:

In the definition of your form, put in an html section

    {pm_task_id:integer(select),optional
        {section "Task"}
        {label "Subject"}
        {options {$task_options}}
        {html 
        {onChange "document.log_entry_form.__refreshing_p.value='1';
submit()"}
        }
        {value $pm_task_id}
    }
} 
In this case, the form is called log_entry_form. When you submit the form, it will show the form again, this time with the value for pm_task_id and the rest of the form set. I then have a section of my form that says:

if {[info exists pm_task_id]} {

extend the form here

}

This can allow you to do things like sub-categories with ad_form.

06:19 PM, 28 May 2004 by Jade Rubick Permalink | Comments (0)

How to deal with includes and URLs

When you have code in a /lib directory, and you want it to be called by any package, you need to make sure any links you return are relative to the package the /lib resides in. Let's say it's in package-A/lib and it's being called from package-B/www/myfile.tcl

Look a lars-blogger/www/blog.adp for a good example of how to deal with this.

05:31 PM, 27 May 2004 by Jade Rubick Permalink | Comments (0)

Using TAGS files with emacs and OpenACS

[11:16] <bartt> You use a TAGS file for that.
[11:16] <bartt> Are you familiar w/ M-. ?
[11:16] > No, not really.
[11:17] <bartt> OK, let me publish some scripts I use to create TAGS files for OpenACS.
[11:17]         jadeforrest cheers :)
[11:17] <bartt> TAGS files are one of the best things about Emacs and VIM
[11:17] <SchemaThings> tks bartt!
[11:17] <SchemaThings> totally
[11:18] <SchemaThings> the toolmaster 9000
[11:18]         bartt setting up a ~/bin GNU Arch achive
[11:19] > I can't believe I was living without oacs.el before :)
[11:44] <bartt> OK, for those with tla, you can get otags & otags-site using:
[11:45] <bartt> tla get -A bart-arch@thecodemill.biz--2004 bin--main--0 bin
[11:45] <bartt> Do this in your ~ and then add ~/bin to your PATH.
[11:45]         bartt making a tar file of this archive.
[11:47] <bartt> You can download the tar file from: http://www.thecodemill.biz/repository/otags.tgz
[11:47] <bartt> Extract in ~ (creates ./bin)
[11:48] <bartt> Then run otags-site <path to your OpenACS server root>
[11:48] <bartt> E.g. otags-site /web/openacs-4
[11:48] <bartt> This will create 2 files in each package directory: TAGS and TAGS-TCL
[11:49] <bartt> Plus a master set of TAGS and TAGS-TCL files in server root.
[11:49] hazmat [~hazmat@pool-68-162-33-2.nwrk.east.verizon.net] has joined #openacs
[11:51] <bartt> TAGS contains tags of all TCL procedure definitions, XQL query definitions and all SQL package bodies.
[11:52] <bartt> TAGS-TCL contains tags of all TCL procedure definitions and XQL query definitions but not the SQL package bodies.
[11:52] <bartt> otags-site calls otags
[11:52] <bartt> otags is configured to index Oracle XQL files.
[11:53] <bartt> Change the regexp in otags to index PostgreSQL XQL files instead.
[11:53] <bartt> Re-running otags-site will update the TAGS and TAGS-TCL files.
[11:53] <bartt> To use these files press M-. in Emacs
[11:54] <bartt> Upon first use Emacs will ask for a TAGS file.
[11:54] <bartt> If you want to search the entire site you point it to the master TAGS file. E.g. /web/openacs-4/TAGS
[11:55] <bartt> If you want to limit your search to a single package point it to the package TAGS file. E.g. /web/openacs-4/packages/acs-tcl/TAGS
[11:55] <bartt> If you want to limit your search to on the TCL and XQL files of a single package point it to the package TAGS-TCL file. E.g. /web/openacs-4/packages/acs-tcl/TAGS-TCL
[11:55] <bartt> Let me know if you have any questions.
[11:57] <bartt> You can switch TAGS files in an Emacs session w/ M-x tags-reset-tags-table
[11:57] > Is this documented anywhere, or should I copy and paste from this session so I don't forget?
[11:57] <bartt> I haven't documented this. Most of it is documented in Emacs though.
[11:58]         bartt Reminds himself to write another article
[11:59] <bartt> C-h i
[11:59] <bartt> m emacs
[11:59] <bartt> m tags
[11:59] <bartt> Will get you to the tags documentation in Emacs
[11:59] <SchemaThings> tags is a standard feature of either editor if you can tag the body of stuff you're working with
[12:00] <SchemaThings> so the bartt tag generator is the custom code / technique here
[12:00] <dirkgomez> lars uses them in a very interesting way
[12:00] <SchemaThings> how so?
[12:01] <bartt> Also very useful: M-x tag-search and M-x tags-query-replace
[12:01] <bartt> Followed by M-,

01:52 PM, 11 May 2004 by Jade Rubick Permalink | Comments (0)

Use ad_url

Jeff pointed out I can say:

ad_url

instead of...

parameter::get_from_package_key -package_key acs-kernel -parameter SystemURL

Thanks, Jeff!

05:22 PM, 10 May 2004 by Jade Rubick Permalink | Comments (0)

Updated my site to OpenACS 5.04

Woohoo! :)

11:55 PM, 04 May 2004 by Jade Rubick Permalink | Comments (0)

I posted a script I used.

07:26 AM, 03 May 2004 by Jade Rubick Permalink | Comments (0)

Richard Hamilton called my project-manager package for OpenACS, a work of art! Wow, thanks, Richard!

I think it still needs a lot of work!

12:38 PM, 29 Apr 2004 by Jade Rubick Permalink | Comments (0)

Interesting proc.

05:41 PM, 23 Apr 2004 by Jade Rubick Permalink | Comments (0)

Using richtext

In OpenACS, if you have context and the mime_type, you can get the HTML to display as follows:

set richtext_list [list $description $mime_type]

set description [template::util::richtext::get_property html_value $richtext_list]

01:31 PM, 23 Apr 2004 by Jade Rubick Permalink | Comments (0)

Are you well socialized?

I've noticed a pattern recently in people who don't seem very well socialized:

* they don't ask questions about the person they're talking with.

They either talk about themselves, or they don't talk much at all.

08:05 PM, 31 Mar 2004 by Jade Rubick Permalink | Comments (0)

XML