Tutorial by Examples

When a method is defined to be a macro, the compiler takes the code that is passed as its argument and turns it into an AST. It then invokes the macro implementation with that AST, and it returns a new AST that is then spliced back to its call site. import reflect.macros.blackbox.Context object ...
Macros can trigger compiler warnings and errors through the use of their Context. Say we're a particularly overzealous when it comes to bad code, and we want to mark every instance of technical debt with a compiler info message (let's not think about how bad this idea is). We can use a macro that d...
Declare @userList Table(UserKey VARCHAR(60)) Insert into @userList values ('bill'),('jcom'),('others') --Declared a table variable and insert 3 records Declare @text XML Select @text = ( select UserKey from @userList for XML Path('user'), root('group') ) --Set the XML value from ...
Some topics are loosely associated examples under a theme, such as C# 6.0 Features and Common pitfalls. On the whole, this style of topic has been discouraged since examples per topic were limited as there's no natural place to stop adding content. It's probably better to move the examples to anoth...
CREATE TABLE mytable (number INT); INSERT INTO mytable VALUES (1); CREATE MATERIALIZED VIEW myview AS SELECT * FROM mytable; SELECT * FROM myview; number -------- 1 (1 row) INSERT INTO mytable VALUES(2); SELECT * FROM myview; number -------- 1 (1 row) REFRESH ...
Java code: public class StdioApplication { public static void main(String[] args) { new ClassPathXmlApplicationContext("classpath:spring/integration/stackoverflow/stdio/stdio.xml"); } } Xml config file <?xml version="1.0" encoding="UTF-8"?&...
This example demonstrates how to develop a simple UWP application. On creation of a "Blank App (Universal Windows)" project there are many essential files that are created in your solution. All files in your project can be seen in the Solution Explorer. Some of the crucial files in your...
using System; using System.Speech.Synthesis; using System.Windows; namespace Stackoverflow.SpeechSynthesisExample { public partial class SpeechSynthesisSample : Window { public SpeechSynthesisSample() { InitializeComp...
The non-null assertion operator, !, allows you to assert that an expression isn't null or undefined when the TypeScript compiler can't infer that automatically: type ListNode = { data: number; next?: ListNode; }; function addNext(node: ListNode) { if (node.next === undefined) { nod...
This example demonstrates how a cross origin http request can be handled using a middleware. CORS Background CORS is an access control method adopted by all major browsers to avert Cross Scripting Vulnerabilities inherent by them. In general browser security, scripts should maintain that all XHR r...
Once you got a collection object, queries use the same syntax as in the mongo shell. Some slight differences are: every key must be enclosed in brackets. For example: db.find({frequencies: {$exists: true}}) becomes in pymongo (note the True in uppercase): db.find({"frequencies": ...
Let's say you need to add a field to every document in a collection. import pymongo client = pymongo.MongoClient('localhost', 27017) db = client.mydb.mycollection for doc in db.find(): db.update( {'_id': doc['_id']}, {'$set': {'newField': 10} }, upsert=False, multi=False...
Previously, datatables were initialized as follows: var oTable = $("#selector").dataTable(); This used to return a jQuery object which would stored in the variable oTable. And then to access the api to modify table properties, we had to initialize the api differently, as shown below: ...
The following 3 features (that were deprecated in 1.9) are no longer available in 1.10, they are : fnRender: According to the deverloper: The old fnRender option provided a method of manipulating a cell when it was created. however, it was provided with a confusing list of options as its a...
Conditional predicate will be cleaner and safer by using the NSCompoundPredicate class which provides basic boolean operators for the given predicates. Objective-c AND - Condition NSPredicate *predicate = [NSPredicate predicateWithFormat:@"samplePredicate"]; NSPredicate *anotherPre...
This code create a producer which send two messages to a queue, and a consumer which receives all the messages from that queue. Code for producer.py (using the pika 0.10.0 Python client): import pika connection = pika.BlockingConnection(pika.ConnectionParameters( host='localhost')) ch...
This approach was introduced in JSR 286. In JSR 168,render parameters set in processAction of a portlet were available only in that portlet.With the Public Render Parameters feature, the render parameters set in the processAction of one portlet will be available in render of other portlets also.In ...
This is one approach which has been there since JSR 168.It allows us to share attributes using portlet session.A portlet session can have different types of scopes: Portlet scope(attributes available only within portlet) Application scope(attributes available within whole application[war]) In...
The eventing mechanism is an extended version of the public render param,with additonal feature to pass custom objects to other portlets,but with an overhead of event phase. To achieve this,this mechanism consists of Publisher portlet Processor(consumer) portlet,where both may be part of differ...
We assume a fully working UIScrollview named _scrollView; Note that UITableView, UICollectionView are also scrollviews, hence the following examples would work on those UI elements. First, creation & allocation UIRefreshControl refreshControl = new UIRefreshControl(); Second, connecting th...

Page 1079 of 1336