Expanding a block to the empty space of the parent element (div expand)

Today I came across an unpleasant problem - when using block layout, I needed to stretch a block to fill the empty space of the parent element vertically (div expand). Naturally, there is no difficulty in doing this horizontally - simply set the display to block and it will work =).

List of routine web programming tasks

programmerWhen studying a new framework or web programming language, you may sometimes feel confused and ask yourself: When can I consider that I have learned the product to a decent level? When can I say that I know it, and if there are some things I don't know, I can quickly grasp/read them in the manual/search for them on Google?

Converting table engine in MySQL

Sometimes you need to convert the table engine MySQL in an existing database.

For example, I needed to create relationships between tables. To create them, the tables must be InnoDB (to support foreign keys).

Old Wordpress (and other) projects use MyISAM because until version MySQL 5.5.4 it was the default engine. But it doesn't support many useful features, such as foreign keys, transactions, etc. All these features are supported by the more modern engine InnoDB, which is now used by default.

Create relations in MySQL database using phpmyadmin

After reading this article, you will be able to create relations in MySQL database using phpmyadmin. If for some reasons you don't want to use phpmyadmin, please look at SQL queries below.

So, what reason to store relations in the database? After all, your application also solves this task. Actually, it's all about the restrictions and actions upon changes, which can be set using relations.

For example, you can deny deleting category while any article connected with it. Or remove all articles if category removed. Or set NULL in relation field. In any case, using relations increases fault tolerance and reliability of the application.

You need to use an InnoDB engine to create a relation. Only this engine supports foreign keys. If you have MyISAM tables, you can read how convert it to InnoDB.

Form without tables

To create a form using tables, even a beginner webmaster can do it, but for formatting a tableless form, some skills are required. Let's consider a simple example, such as a login form.

Using templates in Symfony framework. (Lesson 7. Twig)

Using templates in Symfony framework can be done in several ways. First, you can use PHP templates. But the preferred option is to use the Twig template engine (by default). Twig is a compiling open-source template engine written in PHP. It produces PHP/HTML code as output. Besides being very functional, Twig is also very fast.

Usage of QwtPlotSpectrogram

Previously, we learned to use the QwtPlotSpectrocurve component (here). Qwt provides an alternative component that is more convenient for visualizing analytical functions. In this note, we will learn how to use QwtPlotSpectrogram.

Setting PHP timezone in php.ini

During the work with Symfony framework, I received the following warning:

Warning: date_default_timezone_get(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /var/www/symfony/app/cache/prod/classes.php on line 5009

In fact, there is nothing to worry about or unusual - this was caused by updating PHP to version 5.4, and since the new version was installed next to the old one with new configs, it was necessary to configure the PHP timezone in php.ini again. First, we need to find out which timezone we are in. More precisely, how it should be specified in the PHP config.

Routing in the Symfony framework (Lesson 6: Routing)

After learning how to create controllers (here), it is important to understand how a user can invoke a controller and how to work with it.

The Symfony framework has a special feature called routing system. In yii framework , for example, routing is determined by the file structure of the application by default (although you can still use a routing system with the necessary tools). However, in Symfony framework, you have to define the routing manually (excluding the basic routing created by the bundle generator).

Creating and deleting bundles in Symfony (Lesson 4)

So, after studying the materials 1, 2, 3, it's time to start developing your first Symfony application =). So, as you already know, everything in Symfony is a bundle. And, as you remember, the place for bundles is the src/ directory.