After launching Visual Studio 2015, go to File → New → Project. In the New Project dialog box, browse in the templates tree to Visual C# → Windows → Universal and select Blank App (Universal Windows).
Next, we need to fill the form to describe the Application:
Name: this is the name of the appli...
There are two common conventions for private fields: camelCase and _camelCaseWithLeadingUnderscore.
Camel case
public class Rational
{
private readonly int numerator;
private readonly int denominator;
public Rational(int numerator, int denominator)
{
// "this&q...
Tail Call Optimisation makes it possible to safely implement recursive loops without concern for call stack overflow or the overhead of a growing frame stack.
function indexOf(array, predicate, i = 0) {
if (0 <= i && i < array.length) {
if (predicate(array[i])) { return...
Break and continue statements can be followed by an optional label which works like some kind of a goto statement, resumes execution from the label referenced position
for(var i = 0; i < 5; i++){
nextLoop2Iteration:
for(var j = 0; j < 5; j++){
if(i == j) break nextLoop2Iteration;
...
In other frameworks pagination is headache. Laravel makes it breeze, it can generate pagination by adding few lines of code in Controller and View.
Basic Usage
There are many ways to paginate items, but the simplest one is using the paginate method on query builder or an Eloquent query. Laravel ou...
The if statement in the example above allows to execute a code fragment, when the condition is met. When you want to execute a code fragment, when the condition is not met you extend the if with an else.
if ($a > $b) {
echo "a is greater than b";
} else {
echo "a is NOT gre...
elseif
elseif combines if and else. The if statement is extended to execute a different statement in case the original if expression is not met. But, the alternative expression is only executed, when the elseif conditional expression is met.
The following code displays either "a is bigger tha...
SP.SOD.executeOrDelayUntilScriptLoaded( function(){ deleteItem(1); }, "sp.js");
function deleteItem(id){
var clientContext = new SP.ClientContext();
var list = clientContext.get_web().get_lists().getByTitle("List Title");
var item = list.getItemById(id);
it...
A do-while loop is very similar to a while loop, except that the condition is checked at the end of each cycle, not at the start. The loop is therefore guaranteed to execute at least once.
The following code will print 0, as the condition will evaluate to false at the end of the first iteration:
i...
With ng-model you can bind a variable to any type of input field. You can display the variable using double curly braces, eg {{myAge}}.
<input type="text" ng-model="myName">
<p>{{myName}}</p>
As you type in the input field or change it in any way you will s...
class Skill(models.Model):
name = models.CharField(max_length=50)
description = models.TextField()
class Developer(models.Model):
name = models.CharField(max_length=50)
skills = models.ManyToManyField(Skill, through='DeveloperSkill')
class DeveloperSkill(models.Model):
...
This simple example provides an explanation on some functions I found extremely useful since I have started using MATLAB: cellfun, arrayfun. The idea is to take an array or cell class variable, loop through all its elements and apply a dedicated function on each element. An applied function can eith...
The use of Matlab Coder sometimes denies the use of some very common functions, if they are not compatible to C++. Relatively often there exist undocumented helper functions, which can be used as replacements.
Here is a comprehensive list of supported functions..
And following a collection of alte...
Log into a running container
A user can enter a running container in a new interactive bash shell with exec command.
Say a container is called jovial_morse then you can get an interactive, pseudo-TTY bash shell by running:
docker exec -it jovial_morse bash
Log into a running container with a s...
Installing pipeline
Once Heroku Toolbelt is installed it requires Pipelines plugin too.
heroku plugins:install heroku-pipelines
Creating pipelines
You must start with an app to add to the pipeline, although it doesn’t have to be for a particular stage. If you don’t specify --stage STAGE, the...