Assume we need to add an NSString object to SomeClass (we cant subclass).
In this example we not only create an associated object but also wrap it in a computed property in a category for extra neatness
#import <objc/runtime.h>
@interface SomeClass (MyCategory)
// This is the property wr...
Accessed through including <stdio.h>, the function printf() is the primary tool used for printing text to the console in C.
printf("Hello world!");
// Hello world!
Normal, unformatted character arrays can be printed by themselves by placing them directly in between the parenthes...
To receive messages, use a service that extends FirebaseMessagingService and override the onMessageReceived method.
public class MyFcmListenerService extends FirebaseMessagingService {
/**
* Called when message is received.
*
* @param remoteMessage Object representing t...
Client apps can subscribe to any existing topic, or they can create a new topic. When a client app subscribes to a new topic name, a new topic of that name is created in FCM and any client can subsequently subscribe to it.
To subscribe to a topic use the subscribeToTopic() method specifying the top...
Use Enum.chunk/2 to group elements into sub-lists, and Map.new/2 to convert it into a Map:
[1, 2, 3, 4, 5, 6]
|> Enum.chunk(2)
|> Map.new(fn [k, v] -> {k, v} end)
Would give:
%{1 => 2, 3 => 4, 5 => 6}
Individual pixel access in OpenCV Mat structure can be achieved in multiple ways. To understand how to access, it is better to learn the data types first.
Basic Structures explains the basic datatypes. Shortly, CV_<bit-depth>{U|S|F}C(<number_of_channels>) is the basic structure of a typ...
Ways to create a file with the echo command:
echo. > example.bat (creates an empty file called "example.bat")
echo message > example.bat (creates example.bat containing "message")
echo message >> example.bat (adds "message" to a new line in example.bat)...
@echo off prevents the prompt and contents of the batch file from being displayed, so that only the output is visible. The @ makes the output of the echo off command hidden as well.
Ways to create a file with the echo command:
ECHO. > example.bat (creates an empty file called "example.bat")
ECHO message > example.bat (creates example.bat containing "message")
ECHO message >> example.bat (adds "message" to a new line in example.bat)...
Vec (Vector) is a template class for numerical values. Unlike c++ vectors, it generally stores short vectors (only a few elements).
The way a Vec is defined is as follows:
typedef Vec<type, channels> Vec< channels>< one char for the type>;
where type is one of uchar, short, i...
In OpenCV, images can be RGB/BGR, HSV, grayscaled, black-white and so on. It is crucial to know the data type before dealing with images.
The image data types are mainly CV_8UC3 (Matrix of uchar with 3 channels) and CV_8U (Matrix of uchar with 1 channel), however, the conversion to other types such...
Activate Developer Mode:
Login to odoo application.
After login user may see several odoo menu's. Click on setting menu.
Click on 'Activate the developer mode' which is located at right-bottom corner of settings page.
Developer mode now activated.
The CPU governor itself is just 1 C file, which is located in kernel_source/drivers/cpufreq/, for example: cpufreq_smartass2.c. You are responsible yourself for find the governor (look in an existing kernel repo for your device)
But in order to successfully call and compile this file into your ke...
DispatchSemaphore provides an efficient implementation of a
traditional counting semaphore, which can be used to control access to
a resource across multiple execution contexts.
A scenario for when to use a semaphore could be if you are doing some file reading/writing, if multiple tasks are t...