Re: [CODE4LIB] Stack Overflow

2014-11-04 Thread Geoffrey Spear
On Tue, Nov 4, 2014 at 9:12 AM, Schulkins, Joe
 wrote:
> Presumably I'm not alone in this, but I find Stack Overflow a valuable 
> resource for various bits of web development and I was wondering whether 
> anyone has given any thought about proposing a Library Technology site to 
> Stack Exchange's Area 51 (http://area51.stackexchange.com/)? Doing a search 
> of the proposals shows there was one for 'Libraries and Information Science' 
> but this closed 2 years ago as it didn't reach the required levels during the 
> beta phase.
>
> The reason I think this might be useful is that instead of individual places 
> to go for help or raise questions (i.e. various mailing lists) there could be 
> a 'one-stop' shop approach from which we could get help with LMSs, discovery 
> layers, repository software etc. I appreciate though that certain vendors 
> aren't particularly open (yes, Innovative I'm looking at you here) and might 
> not like these things being discussed on an open forum.
>
> Does anybody else think this might be useful? Would such a forum be shot down 
> by all the vendors legalese wrapped up in their Terms and Conditions? Or are 
> you happy with the way you go about getting help?
>
> Joe

I suspect such a site wouldn't work for the same reason the Libraries
site failed; the potential audience is relatively small, but more
importantly it's made up of people who know how to do their own
research and so ask a smaller volume of questions than you see on most
Stack Exchange sites. A model where opinion-based questions don't work
and where questions with a definitive answer have the people with the
questions just finding it themselves most of the time seems doomed to
failure on the SE platform.

That said, despite my pessimism I'd probably support an Area 51
proposal just to see what happens.
--
Geoffrey Spear
Metadata Manager
Health Sciences Library System
University of Pittsburgh


[CODE4LIB] Announcing pycounter, a Python library for COUNTER usage stats

2015-04-14 Thread Geoffrey Spear
I'm pleased to announce that the Health Sciences Library System of the
University of Pittsburgh has released an alpha version of pycounter, a
Python library for dealing with COUNTER usage statistics.

version 0.5a2 includes support for reports JR1, BR1, and BR2, and can fetch
reports via SUSHI or parse COUNTER 3/4 .xlsx, .csv, and .tsv files.
(Additional reports are in the planning stage).

The library is available on pypi at https://pypi.python.org/pypi/pycounter/
or from GitHub at https://github.com/pitthsls/pycounter (pull requests
welcome!)


--
Geoffrey Spear
Metadata Manager
Health Sciences Library System
University of Pittsburgh


Re: [CODE4LIB] is python s l o o o w ? [resolved]

2015-05-19 Thread Geoffrey Spear
On Mon, May 18, 2015 at 10:34 PM, Eric Lease Morgan  wrote:

> On May 18, 2015, at 9:23 PM, Galen Charlton  wrote:
>
> >> I have two scripts, attached. They do EXACTLY the same thing
> >> in almost EXACTLY the same manner, but the Python script is
> >> almost 25 times slower than the Perl script:
> >
> > I'm no Python expert, but I think that the difference is much more
> > likely due to which JSON processor is being used.  I suspect your Perl
> > environment has the JSON::XS module, which is written in C, is fast,
> > and is automatically invoked (if present) by "use JSON;".
> >
> > In contrast, I believe that the Python "json" library is written in
> > Python itself.  I tried swapping in cjson and UltraJSON [1] in place
> > of "json" in your Python script, and in both cases it ran rather
> > faster.
> >
> > [1] https://github.com/esnme/ultrajson
>
>
> Thank you. After using the Python module ujson instead of json, the speed
> of my two scripts is now all but equal. Whew! —Eric
>

This is kind of weird, since the stdlib json module should be using a C
extension (from _json). ultrajson does claim to be faster than simplejson
(which is the library that got incorporated into the python 2.6 stdlib as
"json"), but I wouldn't have expected it to make that much of a difference.

Out of curiosity, does "import _json" work on your Python? I'm wondering if
the C extension didn't build for some reason.


[CODE4LIB] BatchCat from Python?

