Fix “This field was locked by vendor” in Plesk Updates source and installation settings

I was trying to install some new components to one on my Plesk managed servers but I got this error when going to “Server > Tools & Settings > Plesk > Updates and Upgrades”:

Failed to read product information from the file : Can't process products.inf3: Failed to download the package http://20141204-09h35m01s.parallels.mirrors.ovh.net.snapmirror.vps.ovh.net/parallels/products.inf3: The requested URL returned error: 404 Can't process versions.inf3: Failed to download the package http://20141204-09h35m01s.parallels.mirrors.ovh.net.snapmirror.vps.ovh.net/parallels/versions.inf3: The requested URL returned error: 404

I asked OVH technical service and they told me more or less this: “Yep, that URL is no longer available but we only provide it on first automated install. Fix it yourself.”. I have to say that this happened with the customer service from Spain, something that of course didn’t surprise me. We are used to this kind of “help” from customer services here.

So I tried to change the product information source to the official Plesk one but I noticed that the field was disabled, as it said “This field was locked by vendor.”.

Plesk-updates-source-and-installation-settings

I started to search for the original URL in /root/parallels in order to edit it with no luck. When I did a search for this problem on the Internet I got to the most surreal fix I’ve ever come around: Open the browsers devtools and remove the “disabled” option to the “URL to the directory with .inf3 file” input field, change the URL to the correct one (http://parallels.mirrors.ovh.net/parallels/) and click “Save”. It worked!

Plesk-updates-source-and-installation-settings-before

Plesk-updates-source-and-installation-settings-after

Ref: http://forum.odin.com/threads/where-is-the-parallels-installer-configuration-file.329704/#post-782253

Hide Mac OS X Recovery partition

Sometimes the Mac OS X Recovery partition can be seen because it’s mounted automatically on boot. This is usually caused because you moved the operating system to another disk (clone) or because you used an app that changed the disks partitions (rEFInd in my case).

Recovery HD

To fix this you can run this script:

#!/bin/bash

PARTITION=`mount | grep "Recovery HD" | awk '{print $1}'`
if [ -n "$PARTITION" ]; then
    sudo diskutil unmount $PARTITION
    sudo asr adjust --target $PARTITION -settype Apple_Boot
fi

Then SHUTDOWN (don’t just reboot) and turn on the computer.

You can also unmount that partition from the Disk Utility if you enable the debug option from the command line, but this will only work one time as it will be mounted again on next boot:

$ defaults write com.apple.DiskUtility DUDebugMenuEnabled 1

Disk-Utility-Debug

Ref: http://automatica.com.au/2013/11/hide-recovery-hd-after-cloning-an-os-x-installation/
http://osxdaily.com/2011/09/23/view-mount-hidden-partitions-in-mac-os-x/

Remove old Linux kernels in Ubuntu

As time goes new kernel versions are released. After a kernel update old installed versions are not removed automatically, they are keep in case something goes wrong so you can boot again to a previous version.

linux-penguin-logo

But you may end up having lots of old versions you’ll never use. To remove them first you need to find all the installed versions:

$ dpkg -l | grep linux-image | grep -v extra | awk '{print $2}'
linux-image-3.16.0-30-generic
linux-image-3.16.0-31-generic
linux-image-3.16.0-34-generic
linux-image-3.16.0-37-generic
linux-image-3.16.0-43-generic
linux-image-generic-lts-utopic

Then remove all the unwanted versions using apt-get autoremove:

$ sudo apt-get autoremove linux-image-3.16.0-30-generic linux-image-3.16.0-31-generic linux-image-3.16.0-34-generic

You should probably leave at least the latests 2 versions just in case.

Ref: https://help.ubuntu.com/community/Lubuntu/Documentation/RemoveOldKernels

Deactivate VCS (Version Control System) in PHPStorm

You can enable VCS (Version Control System) in PHPStorm from the VCS menu but, how do you deactivate it?

PHPStorm VCS

I didn’t found an option for that anywhere so this is the solution: Remove the .idea/vcs.xml file and restart PHPStorm.

Ref: How to disable version control in phpstorm?

Unserialize strings with special characters in PHP

After several hours having problems with serialized object with spanish texts in it, finally this function I found in magp.ie worked like a charm:

function mb_unserialize($string) {
    $string = preg_replace_callback(
        '!s:(\d+):"(.*?)";!s',
        function ($matches) {
            if ( isset( $matches[2] ) )
                return 's:'.strlen($matches[2]).':"'.$matches[2].'";';
        },
        $string
    );
    return unserialize($string);
}

For example:

var_dump(mb_unserialize('O:8:"stdClass":1:{s:4:"text";s:12:"áéíóúñ";}'));

class stdClass#1 (1) {
  public $text =>
  string(12) "áéíóúñ"
}

php