Skip to content →

Tag: wordpress

The joys of running a WordPress blog

Earlier today, John Duncan (of moonshine fame) emailed he was unable to post a comment to the previous post:
“I went to post a comment but somehow couldn’t convince the website to cooperate.”

There’s little point in maintaining a self-hosted blog if people cannot comment on it. If you tried, you got this scary message:

Catchable fatal error: Object of class WP_Error could not be converted to string in /wp-includes/formatting.php on line 1031

The days I meddled with wordpress core php-files are long gone, and a quick Google search didn’t come up with anything helpful.

In despair, there’s always the database to consider.

Here’s a screenshot of this blog’s database in phpMyAdmin:

No surprise you cannot comment here, there isn’t even a wp_comments table in the database! (though surprisingly, there’s a table wp_commentmeta…)

Two weeks ago I moved this blog to a new iMac. Perhaps the database got corrupted in the process, or the quick export option of phpMyAdmin doesn’t include comments (unlikely), or whatever.

Here’s what I did to get things working again. It may solve your problem if you don’t have a backup of another wordpress-blog with a functional wp_comments table.

1. Set up a new WordPress blog in the usual way, including a new database, let’s call it ‘newblog’.

2. In phpMyAdmin drop all tables in newblog except for wp_comments.

3. Export your blog’s database, say ‘oldblog’, via the ‘quick export’ option in phpMyAdmin to get a file oldblog.sql.

4. If this file is small you can use phpMyAdmin to import it into newblog. If not you need to do it with this terminal-command

mysql -h localhost -u root – p newblog < oldblog.sql

and have the patience for this to finish.

5. Change in your wp-config file the oldblog database to newblog.

Happy commenting!

Leave a Comment

From WordPress to ePublishing (1)

Perhaps, the tips and tricks I did receive to turn a selection of wordpress-posts into a proper ePub-file may be of use to others, so I will describe the procedure here in some detail.

It makes a difference whether or not some of the posts contain TeX. This time, I’ll sketch the process for non-LaTeX posts and hence we will turn the Bourbaki-code posts into ePub-format to read on your iPad, rather than merely into a pdf-file as last time. Next time, I’ll add some tricks to repeat this when some of your posts do contain LaTeX.

1. Install the ePub export plugin

Get the epub export wordpress plugin, install and activate it in the usual way. ePub Export automatically creates an ePub file when a post or page is published or updated. The ePubs are stored in the uploads directory. For later use, remember that your uploads directories are located under BLOGHOME/wp-content/uploads.

2. Update the posts you want to include

Decide which posts you want to include in your eBook, edit them (or not) and press for each one of them the update-button. This will populate today’s uploads-directory with a number of epub-files. Transfer them all, for example using Transmit, to a directory on your home-computer, named say MyFirstEBook.



3. Unpack the epub-files

The crucial fact to remember about epub-files is that they are really zipped archives containing xhtml-, css- and other files and directories. As we want to edit some of those, we first have to unpack the directories. So, change the .epub extensions to .zip and double-click on them to create the directories.



The crucial files in each directory are preface.xhtml (containing title author and blog-name), text.html (containing the blog-post) and the images-directory (containing copies of all the images used in the post).

4. Rename the directories user-friendly

As all the posts will be chapters in our eBook in some specific order, we will rename the numbers of the directories to something more user-friendly such as shortened blog-titles. To do this, double-click in each of the directories on the preface.xhtml file. This will open Safari and will show the title of the blog-post. Use it to rename that directory. For convenience let us call the directory corresponding to the first chapter in our book MasterDirectory

5. Move all images to the master directory

For each of the other chapter-directories, drag all the files contained in the images-subdirectory to MasterDirectory/images.

6. Edit the MasterDirectory/text.xhtml file

Because we will have to open and copy-paste all the text.xhtml files of the different directories, it is perhaps best to rename momentarily the MasterDirectory/text.xhtml file to something like master.xhtml.

Now, open this file with a text-processor such as TextWrangler. Edit it to remove unwanted html-code (such as links to other posts at the start if you are using the series-plugin, or previous/next post links at the end). Also add the title of the blog-post between h1-tags (and if you want to include a table of contents later, give it an anchor-name).

Go to the directory of your second chapter, open that text.xhtml file and copy/paste only the post-content over to the master-xhtml file at the appropriate place. As before, add title/anchor before the copied post-content.

