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.

 

Snooper.email (short post)

I’m going to make some really short posts to keep track of projects that I’ve done by myself or within my company¬†in the last weeks.

The first one is about snooper.email, a service we developed to keep track of when your email is opened. It makes use of a tracking pixel (fundamentally an image hosted on your server) to detect when the email is opened, and thus the image fetched.

Snooper.email

We also posted an update on our company’s blog:¬†https://blog.dmnk.cloud/index.php/2021/04/12/snooper-email-traccia-quando-le-tue-email-vengono-aperte/

Teenage Engineering PO-33 KO drumset loader app

While there are some projects I’ve been doing lately that I’ve not written here yet, this is one of those I want to write up while it’s still hot – I could easily forget about it.

I recently bought a PO-33 KO by Teenage Engineering, which I think is¬†an incredible music making device. It’s basically a handheld sampler, very easy to use, even if¬†it has some limitations. I’ve been enjoying very much playing with it lately, but that’s not the point of this post! You can go see all the videos out there if you’re interesting in what it is and what it does.

The point of this post is that if you’ve been using it, you know it has some beautiful features, among which there’s the possibility of recording samples with the microphone or the line input. Everything is really fine while recording the melodic slots, but when it comes to recording drum slots, it begins to be a bit difficult to make the PO detect the various slices correctly. There’s a bit of frustation about this in the community, as you can find various videos on Youtube giving tips and tricks on the matter. In the end, it seems to be understood that the process is somewhat buggy, and it’s become accepted that you should probably use some of the available workarounds, like recording first in the melodic slots and then copying the slices to the drum section. By the way, these workarounds are slow and kind of impractical if you want to quickly move some drumset you’ve got on your PC to the PO.

I’ve seen people already doing this in various ways, trying to tackle the problem using other hardware or software which is not specific for the PO, but still the solutions seemed to me a bit suboptimal.

That’s why I wanted to try and solve the problem with a very simple webapp which basically allows to upload a series of sounds and then plays them in a hopefully PO-friendly way. It’s still in very early developement, but I’ve already been able to use it to upload some sample drums I had on my PC to the PO.

Right know it’s still pretty raw, but¬†you can find it¬†here:¬†http://app.dmnk.cloud/po33-loader/

or on the Play Store here: https://play.google.com/store/apps/details?id=cloud.dmnk.po33loader2&hl=en_US&gl=US

Some quick instructions:

  1. press the buttons and¬†select some¬† audio files representing your slices. You can select multiple files at once and it will place them in consecutive slots. The first sound is placed in every slot because as I understand it’s needed to play all 16 slots if you want a clean slicing.
  2. when you’re ready, press the desired destination drum slot (9-16)¬† plus the record button on the PO (as normally when you want to record there), and at the same time, start the playback on the app by pressing the red button (you’ll find it in the place of the record button on the PO background image of the app).
  3. you shoud hear all your sounds playing one after another and hopefully if either you’ve connected the PO with a jack-jack cable or you’re just placing it close to your speakers, the PO should be able to slice the sounds correctly.

You’ll notice that the sounds¬†get cut in some cases, that’s because in my tests longer sounds¬†have always been¬†split by the PO in more slices. I decided that this tool should be only used with shorter sounds, more appropriate for the drum slots. If you need something longer, you’d better record it separately on¬†a melodic slot and copy it manually to the drum section afterwards.

I hope this thing will be useful to someone! I may or may not make some improvements in the following days and then I may or may not update this blog post accordingly.

Radio Lockdown

Just keeping track of the projects.. On the 28th of October 2020 Radio Lockdown was founded. It’s a web radio in which me and my gf talk nonsense, but unbelivably on the second day we hit almost 200 active listeners.. wow. Anyways, going back to the technical details, it was so easy to make¬†it from scratch:

  1. install icecast2 on the server
  2. configure icecast2 following the instructions (from apt-get)
  3. install darkice on the client
  4. configure /etc/darkice.cfg specifying the device (I used ‘pulse’ which uses the system sound in ubuntu) – if you don’t have a default darkice.cfg I think you can find an example somewhere in /usr/share
  5. run darkice and speak into the mic
  6. make a simple website with an audio element sourcing from your icecast2 address

