I have begun to write a (free) scientific database (pubmed) browser.
Mainly I want the ability to perform a search on the web, get the page
retrieving the records, but before it displays in the browsers, inject
some css using greasemonkey or userjavascript so that records that i
have already looked at are marked off in a different color/font.
For this, I need to be able to compare the returned record IDs with a
(possibly very long, greater than 10,000) list of record IDs that I
have saved somewhere on my hard disk.
After some searching, it seemed to me that javascript would not be able
to do this, since I would have no way of reading the data from my own
disk into the javascript program for comparison. So I was looking at
java applets or just writing a standalone python/perl based program to
do this, but then I would have the overhead of handling the GUI for the
records etc, and I much prefer to do this within the browser itself.
But it seems that Tiddly wiki, being a local javascript file can indeed
read and write to the disk. Would it be possible to have a tiddly wiki
- like set up that then performs searches on the web and then modifies
the returned document (or else formats the returned xml format search
results for display in a new webpage) by comparing to the long list of
record IDs stored locally ?
I realize that this is probably way too general for a response, but
perhaps you can point me to a book or source that I can use to read up
on how to do this with javascript, if it is possible.
Thanks for your time and help !!!
Suresh
While much of what you want to do is quite different from what
TiddlyWiki does, the TW file I/O code should provide you with some good
examples to start...
visit www.TiddlyWiki.com and then view the page *source* and search for
the file I/O functions:
saveFile(fileUrl, content)
loadFile(fileUrl)
ieSaveFile(filePath, content)
ieLoadFile(filePath)
mozillaSaveFile(filePath, content)
mozillaLoadFile(filePath)
javaUrlToFilename(url)
javaSaveFile(filePath, content)
javaLoadFile(filePath)
saveFile/loadFile provide browser-independent wrappers for the
browser-specific file I/O implementations. Obviously, the "ie" prefix
is for Internet Explorer, and "mozilla" is for FireFox and other
'moz-based' browsers. The functions with a "java" prefix work with an
external .jar file to provide support for Safari, Opera, etc... (see
http://www.tiddlywiki.com/#TiddlySaver for more details)
HTH,
-e
Eric Shulman
TiddlyTools / ELS Design Studios
Benchmarks:
http://shootout.alioth.debian.org/gp4sandbox/benchmark.php?test=all&lang=javascript
And one last thing, performing web searches over domains would be
problematic. I would actually suggest you look into the dojotoolkit ( a
bit more all encompassing for what you want ). They might have a better
solution for you with their offline storage in terms of speed vs. ease
of use, but theirs is flash based.
Cheers,
Bradley
In response to Bradley's question: pubmed is a huge database that is
maintained by the national library of medicine. I spend hours searching
it and tagging records of interest and saving them to disk. When I
perform a new search and get a list of record IDs, I would like to know
which of the hundreds of returned IDs have already been tagged and
saved into my local database. It is most efficient for me to perform
the search from within my browser rather than from my bibliographic
application (Jabref or Endnote) because searching from within the
application is extremely clumsy.
I will keep your tip about speed in mind. The file would however be
only read once ideally at startup, if I could make sure I store the
list of IDs as a persistent variable during the search session (I read
that this is possible in javascript). But I realize that the 10,000
element search could still be very slow, especially when done hundreds
of times on each page for each record ID returned from the search.
I guess I should bite the bullet and go Java/Perl/Python... any
tips/advice would of course be greatly appreciated: I am still a
complete novice when it comes to web programming, as is probably
obvious.
Thanks, Suresh
On Jan 26, 4:08 am, "BradleyMeck" <genisis...@gmail.com> wrote:
> I am not quite sure I understand why there is a list of record IDs on a
> computer, but the overall idea can be done on a html page using some
> Javascript functions as Eric has said, however I would urge against
> this because 10,000 element searches in Javascript can be very very
> slow, especially when reading a file.
>
> Benchmarks:http://shootout.alioth.debian.org/gp4sandbox/benchmark.php?test=all&l...
I've written a small plugin which links to the arXiv:
http://bob.mcelrath.org/tiddlyjsmath.html#%5B%5BPlugin%3A%20arXiv%20Links%5D%5D
and I regularly use Bram Chen's XMLReader to pull RSS feed from the
arXiv.
At least with the arXiv (I can't speak for pubmed), each paper has a
unique identifier, such as hep-ph/0506151. Every other database I've
seen has them, such as DOI's or more traditional library-type journal
references. Put these in a javascript dictionary. Add a hook to
tiddlywiki's save() somehow to serialize this dictionary into a tiddler
and save it. Dictionary lookup should be very fast, O(1), regardless of
the size. And the load cost is the load cost of eval'ing the data
structure.
This also provides the possibility to not only keep track of what you've
read, but also keep *notes* on them, and even trackbacks for more public
comments on papers. There are things like this happening these days
between the arXiv and some blogs.
I've wanted something like this for a long time. Please keep us
informed of your progress. I might also suggest to invest a little
effort in making it database independent. If you can keep an identifier
and a query URL, you could link up to any database.
arXiv/SPIRES/doi/ADS, etc.
--
Cheers,
Bob McElrath [Univ. of California at Davis, Department of Physics]
"The reasonable man adapts himself to the world; the unreasonable one
persists in trying to adapt the world to himself. Therefore all progress
depends on the unreasonable man."
-- George Bernard Shaw, Maxims for Revolutionists
This way, I can interface to a Perl/PHP based bibliography database
program (Refbase/SixPack/others for Perl) and not have to worry about
keeping my dictionary up to date etc. It is less universal than a
easily-distributable tiddler, but much more general and powerful,
after a little setup effort (setting up the webserver and PHP
basically; quite easy on Windows even for a novice like me).
Suresh
On Jan 28, 4:01 am, Bob McElrath <bob.mcelr...@gmail.com> wrote:
> Ok not entirely an answer, but you might be interested in what I'm doing
> in this space...
>
> I've written a small plugin which links to the arXiv:
> http://bob.mcelrath.org/tiddlyjsmath.html#%5B%5BPlugin%3A%20arXiv%20L...
> signature.asc
> 1KDownload