Tutorial by Examples: c

This allows you to pass a variable by reference to a function or element that allows you to modify the original variable. Passing-by-reference is not limited to variables only, the following can also be passed by reference: New statements, e.g. foo(new SomeClass) References returned from functi...
LocalBroadcastManager is used to send Broadcast Intents within an application, without exposing them to unwanted listeners. Using LocalBroadcastManager is more efficient and safer than using context.sendBroadcast() directly, because you don't need to worry about any broadcasts faked by other Applic...
The following example encrypts a given data block using AES. The encryption key is derived in a secure way (random salt, 1000 rounds of SHA-256). The encryption uses AES in CBC mode with random IV. Note that the data stored in the class EncryptedData (salt, iv, and encryptedData) can be concatenate...
add filter method in RecyclerView.Adapter: public void filter(String text) { if(text.isEmpty()){ items.clear(); items.addAll(itemsCopy); } else{ ArrayList<PhoneBookItem> result = new ArrayList<>(); text = text.toLower...
We can easily separate distribution specific tasks and variables into different dedicated .yml files. Ansible helps us to automatically identify the target hosts distribution via {{ ansible_distribution }} and {{ ansible_distribution_version }}, so we just have to name the distribution dedicated .y...
We can provision remote systems with Ansible. You should have an SSH key-pair and you should take your SSH public key to the machine ~/.ssh/authorized_keys file. The porpuse is you can login without any authorization. Prerequisites: Ansible You need an Inventory file (for ex.: development.ini...
CSRF is an attack which forces end user to execute unwanted actions on a web application in which he/she is currently authenticated. It can happen because cookies are sent with every request to a website - even when those requests come from a different site. We can use csurf module for creating cs...
While redux itself is entirely synchronous, you can use a middleware such as redux-thunk to handle asynchronous actions. A "thunk" is another name for a callback. It is a function that is usually passed as an argument to be called at a later time. To use, apply the middleware to you...
Create a new httpHandler inside your ASP.NET project. Apply the following code (VB) to the handler file: Public Class AttachmentDownload Implements System.Web.IHttpHandler Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest ' pass an ID thr...
As defined in the AngularJS Documentation When a Controller is attached to the DOM via the ng-controller directive, Angular will instantiate a new Controller object, using the specified Controller's constructor function. A new child scope will be created and made available as an injectable par...
The Controller we have made can be instantiated and used using controller as Syntax. That's because we have put variable directly on the controller class and not on the $scope. Using controller as someName is to seperate the controller from $scope itself.So, there is no need of injecting $scope as ...
The way the $scope is injected in the controller's constructor functions is a way to demonstrate and use the basic option of angular dependency injection but is not production ready as it cannot be minified. Thats because the minification system changes the variable names and anguar's dependency i...
Const baseString As String = "Foo Bar" Dim containsBar As Boolean 'Check if baseString contains "bar" (case insensitive) containsBar = InStr(1, baseString, "bar", vbTextCompare) > 0 'containsBar = True 'Check if baseString contains bar (case insensitive) co...
Const baseString As String = "Foo Bar" Dim containsBar As Boolean Dim posB As Long posB = InStr(1, baseString, "B", vbBinaryCompare) 'posB = 5
Const baseString As String = "Foo Bar" Dim containsBar As Boolean 'Find the position of the last "B" Dim posX As Long 'Note the different number and order of the paramters for InStrRev posX = InStrRev(baseString, "X", -1, vbBinaryCompare) 'posX = 0
Const baseString As String = "Foo Bar" Dim leftText As String leftText = Left$(baseString, 3) 'leftText = "Foo"
Const baseString As String = "Foo Bar" Dim rightText As String rightText = Right$(baseString, 3) 'rightText = "Bar"
Const baseString As String = "Foo Bar" 'Get the string starting at character 2 and ending at character 6 Dim midText As String midText = Mid$(baseString, 2, 5) 'midText = "oo Ba"
'Trim the leading and trailing spaces in a string Const paddedText As String = " Foo Bar " Dim trimmedText As String trimmedText = Trim$(paddedText) 'trimmedText = "Foo Bar"
Used by awk to separate records and is output at the end of every print statement. For example: echo "a b c d e f" | awk 'BEGIN {ORS="|"} {print $2, $3}' produces: b c|e f The default value is \n (newline character).

Page 285 of 826