Artikel-Schlagworte: „ubuntu“

Abbreviated Journal Names with Mendeley - Replace Long Journal Names Automatically

Freitag, 11. Dezember 2009

I created a small bash script that replaces the full journal names with the abbreviated ones (MEDLINE-standard).
You need to download the list of journals from pubmed and place it within the same folder of the script.

Additionally you need sqlite3 (sudo apt-get install sqlite3) under Ubuntu Linux. On Windows systems you need to install cygwin or something similar first i think… but it easier to make the conversion on a linux box on the campus.

Then you should adjust the path to your database file according to your operating system:

  • Windows XP: C:\Documents and Settings\<Your Name>\Local Settings\Application Data\Mendeley Ltd\Mendeley Desktop\
  • Windows Vista / Windows 7: %LOCALAPPDATA%\Mendeley Ltd.\Mendeley Desktop\
  • Mac OS X: /Users/<Your username>/Library/Application Support/Mendeley Desktop/
  • Linux: ~/.local/share/data/Mendeley Ltd./Mendeley Desktop/

After you have done so, I recommend running the script once in echo only mode. If the result looks okay, change the last echo to sqlite3 $db.

Please feel free to leave comments…

Good look ;)
#!/bin/bash
db=test.sqlite # set the db-file here. The location depends on the OS you use.
limit="WHERE confirmed='true' AND type='JournalArticle'"
sqlite3 $db "SELECT id FROM Documents $limit" > temp_ids.txt
cat temp_ids.txt | while read line
do
long=$(sqlite3 $db "SELECT publication FROM Documents WHERE id=$line")
echo "long = $long"
#echo "The id is $line"
line_pubm=$(grep -i -n -m 1 "$long" J_Medline.txt | cut -f1 -d:)
#echo "linenumber in pubm= $line_pubm"
abbr_linen=$(( $line_pubm + 1 ))
short=$(sed -n ${abbr_linen}p J_Medline.txt | sed 's/MedAbbr: //' | tr -cd '[:alnum:]‘)
echo “short= $short”
LEN=$(echo ${#short})
echo $LEN
if [ "$short" ]; then
echo “UPDATE Documents SET publication=’$short’ WHERE id=$line”
# sqlite3 $db
# make a security update of your sqlite-file and replace the echo from above with sqlite3 $db
else
echo “no or short shortname (<3 chars) - not changed”
fi
done

Unbrick La Fonera 2.0 (fon-ng) with Ubuntu

Dienstag, 9. Dezember 2008

Two days after my fonera arrived, i already messed up the init.d section and had to reflash with RedBoot, as there is currently no .fon image available to flash via the webinterface.
After hours of testing with gnome-console (where the ctrl-c does not work) I got crazy but thanks to the irc-channel I became finally able to unbrick the tiny device…

The procedure:

  • install tftpd and putty: sudo apt-get install tftpd-hpa tftp-hpa putty
  • copy the image to /var/lib/tftpboot and rename it to i.e. alfred.image
  • start the tftp server: sudo /etc/init.d/openbsd-inetd start
  • test your tftpd: tftp localhost -c get /alfred.image
    the image should now be loaded to the current directory
  • get into redboot:
    sudo su
    ifconfig eth0 192.168.1.254;while true; do fping -t 100 192.168.1.1 && break; done;putty telnet://192.168.1.1:9000
  • you should end up in a telnet session and see the boot promt RedBoot>
  • type:
    fis del image -> confirm with y
    load -r -b %{FREEMEMLO} openwrt-fonera2.imag
    fis create image -> wait about 20min, drink some tea
    reset -> wait about 3 min -> unplug and replug the fonera
    Be happy…

Any comments are welcome…