среда, 26 сентября 2018 г.

[Docker] how to solve 'VOLUME: not found' or 'COPY: not found'

If you receive a "/bin/sh: COPY: command not found" (or VOLUME) error, you should check that previous Dockerfile line is closed properly. For example, if you have similar like below,

RUN set -eux; \
   apk add --no-cache --virtual .build-deps \
      git \
   ;

do not forget to enclose your line with \ and ; symbols.

вторник, 11 сентября 2018 г.

[Linux] another way to fix Jetbrains Russian layout hotkeys

If you cannot use Jetbrains phpstorm/idea hotkeys with Russian layout on Ubuntu, try to install KDE instead of GNOME, because this issue doesn't appears in Kubuntu.

вторник, 4 сентября 2018 г.

How to debug FormData object

If your FormData object named as formData in code, you can debug it with Array.from(formData.entries())

воскресенье, 2 сентября 2018 г.

[Ethereum] [Mist] geth runtime error: invalid memory address or nil pointer dereference

If you often receive mentioned error,  delete ~.config/Mist/mist.lokidb file on Linux at closed Mist client.

понедельник, 20 августа 2018 г.

Fedora - how to increase browser scroll speed

To increase mouse wheel speed, just install rpm binary package from https://fedora.pkgs.org/28/russian-fedora-free-i386/imwheel-1.0.0-0.1.pre12.fc28.i686.rpm.html . After installing, you will feel that scroll speed increased. Do not forget add it to autostart

четверг, 2 августа 2018 г.

Symfony how to bind request data to form without HTML

When you want to bind data to form (for example in your REST application) as in FOSRestBundle, but after handleRequest() you doesn't have submitted data, try to map it with

$this->get('form.factory')->createNamed('', MyFormType::class, $dummy, ['csrf_protection' => false]);

, where first parameter is empty string, the second is form, $dummy is for model or entity object. So you can use form validation in simple Symfony action.

понедельник, 30 июля 2018 г.

FOSRestBundle invalid form doesn't use ExceptionWrapper

If your FOSRestBundle response doesn't have normal type, (for example, as below):

{
    "form": {
        "children": {
            "currency": {},
            "limit": {
                "errors": [
                    "This value should be greater than or equal to 0."                ]
            },
            "": {},
            "name": {}
        }
    },
    "errors": []
},
As we see, there are no 'code' and 'message' keys, so FOSRestBundle type is wrong. To fix it, use
$view->getContext()->setAttribute('status_code', Response::HTTP_BAD_REQUEST);
for your $view object.