Tutorial by Examples: a

Add a button you can tap to trigger a crash. Paste this code into your layout where you’d like the button to appear. <Button android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="Force Crash!" android:onClick=&quo...
HTML to NSAttributedString conversion Code :- //HTML String NSString *htmlString=[[NSString alloc]initWithFormat:@"<!DOCTYPE html><html><body><h1>My First Heading</h1><p>My first paragraph.</p></body></html>"]; //Converting HTML s...
Using the PhantomData type like this allows you to use a specific type without needing it to be part of the Struct. use std::marker::PhantomData; struct Authenticator<T: GetInstance> { _marker: PhantomData<*const T>, // Using `*const T` indicates that we do not own a T } imp...
In SuiteScript 1.0, use nlobjContext.getRemainingUsage() to retrieve the remaining units. An nlobjContext reference is retrieved using the global nlapiGetContext function. // 1.0 var context = nlapiGetContext(); nlapiLogExecution("DEBUG", "Governance Monitoring", "Remai...
Typically trying to extend the parent like so: .parent { style: value; @extend &; } Will result in an error, stating that the parent cannot be extended. This makes sense, but there's a workaround. Simply store the parent selector in a variable. .parent { $parent: &; style...
let inline getLength s = (^a: (member Length: _) s) //usage: getLength "Hello World" // or "Hello World" |> getLength // returns 11
// Record type Ribbon = {Length:int} // Class type Line(len:int) = member x.Length = len type IHaveALength = abstract Length:int let inline getLength s = (^a: (member Length: _) s) let ribbon = {Length=1} let line = Line(3) let someLengthImplementer = { new IHaveALength wit...
Bucket Sort is a sorting algorithm in which elements of input array are distributed in buckets. After distributing all the elements, buckets are sorted individually by another sorting algorithm. Sometimes it is also sorted by recursive method. Pseudo code for Bucket Sort Let n be the length of t...
C Merge Sort int merge(int arr[],int l,int m,int h) { int arr1[10],arr2[10]; // Two temporary arrays to hold the two arrays to be merged int n1,n2,i,j,k; n1=m-l+1; n2=h-m; for(i=0; i<n1; i++) arr1[i]=arr[l+i]; for(j=0; j<n2; j++) arr2[j]=arr[m+j+1]; arr...
Quicksort is a sorting algorithm that picks an element ("the pivot") and reorders the array forming two partitions such that all elements less than the pivot come before it and all elements greater come after. The algorithm is then applied recursively to the partitions until the list is so...
One of the more useful things about const correctness is that it serves as a way of documenting code, providing certain guarantees to the programmer and other users. These guarantees are enforced by the compiler due to constness, with a lack of constness in turn indicating that code doesn't provide...
use std::ops::Drop; struct Foo(usize); impl Drop for Foo { fn drop(&mut self) { println!("I had a {}", self.0); } }
use std::ops::Drop; #[derive(Debug)] struct Bar(i32); impl Bar { fn get<'a>(&'a mut self) -> Foo<'a> { let temp = self.0; // Since we will also capture `self` we.. // ..will have to copy the value out first Foo(self, temp) ...
In some scenarios, we might want to narrow down the results being shown by PlaceAutocomplete to a specific country or maybe to show only Regions. This can be achieved by setting an AutocompleteFilter on the intent. For example, if I want to look only for places of type REGION and only belonging to I...
<?php $parameters = array('path' => '/test.txt'); $headers = array('Authorization: Bearer <ACCESS_TOKEN>', 'Content-Type: application/json'); $curlOptions = array( CURLOPT_HTTPHEADER => $headers, CURLOPT_POST => true, CURLOPT_PO...
The puppet agent is a service that runs on the servers. Once the service is started, The agent will be triggered on background every 30 min (by default). The agent have 2 main usages: Send server`s facts to the puppet master Receive catalog from the puppet master ans apply it
No Java variable represents an object. String foo; // NOT AN OBJECT Neither does any Java array contain objects. String bar[] = new String[100]; // No member is an object. If you mistakenly think of variables as objects, the actual behavior of the Java language will surprise you. For...
Another way to .Install installers is by using Castle's FromAssembly class. It gives an array of functions to locate installers in the loaded assemblies. For example: //Will locate IInstallers in the current assembly that is calling the method container.Install(FromAssembly.This()); For more d...
Castle enables to register components also via XML Registration. //To install from the app/web.config container.Install(Configuration.FromAppConfig()); //To install from an xml file Configuration.FromXmlFile("relative_path_to_file.xml"); Read Castle's documentation for "What ...
It is possible to run windeployqt and macdeployqt from CMake, but first the path to the executables must be found: # Retrieve the absolute path to qmake and then use that path to find # the binaries get_target_property(_qmake_executable Qt5::qmake IMPORTED_LOCATION) get_filename_component(_qt_bi...

Page 789 of 1099