Repeat this procedure, in order, for all the chapters of your eBook.

Once finished, doubleclick the master.xhtml file and correct remaining errors (as it is an xhtml-file, it is rather picky about opening and closing tags) and see whether all your images are included. If you’re satisfied with it, rename the master.xhtml to text.xhtml (don’t forget this!).

7. Edit the MasterDirectory/preface.xhtml file

Open the preface.xhtml file and change the first blogpost-title to the title of your booklet, alter your name (by default it uses your wp-nick) and add a frontipiece-picture if you so desire.

8. Re-package the directory into an epub-file

This is the (only) tricky part. E-book readers require that the mimetype file is the first one in the zip document. What’s more, to be fully compliant, this file should start at a very specific point – a 30-byte offset from the beginning of the zip file (so that the mimetype text itself starts at byte 38).

Here’s how to do this on a Mac (Linux-users being the geeks they are will have given up on reading this post a while ago and as to Windows-users, yeah well …). Open Terminal.app and cd to your MasterDirectory. Now type:

zip -X MyFirstEBook.epub mimetype

Next, type:

zip -rg MyFirstEBook.epub * -x *.DS_Store

(of course you’ll have to change your book-title to whatever you want). If you want to know more about these 2 magical commands, read this post.

9. Edit metadata

Get Calibre and add the MyFirstEBook.epub to Calibre by clicking on the ‘Add Books’ button.



You can preview your eBook by clicking on the ‘View’-button. Next, click the ‘Edit metadata’-button and alter the title and author entries (and whatever else you want to include) and click the OK button. Then click ‘Save to disk’.

10. Read your eBook on your iPad

Finally, we want to see how it looks on the iPad. Mail MyFirstEBook.epub to yourself as attachement, open it with iBooks and enjoy!

Leave a Comment

changes (ahead)

In view or recents events & comments, some changes have been made or will be made shortly :

categories : Sanitized the plethora of wordpress-categories to which posts belong. At the moment there are just 5 categories : ‘stories’ and ‘web’ (for all posts with low math-content) and three categories ‘level1’, ‘level2’ and ‘level3’, loosely indicating the math-difficulty of a post.

MathJax : After years of using LatexRender and WP-Latex, we’ll change to MathJax from now on. I’ll try to convert older posts as soon as possible. (Update : did a global search and replace. ‘Most’ LaTeX works, major exceptions being matrices and xymatrix commands. I’ll try to fix those later with LatexRender.)

theme : The next couple of days, the layout of this site may change randomly as I’ll be trying out things with the Swift wordpress theme. Hopefully, this will converge to a new design by next week.

name : Neverendingbooks will be renamed to something more math-related. Clearly, the new name will depend on the topics to be covered. On the main index page a pop-up poll will appear in the lower right-hand corner after 10 seconds. Please fill in the topics you’d like us to cover (no name or email required).

This poll will close on friday 21st at 12 CET and its outcome will influence name/direction of this blog. Use it also if you have a killer newname-suggestion. Among the responses so far, a funnier one : “An intro to, or motivation for non-commutative geometry, aimed at undergraduates. As a rule, I’d take what you think would be just right for undergrads, and then trim it down a little more.”

guest-posts : If you’d like to be a guest-blogger here at irregular times, please contact me. The first guest-post will be on noncommutative topology and the interpretation of quantum physics, and will appear soon. So, stay tuned…

2 Comments

NeB : 7 years and now an iPad App

Exactly 7 years ago I wrote my first post. This blog wasn’t called NeB yet and it used pMachine, a then free blogging tool (later transformed into expression engine), rather than WordPress.

Over the years NeB survived three hardware-upgrades of ‘the Matrix’ (the webserver hosting it), more themes than I care to remember, and a couple of dramatic closure announcements…

But then we’re still here, soldiering on, still uncertain whether there’s a point to it, but grateful for tiny tokens of appreciation.

Such as this morning’s story: Chandan deemed it necessary to correct two spelling mistakes in a 2 year old Fun-math post on Weil and the Riemann hypothesis (also reposted on Neb here). Often there’s a story behind such sudden comments, and a quick check of MathOverflow revealed this answer and the comments following it.

