jruby/rawr exe bundling headbanging with windows xp.

Since I could find nothing on this online, some notes in case it helps anyone.

On Windows XP SP3
jruby 1.5.5
rawr 1.4.5

I was trying to do this:

jruby -S rake rawr:bundle:exe

I kept getting this error:

** Invoke rawr:bundle:exe (first_time)
** Invoke rawr:jar (first_time)
** Invoke package/jar/sersol_delete_url_check.jar (first_time, not_needed)
** Invoke package/classes/java/org/rubyforge/rawr/Main.class (first_time, not_needed)
** Invoke src/org/rubyforge/rawr/Main.java (first_time, not_needed)
** Invoke package/classes/java (first_time, not_needed)
** Invoke package/classes/META-INF (first_time, not_needed)
** Invoke package/jar (first_time, not_needed)
** Execute rawr:jar
cp lib/java/jruby-complete.jar package/jar/lib/java/jruby-complete.jar
** Invoke package/windows (first_time, not_needed)
** Execute rawr:bundle:exe
Creating Windows application in package/jar/sersol_delete_url_check.exe
rake aborted!
private method `split’ called for nil:NilClass
c:/jruby-1.5.5/lib/ruby/gems/1.8/gems/rawr-1.4.5/lib/exe_bundler.rb:95:in `deploy’
c:/jruby-1.5.5/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call’

I poked around in exe_bundler.rb and made it put file_dir_name, the part of file_dir_name split out for use in output, and output to the screen:

FILE DIR NAME: c:/jruby-1.5.5/lib/ruby/gems/1.8/gems/rawr-1.4.5/lib
OUTPUT: Error: The filename, directory name, or volume label syntax is incorrect.

I’m on my work computer so I don’t have full admin permissions, but I can run this fine in the cmd window myself:
fsutil fsinfo volumeinfo c:

Anyway, all of that is leading up to finding out whether my file system is FAT32 or NTFS, so it can do:

if 'NTFS' == output.split("n")[3].split(':')[1].strip
sh "echo y | cacls "#{file_dir_name}/launch4j/bin-win/windres.exe" /G "#{ENV['USERNAME']}":F"
sh "echo y | cacls "#{file_dir_name}/launch4j/bin-win/ld.exe" /G "#{ENV['USERNAME']}":F"

I know it is NTFS, so I just commented out the if block lines:

#if 'NTFS' == output.split("n")[3].split(':')[1].strip
sh "echo y | cacls "#{file_dir_name}/launch4j/bin-win/windres.exe" /G "#{ENV['USERNAME']}":F"
sh "echo y | cacls "#{file_dir_name}/launch4j/bin-win/ld.exe" /G "#{ENV['USERNAME']}":F"

That’s hideous, but hey, the next run of rawr:bundle:exe worked with no errors, successfully creating my exe.

Of course, now that I have an exe, I have found that it appears to do nothing, regardless of how I run it. But figuring that out is for another day, because I must get ready to leave work.

if only i’d thought of the right words.

It seems that in the era of Wikipedia and Freebase and linked data of all sorts, there should be at least a semi-effective, vaguely fakely intelligent way to convert strings to sentence case (all lowercase except for proper nouns).

You know, at the very least have it recognize country/state/province names and have been run over some Who’s Who lists or something.

If there is such a thing, I can’t find it. I have looked.

Any insight or suggestions?

ruby, a teeny bit at a time.

So I’ve learned Ruby and I am in love. And I just learned something that is going to make my life a whole lot easier and my scripts a lot less convoluted. Perhaps this was in one of the several books/tutorials I’ve read on the language, but I don’t remember it, or it was not presented in a way that seemed relevant to my applications.

My question was how do I get back to nameless, label-less objects based on their instance attributes? Here’s a silly example:

Here’s the definition of the Cat class:

class Cat
attr_reader :name, :byear

def initialize(name, byear)
@name = name
@byear = byear
end #def initialize
end #class Cat

My initial array—I’ll call it catdata—looked like this:
[["Be", 1996], ["Cu", 1996], ["Hal", "unknown"], ["Felix", 1919]]

I created an array of Cat objects:
cats = []

catdata.each do |e|
newcat = Cat.new(e[0], e[1])
end #catdata.each do

