Privacy policyContactsAbout siteOpinionsGitHubDonate
© EVILEG 2015-2018
Recommend hosting
TIMEWEB
Nov. 6, 2018, 10: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, 11: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, 9: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, 6: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, 6: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.

Oct. 23, 2018, 10:11 a.m.

C++

cpp, C++17, fallthrough

Start at work to use a compiler that supports the standard C++17.

Actively we begin to use various features from this standard..

I was pleased with the [[fallthrough]] attribute for switch case constructions.

Oct. 11, 2018, 6:04 p.m.

Qt

Qt, QScriptEngine, QScriptValue, JavaScript, QScriptContext

Suppose you are faced with the task of executing JavaScript code in a C++ application. For example, there is a set of output data or variables whose names are known in advance, and there are pieces of JavaScript code that does something with these variables. And there is also an algorithm that, if there are any conditions, it will choose. which javascript code should be run.

Also, you can't just take and rewrite that JavaScript code into C++ code and hardcorely add it to the application. Since there are a lot of such pieces of code, at the same time other people are engaged in their maintenance and constantly add new pieces of code.

That is, in this case, the set of input data and JavaScript code for us is data, in some way the content that we launch using a certain algorithm, according to which we choose, under what conditions to choose one or another for the same set of input variables a piece of javascript code.

I hope that I clearly explained why we need to run the execution of JavaScript code in a C++ application.

I suggest to write an application that has two input fields for variable names, two input fields with input for the values of these variables in double format, in case of entering a value other than double data type, we will set the value to Undefined .

We will also add an TextEdit input field for writing JavaScript code that we will execute in our application.

And the last input field will be called Result (this will be TextEdit ), which will be responsible for the output of the new calculated values of the variables we entered.

Also add a QPushButton, which will run the execution of JavaScript code.

The application will look like the image below.

Oct. 10, 2018, 1:32 p.m.

C++

C++, once, pragma

Work on a large project allows in some cases to test some theories concerning a programming language.

It was always interesting if the build is really accelerated by using the #pragma once directive instead of the classic #ifndef #define #endif .

Check this acceleration on a small project is quite problematic, because if the project is going on average for 20 seconds, then we will most likely not see a tangible acceleration, because the assembly time will always float from 17 to 23 seconds.

But I had free time and managed to test this theory on a large project.

Oct. 9, 2018, 7:16 p.m.

Qt

Qt, DLL, dll, Windows, dynamic

The forum raised the question of how to create a dynamic library and correctly connect it to a third-party project. Periodically, such questions arise, so consider one option of creating a dynamic dll for Windows using the standard wizards in Qt Creator.

In this case, the option will not be considered when the project is divided into subprojects, which are compiled as libraries and then connected to the main project. Because it will be the dynamic internal libraries of the project. Let's create exactly the external library, which theoretically could be distributed in the form of binaries.

Create two projects:

  1. QuiLib - this will be an external dynamic library that will contain one dialog box. This dialog box will open in the main project.
  2. WithDynamicLibrary - the project that will be used to connect this dynamic library.

Oct. 1, 2018, 8:34 a.m.

Design Patterns

шаблоны проектирования, приспособленец, flyweight

Цели


  • Использование общего доступа для эффективного использования большого количества объектов.
  • Стратегия GUI Motif по замене тяжеловесных виджетов легкими виджетами.

Проблематика

Проектирование объектов вплоть до самых низких уровней «гранулярности» системы обеспечивает оптимальную гибкость, но может быть неприемлемо дорогим с точки зрения производительности и использования памяти.

Nov. 16, 2018, 7:09 p.m.
Илья Завьялов

Qt - Test 001. Signals and slots

  • Result:31points,
  • Rating scores-10
Nov. 16, 2018, 12:49 p.m.
Ирина Минигузина

C++ - Тест 003. Условия и циклы

  • Result:0points,
  • Rating scores-10
Nov. 16, 2018, 8:55 a.m.
Vitaliy

Qt - Test 001. Signals and slots

  • Result:52points,
  • Rating scores-4
Recent comments
Nov. 16, 2018, 6:50 a.m.
Евгений Легоцкой

Добрый день! шаблон не находит, или шаблон неправильно прописали, или тег шаблона неправильно написан, иных выводов сделать не могу, из того, что вы написали. трейсбек нужно смотреть. Со...
Nov. 16, 2018, 6:48 a.m.
Евгений Легоцкой

пройтись циклом по всем виджетам в обратном порядке for (int i = ui->vertialLayout->count() - 1; i >= 0; --i){ QWidget* w = ui->verticalLyout->itemAt(i)->widget();...
Nov. 15, 2018, 9:35 p.m.
chunk

Доброго времени суток Евгений. Не подскажете что я делаю не так? Получаю ошибку такого характера: Reverse for 'add_comment' with arguments '('',)' not found. 1 pattern(s) tried: ...
Nov. 15, 2018, 3:35 p.m.
Михаиллл

Спасибо. Похоже где то описку сделал, поэтому не работало. Я добавил на verticalLayout много виджитов. А можно ли их как то быстро и просто удалить?
Nov. 15, 2018, 2:55 p.m.
Евгений Легоцкой

verticalLayout - это, по-моему предположению, должен быть у вас объект класса QVBoxLayout, который наследован от QBoxLayout. Поэтому открываете документацию на QVBoxLayout ...
Now discuss on the forum
Nov. 17, 2018, 11:20 p.m.
Евгений Легоцкой

Три года назад я подключал ffmpeg в проект на Qt/С++ на первой работе. И кодирование декодирование удалось запустить. Подключал как библиотеку. Думаю, что в зависимости от проекта мо...
Nov. 17, 2018, 2:13 p.m.
Чарльз Грин

Я сейчас занимаюсь мультимедией, это аудио и видео, программы для концертов и т. д. Бибилиотека Qt очень помогает, она надежная, а надежность в моих приложениях очень важный фактор чтоб не пол...
Nov. 16, 2018, 4:28 p.m.
Евгений Легоцкой

Добрый день! Спасибо, что воспользовались именно форумом. Заниматься курсовыми работами чьими-то ни было у меня времени нет, у самого полторы работы. Но что-то подсказать на фо...
Nov. 16, 2018, 9:52 a.m.
Евгений Легоцкой

Отладчик!!!! Версия комплекта MSVC 2015 + компилятор 14.0!!!!
Join us in social networks

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