I thank Ed Dean for linking to the Fun-post, Chandan for correcting the misspellings and Georges for the kind words. I agree with Georges that a cut&copy of a blogpost-quoted text does not require a link to that post (though it is always much appreciated). It is rewarding to see such old posts getting a second chance…

Above the Google Analytics graph of the visitors coming here via a mobile device (at most 5 on a good day…). Anticipating much more iPads around after tonights presents-session I’ve made NeB more accessible for iPods, iPhones, iPads and other mobile devices.

The first time you get here via your Mac-device of choice you’ll be given the option of saving NeB as an App. It has its own icon (lowest row middle, also the favicon of NeB) and flashy start-up screen.

Of course, the whole point trying to make NeB more readable for Mobile users you get an overview of the latest posts together with links to categories and tags and the number of comments. Sliding through you can read the post, optimized for the device.

I do hope you will use the two buttons at the end of each post, the first to share or save it and the second to leave a comment.

I wish you all a lot of mathematical (and other) fun in 2011 :: lieven.

3 Comments

WikiLeaks’ collateral damage : web-anarchy?

NeB’s web-stats are orders of magnitude out of normal behavior, something must be going on…

  • Spam filter : normally between 10 and 20 spam-comments are trapped. They are removed automatically every 14 days so I only look at them when someone complains a valid comment didn’t get through. This moment, there are 1007 spam-comments held (already 1020 by the time I post this).
  • Akismet-plugin : for those who don’t run a blog, Akismet is an extremely useful WordPress-plugin getting rid of most spam-comments (before entering the spam-filter). I must admit I don’t check Akismet-stats regularly but today the message reads : ‘Akismet has protected your site from 104,145 spam comments already’ (which is about 10% of all visits…).
  • Mail-notifications : this week my email-account is bombarded with spam-comments to approve. Usually there are 1 to 2 such comments a week, now about 20 a day. Part of the problem was that the Akismet-servers were obstructed earlier this week, but the problem persists.
  • Today’s stats show more than 4000 hits, 500 uniques. About 3 times average.

Do we all really need to get caught in the cross-fire between WikiLeaks- and government-hackers?

I have no intention to post my take on WikiLeaks, simply because it won’t be original. As to Assange’s problems with justice : until further evidence comes to light I’m with Naomi Wolf on this (thanks Kea for the link).

If NeB goes off-line for a while, you know why…

One Comment

Link problems : Markdown versus latex2wp.py

As John Baez (and hopefully others) noticed most links here on NeB are now screwed up.

For years I’ve used the Markdown syntax to include links in posts (that is something like [this is what you see](and here is the URL)). NeB used an older version ( Version 1.0.1k) of php Markdown to convert these to proper links (as I did have problems with the newer version).

Ever since the Return to LaTeX post, I’m trying to re-educate myself to write posts in LaTeX and convert them into wp-format using the Latex2WP python script.

Unfortunately this script doesn’t go together nicely with the Markdown-syntax, forcing me to go over the converted latex-file almost line by line fixing errors in order to be able to post. Not the time-saver I had in mind…

I hope to post a lot of new material once the semester finishes and therefore disabled the Markdown-plugin. This causes all links to remain in Markdown-format, which is a nuisance but, if you really want to follow the link it is still there for you to copy-paste. Depending on how exciting the christmas-break will be I’ll try to hard-code the links in some of the more popular posts.

If someone knows of an elegant solution, such as a micro-markdown wp-plugin only parsing links, please drop a comment.

UPDATE : I have downloaded the Markdown quicktags plugin. It replaces the standard HTML-editor of WordPress with a Markdown-editor. There is an option “Render” which transforms Markdown to HTML and then updating the post will save the HTML-version. This looks like a relative quick way to get my old post-links back. So far, I’ve rescued the posts of the last year, more later. Hopefully, this causes no overload in your RSS-aggregator…

3 Comments

NeB not among 50 best math blogs

Via Tanya Khovanova I learned yesterday of the 50 best math blogs for math-majors list by OnlineDegree.net. Tanya’s blog got in 2nd (congrats!) and most of the blogs I sort of follow made it to the list : the n-category cafe (5), not even wrong (6), Gowers (12), Tao (13), good math bad math (14), rigorous trivialities (18), the secret blogging seminar (20), arcadian functor (28) (btw. Kea’s new blog is now at arcadian pseudofunctor), etc., etc. . Sincere congrats to you all!

