Pull to refresh
1075.47

Programming *

The art of creating computer programs

Show first
Period
Level of difficulty

Compilable configuration of a distributed system

Reading time17 min
Views1.5K

In this post we'd like to share an interesting way of dealing with configuration of a distributed system.
The configuration is represented directly in Scala language in a type safe manner. An example implementation is described in details. Various aspects of the proposal are discussed, including influence on the overall development process.


Overall configuration management process


(на русском)

Read more →

Weak UI, weak programmer

Reading time2 min
Views3.1K

UI facepalm


Why do so many programmers hate UI work? Because it is tedious. Especially, for the Web, but other types of UI are only slightly easier. Layouts, margins, paddings — neverending stream of little tweaks to make it look OK on all sane environments, and somehow this freaking button sometimes overlaps that input field. Rrrr! And yes, it should not hang on button clicks, which means a lot of asynchronous programming, which is a nightmare.


And don’t even speak about aesthetics and usability! Choose right colours, element sizes and locations, find/draw images and put them where they fit, think about user workflows — isn’t it a designers’ or Ux specialists’ job?! Leave me alone, I’m a programmer. I work with backend layers, where everything is straightforward and linear, there are no buttloads of different environments to adjust to, and design is guided by mere logic without pesky fussing with ‘user friendliness’ and ’beauty’!

Read more →

Why x^0 = 1 visually

Reading time3 min
Views1.2K

The traditional definition for the operation of exponentiation to a natural power (or a positive integer) had introduced approximately as follows:

Exponentiation is an arithmetic operation originally defined as the result of multiple multiplications a number by itself.

But the more precise formulation is still different:

Raising a number X to an integer power N is an arithmetic operation defined as the result of multiple [N by mod times] multiplications or divisions one by number X.

Let's figure it out under the cut! >>

Lingtrain Aligner. How to make parallel books for language learning. Part 1. Python and Colab version

Reading time8 min
Views4.1K

title


If you're interested in learning new languages or teaching them, then you probably know such a way as parallel reading. It helps to immerse yourself in the context, increases the vocabulary, and allows you to enjoy the learning process. When it comes to reading, you most likely want to choose your favorite author, theme, or something familiar and this is often impossible if no one has published such a variant of a parallel book. It's becoming even worse when you're learning some cool language like Hungarian or Japanese.


Today we are taking a big step forward toward breaking this situation.


We will use the lingtrain_aligner tool. It's an open-source project on Python which aims to help all the people eager to learn foreign languages. It's a part of the Lingtrain project, you can follow us on Telegram, Facebook and Instagram. Let's start!


Find the texts


At first, we should find two texts we want to align. Let's take two editions of "To Kill a Mockingbird" by Harper Lee, in Russian and the original one.

Read more →

Algorithms in Go

Reading time2 min
Views5.8K

Most solutions to algorithmic problems can be grouped into a rather small number of patterns. When we start to solve some problem, we need to think about how we would classify them. For example, can we apply fast and slow аlgorithmic pattern or do we need to use cyclic sortpattern? Some of the problems have several solutions based on different patterns. In this series, we discuss the most popular algorithmic patterns that cover more than 90% of the usual problems.

It is different from High-School Algorithms 101 Course, as it is not intended to cover things like Karatsuba algorithm (fast multiplication algorithm) or prove different methods of sorting. Instead, Algorithmic Patterns focused on practical skills needed for the solution of common problems. For example, when we set up a Prometheus alert for high request latency we are dealing with Sliding Window Pattern. Or let say, we organize a team event and need to find an available time slot for every participant. At the first glance, it is not obvious that in this case, we are actually solving an algorithmic problem. Actually, during our day we usually solve a bunch of algorithmic problems without realizing that we dealing with algorithms.

The knowledge about Algorithmic Patterns helps one to classify a problem and then apply the appropriate method.

But probably most importantly learning algorithmic patterns boost general programming skills. It is especially helpful when you are debugging some production code, as it trains you to understand the execution flow.

Patterns covered so far:

Sliding Window I

Sliding Window II

Merge Intervals

Dutch National Flag

