Programming Leftovers


-
How to use C++ Unordered Map
A map, also known as an associative array is a list of elements, where each element is a key/value pair. So, each key corresponds to a value. Different keys can have the same value, for ordinary work. For example, the keys can be a list of fruits and the corresponding values, the colors of the fruits. In C++, the map is implemented as a data structure with member functions and operators. An ordered map is one where the element pairs have been ordered by keys. An unordered map is one where there is no order. This article explains how to use C++ unordered map, written as unordered_map. You need knowledge in C++ pointers to understand this article. unordered_map is part of the C++ standard library.
-
How to use memcpy function in C language?
In the C language memcpy() function is used to copy a block of memory from one location to another. In this article, we are going to discuss in detail how the memcpy() function is used. So, let’s get started.
-
How teachers train in Computing with our free online courses
-
Python String Formatting
String formatting is a significant feature of any programming language. By using string formatting, you can properly arrange your string. String formatting helps users understand the output in a well-defined, coherent way. In Python, string formatting can be performed in various ways, i.e., by using the ‘%’ operator and the ‘format ()’ function.
This article explains string formatting in Python using the ‘%’ operator and the ‘format ()’ function. The Spyder3 editor is used to write and run the Python scripts shown in this article.
-
Python Variables
A Python variable is a location in memory to store the values. The variables are reserved memory locations. A variable is a bag or container that stores the value. We store our data in a Python variable which is subsequently used for multiple purposes i.e. processing, value printing, etc. Every value that is assigned to a variable has a data type.
-
Python Functions
A function is a block or group of similar statements that perform a specific task. A function is written to perform the task. In Python, a function takes the input, performs the task, and returns the output. A function also makes the code reusable; instead of writing the same code again and again for performing a similar task, we can make a function and call it.
Python has various built-in functions, including print (), type (), and more. But, we can also define or write our functions. We call these functions “user-defined” functions. In this article, you will learn how to define a function with multiple examples. The Spyder3 editor is used for creating and writing the Python scripts shown in this article.
-
What is a Bash Script?
Many times while working with the different flavors of the Linux operating system, we come across the terms of shell scripting or bash scripting. Most of the naïve users often wonder what these terms really refer to. Shell is a command-line interpreter used with Linux which has multiple different flavors. In this article, we are interested in exploring its variation named Bash. We will throw light on the concept of Bash scripts and we will try to understand them with the help of a few very basic examples. So, let us try and dig deeper into Bash and Bash scripting.
[...]
Whenever you launch the terminal in Linux operating system, the default program that runs inside it is Shell or Bash. This default program is responsible for interpreting all the commands that you run on the Linux operating system. We can also say that Bash is responsible for running the other programs in the Linux operating system. On the other hand, the Linux terminal acts as a bridge between Bash and the user and enables a smooth interaction between them.
Since Bash is responsible for executing the commands that you run in the Linux terminal, therefore, many of the important tasks can be associated with it as its responsibilities. It can be used to configure different programs or even run them via terminal. It can manipulate the files stored on your Linux operating system. It is also capable of interacting with databases. Apart from this, Bash is also a full-fledged scripting language and we will try to find out how is it possible in the next section of this article.
-
Using the “awk” Command to Print the Last Column from a File
“awk” is a very powerful Linux command that can be used with other commands as well as with other variables. This command is essentially used to read the content of a file. The process of file reading has never been this much easier as it is with this efficient command. File reading and writing are very repeatedly used especially if you are a programmer. The read file can then be used to process its content, to modify it, or even to simply print it.
However, there are situations in which you do not intend to read the entire content of that file rather you are only concerned with a specific portion of that file. In such a situation, it is highly not recommended to read the entire file since it will occupy extra space and will also take a longer time for processing rather you should directly hit that particular portion of that file. In this article, we aim to walk you through the different methods of using the “awk” command to print the last column from a file. -
Daniel Stenberg: rust in curl with hyper
curl and its data transfer core, libcurl, is all written in C. The language C is known and infamous for not being memory safe and for being easy to mess up and as a result accidentally cause security problems.
At the same time, C compilers are very widely used and available and you can compile C programs for virtually every operating system and CPU out there. A C program can be made far more portable than code written in just about any other programming language.
curl is a piece of “insecure” C code installed in some ten billion installations world-wide. I’m saying insecure within quotes because I don’t think curl is insecure. We have our share of security vulnerabilities of course, even if I think the rate of them getting found has been drastically reduced over the last few years, but we have never had a critical one and with the help of busloads of tools and humans we find and fix most issues in the code before they ever land in the hands of users. (And “memory safety” is not the single explanation for getting security issues.)
-

- Login or register to post comments
Printer-friendly version- 13252 reads
PDF version
More in Tux Machines
- Highlights
- Front Page
- Latest Headlines
- Archive
- Recent comments
- All-Time Popular Stories
- Hot Topics
- New Members
digiKam 7.7.0 is released
After three months of active maintenance and another bug triage, the digiKam team is proud to present version 7.7.0 of its open source digital photo manager. See below the list of most important features coming with this release.
|
Dilution and Misuse of the "Linux" Brand
|
Samsung, Red Hat to Work on Linux Drivers for Future Tech
The metaverse is expected to uproot system design as we know it, and Samsung is one of many hardware vendors re-imagining data center infrastructure in preparation for a parallel 3D world.
Samsung is working on new memory technologies that provide faster bandwidth inside hardware for data to travel between CPUs, storage and other computing resources. The company also announced it was partnering with Red Hat to ensure these technologies have Linux compatibility.
|
today's howtos
|








.svg_.png)
Content (where original) is available under CC-BY-SA, copyrighted by original author/s.

Recent comments
1 year 11 weeks ago
1 year 11 weeks ago
1 year 11 weeks ago
1 year 11 weeks ago
1 year 11 weeks ago
1 year 11 weeks ago
1 year 11 weeks ago
1 year 11 weeks ago
1 year 11 weeks ago
1 year 11 weeks ago