Of course there are same small tweaks you can do, like could be useful to know that the default maximum number of simultaneous listeners is set to 100, that was why we had only 99 listeners for quite some time yesterday evening. And then if you wanna have same good sound too, you should probably connect a decent microphone or equipment, but that’s a different story.

So that’s how Radio Lockdown is born. But why? As the name itself tells, because of the lockdown imposed in France starting today. We stay isolated, but radio-connected!

If you want to listen for some trash talking, we don’t have a plan but we do have an url (we speak mostly italian):

http://radiolockdown.online

https://radiolockdown.danielenicassio.eu

NotesLearn

I recently bought an alto saxophone. It was quite a while I haven’t seriously been playing an instrument, so I came across a little challenge when it was time to read a music sheet. You know, that thing with a pentagram and some notes of various shapes drawn over it.

Since playing a note on the saxophone is not straightforward as it would be on a piano, I actually had two separate challenges: the first was to recognize a note on the pentagram, the second was to play it well (it means play the correct note steadly for some seconds – and in tune).

So I decided to code a little app to aid me doing so. The app is pretty simple: it shows a (random) note on the pentagram, and then listens to the microphone waiting for a note, identifying the pitch and, after some seconds of playing, says if the played note was correct or not. This app has proven quite useful in the process of improving my reading accuracy and speed, and I guess it might be useful to someone else too.

It’s published here: https://dmnk.cloud/noteslearn.

Technical infos

On the technical side, it is entirely coded using Javascript, and has been a cool challenge to code since it was the first time for me interacting with the microphone data on a web app. It uses some advanced Audio features of HTML5, based on the AudioContext component. Recognizing the pitch was a minor issue, obtained by playing a bit with the FFT of the signal, some other challenges included volume thresholding and octave recognition (less trivial).

In the end, the result is pretty usable for my alto sax, even though it may be less accurate if used with other instruments I didn’t test. The piano version is not perfect, for some notes it needs to repeatedly play the key to make the app recognize it. I guess it should work best with constant-volume-notes kind of instruments, like violin or flute, but as I said it was only fully tested with my alto sax.

KangaMex

Hello everyone! It’s been a while since I last wrote a piece on this blog, since that a lot of things changed, but I still want to share some of my experiences with the world.

I’ll be making some brief posts to track some projects I’ve been working to in these almost 2 years of absence.

This post is about KangaMex, a messaging platform which idea is really simple, yet I didn’t find something like it when I needed it. The app is a delayed messaging service, or a service to send messages which will be delivered only at a specified date and time in the future. You write your message, set the unlock date and time, the recipient’s username, and send it. The recipient will be notified that he/she has an upcoming message, but will not be able to see it until the unlock time has come. Very simple, nice way to send delayed messages.

The app is at mex.kanga.life.

Who wants to be millionaire?

You probably know the tv show “Who wants to be a millionaire”. Lately I’ve been invited at the graduation party of a friend, and thought about creating a game for it.

So I decided to create a HTML5 simulation of WWTBAB, complete with webcam support, sounds and introduction video. It has been quite fun, and I’ve been releasing the code on github.

Questions are hardcoded in the index.html file, but it’s trivial to modify¬†them. Recently I’ve added support for images in questions.

I really don’t know if someone can actually make use of it, but who knows?

Just a quick overview about the keys used to control the simulation:

  • [Left arrow] – to skip to next step (video is not skippable by now)
  • [Down arrow] – to unveil the next answer
  • [A,B,C,D] – to highlight the selected answer
  • [Y,N] – when an answer is highlighted, Y makes it correct, N makes it wrong
  • [F] – to switch between the default background or the webcam image
  • [P] – to flash the background to induce some suspance

Github.

Example-link.