• Please complete the contact form below with details about your inquiry and I'll get back to you as soon as possible.

  • This field is for validation purposes and should be left unchanged.

Category: Bugs and Issues

Fix: Mouse pointer shakes while mouse standing still in Ubuntu 20.04

Here’s a peculiar issues I’ve encountered the second time this week. Out of the blue, the mouse pointer will start shaking/wiggling/moving up and down heretically, while the mouse itself is standing still. Turning the mouse off, disconnecting the receiver dongle will do nothing. The previous time I fixed it with a reboot, but this time I didn’t want to resort to the same “fix” because I have a lot of windows open, and I want to keep the state of my running apps and services.

Fortunately, I found a better way to fix this issue, although it’s not a permanent fix. What I did was to switch to a different GUI, then go back to my original one. So first, CTRL+ALT+F1 to go to the other GUI, then CTRL+ALT+F2 to go back to the original one (which kept the state intact, less the shaking pointer thanks god). Your current GUI might not necessarily be at F2 as in my case, just try all F1-F12 combinations until you find it.

Fix: Ubuntu 20.04 stuttering animations & video

Ok, this was driving me nuts, but I’m glad I finally figured it out thanks to this.

So the issue was: every 500ms or so, any  graphic output would briefly freeze, be it a video playing, a page scrolling, or moving a window around. This issue was persistent right after I upgraded from Ubuntu 19.10 to Ubuntu 20.04.

The troublemaker: the issue was caused by the “System Monitor” extension. The extension was running in my app indicators toolbar, since I like seeing small bits of stats about CPU load, network usage, etc. Unfortunately, it seems that there is an issue with this extension on the newest version of Ubuntu.

Unsuccessful attempts: I tried reinstalling the Nvidia driver (390.132), tried to install the driver manually instead of using the Ubuntu Drivers tool. Switching to the Nouveau driver had no effect. Choosing a different session from the log in screen (Default Gnome) had no effect either, since my Gnome extensions were running there too for some reasons.

The solution: Disabling the “System Monitor” extension, instantly fixed the issue. If you have the extension running in the app indicators area, simply clicking on it, and choosing “Quit” will do the trick.

Dockerized pgAdmin 4 & local Postgres server on Ubuntu 20.04

At this time of writing, pgAdmin4 is not available for installation on Ubuntu 20.04, due to an unresolved Python dependency. Until this is solved, or in case you want to run pgAdmin from a Docker container, here’s what worked for me. This assumes you already have Docker installed in your Ubuntu.

First, docker pull dpage/pgadmin4 to pull the image on your computer.

Next, I added the following command to my ~/.bash_aliases so I can quickly run the container:

alias pgadmin-boot='docker run --add-host=database:YOUR_LOCAL_IPV4_ADDRESS -p 5050:80 -e "PGADMIN_DEFAULT_EMAIL=YOUR_PGADMIN_LOGIN_EMAIL" -e "PGADMIN_DEFAULT_PASSWORD=YOUR_PGADMIN_LOGIN_PASS" -d dpage/pgadmin4'

The YOUR_LOCAL_IPV4_ADDRESS is the IP address of your computer on the local area network, assuming Postgres is running from your local machine.

Next, start pgAdmin by running pgadmin-boot or the command above. You may need to restart your terminal so that the alias is loaded.

If everything went well until this point, you should be able to access pgAdmin4 at http://localhost:5050/browser/ and log in with the email and password you specified in the command above.

Next, from the ‘Quick Links’ section on the pgAdmin dashboard, you can add a new server. For the hostname use database since we defined that earlier in the command above. The port is most likely 5432. The username is most likely postgres. The password is something you should know, otherwise see this comment on StackOverflow how to reset your postgres password. If you try to add the new server, you will most likely get an error notice about Postgres complaining about an IP not having access. That is the IP of your running pgAdmin docker container. Copy that IP, in my case it was 172.17.0.2. Next, find your pg_hba.conf file. To do that, you can run the following commands:

