AppleScript: Revised Document Statistics

This is a revised version of the clipboard document statistics script that I used some time ago. It now counts the paragraphs and includes a 1-button dialog box.

Count the number of characters, words and paragraphs in the clipboard
David R. -
To use place this script in your User Scripts folder in ~/Library/Scripts
set nChars to count (the clipboard)
set nWords to count words of (the clipboard)
set nParag to count paragraphs of (the clipboard)
display dialog "Characters: " & nChars & "
Words: " & nWords & "
Paragraphs: " & nParag buttons {"OK"} default button 1

Installing the script

To use the script just use the AppleScript Editor that ships with MacOS (search in side the utilities folder) and save this as a script in your Scripts folder in ~/Library/Scripts.

756 EV cars sold in Portugal during 2016

I’ve just read that the Portuguese bought 756 (+17%) full electric vehicles during 2016 (mostly Nissan Leafs). That might seem a small number — as it is just 0,36% of the market — but it is a good clear sign of the future. Electric is both cheap and clean and with the arrival of the 300+Km cars in 2017 I imagine that many will start looking at them with greater curiosity. I’m really curious to see how the introduction of the 41Kwh Renault Zoe, the Opel Ampera-e and the Hyundai Ioniq will impact these numbers during this year.

The Second Machine Age: Work, Progress, and Prosperity in a Time of Brilliant Technologies ★★★★

The Second Machine Age: Work, Progress, and Prosperity in a Time of Brilliant Technologies ★★★★
by Erik Brynjolfsson, Andrew McAfee

The Second Machine Age: Work, Progress, and Prosperity in a Time of Brilliant Technologies

This is a book the reflect upon. Well, not the book, but the ideas in it. The topics covered claim that we are living alongside a transformative force that will change the shape of the world as we know it.

The author argues that the Second Machine Age is upon us in the form of the crescent digitisation of everything. This is reshaping most of the fundamental aspects of our economies where the cost structures of the digital goals are becoming negligible.

There are many ideas in the book (alongside with some advice) that are food for thought, and this is probably the books best-selling point. The only negative aspect I found is that it focuses mostly on America in the latter chapters of the book.

A curiosity spoiler is that the book addresses some issues in the bounty-spread dichotomy that have been fundamental in recent elections (Brexit and Trump), so they acquire some prophetic aspect when reading the book in 2017.

I also enjoyed the chapters on education, although I found myself wanting more chapters on the topic. Naturally, education is not a “sexy” theme for everybody, but I believe it will become the fundamental tool to reshape the human side of the XXI century man-machine equation.

Highly recommended.

The Great War for Civilisation: The Conquest of the Middle East 2★

The Great War for Civilisation: The Conquest of the Middle East 2★
by Robert Fisk

A Grande Guerra pela Civilização by Robert Fisk

This book could have been very interesting if it was reduced to one third of its size. At more than 1000 pages it becomes very boring to read through. My advice? don’t bother with this one, or just skim through the most important chapters.

As an information source it shows how the west has f**ked up the situation in the middle east, and in part the mess of the world we live in is also our own fault. But all it tells us could be written in a non-mammoth way. It took me almost one year to make this go into the club37 shelve. My rating is just 2★ because of the size. Otherwise it could have been a 3 or 4 star book.

Can Future Faraday FF91 win the EV market?

Can the Future Faraday FF91 be it? One of my recent interests is Electric Cars. It is my belief that the combustion engine is going the way of the dodo. Personally I need to replace my almost 20 year old Rover in the next couple of years.

The recent announcement of the Faraday Future FF91 is a testament to the momentum the industry is having (even if the car will only sell in 2018, and only in the US and China). But the FF91 also shows another aspect of this industry. The need for very aerodynamic shapes is making really, really, really ugly cars (Leaf?, Ioniq?).

The electric car cannot be a reason-engineering product alone. Not in XXI century when car companies will charge a lot for these products. Electric cars also need to capture passions. They need to be the Millennium Falcon of the automobile industry. Something that gets car nerds excited and doesn’t capture the interest of eco-zealots.

Right now companies are approaching this lack of oomph via the performance route. The Future Faraday FF91 goes 0–60mph in 2.39 seconds. Tesla is doing the same thing (although their cars are nicer because they first solved the pizazz issue by borrowing a lotus chassis for the Roadster). Future Faraday FF91 design is… well, it looks like a Rhino (another endangered species). But this doesn’t make them desirable to petrol heads (yet). And the fault lies on the long history of the combustion engine. The noise, the smells, the macho attributes petrol cars convey that many EVs still lack.

The near future of Electric Vehicles

I see the future of traditional car makers and new EV-only car companies converging. The latter will end up absorbed by the former. But by that time we’ll be all better served by electric cars than we were by combustion engine cars. And we’ll be happier and healthier too.

