Latest posts

Browse topics

Poppy fields near Marneuli

We love poppy fields, we have featured them a couple of times here at the Piece of Life series

Today we are going to share a brief photo story with poppy field near Marneuli, next to the Милена Оптовый Магазин (Milena mall)

It was one of the first days when travel restrictions between Georgia's inner cities were lifted and we decided to head to the Marneuli side looking for poppy fields (my partner have seen online some beautiful photos of poppies the day before). I love these wandering around days.

We didn't find the special poppy field, instead we found poppies. Surprisingly we made a lot of great family portraits here rich with poppies  in the background.

Poppy fields next to the Milena Shopping mall near Marneuli

Poppy fields next to the Milena Shopping mall near Marneuli

Quite an interesting stop here, we spent about an hour in this flower field.

Poppy field

Poppy field

That was a nice day at the end of May 2020.

Drupal 7 Fix: SQLSTATE[42000]: Syntax error or access violation: 1231 Variable 'sql_mode' can't be set to the value of 'NO_AUTO_CREATE_USER'.

I was migrating Drupal 7 website to a newer infrastructure (PHP 7.4) and during the migration process when tried to connect to the MySQL database  I faced following error - SQLSTATE[42000]: Syntax error or access violation: 1231 Variable 'sql_mode' can't be set to the value of 'NO_AUTO_CREATE_USER'.

Here is the error code:

Resolve all issues below to continue the installation. For help configuring your database server, see the installation handbook, or contact your hosting provider.

Failed to connect to your database server. The server reports the following message: SQLSTATE[42000]: Syntax error or access violation: 1231 Variable 'sql_mode' can't be set to the value of 'NO_AUTO_CREATE_USER'.

Is the database server running?
Does the database exist, and have you entered the correct database name?
Have you entered the correct username and password?
Have you entered the correct database hostname?

No_auto_create_user

No_auto_create_user