Matrix Spiral

Iterative Postorder Traversal

Bit Manipulation

Stay tuned :)

<Promo> If you interested to work as a backend engineer, there is an open position in my squad. Prior knowledge of Golang is not required. I am NOT an HR and DO NOT represent the company in any capacity. However, I can share my personal experience as a backend engineer working in the company. </Promo>

Read more

Algorithms in Go: Sliding Window Pattern

Reading time3 min
Views5.9K

Let's consider the following problem: we have an array of integers and we need to find out the length of the smallest subarray the sum of which is no less than the target number. If we don't have such a subarray we shall return -1.

We can start with a naive approach and consider every possible subarray in the input:

Continue reading

Using Flex (Fast Lexical Analyzer Generator)

Reading time5 min
Views8.6K
Lexical analysis is the first stage of a compilation process. It's used for getting a token sequence from source code. It gets an input character sequence and finds out what the token is in the start position, whether it's a language keyword, an identifier, a constant (also called a literal), or, maybe, some error. A lexical analyzer (also known as tokenizer) sends a stream of tokens further, into a parser, which builds an AST (abstract syntax tree).

It's possible to write a lexer from scratch, but much more convenient to use any lexer generator. If we define some parsing rules, corresponding to an input language syntax, we get a complete lexical analyzer (tokenizer), which can extract tokens from an input program text and pass them to a parser.

One of such generators is Flex. In this article, we'll examine how it works in general, and observe some nontrivial nuances of developing a lexer with Flex.
Read more →

Static Analysis: baseline VS diff

Reading time6 min
Views1.3K
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 →

Esoteric programming languages: a systematic approach

Reading time6 min
Views2.2K
A surprising number of programming languages were created to accomplish unusual tasks that have nothing to do with programming. These are commonly called esoteric. Today, we’re going to paint a general overview of the esolang landscape, and try to figure out why people are continuing to create them.

Read more →

[Interview] Top Programming Trends And Practical Advice to Follow in The New Decade

Reading time3 min
Views2.3K


Image credit: Unsplash

What will the future bring to the programming world? Are there any specific technologies that will rise and fall? Which programming language one should learn to succeed in their career? What should a newbie programmer know and understand to build a successful career in the 2020s?

I had the opportunity to sit down and talk about these issues in greater detail with Vitaly Kukharenko, a CTO with 10+ years of experience and creator of several high load startups.
Read more →

WebRTC streaming in and around virtual reality

Reading time6 min
Views3.8K


Virtual reality is on the rise these days. The equipment that was previously the exclusive preserve of crazy scientists geeks with big money from the Ministry of Defense back in the The Lawnmower Man days, is currently affordable for ordinary people; those whose pockets are empty, can assemble a VR headset from cardboard and a smartphone according to many recipes.

Read more →

Hyper-V for Developers on Windows 10

Reading time6 min
Views6.4K
Hyper-V is more known as a server virtualization technology; however, since Windows 8, it is also available in the client operating system. In Windows 10, Microsoft improved the experience drastically to make Hyper-V an excellent solution for developers and IT Pros.
 
Microsoft Hyper-V, codenamed Viridian, is a native (type 1) hypervisor that directly runs on the hardware, compared to VMware Workstation, VirtualBox, and other type 2 or hosted hypervisors. It was first released in Windows Server 2008, and it allows you to run virtual machines on x86-64 systems.

As mentioned, with Windows 10, Microsoft optimized Hyper-V for developers. Hyper-V allows developers to quickly spin up development virtual machines on Windows 10 with excellent performance, but it is also used in a couple of other development features as a back-end technology, like the Android Emulator, the Windows Subsystem for Linux 2 or Docker Containers. In this article, we will have a quick look at what Hyper-V on Windows 10 can over for developers.
Read more →

Channel quality indicator for server WebRTC over TCP

Reading time5 min
Views2.7K


Publish and Play


There exist two main functions of WebRTC operation on the server side in the field of streaming video: publishing and playing. In the case of publishing, the video stream is captured from the web camera and moves from the browser to the server. In the case of playing, the stream moves in the opposite direction, from the server to the browser, is decoded and played in the browser’s HTML5 <video> element on the device’s screen.

