Devember 2020 - Devlog
This is my Devember 2020 devlog. Probably I will stop somewhere during this month because of other mandatory duties, although I actually hope this won’t happen
The general aim of this year edition is to improve my functional Scala skillset implementing a playground project using ZIO.
1st December 2020
- setup of the repository
- adding ZIOTest
- creating a dummy main class doing basic I/O.
2nd December 2020
- scaffolding of a configuration management using ZIO, still incomplete.
Taking inspiration from ZIO Exercises by Wiem Zine.
Joining Functional Scala 2020.
It is an online conference about Scala ecosystem. During the first day we started with a workshop by John De Goes, that spent his day explaining all the major features introduced in Scala 3 such as: enumerations
, extension methods
, etc.
3rd December 2020
Few other lines added to the project. They introduce a working ZIO-Config instance to load application.conf
file through ZIO environments.
Some steps ahead in my understanding of the ZIO ecosystem, especially I got a better understanding of how the enviroment concept fits in the the ZIO
datatype. However, I have still to work in a complete understanding of it.
Also, I attended the second day of FunctionalScala. New macro features of Scala 3 look really impressive.
4th December 2020
My understanding of ZIO features is going better. Today I was able to define two small modules implementing console logging and a dummy business logic. I read through this documentation in order to get a better understading of what ZLayer
and ZIO modules are about.
Thanks to this reading I feel more comfortable in browsing through codebases written using ZIO.
My expectations for today afternoon are to be able to better understand Functional Scala talks about ZIO.
5th December 2020
I spent an hour developing a small module to perform API calls using HTTP4S. The module implementation has been inspired by this blog post.
Since it’s my first time both with ZIO and HTTP4S, so far I found it difficult to make them working together. I got an overview about the fact that HTTP4S requires implicits, probably because of the HTTP response deserialization. It seems that HTTP4S client invocations return ZIO Task
datatype because of the implicit EntityDecoder
instance.
ZIO Task
datatype represents a type alias of an effect requiring an Any
enviroment as dependency and having a Throwable
error type.
Tomorrow’s goal may be a better investigation of HTTP4S library and ZIO datatypes as well. Also, I’d like to perform also a proper HTTP invocation using the sourcecode I am writing.
6th December 2020
Tonight I am feeling puzzled because of strange NoSuchMethodError
exception occurring, i.e.:
java.lang.NoSuchMethodError: 'zio.ZIO zio.ZIO$.disown(zio.Fiber)'
at zio.interop.CatsConcurrentEffect.$anonfun$runCancelable$10(cats.scala:192)
at zio.ZIO$TapFn.apply(ZIO.scala:4137)
at zio.ZIO$TapFn.apply(ZIO.scala:4135)
at zio.internal.FiberContext.evaluateNow(FiberContext.scala:916)
at zio.Runtime.unsafeRunWith(Runtime.scala:207)
at zio.Runtime.unsafeRunSync(Runtime.scala:81)
at zio.Runtime.unsafeRunSync$(Runtime.scala:78)
at zio.Runtime$$anon$3.unsafeRunSync(Runtime.scala:273)
at zio.Runtime.unsafeRun(Runtime.scala:58)
at zio.Runtime.unsafeRun$(Runtime.scala:57)
at zio.Runtime$$anon$3.unsafeRun(Runtime.scala:273)
this is happening while trying to launch a sample app written to perform a dummy HTTP GET request towards a publicly exposed endpoint.
I am still facing problems in understanding all the ZIO machinery because of the paradigm shift that this library is bringing. Indeed, I still don’t get a working muscle memory regarding the scaffolding of all the parts required to make the code compiling.
For example, how is it possible to get an exitCode
of a ZIO[ZEnv, Throwable, Unit]
instance running at the end of the world?
7th December 2020
JavaScript interlude today A GitHub user reported an issue in vue-country-flag
about the fact that the component does not support Vue 3.
So, I spent some time trying to figure out to make the component working with latest version of Vue. Basically, to get the expected behavior I have to rebuild the component sourcecode to make it compliant with the latest features of Vue.
In order to achieve that, I have to bump all the devDependencies
versions of vue-country-flag
and setup a monorepo configuration, possibly with Lerna, to support some mechanism to make the component buildable both for Vue2 and Vue3.
I made some steps toward the expected outcome, but I am still facing some issues in making all the latest versions of the dependencies working properly. In particular, the Jest tests of the component are not working anymore because of some dependency issue
As a bonus note, I stumbled upon an updated version of vue-sfc-rollup
: it’s the library I used to build this SFC. This updated version of the library looks long way improved if compared with the older version I used to build vue-country-flag
.
I hope to provide this Vue3 support soon, so I could switch back to ZIO in next days!
8th December 2020
Today I spent some time on vue-country-flag
. I was able to setup a working Lerna monorepo package configuration for the SFC component.
Also, I did some manual tests of building up both packages for the older Vue2 and the newer Vue3 versions through lerna
CLI commands. So far they work without particular issues.
However, in order to publish the component on NPM, I still need to fix some missing parts, such as the non working tests. Probably, tests are failing because of some version misconfigurations.
The aim for tomorrow is to fix this tests issue and release both the Vue2 and Vue3 version of vue-country-flag
.
9th December 2020
Another interlude today! Indeed, at my company, a CTF challenge has started, so today I spent my spare time trying to solve some of the challenges. So far I was able to solve two of them. The first one required some Python scripting, while the second one was about an esoteric language. Actually the latter was quite easy to solve because, once I found a proper interpreter to read the esoteric code, the script itself returned the expected challenge outcome.
I hope to solve others of these challenges in the next days.
10th December 2020
Another day spent in solving some of the CTF challenges. Today I’ve been trying to setup a ML model to detect handwritten captchas. Thanks to this initiative I am playing a little with Python. I wasn’t familiar at all with the language. Needless to say, I dislike the fact it’s not statically typed, but I admit it has an humongous set of helpful libraries. Probably today I won’t solve any challenge since the one I am focusing on is quite difficult.
11th December 2020
I made some progress in implementing a Virtual Machine for resolving another CTF challenge. I did the implementation using Python, so I have been spending time in improving my settleness with the language.
The implemented VM is quite simple, and so far I have some issue in managing the jmp
operations. Hopefully tomorrow will be the right day to complete the VM implementation in order to solve some other CTF challenges.
12th December 2020
Few progresses made while trying to solve the CTF challenges. I am still implement some parts of the Virtual Machine I was mentioning yesterday. Probably I spotted the bug causing the jmp
operation not working: it should be something related to the return registry of the Jump operation itself. I am investigating on it.
Instead, referring to the other challenges I made some progress in the one containing the first 10 million digits of the Pi Number, but so far I was not able to complete it yet.
13th December 2020
Hooray! I finally fixed all the issues in the Virtual Machine I was developing for the Capture the Flag challenge . Thanks to these fixes I was able to launch the binary file containing the challenge and eventually, I solved the Zork Maze getting the expected Flag. It was a very funny game and it helped me in solving another challenge of the list. Now I need to solve only four more challenges in order to get all the missing flags. I hope I’ll be able to do that soon.
14th December 2020
Today I am trying to solve another challenge using the VM implemented yesterday. I have some intuitions about how to solve it, but so far the outcome is not yet the expected flag. I will spend few more hours in trying to solve this challenge and after that I will stop to have fun with these CTF challenges, since the due date for the final submissions is tomorrow afternoon.
15th December 2020
Alas, the time for completing the challenges is over: I was able to solve 6 challenges of 10. Of the missing ones I had no clues on how to solve two of these, while for the others I was quite near to the solution. Specifically I was near to solve:
1 - a challenge requiring the implementation of a Machine Learning training algorithm; 2 - a challenge requiring the customization of a Virtual Machine assembly language;
Today I tried to solve both of these, but the time was not enough neither to implement the ML algorithm nor to find the solution of the VM challenge.
However, during these days, I had fun hacking with the CTF challenges, since I learn interesting stuff.
16th December 2020
After few days spent solving CTF challenges I decided to have a break and today I spent my daily programming hour on giving back to the community by answering some questions on StackOverflow. I answered to a question about taking browser screenshots using Vue.js.
It was interesting because in order to answer I had to try few tricks on JavaScript canvas and its drawImage
function.
17th December 2020
The daily task is about vue-country-flag
. The idea is to fix the test issues that I am still facing after the library updates. At the moment I’ve not been able yet to find a solution for that. However the Lerna scaffolding is almost done. Tomorrow I’d be able to release a Vue3 version of the component.
18th December 2020
Still no solution found for the failing tests today. However I did further investigations: the problem seems related to the building of the Vue component during the mounting phase. Tomorrow I’ll try to fix the problem by switching tests from Vue2 to Vue3.
19th December 2020
I tried to switch from Vue2 to Vue3 tests. Few steps ahead done. However, I am still facing some dependencies problems because some of their versions are not compliant yet with next Vue version.
20th December 2020
Day off today.
21st December 2020
No steps ahead with vue-country-flag
. Today I was investigating again on the dependency version incompatibilities. Alas, the tests are still failing because of some problems in bundling scoped CSS in the building phase of the Vue component. Probably the issue is related to some devDependencies
required for building the SFC.
Tomorrow I’ll try to spend more than one hour on the topic, since small time slots are not enough to address the problem.
Small aside: today I got the Hacktoberfest 2020 swag, six years in a row!
22nd December 2020
Yes! Finally I was able to fix the issue of vue-country-flag
failing tests. As suspected, it was related to some third party dependencies misconfiguration. Indeed, it was because the lasest version of Babel does not fit well with the Babel package required for testing, namely babel-jest
.
After some trial and errors, I came to a working confiuration, that is installing the following:
npm install --save-dev babel-jest @babel/core [email protected]
See here for further details.
23rd December 2020
Today I made an enhancement to vue-country-flag
: some user reported the need of the support for the Soviet Union flag, so my daily development hour was spent in adding it. Latest version of the component now provides the required flag as well.
24th December 2020
25th December 2020
26th December 2020
27th December 2020
28th December 2020
29th December 2020
30th December 2020
31st December 2020
Devember 2020 statement
I will participate to the next Devember. My Devember will be programming a playground application to learn ZIO. I promise I will program for my Devember for at least an hour, every day of the next December. I will also write a daily public devlog and will make the produced code publicly available on the internet. No matter what, I will keep my promise.