A hidden gem: inner_product

Growing up

I know, it’s been a while since the last time I published something on my blog. The main reason is that in my spare time – apart from private life – I’ve been committed to organize events and activities in Italy and also to work on a personal project with a great friend of mine. Anyway, I found some time to share a new blog post I hope you will like.

This article is also part of my series C++ in Competitive Programming.

In the very first installment of this series, I showed an example whose solution amazed some people. Let me recall the problem: we have to find the minimum difference between any two elements in a sorted sequence of numbers. For example:

The minimum difference is 10, that is 20-10. Any other combination is greater. Then, I showed an unrolled solution for such problem (not…

View original post 1,667 more words

Advertisements

The Valley of Shit

The Thesis Whisperer

I have a friend, let’s call him Dave, who is doing his PhD at the moment.

I admire Dave for several reasons. Although he is a full time academic with a young family, Dave talks about his PhD as just one job among many. Rather than moan about not having enough time, Dave looks for creative time management solutions. Despite the numerous demands on him, Dave is a generous colleague. He willingly listens to my work problems over coffee and always has an interesting suggestion or two. His resolute cheerfulness and ‘can do’ attitude is an antidote to the culture of complaint which seems, at times, to pervade academia.

I was therefore surprised when, for no apparent reason, Dave started talking negatively about his PhD and his ability to finish on time. All of a sudden he seemed to lose confidencein himself, his topic and the quality of…

View original post 920 more words

$20,000 in 10 months from two small games, how? and what next?

Coffee Induced Games

Between January 2017 and November 2017, I have made a little over $20,000 in advertising revenue alone from two small mobile games on the Android App Store – Google Play

Admob income Nov 2016 - Nov 2017 Proof of income to back up my claims

Up until now, I’ve been writing small simple Android games as a hobby, but now it’s getting serious…

If you’ve have told me a year ago, that I’d be writing this article today, I’d think you were joking around. At that point, my total earnings on the Google Play store, amounted to $43.75, if it hadn’t been for some extra income from my YouTube channel showing simple games programming tutorials, I’d have never of received any money from Google up until that point. But as of the time of writing, I’ve earned just over $23,000 in the last year, all from just two games:

Invaders

An pretty simple Space Invaders clone I…

View original post 962 more words

My 20-Year Experience of Software Development Methodologies

zwischenzugs

Sapiens and Collective Fictions

Recently I read Sapiens: A Brief History of Humankind by Yuval Harari. The basic thesis of the book is that humans require ‘collective fictions’ so that we can collaborate in larger numbers than the 150 or so our brains are big enough to cope with by default. Collective fictions are things that don’t describe solid objects in the real world we can see and touch. Things like religions, nationalism, liberal democracy, or Popperian falsifiability in science. Things that don’t exist, but when we act like they do, we easily forget that they don’t.

Collective Fictions in IT – Waterfall

This got me thinking about some of the things that bother me today about the world of software engineering. When I started in software 20 years ago, God was waterfall. I joined a consultancy (ca. 400 people) that wrote very long specs which were honed to within an…

View original post 1,627 more words

Arithmetic Gas

Mathematical Garden

arithmetic_gas

Prime numbers can be considered as the building blocks of natural numbers. For example, 12 can be factored in a unique way as $latex 2^{2} cdot 3$ where 2 and 3 are primes. Thus, prime numbers can be compared to elementary particles, which are the building blocks of matter in physics. The concept of arithmetic gas provides an interesting connection between statistical physics and number theory, for which the Riemann zeta function plays the role of a partition function.

View original post 957 more words

Seam Carving: Using Dynamic Programming to implement Context-Aware Image Resizing in Python

sandipanweb

The following problem appeared as an assignment in the Algorithm Course (COS 226) at Princeton University taught by Prof. Sedgewick.  The following description of the problem is taken from the assignment itself.

The Seam Carving Problem

  • Seam-carving is a content-aware image resizing technique where the image is reduced in size by one pixel of height (or width) at a time.
  • vertical seam in an image is a pathof pixels connected from the top to the bottom with one pixel in each row.
  • horizontal seam is a path of pixels connected from the left to the right with one pixel in each column.
  • Unlike standard content-agnostic resizing…

View original post 774 more words

Calculating the Distance Between Points in “Wrap Around” (Toroidal) Space

The blog at the bottom of the sea

Let’s say you are trying to find the distance between two points in 2D, but that these points are in a universe that “wraps around” like old video games – leaving the screen on the right, left, top or bottom side makes you re-appear on the opposite edge.

This universe is actually shaped like a toroid, also known as a doughnut. If you imagine yourself being on the inside surface of a hollow doughnut, it would behave exactly this way. If you go “down” you end up where you previously considered “up”. If you go far enough “left” you end up where you previously considered “right”.

How would you calculate the distance between two points in a universe like this?

Let’s imagine the situation below where we are trying to find the distance between the red point and the green point:

One way to do this would be to pick…

View original post 666 more words