<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
    <title>Jeff Silvis&apos;s Blog</title>
    <link rel="alternate" type="text/html" href="http://blog.lib.umn.edu/silvi003/codenotes/" />
    <link rel="self" type="application/atom+xml" href="http://blog.lib.umn.edu/silvi003/codenotes/atom.xml" />
   <id>tag:blog.lib.umn.edu,2009:/silvi003/codenotes//6716</id>
    <link rel="service.post" type="application/atom+xml" href="http://blog.lib.umn.edu/cgi-bin/mt-atom.cgi/weblog/blog_id=6716" title="Jeff Silvis's Blog" />
    <updated>2009-11-17T22:04:31Z</updated>
    <subtitle></subtitle>
    <generator uri="http://www.sixapart.com/movabletype/">Movable Type 4.25</generator>
 

<entry>
    <title>Problem getting to localhost website on my Mac after snow lepord</title>
    <link rel="alternate" type="text/html" href="http://blog.lib.umn.edu/silvi003/codenotes/2009/11/problem_getting_to_localhost_w.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://blog.lib.umn.edu/cgi-bin/mt-atom.cgi/weblog/blog_id=6716/entry_id=205365" title="Problem getting to localhost website on my Mac after snow lepord" />
    <id>tag:blog.lib.umn.edu,2009:/silvi003/codenotes//6716.205365</id>
    
    <published>2009-11-17T22:04:30Z</published>
    <updated>2009-11-17T22:04:31Z</updated>
    
    <summary>I got a 403 when trying to reach localhost: Solution from: techtrouts.com Mac OS X 10.5: Web Sharing – “Forbidden 403″ on http://localhost/~username If, usually after installing/upgrading your mac, you can’t access your ~/Sites folder on your browser ( http://localhost/~username...</summary>
    <author>
        <name>Jeffrey Silvis</name>
        <uri></uri>
    </author>
    
        <category term="HowTo" />
    
    <content type="html" xml:lang="en" xml:base="http://blog.lib.umn.edu/silvi003/codenotes/">
        <![CDATA[I got a 403 when trying to reach localhost:
Solution from: 
<a href="http://techtrouts.com/mac-os-x-105-web-sharing-forbidden-403-on-httplocalhostusername/"> techtrouts.com</a>

<br>
Mac OS X 10.5: Web Sharing – “Forbidden 403″ on http://localhost/~username<br>

If, usually after installing/upgrading your mac, you can’t access your ~/Sites folder on your browser <br>( http://localhost/~username , where username is your mac username):<br>

    * Open a Terminal and $ sudo nano /private/etc/apache2/httpd.conf ;<br>
    * ctrl+w (where is) : <xmp> “<Directory />” </xmp> ;<br>
    * Alter the line below from “Deny from all” to “Allow from all“;<br>
    * ctrl+x and y to save;<br>
    * now $ sudo httpd -k restart to restart your Apache 2 server;<br>
<br>
<br>

Then I got the error: <br>
httpd: Syntax error on line 459 of /private/etc/apache2/httpd.conf: Syntax error on line 15 of /private/etc/apache2/extra/httpd-userdir.conf: Syntax error on line 8 of /private/etc/apache2/users/+entropy-php.conf: Cannot load /usr/local/php5/libphp5.so into server: dlopen(/usr/local/php5/libphp5.so, 10): no suitable image found.  Did find:\n\t/usr/local/php5/libphp5.so: no matching architecture in universal wrapper<br>

Fixed this by changing : <br>
LoadModule php5_module        /usr/local/php5/libphp5.so <br>
to <br>
LoadModule php5_module        libexec/apache2/libphp5.so <br>
in <br>
/private/etc/apache2/users/+entropy-php.conf

]]>
        
    </content>
</entry>

<entry>
    <title>Reaching the Fedora Repository from a remote box ... localhost issue</title>
    <link rel="alternate" type="text/html" href="http://blog.lib.umn.edu/silvi003/codenotes/2009/11/reaching_the_fedora_repository.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://blog.lib.umn.edu/cgi-bin/mt-atom.cgi/weblog/blog_id=6716/entry_id=205349" title="Reaching the Fedora Repository from a remote box ... localhost issue" />
    <id>tag:blog.lib.umn.edu,2009:/silvi003/codenotes//6716.205349</id>
    
    <published>2009-11-17T21:01:56Z</published>
    <updated>2009-11-17T21:01:57Z</updated>
    
    <summary>I was trying to contact a fedora box from a remote box and I had the problem that when I hit links within Fedora, the word &quot;localhost&quot; kept appearing in the URL. This resolved to a &quot;404&quot; because Fedora is...</summary>
    <author>
        <name>Jeffrey Silvis</name>
        <uri></uri>
    </author>
    
        <category term="fedora" />
    
    <content type="html" xml:lang="en" xml:base="http://blog.lib.umn.edu/silvi003/codenotes/">
        <![CDATA[I was trying to contact a fedora box from a remote box and I had the problem that when I hit links within Fedora, the word "localhost" kept appearing in the URL.  This resolved to a "404" because Fedora is not on my box.  I fixed this by editing: <br>

$FEDORA_HOME/server/config/fedora.fcfg
and changing the line:
<xmp>
<param name="fedoraServerHost" value="localhost">
</xmp>

In the line above, I replaced the word "localhost" with the actual IP address.
]]>
        
    </content>
</entry>

<entry>
    <title>Turning XACML  ON and OFF in Fedora </title>
    <link rel="alternate" type="text/html" href="http://blog.lib.umn.edu/silvi003/codenotes/2009/11/turning_xacml_on_and_off_in_fe.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://blog.lib.umn.edu/cgi-bin/mt-atom.cgi/weblog/blog_id=6716/entry_id=204139" title="Turning XACML  ON and OFF in Fedora " />
    <id>tag:blog.lib.umn.edu,2009:/silvi003/codenotes//6716.204139</id>
    
    <published>2009-11-13T16:40:13Z</published>
    <updated>2009-11-13T16:40:15Z</updated>
    
    <summary>2.1 Enabling/Disabling XACML Policy Enforcement To enable/disable XACML policy enforcement in Fedora, use the Fedora configuration file (fedora.fcfg). Whether Fedora uses XACML for authorization decisions is controlled by the ENFORCE-MODE parameter in the Authorization module: The ENFORCE-MODE parameter can contain...</summary>
    <author>
        <name>Jeffrey Silvis</name>
        <uri></uri>
    </author>
    
        <category term="fedora" />
    
    <content type="html" xml:lang="en" xml:base="http://blog.lib.umn.edu/silvi003/codenotes/">
        <![CDATA[2.1 Enabling/Disabling XACML Policy Enforcement

To enable/disable XACML policy enforcement in Fedora, use the Fedora configuration file (fedora.fcfg). Whether Fedora uses XACML for authorization decisions is controlled by the ENFORCE-MODE parameter in the Authorization module:

<xmp>
<param name="ENFORCE-MODE" value="enforce-policies"/>
</xmp>
The ENFORCE-MODE parameter can contain one of three values, with the following meanings:

   1. enforce-policies – enable XACML enforcement to determine whether a request is permitted or denied <br>
   2. permit-all-requests – disable XACML enforcement; PERMIT every request by default<br>
   3. deny-all-requests – disable XACML enforcement; DENY every request by default<br>

The enforce-policies setting is used to enable the enforcement of XACML policies, and is the default setting for a Fedora repository. The permit-all-requests setting can facilitate testing code independent of security. The deny-all-requests setting can be used to quickly shut down access to the server, but requires a server restart to affect this.

Tomcat container security is, of course, still a first barrier to authentication/authorization (i.e., Fedora's Tomcat web.xml specifies access protection earlier than XACML. Tomcat container security is always in place regardless of the setting for parameter ENFORCE-MODE.


see <a href="http://fedoracommons.org/confluence/display/FCR30/Fedora+Authorization+with+XACML+Policy+Enforcement">Fedora Commons on XACML</a>]]>
        
    </content>
</entry>

<entry>
    <title>DC Metadata fields used by UMN DSPACE instances:</title>
    <link rel="alternate" type="text/html" href="http://blog.lib.umn.edu/silvi003/codenotes/2009/11/dc_metadata_fields_used_by_umn.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://blog.lib.umn.edu/cgi-bin/mt-atom.cgi/weblog/blog_id=6716/entry_id=201784" title="DC Metadata fields used by UMN DSPACE instances:" />
    <id>tag:blog.lib.umn.edu,2009:/silvi003/codenotes//6716.201784</id>
    
    <published>2009-11-03T21:53:58Z</published>
    <updated>2009-11-03T21:53:59Z</updated>
    
    <summary>dc.title dc.title.alternative dc.contributor.author dc.contributor.editor dc.subject dc.subject.other dc.date.issued dc.identifier.citation dc.relation.ispartofseries dc.description.abstract dc.description dc.identifier.govdoc dc.identifier.uri dc.identifier.isbn dc.identifier.issn dc.identifier.ismn dc.identifier dc.relation dc.format.extent dc.language dc.extent...</summary>
    <author>
        <name>Jeffrey Silvis</name>
        <uri></uri>
    </author>
    
        <category term="dspace" />
    
    <content type="html" xml:lang="en" xml:base="http://blog.lib.umn.edu/silvi003/codenotes/">
        <![CDATA[dc.title <br>
dc.title.alternative  <br>
dc.contributor.author  <br>
dc.contributor.editor  <br>
dc.subject  <br>
dc.subject.other  <br>
dc.date.issued  <br>
dc.identifier.citation  <br>
dc.relation.ispartofseries  <br>
dc.description.abstract  <br>
dc.description  <br>
dc.identifier.govdoc  <br>
dc.identifier.uri  <br>
dc.identifier.isbn  <br>
dc.identifier.issn  <br>
dc.identifier.ismn  <br>
dc.identifier  <br>
dc.relation  <br>
dc.format.extent  <br>
dc.language  <br>
dc.extent <br>]]>
        
    </content>
</entry>

<entry>
    <title>Last step in getting perl drivers for Postgres</title>
    <link rel="alternate" type="text/html" href="http://blog.lib.umn.edu/silvi003/codenotes/2009/10/last_step_in_getting_perl_driv.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://blog.lib.umn.edu/cgi-bin/mt-atom.cgi/weblog/blog_id=6716/entry_id=200438" title="Last step in getting perl drivers for Postgres" />
    <id>tag:blog.lib.umn.edu,2009:/silvi003/codenotes//6716.200438</id>
    
    <published>2009-10-28T21:29:45Z</published>
    <updated>2009-11-03T21:51:53Z</updated>
    
    <summary>While trying to install new DBD::Pg drivers on mac os x Snow Leopard I got the error below, when running test code: dyld: lazy symbol binding failed: Symbol not found: _PQconnectdb Referenced from: /opt/local/lib/perl5/site_perl/5.10.1/darwin-2level/auto/DBD/Pg/Pg.bundle Expected in: dynamic lookup I found...</summary>
    <author>
        <name>Jeffrey Silvis</name>
        <uri></uri>
    </author>
    
    <content type="html" xml:lang="en" xml:base="http://blog.lib.umn.edu/silvi003/codenotes/">
        <![CDATA[While trying to install new DBD::Pg drivers on mac os x Snow Leopard I got the error below, when running test code: <br> 

<xmp>
dyld: lazy symbol binding failed: Symbol not found: _PQconnectdb
  Referenced from: /opt/local/lib/perl5/site_perl/5.10.1/darwin-2level/auto/DBD/Pg/Pg.bundle
  Expected in: dynamic lookup
</xmp>

I found that the Makefile.PL that cpan made for DBD::Pg was pointed at the wrong directories for libraries.  I made the changes below to   Makefile.PL (located in ~/.cpan/build/XML-DOM-1.44-tM9lK0): <br>

<xmp>
#$POSTGRES_INCLUDE = $ENV{POSTGRES_INCLUDE} || $pg->inc_dir || "$ENV{POSTGRES_HOME}/include";
$POSTGRES_INCLUDE = '/opt/local/include/postgresql83';

#$POSTGRES_LIB = $ENV{POSTGRES_LIB} || $pg->lib_dir || "$ENV{POSTGRES_HOME}/lib";
$POSTGRES_LIB = '/opt/local/lib/postgresql83';
</xmp>
  
Then <br>

  sudo perl Makefile.PL <br>
  sudo make test<br>
  sudo make install<br>
<br>
And the error was gone.<br>
<br>
Also I had to switch <br>
<xmp>
#!/opt/local/bin/perl
# /usr/bin/perl
</xmp>



]]>
        
    </content>
</entry>

<entry>
    <title>utf-8 utf-16 and UNIX </title>
    <link rel="alternate" type="text/html" href="http://blog.lib.umn.edu/silvi003/codenotes/2009/10/utf-8_utf-16_and_unix.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://blog.lib.umn.edu/cgi-bin/mt-atom.cgi/weblog/blog_id=6716/entry_id=199092" title="utf-8 utf-16 and UNIX " />
    <id>tag:blog.lib.umn.edu,2009:/silvi003/codenotes//6716.199092</id>
    
    <published>2009-10-21T19:55:12Z</published>
    <updated>2009-10-21T19:55:14Z</updated>
    
    <summary>1) Convert utf-16 to utf-8. iconv -f utf-16 -t utf-8 bell-map-IMAGESspreadsheet.xml &gt; tt 2) Have less read utf-8 export LESSCHARSET=&apos;utf-8&apos; cat just works....</summary>
    <author>
        <name>Jeffrey Silvis</name>
        <uri></uri>
    </author>
    
        <category term="HowTo" />
    
    <content type="html" xml:lang="en" xml:base="http://blog.lib.umn.edu/silvi003/codenotes/">
        <![CDATA[1) Convert  utf-16 to utf-8.  <br>
iconv -f utf-16  -t utf-8 bell-map-IMAGESspreadsheet.xml  > tt <br>

2) Have less read utf-8 <br>
export LESSCHARSET='utf-8' <br>
cat just works. <br>




]]>
        
    </content>