dragos@dragos-pc:~$ sudo -u postgres psql
[sudo] password for dragos: 
psql (12.2 (Ubuntu 12.2-4))
Type "help" for help.

postgres=# SHOW hba_file;
              hba_file               
-------------------------------------
 /etc/postgresql/12/main/pg_hba.conf
(1 row)

postgres=# quit

You will need to edit the configuration file to add the docker IP address as trusted: sudo nano /etc/postgresql/12/main/pg_hba.conf and add this line host all all 172.17.0.2/24 trust to the ‘# IPv4 local connections:’ block. Restart postgres sudo service postgres restart.

Now if you try to add the server in pgAdmin, it should succeed.

If you still can’t connect to the Postgres server, you may need to let Postgres know that it can accept connections from address other than ‘localhost’. To do that, sudo nano /etc/postgresql/12/main/postgresql.conf and then find and uncomment the config for listen_addresses amd add your YOUR_LOCAL_IPV4_ADDRESS from earlier. It should look like this: listen_addresses = 'localhost,192.168.0.11'.

Hope this helps!

Fixing: “ESLint: Expected indentation of 2 spaces but found 6. (indent)” in PhpStorm

I recently bootstrapped a new Vue.js application from the Vue-CLI, and I chose to lint my code. Now when I write code, I tend to auto-format my code all the time. The thing is by default, ESLint will warn you if your javascript code is indented inside a script tag (for single-file components). Now I use PhpStorm, but I think the same should apply to WebStorm.

To fix the issue, go to File > Settings > Editor > Code Style > HTML > Other , and for “Do not indent children of” add the “script” tag to the list. That’s it! You can try re-formatting  your code now, and the code indentation in the script tag should be gone now, as well as the ESLint warning. Happy coding!

Solution: kernlab class probability calculations failed; returning NAs

Howdy! I’m putting this down here for my future reference, as well as for anyone who has spent the couple hours looking for a solution:

kernlab class probability calculations failed; returning NAs

You get this error because you need to use a formula to define your model. For example:

fit.svm.radial <- train(data.train[,!(names(data.train) %in% c('value_change'))], data.train$value_change, 
                method='svmRadial', 
                trControl=objControl,  
                metric = "ROC",
                tunegrid=tunegrid,
                preProcess = NULL
                )

needs to be changed to:

fit.svm.radial <- train(value_change~., data=data.train, 
                method='svmRadial', 
                trControl=objControl,  
                metric = "ROC",
                tunegrid=tunegrid,
                preProcess = NULL
                )

Happy training!

500 Server error when uploading a PDF file in WordPress

Just had to deal with an obscure issue, that I believe is more common to happen on a shared hosting. So uploading a PDF file in WordPress, would fail to a 500 server error page. Server logs show nothing, just some information about some ‘Ghostscript GPL’ and some ‘broken headers’. So I had to debug the application the usual way and found it was failing in /wp-includes/media.php on line 2909:

$implementation = _wp_image_editor_choose( $args );

if ( $implementation ) {
    $editor = new $implementation( $path );
    $loaded = $editor->load(); //this line

    if ( is_wp_error( $loaded ) )
      return $loaded;

return $editor;
}

Dumping the $implementation variable, I found it was the name of an image processing library wrapper WP_Image_Editor_Imagick . Image processing libraries can be extremely memory demanding, especially when they have to deal with a PDF file. Why WordPress needs to process a PDF file with Imagick, I don’t know. But I got to solve this server error by increasing the PHP max memory directive. There’s not specific value that will work in your case, just test in increments of 32Mb blocks and be generous if your server allows.

SVG animation with stroke-dashoffset happening backwards on Safari

If you’re running into this issue, I’ll save you some time: Safari does not support negative values for stroke-dashoffset . Rewriting the values into positive ones will solve the issue.

If this still doesn’t solve the issue for you, make sure you don’t have the  animation-direction: reverse set on your animation.