Tutorial by Examples

C++14 C++14 allows to use auto in lambda argument auto print = [](const auto& arg) { std::cout << arg << std::endl; }; print(42); print("hello world"); That lambda is mostly equivalent to struct lambda { template <typename T> auto operator ()(const...
Following are the page life cycle events: PreInit - PreInit is the first event in page life cycle. It checks the IsPostBack property and determines whether the page is a postback. It sets the themes and master pages, creates dynamic controls, and gets and sets profile property values. This event ca...
using System; namespace myProject { public partial class WebForm1 : System.Web.UI.Page { public string PageSteps = string.Empty; //Raised after the start stage is complete and before the initialization stage begins. protected void Page_PreInit(object sender...
Asp.net is web application framework developed by Microsoft to build dynamic data-driven Web Application and WebServices. Asp.net is basically a subset of wider .NET framework. A framework is nothing but a collection of classes. In .NET Framework you can build Console application. Web Applicatio...
This is how the right fold is implemented: foldr :: (a -> b -> b) -> b -> [a] -> b foldr f z [] = z foldr f z (x:xs) = f x (foldr f z xs) -- = x `f` foldr f z xs The right fold, foldr, associates to the right. That is: foldr (+) 0 [1, 2, 3] -- is equivalen...
To create a UDF, we need to extend UDF (org.apache.hadoop.hive.ql.exec.UDF) class and implement evaluate method. Once UDF is complied and JAR is build, we need to add jar to hive context to create a temporary/permanent function. import org.apache.hadoop.hive.ql.exec.UDF; class UDFExample ex...
Current date and time can be found with getCurrentTime: import Data.Time print =<< getCurrentTime -- 2016-08-02 12:05:08.937169 UTC Alternatively, just the date is returned by fromGregorian: fromGregorian 1984 11 17 -- yields a Day
Given a Day, we can perform simple arithmetic and comparisons, such as adding: import Data.Time addDays 1 (fromGregorian 2000 1 1) -- 2000-01-02 addDays 1 (fromGregorian 2000 12 31) -- 2001-01-01 Subtract: addDays (-1) (fromGregorian 2000 1 1) -- 1999-12-31 addDays (-1) (fromGregorian...
[footag foo="value of 1" attribute-2="value of 2"] In wordpress admin we use pre defined shortcodes by writing the shortcode name inside square brackets and optionally adding attributes to it separating by space.
function footag_func( $atts ) { return "foo = {$atts['foo']}"; } add_shortcode( 'footag', 'footag_func' ); In plugins we can add shortcodes using the add_shortcode function. The shortcode can be used in any Wordpress page or post just by enclosing it in square brackets. [footag...
<?php echo do_shortcode("[footag foo='Hi! I am a foo output']"); ?> To print a shortcode using php use the do_shortcode function and echo the returned value.
Like Getting a result from another Activity you need to call the Fragment's method startActivityForResult(Intent intent, int requestCode). note that you should not call getActivity().startActivityForResult() as this will take the result back to the Fragment's parent Activity. Receiving the result c...
Here a simple portable way to get the current device family: /// <summary> /// All the device families /// </summary> public enum DeviceFamily { Desktop, Mobile, Iot, Xbox, } /// <summary> /// The helper to get the current device family /// </summ...
Depending on the device/release version of the system, some API may not be available. You can check which contract is supported by using ApiInformation.IsApiContractPresent() For example, this will return true on phone devices and false on the others ApiInformation.IsApiContractPresent(typeof(Cal...
This program draws some shapes and 'hello world!' and let an image go to every corner of the window. the complete code: import pygame,sys from pygame.locals import * pygame.init() FPS = 30 #frames per second setting fpsClock = pygame.time.Clock() #set up the window screen = pygame.disp...
enum SomeEnum { A, B } let enumValues:Array<string>= []; for(let value in SomeEnum) { if(typeof SomeEnum[value] === 'number') { enumValues.push(value); } } enumValues.forEach(v=> console.log(v)) //A //B
The IsHighResolution property indicates whether the timer is based on a high-resolution performance counter or based on the DateTime class. This field is read-only. // Display the timer frequency and resolution. if (Stopwatch.IsHighResolution) { Console.WriteLine("Operations timed ...
This code requires that you use the PDFlib library for it to function properly. <?php $pdf = pdf_new(); //initialize new object pdf_begin_document($pdf); //create new blank PDF pdf_set_info($pdf, "Author", "John Doe"); //Set info about your PDF pdf_set_info($pd...
The tabular environment is the most basic way to create a table in LaTeX and doesn't require any other packages. \begin{tabular}{|lcr||} left aligned column & center column & right column \\ \hline text & text & text \\ text & text & text \\ \end{tabular} T...
The register sp is used as stack pointer, pointing to the last stored value into stack ("top" of stack). So EX (sp),hl will exchange value of hl with the value on top of stack. Contrary to "top" word, the stack grows in memory by decreasing the sp, and releases ("pops"...

Page 679 of 1336