</entry>

<entry>
    <title>Some useful drupal sql</title>
    <link rel="alternate" type="text/html" href="http://blog.lib.umn.edu/silvi003/codenotes/2009/10/some_useful_drupal_sql.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://blog.lib.umn.edu/cgi-bin/mt-atom.cgi/weblog/blog_id=6716/entry_id=196171" title="Some useful drupal sql" />
    <id>tag:blog.lib.umn.edu,2009:/silvi003/codenotes//6716.196171</id>
    
    <published>2009-10-06T17:44:13Z</published>
    <updated>2009-11-05T20:21:48Z</updated>
    
    <summary>Find uid given user naa (in this case naa) select uid from users where name=&apos;naa&apos;; Get the number of uploads by user &apos;naa&apos; select count(upload.fid) from upload, node where node.nid=upload.nid and node.uid=(select uid from users where name=&apos;naa&apos;); Get the number...</summary>
    <author>
        <name>Jeffrey Silvis</name>
        <uri></uri>
    </author>
    
        <category term="HowTo" />
    
    <content type="html" xml:lang="en" xml:base="http://blog.lib.umn.edu/silvi003/codenotes/">
        <![CDATA[<h3>Find uid given user naa (in this case naa)</h3>
select uid from users where name='naa';

<h3>Get the number of uploads by user 'naa' </h3>
select count(upload.fid) from upload, node  where node.nid=upload.nid and node.uid=(select uid from users where name='naa'); 

<h3>Get the number of files owned by user 'naa' </h3>
select files.filepath from files, upload  where upload.fid=files.fid and upload.nid=68652; 

<h3>Find path to uploaded files</h3>

select files.filepath from files, upload  where upload.fid=files.fid and upload.nid=68652; ]]>
        
    </content>
