Pull to refresh
697.84

Programming *

The art of creating computer programs

Show first
Rating limit
Level of difficulty

Checking QEMU using PVS-Studio

Reading time 14 min
Views 624
image1.png

QEMU is a rather well-known application for emulation. Static analysis can help developers of complex projects such as QEMU catch errors at early stages and generally improve quality and reliability of a project. In this article, we will check the source code of the QEMU application for potential vulnerabilities and errors using the PVS-Studio static analysis tool.
Read more →
Total votes 3: ↑3 and ↓0 +3
Comments 0

Dark code-style academy: line breaks, spacing, and indentation

Reading time 4 min
Views 2.4K

Hey guys! Let me walk you through the next part of our dark-style code academy. In this post, we will discover some other ways how to slow down the reading speed of your code. The next approaches will help you to decrease maintenance and increase a chance to get a bug in your code. Ready? Let's get started.

Read more
Total votes 1: ↑1 and ↓0 +1
Comments 1

Dark code-style academy: spoil if statement

Reading time 3 min
Views 2.1K

image


Do you want to raise your salary? Do you want always to be in demand? Do you want to have your job as long as you want? It is absolutely real! You just need to change the way you write your code. Basically, you need to increase your job security. You have to write code which will be almost impossible to maintain for everyone except you. And in these series of articles, I will tell you how to achieve it. Welcome under the cut.

Read more →
Total votes 3: ↑3 and ↓0 +3
Comments 0

Static Analysis: From Getting Started to Integration

Reading time 9 min
Views 1.2K
Sometimes, tired of endless code review and debugging, you start wondering if there are ways to make your life easier. After some googling or merely by accident, you stumble upon the phrase, "static analysis". Let's find out what it is and how it can be used in your project.

Read more →
Total votes 4: ↑3 and ↓1 +2
Comments 0

Static Analysis: baseline VS diff

Reading time 6 min
Views 1.2K
If you use static analyzers, you will have, sooner or later, to address the task of making their integration into existing projects easier, where fixing all warnings on legacy code is unfeasible.

The purpose of this article is not to help with integration but rather to elaborate on the technicalities of the process: the exact implementations of warning suppression mechanisms and pros and cons of each approach.

image1.png

Read more →
Total votes 5: ↑5 and ↓0 +5
Comments 0

Spring transaction management. Isolation and propagation

Reading time 3 min
Views 25K

Introduction


In my opinion transaction management is a really important topic for each backend developer. In general, people don’t pay attention to it while using Spring framework.


But I think, it is important to know how to use transactions properly. Because sometimes can happen that there was an exception thrown inside your method, but transaction was not rolled back and it is not clear why? Or some other “strange” cases.

Read more →
Total votes 6: ↑6 and ↓0 +6
Comments 0

The Testcontainers’ MongoDB Module and Spring Data MongoDB Reactive in Action

Reading time 19 min
Views 5.1K

1. Introduction


How can I easily test my MongoDB multi-document transaction code without setting up MongoDB on my device? One might argue that they have to set it up first because in order to carry out such a transaction it needs a session which requires a replica set. Thankfully, there is no need to create a 3-node replica set and we can run these transactions only against a single database instance.

Read more →
Rating 0
Comments 0

C2x: the future C standard

Reading time 8 min
Views 16K

image


I strain to make the far-off echo yield
A cue to the events that may come in my day.
(‘Doctor Zhivago’, Boris Pasternak)

I’ll be honest: I don’t write in pure C that often anymore and I haven’t been following the language’s development for a long time. However, two unexpected things happened recently: С won back the title of the most popular programming language according to TIOBE, and the first truly interesting book in years on this language was published. So, I decided to spend a few evenings studying material on C2x, the future version of C.


Here I will share with you what I consider to be its most interesting new features.

Read more →
Total votes 22: ↑21 and ↓1 +20
Comments 3

Small things that pollute your code

Reading time 4 min
Views 2.3K
I'm not going to discuss global things like design patterns and so on, as there's enough literature on that topic. Instead, I'd like to attract your attention to some small things that still affect lucidity and maintainability of a code.

Polluting code with 'test-only' methods or access modifiers


First of all, if you give access to something that shouldn't be used in production code, it gets used sooner or later. Just because it exist. The argument that it's an internal stuff doesn't work as it absolutely shouldn't be matter, writing you a library or isolated project! Treat people who will add anything to your internal codebase the same way as if they use your existing code as a different library.

Thus, if for some reason in test, you need to call something that should not be called on prod — use reflection or whatever else but do not expose it in production code! And there's no reason to afraid of reflection for test proposes, at the end, you using Mockito, shouldn't it be bad in that case as well?
Read more →
Total votes 4: ↑3 and ↓1 +2
Comments 1

How to find an English teacher. Part 2

Reading time 4 min
Views 876
image

This is a continuation of story about using Data Science for finding an English teacher. If you have not read it yet - there is an opportunity to become familiar with it

Briefly  -  we had information about language teachers and tried to apply some basic ideas using pandas and our expectations. Unfortunately we got stuck on the third step, because there is not enough information for resolving our the last requirements  -  we need not more 3 candidates at the end.

Disclaimer
It is an approach based on my own experience and can be unsuitable to your point of view, ideas, or principles.
Rating 0
Comments 0

PVS-Studio is now in Compiler Explorer

