Testing latex

No, not the rubber stuff; the math stuff. According to the WP codex, it should be as simple as this:

$latex i\hbar\frac{\partial}{\partial t}\left|\Psi(t)\right>=H\left|\Psi(t)\right>$

OK, so that doesn't work :\. Ah right, that's just for when you have the blog under the wordpress.org itself. Right … mimetex then.

* finds wp-latexrender.zip here.

* looks for install procedure.

* looks for clear install procedure.

* tries the install anyway.

* reads the mimetex.php in full because while everyone says to update the path directories, it's unclear what to set them to especially as they seem to be double.

* sighs and rewrites the whole function because the variables and how they are used are … silly.


Right. How about this then: "[tex]x^2+y^2[/tex]"?

x^2+y^2

Yaaay! :D. And now for some more interesting forms:

E = mc^2 \label{clever}

OK, so apparently I can't put the labels into mimetex. Let's see what else will and will not work ...

\lim_{n \to \infty}\sum_{k=1}^n \frac{1}{k^2} = \frac{\pi^2}{6}

Okay ... so the default version doesn't like newlines either. So let's tweak the formula so that all whitespace (and repeated white) it replaced by a single space ... '/\s+/ /g' should do the trick.

\LARGE\tilde y=\left\{ {\ddot x\text{ if $\vec x$ odd}\atop\hat{\,\bar x+1}\text{ if even}}\right.
\small\hspace{10}\unitlength{.75} \picture(120,220){~(60,200){\circle(120,40)}~(0,20){\line(0,180)} (5,189;0,-30){\pict(110,20){(c20,10;70;2){ \pict(40,20){(20,10){\circle(40,20)}(c10,10)+(c30,10)-}}~}~} (119,20){\line(0,180)}~(60,20){\circle(120,40;34)}}
\bold C( \theta, \phi) = \bold R_y(\phi) \cdot \bold R_x(\theta) = \begin{bmatrix} \cos (\phi) & \sin(\phi) \sin(\theta) & -\sin(\phi) \cos(\theta)\\ 0 & \cos(\theta) & \sin(\theta) \\ \sin(\phi) & -\cos(\phi)\sin(\theta) & \cos(\phi)\sin(\theta) \end{bmatrix}

And to try some inline stuff: m \vec{a} = -k \vec{x} . Or maybe m \vec{a} = -k \vec{x} for something a little smaller. Yay, that works as well.

Anyway, for anyone who also wants math on their site, you can get mimetex from from http://www.forkosh.com/mimetex.html. Although the site starts with the source, there are precompiled binaries in the back somewhere. I would recommend rewriting mimetex.php, though: I found it somewhat tricky to get it working. It relies on 4 paths, but it doesn't exactly say what they were supposed to represent or what they should be set to; when I tried it locally the only way to get them to work was to do stuff that had little relation to the fill-in-the-blanks parts of the paths.

It doesn't like whitespace either in or around the formula, so removing that can be useful; so is feeding the through rawurlencode() if you want to put it into the url: HTMLTidy really doesn't like all the backslashes and stuff in the url. Adding options to the [tex] tag is also a good idea (like size; see above). And what's especially useful is a preview mode that doesn't render to a file. That way you won't be left with hundreds of little temporary bitmaps for all the failed variants. (I suppose I could give you mine, but it's not finished yet.)

Lastly, if you're new to TeX, consider using this site as an editor. There is a larger manual on the mimetex maintainer's site, but this little tool is very useful.

computing, costs and caching, oh my

Via coding horror, I stumbled upon a simply wonderful talk by Herb Sutter about various performance issues like how much operations cost. It also discusses how memory, latency and machine architecture can affect that cost how this has changed over the years. You can find the slides and a video of the presentation at http://nwcpp.org/Meetings/2007/09.html.

Be prepared for a total geek-out. This is highly technical (and awesome, but that's bordering on a tautology) stuff and probably not for the faint of heart. Slides 6 and 7, for example, around the 23m mark) show the value of cache compared to getting something from RAM, and just how bad retrieval from disk is. Later (slides 13 and on; around 55m in the video), when it comes to threads and how a compiler or even hardware may screw you over not do what you want to do, or even what you tell it to do, people how still have them are allowed to run to their moms for safety. By Patina, that is just nasty.

Near the end Sutter discusses the differences between using vectors, lists and sets and what the penalties for the latter are for something as simple add adding all the values in them. This starts at around slide 22, or 1h40m. Even if the rest is gobblyjook, this part is easy to understand. Basically, low footprint and sequential accesses are Good Things, even if you have cache and stuff. Especially when you have cache and stuff.

Tonc:setup update

Finally got round to updating Tonc's dev setup page. It finally mentions devkitPro's template makefiles and the basics of how to use them. I've also added a list of potential problems you may encounter when installing/upgrading devkitARM or just building projects. I have not updated the downloadables yet because there's still a few unfinished edits there. I just wanted to get this one out of the way because it's so very, very overdue.

Little Rocket Man

For those familiar with Half-Life 2 Ep 2, you may have noticed the achievement list. Many of these are easy to do even on a first run, but there are three in particular that take some effort: “Neighborhood Watch”, “Little Rocket Man” and “Get Some Grub”. The requirement for the second really is somewhat mind-boggling: yes, it really means getting the garden gnome you find in the first building aaaaalll the way to the rocket in the White Forest base at the end. This seems insane – it is insane. But I finally managed it:



For others attempting this: the only really taxing part is across the train-tracks with that damn chopper on your tail. My strategy was to carry the gnome to safe-points first by hiding under the wagons, then going back for the car. In the second leg, the chopper will at the base once you get close enough; you can use this to secure safe passage. Also, once inside the garage do not leave the gnome on the table: the table will disappear when you get back from the auto-gun, apparently taking the gnome with it. Once you reach the rocket, close the hatch yourself! This is also part of the requirement. The rest is mostly getting out of the car because there's no gnome-sized seatbelts, although I hear there's a way to get it stuck in the rear window somehow.

With that done, I only need the Grub achievement for the whole set. I missed eight of them. Eight! Out of 333! :(