NeverEndingBooks didn’t make it to the list, and I can live with that. For reasons only relevant to myself, posting has slowed down over the last year and the most recent post dates back from february!

More puzzling to me was the fact that F-un mathematics got in place 26! OnlineDegree had this to say about F-un Math : “Any students studying math must bookmark this blog, which provides readers with a broad selection of undergraduate and graduate concerns, quotes, research, webcasts, and much, much more.” Well, personally I wouldn’t bother to bookmark this site as prospects for upcoming posts are virtually inexistent…

As I am privy to both sites’ admin-pages, let me explain my confusion by comparing their monthly hits. Here’s the full F-un history



After a flurry of activity in the fall of 2008, both posting and attendance rates dropped, and presently the site gets roughly 50 hits-a-day. Compare this to the (partial) NeB history



The whopping 45000 visits in january 2008 were (i think) deserved at the time as there was then a new post almost every other day. On the other hand, the green bars to the right are a mystery to me. It appears one is rewarded for not posting at all…

The only explanation I can offer is that perhaps more and more people are recovering from the late 2008-depression and do again enjoy reading blog-posts. Google then helps blogs having a larger archive (500 NeB-posts compared to about 20 genuine Fun-posts) to attract a larger audience, even though the blog is dormant.

But this still doesn’t explain why FunMath made it to the top 50-list and NeB did not. Perhaps the fault is entirely mine and a consequence of a bad choice of blog-title. ‘NeverEndingBooks’ does not ring like a math-blog, does it?

Still, I’m not going to change the title into something more math-related. NeverEndingBooks will be around for some time (unless my hard-disk breaks down). On the other hand, I plan to start something entirely new and learn from the mistakes I made over the past 6 years. Regulars of this blog will have a pretty good idea of the intended launch date, not?

Until then, my online activity will be limited to tweets.

4 Comments

Return to LaTeX

To most mathematicians, a good LaTeX-frontend (such as TeXShop for Mac-users) is the crucial tool to get the work done. We use it to draft ideas, write papers and courses, or even to take notes during lectures.

However, after six years of blogging, my own LaTeX-routine became rusty. I rarely open a new tex-document, and when I do, I’d rather copy-paste the long preamble from an old file than to start from scratch with a minimal list of packages and definitions needed for the job at hand. The few times I put a paper on the arXiv, the resulting text resembles a blog-post more than a mathematical paper, here’s an example.

As I desperately need to get some math-writing done, I need to pull myself away from the lure of an ever-open WordPress admin browser-screen and reacquaint myself with the far more efficient LaTeX-environment.

Perhaps even my blogging will benefit from the change. Whereas I used to keep on adding to most of my tex-files in order to keep them up-to-date, I rarely edit a blog-post after hitting the ’publish’ button. If I really want to turn some of my better posts into a book, I need them in a format suitable for neverending polishing, without annoying the many RSS-feed aggregators out there.

Who better than Terry Tao to teach me a more proficient way of blogging? A few days ago, Terry announced he will soon have his 5th (!!) book out, after three years of blogging…

How does he manage to do this? Well, as far as I know, Terry blogs in LaTeX and then uses a python-script called LaTeX2WP ’a program that converts a LaTeX file into something that is ready to be cut and pasted into WordPress. This way, you can write, and preview, your post in LaTeX, then run LaTeX2WP, and post into WordPress whatever comes out.’ More importantly, one retains a pure-tex-file of the post on which one can keep on editing to get it into a (book)-publishable form, eventually.

Nice, but one can do even better, as Eric from Curious Reasoning worked out. He suggests to install two useful python-packages : WordPressLib “with this library you can control remotely a WordPress installation. Use of library is very simple, you can write a small scripts or full applications that allows you to automate publishing of articles on your blog/site powered by WordPress” and plasTeX “plasTeX is a LaTeX document processing framework written entirely in Python. It currently comes bundled with an XHTML renderer (including multiple themes), as well as a way to simply dump the document to a generic form of XML”. Installation is easy : download and extract the files somewhere, go there and issue a **sudo python setup.py install** to add the packages to your python.

Finally, get Eric’s own wplatex package and install it as explained there. WpLaTeX has all the features of LaTeX2WP and much more : one can add titles, tags and categories automatically and publish the post from the command-line without ever having to enter the taboo WordPress-admin page! Here’s what I’ve written by now in TeXShop