</entry>

<entry>
    <title>title element wrong for media ingest</title>
    <link rel="alternate" type="text/html" href="http://blog.lib.umn.edu/silvi003/codenotes/2009/10/title_element_wrong_for_media.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://blog.lib.umn.edu/cgi-bin/mt-atom.cgi/weblog/blog_id=6716/entry_id=196168" title="title element wrong for media ingest" />
    <id>tag:blog.lib.umn.edu,2009:/silvi003/codenotes//6716.196168</id>
    
    <published>2009-10-06T17:21:58Z</published>
    <updated>2009-10-07T15:49:04Z</updated>
    
    <summary>The IMAGES xml files used to ingest data into the the media repository contain a flaw. Bad version (current): Good: Duplex House Residence project Exterior perspective Effected files: bln-dcugranting2007.xml botanical-dcugranting2007.xml cbi-dcugranting2007.xml ellis-dcugranting2007.xml mno-dcugranting2007.xml mss-alexanderBros.xml mss-dcugranting2007.xml Some more files (all the...</summary>
    <author>
        <name>Jeffrey Silvis</name>
        <uri></uri>
    </author>
    
        <category term="fedora" />
    
    <content type="html" xml:lang="en" xml:base="http://blog.lib.umn.edu/silvi003/codenotes/">
        <![CDATA[The IMAGES xml files used to ingest data into the  the media repository contain a flaw. <br>

Bad version (current):
<xmp>
 <title main="Duplex House" variant="Residence project" variant="Exterior presepctive"/>
</xmp>
Good:
<xmp>
<title type="main" > Duplex House </title>
<title type="variant" > Residence project </title>
<title type="variant" > Exterior perspective </title>
</xmp>

Effected files:

bln-dcugranting2007.xml <br>
botanical-dcugranting2007.xml<br>
cbi-dcugranting2007.xml<br>
ellis-dcugranting2007.xml<br>
mno-dcugranting2007.xml<br>
mss-alexanderBros.xml<br>
mss-dcugranting2007.xml<br>

 <br>

Some more files (all the rest): <br>
<br>s
001-bell-historicalmaps <br>
005-ymca-wwiPhotos <br>
006-map-19thCent <br>
008-eas-ming <br>
011-mss-purcellMasonite <br>]]>
        
    </content>
</entry>

<entry>
    <title>David  Naughton gave me some fast perl code for hashes</title>
    <link rel="alternate" type="text/html" href="http://blog.lib.umn.edu/silvi003/codenotes/2009/09/david_naughton_gave_me_some_fa.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://blog.lib.umn.edu/cgi-bin/mt-atom.cgi/weblog/blog_id=6716/entry_id=191646" title="David  Naughton gave me some fast perl code for hashes" />
    <id>tag:blog.lib.umn.edu,2009:/silvi003/codenotes//6716.191646</id>
    
    <published>2009-09-17T15:47:51Z</published>
    <updated>2009-09-17T15:48:08Z</updated>
    
    <summary> #!/exlibris/sfx_ver/sfx_version_3/app/perl-5.8.6/bin/per use strict; use warnings; # Takes export file from SFX and generates host definitions to append to # the ezproxy.cfg file. # Open SFX export file for manipulation my $sfx_url_file = shift @ARGV; open (my $fh_sfx, &apos;) {...</summary>
    <author>
        <name>Jeffrey Silvis</name>
        <uri></uri>
    </author>
    
        <category term="HowTo" />
    
    <content type="html" xml:lang="en" xml:base="http://blog.lib.umn.edu/silvi003/codenotes/">
        <![CDATA[

<xmp>
#!/exlibris/sfx_ver/sfx_version_3/app/perl-5.8.6/bin/per
use strict;
use warnings;
# Takes export file from SFX and generates host definitions to append to
# the ezproxy.cfg file.
# Open SFX export file for manipulation
my $sfx_url_file = shift @ARGV;
open (my $fh_sfx, '<', $sfx_url_file) or die "File Open Failed: $!";
# get hostnames into a hash
my %hostnames;
while (<$fh_sfx>) {
   my $line = $_;
   next if $line =~ /^#/;
   my ($sfx_target, $sfx_url) = split /\t/, $line;
   if ($sfx_url =~ m/\:\/\/(.*?)\//) {
       # Hash keys are always unique, so if a key for $1
       # already exists, this line will clobber its value:
       $hostnames{$1} = undef;
       # If you want to keep track of how many times each
       # hostname appears, you can use this magic:
       # $hostnames{$1}++;
       # More verbose version of the code above:
       # if (!(exists $hostnames{$1})) {
       #     $hostnames{$1} = 0;
       # }
       # $hostnames{$1} = $hostnames{$1} + 1;
   }
}
# print each unique hash key, with some added text
for my $hostname (keys %hostnames) 
{
   print "HJ $hostname\n";
}
# close file handle
close $fh_sfx or die "File Close Failed: $!";
</xmp>]]>
        
    </content>
</entry>

<entry>
    <title>dspace batch ingest</title>
    <link rel="alternate" type="text/html" href="http://blog.lib.umn.edu/silvi003/codenotes/2009/09/dspace_batch_ingest.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://blog.lib.umn.edu/cgi-bin/mt-atom.cgi/weblog/blog_id=6716/entry_id=191258" title="dspace batch ingest" />
    <id>tag:blog.lib.umn.edu,2009:/silvi003/codenotes//6716.191258</id>
    
    <published>2009-09-15T20:38:02Z</published>
    <updated>2009-09-15T20:42:10Z</updated>
    
    <summary>Format of files to ingest Here is a breakdown of the files : batch_files - top level directory (name does not matter)        I    Ingest1   - This a prototype for the directories that you will create....</summary>
    <author>
        <name>Jeffrey Silvis</name>
        <uri></uri>
    </author>
    
        <category term="dspace" />
    
    <content type="html" xml:lang="en" xml:base="http://blog.lib.umn.edu/silvi003/codenotes/">
        <![CDATA[<h3>Format of files to ingest</h3>
Here is a breakdown of the files :

batch_files - top level directory (name does not matter) <br>
       I <br>
   Ingest1   - This a prototype for the directories that you will create.  Give these directories any name you want <br>
            I<br>
         contents                                            -    contains  the asset name.  The fields are separated by a single tab.  File must  be called "contents" <br>
        dublin_core.xml                                - contains the DC metadata.  This file must be called "dublin_core.xml"  <br>
        UDCsubmissionguidelines.pdf     - This is the asset.  You may use whatever name you want.  However the name of the <br>
                                                                       asset must appear in the "contents" file. <br>
 <br>
<a href="http://blog.lib.umn.edu/silvi003/codenotes//batch_files.tar.gz" title="batch_files.tar.gz">tarball</a> that gives working sample of the directory structure.


<h3>command</h3>

/dspace/dspace-ir/bin$ ./dsrun org.dspace.app.itemimport.ItemImport -a -c CollectionHandle -e Eperson -s /PATH_TO_BATCH_FILES/batch_files -m /home//PATH_TO_BATCH_FILESs/Ingest1/mapfile.txt


<h3>Resources</h3>
<a href="http://cavlec.yarinareth.net/2008/01/07/the-dspace-batch-importer/">Dorothea Salo's EXCELLENT blog</a><br>
<a href="http://blog.lib.umn.edu/silvi003/codenotes//ingest-export.ppt" title="ingest-export.ppt">ingest-export.ppt ARD Prasad</a><br>

<a href="http://wiki.dspace.org/index.php/ScalabilityIssues" title="ingest-export.ppt">ScalabilityIssues - DSpace Wikis</a>]]>
        
    </content>
</entry>

<entry>
    <title>putting captchas into dspace using jcaptcha</title>
    <link rel="alternate" type="text/html" href="http://blog.lib.umn.edu/silvi003/codenotes/2009/09/putting_captchas_into_dspace_u.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://blog.lib.umn.edu/cgi-bin/mt-atom.cgi/weblog/blog_id=6716/entry_id=191010" title="putting captchas into dspace using jcaptcha" />
    <id>tag:blog.lib.umn.edu,2009:/silvi003/codenotes//6716.191010</id>
    
    <published>2009-09-14T21:26:10Z</published>
    <updated>2009-09-15T20:46:51Z</updated>
    
    <summary>ingest-export.pptcode needed for a captcha The file form.jsp had to be modified so that if the captcha was not set or was not correct the form for the email form was not produced. If the email form was not called...</summary>
    <author>
        <name>Jeffrey Silvis</name>
        <uri></uri>
    </author>
    
        <category term="dspace" />
    
    <content type="html" xml:lang="en" xml:base="http://blog.lib.umn.edu/silvi003/codenotes/">
        <![CDATA[<a href="http://blog.lib.umn.edu/silvi003/codenotes//ingest-export.ppt" title="ingest-export.ppt">ingest-export.ppt</a><h3>code needed for a captcha</h3>
The file <a href="http://blog.lib.umn.edu/silvi003/codenotes//form.jsp" title="form.jsp">form.jsp</a>
had to be modified so that if the captcha was not set or was not correct the form for the email form was not produced. <br>
If the email form was not called then a jsp was called that produced the captcha:
<a href="http://blog.lib.umn.edu/silvi003/codenotes//captcha_main.jsp" title="captcha_main.jsp">captcha_main.jsp</a> The jsp captcha_main.jsp called in order the following java classes to make the captcha image:<br>


<a href="http://blog.lib.umn.edu/silvi003/codenotes//ImageCaptchaServlet.java" title="ImageCaptchaServlet.java">ImageCaptchaServlet.java</a> <br>


<a href="http://blog.lib.umn.edu/silvi003/codenotes//CaptchaServiceSingleton.java" title="CaptchaServiceSingleton.java">CaptchaServiceSingleton.java</a><br>

<a href="http://blog.lib.umn.edu/silvi003/codenotes//MyImageCaptchaEngine.java" title="MyImageCaptchaEngine.java">MyImageCaptchaEngine.java</a><br>


Also the file <a href="http://blog.lib.umn.edu/silvi003/codenotes//dspace-web.xml" title="dspace-web.xml">dspace-web.xml</a> had to be modified. <br>
<h3>X11 not on the box where tomcat runs</h3>
If X11 is not the box with tomcat, you will get an error like "port 6000 not available".  To fix this put: <br>
<br>
-Djava.awt.headless=true<br>
<br>
into the catalina.sh file.

<h3>Helpful links</h3>
<a href="http://www.java-tips.org/java-ee-tips/javaserver-pages/how-to-use-jsp-forward-tag-2.html">How to use jsp-forward tag</a><br>
<a href="http://www.jguru.com/faq/view.jsp?EID=376">How do I perform browser redirection from a JSP pages</a><br>
<a href="http://www.cs.sfu.ca/~mori/research/gimpy/">Breaking a Visual CAPTCHA</a><br>
]]>
        
    </content>
</entry>

<entry>
    <title>Error in DSPACE search ... handles from index not having items</title>
    <link rel="alternate" type="text/html" href="http://blog.lib.umn.edu/silvi003/codenotes/2009/08/error_in_dspace_search_handles.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://blog.lib.umn.edu/cgi-bin/mt-atom.cgi/weblog/blog_id=6716/entry_id=189208" title="Error in DSPACE search ... handles from index not having items" />
    <id>tag:blog.lib.umn.edu,2009:/silvi003/codenotes//6716.189208</id>
    
    <published>2009-08-31T14:53:21Z</published>
    <updated>2009-09-01T16:10:52Z</updated>
    
    <summary>Symptom Hi, I was checking abstracts for Volume 41 No. 2 of Journal of Agricultural and Applied Economics. When I searched on &quot;Race, Gender, School . . .&quot; I got an error message saying that the website had experienced an...</summary>
    <author>
        <name>Jeffrey Silvis</name>
        <uri></uri>
    </author>
    
        <category term="dspace" />
    
    <content type="html" xml:lang="en" xml:base="http://blog.lib.umn.edu/silvi003/codenotes/">
        <![CDATA[<h3>Symptom</h3>
<xmp>
Hi,
I was checking abstracts for Volume 41 No. 2 of Journal of Agricultural and Applied Economics. When I searched on "Race, Gender, School . . ." I got an error message saying that the website had experienced an internal error and I tried it again w/ the same results. Since the same message requested letting you know of the problem I am responding.
Sincerely,

</xmp>
<h3>Error Message </h3>
Trying the search above generated the error message:
<xmp>
An internal server error occurred on http://ageconsearch.umn.edu:

Date:       8/28/09 10:59 AM
Session ID: 6AAEA1B2D8AADD0C7F1BE28731AE9083

-- URL Was: http://ageconsearch.umn.edu/simple-search?sort=date&query=%28%28keyword%3Arace%29%29&from_advanced=true&query2=&field1=keyword&conjunction2=AND&query1=race+&field2=keyword&query3=&conjunction1=AND&field3=ANY&SortDirection=descending
-- Method: GET
-- Parameters were:
-- field3: "ANY"
-- field2: "keyword"
-- field1: "keyword"
-- sort: "date"
-- query3: ""
-- query2: ""
-- SortDirection: "descending"
-- query1: "race "
-- query: "((keyword:race))"
-- from_advanced: "true"
-- conjunction2: "AND"
-- conjunction1: "AND"


Exception:
java.sql.SQLException: Query "((keyword:race))" returned unresolvable handle: 53087
	at org.dspace.app.webui.servlet.SimpleSearchServlet.doDSGet(SimpleSearchServlet.java:271)
	at org.dspace.app.webui.servlet.DSpaceServlet.processRequest(DSpaceServlet.java:151)
	at org.dspace.app.webui.servlet.DSpaceServlet.doGet(DSpaceServlet.java:99)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
	at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:199)
	at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:282)
	at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:767)
	at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:697)
	at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:889)
	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
	at java.lang.Thread.run(Thread.java:595)

