Tutorial by Examples: n

@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...
//'client.jade' //a button is placed down; similar in HTML button(type='button', id='send_by_button') Modify data #modify Lorem ipsum Sender //loading jQuery; it can be done from an online source as well script(src='./js/jquery-2.2.0.min.js') //AJAX request ...
i=0 while read -r line; do i=$((i+1)) done < file echo $i With a file containing: Alpha Beta Gamma Delta Epsilon The above script prints: 5
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
Remove the token from the client storage to avoid usage Tokens are issued by the server and you can not force browsers to delete a cookie/localStorage or control how external clients are managing your tokens. Obviously if attackers have stolen the token before logout they still could use the token,...
Mark invalid tokens, store until their expiration time and check it in every request. Blacklist breaks JWT statelessness because it requires maintaining the state. One of the benefits of JWT is no need server storage, so if you need to revoke tokens without waiting for the expiration, think also ab...
Set expiration time short and rotate tokens. Issue a new access token every few request. Use refresh tokens to allow your application to obtain new access tokens without needing to re-authenticate Refresh and access tokens access token: Authorize access to a protected resource. Limited lifetim...
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 is a simple example to search in Google. It containt two parts, Feature File Step Definition File Am not going into much details here as the code itself is self explanatory. Feature File Feature:Google Key word search @mytag Scenario: search Spec Flow in Google search bar Given...
If you want to use "cmake" (see www.cmake.org), type cd [your libpng source directory] cmake . -DCMAKE_INSTALL_PREFIX=/path make make install where "/path" points to the installation directory where you want to put the libpng "lib", "include", and &quot...
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...
Basic architecture examples on how development for embedded systems works (i.e. IDEs, cross-compiling, downloading, in-line debugging, JTAG,...) and what would be the minimum requirements for starting. It would be worth mentioning different approaches and platforms from begginers-higher level to ad...
import { expect } from 'chai'; import { createStore } from 'redux'; describe('redux store test demonstration', () => { describe('testReducer', () => { it('should increment value on TEST_ACTION', () => { // define a test reducer with initial state: test: 0 const te...
HtmlHelper.Action() @Html.Action(actionName: "Index") output: The HTML rendered by an action method called Index() @Html.Action(actionName: "Index", routeValues: new {id = 1}) output: The HTML rendered by an action method called Index(int id) @(Html.Action("In...
Project structure project/ group_vars/ development inventory.development playbook.yaml These variables will be applied to hosts under the development group due to the filename. --- ## Application app_name: app app_url: app.io web_url: cdn.io app_friendly: New App env_type: ...
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 =&...

Page 696 of 1088