I’ve added the screenshot and the script will know where to find it online for the blog-version as well as on my hard-disk for the tex-version. Very handy is the iftex … fi versus ifblog … fi alternative which allows you to add pure HTML to get the desired effect, when needed. Remains only to go into Terminal and issue the command

wplpost -x http://www.neverendingbooks.org/xmlrpc.php ReturnToLatex.tex

(if your blog is on WordPress.com it even suffices to give its name, rather than this work-around for stand-alone wordpress blogs). The script asks for my username and password and will convert the tex-file and post it automatic.

5 Comments

Snow leopard + wordpress + latex problem

Ever since I’ve upgraded to Snow Leopard I’ve been having problems with the webserver.

At first there were the ‘obvious’ problems : mysql-connection lost and php-error message. These were swiftly dealt with using the excellent Snow Leopard, Apache, PHP, MySQL and WordPress! advice from ‘tady’.

Right now, access to this blog is extremely slow (and often impossible), certainly via the admin-page. The problem appears to be that most of my CPU is used by lots of pdfetex-processes owned by www. Hence the conjecture that it is a problem with either LaTeXRender or WP LaTeX.

Anyone experiencing a similar problem, or knowing a trick to resolve it? Takk.

Leave a Comment

Grothendieck’s functor of points

A comment-thread well worth following while on vacation was Algebraic Geometry without Prime Ideals at the Secret Blogging Seminar. Peter Woit became lyric about it :

My nomination for the all-time highest quality discussion ever held in a blog comment section goes to the comments on this posting at Secret Blogging Seminar, where several of the best (relatively)-young algebraic geometers in the business discuss the foundations of the subject and how it should be taught.

I follow far too few comment-sections to make such a definite statement, but found the contributions by James Borger and David Ben-Zvi of exceptional high quality. They made a case for using Grothendieck’s ‘functor of points’ approach in teaching algebraic geometry instead of the ‘usual’ approach via prime spectra and their structure sheaves.

The text below was written on december 15th of last year, but never posted. As far as I recall it was meant to be part two of the ‘Brave New Geometries’-series starting with the Mumford’s treasure map post. Anyway, it may perhaps serve someone unfamiliar with Grothendieck’s functorial approach to make the first few timid steps in that directions.

Allyn Jackson’s beautiful account of Grothendieck’s life “Comme Appele du Neant, part II” (the first part of the paper can be found here) contains this gem :

“One striking characteristic of Grothendieck’s
mode of thinking is that it seemed to rely so little
on examples. This can be seen in the legend of the
so-called “Grothendieck prime”.

In a mathematical
conversation, someone suggested to Grothendieck
that they should consider a particular prime number.
“You mean an actual number?” Grothendieck
asked. The other person replied, yes, an actual
prime number. Grothendieck suggested, “All right,
take 57.”

But Grothendieck must have known that 57 is not
prime, right? Absolutely not, said David Mumford
of Brown University. “He doesn’t think concretely.””

We have seen before how Mumford’s doodles allow us to depict all ‘points’ of the affine scheme $\mathbf{spec}(\mathbb{Z}[x]) $, that is, all prime ideals of the integral polynomial ring $\mathbb{Z}[x] $.
Perhaps not too surprising, in view of the above story, Alexander Grothendieck pushed the view that one should consider all ideals, rather than just the primes. He achieved this by associating the ‘functor of points’ to an affine scheme.

Consider an arbitrary affine integral scheme $X $ with coordinate ring $\mathbb{Z}[X] = \mathbb{Z}[t_1,\ldots,t_n]/(f_1,\ldots,f_k) $, then any ringmorphism
$\phi~:~\mathbb{Z}[t_1,\ldots,t_n]/(f_1,\ldots,f_k) \rightarrow R $
is determined by an n-tuple of elements $~(r_1,\ldots,r_n) = (\phi(t_1),\ldots,\phi(t_n)) $ from $R $ which must satisfy the polynomial relations $f_i(r_1,\ldots,r_n)=0 $. Thus, Grothendieck argued, one can consider $~(r_1,\ldots,r_n) $ an an ‘$R $-point’ of $X $ and all such tuples form a set $h_X(R) $ called the set of $R $-points of $X $. But then we have a functor

