Note: This article is about Chromium based browsers.

Remember the days when computers were configured to present the filesystem to the network by default in read/write mode? Those were the days. Today, though, everything is configured for security and browsers are no exceptions. One thing that annoyed me yesterday was CSP (Content Security Policy) which disallowed me to fetch from a web site information from another web site which was happy to provide it. The culprit was a meta tag that looks like this:
<meta http-equiv="Content-Security-Policy" content="...">

The content was configuring default-srcconnect-src, style-src, frame-src, worker-src, img-srcscript-srcfont-src! Everything. But I wasn't looking for a hack to disable CSP (well I was, but that's another story), I just wanted to test that, given a friendly CSP, I could connect to a specific web site and get the data that I wanted and do something with it. Surely in the developer tools of the browser I would find something that would allow me to temporarily disable CSP. No such luck!

Then I looked on the Internet to see what people were saying. All were complaining about "Refused to connect to [url] because it violates the following Content Security Policy directive..." and how it annoyed them, but there was no real solution. Here is what I found:

  • browser extensions to remove the CSP header
    • I assume this works, but it wasn't my case
  • browser extensions to remove content from the page from the Developer Tools
    • I tried one, but when it changed the content now the browser was crashing with an ugly Aw, snap! page with a Status_Access_Violation status
  • I tried ticking the web site's settings for Insecure content
    • How naïve to think that it would allow loading of insecure content
  • I tried browser command line flags and experimental flags
    • nothing worked

I was contemplating hacking the browser somehow when I stumbled upon this gem: Override files and HTTP response headers locally.

It is almost exactly what I was looking for, only it doesn't replace content with regular expressions but saves the entire content of a URL on the local drive and serves it from there, modified in whatever way you want. So if you want to alter a server rendered page you're out of luck.

How did I use it to remove the CSP? I went to sources, I configured the local overrides and I then edited the page (in the Sources panel) and simply deleted the annoying meta tag. Now it worked.

Hope it helps!

  I was thinking today about our (meaning "the Western Coalition" of countries with a common anti-Putin position) handling of the conflict in Ukraine. I was imagining a reporter trying to ascertain whether people support Ukraine or Russia, Zelensky or Putin, going on the street with a microphone and asking randomly for opinion. And I realized that would be impossible, because any positive support for Putin's aggression will immediately lead to negative personal consequences, so why would anyone be honest about that?

  Somehow, people saw there was a war in Ukraine and they thought it's like a Twitter war. "Russia attacked Ukraine. We're cancelling Russia!". Fine, people were trained to respond to conflict with some kind of mob action, do it your way! But how can you expect that the result of the same action will be different in the case of Russia? On Twitter people mob on someone until their life is ruined, they mob back stronger or they just don't care and leave Twitter. What exactly do people expect Putin is going to do? An insincere apology on Oprah? No. Either Russia will be ruined, with all of its people, they will mob back, and you don't want that from a nuclear power, or they will just not care and carry on, which will ruin both Russia and Ukraine, with all of their people.

  We are in a situation where our entire society punishes dialogue, even compassion. How can you resolve a conflict if you are unwilling to even consider the point of view of the other side? What do you expect? Putin to one day wake up and think "All these people say I am evil. Perhaps I am. Shame on me! Ok, guys, stop the war! Do no evil"? As long as open discussion of all of the view points - regardless of their validity or moral value - is impossible so is the end of the conflict outside the complete destruction of one or both sides.

  How exactly did societies that took pride in their democratic ideals reach a point where dissent is censored, dissenters punished, their lives destroyed and discussion stifled?

  How daft to believe that skirting the responsibilities of principle will ensure the victory of that principle. How idiotic to assume that a position of strength validates your moral stance. Putin does that! People from behind the Iron Curtain had that during the Communist era, where everything anyone would say is how wonderful our magnificent leader is and how the Communist ideals are all we think about. North Korea uses the same system. And now "the free world". "Oh, another tyrant! Let's tyrannize them!". 

  Taking a side in this is as debatable as in any other conflict because both sides would act righteously. What I am saying is that resolution of conflict lies in the ability to debate it, not in coercing people to sing your tune.

  There is a common task in Excel that seems should have a very simple solution. Alas, when googling for it you get all these inexplainable crappy "tutorial" sites that either show you something completely different or something that you cannot actually do because you don't have the latest version of Office. Well, enough of this!

  The task I am talking about is just selecting a range of values and concatenating them using a specified separator, what in a programming language like C# is string.Join or in JavaScript you get the array join function. I find it very useful when, for example, I copy a result from SQL and I want to generate an INSERT or UPDATE query. And the only out of the box solution is available for Office 365 alone: TEXTJOIN.

  You use it like =TEXTJOIN(", ", FALSE, A2:A8) or =TEXTJOIN(", ", FALSE, "The", "Lazy", "Fox"), where the parameters are:

  • a delimiter
  • a boolean to determine if empty cells are ignored
  • a series or text values or a range of cells

  But, you can have this working in whatever version of Excel you want by just using a User Defined Function (UDF), one specified in this lovely and totally underrated Stack Overflow answer: MS Excel - Concat with a delimiter.

  Long story short:

  • open the Excel sheet that you want to work on 
  • press Alt-F11 which will open the VBA interface
  • insert a new module
  • paste the code from the SO answer (also copy pasted here, for good measure)
  • press Alt-Q to leave
  • if you want to save the Excel with the function in it, you need to save it as a format that supports macros, like .xlsm

And look at the code. I mean, it's ugly, but it's easy to understand. What other things could you implement that would just simplify your work and allow Excel files to be smarter, without having to code an entire Excel add-in? I mean, I could just create my own GenerateSqlInsert function that would handle column names, NULL values, etc. 

Here is the TEXTJOIN mimicking UDF to insert in a module:

Function TEXTJOIN(delim As String, skipblank As Boolean, arr)
    Dim d As Long
    Dim c As Long
    Dim arr2()
    Dim t As Long, y As Long
    t = -1
    y = -1
    If TypeName(arr) = "Range" Then
        arr2 = arr.Value
    Else
        arr2 = arr
    End If
    On Error Resume Next
    t = UBound(arr2, 2)
    y = UBound(arr2, 1)
    On Error GoTo 0

    If t >= 0 And y >= 0 Then
        For c = LBound(arr2, 1) To UBound(arr2, 1)
            For d = LBound(arr2, 1) To UBound(arr2, 2)
                If arr2(c, d) <> "" Or Not skipblank Then
                    TEXTJOIN = TEXTJOIN & arr2(c, d) & delim
                End If
            Next d
        Next c
    Else
        For c = LBound(arr2) To UBound(arr2)
            If arr2(c) <> "" Or Not skipblank Then
                TEXTJOIN = TEXTJOIN & arr2(c) & delim
            End If
        Next c
    End If
    TEXTJOIN = Left(TEXTJOIN, Len(TEXTJOIN) - Len(delim))
End Function

