Tutorial by Examples: ce

Some parsers allow code to be designated by adding three backticks before and after a section of code. ``` <p><em>This</em> is an HTML example!</p> ``` Optionally, many parsers allow adding syntax highlighting by specifying the code's language immediately after the firs...
Reflection is often used as part of software testing, such as for the runtime creation/instantiation of mock objects. It's also great for inspecting the state of an object at any given point in time. Here's an example of using Reflection in a unit test to verify a protected class member contains the...
It's an emulation of classical inheritance using prototypical inheritance which shows how powerful prototypes are. It was made to make the language more attractive to programmers coming from other languages. 6 IMPORTANT NOTE: Since ES6 it doesn't make sense to use pseudo-calssical inheritance sinc...
5 Treat a property as a combination of two functions, one to get the value from it, and another one to set the value in it. The get property of the property descriptor is a function that will be called to retrieve the value from the property. The set property is also a function, it will be call...
The following queries will return a list of all Stored Procedures in the database, with basic information about each Stored Procedure: SQL Server 2005 SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_TYPE = 'PROCEDURE' The ROUTINE_NAME, ROUTINE_SCHEMA and ROUTINE_DEFINITION columns are...
In this type of image addition, one image can be used several times without duplicating its URL, making it a good choice when using one image multiple times in a document. Markdown Source Picture of Duck: ![Duck][1] Same picture of Duck: ![Same Duck][1] [1]: http://i.stack.imgur.com/uk...
You cannot pass a reference (or const reference) directly to a thread because std::thread will copy/move them. Instead, use std::reference_wrapper: void foo(int& b) { b = 10; } int a = 1; std::thread thread{ foo, std::ref(a) }; //'a' is now really passed as reference thread.join()...
The STUFF() function inserts a string into another string by first deleting a specified number of characters. The following example, deletes "Svr" and replaces it with "Server". This happens by specifying the start_position and length of the replacement. SELECT STUFF('SQL Svr D...
- (void)reachabilityChanged:(NSNotification *)note { Reachability* reachability = [note object]; NetworkStatus netStatus = [reachability currentReachabilityStatus]; switch (netStatus) { case NotReachable: NSLog(@"Network unavailable"); br...
django-admin is a command line tool that ships with Django. It comes with several useful commands for getting started with and managing a Django project. The command is the same as ./manage.py , with the difference that you don't need to be in the project directory. The DJANGO_SETTINGS_MODULE envir...
This data is collected by the http_unit and scollector. It warns when an alert is going to expire within a certain amount of days, and then goes critical if the cert has passed the expiration date. This follows the recommended default of warn and crit usage in Bosun (warn: something is going to fail...
public string Check() { string input = "Hello World!"; string pattern = @"W.rld"; // Hello Stack Overflow! return Regex.Replace(input, pattern, "Stack Overflow"); }
Git lets you use non-git commands and full sh shell syntax in your aliases if you prefix them with !. In your ~/.gitconfig file: [alias] temp = !git add -A && git commit -m "Temp" The fact that full shell syntax is available in these prefixed aliases also means you can us...
On Windows you can install Scollector as a service using the -winsvc="install" flag. On Mac and Linux you must manually create a service or init script. For example here is a basic systemd unit file: #Scollector unit file saved to /etc/systemd/system/scollector.service [Unit] Descriptio...
Scollector will monitor Linux processes specified in the configuration file. [[Process]] Command = "/opt/bosun/bosun" Name = "bosun" [[Process]] Command = "ruby" Name = "puppet-agent" Args = "puppet" [[Process]] Command = &qu...
Scollector will monitor any Windows processes or services specified in the configuration file. [[Process]] Name = "^scollector" [[Process]] Name = "^chrome" [[Process]] Name = "^(MSSQLSERVER|SQLSERVERAGENT)$"
The following Go file can be compiled into a continuous external collector that will query a MSSQL server database that uses the StackExchange.Exceptional schema. It will query multiple servers/databases for all exceptions since UTC 00:00 to convert the raw entries into a counter. It also uses the b...
Scollector can also monitor any Windows processes using the .NET framework. If no ProcessDotNet settings are specified it will default to just monitoring the w3wp worker processes for IIS. You can specify which applications to monitor in the configuration file. [[ProcessDotNet]] Name = "^w3...
In classes, super.foo() will look in superclasses only. If you want to call a default implementation from a superinterface, you need to qualify super with the interface name: Fooable.super.foo(). public interface Fooable { default int foo() {return 3;} } public class A extends Object impl...
SQL Server 2008 WITH XMLNAMESPACES ( DEFAULT 'http://www.w3.org/2000/svg', 'http://www.w3.org/1999/xlink' AS xlink ) SELECT 'example.jpg' AS 'image/@xlink:href', '50px' AS 'image/@width', '50px' AS 'image/@height' FOR XML PATH('svg') <svg xmlns:xlink="http:...

Page 10 of 134