Tutorial by Examples: code

Xcode have ability to run any script with hotkey. Here is example how to assign hotkey ⌘+⌥+⌃+⇧+T to open Terminal app in current project folder. Create bash script and save it in some folder #!/bin/bash # Project Name: $XcodeProject # Project Dir: $XcodeProjectPath # Workspace Dir: $X...
constexpr const size_t addressSize = sizeof(sockaddr_in); constexpr const uint16_t defaultPort = 80; // The port you want to use int serverSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); sockaddr_in serverAddress, clientAddress; memset(&serverAddress, 0, addressSize); serverAddress....
2xx Success 200 OK - Standard response for successful HTTP requests. 201 Created - The request has been fulfilled, resulting in the creation of a new resource. 204 No Content - The server successfully processed the request and is not returning any content. 3xx Redirection 304 Not Modified...
Prerequiste steps: Get dotnet core for your platform: Dotnet Core Follow instructions and make sure dotnet core is working Get Visual Studio Code for your platform: VS Code Launch Visual Studio Code (VS code) and install the C# extension then reload Create self hosted NancyFx project: ...
Once your test application is ready you can connect it with code for which you want to write unit tests. Either you have you code in PCL, or in UWP app project (I assume that you applied MVVM pattern) just add reference to it in Test Application project: Now you have access to all your code from...
Within the CodeIgniter, there are two main directories to worry about: system and application. The system folder contains the core guts of CodeIgniter. The application folder will contain all of the code specific to your application, including models, controllers, views and other relevant libraries...
Here are the steps to generate test skeleton for existing code: Open Eclipse, and choose the project you want to create test cases for In the Package Explorer, select the java class you want to generate the Junit test for Go to File -> New -> Junit Test Cases Change the Source folder to ...
The Java Native Interface (JNI) allows you to call Java functions from native code. Here is a simple example of how to do it: Java code: package com.example.jniexample; public class JNITest { public static int getAnswer(bool) { return 42; } } Native code: int getTheAnswer(...
private static void saveItem(List<EventTracker> items) { List<WriteRequest> wrList = new ArrayList<>(); try { for (EventTracker item : items) { WriteRequest wreqItem; wreqItem = getWriteRequest(item); wrList.add(wreqItem);...
Bullet This one particularly blew my mind. The bullet gem helps you kill all the N+1 queries, as well as unnecessarily eager loaded relations. Once you install it and start visiting various routes in development, alert boxes with warnings indicating database queries that need to be optimized will p...
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder() .detectDiskWrites() .penaltyLog() //Logs a message to LogCat .build())
StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder() .detectActivityLeaks() .detectLeakedClosableObjects() .penaltyLog() .build());
In order to create an use a custome tag,we need to follow couple of steps: Create a tag file,defining the attributes used by it and any variables which will be used by the tag a. The attributes need to have a name,their type and and required field with a boolean value b. The variables will be...
Once the provisioning profiles are all set, next step in the process of submitting the app is to archive your code. From the dropdown of devices and simulators select option "Generic iOS device". Then, under "Product" menu select option "Archive". In case where the s...
Let's say that inside a resources file, you had a file called /icons/ok.png The full url of this file within code is qrc:/icons/ok.png. In most cases, this can be shortened to :/icons/ok.png For example, if you wanted to create a QIcon and set it as the icon of a button from that file, you could u...
Private Const HashTypeMD5 As String = "MD5" ' https://msdn.microsoft.com/en-us/library/system.security.cryptography.md5cryptoserviceprovider(v=vs.110).aspx Private Const HashTypeSHA1 As String = "SHA1" ' https://msdn.microsoft.com/en-us/library/system.security.cryptography.sha1c...
There are several ways to mark a comment block as a detailed description, so that this comment block is parsed by Doxygen and added as a description of the following code item to the documentation. The first and most common one are C style comments with an extra asterisk in the comment start sequenc...
Question: What is the output of code below and why? setTimeout(function() { console.log("A"); }, 1000); setTimeout(function() { console.log("B"); }, 0); getDataFromDatabase(function(err, data) { console.log("C"); setTimeout(function() { ...
Example Data Please try to provide a minimal example input data in a format that can be directly used by the answers without tedious and time consuming parsing for example input file or local collection with all code required to create distributed data structures. When applicable always include ty...
package main import ( "encoding/gob" "os" ) type User struct { Username string Password string } func main() { user := User{ "zola", "supersecretpassword", } file, _ := os.Create("user.go...

Page 16 of 21