In order to be able to sort the contents of a file in Linux, we must first be aware of the sort command that Linux provides us with.The sort command is mainly used to sort the contents of a file. It arranges the records in a particular manner. By default, these records are sorted considering the fact that they are ASCII based values.Few key points to remember about the sort command are −SORT command does the sorting from one line to another, one line at a time.It prints the contents of the file when used on a file, in the ... Read More
In order to simulate the packages that got delayed or dropped we can make use of the netem which provides us with a network emulation functionality that is helpful in testing protocols.The way netem works is that it tests the protocols by emulating the properties of wide area networks.There are different versions of netem and the current stable version allows us to emulate variable delay, loss, re-ordering and duplication of packets.There are two ways in which we can use the network emulator, the first is the most basic one where we can enable the netem kernel component by following the ... Read More
We know that a shared library is a library that can be linked to any program at runtime. In order to view all the shared libraries used by an executable we make use of the Linux command utility known as ldd. We can easily locate the shared libraries on a Linux machine, as they usually start with lib* prefix.Let’s first understand and see examples of how to make use of the ldd command that Linux provides us with.Ldd is a command utility that Linux provides us with and is mostly used in case we want to know the shared library ... Read More
Before setting up GOPATH or GOROOT on the local environment of yours, we must check whether you have correctly installed Go or not.Just type the following command on any user of the machine, where you think you have installed Go −go versionIf it outputs nothing or something like go is not present, then instead of setting the GOPATH first I would recommend that you first download the go binary from this link and then install it on your local machine.Normally the output for the case that you have Go installed will look something like this −immukul@192 linux-questions-code % go version ... Read More
A hardware serial, as the name suggests, denotes that a dedicated piece of hardware (UART) enables Serial communication. In Arduino Uno, for instance, pins 0 and 1 have UART support, and they are connected to the USB via a USB-to-UART converter. That facilitates communication between your computer/laptop and the Arduino. While Arduino Uno has a single Hardware Serial, other boards like Mega have multiple. They are accessed using Serial, Serial1, Serial2, and so on.You can have a look at an example of using Multiple Hardware Serials by going to File → Examples → Communication → MultiSerialSoftware serial is a library ... Read More
You can define a class in Arduino just like in C, with public and private variables and methods.The example below demonstrates the definition of a Student class, which has the constructor, two methods (add_science_marks and get_roll_no) and 3 private variables, _division, _roll_no and _science_marks.Exampleclass Student { public: Student(char division, int roll_no); void add_science_marks(int marks); int get_roll_no(); private: char _division; int _roll_no; int _science_marks; }; Student::Student(char division, int roll_no){ _division = division; _roll_no = roll_no; } void ... Read More
I2C stands for Inter-Integrated Circuit. It is a popular communication protocol used by several peripherals like accelerometer and gyroscopes, OLED Displays, etc. Arduino refers to I2C as Wire, which is a shorter form of the term Atmel uses (Two Wire Interface or TWI). Here are some salient features of I2C −It uses only two lines: One for data (SDA) and one for clock (SCL). I2C is synchronous because it uses a clock.The slaves are not selected via a slave select line, but via address bits.The first byte sent by the master contains a seven-bit address and a read/ write bit ... Read More
SPI stands for Serial Peripheral Interface. It is a common protocol used for communication between microcontrollers and peripherals. SD Card is a popular peripheral that uses SPI for communication. Here are some salient features of SPI −It uses four lines −Clock line (SCK), Master Input, Slave Output(MISO) for master to receive and slave to transmit, Master Output, Slave Input(MOSI) for master to transmit and slave to receiveSlave Select(SS) for selecting one among multiple slave with which communication is desired.Note that master is defined as the micro-controller which sends the clock signalIt operates in full duplex mode, meaning the master and ... Read More
Don’t have Arduino IDE installed on your machine, but still want to write Arduino code? Alternatively, don’t have access to your machine, but still want to program boards with your code? Come in Arduino Online Editor. Head on to www.create.arduino.cc/editorYou will be asked to Sign Up if you are visiting this page for the first time. Complete the Sign Up formalities, and login.You will be greeted with a screen like this one −As you can see, this is very similar to the offline Arduino IDE. You can select the board and port (more on the port later), you can write ... Read More
We will have a comparison of the specifications of Arduino Uno and the STM32 Blue Pill Board.Arduino UnoRaspberry PiArduino Uno and Raspberry Pi are in different leagues altogether. Arduino is a microcontroller, while R-Pi is a Single Board Computer. R-Pi comes with its own operating system. Arduino has no OS, it can simply run programs compiled for the Arduino platform (which means C and C++ programs in general). There is no point comparing the two, but still let’s see the difference in specs, to drive the point home.Arduino Uno has 2 kB of SRAM. The first model of R-Pi had ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP