Tutorial by Examples

Caffe has a build-in input layer tailored for image classification tasks (i.e., single integer label per input image). This input "Data" layer is built upon an lmdb or leveldb data structure. In order to use "Data" layer one has to construct the data structure with all training d...
Using comments in your projects is a handy way of leaving explanations of your design choices, and should aim to make your (or someone else's) life easier when maintaining or adding to the code. There are a two ways of adding a comment to your code. Single line comments Any text placed after // w...
A region is a collapsible block of code, that can help with the readability and organisation of your code. NOTE: StyleCop's rule SA1124 DoNotUseRegions discourages use of regions. They are usually a sign of badly organized code, as C# includes partial classes and other features which make regions o...
By default, LESS will use its own calc() unless told otherwise. So: @column-count: 2; .class-example { width: calc(100% / @column-count); } Would compile to this: .class-example { width: 50%; } While it is our desired width, LESS has used it's own calc() function to calculate ...
RSA can be used to create a message signature. A valid signature can only be generated with access to the private RSA key, validating on the other hand is possible with merely the corresponding public key. So as long as the other side knows your public key they can verify the message to be signed by...
Asymmetric encryption has the advantage that a message can be encrypted without exchanging a secret key with the recipient of the message. The sender merely needs to know the recipients public key, this allows encrypting the message in such a way that only the designated recipient (who has the corre...
strip_tags is a very powerful function if you know how to use it. As a method to prevent cross-site scripting attacks there are better methods, such as character encoding, but stripping tags is useful in some cases. Basic Example $string = '<b>Hello,<> please remove the <> tags.&...
The GNU gprof profiler, gprof, allows you to profile your code. To use it, you need to perform the following steps: Build the application with settings for generating profiling information Generate profiling information by running the built application View the generated profiling inf...
std::ostringstream is a class whose objects look like an output stream (that is, you can write to them via operator<<), but actually store the writing results, and provide them in the form of a stream. Consider the following short code: #include <sstream> #include <string> ...
1. Jenkins : Jenkins is an open source continuous integration tool written in Java. The project was forked from Hudson after a dispute with Oracle. In a nutshell, Jenkins is the leading open source automation server. Built with Java, it provides hundreds of plugins to support building, testing, de...
Setup Spark context in R To start working with Sparks distributed dataframes, you must connect your R program with an existing Spark Cluster. library(SparkR) sc <- sparkR.init() # connection to Spark context sqlContext <- sparkRSQL.init(sc) # connection to SQL context Here are infos how...
What: Caching can optimize computation in Spark. Caching stores data in memory and is a special case of persistence. Here is explained what happens when you cache an RDD in Spark. Why: Basically, caching saves an interim partial result - usually after transformations - of your original data. So, ...
SQL Server 2012 In Transact SQL , you may define an object as Date (or DateTime) using the [DATEFROMPARTS][1] (or [DATETIMEFROMPARTS][1]) function like following: DECLARE @myDate DATE=DATEFROMPARTS(1988,11,28) DECLARE @someMoment DATETIME=DATEFROMPARTS(1988,11,28,10,30,50,123) The parameter...
If you'd like to quickly test if an ability class is giving the correct permissions, you can initialize an ability in the console or on another context with the rails environment loaded, just pass an user instance to test against: test_ability = Ability.new(User.first) test_ability.can?(:show, Pos...
A UserForm is a class module with a designer and a default instance. The designer can be accessed by pressing Shift+F7 while viewing the code-behind, and the code-behind can be accessed by pressing F7 while viewing the designer. Work with a new instance every time. Being a class module, a form i...
The QueryClose event is raised whenever a form is about to be closed, whether it's via user action or programmatically. The CloseMode parameter contains a VbQueryClose enum value that indicates how the form was closed: ConstantDescriptionValuevbFormControlMenuForm is closing in response to user act...
import groovy.json.JsonSlurper; def jsonSlurper = new JsonSlurper() def obj = jsonSlurper.parseText('{ "foo": "bar", "baz": [1] }') assert obj.foo == 'bar' assert obj.baz == [1]
import groovy.json.JsonSlurper; def jsonSlurper = new JsonSlurper() File fl = new File('/path/to/fils.json') // parse(File file) method is available since 2.2.0 def obj = jsonSlurper.parse(fl) // for versions < 2.2.0 it's possible to use def old = jsonSlurper.parse(fl.text)
import groovy.json.JsonOutput; def json = JsonOutput.toJson([foo: 'bar', baz: [1]]) assert json == '{"foo":"bar","baz":[1]}' In addition to maps, lists and primitives groovy.json.JsonOutput also supports a POJOs serialitzation: import groovy.json.JsonOutput; ...
import groovy.json.JsonOutput; def json = JsonOutput.toJson([foo: 'bar', baz: [1]]) assert json == '{"foo":"bar","baz":[1]}' def pretty = JsonOutput.prettyPrint(json) assert pretty == '''{ "foo": "bar", "baz": [ ...

Page 744 of 1336