Tutorial by Examples: sin

Let's assume we have the following struct that defines a City type: type City struct { Name string Temperature int } We can encode/decode City values using the encoding/json package. First of all, we need to use the Go metadata to tell the encoder the correspondence between the...
Usually to use the converter, we have to define it as resource in the following way: <converters:SomeConverter x:Key="SomeConverter"/> It is possible to skip this step by defining a converter as MarkupExtension and implementing the method ProvideValue. The following example conve...
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1">...
On error move to labelled code and see if there is a specific error that needs to be handled. Public Const cErrCodeNotNumber = 2262 ' This value must be a number. Public Const cErrCodeNumericOverflow = 2263 ' The number is too large. Private Sub MySub() Dim objConn As ADODB.Connection ...
Encryption is used to transform data in its orignal format (Eg: The contents of a letter, Credentials part of authorizing a financial transaction) to something that cannot be easily reconstructed by anyone who is not intended to be part of the conversation. Basically encryption is used to preve...
When a hit is sent to Google Analytics the data must be processed. Processing latency is 24-48 hours. This means that it can take time before you will see data under standard reports (Not real-time) any data that you do see may not be correct as it has probably not completed processing. Standard a...
Modals slide in off screen to display a temporary UI, often used for login or signup pages, message composition, and option selection. import { ModalController } from 'ionic-angular'; import { ModalPage } from './modal-page'; export class MyPage { constructor(public modalCtrl: ModalControlle...
Let's say we have multiple data sources which include database, file, prompt and argumentList. Depending on chosen source we change our approach: def loadData(dataSource: Symbol): Try[String] = dataSource match { case 'database => loadDatabase() // Loading data from database case 'file =&g...
If you want to detect missings with df=pd.DataFrame({'col':[1,np.nan]}) df==np.nan you will get the following result: col 0 False 1 False This is because comparing missing value to anything results in a False - instead of this you should use df=pd.DataFrame({'col':[1,np.nan]}) ...
let doc = require('dynamodb-doc'); let dynamo = new doc.DynamoDB(); var tblName = "MyTable"; exports.handler = (event, context, callback) => { readOperation(context); } function readOperation(cnxt) { var params = { TableName: tblName, Key: { "id": ...
Setup After setting up a simple project to use webpack, babel and react issuing $npm i -g webpack-dev-server will install the development http server for quicker development. Modifying webpack.config.js var path = require('path'); module.exports = { entry: './src/index.js', output: { ...
A cycle in a directed graph exists if there's a back edge discovered during a DFS. A back edge is an edge from a node to itself or one of the ancestors in a DFS tree. For a disconnected graph, we get a DFS forest, so you have to iterate through all vertices in the graph to find disjoint DFS trees. ...
The minimal setup for an HTTPS server in Node.js would be something like this : const https = require('https'); const fs = require('fs'); const httpsOptions = { key: fs.readFileSync('path/to/server-key.pem'), cert: fs.readFileSync('path/to/server-crt.pem') }; const app = function ...
This example uses a separate element to edit bound data to the row-detail template. Working jsBin <!DOCTYPE html> <html> <head> <base href="https://polygit.org/polymer+:master/iron-data-table+Saulis+:master/components/"> <link rel="import&q...
Once you have a query, you can do more with it than just iterating the results in a for loop. Setup: from datetime import date class User(Base): __tablename__ = 'users' id = Column(Integer, primary_key=True) name = Column(Text, nullable=False) birthday = Column(Date) # ...
Plugins are scripts that enhance the functionality of analytics.js to aid in measuring user interaction. Plugins are typically specific to a set of features that may not be required by all Google Analytics users, such as ecommerce or cross-domain tracking, and are therefore not included in analytics...
So the GNU coreutils should be avaialable on all linux based systems (please correct me if I am wrong here). If you do not know what system you are using you may not be able to directly jump to one of the examples above, hence this may be your first port of call. `$ uname -a On my system this giv...
<cffunction name="getUserById" access="public" returntype="query"> <cfargument name="userId" type="numeric" required="yes" hint="The ID of the user"> <cfquery name="local.qryGetUser" datasource...
Enable validation using annotations in app/config/config.yml file framework: validation: { enable_annotations: true } Create an Entity in AppBundle/Entity directory. The validations are made with @Assert annotations. <?php # AppBundle/Entity/Car.php namespace AppBundle\Ent...
Create an Entity in AppBundle/Entity directory. You can do this manually, or by using Symfony's command php bin/console doctrine:generate:entity and filling in the required information in each step. You must specify yml option at Configuration format (yml, xml, php or annotation) step. <?php...

Page 108 of 161