If now is not the time to buy an electric car, some might say, then now is not the time to buy a petrol car either. The two things are decoupled and buying a combustion engine car is one of the dumbest decisions one could make in 2017. 2020 is going to see cities blocking city center access to combustion engine cars (Paris for example). And you don’t want to be A-hole that got a new expensive artefact of automotive industry.

Now is the time to be patient if you weigh all the pros and cons. My Rover will need to hold off its retirement. If you are an early adopter, well, then you already drive a Leaf don’t you?

†I know that it is Faraday Future, but honestly, the car will be released so far in the Future that Future Faraday seems appropriate.

Apple needs a new CEO, Tim Cook must resign.

Apple CEO, Tim Cook must resign and the company should shift towards a more aggressive development strategy. Apple at the present is just a company of incremental improvements of existing products and market expansion.

There are no new products to come. No new directions to travel. The problem with apple started when the company stopped making tools for creative people and focused on creating gadgets. But it is not all about the products made by apple. In the end, it is all about the core vision and ambition of Apple’s CEO, Tim Cook.

“Peacetime CEO aims to expand the market. Wartime CEO aims to win the market.”

Excerpt From: Horowitz, Ben. “The Hard Thing About Hard Things: Building a Business When There Are No Easy Answers.” – Chap. 7 – “Peacetime CEO/Wartime CEO”.

Tim Cook is an excellent peacetime CEO, like the ones of Eric Schmidt at Google or Steve Balmer at Microsoft. They were excellent at expanding the company market, but not really at reinventing the company. Wartime CEOs like Steve Jobs, Bill Gates or Larry Page, envision new products that will define new markets and want to control those markets. The uninteresting – to avoid the word dull – products of Apple, show that they really need a CEO that can stir the waters. For all this Tim Cook must resign.

Who can replace Tim Cook?

Probably no one inside apple right now. Mainly because the CEO cannot be someone of the existing CEOs. Most of them are just peacetime CEOs like Tim Cook. They are there since the time of Steve Jobs. And going back to Ben Horowitz book:

“I call managers who are happier setting the direction of the company Ones and those who more enjoy making the company perform at the highest level Twos.”

Excerpt From: Horowitz, Ben. “The Hard Thing About Hard Things: Building a Business When There Are No Easy Answers.” – Chap. 7 – “Ones and Twos”.

Steve Jobs was a natural One. As a founding CEO he was always defining the future. Gathering information and playing “eight-dimensional chess against their best competitors”. Ones need to be surrounded by Twos, people that excel at making the company execute the plan at full performance. Tim Cook was that kind of person. As were the others executives at apple at the time, either Jony Ive or Phil Schiller. As Twos they complemented Steve Jobs being the One.

When Jobs passed way Tim Cook took over and we started having a Two as the CEO. He made Apple stronger and bigger than ever before. Apple expanded with the same products. But now, that existing products are not sustaining that expansion, Apple needs to redefine their strategy. Define the big transformative objectives. Decide on where to go next. For that, Apple needs a One at the helm, and that’s why Tim Cook must resign.

Reference: Six Degrees of Francis Bacon: A Statistical Method for Reconstructing Large Historical Social Networks

by Christopher N. Warren; Daniel Shore; Jessica Otis; Lawrence Wang; Mike Finegold; Cosma Shalizi

When you accidentally find a paper with Cosma Shalizi as one of the co-authors you know you have to read it. And this one is an interesting paper because of some research aspects that are of my interest. The abstract’s first sentence immediately caught my eye.

In this paper we present a statistical method for inferring historical social networks from biographical documents as well as the scholarly aims for doing so.

I found Six Degrees of Francis Bacon: A Statistical Method for Reconstructing Large Historical Social Networks interesting because it connects with my own work in some aspects:

Historical Analysis

  • They focus on the analysis of historical documents. The authors use automated text extraction elements for inferring networks of personal relations from historical data. It relates to my work on the detecting Lisbon’s historical patterns and the unbuilt Lisbon.

Natural Language Processing

  • They use many NLP and topic modelling techniques that are state of the art practice.


  •  A Poisson Graphical Lasso statistical method to infer the network from the co-occurrence matrices is used. More elaborate than the simple co-occurrence matrix I used in the survey of architecture floor design network construction. This approach is probably going to be of use for the future revision of the survey work.

Code availability

Use of experts: Peer assessment

  • Curious use of experts to tune the quality of the method. Important to compare with work done on the clustering of floor plan designs. Using experts to create ground truths is common, but they come with their own pitfalls.

American Elections


Aftermath: You didn’t follow advice from a Portuguese low life like myself and now the world is a worse place to live in. You are super, america.