Tutorial by Examples: c

First import #import <QuartzCore/QuartzCore.h> into your ViewController class. Here is how I set my view in code UIView *view1=[[UIView alloc]init]; view1.backgroundColor=[UIColor colorWithRed:255/255.0 green:193/255.0 blue:72/255.0 alpha:1.0]; CGRect view1Frame = view1.frame; view1Frame....
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...
// 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; #[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...
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...
Background: The Household entity includes a set of options, each of which is an entity that is managed in an admin backend. Each option has a boolean enabled flag. If a previously enabled option is set to disabled it will need to be persisted in later Household edits, but cannot be edited away. T...
->add('housing', EntityType::class, array( 'class' => 'AppBundle:Housing', 'choice_label' => 'housing', 'placeholder' => '', 'attr' => (in_array('Housing', $options['disabledOptions']) ? ['disabled' => 'disabl...
In a simple case statement, one value or variable is checked against multiple possible answers. The code below is an example of a simple case statement: SELECT CASE DATEPART(WEEKDAY, GETDATE()) WHEN 1 THEN 'Sunday' WHEN 2 THEN 'Monday' WHEN 3 THEN 'Tuesday' WHEN 4 THEN 'Wednes...
# encode/decode UTF-8 for files and standard input/output use open qw( :encoding(UTF-8) :std ); This pragma changes the default mode of reading and writing text ( files, standard input, standard output, and standard error ) to UTF-8, which is typically what you want when writing new application...
boost::replace_all(): #include <iostream> #include <string> #include <boost/algorithm/string.hpp> using namespace std; int main() { // String to replace characters in string str = "Darn you, Darn you to the 5th power!!!"; // Replace "Da...

Page 602 of 826