tag:blogger.com,1999:blog-49336129582796840582024-02-24T17:54:24.098-08:00ShinTakezou's BlogThis is a personal blog (mainly about programming computer, and more)Maurohttp://www.blogger.com/profile/00097378869539038765noreply@blogger.comBlogger108125tag:blogger.com,1999:blog-4933612958279684058.post-77623739381945988582024-02-11T19:00:00.000-08:002024-02-11T19:00:00.127-08:00Run Length Encoding<!-- -*- coding:utf-8-unix; -*- -->
Let’s have a little bit of programming fun with data
compression.
Run-length encoding
The idea is to remove adjacent repetitions of a byte. If I have a
string such as
aaaaaaaaaaaaaaaaaaaa
I could reduce the size of the actual data encoding
something like:
the byte “a” repeated 20 times
But we can have also bytes that do not repeat:
Maurohttp://www.blogger.com/profile/00097378869539038765noreply@blogger.com0tag:blogger.com,1999:blog-4933612958279684058.post-70300861069047076042023-12-08T21:00:00.000-08:002023-12-08T21:00:00.134-08:00On case sensitiveness and path syntax
Just another filler article. And what is this about? The usual stuff, of course!
To be or not to be case sensitive? That’s the question!
In languages like C, C++, and others, symbols are case sensitive. The variable x is different from X, the function get_name() isn’t the same as get_naMe(), and so on.
In few languages the case is semantically relevant1: in Go the first letter case determinesMaurohttp://www.blogger.com/profile/00097378869539038765noreply@blogger.com0tag:blogger.com,1999:blog-4933612958279684058.post-12467874830388916242023-10-22T08:17:00.002-07:002023-10-28T05:25:34.329-07:00C++ slower than Java: the danger of AI, or HS
Once in a while I look up articles about programming languages, just to waste a little bit of precious time or to find inspiring quotes agreeing with my fact-grounded truth about languages which suck, despite being widely used, and those that could rule half the world, if only programming hadn’t become like modern music and art: coloured tasteless shit put inside glossy glassy windows which byMaurohttp://www.blogger.com/profile/00097378869539038765noreply@blogger.com0tag:blogger.com,1999:blog-4933612958279684058.post-38352145433992998392021-04-11T10:11:00.004-07:002021-04-11T10:11:00.207-07:00Java sucks, yes it sucks<!-- mode: pandoc; coding: utf-8-unix; -->
Java sucks.
This is a fact. One of the usual reaction is that it can’t be, because it is used everywhere. But widespread adoption doesn’t mean anything — lucky circumstances, inertia, conformism, money, lack of resourcefulness, bandwagon-like machanisms, or alike, help the language to keep its undeserved status.
The fact that a programming language Maurohttp://www.blogger.com/profile/00097378869539038765noreply@blogger.com6tag:blogger.com,1999:blog-4933612958279684058.post-36644446829487097582020-10-03T09:29:00.002-07:002020-10-03T11:54:48.071-07:00Object-Oriented Programming is Embarrassing?I like very much articles and videos smashing C++ and object oriented paradigm as it is now.
Here an example of video about OOP, it goes by the title of Object-Oriented Programming is Embarrassing. Woa.
Don’t take me wrong: OOP can be good. Just not used so much and how it is often used.
And about C++, not strictly related to OOP, but the story is this: I hated the language until C++11, when I Maurohttp://www.blogger.com/profile/00097378869539038765noreply@blogger.com1tag:blogger.com,1999:blog-4933612958279684058.post-28335917180571317322020-10-03T08:11:00.001-07:002020-10-03T08:11:23.023-07:00Object-Oriented Programming is Garbage: 3800 SLOC exampleMaurohttp://www.blogger.com/profile/00097378869539038765noreply@blogger.com0tag:blogger.com,1999:blog-4933612958279684058.post-61323281877093819062020-10-02T21:29:00.014-07:002021-02-09T23:34:37.139-08:00Chaining mistakes<!-- -*- mode:pandoc; coding:utf-8-unix; -*- -->
You shall never do the same mistake again.
Unless you don’t recognize that it’s the same error.
First, let’s summarize what I’ve learned when you work on old, cluttered codebases which should be rewritten from scratch but nobody dares.
Do not trust functions’ or variables’ names
Do not trust functions’ arguments to do what’s suggested by theirMaurohttp://www.blogger.com/profile/00097378869539038765noreply@blogger.com0tag:blogger.com,1999:blog-4933612958279684058.post-84165320714688317762020-09-25T21:29:00.001-07:002020-09-25T21:29:00.813-07:00Vaporware 2020-2021So far, I “have” few chess engines which are pure vaporware, with the only exception of one, which did play against itself, but it was a mess already and then it was scratched away.
By そらみみ (Soramimi) - Own work, CC BY-SA 4.0, https://commons.wikimedia.org/w/index.php?curid=47231683
Currently I’ve put more efforts in finding names for this vaporware of mine than in completing just Maurohttp://www.blogger.com/profile/00097378869539038765noreply@blogger.com0tag:blogger.com,1999:blog-4933612958279684058.post-80637459224303829102020-08-30T21:29:00.001-07:002020-08-30T21:29:02.353-07:00Ada 2020 target syntax (at)I’ve already talked a little bit about Ada++ — just a waste of time, in my opinion.
Somebody once told me that he liked C because you can write
a++;
where other languages require
a := a + 1;
I don’t see the problem, but imagine that the variable to be incremented is longer:
A_Long_Name_For_A_Var := A_Long_Name_For_A_Var + 1;
Well, in Ada 2020 you can write
A_Long_Name_For_A_Var := @ +Maurohttp://www.blogger.com/profile/00097378869539038765noreply@blogger.com0tag:blogger.com,1999:blog-4933612958279684058.post-52174955419384846942020-08-29T21:29:00.001-07:002020-08-29T21:29:00.868-07:00Top 10 highest paid programming languagesI don’t think one should learn a programming language just because it is well paid. A programming language is just a tool, you can use it well or bad, to build or destroy, to make life great or miserable to your future self and your collegues — and your employer, I forgot to mention it…
But real life, alas, works like this: you choose your tools not just because they are the best to do what Maurohttp://www.blogger.com/profile/00097378869539038765noreply@blogger.com0tag:blogger.com,1999:blog-4933612958279684058.post-62752471311359873182020-08-15T07:12:00.000-07:002020-08-15T07:12:10.680-07:00Absurd dependenciesWriting something in texinfo, it happens that I can’t use @subentry for the index. It seems Ubuntu 19.10 has an old texinfo. So I downloaded the latest and wanted to purge the old one. But:
$ sudo apt-get remove texinfo
[sudo] password for user:
Reading package lists... Done
Building dependency tree
Reading state information... Done
...
The following packages will be REMOVED:
Maurohttp://www.blogger.com/profile/00097378869539038765noreply@blogger.com0tag:blogger.com,1999:blog-4933612958279684058.post-2153881828139987682020-08-09T21:29:00.001-07:002020-08-09T21:29:00.739-07:00Old times newsWeeks ago I digged into one of my dad’s hard drive on his Microsoft Windows office machine, searching for interesting stuffs he could have left there. Since I hadn’t the time to cope with all the amount of data found there, I did a simple
dir /s ... >a_file.txt
(or something like this) to have a list to check against the content of other hard drives at home. Likely what’s there was already Maurohttp://www.blogger.com/profile/00097378869539038765noreply@blogger.com0tag:blogger.com,1999:blog-4933612958279684058.post-31260551343263985382020-07-31T21:29:00.000-07:002020-07-31T21:29:01.014-07:00Ada++ what?Not very much time ago I commented on a post on LinkedIn. The post promoted the “Ada++” language as some sort of better Ada. As an Ada hobby newcomer who began to like the language very much (and who started to consider C++ acceptable in its modern revisions, and yet continues to think not very much of that really important and powerful language), I felt horrified. Ada isn’t perfect, nothing is Maurohttp://www.blogger.com/profile/00097378869539038765noreply@blogger.com0tag:blogger.com,1999:blog-4933612958279684058.post-39193578179305619292020-06-21T09:29:00.000-07:002020-06-21T09:29:00.173-07:00Golfrun reloaded in lisp?Currently I’m mainly trying to learn more about electronics and hardware, beyond the basic things I already knew (also opened a new Italian blog to dump whatever related — everything indeed begins from my dad’s death and his stuffs). But I never stop to try and learn other things, especially in the software field where I feel more comfortable.
It isn’t good — they say — not to focus on one Maurohttp://www.blogger.com/profile/00097378869539038765noreply@blogger.com0tag:blogger.com,1999:blog-4933612958279684058.post-81340575900190734132020-06-20T09:29:00.002-07:002020-06-20T09:29:00.525-07:00Snap the back of those snapsI’ve already said how annoying Ubuntu is getting. Already said something about that crappy things they call snaps, that idiotic insane attempt to replace the honorable and mostly working and easy enough (from the users’ point of view) usual package system used by Debian and other “.deb” distros, with the “.rpm” as competing school (and few others in other distros).
Leaving apart the fact that Maurohttp://www.blogger.com/profile/00097378869539038765noreply@blogger.com0tag:blogger.com,1999:blog-4933612958279684058.post-44118775383229311092020-05-23T00:20:00.001-07:002020-05-23T00:20:42.479-07:00Programming languages you should learn in 2021This kind of title appears once in a while in feeds and in search results about languages (I do search for languages trends).
I want to make my own list. I am not going to suggest a language because they can give you a job, high salary, or because it’s what all the buzz is about. These factors mean nothing.
I am not going to explain why you should learn something about all those languages: you Maurohttp://www.blogger.com/profile/00097378869539038765noreply@blogger.com0tag:blogger.com,1999:blog-4933612958279684058.post-34819910778345464842020-05-10T08:58:00.004-07:002020-09-27T13:04:25.543-07:00Annoying UbuntuUbuntu is getting more annoying. Recently — I can’t remember exactly when — I’ve got a forced update which could not be interrupted. Very microsoftwindowish.
Now, it’s trying to make me upgrade the system to Ubuntu 20.04 LTS. The LTS bit almost got me, so maybe I’ve a little bit of peace.
But it told me it could take several hours. This made me think and check what’s in this 20.04, codenamed Maurohttp://www.blogger.com/profile/00097378869539038765noreply@blogger.com0tag:blogger.com,1999:blog-4933612958279684058.post-72331120592056369172019-10-05T11:00:00.000-07:002019-10-11T13:57:30.030-07:00Enumeration (enum) in Perl6Perl6 has enum. Now I have acquired a little bit of the Ada mindset, so I expected something similar. But Perl6 isn’t Ada, of course, hence I was disappointed. Should I retune my expectations taking into account this fact?
Yes, but also no. Because Perl6 enumeration doesn’t feel completely right.
My problem was this: I wanted to use enumeration to label squares of a chessboard. Something like Maurohttp://www.blogger.com/profile/00097378869539038765noreply@blogger.com0tag:blogger.com,1999:blog-4933612958279684058.post-9126649769459115872019-06-23T09:00:00.000-07:002019-06-23T09:00:36.264-07:00Snippet/ Prolog in the Java documentationJust spotted this:
The type checker enforces type rules that are specified by means of Prolog clauses.
from here.
Maurohttp://www.blogger.com/profile/00097378869539038765noreply@blogger.com0tag:blogger.com,1999:blog-4933612958279684058.post-8999741038216882032019-04-16T14:25:00.000-07:002019-04-16T14:26:43.523-07:00Dynamic dispatching reloadedIn previous posts I was exploring a feature I am interested in, and which I have called in many different ways — here I will call it dynamic dispatching.
The previous articles:
Dynamic overloading
“Dynamic overloading” in other languages (not C++)
Conclusion of those posts: out of the box only Perl6 has it.
The story went on like this: I stirred the net for a solution in C++. And I obtained it.Maurohttp://www.blogger.com/profile/00097378869539038765noreply@blogger.com0tag:blogger.com,1999:blog-4933612958279684058.post-24813198169409496132019-04-14T16:30:00.000-07:002019-04-14T16:30:04.773-07:00Nested functionsSome languages allow nested functions (or procedures, or subroutines, or whatever you prefer to call them), others don't.
I think those can be useful and I wonder why they aren't embraced by all living programming languages.
The example are made thinking of this scenario: you have a structure (a compound type, a record, a…), and an array of this structure/type, and you want to count the Maurohttp://www.blogger.com/profile/00097378869539038765noreply@blogger.com0tag:blogger.com,1999:blog-4933612958279684058.post-44109493251724485382019-04-13T17:30:00.000-07:002019-04-14T02:17:04.659-07:00Changing input validation in an established APILet's suppose that your server S exposes an API and that this API is used by many clients, or maybe just one — it doesn't really matter.
Let's focus on a client only, let's call it C. Documents were exchanged between S and C, so to agree on the interface.
After that, tests were done and none raised issues or, if they did, they were fixed.
The tests stated that S and C can talk, that they can Maurohttp://www.blogger.com/profile/00097378869539038765noreply@blogger.com0tag:blogger.com,1999:blog-4933612958279684058.post-90841485493686028742019-03-11T12:58:00.000-07:002019-03-11T12:58:36.701-07:00This is google
I am not going to do anything about it. If there are interesting comments, they'll be lost. Hopefully I haven't relied on comments very much — thankfully no one, or few, cared to comment! There are maybe a couple of exceptions in this very same blog. As already written, I am not going to do anything about those, sorry.
But remember: Google can take away from you everything it's given before, Maurohttp://www.blogger.com/profile/00097378869539038765noreply@blogger.com0tag:blogger.com,1999:blog-4933612958279684058.post-60299740145494242142019-01-13T15:00:00.000-08:002019-01-13T15:00:08.939-08:00“Dynamic overloading” in other languages (not C++)In a previous post I've imagined that future C++ could dynamically dispatch a call to a proper function/method according to the derived types of its arguments — that is, dynamic overloading, whereas notoriously in C++ overloading is a compile time feature.
Now the question is: what about other languages?
Python
Python isn't statically typed; methods and functions can be overloaded, but the only Maurohttp://www.blogger.com/profile/00097378869539038765noreply@blogger.com0tag:blogger.com,1999:blog-4933612958279684058.post-80020242685077127852019-01-12T13:51:00.001-08:002019-01-14T12:50:54.538-08:00Dynamic overloadingI have always stated that I dislike C++. “Modern C++” (from C++11 on) changed a lot, but the language still has plenty of dark corners. And limits when you would like to achieve easily some goals, but the language reminds you it doesn't work that way, so things can become more complicated than you would like to think.
Overloading is static
By that I mean that the actual method, or function, Maurohttp://www.blogger.com/profile/00097378869539038765noreply@blogger.com0