Dragonball comics on iPad

Dragonball comics can be downloaded at http://www.realitylapse.com/manga/dragonball.php.There are two types of downloads – chapters or volumes, volumes are combination of several chapters. Better download the volumes, since downloading each chapter will take longer time.

I’m using SideBooks app to view the comics on iPad. The files can be easily transferred to iPad via iTunes shared folder.


Or if you’re using Fedora, it’s automatically detected as mobile device & by using Nautilus it’s as easy as copying files into SideBooks folder inside the iPad.


Efficient code

From my experience, an efficient code is code that have these characteristics:

  • it works
  • use optimum resource
  • manageable

Note: example codes are in Javascript, specifically Titanium mobile.

An efficient code must be code that can be run. There’s no point of evaluating a code that doesn’t run at all. Secondly, it must solve the problem it’s required to.

Example, a function must return letter ‘S’ for person with weight 50kg and below, ‘M’ for 51-70kg and ‘L’ for 71kg and above. So, the code must comply to this requirement

function getSizeFromWeight(weight) {
  if (weight <=50) {
    return 'S';
  else if (weight <= 70) {
    return 'M';
  return 'L';

Note: don’t bother to assign the result to another variable, just return it immediately.

An efficient code that use optimum resources, means the code only create necessary variables and use external resource such as filesystem, network connection, database or plugins only when needed and release those resources when done.

For example, iterating a list of files and getting each of the files’ modification timestamp, for each files that are modified a minute ago will need to be deleted. Some newbie programmer will collect a list of files that need to be deleted and then delete them, one by one. There’s nothing wrong with this method, except the code need to iterate twice in order to delete the expired files, which is inefficient.

var now = new Date().getTime();
var files = []; // assume this contains Ti.Filesystem.File objects
var i = files.length;
while (i--) {
  var f = files[i];
  if (f.modifiedTimestamp + 60000 < now) {

Notes: Some loop statement (e.g while loop) is generally faster that other (for, foreach, do while).

Lazy loading is one of the technique that explains how to use optimum resource. Example, in a Titanium app, when a window opened, we only include those modules that required in order to open the window. If your app need to play audio, only load the audio player module when user invoke the functionality (via play button click etc.)

// open a window
var win = Ti.UI.createWindow();
var TopBar = require('ui/TopBar');
var ContentGrid = require('ui/ContentGrid');
win.add(new TopBar());
win.add(new ContentGrid());

// play an audio, when click the play button
playBtn.addEventListener('click', function() {
  var Player = require('lib/Player');
  Player.start(this.audioUrl); // assume playBtn has this property

Note: During opening a window, only include UI components required in order to build the app window. And only when the play button is clicked then include the audio player module.

Code manageability means when you need to fix bug, add new feature or rewrite the code to accommodate new infrastructure, the existing code require little or zero adjustment. These small adjustment won’t break the current system.

Example, also in Titanium app, you have a feature to check for a new version of your app from the webserver. In initial release, the app only need to know the version number. Then in subsequent release, you want to add download link, thumbnail image etc. Current code shouldn’t have to be adjusted too much, till it break the calling component.

// initial release
function notifyNewUpdate(p) {
    message: 'Version ' + p.version + ' is ready to be downloaded'

// subsequent release
function notifyNewUpdate(p) {
  var dialog = Ti.UI.createAlertDialog({
    message: 'Version ' + p.version + ' is ready to be downloaded'
  dialog.addEventListener('click', function() {
    var Updater = require('lib/Updater');

Note: notice that input parameter to notifyNewUpdate() function is maintained. This allow developer to add more or remove unused parameter without breaking the function call.

Up & running

Yesterday I found out this blog was inaccessible. It showed some sort of error page. I have had this problem before, due to high usage in MySQL, so they (hosting provider) suspended this free account. So I login the cPanel to see what’s wrong. It shouldn’t be because of high usage, since the analytics shows no spike.

But during the login process I found out something – the login URL has changed. On further observation, there’s a small announcement in cPanel that told me to use a new IP address to access the FTP. So to summarize, the hosting provider relocated my account to another server so the IP address was changed too. The domain name still resolve the IP address to the old one, so that’s why this blog was inaccessible. With simple nslookup & updating IP address records in Cloudflare, this site is up and running.

So, the moral of the story is, know what you are paying for. This site is hosted using a free account, so don’t expect any support from the provider. If you pay for the service, you can demand for a better service or support. If you are not paying anything (to use a service), so you are the product.