Hello WordPress!

If there is a good thing about having a cold/flu it’s that you get around to do those little things you’ve been putting off for months or years (because you’re not up for much else) — like getting your blog in order. I’ve used Blogger some time ago, then installed WordPress, but never moved old posts… So here they come now.

Posted in Blogging | Leave a comment

Coffeine triggered migraine

This is an interesting article on caffeine and migraine. I thought the connection was obvious, I had no idea it is something still debated/not explicitly shown in studies.

Posted in Uncategorized | Leave a comment

XML parsing with Perl using XPath

use strict;
use XML::LibXML;

# data source
my $xml_filename = "xml/data.xml";

my $parser = XML::LibXML->new;
my $doc = $parser->parse_file($xml_filename);

my $xpath = "//word/entry[\@src=\"pr\"]/..";
my @words = $doc->findnodes($xpath);

foreach my $word (@words) {
	print $word->findvalue("\@id");
	print "\n";
}
Posted in Data Processing, Programming, Tips & Tricks | Tagged , , | Leave a comment

File modified timestamp with Perl

This is how to quickly get the timestamp of when the file was last modified in Perl:

$lastmod = (stat($filename))[9];
Posted in Programming, Tips & Tricks | Tagged , | Leave a comment

XSLT transform with Perl

Here is a Perl snippet that transforms an XML file with XSLT:

use strict;
use XML::XSLT::Wrapper;

my $xml_input_filename = "xml/data.xml";
my $xml_output_filename = "xml/out.xml";
my $xsl_filename = "xml/transform.xslt";

my $xslt = XML::XSLT::Wrapper->new(
		ProcessorList => [
			'libxslt',
			'sablotron',
			'xslt'
		],
	);
my $result = $xslt->transform(
		OutFile => $xml_output_filename,
		xml => $xml_input_filename,
		xsl => $xsl_filename,
	);
$xslt->dispose();

Values given to xml => and xsl => can be either file names, or xml/xslt code passed as a string.

If OutFile is ommited, then the result of the transformation is returned to the variable $result.

Posted in Data Processing, Programming, Tips & Tricks | Tagged , , | Leave a comment

Blogger, WordPress, b2evolution: Blog Engine Choice

As I signed up with Blogger a few years ago, and have never looked at alternatives, I decided to do so now, just to check whether I’m missing on something. Here’s what I found.

Read More »

Posted in Blogging | Tagged , , | 1 Comment

Sitemap generator configuration for Blogger

If you are using Google’s sitemap generator sitemap_gen.py to generate a sitemap of your Blogger blog , here are the configuration lines to add to the config.xml file:

<filter action="drop" type="wildcard"
    pattern="*.py" />
<filter action="drop" type="wildcard"
    pattern="*.txt" />
<filter action="drop" type="regexp"
    pattern="/google\w+\.html" />
<filter action="drop" type="regexp"
    pattern="/\d+/(\d+/)?$" />

<filter action="drop" type="regexp"
    pattern="/archive/$" />
<filter action="drop" type="regexp"
    pattern="/uploaded_files/$" />
<filter action="drop" type="regexp"
    pattern="/uploaded_images/$" />

In this way, void URLs will not be included in the sitemap.xml output.

If you’re wondering “Why would I be running the sitemap generator on my blog?”, it’s because Googlebot does not handle well the posts where the time & date has been altered.

If you don’t know what the sitemap generator is, see Google Sitemaps Help.

Posted in Tips & Tricks | Tagged , | Leave a comment

Function call counting in Matlab

Here’s a neat way to keep track of the cost, i.e. number of function calls in Matlab:
rather than using a counter variable and increment it each time a function is called, use the internal Matlab counters, accessible through the FunctionTable struct array.

The loop below is necessary only to get the index of the desired function in the struct array (If you know a better way of looking up a function in FunctionTable, let me know!).

Replace the function name ftest if needed.

profile on

% your code comes here
% (cost is counted from "profile on" to "profile off")

p = profile('info');
for i = 1:size(p.FunctionTable,1)
    if strcmp(p.FunctionTable(i).FunctionName,'ftest')
        break
    end
end
cost = p.FunctionTable(i).NumCalls;
profile off
Posted in Scientific Computing, Tips & Tricks | Tagged | Leave a comment

Between bouncing and splashing: water drops on a solid surface

This is my first semester term paper (co-authored with Katie Varland): bounce.pdf. It’s about water drops bouncing off hydrophobic surfaces. Yes, the premise sounds cool, and the shots we made with a high-speed camera are fascinating. The paper itself is descriptive rather than analytical, but an interesting boundary has been observed between a “splashing region” and a “bouncing region”: one where the drop stays in one piece, barely avoiding being split into small droplets, while most of its energy is converted into turbulent motion, thus leaving very little energy to bounce. Still frames to see towards the end of the paper!

Posted in Papers | Leave a comment

Images in LaTeX

Problem:
you can’t get those images to appear in a typeset document.
Cause:
pdflatex and latex have virtually no graphic drivers in common. For instance, pdflatex can’t handle eps files.
Solution:
I converted my eps files to pdf using a thing called epstopdf, which is included in latex distributions, and pdflatex handled those pdf graphs perfectly, so that the output was identical to that of eps with latex.
Posted in LaTeX, Tips & Tricks | Leave a comment