Pull to refresh

Development

Show first
Rating limit
Level of difficulty

Exploring a possible implementation of non-blocking IO by writing a server on pure syscalls

Reading time11 min
Views2.6K

How do people usually write a server if they don't really care about performance? A program starts, then starts accepting incoming connections from clients and starts a new thread for each client, which is engaged in servicing this client. If you use framework, like Spring or Flask or Poco there, then it does something like this inside itself - the only difference is the threads can be reused, that is, taken from a certain pool. It's all quite convenient, but not too effective (and Spring is bad). Most likely, your threads serving clients do not live long and most of the time they are waiting either to receive data from the client or to send it to the client - that is, they are waiting for some system calls to return. Creating an OS thread is quite an expensive operation, as is context switching between OS threads. If you want to be able to serve a lot of customers efficiently, you need to come up with something else. For example, callbacks, but they are pretty inconvenient (though there are different opinions on this).

Another option is to use non-blocking I/O in combination with some kind of implementation of user-space threads (fibers). In this article I will show you how to write all this with your own hands.

Read more

Machine Learning for price optimization

Level of difficultyMedium
Reading time27 min
Views7.5K

This is a translated and adopted article I wrote for the Aha'22 (30 May 2022) conference. It describes an approach to a marketplace prices optimisation. Here I've outlined some important definitions and tried to define the scopes and roles of ML, algorithms, and humans in optimal pricing. Although the article covers rather basic things, still, you can find out some new formulas and ideas, because these basics are somewhat "well-known only in a very closed clubs", and besides, the real gem found here is the detailed recipe for ML engineers how to build optimal pricing systems.

Read more

TRIZ: The Problem-Solving Methodology for Product Managers

Level of difficultyEasy
Reading time11 min
Views2.8K

Background

As a product manager with over a decade of experience, I'm always looking for new ways to enhance my skills and help other product managers advance in their careers. One area that many companies focus on during the job interview process is analytical and creative problem-solving. And as product managers, we encounter these types of challenges on a daily basis. It's important to stay sharp and continuously develop our problem-solving abilities. That's why I made it a habit to practice a logic puzzle every day. But I also wondered if there was a common approach to solving these puzzles. That's when I discovered TRIZ – the Theory of Inventive Problem Solving. In this article, I'll provide an overview of what TRIZ is and how it can be applied in product management. Then, I'll apply TRIZ principles to solve a series of logical puzzles, showcasing the power and effectiveness of this methodology. So whether you're an experienced product manager looking to enhance your skills or someone who enjoys a good brain teaser, read on to discover the power of TRIZ!

If you find TRIZ to be a useful tool for problem-solving and innovation, there are many resources available to help you delve deeper into the methodology. The TRIZ Journal, for example, offers enough information on TRIZ, including case studies, articles, and other resources. You can also find books and online courses that provide a more in-depth look at TRIZ and how it can be applied in different industries and contexts. So if you're interested in learning more, there are plenty of opportunities to expand your knowledge and apply TRIZ to your work.

Read more

On the difference between regular functions and Lambdas

Level of difficultyMedium
Reading time11 min
Views3.3K

The point of this article is to explore Lambda functions, their dirrerences from regular functions and how they are implemented, based on C++, Python and Java programming languages.

Throughout this article I will be using godbolt.org to compile code and see machine code or byte code.

Read more

Automation in mobile QA testing

Level of difficultyMedium
Reading time7 min
Views1.3K

It takes a lot of time and effort to develop a game. Finding and fixing errors before the release is one of the most crucial stages of the whole process, and the bigger your project is, the more people are usually involved in testing. Even the most uncomplicated games require a proper and thorough examination by QAs. The processes are automated to provide high-level project maintenance by increasing testing speed and reducing the influence of the human factor.

Automated testing is done with the help of specific programs, like Selenoid and Appium (although such frameworks are rarely used in games). 

However, the chances of successful automation depend primarily on the genre. Plus, it doesn’t cover all stages. For example, while the analytical issues can be automated, the visual aspect and gameplay are still tested manually (or are they really? We’ll get back to this later). We differentiate the two most popular types of auto testing: 

Read more

Langton's ant: a mystery cellular automaton

Reading time4 min
Views3K

The life of Langton's Ant seems sad and lonely, but, as we'll soon discover, he is not ready to put up with such an outrageous situation and is trying his best to escape. American scientist Christopher Langton invented his ant back in 1986. Since then, no one has been able to explain the strange behavior of this mysterious model...

Read more

Array of weak in Swift

Level of difficultyMedium
Reading time2 min
Views6.5K

In Swift, when working with objects, it’s important to manage memory correctly. One way to do this is by using weak references to avoid retaining objects too long and causing memory leaks. In this article, we will discuss how to create an array of weak references in Swift using a generic wrapper.

Read more

GNU radio 802.11 black box optimization

Level of difficultyMedium
Reading time5 min
Views3K

In this post I'll share my experience in adjustment of WiFi physical channel. The channel was implemented on a software defined radio (SDR) platform. WiFi looks like a very complicated thing standardized over hundreds of pages. Could a non-expert with a PC and a couple of 100$ devices (HackRFs) somehow improve it? Here I try to develop a WiFi optimization approach basically agnostic of protocol implementation details. There's some math and Python programming in it.

Read more

The Collatz conjecture is the greatest math trick of all time

Reading time4 min
Views3.7K

On the Internet and in non-fiction literature you can often find various mathematical tricks. The Collatz conjecture leaves all such tricks behind. At first glance, it may seem like some kind of a trick with a catch. However, there is no catch. You think of a number and repeat one of two arithmetic operations for it several times. Surprisingly, the result of these actions will always be the same. Or, may be not always?

