• 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

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, 
                metric = "ROC",
                preProcess = NULL

needs to be changed to:

fit.svm.radial <- train(value_change~., data=data.train, 
                metric = "ROC",
                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.