Tutorial by Examples: sin

As this documentation explains, Sometimes a resource file will need to contain a value that can only be supplied at build time. To accomplish this in Maven, put a reference to the property that will contain the value into your resource file using the syntax ${<property name>}. The property ...
The other examples may be the best and most stable way to get a version number into an application statically. This answer proposes an alternative showing how to do it dynamically during runtime, using the maven maven-model library. Add the dependency: <dependency> <groupId>org.apac...
Design Patterns provide solutions to the commonly occurring problems in software design. The design patterns were first introduced by GoF(Gang of Four) where they described the common patterns as problems which occur over and over again and solutions to those problems. Design patterns have four ess...
The following function adds four threads. Three threads compete for the semaphore, which is set to a count of one. A slower thread calls notify_one(), allowing one of the waiting threads to proceed. The result is that s1 immediately starts spinning, causing the Semaphore's usage count to remain be...
using UnityEngine; using UnityEngine.Advertisements; public class Example : MonoBehaviour { #if !UNITY_ADS // If the Ads service is not enabled public string gameId; // Set this value from the inspector public bool enableTestMode = true; // Enable this during development #en...
Using with blocks can accelerate the process of running a macro. Instead writing a range, chart name, worksheet, etc. you can use with-blocks like below; With ActiveChart .Parent.Width = 400 .Parent.Height = 145 .Parent.Top = 77.5 + 165 * step - replacer * 15 .Parent.Left = 5 E...
Dim duplicateFruits = New List(Of String) From {"Grape", "Apple", "Grape", "Apple", "Grape"} 'At this point, duplicateFruits.Length = 5 Dim uniqueFruits = duplicateFruits.Distinct(); 'Now, uniqueFruits.Count() = 2 'If iterated over at this poin...
Here we are having a list of todo items that is passed to the props of our component. Each todo item has a text and id property. Imagine that the id property comes from a backend datastore and is a unique numeric value: todos = [ { id: 1, text: 'value 1' }, { id: 2, te...
If you don't have unique database ids at hand, you could also use the numeric index of your array like this: render() { const { todos } = this.props; return ( <ul> { todos.map((todo, index) => <li key={ `todo-${index}` }> { todo.text } &...
Use Redirect to force users to connect to the secure URL. <VirtualHost *:80> ServerName example.com SSLProxyEngine on Redirect permanent / https://secure_example.com/ </VirtualHost> The rest of the configuration can be put in the ssl virtual host (port 443) since ever...
When designing a linked list, you can avoid all the special-cases (empty list, first node, last node, etc) by using a sentry node. Let's see how that is done: struct Node { Node* next; Node* prev; T data; }; // helper function to link 2 nodes void Link(Node* n1, Node* n2) { ...
A simple SELECT query in Linq static void Main(string[] args) { string[] cars = { "VW Golf", "Opel Astra", "Audi A4", "Ford Focus", "Seat Leon&q...
#pragma strict import UnityEngine.Advertisements; #if !UNITY_ADS // If the Ads service is not enabled public var gameId : String; // Set this value from the inspector public var enableTestMode : boolean = true; // Enable this during development #endif function InitializeAds () // Example o...
Sherlock captures all your crashes and reports them as a notification. When you tap on the notification, it opens up an activity with all the crash details along with Device and Application info How to integrate Sherlock with your application? You just need to add Sherlock as a gradle dependency i...
A for loop iterate through items in an enumeration program EnumLoop; uses TypInfo; type TWeekdays = (Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday); var wd : TWeekdays; begin for wd in TWeekdays do WriteLn(GetEnumName(TypeInfo(TWeekdays), Ord(wd))); ...
You must have 3.2 to be able to upgrade to 3.4. This example assumes you are using apt. sudo service mongod stop sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6 echo "deb [ arch=amd64,arm64 ] http://repo.mongodb.org/apt/ubuntu xeni...
I am using eclipse here, and you need to add below given dependency to your pom.xml 1.) POM.XML <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://m...
dplyr uses Non-Standard Evaluation(NSE), which is why we normally can use the variable names without quotes. However, sometimes during the data pipeline, we need to get our variable names from other sources such as a Shiny selection box. In case of functions like select, we can just use select_ to u...
Using Select2 in a Bootstrap Modal/PopUp If you are using Bootstrap Modal then be sure that Model tabindex=-1 is removed. $('#targetId').select2({ width: '100%', dropdownParent: $("#myModal") })
Suppose you had an array: pair = ['Jack','Jill'] And a method that takes two arguments: def print_pair (a, b) puts "#{a} and #{b} are a good couple!" end You might think you could just pass the array: print_pair(pair) # wrong number of arguments (1 for 2) (ArgumentError) Si...

Page 149 of 161