</xmp>
<h3>Outline of Solution</h3>
1) A handle was found by search that was not in the database (probably a deleted file and IndexAll has not run yet). <br>
2) I found the segment of code that collects into a list all the items found by search.<br>
3) When any word that was on this deleted record was input, the search routine would throw an error and halt.<br>
4) I rewrote the code to ignore handles that are not in the database. <br>
5) Ran a few basic tests on Odin (our private DSAPCE setup).<br>
6) Deployed it to strip1 (production site)<br>

<h3>Modified Code</h3>
<xmp>
// FROM SimpleSearchServlet.java
/*
        resultsItems = new Item[numItems];
        for (int i = 0; i < numItems; i++)
        {
            String myhandle = (String) itemHandles.get(i);
           Object o = HandleManager.resolveToObject(context, myhandle);
           resultsItems[i] = (Item) o;
           if (resultsItems[i] == null)
            {
                throw new SQLException("Query \"" + query
                        + "\" returned unresolvable handle: " + myhandle);
            }
        }
*/
// The code below will only add handles to the list if a well defined 
// item is associated with it.
        Item[] resultsItems_temp  = new Item[numItems];
        int item_count =0;
        for (int i = 0; i < numItems; i++){
            String myhandle = (String) itemHandles.get(i);
            Object o = HandleManager.resolveToObject(context, myhandle);
            if (o != null){
               resultsItems_temp[item_count] = (Item) o;
               item_count++;
            }
        }
        
        resultsItems = new Item[item_count];
        for (int i = 0; i < item_count; i++){
           resultsItems[i] = resultsItems_temp [i];
        }