After quick research I was able to find a patch (Mysql 8 Support on Drupal 7 #24)  which involves overwriting core database.inc file (inclues/database/mysql - > database.inc)

here I'm pasting full working example (for a patch see here)

<?php

/**
 * @file
 * Database interface code for MySQL database servers.  
 */

/**
 * @addtogroup database
 * @{
 */

class DatabaseConnection_mysql extends DatabaseConnection {

  /**
   * Flag to indicate if the cleanup function in __destruct() should run.
   *
   * @var boolean
   */
  protected $needsCleanup = FALSE;

  public function __construct(array $connection_options = array()) {
    // This driver defaults to transaction support, except if explicitly passed FALSE.
    $this->transactionSupport = !isset($connection_options['transactions']) || ($connection_options['transactions'] !== FALSE);

    // MySQL never supports transactional DDL.
    $this->transactionalDDLSupport = FALSE;

    $this->connectionOptions = $connection_options;

    $charset = 'utf8';
    // Check if the charset is overridden to utf8mb4 in settings.php.
    if ($this->utf8mb4IsActive()) {
      $charset = 'utf8mb4';
    }

    // The DSN should use either a socket or a host/port.
    if (isset($connection_options['unix_socket'])) {
      $dsn = 'mysql:unix_socket=' . $connection_options['unix_socket'];
    }
    else {
      // Default to TCP connection on port 3306.
      $dsn = 'mysql:host=' . $connection_options['host'] . ';port=' . (empty($connection_options['port']) ? 3306 : $connection_options['port']);
    }
    // Character set is added to dsn to ensure PDO uses the proper character
    // set when escaping. This has security implications. See
    // https://www.drupal.org/node/1201452 for further discussion.
    $dsn .= ';charset=' . $charset;
    $dsn .= ';dbname=' . $connection_options['database'];
    // Allow PDO options to be overridden.
    $connection_options += array(
      'pdo' => array(),
    );
    $connection_options['pdo'] += array(
      // So we don't have to mess around with cursors and unbuffered queries by default.
      PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => TRUE,
      // Because MySQL's prepared statements skip the query cache, because it's dumb.
      PDO::ATTR_EMULATE_PREPARES => TRUE,
    );
    if (defined('PDO::MYSQL_ATTR_MULTI_STATEMENTS')) {
      // An added connection option in PHP 5.5.21+ to optionally limit SQL to a
      // single statement like mysqli.
      $connection_options['pdo'] += array(PDO::MYSQL_ATTR_MULTI_STATEMENTS => FALSE);
    }

    parent::__construct($dsn, $connection_options['username'], $connection_options['password'], $connection_options['pdo']);

    // Force MySQL to use the UTF-8 character set. Also set the collation, if a
    // certain one has been set; otherwise, MySQL defaults to 'utf8_general_ci'
    // for UTF-8.
    if (!empty($connection_options['collation'])) {
      $this->exec('SET NAMES ' . $charset . ' COLLATE ' . $connection_options['collation']);
    }
    else {
      $this->exec('SET NAMES ' . $charset);
    }

    // Set MySQL init_commands if not already defined.  Default Drupal's MySQL
    // behavior to conform more closely to SQL standards.  This allows Drupal
    // to run almost seamlessly on many different kinds of database systems.
    // These settings force MySQL to behave the same as postgresql, or sqlite
    // in regards to syntax interpretation and invalid data handling.  See
    // http://drupal.org/node/344575 for further discussion. Also, as MySQL 5.5
    // changed the meaning of TRADITIONAL we need to spell out the modes one by
    // one.
    $connection_options += array(
      'init_commands' => array(),
    );
    $connection_options['init_commands'] += array(
     'sql_mode' => "SET sql_mode = 'REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO'",
    );
    // Execute initial commands.
    foreach ($connection_options['init_commands'] as $sql) {
      $this->exec($sql);
    }
  }

  public function __destruct() {
    if ($this->needsCleanup) {
      $this->nextIdDelete();
    }
  }
  public function query($query, array $args = array(), $options = array()) {
    $query = preg_replace('/{([^}]+)}/', '`\1`', $query);
    // This to make Drush work
    $query = str_replace(' system.', ' `system`.', $query);
    $query = str_replace('`system` system', '`system` `system`', $query);
    return parent::query($query, $args, $options);
  }

  public function queryRange($query, $from, $count, array $args = array(), array $options = array()) {
    return $this->query($query . ' LIMIT ' . (int) $from . ', ' . (int) $count, $args, $options);
  }

  public function queryTemporary($query, array $args = array(), array $options = array()) {
    $tablename = $this->generateTemporaryTableName();
    $this->query('CREATE TEMPORARY TABLE {' . $tablename . '} Engine=MEMORY ' . $query, $args, $options);
    return $tablename;
  }

  public function driver() {
    return 'mysql';
  }

  public function databaseType() {
    return 'mysql';
  }

  public function mapConditionOperator($operator) {
    // We don't want to override any of the defaults.
    return NULL;
  }

  public function nextId($existing_id = 0) {
    $new_id = $this->query('INSERT INTO {sequences} () VALUES ()', array(), array('return' => Database::RETURN_INSERT_ID));
    // This should only happen after an import or similar event.
    if ($existing_id >= $new_id) {
      // If we INSERT a value manually into the sequences table, on the next
      // INSERT, MySQL will generate a larger value. However, there is no way
      // of knowing whether this value already exists in the table. MySQL
      // provides an INSERT IGNORE which would work, but that can mask problems
      // other than duplicate keys. Instead, we use INSERT ... ON DUPLICATE KEY
      // UPDATE in such a way that the UPDATE does not do anything. This way,
      // duplicate keys do not generate errors but everything else does.
      $this->query('INSERT INTO {sequences} (value) VALUES (:value) ON DUPLICATE KEY UPDATE value = value', array(':value' => $existing_id));
      $new_id = $this->query('INSERT INTO {sequences} () VALUES ()', array(), array('return' => Database::RETURN_INSERT_ID));
    }
    $this->needsCleanup = TRUE;
    return $new_id;
  }

  public function nextIdDelete() {
    // While we want to clean up the table to keep it up from occupying too
    // much storage and memory, we must keep the highest value in the table
    // because InnoDB  uses an in-memory auto-increment counter as long as the
    // server runs. When the server is stopped and restarted, InnoDB
    // reinitializes the counter for each table for the first INSERT to the
    // table based solely on values from the table so deleting all values would
    // be a problem in this case. Also, TRUNCATE resets the auto increment
    // counter.
    try {
      $max_id = $this->query('SELECT MAX(value) FROM {sequences}')->fetchField();
      // We know we are using MySQL here, no need for the slower db_delete().
      $this->query('DELETE FROM {sequences} WHERE value < :value', array(':value' => $max_id));
    }
    // During testing, this function is called from shutdown with the
    // simpletest prefix stored in $this->connection, and those tables are gone
    // by the time shutdown is called so we need to ignore the database
    // errors. There is no problem with completely ignoring errors here: if
    // these queries fail, the sequence will work just fine, just use a bit
    // more database storage and memory.
    catch (PDOException $e) {
    }
  }

  /**
   * Overridden to work around issues to MySQL not supporting transactional DDL.
   */
  protected function popCommittableTransactions() {
    // Commit all the committable layers.
    foreach (array_reverse($this->transactionLayers) as $name => $active) {
      // Stop once we found an active transaction.
      if ($active) {
        break;
      }

      // If there are no more layers left then we should commit.
      unset($this->transactionLayers[$name]);
      if (empty($this->transactionLayers)) {
        if (!PDO::commit()) {
          throw new DatabaseTransactionCommitFailedException();
        }
      }
      else {
        // Attempt to release this savepoint in the standard way.
        try {
          $this->query('RELEASE SAVEPOINT ' . $name);
        }
        catch (PDOException $e) {
          // However, in MySQL (InnoDB), savepoints are automatically committed
          // when tables are altered or created (DDL transactions are not
          // supported). This can cause exceptions due to trying to release
          // savepoints which no longer exist.
          //
          // To avoid exceptions when no actual error has occurred, we silently
          // succeed for MySQL error code 1305 ("SAVEPOINT does not exist").
          if ($e->errorInfo[1] == '1305') {
            // If one SAVEPOINT was released automatically, then all were.
            // Therefore, clean the transaction stack.
            $this->transactionLayers = array();
            // We also have to explain to PDO that the transaction stack has
            // been cleaned-up.
            PDO::commit();
          }
          else {
            throw $e;
          }
        }
      }
    }
  }

  public function utf8mb4IsConfigurable() {
    return TRUE;
  }

  public function utf8mb4IsActive() {
    return isset($this->connectionOptions['charset']) && $this->connectionOptions['charset'] === 'utf8mb4';
  }

  public function utf8mb4IsSupported() {
    // Ensure that the MySQL driver supports utf8mb4 encoding.
    $version = $this->getAttribute(PDO::ATTR_CLIENT_VERSION);
    if (strpos($version, 'mysqlnd') !== FALSE) {
      // The mysqlnd driver supports utf8mb4 starting at version 5.0.9.
      $version = preg_replace('/^\D+([\d.]+).*/', '$1', $version);
      if (version_compare($version, '5.0.9', '<')) {
        return FALSE;
      }
    }
    else {
      // The libmysqlclient driver supports utf8mb4 starting at version 5.5.3.
      if (version_compare($version, '5.5.3', '<')) {
        return FALSE;
      }
    }

    // Ensure that the MySQL server supports large prefixes and utf8mb4.
    try {
      $this->query("CREATE TABLE {drupal_utf8mb4_test} (id VARCHAR(255), PRIMARY KEY(id(255))) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci ROW_FORMAT=DYNAMIC ENGINE=INNODB");
    }
    catch (Exception $e) {
      return FALSE;
    }
    $this->query("DROP TABLE {drupal_utf8mb4_test}");
    return TRUE;
  }
}

/**
 * @} End of "addtogroup database".
 */

May 2020 Dividend Income Report - $225.17

Welcome to the thirty-seventh (#37) dividend income report, covering earnings I've made from dividend-paying stocks and peer to peer lending in May 2020.

Just like the previous month of April, in May we also spent in a self-isolation (because of Covid-19) here in Georgia. Some of the strict lockdown measurements were lifted (like using a private vehicle and going from city to city)  we did a few road trips here in Georgia.  Baby girl is doing her online class, learning about animals, shapes, continents, and even planets. Quite fascinating what a 22-month-old can do. Development is very rapid.

Saint Dimitri Tesalonikeli Fathers Moanstery near Mtksheta

Saint Dimitri Tesalonikeli Fathers Moanstery near Mtksheta

May come with very sad news - my dad passed away, some 11 days before his 66 year birthday. My dad was like a best buddy to me, we talked a lot about investments, stocks, politics, we argued, disagreed, we had opinions  - most of our conversations were on WhatsApp chat, he was very tech guy, into gadgets.. dad I miss you. Everything's gonna be alright - this was his favorite phrase. His last message on WhatsApp was on May 8:

Last message from Dad on May 8, 2020

Last message from Dad on May 8, 2020

The loss of dad will leave a space in my life that can never get filled.

From the perspective of dividend income -  last May was very good, we were able to take $225.17, despite most of our dividends are trimmed by half and more. Back in March's market panic, we bought for a cheap a lot of FGB stock, this stock helped to boost this May's dividend income. FGB is not the stock we would like to keep for life, but I feel happy I bought it back in March.

Compared to the previous May in 2019, our monthly dividend has increased by a mere 4.16%  (+$9.00). Despite I was looking at a $300-$350 dividend this month a year ago, I will say the overall result is very good, taking into account the market downturn.

An additional $595.43 was made from options trading.   As options trading is not a passive form of making money while you are sleeping it wouldn't be fair to include them in dividend income reports. As we love selling options a lot, during the month of May I launched a separate website -  Investing with covered calls - OptionsBrew.com You can read our first options income review here: May 2020 Options Income Report - $595.43

If counted all together (dividends + options) it seems we have made $820.6 in total last month. 

Effective income yield last May was 4.36% (about 52.32% annually) Which is great. One of my monthly goals is to generate at least 2.5% income yield from the portfolio. As longs it's above to it - it's awesome.

From dividends + active trading taking 30% year seems quite doable. The first five months of 2020 have been a bumpy road, but we have been able to take more than 2.5% from the market in 3 out of the 5 months. 

Interest income in May 2020

From the stocks and peer to peer lending I got following income last month:

Ticker

Earnings

FGB

€75.23

BGLF

€36.30

XIN

€17.52

EDI

€14.04

Mintos

€11.26

EDF

€9.77

NRZ

€9.54

KNF1L

€9.05

RA

€7.60

NCV

€6.48

ET

€5.44

AWP

€3.66

Total EUR 206.58 / USD 225.17

In total there were 12 companies paying us dividend in May 2020 that is 3 companies less than in May 2019

Monthly income

I've been tracking my journey towards million dollars in a savings account since January 2017. More than three years already. The result, so far, looks quite good. Dividends are growing (even when they are not)

Monthly dividend Income chart as of May 2020

Monthly dividend Income chart as of May 2020

The cumulative earnings for 2020 now are $882.72  which is exactly 24.52% from my goal of 2020 ($3,600). On average, it would ask us to generate $388.89 every month for the next 7 months to reach this goal. Right, now the goal looks unattainable, as for now, I cannot see even a single $300 month for 2020, but this could change later, during the year as we are trying to add more quality stock to the portfolio. 

Goals for May 2021

This is my favorite part of the reports - trying to forecast/set goals for the next year. But before setting a goal for 2020, let's see what I forecasted/said a year ago (May 2019)

When setting goals for May 2020, I will say $300 seems a good number to work with, but I want more - at least $350 for May 2020

None of the numbers were reached. Taking into account the downturn in the markets and many dividend trims. I will say that it is quite acceptable. 

For May 2021 I have a goal to crack finally that $300 milestone, to get there will add more quarterly stocks paying dividends in May (like FBG, PBCT, and T). From today's perspective looks quite possible.

Top 30 Dividend Paying Stocks in Germany (DAX Index)

For current DAX dividend yields and a look at what’s changed since 2020, read Best German Dividend Stocks: 2026 Edition.

One way to invest in Germany is to buy shares in German companies. I’m looking at the country’s blue chips, the 30 companies that make up the DAX.

The DAX, short for Deutscher Aktienindex, tracks 30 major companies listed on the Frankfurt Stock Exchange. The index uses prices from Xetra, the trading venue operated by Deutsche Börse. Market capitalization and trading volume are used to select companies from the Prime Standard.

I’ve listed all 30 stocks below, ranked from highest to lowest dividend yield. I’m particularly interested in selling options on German stocks, and each company in this list has options available.

Highest-paying dividend stocks in the German DAX

The table shows each company’s industry, ticker, share price, dividend yield, options availability, and founding year.

The eight highest yields in the original 2020 DAX table. Lufthansa 8.07%, BASF 6.66%, Allianz 5.64%, E.ON 4.65%, Munich Re 4.59%, Bayer 4.56%, BMW 4.54%, and Volkswagen 4.53%.
Yields as recorded in the original 2020 table, using May 27, 2020 share prices.
CompanyPrime Standard industry groupTicker symbolPriceDividend YieldOptionsFounded
Deutsche LufthansaTransport AviationETR:LHA€9.278.07%yes1953
BASFChemicalsETR:BAS€49.756.66%yes1865
AllianzInsuranceETR:ALV€168.905.64%yes1890
E.ONEnergyETR:EOAN€9.984.65%yes2000
Munich ReInsuranceETR:MUV2€210.004.59%yes1880
BayerPharmaceuticals and chemicalsETR:BAYN€62.004.56%yes1863
BMWManufacturingETR:BMW€54.394.54%yes1916
Volkswagen GroupManufacturingETR:VOW3€140.124.53%yes1937
ContinentalManufacturingETR:CON€91.784.37%yes1871
Deutsche PostLogisticsETR:DPW€28.984.31%yes1995
Deutsche TelekomCommunicationsETR:DTE€14.104.26%yes1995
SiemensIndustrial, electronicsETR:SIE€98.983.86%yes1847
CovestroChemicalsETR:1COV€34.923.47%yes2015
VonoviaReal estateETR:VNA€50.123.11%yes2001
RWEEnergyETR:RWE€29.352.72%yes1898
DaimlerManufacturingETR:DAI€35.552.56%yes1926
HenkelConsumer goods and chemicalsETR:HEN3€78.542.35%yes1876
LindeIndustrial gasesETR:LIN€175.752.20%yes1879
MTU Aero EnginesAerospaceETR:MTX€152.802.19%yes1934
FreseniusMedicalETR:FRE€42.361.98%yes1912
Deutsche BörseSecuritiesETR:DB1€148.651.95%yes1992
AdidasClothingETR:ADS€233.001.64%yes1924
Fresenius Medical CareMedicalETR:FME€73.161.64%yes1996
Deutsche BankBankingETR:DBK€7.791.41%yes1870
SAPSoftwareETR:SAP€111.841.40%yes1972
Infineon TechnologiesSemiconductorsETR:IFX€19.251.37%yes1999
HeidelbergCementBuildingETR:HEI€45.401.31%yes1874
MerckPharmaceuticalsETR:MRK€101.201.28%yes1668
BeiersdorfConsumer goods and chemicalsETR:BEI€93.840.77%yes1882
WirecardFinancial TechnologyETR:WDI€89.250.22%yes1999

Data source: DAX. Stock prices as of May 27, 2020.

What surprised me was seeing a dividend yield beside every stock in the table. From what I’ve seen, German companies typically pay dividends once a year. In the U.S., quarterly payments are more common, and some companies pay monthly.

Selling options is the main reason I’m looking at these stocks. I also wrote about one of these ideas on OptionsBrew, using monthly covered calls on a DAX blue chip.

How To Swap / Transfer IP address with Linode VPS

Recently I was rebuilding a compromised VPS on the Linode - this was a small web server serving some 3 established websites. It took me a few hours from A-Z  - launch a new Linode, install a new webserver on it, then transfer data from one host to another.

Once all migration works were done, there was an option to change DNS entry to point to the new server. Nothing complicated. But there is a neat feature from Linode called - Swap IP (IP Transfer). That's a little perk from Linode and quite good for SEO

You can get a cheap VPS starting just $5/mo from Linode. That's what I did - bought a new Linode just for $10

If you have two Linodes in the same data center, you can use the IP transfer feature to switch their IP addresses. This could be useful in several situations. For example, if you’ve built a new server to replace an old one, you could swap IP addresses instead of updating the DNS records.

IP Transfer with Linode

IP Transfer with Linode

Here are the instructions how to transfer IP on Linode (found here: How do I move an IP Address around between different Linodes?)

  1. Login to the Linode Cloud Manager. https://cloud.linode.com
  2. Click on "Linodes" in the bar on the left.
  3. Select the Linode which has the IP address set up with DNS records.
  4. In the upper-right corner of the page, you will see a pull down menu that shows the state of your Linode. If it is running, select Power Off and make a note of its name.
  5. Go back to the Linodes page.
  6. Select the Linode which you would like to get the IP which is already set up for DNS.
  7. Click on the "Networking" tab and scroll to the bottom.
  8. Click on "IP Transfer".
  9. Select the IP Address (if there is more than one address assigned to this Linode)
  10. Under Actions, select "Swap With"
  11. A pulldown will appear that will let you select the Linode that has the IP address you want.
  12. Select the IP address from those addresses that Linode has.
  13. Click "Save"
  14. You can now boot your Linode and work with it.