Hope it helps!

and has 0 comments

  I was watching a silly movie today about an evil queen bent on world domination. And for the entire film all she did was posture and be evil. Whenever she needed something, she told her people to do it. And I asked myself: why do whatever the queen demands and not kill her on the spot? I mean, she sprawls in her throne while you are an armored and heavily armed soldier sitting right next to her. And the answer I found was: stories. The warrior believes that the queen has the right and the power to command him, so she does. There is nothing intrinsically powerful in the woman herself, just the stories people believe about her.

  And this applies to you as well. Your boss, your wife, your country, your people, your family, your goals and how you choose to go for them are all stories that you tell yourself. It applies to the stock market as well, where stocks have no value unless someone believes in them. And just like there, the stories told to large audiences have large effects as even a small percentage of people get to believe them. Perhaps nothing has any value unless somebody believes it has.

  Generals have known this for a long long time and they apply it today. Just try to find any news source that isn't biased one way or another. The war "in Ukraine" has already become a world war, it's just not fought with conventional weapons. The censorship is there, applied over the entire western area of influence, just as it does in Russia and in China and everywhere to where we used to scoff with superior moral conviction and accuse them of not being free. Conviction is a funny word, as it implies unshakeable belief, the worst kind there is. Convict has the same etymology.

  I think I am lucky for being born when I was. I was raised in a Communist dystopia that was already crumbling at the time, with people telling me stories (that word again) about the wonderful world outside our borders, where people were rich, content and free. I was raised reading and watching science fiction that depicted a near future filled with technology and wonder, fantastical or new planetary worlds, but most importantly, hope. I remember calculating that in the year 2000 I would be 23, a rather wonderful age to be going to the Moon and exploring the Solar System.

  Well, now it's 2022 and everywhere I look I see directed stories, weaponized to nudge me in a direction or another. And like any instrument wielded by blunt people, these stories are always negative, lacking inspiration - both in their creation and their effect, attempting to make me feel scared, insecure, overwhelmed, outraged, offended, angry. Because when you have those feelings you accept authority and the orders you get, no matter how dumb, violent or deleterious. The attack on the Capitol was caused by that kind of storytelling, the war in Ukraine keeps going because of these type of stories, both on the Russian and the anti-Russian side. 

  We are doing it to ourselves, pushing these narratives that in the end hurt us just as much. Gone is the hopeful post-scarcity future of Star Trek, where people understand living to eat and eating to live is not the way to live. Gone are the rebel fighters of Star Wars and the noble principles they were guided by. Gone are the Russian teams exploring the cosmos and solving problems using science. Everything is now anger, hate, suffering, explosions, political scheming, social agendas, special effects. We are darkening our stories and dimming ourselves.

  And I do believe that hope is the antidote. Not because reasons to hope, but despite their absence. A hopeful story is inspiring, protective and kind. In the fourth season of Stranger Things people use a verse from the Bible: "Do not be overcome by evil, but overcome evil with good." Of course, those people then proceed to arm themselves and try to kill a bunch of kids for playing D&D, another example on how easily hope can be corrupted into fear and anger. The good stories are of people who better themselves and think of others, not of defeating evil. There is no hope in seeing the evil queen stabbed and thrown into the lava, the real story is how the heroes overcome the evil in themselves.

  I am an atheist. I believe (heh!) that we don't need gods to be decent and that thinking things over will always yield the best solution. But I understand religion, how it tries to inspire, to raise hope, even if in the end it is misused by shallow people to control and usurp. I don't have an answer for everyone, but I have hope, I must have it. The alternative is to remove myself from the world, or join it in its perceived evil. I am sure there are a lot of people like me, though. Even if we feel alone, trapped in an eternal WTF moment, we are many. The number shouldn't matter, though, except as a reason to not abandon the world, to still hold hope for it, for each of us can hold. Hold hope, hold ourselves or simply hold against.

  Star Trek and old Russian sci-fi will not happen while I live. The world will not wake. As a pessimist at heart, I don't expect good things to happen, especially this first half of a century. But I will continue to watch and hope for a good ending.

and has 0 comments

  There is something really cool about Twitter, but it's not what you probably think. Elon Musk wants to buy it to promote free speech, but also criticizes the way it started at the same time as Facebook yet it made no money. That's what's cool about Twitter: it made no money!

  Having the freedom to express oneself with the only limitation of constraining length to 140 or 280 characters per message is the core of Twitter. I agree with Musk that political censorship of content is evil and that it is slowly strangling what Twitter was supposed to be, but I disagree with the idea that it should be monetized more. That's what Facebook does and for better or worse, it covers that niche. I have to say that if there is someone who can make Twitter both make money and keep its core values intact, that's probably Elon Musk, but I dread the possibility of failure in the attempt.

  Now, don't get me wrong: I almost never tweet. I have an automated system to announce new blog posts on Twitter and lately I've started writing short (Twitter core!!) reviews on the TV series I've watched. In my mind, TV series - should I still call them TV? - don't deserve the attention that I give movies in my IMDb reviews or separate blog posts like books and that is why I write there. Nor do I regularly read Twitter posts. I have a system that translates Twitter accounts into RSS feeds and I sometimes read the content on my feed reader - thank you, Nitter!

  The reason why I am writing this post is ideological, not technical or self interested. If Twitter disappeared tomorrow, I wouldn't really feel the loss. But I do believe its values are important for humanity as a whole. In fact, I don't fully agree with Musk that bots are a problem, because Twitter was designed with automation in mind. A public square, he calls it. I don't like public squares, or anything public, to be honest. What I value is personal and my belief is that this is what we should try to preserve.

  Strangely enough, the trigger for this post was a Netflix documentary about Richard Burton. Now, there is a man! He came from a poor, hard mining town from Wales. He started with a strong regional accent and trained every day to have an English one. From a family of 13 (or 11, if you discount infant mortality, as he did) he choose a drama teacher as a parent - and took his last name, with his family's blessing. Can you imagine being part of a family that is glad to give you for adoption, because that's what's best for you? He was beautiful, hard, passionate and articulate, charming, violent, ruthless, living life to the fullest and hating himself for it. He became a Hollywood icon, yet admitted he had no idea why. That's what men were like half a century ago. I am old enough to have seen some of his movies and to appreciate him as an actor. And while I was watching the documentary, I imagined what Twitter would say about Burton now and what the people behind those tweets would be. The petty, ugly, pathetic crowd that can't stand someone so vastly different, so as not to say superior.

  But it's not Twitter that would be at fault. In fact, when Richard Burton chose to leave his faithful wife for many years for Elizabeth Taylor he was sued by a "subcommittee" for indecent behavior. They didn't have Twitter, but they reveled in outrage just as well. And it's not like he was any kind of saint. He was rigid and cruel and judgmental and lacking any shyness at saying what he though or felt was wrong with you. The issue is not what you do, but why you do it for.

  That's what I believe is where the line should be drawn. It's not about the words you use, but why you said them in the first place. It's not about preserving some social contract that everybody should be forced to obey, but about one's position about particular events. It's not even about "do no harm", because one's harm is another's pleasure. It is about intention.

  Coming back to Twitter and its most famous side effect, cancel culture: I think cancel culture is despicable, but I also partially agree with its defenders or the people who deny its existence. Because the reason why cancelling someone is toxic is not because of people disagreeing, but because people fear being on the wrong side. Once there is enough momentum and energy poured into destroying the life of one person, it becomes a snowball of fear, with people refusing to be "associated" with cancelled people. It's that fear that is the problem, the weak cowardly fear that prevents one from staying the course or ignoring the drama or even supporting someone for mostly economic reasons. Yes, that's what cancel culture is: people afraid to lose their money or some other currency because of other people hating each other. Cancel culture is not new, it just become globalized. If people in Richard Burton's time disliked a person so much they couldn't stand their existence, all that person had to do is leave and start living in some other place. Nowadays, it's all public (heh!) and global. You can't escape being hated.

  Yet the problem is not globalization, is people who somehow care what people they don't care about care about. Yes, you got a bad rep somewhere in the world, from people I don't know. I will be circumspect, but I will use my own judgement about you. Not doing that is lazy and stupid and, again, petty. As George Carlin once said "I never fucked a ten! But I once fucked five twos!". A crowd of stupid, petty, lazy people does not a great person make.

  Bottom line: congrats for making it this far into my rant. People are bound to be different and disagree with each other. Fearing to associate with someone because they are shunned by another group of people is just a feeling. Your choice is what matters. Twitter is a platform, a tool, and what matters is the ability to express oneself and to filter out people you don't want to hear from. That's what a person does and that's what the Internet should preserve. Not the mobs, not the fake outrage to get social points, but the personal: freedom of expression and freedom to ignore whatever you want.

  If Elon Musk would ask my opinion (why would he?!) I would tell him that people need more filters. Enable people to ignore what they choose to ignore and they will be less hateful. That also applies to ads, by the way. Every time I see an angry person obliquely or directly attacking a group that I am even remotely part of I feel attacked and I get angry, too. I didn't want to read that person's opinion and I don't care for it, but it got shoved in my face. If I could just ignore them, I would be less angry and more positive, as would my tweets. And believe me, I used Twitter's word filtering already. It filters out stuff like -isms, politics, U.S. presidents and so on. You see? That's a personal choice, to move away from hatred and judgement. Do it, too, and life will feel so much better. Becoming an outraged activist for something is not an inevitability, it's a choice.

