Tutorial by Examples: st

The jQuery API may be extended by adding to its prototype. For example, the existing API already has many functions available such as .hide(), .fadeIn(), .hasClass(), etc. The jQuery prototype is exposed through $.fn, the source code contains the line jQuery.fn = jQuery.prototype Adding functio...
View jsFiddle: https://jsfiddle.net/HimmatChahal/jb5trg67/ Copy + Pasteable code below: <html> <body> <h1>This will fade in at 60 frames per second (or as close to possible as your hardware allows)</h1> <script> // Fad...
6 An array can be destructured when being assigned to a new variable. const triangle = [3, 4, 5]; const [length, height, hypotenuse] = triangle; length === 3; // → true height === 4; // → true hypotneuse === 5; // → true Elements can be skipped const [,b,,c] = [1, 2, 3, 4]; co...
Omitting the return statement in a function which is has a return type that is not void is undefined behavior. int function() { // Missing return statement } int main() { function(); //Undefined Behavior } Most modern day compilers emit a warning at compile time for this kind o...
C++11 char *str = "hello world"; str[0] = 'H'; "hello world" is a string literal, so modifying it gives undefined behaviour. The initialisation of str in the above example was formally deprecated (scheduled for removal from a future version of the standard) in C++03. A num...
Events that work with most form elements (e.g., change, keydown, keyup, keypress) do not work with contenteditable. Instead, you can listen to changes of contenteditable contents with the input event. Assuming contenteditableHtmlElement is a JS DOM object that is contenteditable: contenteditableH...
State in React components is essential to manage and communicate data in your application. It is represented as a JavaScript object and has component level scope, it can be thought of as the private data of your component. In the example below we are defining some initial state in the constructor f...
The primary way that you make UI updates to your React applications is through a call to the setState() function. This function will perform a shallow merge between the new state that you provide and the previous state, and will trigger a re-render of your component and all decedents. Parameters ...
pip may be used to install BeautifulSoup. To install Version 4 of BeautifulSoup, run the command: pip install beautifulsoup4 Be aware that the package name is beautifulsoup4 instead of beautifulsoup, the latter name stands for old release, see old beautifulsoup
The default property getters and setters can be overridden: @interface TestClass @property NSString *someString; @end @implementation TestClass // override the setter to print a message - (void)setSomeString:(NSString *)newString { NSLog(@"Setting someString to %@", newS...
The syntax for Java generics bounded wildcards, representing the unknown type by ? is: ? extends T represents an upper bounded wildcard. The unknown type represents a type that must be a subtype of T, or type T itself. ? super T represents a lower bounded wildcard. The unknown type repres...
import Alamofire Alamofire.request(.GET, "https://httpbin.org/get")
public string Remove() { string input = "Hello./!"; return Regex.Replace(input, "[^a-zA-Z0-9]", ""); }
Extension methods can be used for writing strongly typed wrappers for dictionary-like objects. For example a cache, HttpContext.Items at cetera... public static class CacheExtensions { public static void SetUserInfo(this Cache cache, UserInfo data) => cache["UserInfo"] ...
In Swift, structures use a simple “dot syntax” to access their members. For example: struct DeliveryRange { var range: Double let center: Location } let storeLocation = Location(latitude: 44.9871, longitude: -93.2758) var pizzaRange = DeliveryRange(range: 200...
Installing OPAM OPAM is a package manager for OCaml. It builds and manages compiler versions and OCaml libraries for you easily. The easiest way to install OPAM on your operating system is to use a package manager for your system. e.g apt-get, yum or homebrew. Mac OSX Installation Instructions U...
public static Unsafe getUnsafe() { try { Field unsafe = Unsafe.class.getDeclaredField("theUnsafe"); unsafe.setAccessible(true); return (Unsafe) unsafe.get(null); } catch (IllegalAccessException e) { // Handle } catch (IllegalArgumentExcept...
public class UnsafeLoader { public static Unsafe loadUnsafe() { return Unsafe.getUnsafe(); } } While this example will compile, it is likely to fail at runtime unless the Unsafe class was loaded with the primary classloader. To ensure that happens the JVM should be loaded with...
MySQL3.19 DROP TABLE IF EXISTS MyTable; PostgreSQL8.x DROP TABLE IF EXISTS MyTable; SQL Server2005 If Exists(Select * From Information_Schema.Tables Where Table_Schema = 'dbo' And Table_Name = 'MyTable') Drop Table dbo.MyTable SQLite3.0 DROP TABLE IF EXI...
Microsoft describes 3 ways of installing WinDbg: as part of the WDK (Windows Driver Kit) as part of the SDK (Software Development Kit) with the installer of the SDK and deselecting everything else but "Debugging Tools for Windows" To get the installer, visit Download the WDK, WinDb...

Page 61 of 369