Now cats is an array of mysterious objects:
[#<Cat:0x7ff6d324>, #<Cat:0x7ff6d34c>, ...etc]

My Problem: Variable names are not assigned to the Cat objects when they are created. How do I access those Cat objects using their instance attributes? For instance, if I want to pull out all the cats born in 1996, what do I do?

I’d come up with a very ugly workaround (don’t ask), but this is much, much cleaner and I believe it can easily be defined as a method for the Cat class. (And if there is an even better/more direct way to do this, please share!)

_1996cats = cats.find_all do |cat|
cat.instance_variable_get(:@byear) == 1996

The result is an array with two elements: the objects for Be and Cu. Hooray!

notes on installing apache 2.2.6 for cygwin

That took forever and the solutions were scattered about. Oh yeah, I’m doing this in Windows XP Pro.

Started with Cygwin’s setup.exe.

Tried to start Apache and got this:

httpd: Could not reliably determine the server’s fully qualified
domain name, using tms-computer.local for ServerName
(48)Address already in use: make_sock: could not bind to address
no listening sockets available, shutting down
Unable to open logs

This was solved by changing the Listening setting (line 40 of etc/httpd.conf) to 85 since another service was using 80.

I read several accounts of people clean restoring their machines to get an open listening socket. Don’t do that!

Let’s see, what was the next problem? Oh yes, this at the very bottom of the same http.conf file:

PHPIniDir “C:/prog/PHP/”
LoadModule php5_module “C:/prog/PHP/php5apache2_2.dll”

I don’t currently have PHP installed, and if I did install it, it wouldn’t be to that location. Perhaps this will cause some problem later, but for now it fixed things enough for me to get to the next problem…

Now, feeling pretty good, I was following these instructions, starting with Test since Cygwin had taken care of everything up to Customize and I had taken care of that already.

Of course, running
$ usr/sbin/apachectl -k start
did not work.

I got the following error:
/usr/sbin/apachectl2: line 78: 2340 Bad system call $HTTPD -k $ARGV

After a fair amount of poking around and trying things that did not work, I found this page, which got me back on the right track.

You have to have cygserver installed.
I swear I had done that before, but I did it again. Details on cygserver are here.

Run usr/bin/cygserver-config
When it asks you if you want to install as a service, say yes.

Set a global Windows environment variable: CYGWIN=server
To do this, right click on any “My Computer” you see and select Properties >> Advanced >> Environment variables.

Make sure you are in the system variables and not the user variables.

Start the cygserver service:

net start cygserver

HA! This must be it…

Try this again:
usr/sbin/apachectl -k start

STILL it didn’t work! Argv indeed.

I forget where I even found the answer, but the answer was to type in this instead:

CYGWIN=server usr/sbin/apachectl -k start


how to configure procite 5.0 to search and import records from the UNC OPAC

Issues: Call numbers are not imported into Procite correctly. As far as I can tell, this stems from the way the catalog stores holdings information separately from the MARC bibliographic record, and complications with having multiple call numbers for books that are held in more than one UNC library.

How I got here: Procite and Endnote are similar, so I looked in the Endnote connection file (.enz) made available by the library to extract the necessary information for configuring Procite. Perhaps the solution to the call number is buried in there, too, but I have run out of time and patience for this today.

  1. Choose Tools –> Internet Search
  2. Click on the Hosts button
  3. Click Configure Hosts
  4. Click New Host
  5. Fill in the following values in the window that pops up:
    Host name: UNC Chapel Hill
    Domain name or IP address: afton.lib.unc.edu
    Port number: 210
    Library type: Academic
    Location: USA
    URL: webcat.lib.unc.edu
    Leave the rest blank. It should look like this:

  6. Click OK
  7. A new Database Properties window will pop up, for you must now enter information about the database that will be searched.
  8. Fill in all the fields as shown below:

  9. Click OK
  10. If you are asked whether you want to add another database, click No
  11. In the Configure Hosts window, select Library Catalog under UNC Chapel Hill and click Proxy Server. Make sure “Not using a proxy server” is selected beneath “Proxy protocol.”
  12. In the Configure Hosts window, select UNC Chapel Hill and click Proxy Server. Make sure “Not using a proxy server” is selected beneath “Proxy protocol.”
  13. In the Configure Hosts window, select Library Catalog under UNC Chapel Hill and click Test Host.
  14. Hopefully you will get a window with a message at the bottom that reads “SUCCESS”
  15. You should now be able to search the catalog and import records from it into your Procite databases.
  16. If you do not have a SUCCESS message, make sure you’ve entered all your values right. If all your values were entered correctly and it is not working, try back later–the catalog itself might be having a problem. If those don’t work, I’m at a loss.