and has 0 comments

  Americans want to think of themselves as gods, the better of humanity, the all powerful rulers of the world. And the reason they get to think that is that we want them to be so. We entrust them with the faith of the world just like ordinary Russians believe Putin to be their savior. Yet once that faith is gone, so is their power, because with great power comes ... pardon the sticky platitude... great responsibility.

  The U.S. economy is not resilient because of something they do, but because all the other economies anchor to it. It cannot fail because then the world would fail. Yet, one has to take care of said economy lest it will just become a joke no one believes in. Crises are loses of faith more than actual technical issues with whole economies.

  I will argue that the Americans did something right: they followed the money and indirectly attracted the science and the technology to maintain their growth. Now they have the responsibility to keep that growth going. It is not a given. Innovation needs to be nourished, risks be taken, solutions for new problems continuously found. But once you believe your own bullshit, that you're the best of them all, that you can't fail, that you need not do anything because your supremacy is ordained, you will fail and fail miserably.

  And no one actually wants that. Certainly not the Americans with their horrendous privilege, which is national more than anything like race, gender, religion or sexual orientation, which they keep focusing on as a diversion. And no, it's not a conspiracy, it's the direction their thoughts must take in order to deflect from the truth. Americans are weird because they can't be anything but. And certainly nobody else wants that Americans fail. Even "the enemies" like Iran or the vague terrorists, or China... they need the Americans to be where they are. Good or evil, they need to remain gods, otherwise the entire world belief structure would crumble. The U.S. is not the world, they are just the fixed point that Archimedes was talking about.

 It is complacency that will get us. Once we believe things are because they are we stop making efforts. Ironically, the military-industrial complex that we like to malign is the only thing that dispels dreams, acts based on facts and pushes for world domination not because it is inherited or deserved, but because it must be fought for.

 Funny enough, it is the economic markets like the stock market that show what the world will become. Years of growth vanish like dreams if the market sentiment shifts. Growth is slow and long term, falls are short and immediate. The world is now hanging by a thread, on the belief that goodness is real, that Americans will save us all, but they need to act on it. Knee-jerk reactions and "we can't fail because we are right" discourse will not cut it. You guys need to lead, not just rule!

  In summary: monkey humans need an Alpha. In groups of people we have one person, in countries we have a government (or for the stupid ones, a person) and in groups of countries, a country. The Alpha will first rise on their own strength, then on the belief of others on their own strength, then on their ability to influence the beliefs of others. Finally they will lead as gods or die as devils. There are no alternatives.

and has 0 comments

  Decency makes us abstain from doing something that we could do, we might be inclined to do, but we shouldn't do. It's living according to some general principles that are intimately connected to our own identity. And when someone else is indecent, we try to steer them towards the "right path", for our own sake as well as theirs. This is what I was raised to think. Today, though, decency is more and more proclaimed for actively opposing things that are declared indecent and nothing else. It's the glee that gives it away, that twisted joy of destroying somebody else after having being given permission to do so. You see it in old photos, where decent town folk were happily and communally lynching some poor soul. After half a century the world is finally becoming a global village, but not because of the free sharing of information, as the creators of the Internet naively believed, but because of social media and 24 hour news cycles. And we are behaving like villagers in tiny isolated bigoted villages.

  South Park is a comedy animated show that has a similar premise: a small U.S. town as a mirror for the world at large. And while 25 years ago that was a funny idea, now it feels weirdly prescient. The latest episode of the show depicts the vilifying of some local residents of Russian descent because of the Ukraine conflict as a symptom of nostalgia towards the Cold War era. Then too, people were feeling mighty good about themselves as they were fighting the Ruskies, the Commies, the Hippies, or anything that was threatening democracy and the American way of life.

  This is not an American affliction as it is human nature. Witch hunts, lynching, playing games with the heads of your enemies, sacrificing virgins, they all have the same thing in common: that feeling that you have social permission to hurt others and that if they are bad, that makes you good. But acting good is what makes you good, not merely destroying evil. When Stalin was fighting Hitler no one said what a nice decent guy Stalin was. Yet now this mob mentality has been exported, globalized, strengthened by the sheer number of people that now participate. It's not easy to mention decency when thousands of people may turn on you for defending their sworn enemy. This "either with us or against us" feeling is also old and symmetrically evil, because usually all sides harbor it towards the others.

  I have started this post two times before deleting everything and starting again. At first I was continuing the story of the playground war, South Park style, where the town people refuse service to the family of the bully, start giving the victim crotch protectors and helmets at first, then baseball bats and pocket knives, slowly delimiting themselves from that family and ostracizing it as "other", even while the two kids continue to go to school and the bullying continues. But it was the glee that gave it away. I was feeling smart pointing out the mistakes of others. Then I tried again, explaining how Putin is wrong, but that's not the fault of the entire Russian people, most of them already living in poverty and now suffering even more while the rich are merely inconvenienced. I also shed doubt on the principledness of vilifying Russia when we seem to do no such thing to Israel, for example. And then I felt fear! What if this is construed to be antisemitic or pro Putin? What if I want to get hired one day and corporate will use the post as proof that I am a terrible human being? Because some nations can be vilified, some must be, but other should never ever be. And I may be a terrible human being, as well.

  Isn't stifling free expression for the sake of democracy just as silly as invading a country for the sake of peace?

  Regardless of how I feel about it, I am inside the game already. I am not innocent, but corrupted by these ways of positioning and feeling and doing things. I am tempted to gleefully attack or to fearfully stay quiet even when I disagree. So take it with a grain of salt as I am making this plea for decency. The old kind, where acting badly against bad people is still bad and acting good and principled is necessary for the good of all.

  Only you can give yourself permission to do something, by the way.

