Deleting duplicate records in Mendeley

I’ve recently been playing around with the program Mendeley for storing my massive collection of academic papers in PDF format. Mendeley looks to be a really useful bit of software, but at the moment it’s rather horrifically buggy. A major problem I’ve been running into is that it’s quite happy to import duplicate PDFs. This lead to much amusement when I set Mendeley to watch my collection of papers, and it decided to parse and import all of the papers every time it started up.

Read More…

r8spermute

r8spermute – Runs all permutations of r8s constraints. © Simon J. Greenhill, 2009 This is a small program to assess how robust divergence times are based on the calibrations given to the program r8s. The program r8s by Mike Sanderson (http://loco.biosci.arizona.edu/r8s/) [1, 2] performs a number of phylogenetic dating methods on a set of phylogenetic trees. In essence, you plug in a number of calibration points from known historical evidence and the program r8s takes your estimated trees, and smoothes” the rates of change observed on those trees, using the calibrations to convert the branches into time.

Read More…

genbank-download

genbank-download

genbank-download is a small script to download nucleotide sequences from genbank using an accession number.

Usage:


> python genbankdownload.py [options] ACCESSION-NUMBER
> 
> **Example Usage**
> python genbankdownload.py J01415
> python genbankdownload.py J01415 > mysequence.xml
> python genbankdownload.py -m fasta J01415 > mysequence.fasta 
> 

The program source-code is available here or you can run:

> easy_install genbank-download

Simple webserver file alteration monitoring using integrit

Intrusion detection? Over on Mezzoblue, Dave Shea found out that his website had been compromised subtly. The attacker had exploited some (as yet unknown) security hole and quietly modified his website to link to the standard spam sites. Within a few hours there were tens of posts from people who’d checked their websites and found similar modifications that had been sitting their un-noticed, with people pointing the finger either at old WordPress installations or a guesses that their hosting service had been compromised.

Read More…

Query PubMed for citation information using a DOI and Python

Here’s a simple little script to query PubMed for a Digital Object Identifier (a DOI) Usage is quite simple, find a DOI somewhere, e.g. 10.1038/nature02029 (for this groundbreaking paper), and run this: lurch:~ python pythonquery.py 10.1038/nature02029 – and via the magic of webservices and XML, and with a bit of luck, you’ll get something like this back: Language-tree divergence times support the Anatolian theory of Indo-European origin. Gray, RD, Atkinson, QD Nature 2003, 426 (6965):435-9 Languages, like genes, provide vital clues about human history.

Read More…

benchmarking .htaccess performance

Introduction: One of the common tips to increasing Apache performance is to turn off the per-directory configuration files (aka .htaccess files) and merge them all into your main Apache server configuration file (httpd.conf). Jeremy raised an interesting question about when the performance loss caused by using many htaccess files is offset by the ease of maintenance. He’s arguing – and I agree – that it makes sense to keep the configuration locally inside .

Read More…

Processing mod_security audit logs with logwatch

This is a quick and dirty LogWatch script to process mod_security audit logs. I had a google, and couldn’t find any released scripts, so here’s my one. #!/usr/bin/perl -w my $Detail = $ENV{'LOGWATCH_DETAIL_LEVEL'} || 0; while (defined($ThisLine = <stdin>)) { chomp($ThisLine); if ( $ThisLine =~ m/^Request:/ ) { print $ThisLine."\n"; } if( $ThisLine =~ m/^mod_security-message/ ) { print $ThisLine."\n"; print "\n"; } </stdin> } exit(0); On Debian, you should just be able to drop the above script into /usr/share/logwatch/scripts/services (chmod +x too!

Read More…

process a url query string in PHP

PHP Function to parse a url and extract its arguments. function process_url( $url ) { $processed_url = parse_url( $url ); $query_string = ; # split into arguments and values $query_string = explode( '&', $processed_url[ 'query' ]); $args = array( ); // return array foreach( $query_string as $chunk ) { $chunk = explode('=', $chunk ); # it's only really worth keeping if the parameter has an argument. if ( count( $chunk ) == 2 ) { list( $key, $val ) = $chunk; $args[ $key ] = urldecode( $val ); } } return $args; } $url = 'http://www.

Read More…

Protecting MySQL from SQL Injection Attacks with PHP.

This is intended as a brief guide to protecting your MySQL database from SQL injection attacks. Unfortunately, a large amount of the code that I’ve seen written by people on forums, and in countless crappy PHP tutorials lurking around on the net, and in the many websites that display the magic breeding slashed-quote (''' see below) show that many people just do not understand what’s going on and how to protect themselves against SQL injection attacks.

Read More…

All Posts by Category or Tags.