Yii 2 Query Builder with strange backticks


 $query = (new Query())
            ->select(['itinerary.id, itinerary.from_vertex_id, itinerary.to_vertex_id,
             v1.name AS from_name, v2.name AS to_name, 
             CONCAT(v1.name, v2.name) AS it_name
             '])
            ->from('itinerary')
            ->innerJoin('vertex v1', 'itinerary.from_vertex_id = v1.id')
            ->innerJoin('vertex v2', 'itinerary.to_vertex_id = v2.id')
            ->orderBy('itinerary.id');

Solution: The select method above must always be passed with an array ( [] ), using it with string puts strange backticks around column names.

Install Android Studio 3.0 on Ubuntu 17.10

Use the following steps to install android studio 3.0 on Ubuntu 17.10.

   sudo add-apt-repository ppa:maarten-fonville/android-studio
   sudo apt-get update
   sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386 lib32z1 libbz2-1.0:i386
   
   cd ~/Android/Sdk/emulator/lib64/libstdc++
   sudo mv libstdc++.so.6 libstdc++.so.6.og
   sudo ln -s /usr/lib64/libstdc++.so.6 .


basic sql query

Today we learned how to connect to sql using work bench and command line mysql client. We created a simple table, and inserted a row.

Fixed yoga 910 screen flicker in Ubuntu 17.10

To fix it, create or edit the file at /usr/share/X11/xorg.conf.d/20-intel.conf as root with the following:

Section "Device"
    Identifier "Intel Graphics"
    Driver "intel"
    Option "AccelMethod" "sna"
    Option "TearFree" "true"
    Option "DRI" "3"
EndSection

And add this:
GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash i915.enable_rc6=0″

to: /etc/default/grub
cmd: sudo update-grub
restart computer.

Link

Ubuntu install PHP mail function

It is not installed by default so you have to install it and then a little configuration is required.

sudo apt install sendmail

The run the following command and choose Y for all the options.

sudo sendmailconfig

Now edit the host file:

sudo nano /etc/hosts

And add or edit as:

127.0.0.1    localhost localhost.localdomain your_machine_name

To get your_machine_name run:

hostname

Raspberry PI enable ssh without a monitor

I spent a dozens of minutes today to learn, how to enable ssh to Raspberry Pi without a monitor. SSH is disable by default after October 2016. Here is a one minute solution.

Attach the sd card to your computer and add an empty file SSH on the root of the sd card partition.