The Linux Page

Help other users realize that everything is possible, especially avoiding Windows for their own personal use.

Welcome to The Linux Page


Fox Trot by Bill Amend. Click to enlarge.
Click to enlarge

This site is a collection of my own work with Linux. Certain things are easy, others take time to decipher and if I ever need to repeat the work (which usually happens!), then I need to remember everything by memory or... have a site with all the steps taken and to take again.

The following are my most recent posts:

A Single Poppy in a field.

There is an old book about design patterns in JavaScript and there is an example of the Singleton pattern:

https://addyosmani.com/resources/essentialjsdesignpatterns/book/

However, the new way of creating a Singleton in ES6 uses a simple class and exports the instance as follow:

class Singleton {
  constructor () {
    if (!Singleton.instance) {
      Singleton.instance = this
    }
    // Initialize object
    return Singleton.instance
  }
  // Properties & Methods
}

const instance = new Singleton()
Object.freeze(instance)

export default instance

Source: ...

More Small Bansai Trees fit in the same amount of space as one giant sequoia tree.

When was Compressed OOP created in Java?

Whenever the Java interpreter was converted to work on 64 bit machines, the pointers, just like with any other software, doubled in size. In other words, the good old 32 bit pointers which used 4 bytes, now went to 64 bit pointers which use 8 bytes. So each reference to any object now uses 2x the size.

The JVM engineers then decided to implement a Compressed version of the pointers which came out with Java SE 6u23 and all versions over Java 7.

The advantage of 64 bit computers is that you can have a very large amount of memory. For a long time ...

Maze of Bugs

The jsdoc tool is much better than doxygen in generating documentation from JavaScript code. Actually doxygen doesn't work at all with ES6 code. At least as of 2018.

So I had to switch to jsdoc. It's annoying that they have no support for the backslash (\), only '@' character. Also there are all sorts of bugs, when this is defined, that doesn't work. If that is not define, then this other thing doesn't work...

For example, I used the @description in that causes problems between the class, the class constructor, and who knows what. So I don't use it at all at ...

What is a fishing boat doing in a field?!

Now a days, I write a lot of my documentation using markdown.

The fact is that it is rather difficult to find problems when I make a mistake such as put a lone backtick (`).

Often it feels like the syntax highlighter is failing.

One way to at least make sure that the file fails for real is to make sure that the highlighting starts from the very beginning of the file. To do so you want to change the number of lines that the highlighting works on.

The number of lines is defined in two variables and you probably want to change both of them. Note that to do so, you need to use the :syntax ...

JavaScript Asynchronous System, how callbacks work

This pictures shows three functions (F1, F2, and F4) and their callbacks (C3, C5, C6. C7, C8, and C9.) The graph shows the order of execution from left to right. As we can see, JavaScript functions and callbacks get executed one after the other. However, the order can seem quite random. This is often referenced as Callback Hell. Promises were going to fix that, but now we have async/await which is even better! Although the execute remains the same (as shown here,) writing the code becomes much more straight forward. For example, changing the graph here with await, it would clearly look like ...

Today I had a little surprised as stars appeared around my mouse pointer and they remained. I was pretty sure I've seen those before so not too much to worry about, but... how to get rid of them?!

I knew that I just hit something on the keyboard, I just don't really know what the keystroke was. So I want to try that keystroke again and get rid of the stars... Only I have no clue what it is.

Going to the Gnome Preferences:

/usr/bin/ccsm

It appears on the first page for me.

It's called Show mouse. Looking into the settings of the feature, I see that the keyboard ...

True or False, the Boolean value which is so often not taken from a variable of type Boolean

Introduction

Today I was thinking about returning a Boolean in my JavaScript function.

I do that all the time in C++ because a function that returns a bool is expected to return true or false.

For example, many people in C++ will do:

bool my_func()
{
  int t = 3;
  ...do some computation against `t`...
  ...now t can be any int number...
  return t;
}

The problem with such code is that the returned value is not a properly formatted boolean value. Compilers do it right, but you could imagine that if you return 0x100 and a bool is saved in a byte.

The correct way to do it in ...

Sling — an elastic and a piece of wood

The Problem with Mapping

Today I spent some 3 hours looking into why I could not setup a certain field as text. The newer versions of Elassandra (ElasticSearch, really) makes use of keyword and text instead of string for text-like data. Only, by default the system sees those as list<text> and not just text. I'm not exactly sure why they do that, though.

Anyway, after many questions to Google, I found out that you have to tell the search system that your field is a singleton or it's going to view it as a container of type list. To do that, you just have to add ...

Old Directory with missing and broken directions.

Today I had a weird one.

The PHP function named stream_socket_client(), used to create a socket to communicate with another computer over a network, may return $errno = 0 and $errstr = "".

The PHP reference actually mentions the problem:

On failure the errno and errstr arguments will be populated with the actual system level error that occurred in the system-level connect() call. If the value returned in errno is 0 and the function returned FALSE, it is an indication that the error occurred before the connect() call. This is most likely due to a problem initializing the socket. ...

Puzzle with a missing piece

If you are using Apache2, you may notice that the HTTP_AUTHORIZATION is missing from the list of variables sent to you. This is because Apache2 decides to not send clear passwords (even if base64 encoded) across processes.

In the old days (and the capability is still available), Apache would call processes with command line parameters as the data, instead of having environment variables.

Unfortunately, they decided to keep things that way when they switch to FastCGI. So you do not get the Authorization header passed down to your CGI scripts. Whether you use Node.js (through CGI-Node, for ...

Unfreeze your Mouse when it Froze

Thank you for visiting my website.