and has 0 comments

  It all reminded me of a playground brawl between kids. Here is the big brawny kid, beating the smaller one. Other small kids shout in support of the victim, but neither does anything. Teachers preach sternly about principles that kids should obey, how bullying is just wrong and one shouldn't do it, parents at home advise kids to stand up for their rights and take a stand. The school psychologists preach that violence at home leads to violence in children and we are all victims. And the result? Small kids keep getting bullied.

  The small kid has options. He can fight - hopelessly, he can run - not for long, he can take a big stick from a friend and bloody the bully's nose - and be mauled for it. But more often they cower in fear, stunned, frozen, hoping things are not happening. And if they are, they won't be so bad. And if they are bad, they would eventually stop. His eyes dart from one person to another in the group of onlookers. "Please! Please, help me!" they silently beg. But some people are frozen, too, some are indifferent, some are expressing disapproval, but then moving on. Most of them pretend it doesn't happen.

  And the kid is thinking, stuck in his inadequate body: This will stop, because it doesn't make sense. And he thinks of all the ways of why his abuse does make sense. Perhaps they miscalculated somehow. Things have to make sense!

  Worse of all, some people would just assume that the bullied child deserves it. He must have done something! There must be a reason for why a kid would attack another. They might even consider various options. Does the bully have an abusive father or other family problems? Is it poverty? Is it education? Perhaps the smaller kid disrespected the larger one on account of religion, race or sexual orientation. Surely, a small kid in school would ONLY behave rationally! And the kid, too, gets to think that perhaps he does deserve it.

  That's us, surrounding ourselves in rationalizations, morals, laws and principles. Trying to contain reality in nice neat boxes and then deny there is anything outside those boxes.

  That's me, too. I watch and I am thinking. Maybe it is military exercises. How funny it would be for Russians to just stop and go home. OK, the mad discourse on TV is troubling, but maybe it's just a bargaining chip in a discussion I am not privy to. They invaded Ukraine, but maybe they stop at the border of the rebel regions. They attack the whole Ukraine, but surely they're gonna stop at its borders. They claim Transnistria is Russia, too, but maybe they won't attack Moldova. Maybe they will stop at the border of Moldova. Maybe they won't enter Romania! Maybe the economic sanctions and stern wording of the Western teachers is going to calm the kid down. Maybe no one will use nukes!! Perhaps they will not shoot each other's satellites from orbit, stranding everybody on this shit planet! Maybe China will stay out of it?

  Maybe Russia has a reason to do all of this, because of the US slowly suffocating that country, economically, militarily and culturally, using their EU henchmen!!! Yes! It all makes sense! It is domestic violence, if only Russia would go to therapy, everything would be all right. I mean, they HAVE TO act rationally, right? They're a country! A whole country big as a continent. And surely the West will understand they are people, too, and show them compassion and help them get past it. Aren't we all human? Can't Biden call Putin as tell him "Dude, chill! I apologize. Let me give you a hug. You are appreciated and I love you!". Isn't this just a joke? 

  I blame us. Whenever a new personality cult pops up we secretly (or less so) hope this is the one. That person who is really strong and not just posturing, intelligent not just conniving, competent not just overconfident, caring and not just obsessing, principled and not just frustrated. We crave for a god to follow and obey and who would make us feel safe. And we tried different things, too. Let's replace a person with multiple ones: senates, parliaments, committees, counsels, parties, syndicates, omertas, majority rule, Twitter likes. It never works. Every time, the power people wield gets to them and somehow... makes them less.

  As I stood there, watching Vladimir Putin explain like a stern grandfather who is also a complete psycho how their brothers across their border are not really a country, nor a people and he has absolute rights over them, I despaired. "Not again!", I thought. I am not much into history, but it felt familiar somehow. Are we getting one of these every century? The strongman going nuts with an entire country following him because... what else is there? For decades people have asked what has made people follow Hitler. The answer seems to be that they thought about it and then went "Meh!".

  And then I watched the valiant exponents of democracy: the EU, the UK, the US. All posturing, talking about principles and international law, begging Putin to stop, making stern discourses on how Putin doesn't have the right to do what he does. What are these people doing? I've worked for them, I know how ineffectual they are, I know that every word in their mouth is unrelated to the truth. They are not lies, per se, just complete fabrications and fantasies. Now, of all times, one should snap out of it, right? Nope. Not happening. They convince themselves that people can't think any other way than them. Surely Putin will stop when his country will slide into economic crisis, because we are all bureaucratic machines that care about profit only. Surely Putin will stop because Biden tells him to. Surely the EU's committees will find a way to word a stern letter that would convince Putin to think about humanity!

  We're screwed.

and has 0 comments

 So you clicked on this post because you thought that:

  • I was smart enough to know how to be better than anybody else
  • I could summarize all the ways to become so
  • I would generously share them with you
  • You would understand what I am telling you in 3 minutes or whatever your attention span is now

While I appreciate the sentiment, no, I am not that smart, nor am I that stupid. There are no shortcuts. Just start thinking for yourself and explore the world with care and terror and hope, like the rest of us. And most of all, stop clicking on "N ways to..." links.

and has 0 comments

The Nazi officer smirks, as the prisoner begs for his life. Instead of any human feelings, he just revels in the pain he inflicts. He is powerful, merciless, and stupid enough to be foiled by the heroes who, against their better interest, came to liberate the helpless victims of this evil butcher. Change the channel! The heartless businessman pushes for more sales of the opioid drug his company produces, destroying the lives of honest, hard working Americans living in flyover country. Change it again! The evil general commands the destruction of a helpless village, laughing maniacally while the future hero of the story vows revenge in Japanese.

