Heroku free plans shut down

Some of my previous projects (fortunately only 2 of them I think) were hosted on heroku and they are not reachable since heroku shut down their free plan. At some point I will move them to my own server, but it will take some time to do so. In the meanwhile, the urls are gonna return an error page – sorry for that.

Mortgage calculator (fixed rate)

Yesterday I made this fixed rate mortgage calculator because I needed a quick way to calculate different options for mortgages for a friend. I found many calculators online but they were either bloated with ads or not providing enough flexibility.

Here is it: mortgage calculator

Screenshot_2023-01-17_11-49-52

As a side note (personal opinion!), I really don’t understand how the typical calculator put emphasis on the monthly payment rather than the total interest money you’re paying in the end. This is very much a disservice for the poorly informed home buyer which looks at a low monthly payments and feels good, when the reality is he’s gonna be paying up to 50% of interest over 30 years of mortgage.. Of course it’s important to be aware of whether you can or cannot afford the mortgage, but in my opinion how much you’re paying for the loaning service is at least equally important. So my tool puts emphasis on how much interest you will pay over the loan lifetime.

Scores!

scores

Scores is a little app I quickly wrote to scrape musical sheets from the internet and to assemble them in a single PDF ready to be downloaded.

Behind the scenes it uses Python-driven Selenium webdrivers to do the scraping and a combination of carefully crafted hacks to make it talk with the frontend. Security was taken into (some) consideration whereas scalability was not – it only handles one request at a time for now.

Intended for (my) personal use only.

Here

 

Estimo App

Just a quick update, some weeks ago I rapidly coded a prototype of this idea of an estimation game, in which you have to guess different facts and the app gives an “accuracy” score. Turned out that the problem of measuring accuracy in guessing is an interesting one and could be solved in many ways. My approach was

score = min(guess,realValue)/max(guess,realValue)

To me this metric is interesting because indicates an “order of magnitude” error, that is if our guess is double or half the actual value, the score is the same.

Of course this formula is only good for positive values, and is not that good if we’re trying to guess bounded values, like if I ask to guess the year of birth of someone: you already have some very clear bounds and you will easily get a score of 95% or so.

The (very basic, only mobile) app is here:

https://estimo-app.herokuapp.com/

I didn’t bother to fix the style for desktop PC – just mobile. Here’s a screenshot:

 

Screenshot_2022-02-22_11-41-39

 

Party Billboard

After moving to NY, we immediately felt the need to organize some parties to meet some new people. Thus, why not designing something to make the party room a bit more “interactive” during the party?

Here’s where the party billboard comes handy: it’s a meme wall easily customizable by everyone at the party:

 

IMG_20220108_202235

 

The top right QR code takes to the customization page in which it’s possible to customize the meme, by entering a text and choosing between a set of default images or specifying a custom publicly reachable URL to an image or GIF.

It was a cool experiment and it was fun to play with at the last party. Can’t wait for the next one!

A live version (with the limitation of 1000 simultaneous parties) is available here.

 

 

 

Virtual Reality (short post)

Some weeks ago I bought an Oculus Quest 2 and beginning experimenting with WebXR technologies. It’s real fun!

Two little projects I’ve put together are these:

1) Painting stuff in 3d: https://greeter.website/pagu-webxr/three/

You can also read the blog post on my company’s blog (in italian): https://blog.dmnk.cloud/index.php/2021/04/01/realta-virtuale-oculus-quest-2/

2) The cubes game: https://app.dmnk.cloud/the-cubes-game/three/

Also here we’ve posted to the company’s blog (still in italian): https://blog.dmnk.cloud/index.php/2021/04/19/the-cubes-game-un-piccolo-gioco-in-realta-virtuale/

JS Genetic Curve Fitter

While I was working on Coronamap.it, in the new section dedicated to analysis, I felt the need to do some curve fitting, that is I had a series of points and I wanted to find a curve which best fit the points, given some constraints. Of course I expected this to be a well known and well solved problem, only to discover that of course yes it is, but it’s actually something not necessarily easy to do. It’s a complex problem which requires to search in a large space of solutions, and as that not an easy task to be done in JS (which I required). Fortunately, I found an implementation in JS which used a genetic algorithm approach, so I decided to rewrite another one from scratch using my old project JSGenetic. If it does not make any sense to you, it’s because it does not have any – except that I love to make this kind of stuff.

So enough for the story, let’s talk about the library:

Example here

Usage:

var cf = GeneticCurveFitter(points, functionGenerator, 3, { //3 is the number parameters you need to tune to find the fitting curve
    RANGES: [
        [1, 2000], //one range for every parameter - if not specified, they fall back to [-1000,1000] which is kind of silly
        [1580000000000, 1590000000000],
        [10000000, 1000000000]
    ]
});
functionGenerator

is a function which gets the generated parameters in input and returns the function which you want to optimize. Easier to explain with an example:

//polynomial functionGenerator
function polyGen(coeffs) {
  return function(x) {
    var result = 0;
    for(var i=0; i<coeffs.length; i++) {
      result += coeffs[i]*Math.pow(x,i);
    }
    return result;
  }
}

//gaussian from the example
var gaussGen = function (coeff) {
    return function (x) {
        return coeff[0] * Math.exp(-((x - coeff[1]) * (x - coeff[1])) / (2 * coeff[2] * coeff[2]));
    }
}

After initializing the object, it can be easily run like this:

var resultFn =   cf.fit();

which returns the best fit function it could find. The process takes some seconds and the time can vary by CPU power and number of coefficients to find. The returned function also has an helper method to generate a chart from it (read: to sample it) which goes like this:

var samples = resultFn.toDataset(startX,endX,numberOfSamples);
//samples is in the form [{x:,y:}, ...]

There are also other methods to better control the evolution of the coefficients: here are the library’s returned methods:

{
        step: step, //make a single step of the genetic algoritm, or N steps if you call cf.step(N)
        fit: fit, //already described before
        getCurrentSolution: getCurrentSolution, //gets current solution
        getCurrentFitness: getCurrentFitness,//gets current error
        getCurrentCoefficients: getCurrentCoefficients //get raw coefficients as an array
}

That’s all! Enjoy.

Update on Coronamap: Coronamap analysis

We added to coronamap the capability of loading custom analysis coded by users in JS.

A list of the analyses can be found here.

Analysis are sorted by points, which you can give by liking them when opened. You can also fork any analysis and modify it as you wish. Everything is in beta, we’re still working on improving the system.

The creation of new analyses can be made from the Coronamap Analysis Editor.

Audio 3D

A very very simple JS API to process an audio file trying to make it sound like the sound source is moving in space. Work in progress, likely never to be finished.
Link here

Instructions:
0) put on some headphones
1) press play button
2) you can try and equalize manually if you want
3) move the position of the source hovering the box with the mouse
4) press Circle to make the source circle automatically
5) refresh the page to test again

The underlying API is very simple, it accepts a simple setXY(x,y) which expects two relative coordinates ranging [-1,1]