</xmp>
]]>
        
    </content>
</entry>

<entry>
    <title>Ames collection ingest ... multiple metadata per file</title>
    <link rel="alternate" type="text/html" href="http://blog.lib.umn.edu/silvi003/codenotes/2009/08/ames_collection_ingest_multipl.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://blog.lib.umn.edu/cgi-bin/mt-atom.cgi/weblog/blog_id=6716/entry_id=187782" title="Ames collection ingest ... multiple metadata per file" />
    <id>tag:blog.lib.umn.edu,2009:/silvi003/codenotes//6716.187782</id>
    
    <published>2009-08-10T19:49:39Z</published>
    <updated>2009-08-11T20:44:47Z</updated>
    
    <summary> The problem While ingesting the metadata for the AMes collection I found a problem. Below is a list of metadata sets that map to the same image. identifier local Image ama00711 ama00711.jpg ama00712 ama00711.jpg amp00259 amp00259.jpg ap00259 amp00259.jpg s...</summary>
    <author>
        <name>Jeffrey Silvis</name>
        <uri></uri>
    </author>
    
        <category term="fedora" />
    
    <content type="html" xml:lang="en" xml:base="http://blog.lib.umn.edu/silvi003/codenotes/">
        <![CDATA[
<h3>The problem</h3>

While ingesting the metadata for the AMes collection I found a problem.
Below is a list of metadata sets that map to the same image.

<table border="1">
<tr>
<td>identifier local</td>
<td> Image </td>
</tr>
<tr>
<td> ama00711 </td>
<td> ama00711.jpg </td>
</tr>
<tr>
<td> ama00712 </td>
<td> ama00711.jpg </td>
</tr>
<tr>
<td> amp00259 </td>
<td> amp00259.jpg </td>
</tr>
<tr>
<td> ap00259 </td>
<td> amp00259.jpg </td>
</tr>
<tr>
s<td> amp00435 </td>
<td> amp00435.jpg </td>
</tr>
<tr>
<td> amp00436 </td>
<td> amp00435.jpg </td>
</tr>
<tr>
<td> amp00448 </td>
<td> amp00449.jpg </td>
</tr>
<tr>
<td> amp00449 </td>
<td> amp00449.jpg </td>
</tr>
<tr>
<td> amp00513 </td>
<td> amp00531.jpg </td>
</tr>
<tr>
<td> amp00531 </td>
<td> amp00531.jpg </td>
</tr>
</table> 

<h3>Jason's solution</h3>

<xmp>
identifier local         Image
ama00711           ama00711.jpg
ama00712           ama00711.jpg - error in the data. Should point to ama00712.jpg (I've fixed it in IMAGES)
amp00259          amp00259.jpg
ap00259             amp00259.jpg - delete this version
amp00435          amp00435.jpg
amp00436          amp00435.jpg - error in the data. Should point to amp00436.jpg (I've fixed it in IMAGES)
amp00448           amp00449.jpg - error in the data. Should point to amp00448.jpg (I've fixed it in IMAGES)
amp00449           amp00449.jpg
amp00513            amp00531.jpg - error in the data. Should point to amp00513.jpg (I've fixed it in IMAGES)
amp00531            amp00531.jpg
</xmp>


<h3>What to do from here</h3>
Bill will need to pull the ames collection from IMAGES.  I will need to re ingest it and delete ap00259.  ]]>
        
    </content>
</entry>

<entry>
    <title>Problem with a dspace user and solution </title>
    <link rel="alternate" type="text/html" href="http://blog.lib.umn.edu/silvi003/codenotes/2009/08/problem_with_a_dspace_user_and.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://blog.lib.umn.edu/cgi-bin/mt-atom.cgi/weblog/blog_id=6716/entry_id=187646" title="Problem with a dspace user and solution " />
    <id>tag:blog.lib.umn.edu,2009:/silvi003/codenotes//6716.187646</id>
    
    <published>2009-08-07T19:52:47Z</published>
    <updated>2009-08-11T20:45:53Z</updated>
    
    <summary>Problem A problem that happened once before. Although Erin George has successfully uploaded files to some of the collections in the Univeresity Archives community, she is now if a cycle where she logs in, goes to a collection, and whatever...</summary>
    <author>
        <name>Jeffrey Silvis</name>
        <uri></uri>
    </author>
    
        <category term="dspace" />
    
    <content type="html" xml:lang="en" xml:base="http://blog.lib.umn.edu/silvi003/codenotes/">
        <![CDATA[<h2>Problem</h2>

<br>
A problem that happened once before.  Although Erin George has successfully uploaded files to some of the collections in the 
Univeresity Archives community, she is now if a cycle where she logs in, goes to a collection, and whatever she does gets cycled back to the log in screen 
with her x500 there but no password.  She enters her password, and goes through the same thing again and again.  This happened to one of our students. 
 
</br>

<h2>Solution</h2>

This command fixed it: <br>
update eperson set netid = 'georg038' where eperson_id = '190';]]>
        
    </content>
</entry>

<entry>
    <title>svn notes ... media_repo Externals Switch</title>
    <link rel="alternate" type="text/html" href="http://blog.lib.umn.edu/silvi003/codenotes/2009/07/svn_notes_media_repo_externals.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://blog.lib.umn.edu/cgi-bin/mt-atom.cgi/weblog/blog_id=6716/entry_id=186746" title="svn notes ... media_repo Externals Switch" />
    <id>tag:blog.lib.umn.edu,2009:/silvi003/codenotes//6716.186746</id>
    
    <published>2009-07-27T18:58:01Z</published>
    <updated>2009-07-27T19:20:57Z</updated>
    
    <summary>Our svn site https://chaucer.lib.umn.edu/svn/dldl/ Externals Chad is using svn externals to have several projects at the DLDL link to the same set of files within the svn tree. From the command line to view the externals use the commands: svn...</summary>
    <author>
        <name>Jeffrey Silvis</name>
        <uri></uri>
    </author>
    
        <category term="HowTo" />
    
    <content type="html" xml:lang="en" xml:base="http://blog.lib.umn.edu/silvi003/codenotes/">
        <![CDATA[<h3>Our svn site</h3>
<a href="https://chaucer.lib.umn.edu/svn/dldl/"> https://chaucer.lib.umn.edu/svn/dldl/</a>

<h3>Externals</h3>
Chad is using <a href="http://svnbook.red-bean.com/en/1.0/ch07s03.html">svn externals</a> to have several projects at the DLDL link to the same set of files within the svn tree.  From the command line to view the externals use the commands: 
<xmp>
svn propedit svn:externals . 
</xmp>

<xmp>
svn propget svn:externals FileName
</xmp>

<h3>Switch</h3>
The <a href="http://svnbook.red-bean.com/en/1.0/re27.html">svn switch</a> command allows a user to update to a new version of a package.  <br>
Example from John Barneson:
First make drupal go offline.
<xmp>
https://dldl00.lib.umn.edu/admin/settings/site-maintenance
</xmp>
<xmp>
 svn switch https://chaucer.lib.umn.edu/svn/dldl/drupal/releases/acquia-drupal-1.2.13/ .
</xmp>


<h3>Useful URLs </h3>
<a href="http://jeremyknope.com/2006/06/23/howto-subversion-externals-basics/#comments">Jeremy Knope dot com</a>
<a href="http://zigzig.com/">OS X svn client</a>
]]>
        
    </content>
</entry>

</feed> 

