Tutorial by Examples: code

In general, UWP is used for making a single application that runs on Windows 10 across many different devices. However, it is also possible to make code tailored to specific devices. You can achieve this in several different ways. Different XAML Layout If you want to use a specific layout on for a...
Using the document-ready event can have small performance drawbacks, with delayed execution of up to ~300ms. Sometimes the same behavior can be achieved by execution of code just before the closing </body> tag: <body> <span id="greeting"></span> world! <sc...
This error occurs when tables are not adequately structured to handle the speedy lookup verification of Foreign Key (FK) requirements that the developer is mandating. CREATE TABLE `gtType` ( `type` char(2) NOT NULL, `description` varchar(1000) NOT NULL, PRIMARY KEY (`type`) ) ENGINE=InnoD...
While server side-code can run with elevated privileges, there is not an equivalent method to elevate privileges in client-side code (for obvious security reasons). As an alternative, you can specify credentials to emulate the access of a specific user or service account. To specify credentials, bu...
import java.util.ArrayList; import java.util.List; import static java.lang.System.out; public class PolymorphismDemo { public static void main(String[] args) { List<FlyingMachine> machines = new ArrayList<FlyingMachine>(); machines.add(new FlyingMachine())...
To check if a required gem is installed, from within your code, you can use the following (using nokogiri as an example): begin found_gem = Gem::Specification.find_by_name('nokogiri') require 'nokogiri' .... <the rest of your code> rescue Gem::LoadError end However, this can ...
Returns the integer value representing the Unicode value of the first character of the input expression. Parameters: Unicode character expression. Any valid nchar or nvarchar expression. SELECT UNICODE(N'Ɛ') -- Returns 400 DECLARE @Unicode nvarchar(11) = N'Ɛ is a char' SELECT UNICODE(@Uni...
Transact-SQL supports two forms of comment writing. Comments are ignored by the database engine, and are meant for people to read. Comments are preceded by -- and are ignored until a new line is encountered: -- This is a comment SELECT * FROM MyTable -- This is another comment WHERE Id = 1; ...
.Rprofile is a file containing R code that is executed when you launch R from the directory containing the .Rprofile file. The similarly named Rprofile.site, located in R's home directory, is executed by default every time you load R from any directory. Rprofile.site and to a greater extend .Rprofil...
HVFL is a language designed to constrain UI elements in a simple and quick fashion. Generally, VFL has an advantage over traditional UI customization in the Interface Builder because it's much more readable, accessible and compact. Here's an example of VFL, in which three UIViews are constrained f...
Knitr is an R package that allows us to intermingle R code with LaTeX code. One way to achieve this is external code chunks. External code chunks allow us to develop/test R Scripts in an R development environment and then include the results in a report. It is a powerful organizational technique....
First thing to do is enable the mod rewrite on wamp go to Apache modules and scroll down the list If not showing tick enable it and then restart all servers. Linux users can also use below terminal command to enable rewrite module sudo a2enmod rewrite Then restart apache using: sudo service...
Scope guards allow executing statements at certain conditions if the current block is left. import core.stdc.stdlib; void main() { int* p = cast(int*)malloc(int.sizeof); scope(exit) free(p); }
Proper indentation gives not only the aesthetic look but also increases the readability of the code. For example, consider the following code: %no need to understand the code, just give it a look n = 2; bf = false; while n>1 for ii = 1:n for jj = 1:n if ii+jj>30 bf = true; break end...
The Python interpreter compiles code to bytecode before executing it on the Python's virtual machine (see also What is python bytecode?. Here's how to view the bytecode of a Python function import dis def fib(n): if n <= 2: return 1 return fib(n-1) + fib(n-2) # Display the disas...
CPython allows access to the code object for a function object. The __code__object contains the raw bytecode (co_code) of the function as well as other information such as constants and variable names. def fib(n): if n <= 2: return 1 return fib(n-1) + fib(n-2) dir(fib.__code__) de...
In this example, we'll be accessing three different resources from Code-behind, each stored in a different scope App.xaml: <Application x:Class="WpfSamples.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http:/...
The attribute status_code contains the status code of the response good_req = requests.get('https://api.github.com/events') code_200 = good_req.status_code notfound_req = requests.get('https://api.github.com/not_found') code_404 = notfound_req.status_code requests.codes.__dict__ will provid...
You can use the following code for going back and forward. if (!function_exists('codepoint_encode')) { function codepoint_encode($str) { return substr(json_encode($str), 1, -1); } } if (!function_exists('codepoint_decode')) { function codepoint_decode($str) { re...
You can use the following code for going back and forward. if (!function_exists('mb_internal_encoding')) { function mb_internal_encoding($encoding = NULL) { return ($from_encoding === NULL) ? iconv_get_encoding() : iconv_set_encoding($encoding); } } if (!function_exists('mb_c...

Page 7 of 21