Read more

Cross-Platform System Programming Guide for UNIX & Windows: Level 1

Reading time61 min
Views6.1K

In this tutorial we'll learn how to write cross-platform code in C using the system functions on popular OS (Windows, Linux/Android, macOS & FreeBSD): file management functions and file I/O, console I/O, pipes (unnamed), execution of the new processes. We're going to write our own small helper functions on top of low-level userspace system API and use them so that our main code can run on any OS without modifications. This tutorial is Level 1, the easiest. I split the difficult stuff into parts so the code samples here shouldn't be overwhelming for those who has just started to program in C. We'll discuss the differences between the system API and how to create a cross-platform programming interface that hides all those differences from the user.

Read more

Autofill input fields in Android WebView

Level of difficultyMedium
Reading time12 min
Views14K

In this article, we will learn about autofill methods for input fields/forms in WebView used inside of an android app. I’d like to stress that the main topic is the autofill in WebView, because, when filling standard EditText views in the app - no issues arise. But when we display content owned by other parties, we can’t fill the form with our data in a simple way.

Read more

Writing The Matrix in Python

Reading time6 min
Views4.4K

Programming textbooks usually do not indulge us with variety of examples. In most manuals, exercises are similar to each other and not particularly interesting: create another address book, draw a circle using turtle, develop a website for a store selling some kind of "necessary" advertising nonsense. Too far from the authentic imitation of "The Matrix". Although…

How about taking over the control and starting to invent exercises yourself?

Would you like to write your own personal little "Matrix"? Of course, not the one with skyscrapers, stylish phones of the time, and the ubiquitous invincible Agent Smiths. We will need a couple of more months of learning for that. But any beginner programmer can write a model of the cult splash screensaver with the green streams of digits flowing down the screen. Let's try to creat it in the "great and mighty" Python.

Read more

DSL (domain-specific language) implementation with macros

Level of difficultyMedium
Reading time8 min
Views2.8K

image
This is a translation of my own article


The release of NewLang language with a brand new "feature" is coming, a remodeled version of the preprocessor that allows you to extend the language syntax to create different DSL dialects using macros.


What is it about?


DSL (Subject Oriented Language) is a programming language specialized for a specific application area. It is believed that the use of DSL significantly increases the level of abstractness of the code, and this allows to develop more quickly and efficiently and greatly simplifies the solution of many problems.

Conditionally, we can distinguish two approaches to DSL implementation:


  • Development of independent syntax translators using lexer and parser generators to define the grammar of the target language through BNF (Backus–Naur form) and regular expressions (Lex, Yacc, ANTLR, etc.) and then compiling the resulting grammar into machine code.
  • Development or integration of the DSL dialect into a general-purpose language (metalanguage), including the use of various libraries or special parsers / preprocessors.

We will talk about the second option, namely the implementation of DSL on the basis of general-purpose languages (metalanguages) and the new implementation of macros in NewLang as the basis for DSL development.

Read more →

Use of Python to write plugins for GIMP

Level of difficultyMedium
Reading time9 min
Views4.2K

GIMP (GNU Image Manipulation Program) is a free and open-source image editing software that provides users with a wide range of tools for editing and manipulating digital images. Python is a high-level programming language that is often used for scripting and automation tasks. The combination of GIMP and Python provides a powerful platform for users to create custom image editing plugins that can automate repetitive tasks, extend the functionality of GIMP, and customize the software to suit their specific needs.

Python provides a flexible and easy-to-learn language for writing GIMP plugins. GIMP provides an API (Application Programming Interface) that allows Python scripts to interact with the image editing program Python plugins for GIMP can be used for a wide range of tasks, including automating repetitive tasks, enhancing the functionality of GIMP, and customizing the software to suit specific needs. Some examples of tasks that can be automated using Python plugins include batch processing of images, resizing and cropping of images, and converting file formats.

Plugins can also add new features to GIMP, such as custom brushes, filters, and effects. Additionally, plugins can be used to create custom user interfaces that enable users to interact with GIMP in new and unique ways.

Read more

Will transport planners lose their jobs as AI becomes smarter?

Level of difficultyMedium
Reading time13 min
Views1.1K

As a Product Manager who has worked on the development of delivery route optimisation software for 10+ years, I see that modern technologies can significantly improve the optimisation process and deliver better solutions. AI, machine learning, and other modern technologies have the potential to revolutionise the way delivery routes are optimised in the future.

With the increasing availability of data and the advancement of AI and machine learning algorithms, it is becoming possible to develop more sophisticated prediction models that can be integrated into optimisation algorithms to make more accurate and informed decisions about route planning and scheduling. Machine learning algorithms can be trained to predict customer demand based on historical sales data and other market trends, allowing businesses to optimise their delivery schedules and routes accordingly. AI can also be used to optimise delivery schedules based on customer preferences and other relevant factors.

Blockchain technology could be used to create a secure, decentralised database of information about deliveries, including information about the products being shipped, the route they are taking, and the status of the delivery. This could help increase transparency and accountability in the delivery process as well as reduce the risk of fraud and theft.

Internet of Things (IoT) devices, such as sensors and GPS trackers, may collect real-time data about delivery vehicles and their surroundings. This data could be analysed and used to optimise delivery routes in real time, as well as to track the location of deliveries and monitor the condition of the products being shipped.

Read more

How to Create a Color Picker in React Native

Level of difficultyEasy
Reading time2 min
Views2.3K

React Native is a popular JavaScript library for creating mobile applications for both Android and iOS devices. One of the most useful components that you can use in React Native is a color picker. A color picker allows users to select a specific color from a range of colors. In this tutorial, we will show you how to create a color picker in React Native.

Read more