Reading time 4 min
Views 994
image1.png

Not so long ago, a landmark event has happened: PVS-Studio appeared in Compiler Explorer! Now you can quickly and easily analyze the code for errors right on the godbolt.org site (Compiler Explorer). This feature opens up a large number of new possibilities – from quenching curiosity about the analyzer's abilities to being able to quickly share check results with a friend. This article will cover the topic on how to use these features. Caution – large GIFs!
Read more →
Total votes 1: ↑1 and ↓0 +1
Comments 0

How to find an English teacher. Part 1

Reading time 5 min
Views 1.5K


In the modern world, here and there ideas are arising about using data science for an extra benefit. For instance, Google can use a history of watched videos for providing recommendations about new ones. Online shops are using a recommendation system for increasing your receipt. However… if companies use the data for their benefit, could we do the same for own needs such as looking an online English teacher?


Disclaimer

It is an approach based on my own experience and can be unsuitable to your point of view, ideas, or principles.

Total votes 2: ↑1 and ↓1 0
Comments 0

How to introduce a static code analyzer in a legacy project and not to discourage the team

Reading time 8 min
Views 1.6K


It is easy to try a static code analyzer. But it requires skills to introduce it in the development of an old large project. If the approach is incorrect, the analyzer can add work, slow down development, and demotivate the team. Let's briefly discuss how to properly integrate static analysis into the development process and start using it as part of CI/CD.
Read more →
Total votes 1: ↑1 and ↓0 +1
Comments 0

Implementation of Linked List in PHP

Reading time 3 min
Views 7K

A linked list is a linear data structure, which contains node structure and each node contains two elements. A data part that stores the value at that node and next part that stores the link to the next node as shown in the below image:


Linked List Node

The first node also known as HEAD is usually used to traverse through the linked list. The last node (next part of the last node) points to NULL. The list can be visualized as a chain of nodes, where every node points to the next node.


Linked List

Implementation of Singly Linked List


Representation:


In PHP, singly linked list can be represented as a class and a Node as a separate class. The LinkedList class contains a reference of Node class type.


//node structure
class Node {
  public $data;
  public $next;
}

class LinkedList {
  public $head;

  //constructor to create an empty LinkedList
  public function __construct(){
    $this->head = null;
  }
};

Read more →
Total votes 7: ↑5 and ↓2 +3
Comments 4

Future of PHP: Bright or Dull?

Reading time 4 min
Views 3.6K
image

PHP is a popular scripting language founded in 1995 designed to perform several functions. Do you think the essence of PHP has faded away since the newer programming languages and frameworks have come into the market?

If you think so, then let me tell you that your perception is totally wrong! In fact, in the contemporary market of custom software development, it has become the most popular language in server-side programming.

image
Read more →
Total votes 4: ↑4 and ↓0 +4
Comments 0

The Anatomy of LuaJIT Tables and What’s Special About Them

Reading time 10 min
Views 3K
I don't know about you, but I really like to get inside all sorts of systems. In this article, I’m going to tell you about the internals of Lua tables and special considerations for their use. Lua is my primary professional programming language, and if one wants to write good code, one needs at least to peek behind the curtain. If you are curious, follow me.


Read more →
Total votes 28: ↑28 and ↓0 +28
Comments 0

Programming as an endless educational pursuit

Reading time 5 min
Views 1.3K
When one embarks on the journey to master the craft of programming, they come to the realisation that it has no finish line. No matter how good you are, there are still things to learn, solutions to explore.

Today, we’ll talk about the importance of remaining a lifelong student, language adoption trends according to StackOverflow and why programming itself might not be what you end up learning to become better.

Read more →
Total votes 9: ↑9 and ↓0 +9
Comments 0

Why I keep track of spendings in a personal app made with Git+JS

Reading time 4 min
Views 1.4K

Hi, folks, let me share my experience of creating an application to keep track of my spendings. Specifically, let me do it by answering the following questions:


  1. Why keep track of spendings in an application?
  2. Why did I create the application as a personal project?
  3. Why does the project use Git+JS?

1. Why keep track of spendings in an application?


I, like many people out there, wanted to become rich and successful. To become rich, one is often advised to run a personal budget, that's what I started to do several years ago. I'd like to point out that running my personal budget hasn't made me rich and successful, and I increased income simply by moving to Moscow.

Rating 0
Comments 0

Does gender segregation in the labor market still persist?

Reading time 6 min
Views 1.6K
Common sense prompts that gender segregation and gender discrimination on labor market have declined. There is a popular opinion that too much is talked about smaller women’s chances to blossom forth at work, while the problem was solved long ago. Actually, women all over the world have the same opportunities as men to get higher education, to hold a supervisor or manager position, to climb the career and salary ladder.



The biggest corporations and companies run special programs to shorten gender inequality on labor market. That seems like the evidence: smaller firms try to imitate the policy, and also values, of world famous companies in order to succeed and gain benefit like the second ones do (it is an economic-sociological proved behavior), so in nearest future, or perhaps in present, all players on labor market will popularize the idea of gender equality in all its senses. However, the state of affairs is far from desired. Even if organizations follow gender unbiased strategy, will it solve the global problem of gender inequality at work overall?

This is the guest article by Maria Antomony, HSE University graduate student, sociologist and code passionate.
Read more →
Total votes 4: ↑3 and ↓1 +2
Comments 0

Authors' contribution