Party Guestbook

Now in Barcelona, home parties are back again! So, following other projects I did for party guest entertainment, this time I decided to develop a digital Guestbook for people to use.. it was nice!

Also, this time I asked chatGPT to help me, and in 4 to 5 prompts I had it all done – with some tweaks afterwards. The way I interacted with chatGPT to produce some working code was nice, a first for me, but I would say very convenient. I had exactly in mind what I wanted, just didn’t know how to do it in detail without searching the internet. So here are a screenshot of the result and the prompts I used to build this:

ChatGPT prompts, with ChatGPT commenting on them:

[AI written content starts here]

Prompt 1: Node.js Express Server with Queue Endpoints

Prompt: Write a node.js Express server with two endpoints: a POST /add that adds a text to a queue, and a GET /queue that returns a JSON with the queue and empties it.

Description: This prompt asks for the creation of a Node.js Express server with two endpoints. The first endpoint (POST /add) should handle a POST request to add text to a queue. The second endpoint (GET /queue) should handle a GET request to retrieve the queue and empty it. The goal is to implement a basic queuing system using the provided endpoints.


Prompt 2: Serving Static Files in Express

Prompt: Modify the code so that every request to files in the public/ folder is served as normal files.

Description: This prompt involves modifying the Node.js Express server code to serve static files from a public/ directory. The goal is to ensure that any requests for files within the public/ folder are served as normal files, allowing them to be accessed by clients. This modification will enable the server to serve static content such as HTML, CSS, JavaScript files, images, and other assets stored in the public/ folder.


Prompt 3: HTML Page for POST Submission

Prompt: Write an HTML page to submit a POST with a JSON payload populated with a text taken from a textarea as an input.

Description: In this prompt, the task is to create an HTML page that includes a form with a textarea input. The user will enter some text into the textarea, and upon submission, a POST request with a JSON payload should be sent to the server. The JSON payload should contain the text entered in the textarea. The purpose of this HTML page is to allow users to submit text to the server for further processing or storage.


Prompt 4: Displaying Queue Data Dynamically

Prompt: Write an HTML page that reads data from the queue with an async call every 10 seconds. Display the pieces of text that it reads from the queue in a random font, color, and size, and place them in a random position on the page.

Description: This prompt involves building an HTML page that fetches data from the server’s /queue endpoint every 10 seconds using an asynchronous call. The retrieved data represents a queue, and the goal is to dynamically display the text from the queue on the page. The displayed text should be styled randomly with fonts, colors, and sizes. Additionally, the text should be positioned randomly on the page, creating a visually dynamic and engaging display.


Prompt 5: Generating QR Code SVG for URL

Prompt: Write the HTML code for an SVG image representing a QR code for the URL https://giada.0bl.eu:3000/add.html.

Description: In this prompt, the task is to write the HTML code for an SVG image that represents a QR code for a specific URL. The provided URL is https://giada.0bl.eu:3000/add.html. The generated SVG image should be suitable for displaying a scannable QR code that, when scanned, will direct the user to the provided URL. The QR code is a widely used method for encoding and decoding information, often used for quickly accessing URLs or other data through mobile devices.

[AI written content ends here]

So, thanks to ChatGPT for helping me code this project, but also for helping me write this too long and inflated blog post. I guess you can paste all this into chatGPT and ask it to make a summary of it, in a net-zero information process that earns some money to openAI ūüôā

Advanced Mortgage Calculator

 

 

amc

After my first post about a simpler mortgage calculator now I developed a more advanced one, especially designed to compare different mortgages, and calculate which one lets you pay less interest over time.

The app can be found here

amc2

Compared to the last tool, which just calculated the total interests and the installment amount, this app offers these other features:

  • charts of the installments over time
  • capability to add different types of events:
    • interest rate change
    • time renegotiation
    • amortization on time
    • amortization on installment amount

amc4

Adding events makes this tool extremely versatile and allows for simulating complex scenarios. You can compare a 10 year mortgage with a 20 years one in which you reduce the time amortizations with annual cash deposits, or a combination of different interest rates which may happen in some situations. The charts are updated automatically, and there is a comparison chart to make it easy to compare the two mortgages over time, focusing on the interest amount paid.

amc3amc5

Plani3D – Planimetry/map to 3D model

In the last days I’ve been working on this helper software to make it easy to turn a planimetry of a house into a simple 3D model to make it easy to visualize¬†it or¬†any modification you would want to make.

 

plani3deditor

Plani3D

plani3d_conpla

The functionalities are extremely limited and it may be buggy – it was only coded to suit my specific needs.

So far it lets you:

  • Load a custom image (planimetry, map)
  • Define a scale (so the 3d model will have the right measures)
  • Draw 3 types of entity with the mouse
    • Walls
    • Windows
    • Doors
  • Change thickness of walls
  • Generate the 3D model
    • saving the link will let you see it in the future too, the model gets encoded in the url (which could get veeery big)
  • Export the generated model as a GTLF file

Note: no deletion of added walls is possible at this time. Not even editing the generated model. It’s more a rapid prototype tool, doesn’t let you make things precisely.

The project can be tested here.

 

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.