Tutorial by Examples: c

In this example I will show you how to make a basic lexer which will create the tokens for a integer variable declaration in python. What does the lexical analyser do? The purpose of a lexer (lexical analyser) is to scan the source code and break up each word into a list item. Once done it tak...
The rule Another common case we usually find and where it is useful to apply this technique are progressive rates based on values. An e-commerce has an offer that is like: 10% off for orders above US$ 80.00 15% off for orders above US$ 150.00 25% off for orders above US$ 200.00 How to appl...
Data annotations are a way of adding more contextual information to classes or members of a class. There are three main categories of annotations: Validation Attributes: add validation criteria to data Display Attributes: specify how the data should be displayed to the user Modelling Attributes...
<!-- : Comment This works with both batch script and WSF. The closing tag(-->), only works in WSF. CodeSucessful in both batch and WSF?<!--: CommentTrue<!--: Comment -->False - The closing tag only works for WSF-->False
Once you have node.js installed on your system, you can just follow the procedure below to get a basic web server running with support for both HTTP and HTTPS! Step 1 : Build a Certificate Authority create the folder where you want to store your key & certificate : mkdir conf ...
Suppose we have an API which allows us to get object metadata in single request (getAllPets), and other request which have full data of single resource (getSinglePet). How we can query all of them in a single chain? public class PetsFetcher { static class PetRepository { List<Integer&g...
LibGDX is designed in a way that you can write the same code and deploy it on several different platforms. Yet, there are times when you want to get access to platform specific code. For an instance, if you have leaderboards and achievements in your game, you may want to use platform-specific tools ...
When you get started with Java or Android, you quickly learn that (0,0) is in the top-left corner. In LibGDX, however, (0,0) is by default in the bottom left corner. Using an Orthographic camera, you can get (0, 0) to be in the top-left corner. Though by default, (0, 0) is in the bottom-left corner...
In this example, user BoeNoe showed how to use the command xcopy to copy files. There is also an extra command called copy. Here is a simple example: copy foo.ext bar.ext This copies foo.ext to bar.ext, and create bar.ext when it doesn't exist. We can also specify paths to the file, but it is a...
It is also possible to have an user upload csv's to your Shiny app. The code below shows a small example on how this can be achieved. It also includes a radioButton input so the user can interactively choose the separator to be used. library(shiny) library(DT) # Define UI ui <- shinyUI(flui...
function sum(numbers) { var total = 0; for (var i = numbers.length - 1; i >= 0; i--) { total += numbers[i]; } return total; } It's a procedural code with mutations (over total).
function sum(numbers) { if(numbers.length == 0) { return 0; } return numbers[0] + sum(numbers.slice(1)); } this is the recursive version. there's no mutation, but we are making a call stack as below which uses extra memory. sum([10, 5, 6, 7]);      10 + sum([5, 6, 7]); ...
function sum(numbers) { return tail_sum(numbers, 0); } function tail_sum(numbers, acc) { if(numbers.length == 0) { return acc; } return tail_sum(numbers.slice(1), acc + numbers[0]); } in the tail recursive version, function return value does not need to wait till...
Let's create a map and a closure to print hello def exMap = [:] def exClosure = { println "Hello" } Assign closure to a property in map exMap.closureProp = exClosure Calling closure exMap.closureProp.call() Output Hello Another Example - Lets create a class with ba...
<?php //Creating Connection to MySQL database using MySQLi $mysqli = mysqli_connect("IP ADDRESS OR DOAMIN", "username", "password", "database_name"); //Executing Query in the Database using MySQLi $result = mysqli_query($mysqli, "SELECT * FROM T...
Here's a simple example to demonstrate that how can we jump/open a specific screen based on the notification. For example, when a user clicks on the notification, the app should open and directly jump to notifications page instead of home page. 'use strict'; import React, { Component } from 'rea...
This calculate current device time and add/subtract difference between real and device time public static Calendar getCurrentRealTime() { long bootTime = networkTime - SystemClock.elapsedRealtime(); Calendar calInstance = Calendar.getInstance(); calInstance.setTimeZone(getUTCTimeZo...
#include <vector> #include <string> #include <boost/process.hpp> #include <boost/asio.hpp> #include <boost/process/windows.hpp> int Run( const std::string& exeName, ///< could also be UTF-16 for Windows const std::string& args, ...
To start a new project in Visual Studio 2010: Click File Menu Select Project Next, we have project types and available languages listed : Select Languages available from left most panel [Below we have languages like Visual C#, VB, F# etc] Once we select languages from installed template...
These locators should be used as a priority when possible, because they are more persistent to changes in an application then locators based on css or xpath, which can easily break. Binding locator Syntax by.binding('bind value') Example View <span>{{user.password}}</span> <s...

Page 816 of 826