Tutorial by Examples: c

Download and install Visual Studio Community 2015 Open Visual Studio Community Click File -> New -> Project Click Templates -> Visual C++ -> Win32 Console Application and then name the project MyFirstProgram. Click Ok Click Next in the following window. Check the Empty proj...
Each Error object has a string property named stack that contains the stack trace:
Instrument your code with console.trace() calls that print current JavaScript call stacks:
Place assertions in your JavaScript code by calling console.assert() with the error condition as the first parameter. When this expression evaluates to false, you will see a corresponding console record:
In many instances, you will want to send data from the R server to the JS client. Here is a very simple example: library(shiny) runApp( list( ui = fluidPage( tags$script( "Shiny.addCustomMessageHandler('message', function(params) { alert(params); });" ), ...
Modern browsers provide a classList object to ease manipulation of the element's class attribute. Older browsers require direct manipulation of the element's className property. W3C DOM4 A simple method to add a class to an element is to append it to the end of the className property. This will no...
Thread.sleep causes the current thread to suspend execution for a specified period. This is an efficient means of making processor time available to the other threads of an application or other applications that might be running on a computer system. There are two overloaded sleep methods in the Thr...
If you're writing a class that manages resources, you need to implement all the special member functions (see Rule of Three/Five/Zero). The most direct approach to writing the copy constructor and assignment operator would be: person(const person &other) : name(new char[std::strlen(other.n...
One of the most useful queries for end users of large RDBMS's is a search of an information schema. Such a query allows users to rapidly find database tables containing columns of interest, such as when attempting to relate data from 2 tables indirectly through a third table, without existing knowl...
REM This is a comment REM is the official comment command.
::This is a label that acts as a comment The double-colon :: comment shown above is not documented as being a comment command, but it is a special case of a label that acts as a comment. Caution: when labels are used as comments within a bracketed code block or for command, the command processor...
It is also possible to use variables as comments. This can be useful to conditionally prevent commands being executed: @echo off setlocal if /i "%~1"=="update" (set _skip=) Else (set _skip=REM) %_skip% copy update.dat %_skip% echo Update applied ... When using the ab...
The batch file format does not have a block comment syntax, but there is an easy workaround for this. Normally each line of a batch file is read and then executed by the parser, but a goto statement can be used to jump past a block of plain text (which can be used as a block comment): @echo off ...
There are use cases when you might want to rename your app directory to something else. In Laravel4 you could just change a config entry, here's one way to do it in Laravel5. In this example we'll be renaming the app directory to src. Override Application class The directories name app is hardcod...
The function angular.isFunction determines and returns true if and only if the value passed to is a reference to a function. The function returns a reference to the now extended destination object angular.isFunction(fn) Examples var onClick = function(e) {return e}; angular.isFunction(onCli...
Implementing two-way-data-binding, to achieve the result from the previous example, could be done with two core functions: $digest is called after a user interaction (binding DOM=>variable) $watch sets a callback to be called after variable changes (binding variable=>DOM) note: this is ...
The previous example is good enough when we need to bind a single html element, to a single variable. In reality - we need to bind many elements to many variables: <span ng-repeat="number in [1,2,3,4,5]">{{number}}</span> This ng-repeat binds 5 elements to 5 variables call...
angular.module('app', []) .controller('myController', ['$scope', function($scope){ $scope.person = { name: 'John Doe' }; }]); <div ng-app="app" ng-conroller="myController"> <input ng-model="person.name" /> <div ng-repeat="number i...
Be careful, this approach might be considered as a bad design for angular apps, since it requires programmers to remember both where functions are placed in the scope tree, and to be aware of scope inheritance. In many cases it would be preferred to inject a service (Angular practice - using scope ...
CSS resets take separate approaches to browser defaults. Eric Meyer’s Reset CSS has been around for a while. His approach nullifies many of the browser elements that have been known to cause problems right off the back. The following is from his version (v2.0 | 20110126) CSS Reset. html, body, di...

Page 253 of 826