Tutorial by Examples: a

Batch file does not come with a built-in method for replacing nth line of a file except replace and append(> and >>). Using for loops, we can emulate this kind of function. @echo off set file=new2.txt call :replaceLine "%file%" 3 "stringResult" type "%file...
JSON data { "name" : { "first" : "Joe", "last" : "Sixpack" }, "gender" : "MALE", "verified" : false, "userImage" : "keliuyue" } It takes two lines of Java to turn it into a User insta...
There are benefits to switching the root view controller, although the transition options are limited to those supported by UIViewAnimationOptions, so depending on how you wish to transition between flows might mean you have to implement a custom transition - which can be cumbersome. You can show t...
In the most straightforward implementation, the Onboarding flow can simply be presented in a modal context, since semantically the User is on a single journey. [Apple Human Interface Guidelines – Modality][1]: Consider creating a modal context only when it’s critical to get someone’s attention, ...
So the most used functions on Clojure map and filter have been modified to return transducers (composable algorithmic transformations), if not called with a collection. That means: (map inc) returns a transducer and so does (filter odd?) The advantage: the functions can be composed into a single f...
Generating simple blog engine rails plugin new [engine name] --mountable Famous engines examples are Device (authentication gem for rails) Spree (Ecommerce)
This example shows how to catch custom Exception class CustomError(Exception): pass try: raise CustomError('Can you catch me ?') except CustomError as e: print ('Catched CustomError :{}'.format(e)) except Exception as e: print ('Generic exception: {}'.format(e)) Output:...
In this example, function will return as soon as value var has 1 def func(params): for value in params: print ('Got value {}'.format(value)) if value == 1: # Returns from function as soon as value is 1 print (">>>> Got 1") ...
AVPlayer *avPlayer = [AVPlayer playerWithURL:[NSURL URLWithString:@"YOUR URL"]]; AVPlayerViewController *avPlayerCtrl = [[AVPlayerViewController alloc] init]; avPlayerCtrl.view.frame = self.view.frame; avPlayerCtrl.player = avPlayer; avPlayerCtrl.delegate = self; [...
This is a compact guide about how to quickly create an R package from your code. Exhaustive documentations will be linked when available and should be read if you want a deeper knowledge of the situation. See Remarks for more resources. The directory where your code stands will be refered as ./, an...
The possibilities are endless. as you can use this concept to pull the version number from your build system; such as git and use that version number in your project. CMakeLists.txt cmake_minimum_required(VERSION 3.8) project(project_name VERSION "0.0.0") configure_file(${path to con...
From the Terminal command line Get the current URL from Safari osascript -e 'tell app "safari" to get the url of the current tab of window 1' Get the active URL in Google Chrome osascript -e 'tell app "google chrome" to get the url of the active tab of window 1'
Get the name of the web page in Safari osascript -e 'tell app "safari" to get the name of the current tab of window 1' Get the title of the web page in Google Chrome osascript -e 'tell app "google chrome" to get the title of the active tab of window 1'
You're not limited to single line Applescript code. Here we take the previous two examples and combine them into a single function. #!/bin/bash pageinfo() { osascript -e \ 'tell app "safari" tell the current tab of window 1 return {url & "\n" & ...
If you you want to pass some data with the timer trigger you can do it with the userInfoparameter. Here is the simple approach that gives brief idea about how you can pass the data to triggered method from the Timer. [Swift 3] Timer.scheduledTimer(timeInterval: 1.0, target: self, selector:#selec...
In this example, three brief and comprehensive sub-examples are presented: Loading weights from available pre-trained models, included with Keras library Stacking another network for training on top of any layers of VGG Inserting a layer in the middle of other layers Tips and general rule-of-t...
A vignette is a long-form guide to your package. Function documentation is great if you know the name of the function you need, but it’s useless otherwise. A vignette is like a book chapter or an academic paper: it can describe the problem that your package is designed to solve, and then show ...
public static void cleanUpOldData(AmazonDynamoDB amazonDynamoDB, String dynamoDBTablesPrefix, String tableName, String dateRangeField, String dateHashKey, String dateIndex, Class clazz) { log.info(String.format("Cleaning old data from table: %s", tab...
To generate json user model with username, password_hash, email_id, created_at, updated_at, type mix phoenix.gen.json User users username:string email_id:string password_hash:string timestamps()
np.save and np.load provide a easy to use framework for saving and loading of arbitrary sized numpy arrays: import numpy as np a = np.random.randint(10,size=(3,3)) np.save('arr', a) a2 = np.load('arr.npy') print a2

Page 1091 of 1099