Read more →

Quick reference of C++ value categories: Part 2

Reading time41 min
Views2.7K



Go to Part 1


Passing parameters to a function


When passing parameter to a function, category of a passed expression is implicitly converted to the category of function parameter: void f(TO_TYPE p); FROM_TYPE x; f(x); This implicit conversion takes place the same way as during an assignment (see "Assignment" section above) except that function definition cannot contain "auto" types.


Read more →

How to Implement Tinder Swipe Cards in SwiftUI

Reading time7 min
Views14K
In June, we heard about SwiftUI for the first time — a totally new way of creating and working with UI elements in iOS and macOS (also iPadOS) apps. It felt like Christmas in the summer. It's new, it's declarative, it's sexy! And now, just a few weeks after iOS 13 has been released, we can start to use SwiftUI in all our projects. Let's learn how to use this amazing tool that Apple gave us, to create the classic Tinder-esque Swipe Cards.

In this article, I would like to show you how to achieve a Tinder-like card view and behavior (swipe to action), with just a few lines of code.

To achieve this, we need to do the following things, in order:

  • Create UserView
  • Create NavigationView
  • Create BottomBarView
  • Create SwipeView
  • Put all this together inside ContentView

So let's get started.
Read more →

Complexity Waterfall and Architecture on Demand

Reading time10 min
Views1.7K

Logo


When talking about "bad code" people almost certainly mean "complex code" among other popular problems. The thing about complexity is that it comes out of nowhere. One day you start your fairly simple project, the other day you find it in ruins. And no one knows how and when did it happen.


But, this ultimately happens for a reason! Code complexity enters your codebase in two possible ways: with big chunks and incremental additions. And people are bad at reviewing and finding both of them.

Read more →

Getting started with Git and GitHub is easier than ever with GitHub Desktop 2.2

Reading time2 min
Views2K


Anyone who uses Git knows that it has a steep learning curve. We’ve learned from developers that most people tend to learn from a buddy, whether that’s a coworker, a professor, a friend, or even a YouTube video. In GitHub Desktop 2.2, we’re releasing the first version of an interactive Git and GitHub tutorial that can be your buddy and help you get started. If you’re new to Desktop, you can download and try out the tutorial at desktop.github.com.
Read more →

A new video series for beginners to learn Python programming

Reading time2 min
Views1.4K
Probably the largest hurdle when learning any new programming language is simply knowing where to get started. What’s important? What do I need to know to be proficient? It’s hard to follow docs when you’re not even sure what you’re reading.

You might be taking a look at Python. Maybe you’re drawn because of its popularity. Maybe you’re drawn to its flexibility. With Python you can create solutions of all shapes and sizes. You can dig into web development. Simplify your life through automation. Or maybe begin building the future with machine learning.

Picking up a new language is a common situation for modern-day developers. The days of going your entire career focused on one language are long since gone.

Fortunately, concepts typically don’t change as you move from one programming language to the next. Sure, the syntax might be different, but an if statement is still an if statement even when it’s written using { } or End If. So, we don’t need to learn how to program, but rather how to program in a new language.

This is why Susan and I created this series of videos! You might know how to write code, for example in JavaScript, Java or C# (or COBOL, or Bash, or… it doesn’t matter, really). Maybe you learned in a college course, online, or reading a book. So, you don’t need to be taught what an if statement is, but rather what an if statement looks like in Python.

Read more →

Modern Environment for React Native Applications

Reading time4 min
Views2.1K
In this article, we will consider the process of setting up a React Native environment using expo-cli, Typescript, and Jest.
Typescript will help us avoid development mistakes and write a more efficient mobile application.

Modern tools allow integrating Typescript into the development environment. We can also use VS Code that supports Typescript.

Integration with React Native will give us the opportunity to use the auto-completion service, code navigation, and refactoring.

Expo is a toolkit that simplifies the creation of native React applications. This tutorial will give you an idea of how you can quickly create native React applications using Expo.


Read more →

Authors' contribution