2015-09-08 Thread Geoffrey Spear
(Apologies for the crosspost; I'm not sure if this a BatchCat specific
problem or I'm doing something dumb with pywin32...)

Have any of you had any luck using BatchCat from a Python script?

A few years ago, I managed to get AddItemStatus working fine using
win32com.client (from the pywin32 library), but trying to use
UpdateHoldingRecord is behaving oddly

I'm doing something like:


import win32com.client
import arrow

bc = win32com.client.Dispatch("BatchCat.ClassBatchCat")
bc.Connect(AppPath=r'C:\Voyager', UserName='myusername',
Password='mypassword')

mrec = thing_that_gets_a_MARC_record()
result = bc.UpdateHoldingRecord(int(mrec.mfhdid), mrec.record.as_marc(),
   arrow.now().datetime, 459,
   int(mrec['004'].data), mrec.suppressed)
print("result:", result)


with the output

result: (23, 6990816, u'00449cy  a22001094
 
451000800040008800500170001600800330003385200866856016700146866002600313\x1e6990816\x1e6935429\x1e20130926071356.0\x1e1203285p
   6   |001bbeng0120328\x1e8 \x1fbfalkwebp\x1fhHSL Online Journals\x1fxULS
Site License\x1fxserhold updated:mk,3/28/12\x1e40\x1fzAccess via Academic
Search Premier for Pitt users\x1fuhttp://
pitt.idm.oclc.org/login?url=http://search.ebscohost.com/direct.asp?db=aph&authtype=ip&jid=FM9&scope=site\x1e41\x1f80\x1fav.28-32(2000-2004)\x1e\x1d',
, 459, 6935429, 0, False)


Error 23, according to the documentation, means I've provided an invalid
location ID. However, "falkwebp" is a valid location, and indeed I'm able
to write this exact MARC (as far as I can tell) via a Perl script.

I'm wondering if there's some kind of encoding problem; as_marc() returns a
bytestring, but the return value seems to indicate that the client thinks
it was called with a unicode version of the MARC (although the bytes look
correct). I ran this with Python 3, as well, with the same output except
for the leading u, so maybe pywin32 is doing some automatic decoding and
that's breaking things?

It seems suspicious that the error is about the location code, rather than
BatchCat thinking the MARC is just invalid if it's getting encoded in such
a way that the 852 subfield b is being misread. I wish I could get it to
tell me what location it thinks I'm trying to use.

Any suggestions would be appreciated.

--
Geoffrey Spear
Metadata Manager
Health Sciences Library System
University of Pittsburgh


Re: [CODE4LIB] BatchCat from Python?

2015-09-09 Thread Geoffrey Spear
On Tue, Sep 8, 2015 at 9:54 PM, Andy Kohler  wrote:

> Disclaimer: never done this from Python, but lots and lots of BatchCat
> work.
>
> I believe you're missing the CatLocationID parameter - at least, your
> example code has only 6 parameters but should have 7:
>
>
Well, I have to admit it didn't occur to me to re-count the parameters
because I expected a function called with the wrong number of *required*
parameters would throw a more useful error.

Thanks for the sharp eyes, and boy do I feel dumb about all the debugging I
tried to do to no avail... :)


Re: [CODE4LIB] Software to track website changes?

2014-07-11 Thread Geoffrey Spear
On Fri, Jul 11, 2014 at 1:01 PM, Francis Kayiwa  wrote:
>> Another +1 for Github Issues. If you’re uncomfortable putting the
>> website in a public repo they’ve given us 50 private repositories
>> for free and have asked us to spread the word. You can just head
>> over to https://education.github.com/ and request a discount for
>> your organization - they’ve been amazing to work with. =)
>>
>
> I had (sample of one) to jump through so many hoops and still couldn't
> convince them to give me what you got.
>
> FWIW All bitbucket needs is a .edu account and they will give you
> unlimited repos. Sure not as *cool* as github but also has had less
> bad press than github. ;-)

We use bitbucket for both the free private repos and issue tracking here.

In my experience, their issue tracker is not nearly as good at
Github's (which isn't particularly surprising since they'd like you to
pay for Jira.)

Github's education discounts looked to me like they were aimed
specifically at teaching rather than being free for any use by an
educational institution when I looked at them, but I don't remember if
there was specific language that gave me that impression or just vague
"use github in the classroom!" marketing. I know Jira does actually
distinguish between "use at an educational institution" and "classroom
use" in their discounted vs. free policy.

If I could get free Travis for Private Repos along with free Github
I'd switch in a second; I don't know that the improved issue tracker
alone would be worth the effort for me.
--
Geoffrey Spear
Metadata Manager
Health Sciences Library System
University of Pittsburgh