You've heard it before, you've seen it before and you've read it before. The mindless, unreasonably evil character who has two purposes only: to be totally unlikeable, an example of what not to be, and to be defeated by the hero, an example of what you should be. But it's not enough! The hero must be a "normal" person, someone you can relate with: powerless, bound by social contracts, connected with people in their community, wanting nothing more than to live their life in peace. But no! This evil asshole is just determined to stand in the way for absolutely no other reason than gaining ultimate power, more than they, or anyone else, deserve. And the hero needs to overcome impossible odds just to have the opportunity to defeat, in an honorable way, the villain. In the end, they will prevail thanks to a combination of friendly help, evolving to a higher level of power (which was always inside them) and sheer dumb luck.

Now, the Dunning Kruger folk will just lap this story up, imagining themselves the hero, but realistic people will just think "wait a minute! If this guy who is well connected in his community, strong as an ox and looking like The Rock, after focused training that he immediately picks up finding magical and physical powers that are beyond reason, has almost no chance of defeating the villain and only gets there through luck, then what the hell chance does a normal human being have?". And a few broken people would ask themselves if the villain wasn't a bit right, wanting to destroy this pathetic place we called "the world".

Where did these stories come from? Why are we suffocated by them and still consuming them like addicts? What is the result of all that?

The psychopathic villain trope is just a version of the old fashioned fairy tale: the knight and the dragon, the peasant and the lord, the girl and the lecherous wizard, the light and the dark. It is the way we explain to little children, who have no frame of reference, that there are ways we prefer them to be and others than we do not. It's a condescending format, design to teach simple concept to little idiots, because they don't know better. Further on, as the child grows up, they should learn that there are nuances, that no one is truly evil or good, that all of us believe we are the protagonist, but we are just a part of a larger network of people. This we call "real life" and the black and white comic book story we call "fantasy", designed to alleviate our anguish.

Yet we stick to the fantasy, and we avoid reality. And it's easy! In fact, it's much easier than any other strategy: close your mind, split your understanding into just two parts, one where you feel comfortable and the other which must be destroyed in the name of all that is holy. To even consider the point of view of the other side if blasphemy and treason. In fact, there is no other side. There is your side and then there is evil, darkness, void, unknown. Which conveniently makes you the good guy who doesn't need to know anything about the other side.

OK, maybe you can't win every battle. Maybe you will never win any battle. But you are a warrior at heart! You don't actually have to do anything. And as you wait for the inevitable defeat of evil at your righteous hand, you can watch other heroes like yourself defeat evil, stupid, one sided villains. And it feels good. And it has been feeling good for as long as stories existed, then books, then plays, then movies and now video games. Yet never have we been bombarded, from every conceivable angle, with so many versions of the same thing.

If hero escapism was a pill that made life more bearable, now it's most of our lives: films, series, games, news. We were raised on them and we are being tamed by them every single day. They are so ubiquitous that if they are gone, we miss them. It's an addiction as toxic as any other. We can't live without it and we pay as much as necessary to get our hit. And this has been happening for at least two generations.

So when we are complaining that today's dumb entitled teenage fuck generation is incapable of understanding nuance, of moderation, of rational thought, of controlling their emotions, of paying attention for more than five minutes to anything, of dialogue, of empathy... it's not their fault. We raised them like this. We educated them in the belief that they are owed things without any effort, that their feelings are valid and good and that it's OK to consider everybody else evil as long as they are different enough. That we must be inclusive with any culture, as long as it is also inclusive, otherwise exclude the shit out of it.

The trope of the psychopathic villain did not teach these people to be heroes, it taught them to be the foil to the people too different from them. And here we are. Psychopaths on all sides, thinking they are good and righteous and that sooner or later ultimate power will be theirs. The only positive thing in all this: they believe the power is inside them and will reveal itself when most needed, without any effort or training. That's what makes them dumb psychotic evil villains, completely unreasonable and easy to defeat.

If only there were any smart heroes left.

and has 2 comments

  Half a year ago I was writing a piece about how the system is stacked against you, no matter where on the ladder you are. Nobody cares about you! was part depression and part experience, because I have worked in corporations most of my career and that's exactly what happens in real life. This post will not be in the "What's Siderite going to say to make us hate life and kill ourselves" category, though. Quite the opposite. I am going to tell you what the logical consequence of that dreary article is - and it's good!

  Think about it! Are there nice things in the world? And I am not talking about love, sunrises and cute kittens, but about human acts and artefacts. The answer is yes, or you are a lot more depressed than I've ever been. So, if the world is configured to not care about you or about anyone, if the logical best strategy is to do just as much as it is absolutely required and fake the rest, why is there human beauty out there?

  The answer is: every good and beautiful man made thing that you see in the world is by someone doing more than they were asked to do. It's a simple sentence, but a powerful reality. Every day people, like and unlike you and me, are defying the boring order of the universe to create beauty and to better the world. Let's say you play a game made by a big game company and you are enjoying it. - maybe not the entire game either, just some portion of it - I can assure you that is not the consequence of the money poured in it, but of some person who did a little more than the bare minimum. If you use a program, a boring one, like Office something, and you find a feature that blows your mind, be convinced that no one asked for it specifically and someone actually made an extra effort to put it there. If you like the way the handle of the knife feels in your hand when you're slicing bread, same.

  And yes, there is the theory that every act of altruism comes from selfishness, and you can abstract everything to mean anything when it involves humans, but I am not talking about people who want to make the world better or selfless angels who want to make others happy. I am talking here of the simple fact of doing more than necessary just because you want to. And I am not talking about some kind of artsy philosophical method of improving everything and sparking joy, but about at least one, just one act that is invested with a bit of a human person. They do what they were asked to, paid to, coerced to, bullied to, begged to, then they make another step. Maybe it's inertia, maybe it's not knowing when to stop or not knowing what's good for them, but they did it and in the act imbued something with a piece of their soul.

  OK, I know that this is more of a "diamond in the mud" category rather than a positive message, but have you ever considered that even the smallest joys in life may come from the acts of rebellion of others? Maybe it's not a diamond, maybe it's a shitty opal, but knowing that you found it in the mud gives it immense relative value. Finding the ugliness, the stupid, the petty, the outrageous is easy. Seeing something beautiful and knowing it grew out of this is rare and valuable.

and has 1 comment

Intro

  Labels. Why do we need them? At first it seems like a natural outcome of people trying to understand their surroundings: good/bad, light/dark, wet/dry, etc. It makes sense to start with a simplified model of reality when it is all brand new. However, as we grow, we soon realize that God/Devil is in the details, that taste is more a matter of subtlety than brute strength and that labels, as useful as they have been, sometimes need throwing away. As the old adage says: a beginner needs to learn the rules, an expert knows all the rules, a master knows when to break the rules.

  So how come, with such a general and all encompassing principle, proven many times over millennia, we still cling to labels? And not only to understand the world around, but to understand ourselves and, ultimately, define ourselves? Not only internally, but externally, as a society? Codifying them in laws and unspoken yet strongly enforced rules?

