Tutorial by Examples: sin

Server side Meteor.methods({ getData() { return 'Hello, world!'; } }); Client side <template name="someData"> {{#if someData}} <p>{{someData}}</p> {{else}} <p>Loading...</p> {{/if}} </template> Template.someData.on...
LaraDock is a Laravel Homestead like development environment but for Docker instead of Vagrant. https://github.com/LaraDock/laradock Installation *Requires Git and Docker Clone the LaraDock repository: A. If you already have a Laravel project, clone this repository on your Laravel root director...
(ns so-doc.events (:require [goog.dom :as dom] [goog.events :as events])) (defn handle-click [event] ;an event object is passed to all events (js/alert "button pressed")) (events/listen (dom/getElement "button"); This is the dom element the event comes fro...
(ns so-doc.events) (enable-console-print!) (defn click-event [] (println "Button clicked")) (defn load-event [] (println "Page loaded!") (.addEventListener (.getElementById js/document "btn") "click" click-event false)) (.addEventListener ...
Large scale applications often need different properties when running on different environments. we can achieve this by passing arguments to NodeJs application and using same argument in node process to load specific environment property file. Suppose we have two property files for different enviro...
Occasionally you will want to access the result of your filters from outside the ng-repeat, perhaps to indicate the number of items that have been filtered out. You can do this using as [variablename] syntax on the ng-repeat. <ul> <li ng-repeat="item in vm.listItems | filter:vm.myF...
This serializer has some nice features that the default .net json serializer doesn't have, like Null value handling, you just need to create the JsonSerializerSettings : public static string Serialize(T obj) { string result = JsonConvert.SerializeObject(obj, new JsonSerializerSettings { NullVa...
You can quickly determine if a text includes a specific pattern using Regex. There are multiple ways to work with Regex in PowerShell. #Sample text $text = @" This is (a) sample text, this is a (sample text) "@ #Sample pattern: Content wrapped in () $pattern = '\(.*?\)' Using ...
Sometimes you need to replace a value matching a pattern with a new value that's based on that specific match, making it impossible to predict the new value. For these types of scenarios, a MatchEvaluator can be very useful. In PowerShell, a MatchEvaluator is as simple as a scriptblock with a singl...
The IIF statement can be used in expressions to screen for division by zero: =IIF(Fields!PossibleZero.Value=0,0,Fields!Denominator.Value/IIF(Fields!PossibleZero.Value=0,1,Fields!PossibleZero.Value)) SSRS does not short circuit IIF arguments. Therefore, using a single IIF function to screen for ...
In order to use a plain-text editor to create a Console application that is written in C#, you'll need the C# Compiler. The C# Compiler (csc.exe), can be found at the following location: %WINDIR%\Microsoft.NET\Framework64\v4.0.30319\csc.exe N.B. Depending upon which version of the .NET Framework t...
svn2git is a Ruby wrapper around git's native SVN support through git-svn, helping you with migrating projects from Subversion to Git, keeping history (incl. trunk, tags and branches history). Examples To migrate a svn repository with the standard layout (ie. branches, tags and trunk at the root l...
It is sometimes useful to integrate a custom error logging framework to ensure all exceptions are logged. [ServiceContract] [ErrorHandler] public interface IMyService { } [AttributeUsage(AttributeTargets.Interface)] public class CustomErrorHandler : Attribute, IContractBehavior, IE...
import tensorflow as tf filename_queue = tf.train.string_input_producer(["file.csv"], num_epochs=1) reader = tf.TextLineReader() key, value = reader.read(filename_queue) col1, col2 = tf.decode_csv(value, record_defaults=[[0], [0]]) with tf.Session() as sess: sess.run(tf.initializ...
The CEILING function rounds a number up, away from zero, to the nearest multiple of significance. The FLOOR function does the same by rounds the number down towards zero. An example of when CEILING could be be used is if you want to avoid using pennies in your prices and your product is priced at $...
The FIXED function rounds a number to the specified number of decimals defined by the decimals parameter, formats the number in decimal format using a comma as a separator unless specified as not required defined by the parameter no_commas, and returns the result as text. The decimals parameter is o...
There are a number of available routing verbs in Sinatra, they correspond directly to http verbs get '/' do .. get some data, a view, json, etc .. end post '/' do .. create a resource .. end put '/' do .. replace a resource .. end patch '/' do .. change a resource .. end ...
Of course you can pass data to Sinatra routes, to accept data in your routes you can add route paremeters. You can then access a params hash: get '/hello/:name' do # matches "GET /hello/foo" and "GET /hello/bar" # params['name'] is 'foo' or 'bar' "Hello #{params['...
Add the necessary dependencies to the project POM (mybatis, and mybatis-spring): <dependency> <groupId>org.mybatis</groupId> <artifactId>mybatis</artifactId> <version>x.x.x</version> </dependency> <dependency> <group...
Another good practice to check when our threads have finished without block the thread waiting to recover the Future object from our Callable is to create our own implemetation for Runnables, using it together with the execute() method. In the next example, I show a custom class which implements Ru...

Page 111 of 161