Tutorial by Examples: on

Usually the case when one wants to change a field type to another, for instance the original collection may have "numerical" or "date" fields saved as strings: { "name": "Alice", "salary": "57871", "dob": "198...
After you got the Location object from FusedAPI, you can easily acquire Address information from that object. private Address getCountryInfo(Location location) { Address address = null; Geocoder geocoder = new Geocoder(getActivity(), Locale.getDefault()); String errorMessage; Li...
Puppet provide official documention for both open-source and enterprise versions. you can find it here
System Requirements However, the Puppet master service is fairly resource intensive, and should be installed on a robust dedicated server. At a minimum, your Puppet master server should have two processor cores and at least 1 GB of RAM. To comfortably serve at least 1,000 nodes, it should have ...
Just add this function to your functions.php. It will remove the version from all enqueued js and css files. function remove_cssjs_ver( $src ) { if( strpos( $src, '?ver=' ) ) $src = remove_query_arg( 'ver', $src ); return $src; } add_filter( 'style_loader_src', 'remove_cssjs_ver', 9...
@Configuration // @Lazy - For all Beans to load lazily public class AppConf { @Bean @Lazy public Demo demo() { return new Demo(); } }
@Component @Lazy public class Demo { .... .... } @Component public class B { @Autowired @Lazy // If this is not here, Demo will still get eagerly instantiated to satisfy this request. private Demo demo; ....... }
Mongoose contains some built in functions that build on the standard find(). doc.find({'some.value':5},function(err,docs){ //returns array docs }); doc.findOne({'some.value':5},function(err,doc){ //returns document doc }); doc.findById(obj._id,function(err,doc){ //returns doc...
Loop n times: while [ $((i=${i:=0}+1)) -le "$n" ]; do echo line $i done Output for n=5: line 1 line 2 line 3 line 4 line 5 Manipulating decimals: $ i=3.14159; echo $((${i%.*}*2)) 6 $ i=3.14159; echo $((${i#*.}*2)) 28318
Absolute value: $ for n in -8 -2 0 3 4; do > echo $((n<0?-n:n)) > done 8 2 0 3 4 Fix variable range: $ min=2 $ max=4 $ for n in 1 2 3 4 5; do > echo $((n<min?min:n>max?max:n)) > done 2 2 3 4 4
Allow change user unique ID if account is compromised with a new user&password login To invalidate tokens when user changes their password or permissions, sign the token with a hash of those fields. If any of these field change, any previous tokens automatically fail to verify. The down...
This will download libpng from the official "git" repository and build it in your "libpng" directory. git clone https://github.com/glennrp/libpng.git libpng cd libpng ./autogen.sh ./configure [--prefix=/path] make install where "/path" points to the installation...
Monkey patching is the modification of classes or objects outside of the class itself. Sometimes it is useful to add custom functionality. Example: Override String Class to provide parsing to boolean class String def to_b self =~ (/^(true|TRUE|True|1)$/i) ? true : false end end A...
Like patching of classes, you can also patch single objects. The difference is that only that one instance can use the new method. Example: Override a string object to provide parsing to boolean s = 'true' t = 'false' def s.to_b self =~ /true/ ? true : false end >> s.to_b =&...
A very simple example would be to fade out an SKSpriteNode. In Swift: let node = SKSpriteNode(imageNamed: "image") let action = SKAction.fadeOutWithDuration(1.0) node.runAction(action)
Sometimes it is necessary to do an action on repeat or in a sequence. This example will make the node fade in and out a total of 3 times. In Swift: let node = SKSpriteNode(imageNamed: "image") let actionFadeOut = SKAction.fadeOutWithDuration(1.0) let actionFadeIn = SKAction.fadeInWithD...
One helpful case is to have the action run a block of code. In Swift: let node = SKSpriteNode(imageNamed: "image") let actionBlock = SKAction.runBlock({ //Do what you want here if let gameScene = node.scene as? GameScene { gameScene.score += 5 } }) node.runActi...
If you want to use docker for rails app, and use database, you need to know that all the data in the docker container will be destroyed (unless you configure the container specifically for keeping data) Sometimes, you need to create a docker container with an application and attach it to an old con...
To select an element by an HTML attribute that contains a specified value use the css locator pattern [attribute*=value] //selects the first element with href value that contains'cont' element(by.css('[href*="cont"]')); //selects the first element with tag h1 and class attribute that...
One of most common use cases of Gitflow Initialize repo and define branches $ git flow init # if you use default setup, you'll define six types of branches: # # main branches (lives forever) # # 1. master: for production releases # 2. develop: for "next ...

Page 292 of 475