Tutorial by Examples: c

The canonical way of writing code inside documentation is with the {@code } construct. If you have multiline code wrap inside <pre></pre>. /** * The Class TestUtils. * <p> * This is an {@code inline("code example")}. * <p> * You should wrap it in pre tags...
To use opacity in all versions of IE, the order is: .transparent-element { /* for IE 8 & 9 */ -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=60)"; // IE8 /* works in IE 8 & 9 too, but also 5, 6, 7 */ filter: alpha(opacity=60); // IE 5-7 /* Modern Browse...
Newtonsoft's Json.NET allows you to bind json dynamically (using ExpandoObject / Dynamic objects) without the need to create the type explicitly. Serialization dynamic jsonObject = new ExpandoObject(); jsonObject.Title = "Merchent of Venice"; jsonObject.Author = "William Shakes...
This command has several related yet distinct forms. del v If v is a variable, the command del v removes the variable from its scope. For example: x = 5 print(x) # out: 5 del x print(x) # NameError: name 'f' is not defined Note that del is a binding occurence, which means that unless expl...
If you want to log exceptions you can and should make use of the logging.exception(msg) method: >>> import logging >>> logging.basicConfig() >>> try: ... raise Exception('foo') ... except: ... logging.exception('bar') ... ERROR:root:bar Traceback (most rec...
This simple example shows how to start multiple threads in Java. Note that the threads are not guaranteed to execute in order, and the execution ordering may vary for each run. public class HelloMultithreading { public static void main(String[] args) { for (int i = 0; i < 10; i...
Prerequisites JDK 7 or Higher (Recommended: JDK 8+) Adding Bukkit as a Dependency The simplest method to add the Bukkit API to your project is to download the Bukkit.jar directly from the Spigot Repository and add it to your project's classpath. Legacy versions of Bukkit can be found at the...
We can create a better mapper classes with extension methods, Suppose if i have some DTO classes like public class UserDTO { public AddressDTO Address { get; set; } } public class AddressDTO { public string Name { get; set; } } and i need to map to corresponding v...
cts:search( fn:doc(), cts:word-query("marklogic"))
This can be done in the following two ways - cts:search( fn:collection("first-collection"), cts:word-query("marklogic")) In this, the scope is changed from all the documents to documents in collection "first-collection" only. In the second approach, use ...
This query returns all the documents with element "company" and its value as "marklogic" cts:element-value-query(xs:QName('company'), 'marklogic'))
The following query returns the documents which have an element named "company" - cts:element-value-query( xs:QName('company'), '*', ("wildcarded"))) The following query returns the documents which have an element named "company" with an attribute named "name&...
The :last-of-type selects the element that is the last child, of a particular type, of its parent. In the example below, the css selects the last paragraph and the last heading h1. p:last-of-type { background: #C5CAE9; } h1:last-of-type { background: #CDDC39; } <div class="c...
Create a new file in the application/config folder named email.php Set the parameters for sending email. These will load when you send your email. $config['newline'] = "\r\n"; //You must use double quotes on this one $config['protocol'] = 'smtp'; $config['smtp_host'] = 'ssl://smtp.gmai...
$this->email->from('[email protected]', 'Tom Webmaster'); $this->email->to('[email protected]', 'Freddie Fakeperson'); $this->email->subject('Your Account Is Active'); $this->email->message('Welcome to our new site!'); In the 'from' method, the first parameter is the...
Error handling in AppleScript uses try on error. The code which may throw an error goes in the try block and any error handling code is in the on error block. The on error block is closed using end try. foo is not defined, so throws an error. When an error occurs, the dialog is displayed. try ...
using System; using System.Collections.Generic; using System.Linq; using System.Numerics; // also add reference to System.Numberics namespace ConsoleApplication33 { class Program { private static IEnumerable<BigInteger> Fibonacci() { BigInteger p...
This example shows how to update a UI component from a background thread by using a SynchronizationContext void Button_Click(object sender, EventArgs args) { SynchronizationContext context = SynchronizationContext.Current; Task.Run(() => { for(int i = 0; i < 10; i++) ...
To Illustrate the MERGE Statement, consider the following two tables - dbo.Product : This table contains information about the product that company is currently selling dbo.ProductNew: This table contains information about the product that the company will sell in the future. The foll...
Use EXCEPT to prevent updates to unchanged records MERGE TargetTable targ USING SourceTable AS src ON src.id = targ.id WHEN MATCHED AND EXISTS ( SELECT src.field EXCEPT SELECT targ.field ) THEN UPDATE SET field = src.field WHEN...

Page 466 of 826