PDF rename based on Zotero entry

Here is a tool that will automatically rename the most recently downloaded PDF with the most recently entered Zotero entry. You may call it directly from the browser by setting a link in the toolbar to file:///c:/system/test.000 while setting the file association for 000 in the Content tab to the location of ZoteroRename.exe.

ZoteroRename.zip includes the source perl script including a compiled windows version.

 1:
 2:
 3:
 4:
 5:
 6:
 7:
 8:
 9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
58:
# ZoteroRename.pl links most recently downloaded PDF with most recent Zotero journal entry
# m@wjst.de 17/1/08

my $dbfile = <$ARGV[0]>;
my $dir = <$ARGV[1]>;

#----------------------------------------------------------------------------------------------

use DBI;

$dbh = DBI->connect("dbi:SQLite:$dbfile","","",{ RaiseError => 1 }) || die "Cannot connect: $DBI::errstr";

my $sql = 'SELECT DISTINCT items.itemID
FROM items
WHERE items.itemTypeID=4
ORDER BY items.dateAdded DESC
LIMIT 1';
$res0 = $dbh->selectall_arrayref($sql);
$ID = $res0->[0][0];

my $sql = 'SELECT DISTINCT itemDataValues.value
FROM items LEFT JOIN itemData ON items.itemID = itemData.itemID LEFT JOIN itemDataValues ON itemData.valueID = itemDataValues.valueID
WHERE items.itemID=' . $ID . ' AND itemData.fieldID IN (14,12)';
$res1 = $dbh->selectall_arrayref($sql);
$dt = $res1->[1][0];
$dt =~ s/(^[0-9]{4})(.*)//gi;
$so = $res1->[0][0];
$so =~ s/\s//gi;

my $sql = 'SELECT DISTINCT creators.lastName
FROM items LEFT JOIN itemCreators ON items.itemID = itemCreators.itemID LEFT JOIN creators ON itemCreators.creatorID = creators.creatorID
WHERE items.itemID=' . $ID . ' AND itemCreators.orderIndex=0';
$res2 = $dbh->selectall_arrayref($sql);
$nm = $res2->[0][0];
$newfn = "$nm-$so-$dt.pdf";

$dbh->disconnect;

#----------------------------------------------------------------------------------------------

use DirHandle;

my $dir_handle = new DirHandle $dir or die "unable to open $dir $!";
my %newest;

$newest{mtime} = 0;
while (defined($file = $dir_handle->read)) {
   next if ($file eq '.' or $file eq '..');
   my $mtime = (stat("$dir/$file"))[9];
   $newest{file} = $file and $newest{mtime} = $mtime if $newest{mtime} < $mtime;
}

$oldfn = $newest{file};

#----------------------------------------------------------------------------------------------

rename ("$dir/$oldfn","$dir/$newfn") or die "unable to rename $dir/$oldfn => $dir/$newfn $!";

Don’t ask for salary

Here is what the University of Cologne published recently

An der Medizinischen Fakultät der Universität zu Köln ist unter den Voraussetzungen des § 36 des Hochschulfreiheitsgesetzes des Landes Nordrhein-Westfalen baldmöglichst eine W 2-Professur für Theorie und Ethik des Gesundheitsmanagements zu besetzen. Die Bewerbung setzt voraus, dass sich die Bewerberin / der Bewerber gleichzeitig bei der DFG um eine Heisenberg-Professur bewirbt. Die Berufung erfolgt dann vorbehaltlich der Bewilligung der Heisenberg-Professur nach den Richtlinien der Deutschen Forschungsgemeinschaft. Eine Zwischenevaluierung nach drei Jahren ist vorgesehen und entscheidend für die Üernahme in den Etat der Hochschule nach fünf Jahren.

It says that can try to get a salary from the German Science Association which will be honored in turn by a position at the medical faculty. When writing this post I did a typing error, writing slavery instead of salary, yea, yea.

A workflow for managing PDFs with Zotero

Over the last weekend I worked on redesigning my workflow of handling PDFs while taking into account the many new capabilities of the Zotero literature management. Continue reading A workflow for managing PDFs with Zotero

Screening steroid activity

A paper in J Drug Target shows a nice property of a cell line

Eight repeats of the glucocorticoid response element (GRE) were cloned into […] vector, and the resulting recombinant plasmid […] was stably transfected into the 293E cells. The stable and sensitive cell line […] was selected by dexamethasone (DEX) using fluorescent microscopy and fluorescence-activated cell sorting. […] The expression of GFP4 in the cell line was under the control of GRE, up-regulated by DEX treatment and down-regulated by phorbol myristate acetate (PMA).

as it could be nicely used for the steroid activity of any compound.

Finally: A true alternative to Thomson ISI® impact factors

