May 3, 2020

Moving from Google Play Books to Apple Books

I was using Google Play Books to read books from past 2 years but I have now moved to Apple Books just because I don’t like Google Play Book’s web reader and I like to read on my MacBook

I don’t know why have they stopped maintaining the web reader, maybe they just figured that the ratio of people reading on desktops is very low as compared to phones, so why maintain it.

Some years back I used to store all my books offline but when I got to know that google play books allowed to store our own ebooks, I moved all my books there. Although there are some restrictions of each book having maximum size 100MB and the total number of user uploaded books to be 1000 (not sure about this, I could not find an official doc with this number).

Moving the books to cloud gave me the advantage of not trying to keep the books in sync on every new device which I had which was a big pain on both android and iOS.

It has very nice mobile applications for both android and iOS. I actually like the Google Play Books iOS app more than Apple Books iOS App. But we are talking about the desktop environments right now. On Desktop systems you only have the option of web reader and the web reader is just not that good.

The UI does not feel as good as Apple Books

The level of refinement that is there in Apple Books is not there in Google Play Books. Google Play Books web reader feels like a legacy software which I think it is.

This is how the book Hackers & Painters looks like on Google Play Books:

The UI somehow feels cheap which I guess is because of fonts used and the line height.

The fonts available feel very legacy:

  • Arial
  • Georgia
  • Times New Roman
  • Trebuchet MS
  • Verdana

The line height feels weird and is not much customisable. It gives 3 options and none of them feel right.

There are some unnecessary elements available to you at all time which you cannot hide. These are a distraction while reading.

  • I don’t always need to see the slider on the bottom of the page.
  • The buttons on the top right could be just shown on hovering them when needed.
  • The information on the top left is not necessary and specially the text Exit bothers me because of the blue color. Even the name of the book should have been dimmed.

Now let’s take a look at Code in Apple Books:

This looks so much better with no clutter and just enough important bits that too in a non prominent way.

The fonts available are also much modern:

  • Athelas
  • Charter
  • Georgia
  • Iowan
  • Palatino
  • San Francisco
  • Sevarek
  • Times New Roman

There isn’t an option to change line height but i never felt the need to, it just feels right!

Changing the font size, font family, line height etc does not work reliably.

I tried Hackers & Painters and I was not able to change the line-height, other options work.
In The Courage To Be Disliked, line-height is working but changing typeface doesn’t work.

Trying to make it better by changing the styles

I really wanted to use Google Play Books so I tried modifying the page styles using Stylish which allows you to inject custom css into webpages.
But it didn’t work because the ebooks rendered in the web reader are inside iframe and i couldn’t figure out a way to inject styles inside an iframe.

March 15, 2020

Debug when stdout and stderr not available

I am developing a blessed application and outputting to standard output and error stream messes up the terminal for obvious reasons.

This is my solution for this problem.

/* eslint-disable no-console */
import { Console } from 'console';
import * as fs from 'fs';
import * as path from 'path';

const output = fs.createWriteStream(
  path.resolve(__dirname, '../stdout.log')
);
const errorOutput = fs.createWriteStream(
  path.resolve(__dirname, '../stderr.log'),
);

// Custom simple logger
export const debug = new Console({
  stdout: output,
  stderr: errorOutput,
  colorMode: true,
});

console.log = debug.log;
console.info = debug.info;
console.error = debug.error;

I have created a new console instance and piping the stdout and stderr to 2 different files.

By changing the reference of console.log to debug.log, we are able to send the streams to the files specified.

So if we or any other module uses console.log or indirectly writes to the stdout or stderr, then we’ll get those stream written to our files.

For checking out the stdout and stderr I open 2 instances of terminal and run these 2 commands in each:

tail -f stdout.log

tail -f stderr.log
node.js javascript