Re: [CODE4LIB] Whatbird Interface Framework

2007-12-18 Thread Ewout Van Troostenberghe
Hi,

Since Django is are already in the Python space, you might consider
using Zope as a storage backend and application server. Zope provides an
object database which is easier to work with than object-relational
mapping. It will probably speed up your development time and allow you
to focus on what really matters, the domain, instead of the technical details.

Regards,
Ewout

Hey all,

I'm considering trying to create a framework\tool to allow people to
create a whatbird.com like interface for other types of datasets
(plants, trees, anything really).

The idea is to create a framework allowing users to create a discovery
tool with attribute selections to narrow down the result set. So, for
example, our faculty/students would identify attributes found in all
trees (leaf shape, fruit, bark, form, etc.) and then input this data
into the tool which would then allow them to input actual trees and
associate them with the attributes (as well as input description info,
pictures, etc.). The end result would look something like whatbird.com
does with birds.

This will be a challenge for me (but a good one). My thought is to use a
web framework like Django (picked because I know it a little) but am
unsure if you can have it organize the database tables with the
relationships properly. I considered using solr but thought it would be
overkill considering the relatively small datasets this tool would be
used to create (under 1000 objects) but in the end it might be a good
bet. If approved (I have to talk to the dean of our forestry department
to see if he will buy into the idea) I will try and create the bulk of
it during January and tweak it the rest of the semester.

Anyone interesting in working on this type of project with me?

Mike Beccaria
Systems Librarian
Head of Digital Initiatives
Paul Smith's College
518.327.6376
[EMAIL PROTECTED]


Re: [CODE4LIB] httpRequest javascript.... grrr

2007-11-29 Thread Ewout Van Troostenberghe
To point out why the use of a Javascript framework is important, let me
put your code into jQuery (http://jquery.com)

$.get('index.cgi', {cmd:'add_tag', username:'username'}, function(html) {
  // do whatever you want here
})

PrototypeJS has a similar, easy to use construct. In the end, using any
framework is more important than the specific choice of framework.

Why doesn't my httpRequest Javascript function return unless I add an
alert? Grrr.

I am writing my first AJAX-y function called add_tag. This is how it
is suppose to work:

   1. define a username
   2. create an httpRequest object
   3. define what it is suppose to happen when it gets a response
   4. open a connection to the server
   5. send the request

When the response it is complete is simply echos the username. I know
the remote CGI script works because the following URL works correctly:

   http://mylibrary.library.nd.edu/demos/tagging/?
cmd=add_tagusername=fkilgour

My Javascript is below, and it works IF I retain the alert
( 'Grrr!' ) line. Once I take the alert out of the picture I get a
Javascript error xmldoc has no properties. Here's my code:


   function add_tag() {

// define username
var username  = 'fkilgour';

// create an httpRequest
var httpRequest;
if ( window.XMLHttpRequest ) { httpRequest = new XMLHttpRequest(); }
else if ( window.ActiveXObject ) { httpRequest = new ActiveXObject
( Microsoft.XMLHTTP ); }

// give the httpRequest some characteristics and send it off
httpRequest.onreadystatechange = function() {

 if ( httpRequest.readyState == 4 ) {

  var xmldoc = httpRequest.responseXML;
  var root_node = xmldoc.getElementsByTagName( 'root' ).item( 0 );
  alert ( root_node.firstChild.data );

 }

};

httpRequest.open( 'GET', './index.cgi?cmd=add_tagusername=' +
username, true );
httpRequest.send( '' );
alert ( 'Grrr!' );

   }


What am I doing wrong? Why do I seem to need a pause at the end of my
add_tag function? I know the anonymous function -- function() -- is
getting executed because I can insert other httpRequest.readyState
checks into the function and they return. Grrr.

--
Eric Lease Morgan
University Libraries of Notre Dame

(574) 631-8604