Skip to content →

Tag: wordpress

some smaller steps

It
always amazes me how much time I have to waste in trying to get
tech-stuff (such as this weblog) working the way I want. You will barely
notice it but again I spend too much time delving in PHP-scripts,
sometimes with minor success, most of the time almost wrecking this
weblog…

An example : it took me a day to figure out why
this page said there was just 1 visitor online whereas log files showed
otherwise. The PHP-script I used checked this by looking at the
IP-address via _REMOTE_ADDR_ which is perfectly OK on an ordinary
Mac OS 10.3 machine, but _not_ on an OS X-Server! For some reason
it gives as the REMOTE_ADDR just the IP address of the Server (that
is, lievenlb.local in this case) so whoever came by this page got
tagged as 143.129.75.209 and so the script thought there was just one
person around… The trivial way around it is changing every
occurence of REMOTE_ADDR by _HTTP_PC_REMOTE_ADDR_.
Easy enough but it took me a while to figure it out.

Another
example : over the week-end this weblog got a stalker! There were over
100 hits from 38.113.198.9, so whoever that is really liked this site
but didn't have time to read a thing… Again, the standard
solution is to ban the IP-address and most weblog-packages have such a
tool on their admin-page. But whathever I tried and Googled WordPress doesn't seem to have it
on board. There were a few hacks and plugins around claiming to do
something about it but none of them worked! So, I tried more drastic
actions such as editing .htaccess files which I thought would solve
everything (again, no problem under 10.3 but _not_ under
10.3-Server!). Once more, a couple of hours lost trying to figure out
how to get the firewall of a Mac-Server do what I needed. The upshot is
that I know now all dark secrets of the _ipfw_ command, so no
more stalking around this site…

In the process of
grounding my stalker, I decided that I needed better site-stats than my
homemade log-file provided. Fortunetely, this time I picked a package
that worked without too much hassle (one more time I had to make the
REMOTE_ADDR substitution but apart from that all went well). You will
see not too much of the power of this stats-package on the page (apart
from the global counter), I feel that such things are best forgotten
until something strange occurs (like stalkers, spammers and other
weirdos). A nice side-effect though was that for the first time I had a
look at _referring pages_, that is the URL leading to this weblog.
Lots of Google searches (some strange ones) but today there were also a
number of referrals from a Chinese blog. I checked it out and it turned
out to be the brand new Math is Math! Life is Life! weblog…

Another time
consuming thing was getting the BBC-news RSS feeds working in the
sidebar, so that you still get _some_ feel for reality while
being trapped here. I am not yet satisfied with the layout under
Explorer, but then everyone should move on to Safari (so I did give up
trying to work out the PHP-script).

But most time I wasted on
something that so far has left no trace whatsoever here. A plugin that
allows specific posts to be read only by registered users (of a certain
'level', that is WordPress can give users a level from 0 to 10
with specific degrees of freedom). But clearly at the same time I wanted
the rest of the world to have at least some indication of what they were
missing (such as a title with a nice padlock next to it) but so far I
didn't get it working. The only trace of a closed posting would be
in the sidebar-listing of the ten last posts but gives an error message
when an unauthorized user clicks on it. So, still a lot of
headache-sensitive work left to do, but it is about time to get back to
mathematics…

update (febr. 2007) : the
padlock-idea is abandoned.

Leave a Comment

quiver pictures in wordpress

Having

latexrender
available, one can edit the _class.latexrender.php_ file
to include additional LaTeX-packages. For example adding the lines

string .= '\usepackage{xy}\n';
string .= '\xyoption{all}\n';
string .= '\newcommand{\vtx}[1]{*+[o][F-]{\scriptscriptstyle #1}}\n';

makes it possible to include quiver-pictures in this weblog.
Observe the double blackslash before newcommand, a single backslash
would produce a new-line and fail to define something.

Leave a Comment

LatexRender plugin for wordpress under Panther

After
three days of desperate trial-and-error I seem to have managed to get latexrender working for
wordpress under Mac
OS X.
First things first : if you only want to include some
symbols in your blog-posts the easiest way to do so is to use mimetex and the
corresponding
wordpress-plugin
written by Steve Mayer. Follow the
instructions and you will be able to include a limited subset of LaTeX
in your blog within 10 minutes.
If you want more, you have to
work a lot harder. The starting point is to follow Steve’s
blog-entries on latexrender
.
But then under Mac OS X you will probably get error messages
when you activate the plugin. The reason seems to be that most versions
of imagemagick available for
OS X require X-terminal support and PHP gets confused between the two
shells. A typical error message is

Warning:
copy(70afbabac176169545d01f4bd91f3055.gif): failed to open
stream:
No such file or directory in
/Users/lieven/Sites/wordpress/latexrender/class.latexrender.php on
line
269

[Unparseable or potentially dangerous latex
formula. Error 6 ]

As suggested by Steve Mayer there are
two roads to obtain more information on what goes wrong. The first is to
uncomment the _unlink commands _ at the end of the
_class.latexrender.php_ file and look in the _wordpress/latexrender/tmp_
directory for which conversions were done and which failed. The normal
latexrender-procedure is : tex->dvi->ps->gif. Probably you will
get all files but the gifs!

Another (and more useful) source of
informations is to look in the _error-log_ of the Apache-WebServer and
see whether you get things like

This is dvips(k) 5.94a
Copyright 2003 Radical Eye Software (www.radicaleye.com)
\\’
TeX output 2004.08.30:1433\\’ ->
0d48700a5dde6d746813733d26dd8df8.ps

. [1]
sh: line 1:
gs: command not found
convert: no decode delegate for this image
format

/Users/lieven/Sites/weblog/latexrender/tmp/
0d48700a5dde6d746813733d26dd8df8.ps\\’.

convert: missing an image
filename/Users/lieven/Sites/weblog/latexrender/tmp/
0d48700a5dde6d746813733d26dd8df8.gif\\’.

identify: unable to
open image 0d48700a5dde6d746813733d26dd8df8.gif\\': No such file
or directory.
identify: missing an image
filename
0d48700a5dde6d746813733d26dd8df8.gif\\’.
`

Here the essential point is that the webserver doesn’t
seem to be able to find GhostScript (even if you have several versions
installed).

To bypass these problems I did two essential
things : (1) in the _class.latexrender.php_ file I rewrote the
conversions so as to use _pdflatex_ instead of tex (to get
immediately a pdf-file rather than the tex->dvi->ps process) and then
use _convert_ to translate this pdf-file into a gif-file. (2) the
version of _convert_ and _include_ (both part of the
ImageMagick package) are those provided by Fink but you should be extremely
careful to install the imagemagick-nox package and not
the imagemagick package! After the command
sudo fink
install imagemagick-nox

you are presented with several
configuration choices. Do _not_ choose on auto-pilot the default
choices but look for options specifying that there is no X-support!
After this, everything should work. If you want to have a look at how
I changed the PHP files, mail
me
.

Leave a Comment