An innocent example

  Let me give you an example. When we enter adolescence we start getting sexually attracted by other people. So this imaginary adolescent (A) likes one girl, then another, then another. After three girls he decides, with the tacit and active approval of his relatives and friends, he is straight. Another imaginary adolescent (B) likes guys, so he's gay. And now, so that we can identify the usefulness of these concepts, we add a third adolescent (C). A sexy young stud that likes... girls, let's say, and has managed to not only like them, but successfully have sexual encounters with them. He has had sex with 20 girls. So tell me, who is more like who in this triangle of adolescents? How do you split this hyperplane of three people into two parts? How do you cluster these people into two groups? Because to me it seems that A and B are far more alike than any of them is similar to C. Moreover, is the sexual attraction pattern that has been established in early adolescence even stable? What happens if the next person A likes is another guy? Is he bisexual now? By how much? Is he 75% hetero?

  Leaving my personal thoughts aside, can anyone tell me what these labels are for? Because if you find yourself sexually attracted by someone, then for sure you don't need a statistical model to analyze that. Is it for the benefit of the other person? "Sorry, but I am straight", which would translate to something like "Oh, I have to tell you that, based on the statistical evidence for sexual attraction I have gathered, I seem to be exclusively attracted to girls. So don't take it personally. I have nothing against gay people, I just have a biological reason to reject any of your advances". Does that sound in any way useful? Especially since we are being taught that one does not refute another's reasons for sexual or romantic rejection, that they have the given right to unilaterally refuse, regardless of any rational reason.

  One might argue that these labels are like armor to define and strengthen the identity of people. You don't just observe you are straight or gay, you define yourself as such, thus avoiding confusion, minimizing internal conflict and adhering to a community. Then, collectively, one can fight the inevitable "You are weird and must die" situation in which all people find themselves in, at one time or the other, when facing people different from themselves. But then, isn't clearly defining a group of people painting a target on their back? Look at the LGBTQ... whatever community. They are actively combatting the discrimination and disrespect that is thrown at them by finely defining the specific sexual group they belong to, then bundling them all together into a community of completely different people. Because they have a common enemy, you see, the cis people (a term they had to invent to define the majority of people, so they don't have to define themselves as not normal). So if I am gay, for example, I am the G person, not the B person, which also accepts sexual encounters with people of the other sex. Why is that important?

  Why can't I fuck whoever I want to fuck, assuming they agree? Why do I need a label which will restrict my choices in the future?

  People managed to somehow debate gender now. And not in terms of "why does it matter?" but in "you didn't define it correctly. It's spelled Phemail, as per the new gender atlas of 2022!"

A less divisive topic

  And what I am saying is not related just to sexuality. Say race, to take something less divisive. Am I White? How do you know? Because the color of my skin? What if you found out that my parents are both Black and I have a skin condition? Is it ancestry, then? The proportion of genetic code from various (very vaguely defined) groups of people in my own? Then we get to the same thing: if my grandfather is Black, am I 25% Black? What if he was Japanese? What the hell does that matter anyway? Why do we need labels like "Caucasian", "non-White", "person of color", "African American"? Am I a European Romanian as opposed to a South Asian Romanian because his Indian-like race was enslaved in Europe a bunch of centuries ago? Who needs this crap? Is it to define values for eventual retribution for perceived historical slights? Is race an accounting concept?

  I identify as a software developer. I am more alike people writing software that with the majority of men, Romanians, sun deprived people with terribly white skin, guys who like girls or humans in general. And there are a lot of software people that are nothing like me. Is it a useful identity, then, other than for HR people? I would say no. No one cares anyway, except when meeting new people and they ask what I do, I tell them, then there is that awkward "Oh..." and they go ask someone else.

The hell with it

  And the holy trinity would not be complete without religion. Religion is a concept you choose! It's the only thing you are protected by law to believe despite any evidence and to act accordingly. It is the same as the identity shield portion of race or sexuality, but that's where the buck stops. No one can prove you are a Christian or a Buddhist. It's a completely arbitrary belief system that is codified only when interacting with other people. You do to Church and if they start singing, or doing strange hand gestures, you better know the lyrics and the gestures or they won't look positively on you. It's like the secret handshake of the gang in your neighborhood. But when you are all alone and you think about God, it's sure that you are thinking of it slightly different than any other person in the world. So why do you need the label? Why can't you believe in two gods, hedge your bets so to speak? You go to the mosque and then to the synagogue. Surely double dipping would be a worse sin than not believing in the true God, wouldn't it? And then, what God do you believe in more?

  Even nationality is stupid. Does the place where I was born define me, or maybe the one I lived the most in? It certainly influences my culture, my values and one can statistically infer many things about me from them, but they are just influences on the path of my life. Some may be important, some not, I may have rejected some or grew out of them. Other than administrative and bureaucratic reasons, nationality is again a mere choice!

  I agree with people who choose to define themselves in certain ways. I respect every personal choice as long as it doesn't hurt others. I am not against self-defining. What I am against, though, is about giving social and legal power to these labels. And then to redefine them again and again as times change. Think of the tortuous etymology of the word "antisemite" for example. You want to define yourself, fine! Don't impose it on me, though. "I identify as a serial killer. Please don't disrupt me in observing the rituals of my people and let me stab you!"

So what's your point?

  We live in a time where everybody and their grandmother decry divisiveness, extremism, polarization. It seems to me that if we want to minimize that, we should at least renounce placing people in disjunct boxes. One shouldn't care what my race, religion or sexuality is until it's relevant to some sort of interaction. And if they find out, it shouldn't be any more important than any other trivia about my person. I say fight the entire idea of labeling people, as a general principle, whether you do it to hurt them or to declaratively protect them. And if you want to build an atlas to categorize the weird and beautiful human species, do it from a place of observation, not coercion.

Forget canon

  Which brings me to the last point. Some people religiously defend their belief in ... imaginary characters and stories. You hear stuff like "In reality, Star Trek canon says that...". No. I have watched everything Star Trek. There is no canon. Canon is used in the concept of religious writings, where people arbitrarily decide what part of a religion is correct and for which part one should burn other people for supporting. It has no place in fiction. Good writing needs to be consistent. If it spreads over multiple decades, multiple writers, multiple IP owners and different times, it needs to adapt. You can say that something is stupidly inconsistent or that adapting old ideas to new times sometimes is detrimental to those ideas and you'd better start anew with fresh stuff. You might even call people idiots for the way they chose to do any of these things. What you cannot expect is canon for imagination! If you do, you are only helping lawyers carve out the landscape of human fantasy and parcel out terrain and capital for the people who care the least about your entertainment.

Conclusion

  Exploring a new domain always requires defining labels, as a simplistic model for charting the unknown. People are not a new domain, nor are they unknown. They may be unknowable, but they certainly don't belong in nicely shelved boxes in the warehouse of politicians, accountants or lawyers, people lacking all imagination or passion. If you believe the current model of interacting with the world is wrong, maybe the surest way to fix it is to renounce and denounce the labels that define the model.

and has 1 comment

  Money is the root of all evil is a saying that has proven itself time and time again. Trying to make money from something that was not meant to do that will always soil and corrupt it. It is the case of so called "superchats", chat entries that have money attached to them.

  Here is how it works. Some content creator is doing a live stream and people are discussing the subject in the chat. There have been donation systems that allow people to give money to the creator for a long time and even there you see there is a bit of an issue. The streamer is almost forced by politeness (and because it encourages viewers) to acknowledge every donation. So they punctuate their content with "X has given me Y. Thanks a lot, X". This diminishes, albeit in a small way, the quality of the streamed content. Superchats are this, times 100.

  You see, when a chat message comes with money attached, the streamers are again motivated to acknowledge it. However, this time they read aloud the content of the message as well and respond to it, even if it is just with a sentence. This leads to significantly more disruption, but also has secondary effects that are at the core of the system. People have now been tiered into the ones that write a message and are ignored and the ones that pay to not be ignored, regardless of how useless, stupid or aggressive their chat message is.

  The content creator has only a few options at their disposal:

  • treat the superchats just like normal chat messages, in which case people won't be motivated to superchat, leading to less money for the stream
  • acknowledge and reply to just some of the superchats, which is a form of gambling for the message sender, if you think about it
  • acknowledge and reply to all superchats, which leads to a "super" tier of discussion that can only be accessed if you pay for it

Now, I understand how this system brings more money to the stream, but at what cost? People who crave attention are not the ones that you want to bring to the forefront of any discussion, but even so, many of them are immature teens. In order to have the system working, you need to stream, which motivates the creator to make interactive content and as long as possible to the detriment of short, concise, researched content.

The result is an explosion of low quality live streams, playing (preying!) on people's biases and social instincts, funded by the money of children and highlighting fragments of discussions based on how much they paid and not the quality of their content. Superchats are a disease of the Internet, akin to infomercials, television ads or paid news items. And unlike these, there are no tools to remove the streamer acknowledgements of superchats from the stream.

I am not an activist, but the only way to get rid of this toxic system is to actively fight it. I wonder if it could be seen as gambling, in a legal context. That should shut it down.

  Every month or so I see another article posted by some dev, usually with a catchy title using words like "demystifying" or "understanding" or "N array methods you should be using" or "simplify your Javascript" or something similar. It has become so mundane and boring that it makes me mad someone is still trying to cache on these tired ideas to try to appear smart. So stop doing it! There is no need to explain methods that were introduced in 2009!

  But it gets worse. These articles are partially misleading because Javascript has evolved past the need to receive or return data as arrays. Let me demystify the hell out of you.

  First of all, the methods we are discussing here are .filter and .map. There is of course .reduce, but that one doesn't necessarily return an array. Ironically, one can write both .filter and .map as a reduce function, so fix that one and you can get far. There is also .sort, which for performance reasons works a bit differently and returns nothing, so it cannot be chained as the others can. All of these methods from the Array object have something in common: they receive functions as parameters that are then applied to all of the items in the array. Read that again: all of the items.

  Having functions as first class citizens of the language has always been the case for Javascript, so that's not a great new thing to teach developers. And now, with arrow functions, these methods are even easier to use because there are no scope issues that caused so many hidden errors in the past.

  Let's take a common use example for these methods for data display. You have many data records that need to be displayed. You have to first filter them using some search parameters, then you have to order them so you can take just a maximum of n records to display on a page. Because what you display is not necessarily what you have as a data source, you also apply a transformation function before returning something. The code would look like this:

var colors = [
  {    name: 'red',    R: 255,    G: 0,    B: 0  },
  {    name: 'blue',   R: 0,      G: 0,    B: 255  },
  {    name: 'green',  R: 0,      G: 255,  B: 0  },
  {    name: 'pink',   R: 255,    G: 128,  B: 128  }
];

// it would be more efficient to get the reddish colors in an array
// and sort only those, but we want to discuss chaining array methods
colors.sort((c1, c2) => c1.name > c2.name ? 1 : (c1.name < c2.name ? -1 : 0));

const result = colors
  .filter(c => c.R > c.G && c.R > c.B)
  .slice(page * pageSize, (page + 1) * pageSize)
  .map(c => ({
      name: c.name,
      color: `#${hex(c.R)}${hex(c.G)}${hex(c.B)}`
  }));

This code takes a bunch of colors that have RGB values and a name and returns a page (defined by page and pageSize) of the colors that are "reddish" (more red than blue and green) order by name. The resulting objects have a name and an HTML color string.

This works for an array of four elements, it works fine for arrays of thousands of elements, too, but let's look at what it is doing:

  • we pushed the sort up, thus sorting all colors in order to get the nice syntax at the end, rather than sorting just the reddish colors
  • we filtered all colors, even if we needed just pageSize elements
  • we created an array at every step (three times), even if we only needed one with a max size of pageSize

Let's write this in a classical way, with loops, to see how it works:

const result = [];
let i=0;
for (const c of colors) {
	if (c.R<c.G || c.R<c.B) continue;
	i++;
	if (i<page*pageSize) continue;
	result.push({
      name: c.name,
      color: `#${hex(c.R)}${hex(c.G)}${hex(c.B)}`
    });
	if (result.length>=pageSize) break;
}

And it does this:

  • it iterates through the colors array, but it has an exit condition
  • it ignores not reddish colors
  • it ignores the colors of previous pages, but without storing them anywhere
  • it stores the reddish colors in the result as their transformed version directly
  • it exits the loop if the result is the size of a page, thus only going through (page+1)*pageSize loops

No extra arrays, no extra iterations, only some ugly ass code. But what if we could write this as nicely as in the first example and make it work as efficiently as the second? Because of ECMAScript 6 we actually can!

Take a look at this:

const result = Enumerable.from(colors)
  .where(c => c.R > c.G && c.R > c.B)
  //.orderBy(c => c.name)
  .skip(page * pageSize)
  .take(pageSize)
  .select(c => ({
      name: c.name,
      color: `#${hex(c.R)}${hex(c.G)}${hex(c.B)}`
  }))
  .toArray();

What is this Enumerable thing? It's a class I made to encapsulate the methods .where, .skip, .take and .select and will examine it later. Why these names? Because they mirror similar method names in LINQ (Language Integrated Queries from .NET) and because I wanted to clearly separate them from the array methods.

How does it all work? If you look at the "classical" version of the code you see the new for..of loop introduced in ES6. It uses the concept of "iterable" to go through all of the elements it contains. An array is an iterable, but so is a generator function, also an ES6 construct. A generator function is a function that generates values as it is iterated, the advantage being that it doesn't need to hold all of the items in memory (like an array) and any operation that needs doing on the values is done only on the ones requested by code.

Here is what the code above does:

  • it creates an Enumerable wrapper over array (performs no operation, just assignments)
  • it filters by defining a generator function that only returns reddish colors (but performs no operation) and returns an Enumerable wrapper over the function
  • it ignores the items from previous pages by defining a generator function that counts items and only returns items after the specified number (again, no operation) and returns an Enumerable wrapper over the function
  • it then takes a page full of items, stopping immediately after, by defining a generator function that does that (no operation) and returns an Enumerable wrapper over the function
  • it transforms the colors in output items by defining a generator function that iterates existing items and returns the transformed values (no operation) and returns an Enumerable wrapper over the function
  • it iterates the generator function in the current Enumerable and fills an array with the values (all the operations are performed here)

And here is the flow for each item:

  1. .toArray enumerates the generator function of .select
  2. .select enumerates the generator function of .take
  3. .take enumerates the generator function of .skip
  4. .skip enumerates the generator function of .where
  5. .where enumerates the generator function that iterates over the colors array
  6. the first color is red, which is reddish, so .where "yields" it, it passes as the next item in the iteration
  7. the page is 0, let's say, so .skip has nothing to skip, it yields the color
  8. .take still has pageSize items to take, let's assume 20, so it yields the color
  9. .select yields the color transformed for output
  10. .toArray pushes the color in the result
  11. go to 1.

If for some reason you would only need the first item, not the entire page (imagine using a .first method instead of .toArray) only the steps from 1. to 10. would be executed. No extra arrays, no extra filtering, mapping or assigning.

Am I trying too hard to seem smart? Well, imagine that there are three million colors, a third of them are reddish. The first code would create an array of a million items, by iterating and checking all three million colors, then take a page slice from that (another array, however small), then create another array of mapped objects. This code? It is the equivalent of the classical one, but with extreme readability and ease of use.

OK, what is that .orderBy thing that I commented out? It's a possible method that orders items online, as they come, at the moment of execution (so when .toArray is executed). It is too complex for this blog post, but there is a full implementation of Enumerable that I wrote containing everything you will ever need. In that case .orderBy would only order the minimal number of items required to extract the page ((page+1) * pageSize). The implementation can use custom sorting algorithms that take into account .take and .skip operators, just like in LiNQer.

The purpose of this post was to raise awareness on how Javascript evolved and on how we can write code that is both readable AND efficient.

One actually doesn't need an Enumerable wrapper, and can add the methods to the prototype of all generator functions, as well (see LINQ-like functions in JavaScript with deferred execution). As you can see, this was written 5 years ago, and still people "teach" others that .filter and .map are the Javascript equivalents of .Where and .Select from .NET. NO, they are NOT!

The immense advantage for using a dedicated object is that you can store information for each operator and use it in other operators to optimize things even further (like for orderBy). All code is in one place, it can be unit tested and refined to perfection, while the code using it remains the same.

Here is the code for the simplified Enumerable object used for this post:

class Enumerable {
  constructor(generator) {
	this.generator = generator || function* () { };
  }

  static from(arr) {
	return new Enumerable(arr[Symbol.iterator].bind(arr));
  }

  where(condition) {
    const generator = this.generator();
    const gen = function* () {
      let index = 0;
      for (const item of generator) {
        if (condition(item, index)) {
          yield item;
        }
        index++;
      }
    };
    return new Enumerable(gen);
  }

  take(nr) {
    const generator = this.generator();
    const gen = function* () {
      let nrLeft = nr;
      for (const item of generator) {
        if (nrLeft > 0) {
          yield item;
          nrLeft--;
        }
        if (nrLeft <= 0) {
          break;
        }
      }
    };
    return new Enumerable(gen);
  }

  skip(nr) {
    const generator = this.generator();
    const gen = function* () {
      let nrLeft = nr;
      for (const item of generator) {
        if (nrLeft > 0) {
          nrLeft--;
        } else {
          yield item;
        }
      }
    };
    return new Enumerable(gen);
  }

  select(transform) {
    const generator = this.generator();
    const gen = function* () {
      for (const item of generator) {
		yield transform(item);
      }
    };
    return new Enumerable(gen);
  }

  toArray() {
	return Array.from(this.generator());
  }
}

The post is filled with links and for whatever you don't understand from the post, I urge you to search and learn.

  About a year and a half ago I installed DuoLingo and started going through some of the languages there. The app was advertising itself as "The world's best way to learn a language" and "Learn languages by playing a game. It's 100% free, fun, and scientifically proven to work." And in the beginning it was. You could go through simple but increasingly complex lessons and advance in level, exactly as promised.

  And then whatever happened to mobile apps everywhere happened to DuoLingo as well: incessant ads, with garish colors and loud sounds, overtly lying about what they are advertising for. They changed the internal currency of DuoLingo, started to ask for more things just to get the normal stuff needed to learn a language, like the short stories that are the only part of the app that teaches the language in context. Lately they added speed games that no one can finish without spending the currency they've amassed, but increase the points one gets, so puts pressure on everyone to either play the games or spend a lot of effort to not fall behind.

  And for what? After getting to the third level in a language, I started to take every section and finish it (take it to level 5). There is basically no difference between the lessons as the level increases. You never get to complex sentences, learn new words or gain any new knowledge. You just go through the motions in order to get a golden badge or whatever, while filling in sentences about newspapers. Yes! I don't know if you remember them, they're very important in the universe of DuoLingo.

  Also, there is a huge difference between the way lessons work for different languages. You want Spanish of French, you get different games, a lot of stories and so on. You want something more obscure like Dutch, you don't even get stories!

  So continuing to bear with obnoxious commercials just in order to use the app "100% free" is too exhausting, while the benefits are now minimal to none.

  I also doubt this is any way to learn a language. I am not able to understand speech in the language that I've spent months working on, there are very few sentence composition lessons that cover reasonable scenarios likely to meet in real life and the vocabulary is extremely limited. And limited in a stupid way: instead of learning words that one would use in everyday sentences you learn things like newspaper and apple and rabbit.

  Let's be honest here: I only went with Duolingo because it was easy. It gave me the illusion that I am doing something with my time while playing with my smartphone. If I really wanted to learn a language I would have listened and read in that language, I would have found people speaking the language and chatted with them, whether directly or in writing, I would have taken the list of the top 100 words used in that language and I would have created and written down sentences using those words until I could do it in my sleep. That requires effort and commitment and it is obvious that I wasn't going to spend it. That's on me. However, the state of DuoLingo, particularly compared to how it started, is the fault of the company.

  Conclusion: not only has DuoLingo become a cautionary tale about applications that advertise how free they are and will ever be, but it wasn't a good app to begin with and they never invested much into improving it. All development efforts in the last year have been on how to get you to pay for the app, what clothes Duo the owl wears and stupid time consuming animations to "motivate" you. Gamification has become the goal, not the means to achieve something worthwhile. So, with a heavy heart because of losing all the gems I've gathered and my 550 daily streak, I will be stopping using DuoLingo.