Online

Evgenij Legotskoj

EVILEG

  • 13
  • 0
Donate
Dec. 2, 2018, 9:58 a.m.

Linux

Linux, Bash, getopts

When developing a site to automate the deployment process, I wrote several bash scripts.

To customize the behavior of scripts, I use the transfer of arguments, which are handled in the bash script by the getopts library.

Nov. 29, 2018, 2:10 p.m.

Boost

cpp, Boost, linking, C++, static

A small note about static linking Boost, so as not to forget.

Initial data:

  • OS Windows
  • MSVC 2017 64bit
  • Boost 1.68.0
  • CMake project
An example will be shown in the simplest version without special variable settings. Maximum default.

Nov. 25, 2018, 5:11 p.m.

Qt

QLineEdit, max, Qt

Напишем небольшое приложение для получения максимального числа из нескольких полей QLineEdit.

This means that we will have several QLineEdit fields, let's say 4 pieces into which numbers will be entered. And there will be the fifth field QLineEdit in which the result will be displayed. We also have a QPushButton button, by clicking we will get values from all QLineEdit fields and among them we will look for the maximum number that has been entered into these fields.

The application will look like this

Nov. 18, 2018, 9:52 a.m.

Qt

QSequentialAnimationGroup, cpp, Qt, C++, QPropertyAnimation

Let's write a small example of an application in which a button will be moved using property animations. To do this, we use the QSequentialAnimationGroup and QPropertyAnimation classes.

QSequentialAnimationGroup is a class that combines several animations into one group, which allows you to automatically start one animation when the previous QPropertyAnimation has completed.

Animation will be launched by pressing the button and this button will move in the window as shown in the image.

Nov. 18, 2018, 5:57 a.m.

Boost

cpp, Boost, Menu, C++

And here is an article on the boost of my some accumulated materials. I offer you the option of writing a console program with support for the console menu, which is implemented using boost::program_options .

boost::program_options is responsible for processing the arguments passed to the program and sets all the necessary variables without the need to implement long logic from if else branches. This is already implemented inside boost::program_optons .

Suppose our program takes the following data as arguments

  • input file path
  • output file path
  • the size of the block being processed, no matter why, we will not do anything with it, just have such a parameter in the program.

Also, the program will have a help menu, which will be the console menu.

The figure below shows the use of this program.

Nov. 6, 2018, 5:13 p.m.

EVILEG

EVILEG, Развитие, News

After talking with one of the users, I decided to change the policy regarding advertising on the site, although I am not sure about that.

I myself am not pleased with the abundance of advertising banners, but I would like to receive sufficient income from the site in order to switch to part-time work and put more effort into the development of the site. I really enjoy the site, it's interesting. But at the moment you have to choose between a hobby and a job.

Oct. 27, 2018, 7:36 p.m.

Django

Django, Facebook, Social

I added authorization on the site through Facebook.

At the same time collected a couple of pitfalls.

Before Facebook , I already added in authorization through the social network VKontakte and Google . And here I needed to create a privacy policy page, since Facebook requires this page and also requires a user agreement, but I provided a privacy policy page. I think that with the growth of the site I will add a full-fledged page of the user agreement, although it is unknown when it will be. However, the site rules are described in sufficient detail.

Also came across a strict need for https from the site. Generally, if you consider that I have https from Let`s Encrypt , I didn’t think that there would be any problem, but as it turned out, by default django-social-auth forms the return address with HTTP protocol, and for using HTTPS You need to specify this in the settings.

And now let's see how this is done.

Oct. 26, 2018, 5:35 p.m.

Qt

Qt5, QJsonArray, QJsonObject, QJsonDocument, JSON, Qt

Consider a small example of the formation of a JSON document from, for example, the text and the title of this text.

For example, the text has:

  • Title - First Title
  • Content - First Content

And so on

We will add this text to QJsonObject, which we will add to the QJsonArray text array. The array of objects will be in the general working QJsonObject, which we will save to a file.

We will do all this through a graphical interface in which we have:

  • QLineEdit - titleLineEdit - contains the title of the text to add
  • QTextEdit - contentTextEdit - contains the contents of the text to add
  • QTextEdit - jsonDocumentTextEdit - JSON document preview
  • QPushButton - addButton - button to add new text in JSON
  • QPushButton - clearButton - button to remove all texts from the current QJsonObject
  • QPushButton - saveButton - button to save JSON document to file
  • QPushButton - loadButton - button to read JSON from file

In this case, we will be able to read the JSON file and add additional texts to the read file.

The application will look like this.

Oct. 25, 2018, 2:47 a.m.

Django

django, сообщение, Python, чат

Gave free time to correct private messages on the site. This functionality is not used very often, so I do not make great efforts to improve it, although it is time to bring this functionality to adequate work.

Previously, there was a very big flaw, which was that the dialogue counter with unread messages was not shown, which led to the fact that the users who were sent the message simply did not pay attention to it, because they did not know about it.

Now I finally fixed this flaw. And in the framework of the previous code I will show which corrections were added.

Oct. 24, 2018, 2:38 a.m.

Django

BeaftifulSoup4, Django, Python, HTML, Python 3

When developing a web site that adds the ability to write comments or publish articles that allow html layout, the mechanism for clearing unwanted html tags, in particular script and style tags, is important, since malicious scripts on a quality resource definitely should not be present. It will also be good to be able to clean up the style of the text, especially if the resource implies a uniform style. The discordance of screaming fonts is not needed by anyone, and adds problems with the layout.

To implement this mechanism, I use the Python package Beautiful Soup 4 and finally wrote one class, which essentially does everything I need. Removes unnecessary tags, adds necessary classes to tags, saves classes in tags, if you need to leave them during stripping, this is important for classes that are added at the stage of writing a comment, for example, when inserting a YouTube video or adding program code when the user selects which programming language should be represented in the program code block.

Looking for a Job?
25,000.00 руб. - 30,000.00 руб.
Разработчик Qt/C++
Barnaul, Altai Krai, Russia

For registered users on the site there is a minimum amount of advertising