[How To Guide] Wiki2Touch: The definitive installation guide for FW 3.1.2
Wiki2Touch is an *offline* Wikipedia reader originally developed by Tom Haukup for the 1st gen/2G iphone to work on FW 1.x., and provides access to Wikipedia’s articles at any time *without* an internet connection as you will have downloaded and installed the *entire* Wikipedia database on your iphone.
I have personally used Wiki2touch ever since it came out and have successfully installed it on FW’s 1.3, 1.4, 2.0, 3.0 and now, 3.1.2. In fact, I would have thrown away my 2G iphone a long time ago if it wasn’t for this software; as far as I am concerned it gives me the worlds' knowledge at my fingertips. Unfortunately when FW 3.0 came out the original software would not work, so people developed the so-called “wikisrvd dirty-hack” as a run around: you no longer had a stand-alone wiki2touch icon on your springboard; instead, the required server was installed, and you then simply opened the safari browser to the localhost address to access the Wikipedia database. This guide will show you how to install this latest version of Wiki2touch Server so you can access the Wikipedia database directly via the localhost address in the safari browser.
I have carried out this process on my 1st gen/2G iphone, but I am told it works on ipod touch, iphone 3G and 3GS. Also, note that there are many ways to transfer/manipulate files to and from the iphone; I am just showing you my preferred method. I did all this on my laptop running Windows 7 but should work fine for XP/Vista as well.
Finally, a big thank you goes out to all the wonderful people who have used this guide, especially to pol3m, tjblack, and pereirdp
II. SOFTWARE AND FILES YOU NEED
A. Software you need on your iphone:
1. SBSettings [Install from Cydia] (you should have this anyway)
2. Wiki2Touch SBSettings Toggle [Install from Cydia] Allows you to turn on/off the wiki2touch server. Once installed, go to SB Settings, choose “more” in the menu, choose “set toggles”, and turn “Wiki2Touch” on. The button will now appear in SB Settings and you can press it to turn it on (green color)
3. afc2add [Install from Cydia]. If you used Blackra1n to activate/jailbreak/unlock your 3.1.2 iphone, it does not install the afc2 service needed for the USB connection by iphone Folders/iphone Explorer (see Part B below). Therefore, if you used blackra1n, install afc2add from Cydia.
4. Wiki2Touch Server (v1.1.20091028) (2/27/10) [Install from Cydia] (This is the latest wikisrvd hack that has been updated to support databases >4GB)
B. Software you need on your computer
1.Install either (i) Iphone Folders (Windows only) OR (ii) iPhone Explorer (Windows and Mac). Either one of these programs will allow you to add/edit/delete files on your iphone from your PC via a simple drag-and-drop process. Just connect your iphone to a USB port on your PC and you're ready to go. I have personally used iphone folders and it has a decent transfer rate. Download (i) iphonefolders (Windows 32bit) or (ii) iphone explorer (Windows 32/64 bit and Mac)
2.Wiki2touch Utilities: This is a collection of programs that allow you to index the Wikipedia articles and associated images/pictures so that they can be properly read by wiki2touch. The latest version of Wiki2touch Utilities (v.0.65) is here via RapidShare or here via MEGAUPLOAD. If you're running Mac OS X, you can either use the Wiki2Touch transfer tool v0.60 for OS X here or a newer version, rebuilt from 0.65 sources, here.
C. Download Wikipedia database
1. You can always find the latest English Wikipedia database dumps here
2. You need to download the latest version of the pages-articles dump (in compressed .bz2 format) located in the “ /latest “ directory at the above website. This dump is regularly updated (it is date/time stamped), and the name of the file is always the same - it is called "enwiki-latest-pages-articles.xml.bz2". Here’s the direct link: Latest Dump (Note: The dump is almost ~6 GB. After indexing it will be reduced to a file called articles.bin ~4 GB)
III. STEP-BY-STEP INSTALLATION GUIDE
STEP 1: INDEXING THE WIKIPEDIA DATABASE
The purpose of the indexer is to scan the .bz2 file, re-arrange the content out of the xml data, and generate the 'articles.bin' and 'images.txt' files. You can either use (i) the “Transfer Tool.exe” program in the wiki2touch utilities folder (has a GUI interface but does not work properly except for the indexing function) or (ii) (recommended) use the command-line version, the “indexer.exe” program, located within the same folder.
To use the command-line version (recommended), make sure you have both “indexer.exe” and your .bz2 files in the same directory. I strongly recommend you just put both on the root C: drive, and open a command prompt (DOS window) running in administrator mode [Go to: Start>All Programs>Accessories] and from there right-click on "Command Prompt", and select "Run as Administrator"]. Navigate to the directory where you placed the indexer.exe program and the .bz2 file, and simply run the command:
This will take some time (probably over an hour) so be patient. When it's finished, you *should* get the indexed “articles.bin” and "images.txt" in the same folder. If not, just do a search for the file “articles.bin” - it might be in a temp directory somewhere. Note that executing the command for a second time will overwrite the file with the same name without warning, so use with care if you already got an 'articles.bin' in that folder!
STEP 2: VERIFY IT WORKS
The default location for the indexed “articles.bin” files on your iphone (you can get them for different languages) is '/var/mobile/Media/Wikipedia/xx/', where 'xx' stands for the two-character language code, e.g. 'en' for English, 'fr' for French, 'de' for German, 'zh' for Chinese, 'ja' for Japanese, etc.
The English Wikipedia dump (the .bz2 file) is close to ~6 GB, and the indexed version is >4GB; transferring it will take some time so you want to make sure the program works first. What you can do is try to upload a smaller articles.bin file for testing. A sample “articles.bin” file (generated from the Forgotten Realms Wiki) can be found here:Sample articles.bin
1. Download the above file (~3MB) and use iphone Folders/iphone Explorer to copy it in the “/var/mobile/Media/Wikipedia/en/” directory
2. Make sure the Wiki2Touch server is ON in SB Settings (green light).
3. Open safari and navigate to: http://127.0.0.1:8080 (You should save this as a bookmark).
4. Check if it works by searching for articles.
STEP 3: TRANSFER articles.bin
1. Use iphone Folders/iphone Explorer to navigate to “/var/mobile/Media/Wikipedia/en/” and delete the sample articles.bin file. Then, copy your properly indexed articles.bin file (>4GB) to this directory. This could take some time, although multiple users of this guide have stated that it takes less than 10 minutes when using iphone Folders.
2. When copying is finished, restart your device and make sure the Wiki2Touch server is ON in SB Settings (green light).
3. Open safari and navigate to to the above mentioned bookmark and search for articles. That's it - you now have full offline access to Wikipedia!
(OPTIONAL) STEP 4: INCLUDE ARTICLE IMAGES
The process described so far will *only* install the Wikipedia articles (i.e. just the text). If you want to include the associated images, be prepared to spend a lot of time downloading, indexing, and then consuming significant disk space on your device. Here are the steps:
1. Place "imagegetter.exe" (located in Wiki2touch Utilities folder) and"images.txt" on the root C: drive
2. Double-click to run "imagegetter.exe" and enter the correct language code (e.g. "en" for English). After many hours, it will create a new folder called "Images" that contains subfolders "en" and "commons". Size of this folder is 17GB with image width 120px and max image size 128kb using the Mar. 15, 2010 enwiki dump. (thanks to pereirdp)
3. Place the "Images" folder and the "pack.exe" program on the root C: drive. Open a command prompt window (run as administrator), navigate to the root c: drive, and execute the following command:
4. Eventually (~13 hours!!) you will get an "images.bin" file (11.7 GB for the Mar. 15, 2010 dump) (thanks to pereirdp). Copy this "images.bin" file into the same directory where you placed your "articles.bin" file (“/var/mobile/Media/Wikipedia/en/”).
5. Restart your device and use Safari to navigate to the above mentioned bookmark. Articles should now include images.
STEP 5: That's all folks! Whenever you feel your Wikipedia database is old and outdated, simply download the latest pages-articles dump, re-index, and transfer to your iphone. ENJOY AND LET ME KNOW IF YOU HAVE ANY PROBLEMS!