Matrix I/O in PHP 5.3

Inspired by the Grid Computing challenge at Code Golf, I came up with a couple of useful functions for reading and writing matrices in PHP 5.3

{[.matrix | 1.hilite(=php=)]}

Here is a demo page

{[.demo | 1.hilite(=php=)]}

whose result is

 

$input = ' A, B, C, D, E FFF, G, H, I, J K, L, MM, N, P Q, R, S, T, UUUU VVVVV, W, X, Y, Z ';
$output = ' A, B, C, D, E FFF, G, H, I, J K, L, MM, N, P Q, R, S, T, UUUU VVVVV, W, X, Y, Z ';
$output === $input

After uncommenting the transposition line, the result is

 

$input = ' A, B, C, D, E FFF, G, H, I, J K, L, MM, N, P Q, R, S, T, UUUU VVVVV, W, X, Y, Z ';
$output = ' A, FFF, K, Q, VVVVV B, G, L, R, W C, H, MM, S, X D, I, N, T, Y E, J, P, UUUU, Z ';
$output !== $input

WordPress on Chrome has the messiest editing bug

I found this bug recently, and there seems to be very little evidence of it in Internet.

I have the last versions of WordPress, Chrome, and WinXP. When editing a post in Visual mode, if I write normal text, all is well, and if I change to HTML mode and back to Visual, all is fine too. But if I click the bullet list (or number list) button in a paragraph, the bug is reproduced: the path at the left bottom corner of the editing box says “Path: ul li span”.

This additional span has a style that sets the size of the font to 13.3333px !!

The formatting, as seen in the HTML mode, is:

And if I undo the bullet list (or number list), it becomes:

The real nasty things about this bug are:

  1. It doesn’t show up in Firefox (the most common default browser among web developers)
  2. It’s pretty common, but almost nobody noticed it
  3. It shows up when doing/undoing a bullet list or a number list
  4. The bug adds ghost spans, one per item, that you must remove manually (like in the following entry)
  5. And manually means manually in HTML mode, because in Visual mode, the “Remove formatting” button usually removes too much formatting
  6. The bug is so strong that if you remove the ghost spans and then undo a list, the same number of ghost spans are added back again
  7. If you don’t remove the garbage as you go, it gets messier and messier, because the ghost spans start to appear also where never there has been a list
  8. I wasn’t able to find where the bug comes from: a search of all WordPress code returns nothing interesting

I’ll look at my theme and plugins code.

For now, it’s a filed bug.

Wrong Assumptions

A couple of weeks ago I needed a mind mapping software and tried some of the free packages.

Xmind was the best one for me. I really liked the fact that with very little effort I got good looking maps.
This allows me to concentrate on the domain concepts I’m trying to model instead of representation details.

When opening Xmind today, I’ve been notified of a new version (3.2.0), so I downloaded and installed it. After opening Xmind again, I found that my English application had turned to Spanish. Spanish translations use to be very bad (and this is not an exception), so I prefer English ones.

Well, I thought, no problem, I’ll go for the config option and change the app back to English. But there is no config option!! So I went back to the site to find out what was going on. In the download page they say:

Every package now contains 7 language packs, English English, GermanGerman, French French, Spanish Spanish, Japanese Japanese, Chinese(Simplified) Chinese(Simplified), and Chinese(Traditional) Chinese(Traditional). XMind will choose language automatically to fit your OS’s settings. Changing your OS’s language settings will change XMind too.

That’s unbelievable!! Do I need to change a global option for changing a local one?

So, here goes my hack, for getting back to English.

  • Edit the file (Xmind folder) configuration org.eclipse.equinox.simpleconfigurator bundles.info and comment out any line that refers to a Spanish translation (containing nl_es).

    Notepad++ Replace dialog for Xmind language hack

When you restart Xmind, English is back.