sonia jessicaJune 21, 2022, 2:34 a.m.

JavaJava Array Programs

Java, Interview

Arrays in java:

  • An array is the basic Data Structure that contains items of similar data types.
  • There is always an ordering amongst the position of the element.
  • It can be accessed with the help of the indices. Java supports 0-indexed arrays. Means the array index starts with 0 in java.
  • We can declare array in java as-[] arr = new int[size];[] arr = {1,2,3…};[] arr = new int[]{1,2,3,...};
Evgenij LegotskojJune 13, 2022, 4:15 a.m.

C++Leet Code Solutions - 003 - Longest Substring Without Repeating Characters

cpp, LeetCode, C++, C++17, string

Solution "Longest Substring Without Repeating Characters" on Leet Code

Evgenij LegotskojJune 13, 2022, 3:13 a.m.

C++Leed Code Solutions - 002 - Add Two Numbers

LeetCode, cpp, C++

Solution "Add Two Numbers" on Leet Code

Evgenij LegotskojJune 13, 2022, 2:58 a.m.

C++Leet Code Solutions - 001 - Two Sum

cpp, LeetCode, C++

Two Sum solution on Leet Code

Evgenij LegotskojJune 1, 2022, 3:30 a.m.

DjangoDjango - Lesson 059. Saving the selected language in user settings

python, language, translation, django

In this article, I would like to show an example of how you can make a link on the site so that the user can switch between languages on the site.

But I will show a more advanced version of this functionality, namely saving the selected language in the user table, as well as redirecting the user to a page with the correct language that was selected by the user, if they are of course authorized. That is, if the user has set the German language for himself, then when going to the site via an English link, the site will automatically redirect the user to the page with the German language.

To do this, we need to add a language code field to the user model, I hope that everyone is already using their user model in Django instead of the default one.
Rewrite the standard Django language setup function, and also add a Middleware that will process the urls requested from the site.

Among other things, this functionality will be useful in order to generate letters with the correct language for registered users.

This article is based on Django 4 and may not be suitable for older versions of Django.

Pavel DorofeevMay 29, 2022, 10:28 a.m.

Projects based on QtКак реализовать TLSv1.2 на Qt 4.8.1


Initially, QSsl in Qt 4.8.1 (released about 13 years ago) used only the maximum of TLS v1.0.

Today is 2022 and Tls v1.0 and v1.1 are being blocked by almost every decent site on the internet.

Qt in QSsl uses the open library openssl.

Evgenij LegotskojApril 18, 2022, 4:39 p.m.

DjangoDjango - Tutorial 058. Database Growth Due to django_session Table

Django, Postgres, garbage collection, Python, PostgreSQL

Lately, I have noticed that the fatal moment is approaching, when the disk space for the site on the hosting will catastrophically cease to be enough. And the database dump becomes incredibly huge, although there are no obvious prerequisites for this. The content size of the site isn't growing that fast, and the number of registered users isn't growing that fast either.

After examining the database, it was found that the size of the django_session table is just a gigantic almost 7 GB, and the size of the index also reaches almost 6.5 GB, despite the fact that the size of the database itself is 14 GB.

At the same time, the size of the second largest table is only 11 MB and this is a third-party application with a list of cities. And the size of the third table, which contains messages on the forum, is only 8 MB.

Accordingly, it was decided to figure out why this is happening and how to fix it.

Right now, I probably won’t reveal anything new to those who actively administer PostgreSQL databases, but for beginners and those who mainly deal with Django as a PET project, without professional use, the information may be useful.

Evgenij LegotskojFeb. 14, 2022, 3:24 a.m.

DjangoDjango Rest Framework - Tutorial 001. Adding Token Authentication

Django Rest Framework, QML, Authentication, Token, drf, Felgo

At the moment I am actively working on an application that will work with the REST API of a Django site. And one of the first steps was to set up user authentication by token, but in order for this to work, you must first obtain an authorization token.

Let's look at how this can be done.

Evgenij LegotskojFeb. 10, 2022, 3:13 a.m.

DjangoDjango - Lesson 057. Multilanguage support in MarkdownField with auto populate functionality

MarkdownField, markdown, modeltranslation, Django

The article How to write auto populate field functionality described the simplest functionality of the MarkdownField field to support markdown syntax on a site with automatic generation of html content.

I did not immediately show advanced functionality to make it easier to understand what a Markdown-like field is like. But now I would like to expand this functionality to add support for multilingualism.

Evgenij LegotskojFeb. 9, 2022, 5:11 a.m.

DjangoDjango - Tutorial 056. How to convert image to WEBP format when saving to ImageField

ImageField, Django, WEBPField, webp, Python

WEBP is an image compression format that was introduced by Google in 2010. Its main advantage is its low size without visible loss of quality compared to formats such as JPEG or PNG. Therefore, it is quite logical to use this format for storing images on the site, especially if you do not need to store the original images on the site.

