Tutorial by Examples: sin

The behaviour of virtual functions in constructors and destructors is often confusing when first encountered. #include <iostream> using namespace std; class base { public: base() { f("base constructor"); } ~base() { f("base destructor"); } virtual co...
You can set a ColdFusion variable using the <cfset> tag. To output the variable, you need to surround the variable name with hash # symbols and enclose it within <cfoutput> tags. <cfset variablename="World!"> <cfoutput> Hello #variablename# </cfoutput>...
The <cfparam> tag creates a variable if it does not already exist. You can assign a default value using the default attribute. This can be used if you want to create a variable, but don't want to overwrite it if it has been previously created elsewhere. Here the variable hasn't been set previ...
We can draw a connection between the Haskell types and the natural numbers. This connection can be made assigning to every type the number of inhabitants it has. Finite union types For finite types, it suffices to see that we can assign a natural type to every number, based in the number of constr...
SoundEffect.Play() plays the sound effect in a "fire-and-forget" fashion. The sound plays once and its lifetime is managed by the framework. You are not able to change the properties (volume, pan, pitch) of the sound during playback, loop it, position it in 3D or pause it. You can hold a ...
The first time a user runs a project's gradlew, it should be realized that it will do two key things: Check to see if the version of the gradle used by the wrapper is already in ~/.gradle/wrapper/dists If not, download the archive of the version from the internet If you're in an environment t...
In this question, @Viclib asked about using rewrite rules to exploit typeclass laws to eliminate some overloaded function calls: Mind the following class: class ListIsomorphic l where toList :: l a -> [a] fromList :: [a] -> l a I also demand that toList . fromList == id. H...
The div is a block-level element, i.e it occupies the whole of the page width and the siblings are place one below the other irrespective of their width. <div> <p>This is DIV 1</p> </div> <div> <p>This is DIV 2</p> </div> The output of...
1. Switch to a frame by Index. Here we are switching to index 1. Index refers to the order of frames on the page. This should be used as a last resort, as frame id or names are much more reliable. driver.SwitchTo().Frame(1); 2. Switch to a frame by Name driver.SwitchTo().Frame("Name_Of_Fr...
Some devices connected through a serial port send data to your program at a constant rate (streaming data) or send data at unpredictable intervals. You can configure the serial port to execute a function automatically to handle data whenever it arrives. This is called the "callback function&quo...
Custom Setting Custom Setting Field Custom Setting Field Value When the field is checked the validation rule will be disabled, for the running user or in this example, their profile - The rule can also be disabled for a whole Salesforce org - Validation Rule AND( /* the below is the...
Explanation In this example a simple Trigger has been created to change the Close Date of an Opportunity, that's about to be inserted or updated, to a date 10 days in the future. The Apex Controller custom setting's checkbox field enables the code to be disabled at the user / profile / org level. ...
Sometimes we need to accept route params as well as access the HTTP Request params. We can still type hint the Requests class in laravel controller and achieve that as explained below E.g. We have a route that update a certain post like this (passing post id i route ) Route::put('post/{id}', 'Post...
Selecting all accounts that have open opportunity records under them SELECT Id, Name FROM Account WHERE AccountId IN (SELECT Id FROM Opportunity WHERE IsClosed = false)
Resolving scoped services during application startup can be difficult, because there is no request and hence no scoped service. Resolving a scoped service during application startup via app.ApplicationServices.GetService<AppDbContext>() can cause issues, because it will be created in the sc...
from bs4 import BeautifulSoup import requests # Use the requests module to obtain a page res = requests.get('https://www.codechef.com/problems/easy') # Create a BeautifulSoup object page = BeautifulSoup(res.text, 'lxml') # the text field contains the source of the page # Now use a CSS ...
There are 4 types of associations(relationships) we can define in CakePHP class PostsTable extends Table { public function initialize(array $config) { // table initialization code should be here $this->belongsTo('Authors', [ 'className' => 'Authors', ...
A Threadpool has a Queue of tasks, of which each will be executed on one these Threads. The following example shows how to add two int arrays using a Threadpool. Java SE 8 int[] firstArray = { 2, 4, 6, 8 }; int[] secondArray = { 1, 3, 5, 7 }; int[] result = { 0, 0, 0, 0 }; ExecutorService po...
Singletons are a frequently used design pattern which consists of a single instance of a class that is shared throughout a program. In the following example, we create a static property that holds an instance of the Foo class. Remember that a static property is shared between all objects of a class...
Using git show we can view a single commit git show 48c83b3 git show 48c83b3690dfc7b0e622fd220f8f37c26a77c934 Example commit 48c83b3690dfc7b0e622fd220f8f37c26a77c934 Author: Matt Clark <[email protected]> Date: Wed May 4 18:26:40 2016 -0400 The commit message will be show...

Page 82 of 161