That was even worth a note in Nature News that finally a free journal-ranking tool entered the citation market. The attack came by an article in JCB (“Show me the data“), the response was weak. Sooooooo we have a choice now which of the metric indices is being the worsest way to rate a researcher (if you can’t understand otherwise what she/he his doing).
BTW individual IF reporting was never intended but ISI but is now common use in many countries. I don´t believe (as Decan Butler explains) that there is so much difference between popularity and prestige – but there is a big difference between popularity and quality.

A little gift from Science Surf

There are many ways how to accidentially duplicate files: storing multiple mail attachments, copying or restoring files to a wrong directory. Here is a simple way Continue reading A little gift from Science Surf

Children research

Spiegel online reports a Pubmed listed study in the Deutsche Medizinische Wochenschrift by 14 and 12 year old authors. Having supervised such a study at Mini-München I believe that this not so spectacular as the DMW is now marketing this event. The DMW has been one of the most renown journals here. As a medical student I even had a full subscription while today the impact is being low (0.58) and needs some marketing tricks.

Outlook calendar export

It should be quite easy to export Outlook appointments into .ics format and let third party applications like phpicalendar stitch these snippets together into a coherent view. Unfortunately older Outlook versions are not supporting ics export. After several frustrating attempts (installing VB macros that are buggy and software like freemical that misses important fields) I finally wrote my own exporter that includes also a category filter as otherwise too may entries will have to be parsed by phpicalendar.

ol2ics.zip includes the source perl script including a compiled windows version.

 1:
 2:
 3:
 4:
 5:
 6:
 7:
 8:
 9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
62:
# ol2ics.pl outlook to ics export
# m@wjst.de 26Dec07
# ------------------------------------------------------------
#!/usr/local/bin/perl

if ($ARGV[0] eq "") {
    print ("OL2ICS export.ics categoryname\n");
    exit(1);
}

open(OUT,">$ARGV[0]");
print OUT ("BEGIN:VCALENDAR\nVERSION:2.0\nPRODID:-//RSB//ICSCATEG//EN\n");
$b="BEGIN:VEVENT\n";
$e="END:VEVENT\n";

use Win32::OLE;
use Win32::OLE::Const 'Microsoft Outlook';

my $outlook = Win32::OLE->new('Outlook.Application') or die "Error!\n";
my $namespace = $outlook->GetNamespace("MAPI") or die "can't open MAPI namespace\n";;
my $folder = $namespace->GetDefaultFolder(olFolderCalendar);

my $items = $folder->Items;
for my $itemIndex (1..$items->Count) {
    my $message = $items->item($itemIndex);
    next if not defined $message;

    $s="SUMMARY:" . $message->{Subject} . "\n";
    # $message->{Body}
    # $message->{IsRecurring}

    $l="LOCATION:" . $message->{Location} . "\n";
    if ($message->{AllDayEvent} eq 1) {
        $t="DTSTART;VALUE=DATE:" . $message->{Start}->Date("yyyyMMdd") . "\n";
        $d="DTEND;VALUE=DATE:" . $message->{End}->Date("yyyyMMdd") . "\n";
    } 
    else {
        $t="DTSTART:" . $message->{Start}->Date("yyyyMMdd") . "T" . $message->{Start}->Time("hhmmss") . "Z\n";
        $d="DTEND:" . $message->{End}->Date("yyyyMMdd") . "T" . $message->{End}->Time("hhmmss") . "Z\n";
    }
    $c="CATEGORIES:" . $message->{Categories} . "\n";
    if ($message->{item.Sensitivity} eq 2) {
        $p="CLASS:PRIVATE\n";
    }
    elsif ($message->{item.Sensitivity} eq 1) {
        $p="CLASS:CONFIDENTIAL\n";
    }
    else {
        $p="CLASS:PUBLIC\n";
    }
    $m="DTSTAMP:" . $message->{LastModificationTime}->Date("yyyyMMdd") . "T" . $message->{LastModificationTime}->Time("hhmmss") . "Z\n";
    $u="UID:" . $message->{EntryID} . "\n";

    if ( $c =~ /.*($ARGV[1]).*/) {
        print OUT ("$b$s$l$t$d$c$p$m$u$e");
    }
}

print OUT ("END:VCALENDAR");
close OUT;
exit(0);

The ics file may then be uploaded to the phpicalendar directory using a wput call like
wput –reupload my.ics ftp://name:password@domain.de/calendar/my.ics

Punch line

I have seen the first user looking here for the BMJ Christmas edition already 2 weeks ago — clearly the annual highlight in the biomedical world since 2000. But only today, the 2007 issue is being online. As a former recumbent owner, I can assure you that Professor Shuster’s observation is correct. Even with my folding bike in the Munich S-Bahn I get many responses from the public, usually technical questions by men but also price inquiries by women. Continue reading Punch line

Forgotten papers: Allergy origins in the gut

Instead of highlighting the best paper in 2007, I decided to nominate now the most under valued paper in 2007. There are so many interesting (and probably highly important) studies that do not get enough initial attention and consecutively fail to enter the high citation track. Here is one of these papers that is as interesting as on the day of publication: Continue reading Forgotten papers: Allergy origins in the gut