Dec 30, 2015

Moore's Law

Moore's law is the essential idea of the accelerating future. There are inherent problems related to a sustained growth, and I've found a nice graph for illustration.

Gordon Moore, the co-founder of Intel and Fairchild Semiconductor, described a doubling of transistors per integrated circuit in a 1965 paper. In 1975, he corrected the doubling rate to two years. Since then it has been used as an analogy in other fields.

The illustration below shows that, while transistor growth is still ongoing, clock frequency scaling has been replaced by scaling the number of cores. It even shows the reason behind this change: the power density limits clock speed.


Moore's lawMoore's law is still valid! | Image credit: Kathy Yelick.

What can we learn from this? While the insights from this are not exactly new, the illustration shows the directions of ongoing development (until 2015) for computer hardware, and emphasises the need for multi-processing.

Enjoy. Please leave a comment below for questions and suggestions.

Dec 28, 2015

Reduce Size of pdf files

It's often annoying with pdf files that they come in different resolutions and that the file sizes are much too big. The second one is especially important if you have an ebook reader. With kindle, file sizes are restricted to 20MBs. With straightforward commands, you can often significantly reduce the size of pdf files.

Here's my bash script for reducing the size of pdfs, pdfSmall.sh

cat pdfSmall.sh
#!/bin/bash
# USAGE: pdfSmall.sh file.pdf

FILENAME="$1"
BASENAME="${FILENAME%.*}"
NEWFILE="${BASENAME}2.pdf"
gs -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen - sOutputFile="${NEWFILE}" "${FILENAME}"

This creates a new file that is named as the original file, but with a 2 added to the name (thanks to Jorge). The file has a resolution optimized for the screen. You can use /ebook instead, if you want to read it on an ebook reader, however, file sizes can be bigger.

If you want to use this script for several files, you can use something like this.

In this case I want to run over the newest 10 pdf files.

cat runFiles.sh
#!/bin/bash
SAVEIFS=$IFS
IFS=$(echo -en "\n\b")
for f in `ls -t *.pdf | head -n 10`
do
echo "$f"
./pdfSmall.sh "$f"
done
IFS=$SAVEIFS

This should work even if filenames have spaces or special characters.

Enjoy. Please leave a comment below for questions and suggestions.

Mar 10, 2014

Speed reading at 600 words per minute

The internet was abuzz with news on the speed reading technology by Spritz Technology. Many showed demo videos where words are presented at very high frequency, faster than what is usually achieved by so-called speed reading techniques. While Spritz seems intent to make money over licenses rather than selling applications themselves, there are already many clones that allow you to read very fast.

Typically, speed reading courses aim to get you to speeds over about 200 words per minute. I read a book on speed reading some time ago, and it boiled down essentially on concentrating harder on the main points. I don't think I profited much from reading it. With the technique advertised by Spritz you can make it beyond 600 words per minute by delivering the words in high frequency to locations that help you avoid eye movements. Some news sources have pointed out that this means you can read a novel in about 90 minutes. This is spectacular of course.

A perl command line tool is available at github. For google chrome, there's the jetzt plugin, which works really well and looks fabulous. Installation is straightforward. The word frequency is by default at 400 words per minute.

I like the chrome extension. However, if you use the chrome extension, there's a downside: chrome doesn't open all filetypes, and it is not even consistent - sometimes txt files get opened, sometimes they are downloaded. You can (I did) read books using this extension by converting them to text (e.g. pdftotext), and loading them into the browser. With calibre you can also directly convert to html (ebook-convert input.pdf output.html).

From text you can to html, just by slapping html tags around it, but for readability it's better to trust tools such as txt2html. For e-books in epub format you can use epubtohtml to convert them to html.

Please also see my post on language learning to get more ideas of the possibilities.

Enjoy. Please leave a comment below for questions and suggestions.

Boot time in Ubuntu with Dropbox

I remember, some time ago, my system used to boot in few seconds and I even tried to optimize the time by installing minimal window systems. I had some friends who bought solid state hard disks, who came down to five seconds. Some linux distributions focused explicitly on boot time. Now, my booting time is extremely slow and I have to wait up to several minutes for my computer to boot, even on my new desktop computer with a ...standard installation. A significant part of the booting time is taken up by dropbox and in this post I explain what I did to bring down this time and to get at least a bit more reasonable boot time.

My ubuntu startup is sometimes extremely slow. When I check the CPU usage, dropbox comes up as one of the heaviest shares. What to do? One option is to change the nice level (process priority) of dropbox. But then, why not use a more specific limit? cpulimit attempts to limit the cpu usage of a process, so let's use that with dropbox!

We start by installing cpulimit. In ubuntu

sudo apt-get install cpulimit

... will do

We need to identify the process which we want to limit. One way is by process id (pid). Let's get the dropbox process id:

ps aux | grep dropbox | grep -v grep | awk '{print $2}'

There is another option to use the absolute path, but I am using the pid here.

Now we need to plug this into the cpulimit syntax, which is as follows:

cpulimit --pid= --limit=

The command can now look like this:

cpulimit --pid=$(ps aux | grep dropbox | grep -v grep | awk '{print $2}') --limit=10

In the terminal, I put an ampersand at the end, to run the command in the background.

For now, everything seems to run smoothly. Dropbox' cpu share is reduced and the system responses seem quicker. Let's see how it works...

I enter this command in the gnome menu of startup applications, behind the dropbox command. Combined it can look as follows:

echo "nice dropbox start -i & cpulimit --pid=$(ps aux | grep dropbox | grep -v grep | awk '{print $2}') --limit=10" | at now + 10 min

Enjoy. Please leave a comment below for questions and suggestions.