After a long search, I still did not find a ready-made and simple solution that would support converting images to WEBP format on the fly.
Therefore, I decided to write my own version, which eventually consists of a couple of dozen lines and is as simple as a wooden board.

Evgenij LegotskojFeb. 8, 2022, 5:55 a.m.

DjangoDjango - Tutorial 055. How to write auto populate field functionality

field, Django, python, auto, Python

For a long time I wanted to write an article on how to write auto populate field functionality for a Django project. This is a very useful feature that allows you to change the content of other model fields in Django by setting a value to a field that uses auto populate.

First, why is it needed? - Such functionality allows you to reduce the size of the code in those places where you need to rewrite other fields of the object when they change. That is, for example, you do not have to redefine the save method each time in order to rewrite some field in case other fields of the object change. Also, using auto populate is basically a more advanced and neat way to manage data models in Django.
And also a similar approach can solve some problems and improve the site.

Evgenij LegotskojFeb. 7, 2022, 7:52 a.m.

QtQt/C++ Tutorial 092. Creating translations for external text sources

Qt 6, Qt, Qt 5, QtLinguist, translation

Today we will discuss a rather interesting option for adding translation to a Qt/C++ application. Namely, adding translations for texts from external sources when you display texts from databases, an external API, or just some other files.

Such a situation can arise in the following case, for example, analysts in your project form sets of data and texts in some external database or text files, but there is no possibility of multilingualism for some reason. And therefore, you do not have the option to select the language as an additional parameter when requesting this data. Or, for example, the final data is downloaded from an external resource and stored in a SQLite database, of course, without additional translations. But at the same time, you are developing a multilingual application and you need to somehow generate translation files for these texts, so that the translation team can translate them, and you can connect them in the application.

But in Qt it is possible to solve this problem as well. In such situations, you can also generate source code files in the same way, for example, generate them when importing data during application development, and then generate translation files with the extension *.ts , which are used in QtLinguist to translate the application to Qt, and then generate binary *.qm translation files that will be included in the application.

Let's see how it works and what needs to be done for this.

Card image cap
Pulsum Via

Project for travelers from EVILEG.


Let me recommend you a great European Fornex hosting.

Fornex has proven itself to be a stable host over the years.

For Django projects I recommend VPS hosting

Following the link you will receive a 5% discount on shared hosting services, dedicated servers, VPS and VPN

View Hosting
Share on social networks

The EVILEG project has switched to a non-commercial basis and will develop solely on the enthusiasm of the site creator, the enthusiasm of users, donations and the hosting referral system

Thank you for your support

Available ways to support the project



C++ - Test 001. The first program and data types

  • Result:46points,
  • Rating points-6
  • ULN
  • July 5, 2022, 7:59 a.m.

C++ - Test 006. Enumerations

  • Result:90points,
  • Rating points8
  • ULN
  • July 5, 2022, 7:51 a.m.

C++ - Test 005. Structures and Classes

  • Result:100points,
  • Rating points10
Last comments

Django - Tutorial 011. Adding comments to the site based on Django


Android and QML - Adding Splash Screen

Ну я решил проблему созданием лого для m-xxxhdpi, разложил по папкам и андроид сам вытаскивает нужный, но, в руководстве один важный аспект пропущен, хотя возможно это у меня только, вообщем qt …

Android and QML - Adding Splash Screen

На данный момент не скажу. Очень давно уже не брался за Java на Android

Android and QML - Adding Splash Screen

Интересен формат иконки, если это png, то как решается проблема scalability? не растягивается ли лого на китайфонах с 1280х2500? У меня просто сплеш скрин с градиентом и логотипом, и вот несколь…

Qt/C++ - Lesson 023. Moving QGraphicsItem on QGraphicsScene with mouse help

FIGURE Abdominopelvic regions. Zjuaqd - Cialis Cialis Recommendations for preparing children and adolescents for invasive cardiac procedures a statement…
Now discuss on the forum

Распознание объектов

Я к тому, что, возможно, софт уже есть.

Передача наследников в аргументы функции

Полиморфизм в языке программирования так реализован. Можно оперировать указателем на объект наследованного класса через указатель на объект базового класса. В данном случае можно будет вызывать …

Sorting the added QML elements in the ListModel

I am writing an alarm clock in QML, I am required to sort the alarms in ascending order (depending on the date or time (if there are several alarms on the same day). I've done the sorting …

Изменение поведения QGroupBox при клике на его чекбокс

Я вынес виджеты вынес за пределы QGroupBox в итоге.

QSqlRelatipnalTabelModel Qt 4.8.1 как получить id внешней связи?

Есть еще принципиально другой вариант решить раз и навсегда вопрос с полей id внешней связи. Это форкнуть Qt 4.8.1 QSqlTableModel, то есть создать свою ветку развития. Например создадим кл…
© EVILEG 2015-2022
Recommend hosting TIMEWEB