Tutorial by Examples: c

defmodule MyModule do @my_favorite_number 13 @use_snake_case "This is a string (use double-quotes)" end These are only accessible from within this module.
Declare: defmodule MyApp.ViaFunctions.Constants do def app_version, do: "0.0.1" def app_author, do: "Felix Orr" def app_info, do: [app_version, app_author] def bar, do: "barrific constant in function" end Consume with require: defmodule MyApp.ViaFuncti...
Declare: defmodule MyApp.ViaMacros.Constants do @moduledoc """ Apply with `use MyApp.ViaMacros.Constants, :app` or `import MyApp.ViaMacros.Constants, :app`. Each constant is private to avoid ambiguity when importing multiple modules that each have their own copies of th...
A basic reducer would look like this: // Import the action types to recognise them import { ACTION_ERROR, ACTION_ENTITIES_LOADED, ACTION_ENTITY_CREATED } from './actions'; // Set up a default state const initialState = { error: undefined, entities: [] }; // If no state is provi...
You can add a method to any class in Ruby, whether it's a builtin or not. The calling object is referenced using self. class Fixnum def plus_one self + 1 end def plus(num) self + num end def concat_one self.to_s + '1' end end 1.plus_one # => 2 3.plus(5) ...
Objective: Use SignalR for notification between Web API, and TypeScript/JavaScript based Web App, where Web API and the Web App is hosted in different domain. Enabling SignalR and CORS on Web API: Create a standard Web API project, and install the following NuGet packages: Microsoft.Owin.Cors ...
If you want to check the existence of one file or do a couple of actions for every file in a folder you can use the Foreach Loop Container. You give the path and the file mask and it will run it for every file it finds
One of the best uses for markup extensions is for easier usage of IValueConverter. In the sample below BoolToVisibilityConverter is a value converter but since it's instance independent it can be used without the normal hasles of a value converter with the help of markup extension. In XAML just use...
var mongoose = require('mongoose'); //assume Player and Board schemas are already made var Player = mongoose.model('Player'); var Board = mongoose.model('Board'); //Each key in the schema is associated with schema type (ie. String, Number, Date, etc) var gameSchema = new mongoose.Schema({ ...
The showcase of Primefaces components you can find here and documentation is here Frontend needs to be saved as a XHTML file. This file can contain JSF, JSTL, JSP, HTML, CSS, jQuery, javaScript and its framework and more front-end technologies. Please, do not mix JSF and JSP technologies together....
Merging key names are same pd.merge(df1, df2, on='key') Merging key names are different pd.merge(df1, df2, left_on='l_key', right_on='r_key') Different types of joining pd.merge(df1, df2, on='key', how='left') Merging on multiple keys pd.merge(df1, df2, on=['key1', 'key2']) Treatment...
You'll first send the user to the Twitch authorization endpoint. This URL is made up of a the base authorization URL (https://api.twitch.tv/kraken/oauth2/authorize) and query string parameters that define what you're requesting. The required parameters are response_type, client_id, redirect_uri, and...
When the user goes to the authorization endpoint, they will be asked to give your application permission to the scopes that you've requested. They can decline this, so you must make sure to take that into consideration in your code. After they've allowed your application access, the user will be red...
Now that you have an authorization code, you can make a POST to the token endpoint (https://api.twitch.tv/kraken/oauth2/token) to get an OAuth token. You will receive a JSON-encoded access token, refresh token, and a list of the scopes approved by the user. You can now use that token to make authent...
Server syntax: var io = require('socket.io')(80); io.on('connection', function (mysocket) { //emit to all but the one who started it mysocket.broadcast.emit('user connected'); //emit to all sockets io.emit('my event', { messg: 'for all'}); }); // a javascript client would listen ...
This line of code demonstrate how to check if a specific field is NULL or has blank value =IIF(IsNothing(Fields!UserEmail.Value) OR Fields!UserEmail.Value = "", "Empty", "Not Empty") This line of code checks if the field is NULL IsNothing(Fields!UserEmail.Value) ...
Excel -> Save as -> Save as type -> "Comma separated value (*.csv)" AND Tools (left to Save button) -> Web options -> Encoding -> Save this document as -> Unicode (UTF-8)
function lastRowForColumn(sheet, column){ // Get the last row with data for the whole sheet. var numRows = sheet.getLastRow(); // Get all data for the given column var data = sheet.getRange(1, column, numRows).getValues(); // Iterate backwards and find first non empty cell ...
The pyplot interface to matplotlib might be the simplest way to close a figure. import matplotlib.pyplot as plt plt.plot([0, 1], [0, 1]) plt.close()
A specific figure can be closed by keeping its handle import matplotlib.pyplot as plt fig1 = plt.figure() # create first figure plt.plot([0, 1], [0, 1]) fig2 = plt.figure() # create second figure plt.plot([0, 1], [0, 1]) plt.close(fig1) # close first figure although second one is active ...

Page 561 of 826