$h_X~:~\mathbf{commutative rings} \rightarrow \mathbf{sets} \qquad R \mapsto h_X(R)=Rings(\mathbb{Z}[t_1,\ldots,t_n]/(f_1,\ldots,f_k),R) $

So, what is this mysterious functor in the special case of interest to us, that is when $X = \mathbf{spec}(\mathbb{Z}[x]) $?
Well, in that case there are no relations to be satisfied so any ringmorphism $\mathbb{Z}[x] \rightarrow R $ is fully determined by the image of $x $ which can be any element $r \in R $. That is, $Ring(\mathbb{Z}[x],R) = R $ and therefore Grothendieck’s functor of points
$h_{\mathbf{spec}(\mathbb{Z}[x]} $ is nothing but the forgetful functor.

But, surely the forgetful functor cannot give us interesting extra information on Mumford’s drawing?
Well, have a look at the slightly extended drawing below :



What are these ‘smudgy’ lines and ‘spiky’ points? Well, before we come to those let us consider the easier case of identifying the $R $-points in case $R $ is a domain. Then, for any $r \in R $, the inverse image of the zero prime ideal of $R $ under the ringmap $\phi_r~:~\mathbb{Z}[x] \rightarrow R $ must be a prime ideal of $\mathbb{Z}[x] $, that is, something visible in Mumford’s drawing. Let’s consider a few easy cases :

For starters, what are the $\mathbb{Z} $-points of $\mathbf{spec}(\mathbb{Z}[x]) $? Any natural number $n \in \mathbb{Z} $ determines the surjective ringmorphism $\phi_n~:~\mathbb{Z}[x] \rightarrow \mathbb{Z} $ identifying $\mathbb{Z} $ with the quotient $\mathbb{Z}[x]/(x-n) $, identifying the ‘arithmetic line’ $\mathbf{spec}(\mathbb{Z}) = { (2),(3),(5),\ldots,(p),\ldots, (0) } $ with the horizontal line in $\mathbf{spec}(\mathbb{Z}[x]) $ corresponding to the principal ideal $~(x-n) $ (such as the indicated line $~(x) $).

When $\mathbb{Q} $ are the rational numbers, then $\lambda = \frac{m}{n} $ with $m,n $ coprime integers, in which case we have $\phi_{\lambda}^{-1}(0) = (nx-m) $, hence we get again an horizontal line in $\mathbf{spec}(\mathbb{Z}[x]) $. For $ \overline{\mathbb{Q}} $, the algebraic closure of $\mathbb{Q} $ we have for any $\lambda $ that $\phi_{\lambda}^{-1}(0) = (f(x)) $ where $f(x) $ is a minimal integral polynomial for which $\lambda $ is a root.
But what happens when $K = \mathbb{C} $ and $\lambda $ is a trancendental number? Well, in that case the ringmorphism $\phi_{\lambda}~:~\mathbb{Z}[x] \rightarrow \mathbb{C} $ is injective and therefore $\phi_{\lambda}^{-1}(0) = (0) $ so we get the whole arithmetic plane!

In the case of a finite field $\mathbb{F}_{p^n} $ we have seen that there are ‘fat’ points in the arithmetic plane, corresponding to maximal ideals $~(p,f(x)) $ (with $f(x) $ a polynomial of degree $n $ which remains irreducible over $\mathbb{F}_p $), having $\mathbb{F}_{p^n} $ as their residue field. But these are not the only $\mathbb{F}_{p^n} $-points. For, take any element $\lambda \in \mathbb{F}_{p^n} $, then the map $\phi_{\lambda} $ takes $\mathbb{Z}[x] $ to the subfield of $\mathbb{F}_{p^n} $ generated by $\lambda $. That is, the $\mathbb{F}_{p^n} $-points of $\mathbf{spec}(\mathbb{Z}[x]) $ consists of all fat points with residue field $\mathbb{F}_{p^n} $, together with slightly slimmer points having as their residue field $\mathbb{F}_{p^m} $ where $m $ is a divisor of $n $. In all, there are precisely $p^n $ (that is, the number of elements of $\mathbb{F}_{p^n} $) such points, as could be expected.

Things become quickly more interesting when we consider $R $-points for rings containing nilpotent elements.

Leave a Comment