Jan 26, 2015

Migration from Wordpress

Finally made the move.

This site as you see now is hosted on Amazon S3, statically. It is always reachable, and no spike is going to bring it down. In short, one less thing to worry.

Google will show dozens of how-tos on Wordpress migration. Any way let's document the process. One more success story doesn't hurt.

The Migration

1) Convert Wordpress exported xml file into markdown formats. We use the tool wp4md. The output is a folder containing pages and posts. Every markdown file has tags in beginning, including critical information like the original link, created date. They are very easy to parse.

wp4md -d myblog  <wordpress-dump.xml>

2) It's up to you to convert those markdown files into html. Everyone has unique taste, and it shouldn't be hard to build customized one, given so many powerful script languages and packages.

3) Register a Disqus account. We are not going into details, but basically what you need to do is:

  1. Import that same xml dump;
  2. Provide a csv file to map old urls to new urls. This could be done programatically using the tags in markdown files. When you're done, upload that file to the Disqus website.

4) Redirect the old links. You don't want Google search results pointing to an unusable link, so you need to map those old links to new locations. Normally you should do that with a web server like nginx, but we are now on a static host. It may be possible to use redirect rules provided by Amazon S3, however, I don't really have the time to learn those rules, when we could simply do it with javascript.

Suppose a page was at

Now it's changed to

Then in index.html, we only need to do a check:

var urlmap = {
var pathQuery = window.location.pathname +;
if (urlmap[pathQuery]) {
    window.location = urlmap[pathQuery];

That's it.

Aug 17, 2014

Update: AEMULA 2.0 for Android

AEMULA 2.0 for android is now available on Google Play.

When we built the first version of AEMULA for Android, it's more like of a proof of concept. We just wanted to make sure the emulation engine works on the platform. Although we had some updates since then, they were mostly engine related improvements.

Still I always felt that we need to improve its usability as well. Recently I finally got the ideas of how to improve it, and the time to actually do it. Here are the results of recent effort:

Apr 25, 2014

New Dropbox sync for TeX Writer

Once I worked on a project, I spotted a code section like this:

[text replaceOccurrencesOfString:@"&" withString:@"&amp;"
    options:NSLiteralSearch range:NSMakeRange(0, text.length)];
[text replaceOccurrencesOfString:@"<" withString:@"&lt;"
    options:NSLiteralSearch range:NSMakeRange(0, text.length)];
[text replaceOccurrencesOfString:@">" withString:@"&gt;"
    options:NSLiteralSearch range:NSMakeRange(0, text.length)];

Then I thought -- without much thinking -- that we should get rid of repetitious code, so it became

NSRange fullRange = NSMakeRange(0, text.length);
[text replaceOccurrencesOfString:@"&" withString:@"&amp;"
    options:NSLiteralSearch range:fullRange];
[text replaceOccurrencesOfString:@"<" withString:@"&lt;"
    options:NSLiteralSearch range:fullRange];
[text replaceOccurrencesOfString:@">" withString:@"&gt;"
    options:NSLiteralSearch range:fullRange];

Of course this is a horrible mistake, because the length of text changes over  time. It's basically like saying because x + x = 2x, so that 1 + 1 = 21. Carelessly refactoring working code is both dangerous and expensive, let alone code rewriting. I was fully aware of the cost, at the beginning of April, when I decided to rewrite Dropbox sync code in TeX Writer from scratch. It's a tough decision to make, because you had to throw away all the tests and fixes that went along with the original code. However, two negative reviews in the App Store (they lost changes after sync) helped me make the final decision. We need a solution that will never overwrite people's work no matter what happens, and the previous solution just isn't strong enough. Today, the rewrite is finished and we have done various tests, especially when conflict happens. We hope to release it soon, but at the same time, if you want to help beta test, please let us know!

Jan 30, 2014

TeX Writer and TeX Equation Release Notes

Recently we have updated both TeX Writer and TeX Equation. Now they share a same compilation core. This will make our future update much easier. For TeX Writer, we add a spell checker. You can enable it from TeX Writer settings by selecting a spell dictionary. Instead of putting all dictionaries in the app, we have a list of dictionaries on the cloud so you can pick the ones you need and install in your device. In this way, we can keep the app package as small as possible. The philosophy behind is that the users should not be forced to download anything he/she doesn't need. The TeX editor inside TeX Writer also highlights formulas between a pair of $, such as $x_1$. By default it is shown in red, but you can use the following command in twinit.l to redefine:

(set-string-color <red> <green> <blue> 1)

red/green/blue are numbers in range 0 to 1.0. TeX Equation now offers three ways to get the equation images out:

  1. Copy as PDF. Most recommended way. Keeps high resolution.
  2. Copy as PNG. Retina resolution, transparent background.
  3. Export to album as JPEG. Retina resolution, no transparency. Too bad iOS doesn't offer a way to save PNG to album.
Dec 13, 2013

Upcoming: TeX Writer as a Web App

It's time to bring TeX Writer to browser, so that users can edit their documents even without their tablets around. It will be free for editing only. If you want to compile it online, we'll provide paid online compilation (monthly/annually subscription). All files are still saved in your Dropbox folder.We won't save a copy of your files on our server. For compilation purpose, the server will download necessary files. These files will be deleted after a short period (no more than a few hours). If everything goes well, the launch time will be early January 2014. Please let us know if you are interested. We may be able to offer limited time PRO accounts (with online compiler, online pdf review) for early users.

Update: web app is available now!