问:
NullPointerException while executing cap write_permissions task from tutorial
I'm seeing an NPE when trying to execute the check_write_permissions task from the Capistrano website.

The stage file itself is straightforward:

```<code>server "demo.ourapp.com", user: "deployuser", roles: %w{app db web}

set :branch, "dev"
set :deployment, "demo"
set :rails_env, "production"

role :app, "demo.ourapp.com"
role :web, "demo.ourapp.com"
role :db,  "demo.ourapp.com", :primary => true

set :repository,  "git@github.com:ouruser/ourapp.git"

set :deploy_to, "/opt/companyname/ourapp-demo"

set :puma_bind,       "unix://#{shared_path}/tmp/sockets/#{fetch(:application)}-puma.sock"
set :puma_state,      "#{shared_path}/tmp/pids/puma.state"
set :puma_pid,        "#{shared_path}/tmp/pids/puma.pid"
set :puma_access_log, "#{release_path}/log/puma.error.log"
set :puma_error_log,  "#{release_path}/log/puma.access.log"
set :puma_preload_app, true
set :puma_worker_timeout, nil
</code>```

Upon executing bundle exec cap deploy this:stage check_write_permissions, I get the following error:

```$ bundle exec cap this:stage check_write_permissions --trace                                       ‹jruby-9.1.12.0›
** Invoke this:stage (first_time)
** Execute this:stage
** Invoke load:defaults (first_time)
** Execute load:defaults
** Invoke bundler:map_bins (first_time)
** Execute bundler:map_bins
** Invoke deploy:set_rails_env (first_time)
** Execute deploy:set_rails_env
** Invoke deploy:set_linked_dirs (first_time)
** Execute deploy:set_linked_dirs
** Invoke deploy:set_rails_env
** Invoke check_write_permissions (first_time)
** Execute check_write_permissions
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as deployuser@demo.ourapp.com:
/Users/srdjan/.bundle/jruby/2.3.0/gems/sshkit-1.14.0/lib/sshkit/runners/parallel.rb:15:in `block in execute'
Java::JavaLang::NullPointerException:
org.jruby.ext.openssl.PKeyEC$Point.initialize(PKeyEC.java:845)
org.jruby.ext.openssl.PKeyEC$Point$INVOKER$i$0$0$initialize.call(PKeyEC$Point$INVOKER$i$0$0$initialize.gen)
org.jruby.internal.runtime.methods.JavaMethod$JavaMethodN.call(JavaMethod.java:725)
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:368)
org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:205)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:209)
org.jruby.RubyClass.newInstance(RubyClass.java:1008)
org.jruby.RubyClass$INVOKER$i$newInstance.call(RubyClass$INVOKER$i$newInstance.gen)
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:208)
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:358)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:195)
org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:323)
org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:73)
org.jruby.ir.interpreter.InterpreterEngine.interpret(InterpreterEngine.java:89)
org.jruby.internal.runtime.methods.MixedModeIRMethod.INTERPRET_METHOD(MixedModeIRMethod.java:214)
org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:200)
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:208)
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:358)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:195)
org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:323)
org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:73)
org.jruby.ir.interpreter.InterpreterEngine.interpret(InterpreterEngine.java:83)
org.jruby.internal.runtime.methods.MixedModeIRMethod.INTERPRET_METHOD(MixedModeIRMethod.java:179)
org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:165)
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:200)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:161)
org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:314)
org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:73)
org.jruby.ir.interpreter.InterpreterEngine.interpret(InterpreterEngine.java:77)
org.jruby.internal.runtime.methods.MixedModeIRMethod.INTERPRET_METHOD(MixedModeIRMethod.java:144)
org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:130)
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:192)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:129)
org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:339)
org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:73)
org.jruby.ir.interpreter.InterpreterEngine.interpret(InterpreterEngine.java:83)
org.jruby.internal.runtime.methods.MixedModeIRMethod.INTERPRET_METHOD(MixedModeIRMethod.java:179)
org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:165)
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:200)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:161)
org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:314)
org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:73)
org.jruby.internal.runtime.methods.MixedModeIRMethod.INTERPRET_METHOD(MixedModeIRMethod.java:109)
org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:95)
org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:77)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:83)
org.jruby.ir.instructions.CallBase.interpret(CallBase.java:428)
org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:355)
org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:73)
org.jruby.ir.interpreter.Interpreter.INTERPRET_BLOCK(Interpreter.java:132)
org.jruby.runtime.MixedModeIRBlockBody.commonYieldPath(MixedModeIRBlockBody.java:148)
org.jruby.runtime.IRBlockBody.doYield(IRBlockBody.java:186)
org.jruby.runtime.BlockBody.yield(BlockBody.java:116)
org.jruby.runtime.Block.yield(Block.java:165)
org.jruby.RubyIO.each_lineInternal(RubyIO.java:3282)
org.jruby.RubyIO.each_line(RubyIO.java:3295)
org.jruby.RubyIO$INVOKER$i$0$1$each_line.call(RubyIO$INVOKER$i$0$1$each_line.gen)
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:298)
org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:79)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:83)
org.jruby.ir.instructions.CallBase.interpret(CallBase.java:428)
org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:355)
org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:73)
org.jruby.ir.interpreter.Interpreter.INTERPRET_BLOCK(Interpreter.java:132)
org.jruby.runtime.MixedModeIRBlockBody.commonYieldPath(MixedModeIRBlockBody.java:148)
org.jruby.runtime.IRBlockBody.doYield(IRBlockBody.java:186)
org.jruby.runtime.BlockBody.yield(BlockBody.java:116)
org.jruby.runtime.Block.yield(Block.java:165)
org.jruby.RubyIO.ensureYieldClose(RubyIO.java:1163)
org.jruby.RubyIO.open(RubyIO.java:1156)
org.jruby.RubyIO$INVOKER$s$0$0$open.call(RubyIO$INVOKER$s$0$0$open.gen)
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:204)
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:348)
org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:173)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:177)
org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:332)
org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:73)
org.jruby.ir.interpreter.Interpreter.INTERPRET_BLOCK(Interpreter.java:132)
org.jruby.runtime.MixedModeIRBlockBody.commonYieldPath(MixedModeIRBlockBody.java:148)
org.jruby.runtime.IRBlockBody.yieldSpecific(IRBlockBody.java:84)
org.jruby.runtime.Block.yieldSpecific(Block.java:134)
org.jruby.ext.thread.Mutex.synchronize(Mutex.java:148)
org.jruby.ext.thread.Mutex$INVOKER$i$0$0$synchronize.call(Mutex$INVOKER$i$0$0$synchronize.gen)
org.jruby.internal.runtime.methods.JavaMethod$JavaMethodZeroBlock.call(JavaMethod.java:498)
org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:77)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:83)
org.jruby.ir.instructions.CallBase.interpret(CallBase.java:428)
org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:355)
org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:73)
org.jruby.internal.runtime.methods.MixedModeIRMethod.INTERPRET_METHOD(MixedModeIRMethod.java:109)
org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:95)
org.jruby.internal.runtime.methods.AliasMethod.call(AliasMethod.java:101)
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:298)
org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:79)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:83)
org.jruby.ir.instructions.CallBase.interpret(CallBase.java:428)
org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:355)
org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:73)
org.jruby.ir.interpreter.InterpreterEngine.interpret(InterpreterEngine.java:77)
org.jruby.internal.runtime.methods.MixedModeIRMethod.INTERPRET_METHOD(MixedModeIRMethod.java:144)
org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:130)
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:192)
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:318)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:131)
org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:339)
org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:73)
org.jruby.ir.interpreter.InterpreterEngine.interpret(InterpreterEngine.java:83)
org.jruby.internal.runtime.methods.MixedModeIRMethod.INTERPRET_METHOD(MixedModeIRMethod.java:179)
org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:165)
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:200)
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:338)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:163)
org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:314)
org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:73)
org.jruby.ir.interpreter.Interpreter.INTERPRET_BLOCK(Interpreter.java:132)
org.jruby.runtime.MixedModeIRBlockBody.commonYieldPath(MixedModeIRBlockBody.java:148)
org.jruby.runtime.IRBlockBody.doYield(IRBlockBody.java:186)
org.jruby.runtime.BlockBody.yield(BlockBody.java:116)
org.jruby.runtime.Block.yield(Block.java:165)
org.jruby.RubyArray.collect(RubyArray.java:2472)
org.jruby.RubyArray.map19(RubyArray.java:2486)
org.jruby.RubyArray$INVOKER$i$0$0$map19.call(RubyArray$INVOKER$i$0$0$map19.gen)
org.jruby.internal.runtime.methods.JavaMethod$JavaMethodZeroBlock.call(JavaMethod.java:498)
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:298)
org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:79)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:83)
org.jruby.ir.instructions.CallBase.interpret(CallBase.java:428)
org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:355)
org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:73)
org.jruby.ir.interpreter.InterpreterEngine.interpret(InterpreterEngine.java:89)
org.jruby.internal.runtime.methods.MixedModeIRMethod.INTERPRET_METHOD(MixedModeIRMethod.java:214)
org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:200)
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:208)
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:358)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:195)
org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:323)
org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:73)
org.jruby.ir.interpreter.InterpreterEngine.interpret(InterpreterEngine.java:77)
org.jruby.internal.runtime.methods.MixedModeIRMethod.INTERPRET_METHOD(MixedModeIRMethod.java:144)
org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:130)
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:192)
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:318)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:131)
org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:339)
org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:73)
org.jruby.ir.interpreter.InterpreterEngine.interpret(InterpreterEngine.java:77)
org.jruby.internal.runtime.methods.MixedModeIRMethod.INTERPRET_METHOD(MixedModeIRMethod.java:144)
org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:130)
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:192)
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:318)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:131)
org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:339)
org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:73)
org.jruby.ir.interpreter.InterpreterEngine.interpret(InterpreterEngine.java:89)
org.jruby.internal.runtime.methods.MixedModeIRMethod.INTERPRET_METHOD(MixedModeIRMethod.java:214)
org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:200)
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:368)
org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:205)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:209)
org.jruby.RubyClass.newInstance(RubyClass.java:1008)
org.jruby.RubyClass$INVOKER$i$newInstance.call(RubyClass$INVOKER$i$newInstance.gen)
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:208)
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:358)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:195)
org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:323)
org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:73)
org.jruby.ir.interpreter.InterpreterEngine.interpret(InterpreterEngine.java:89)
org.jruby.internal.runtime.methods.MixedModeIRMethod.INTERPRET_METHOD(MixedModeIRMethod.java:214)
org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:200)
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:368)
org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:205)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:209)
org.jruby.RubyClass.newInstance(RubyClass.java:1008)
org.jruby.RubyClass$INVOKER$i$newInstance.call(RubyClass$INVOKER$i$newInstance.gen)
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:208)
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:358)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:195)
org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:323)
org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:73)
org.jruby.internal.runtime.methods.MixedModeIRMethod.INTERPRET_METHOD(MixedModeIRMethod.java:109)
org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:95)
org.jruby.RubyMethod.call(RubyMethod.java:127)
org.jruby.RubyMethod$INVOKER$i$call.call(RubyMethod$INVOKER$i$call.gen)
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:298)
org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:79)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:83)
org.jruby.ir.instructions.CallBase.interpret(CallBase.java:428)
org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:355)
org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:73)
org.jruby.internal.runtime.methods.MixedModeIRMethod.INTERPRET_METHOD(MixedModeIRMethod.java:109)
org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:95)
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:298)
org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:79)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:83)
org.jruby.ir.instructions.CallBase.interpret(CallBase.java:428)
org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:355)
org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:73)
org.jruby.internal.runtime.methods.MixedModeIRMethod.INTERPRET_METHOD(MixedModeIRMethod.java:109)
org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:95)
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:298)
org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:79)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:83)
org.jruby.ir.instructions.CallBase.interpret(CallBase.java:428)
org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:355)
org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:73)
org.jruby.ir.interpreter.InterpreterEngine.interpret(InterpreterEngine.java:83)
org.jruby.internal.runtime.methods.MixedModeIRMethod.INTERPRET_METHOD(MixedModeIRMethod.java:179)
org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:165)
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:200)
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:338)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:163)
org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:314)
org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:73)
org.jruby.ir.interpreter.Interpreter.INTERPRET_BLOCK(Interpreter.java:132)
org.jruby.runtime.MixedModeIRBlockBody.commonYieldPath(MixedModeIRBlockBody.java:148)
org.jruby.runtime.IRBlockBody.doYield(IRBlockBody.java:186)
org.jruby.runtime.BlockBody.yield(BlockBody.java:116)
org.jruby.runtime.Block.yield(Block.java:165)
org.jruby.RubyKernel.tap(RubyKernel.java:1747)
org.jruby.RubyKernel$INVOKER$s$0$0$tap.call(RubyKernel$INVOKER$s$0$0$tap.gen)
org.jruby.internal.runtime.methods.JavaMethod$JavaMethodZeroBlock.call(JavaMethod.java:498)
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:298)
org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:79)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:83)
org.jruby.ir.instructions.CallBase.interpret(CallBase.java:428)
org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:355)
org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:73)
org.jruby.ir.interpreter.InterpreterEngine.interpret(InterpreterEngine.java:89)
org.jruby.internal.runtime.methods.MixedModeIRMethod.INTERPRET_METHOD(MixedModeIRMethod.java:214)
org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:200)
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:208)
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:358)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:195)
org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:323)
org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:73)
org.jruby.ir.interpreter.InterpreterEngine.interpret(InterpreterEngine.java:83)
org.jruby.internal.runtime.methods.MixedModeIRMethod.INTERPRET_METHOD(MixedModeIRMethod.java:179)
org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:165)
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:200)
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:338)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:163)
org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:314)
org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:73)
org.jruby.ir.interpreter.Interpreter.INTERPRET_BLOCK(Interpreter.java:132)
org.jruby.runtime.MixedModeIRBlockBody.commonYieldPath(MixedModeIRBlockBody.java:148)
org.jruby.runtime.IRBlockBody.doYield(IRBlockBody.java:193)
org.jruby.runtime.BlockBody.yield(BlockBody.java:125)
org.jruby.runtime.Block.yieldNonArray(Block.java:169)
org.jruby.RubyBasicObject.yieldUnder(RubyBasicObject.java:1751)
org.jruby.RubyBasicObject.instance_exec19(RubyBasicObject.java:1728)
org.jruby.RubyBasicObject$INVOKER$i$0$3$instance_exec19.call(RubyBasicObject$INVOKER$i$0$3$instance_exec19.gen)
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:204)
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:348)
org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:173)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:177)
org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:332)
org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:73)
org.jruby.ir.interpreter.InterpreterEngine.interpret(InterpreterEngine.java:77)
org.jruby.internal.runtime.methods.MixedModeIRMethod.INTERPRET_METHOD(MixedModeIRMethod.java:144)
org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:130)
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:192)
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:318)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:131)
org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:339)
org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:73)
org.jruby.ir.interpreter.Interpreter.INTERPRET_BLOCK(Interpreter.java:132)
org.jruby.runtime.MixedModeIRBlockBody.commonYieldPath(MixedModeIRBlockBody.java:148)
org.jruby.runtime.IRBlockBody.call(IRBlockBody.java:73)
org.jruby.runtime.Block.call(Block.java:124)
org.jruby.RubyProc.call(RubyProc.java:289)
org.jruby.RubyProc.call(RubyProc.java:246)
org.jruby.internal.runtime.RubyRunnable.run(RubyRunnable.java:104)
java.lang.Thread.run(Thread.java:745)
Tasks: TOP => check_write_permissions
```

I am using JRuby 9.1.12.0, Capistrano 3.8.2. I've anonymized the info, but the deployuser does have passwordless SSH access.

Any help is greatly appreciated.

答:
A search for org.jruby.ext.openssl.PKeyEC$Point.initialize(PKeyEC.java:845) turned up this: https://github.com/jruby/jruby-openssl/issues/105 which suggests this as a workaround:

Net::SSH::Transport::Algorithms::ALGORITHMS.values.each { |algs| algs.reject! { |a| a =~ /^ecd(sa|h)-sha2/ } }
Net::SSH::KnownHosts::SUPPORTED_TYPE.reject! { |t| t =~ /^ecd(sa|h)-sha2/ }
```

Does this help at all?

Body:
I'm seeing an NPE when trying to execute the check_write_permissions task from the Capistrano website.

The stage file itself is straightforward:

server "demo.ourapp.com", user: "deployuser", roles: %w{app db web}

set :branch, "dev"
set :deployment, "demo"
set :rails_env, "production"

role :app, "demo.ourapp.com"
role :web, "demo.ourapp.com"
role :db,  "demo.ourapp.com", :primary => true

set :repository,  "git@github.com:ouruser/ourapp.git"

set :deploy_to, "/opt/companyname/ourapp-demo"

set :puma_bind,       "unix://#{shared_path}/tmp/sockets/#{fetch(:application)}-puma.sock"
set :puma_state,      "#{shared_path}/tmp/pids/puma.state"
set :puma_pid,        "#{shared_path}/tmp/pids/puma.pid"
set :puma_access_log, "#{release_path}/log/puma.error.log"
set :puma_error_log,  "#{release_path}/log/puma.access.log"
set :puma_preload_app, true
set :puma_worker_timeout, nil

Upon executing bundle exec cap deploy this:stage check_write_permissions, I get the following error:

$ bundle exec cap this:stage check_write_permissions --trace                                       ‹jruby-9.1.12.0›
** Invoke this:stage (first_time)
** Execute this:stage
** Invoke load:defaults (first_time)
** Execute load:defaults
** Invoke bundler:map_bins (first_time)
** Execute bundler:map_bins
** Invoke deploy:set_rails_env (first_time)
** Execute deploy:set_rails_env
** Invoke deploy:set_linked_dirs (first_time)
** Execute deploy:set_linked_dirs
** Invoke deploy:set_rails_env
** Invoke check_write_permissions (first_time)
** Execute check_write_permissions
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as deployuser@demo.ourapp.com:
/Users/srdjan/.bundle/jruby/2.3.0/gems/sshkit-1.14.0/lib/sshkit/runners/parallel.rb:15:in `block in execute'
Java::JavaLang::NullPointerException:
org.jruby.ext.openssl.PKeyEC$Point.initialize(PKeyEC.java:845)
org.jruby.ext.openssl.PKeyEC$Point$INVOKER$i$0$0$initialize.call(PKeyEC$Point$INVOKER$i$0$0$initialize.gen)
org.jruby.internal.runtime.methods.JavaMethod$JavaMethodN.call(JavaMethod.java:725)
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:368)
org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:205)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:209)
org.jruby.RubyClass.newInstance(RubyClass.java:1008)
org.jruby.RubyClass$INVOKER$i$newInstance.call(RubyClass$INVOKER$i$newInstance.gen)
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:208)
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:358)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:195)
org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:323)
org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:73)
org.jruby.ir.interpreter.InterpreterEngine.interpret(InterpreterEngine.java:89)
org.jruby.internal.runtime.methods.MixedModeIRMethod.INTERPRET_METHOD(MixedModeIRMethod.java:214)
org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:200)
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:208)
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:358)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:195)
org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:323)
org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:73)
org.jruby.ir.interpreter.InterpreterEngine.interpret(InterpreterEngine.java:83)
org.jruby.internal.runtime.methods.MixedModeIRMethod.INTERPRET_METHOD(MixedModeIRMethod.java:179)
org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:165)
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:200)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:161)
org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:314)
org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:73)
org.jruby.ir.interpreter.InterpreterEngine.interpret(InterpreterEngine.java:77)
org.jruby.internal.runtime.methods.MixedModeIRMethod.INTERPRET_METHOD(MixedModeIRMethod.java:144)
org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:130)
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:192)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:129)
org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:339)
org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:73)
org.jruby.ir.interpreter.InterpreterEngine.interpret(InterpreterEngine.java:83)
org.jruby.internal.runtime.methods.MixedModeIRMethod.INTERPRET_METHOD(MixedModeIRMethod.java:179)
org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:165)
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:200)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:161)
org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:314)
org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:73)
org.jruby.internal.runtime.methods.MixedModeIRMethod.INTERPRET_METHOD(MixedModeIRMethod.java:109)
org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:95)
org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:77)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:83)
org.jruby.ir.instructions.CallBase.interpret(CallBase.java:428)
org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:355)
org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:73)
org.jruby.ir.interpreter.Interpreter.INTERPRET_BLOCK(Interpreter.java:132)
org.jruby.runtime.MixedModeIRBlockBody.commonYieldPath(MixedModeIRBlockBody.java:148)
org.jruby.runtime.IRBlockBody.doYield(IRBlockBody.java:186)
org.jruby.runtime.BlockBody.yield(BlockBody.java:116)
org.jruby.runtime.Block.yield(Block.java:165)
org.jruby.RubyIO.each_lineInternal(RubyIO.java:3282)
org.jruby.RubyIO.each_line(RubyIO.java:3295)
org.jruby.RubyIO$INVOKER$i$0$1$each_line.call(RubyIO$INVOKER$i$0$1$each_line.gen)
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:298)
org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:79)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:83)
org.jruby.ir.instructions.CallBase.interpret(CallBase.java:428)
org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:355)
org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:73)
org.jruby.ir.interpreter.Interpreter.INTERPRET_BLOCK(Interpreter.java:132)
org.jruby.runtime.MixedModeIRBlockBody.commonYieldPath(MixedModeIRBlockBody.java:148)
org.jruby.runtime.IRBlockBody.doYield(IRBlockBody.java:186)
org.jruby.runtime.BlockBody.yield(BlockBody.java:116)
org.jruby.runtime.Block.yield(Block.java:165)
org.jruby.RubyIO.ensureYieldClose(RubyIO.java:1163)
org.jruby.RubyIO.open(RubyIO.java:1156)
org.jruby.RubyIO$INVOKER$s$0$0$open.call(RubyIO$INVOKER$s$0$0$open.gen)
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:204)
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:348)
org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:173)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:177)
org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:332)
org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:73)
org.jruby.ir.interpreter.Interpreter.INTERPRET_BLOCK(Interpreter.java:132)
org.jruby.runtime.MixedModeIRBlockBody.commonYieldPath(MixedModeIRBlockBody.java:148)
org.jruby.runtime.IRBlockBody.yieldSpecific(IRBlockBody.java:84)
org.jruby.runtime.Block.yieldSpecific(Block.java:134)
org.jruby.ext.thread.Mutex.synchronize(Mutex.java:148)
org.jruby.ext.thread.Mutex$INVOKER$i$0$0$synchronize.call(Mutex$INVOKER$i$0$0$synchronize.gen)
org.jruby.internal.runtime.methods.JavaMethod$JavaMethodZeroBlock.call(JavaMethod.java:498)
org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:77)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:83)
org.jruby.ir.instructions.CallBase.interpret(CallBase.java:428)
org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:355)
org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:73)
org.jruby.internal.runtime.methods.MixedModeIRMethod.INTERPRET_METHOD(MixedModeIRMethod.java:109)
org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:95)
org.jruby.internal.runtime.methods.AliasMethod.call(AliasMethod.java:101)
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:298)
org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:79)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:83)
org.jruby.ir.instructions.CallBase.interpret(CallBase.java:428)
org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:355)
org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:73)
org.jruby.ir.interpreter.InterpreterEngine.interpret(InterpreterEngine.java:77)
org.jruby.internal.runtime.methods.MixedModeIRMethod.INTERPRET_METHOD(MixedModeIRMethod.java:144)
org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:130)
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:192)
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:318)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:131)
org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:339)
org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:73)
org.jruby.ir.interpreter.InterpreterEngine.interpret(InterpreterEngine.java:83)
org.jruby.internal.runtime.methods.MixedModeIRMethod.INTERPRET_METHOD(MixedModeIRMethod.java:179)
org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:165)
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:200)
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:338)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:163)
org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:314)
org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:73)
org.jruby.ir.interpreter.Interpreter.INTERPRET_BLOCK(Interpreter.java:132)
org.jruby.runtime.MixedModeIRBlockBody.commonYieldPath(MixedModeIRBlockBody.java:148)
org.jruby.runtime.IRBlockBody.doYield(IRBlockBody.java:186)
org.jruby.runtime.BlockBody.yield(BlockBody.java:116)
org.jruby.runtime.Block.yield(Block.java:165)
org.jruby.RubyArray.collect(RubyArray.java:2472)
org.jruby.RubyArray.map19(RubyArray.java:2486)
org.jruby.RubyArray$INVOKER$i$0$0$map19.call(RubyArray$INVOKER$i$0$0$map19.gen)
org.jruby.internal.runtime.methods.JavaMethod$JavaMethodZeroBlock.call(JavaMethod.java:498)
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:298)
org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:79)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:83)
org.jruby.ir.instructions.CallBase.interpret(CallBase.java:428)
org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:355)
org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:73)
org.jruby.ir.interpreter.InterpreterEngine.interpret(InterpreterEngine.java:89)
org.jruby.internal.runtime.methods.MixedModeIRMethod.INTERPRET_METHOD(MixedModeIRMethod.java:214)
org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:200)
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:208)
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:358)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:195)
org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:323)
org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:73)
org.jruby.ir.interpreter.InterpreterEngine.interpret(InterpreterEngine.java:77)
org.jruby.internal.runtime.methods.MixedModeIRMethod.INTERPRET_METHOD(MixedModeIRMethod.java:144)
org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:130)
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:192)
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:318)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:131)
org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:339)
org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:73)
org.jruby.ir.interpreter.InterpreterEngine.interpret(InterpreterEngine.java:77)
org.jruby.internal.runtime.methods.MixedModeIRMethod.INTERPRET_METHOD(MixedModeIRMethod.java:144)
org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:130)
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:192)
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:318)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:131)
org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:339)
org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:73)
org.jruby.ir.interpreter.InterpreterEngine.interpret(InterpreterEngine.java:89)
org.jruby.internal.runtime.methods.MixedModeIRMethod.INTERPRET_METHOD(MixedModeIRMethod.java:214)
org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:200)
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:368)
org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:205)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:209)
org.jruby.RubyClass.newInstance(RubyClass.java:1008)
org.jruby.RubyClass$INVOKER$i$newInstance.call(RubyClass$INVOKER$i$newInstance.gen)
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:208)
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:358)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:195)
org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:323)
org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:73)
org.jruby.ir.interpreter.InterpreterEngine.interpret(InterpreterEngine.java:89)
org.jruby.internal.runtime.methods.MixedModeIRMethod.INTERPRET_METHOD(MixedModeIRMethod.java:214)
org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:200)
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:368)
org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:205)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:209)
org.jruby.RubyClass.newInstance(RubyClass.java:1008)
org.jruby.RubyClass$INVOKER$i$newInstance.call(RubyClass$INVOKER$i$newInstance.gen)
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:208)
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:358)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:195)
org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:323)
org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:73)
org.jruby.internal.runtime.methods.MixedModeIRMethod.INTERPRET_METHOD(MixedModeIRMethod.java:109)
org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:95)
org.jruby.RubyMethod.call(RubyMethod.java:127)
org.jruby.RubyMethod$INVOKER$i$call.call(RubyMethod$INVOKER$i$call.gen)
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:298)
org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:79)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:83)
org.jruby.ir.instructions.CallBase.interpret(CallBase.java:428)
org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:355)
org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:73)
org.jruby.internal.runtime.methods.MixedModeIRMethod.INTERPRET_METHOD(MixedModeIRMethod.java:109)
org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:95)
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:298)
org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:79)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:83)
org.jruby.ir.instructions.CallBase.interpret(CallBase.java:428)
org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:355)
org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:73)
org.jruby.internal.runtime.methods.MixedModeIRMethod.INTERPRET_METHOD(MixedModeIRMethod.java:109)
org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:95)
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:298)
org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:79)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:83)
org.jruby.ir.instructions.CallBase.interpret(CallBase.java:428)
org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:355)
org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:73)
org.jruby.ir.interpreter.InterpreterEngine.interpret(InterpreterEngine.java:83)
org.jruby.internal.runtime.methods.MixedModeIRMethod.INTERPRET_METHOD(MixedModeIRMethod.java:179)
org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:165)
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:200)
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:338)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:163)
org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:314)
org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:73)
org.jruby.ir.interpreter.Interpreter.INTERPRET_BLOCK(Interpreter.java:132)
org.jruby.runtime.MixedModeIRBlockBody.commonYieldPath(MixedModeIRBlockBody.java:148)
org.jruby.runtime.IRBlockBody.doYield(IRBlockBody.java:186)
org.jruby.runtime.BlockBody.yield(BlockBody.java:116)
org.jruby.runtime.Block.yield(Block.java:165)
org.jruby.RubyKernel.tap(RubyKernel.java:1747)
org.jruby.RubyKernel$INVOKER$s$0$0$tap.call(RubyKernel$INVOKER$s$0$0$tap.gen)
org.jruby.internal.runtime.methods.JavaMethod$JavaMethodZeroBlock.call(JavaMethod.java:498)
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:298)
org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:79)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:83)
org.jruby.ir.instructions.CallBase.interpret(CallBase.java:428)
org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:355)
org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:73)
org.jruby.ir.interpreter.InterpreterEngine.interpret(InterpreterEngine.java:89)
org.jruby.internal.runtime.methods.MixedModeIRMethod.INTERPRET_METHOD(MixedModeIRMethod.java:214)
org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:200)
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:208)
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:358)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:195)
org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:323)
org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:73)
org.jruby.ir.interpreter.InterpreterEngine.interpret(InterpreterEngine.java:83)
org.jruby.internal.runtime.methods.MixedModeIRMethod.INTERPRET_METHOD(MixedModeIRMethod.java:179)
org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:165)
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:200)
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:338)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:163)
org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:314)
org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:73)
org.jruby.ir.interpreter.Interpreter.INTERPRET_BLOCK(Interpreter.java:132)
org.jruby.runtime.MixedModeIRBlockBody.commonYieldPath(MixedModeIRBlockBody.java:148)
org.jruby.runtime.IRBlockBody.doYield(IRBlockBody.java:193)
org.jruby.runtime.BlockBody.yield(BlockBody.java:125)
org.jruby.runtime.Block.yieldNonArray(Block.java:169)
org.jruby.RubyBasicObject.yieldUnder(RubyBasicObject.java:1751)
org.jruby.RubyBasicObject.instance_exec19(RubyBasicObject.java:1728)
org.jruby.RubyBasicObject$INVOKER$i$0$3$instance_exec19.call(RubyBasicObject$INVOKER$i$0$3$instance_exec19.gen)
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:204)
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:348)
org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:173)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:177)
org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:332)
org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:73)
org.jruby.ir.interpreter.InterpreterEngine.interpret(InterpreterEngine.java:77)
org.jruby.internal.runtime.methods.MixedModeIRMethod.INTERPRET_METHOD(MixedModeIRMethod.java:144)
org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:130)
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:192)
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:318)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:131)
org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:339)
org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:73)
org.jruby.ir.interpreter.Interpreter.INTERPRET_BLOCK(Interpreter.java:132)
org.jruby.runtime.MixedModeIRBlockBody.commonYieldPath(MixedModeIRBlockBody.java:148)
org.jruby.runtime.IRBlockBody.call(IRBlockBody.java:73)
org.jruby.runtime.Block.call(Block.java:124)
org.jruby.RubyProc.call(RubyProc.java:289)
org.jruby.RubyProc.call(RubyProc.java:246)
org.jruby.internal.runtime.RubyRunnable.run(RubyRunnable.java:104)
java.lang.Thread.run(Thread.java:745)
Tasks: TOP => check_write_permissions

I am using JRuby 9.1.12.0, Capistrano 3.8.2. I've anonymized the info, but the deployuser does have passwordless SSH access.

Any help is greatly appreciated.

Body:
A search for org.jruby.ext.openssl.PKeyEC$Point.initialize(PKeyEC.java:845) turned up this: https://github.com/jruby/jruby-openssl/issues/105 which suggests this as a workaround:

Net::SSH::Transport::Algorithms::ALGORITHMS.values.each { |algs| algs.reject! { |a| a =~ /^ecd(sa|h)-sha2/ } }
Net::SSH::KnownHosts::SUPPORTED_TYPE.reject! { |t| t =~ /^ecd(sa|h)-sha2/ }

Does this help at all?


来源: stackexchange

问:
Can Game Center Track total time played?
Curious to know if Game Center tracks total time played per app? If it does, how could I easily query this data?

Thanks!

答:
No, you cannot use game center to do this. There are a couple of options though.

You can track it locally, and then upload the data to a game center leaderboard. I don't know if you want to do that though because then everyone can see how much a certain player has played

You can use some sort of analytics service, like Google Analytics and ping it periodically while a player is on the app so you can see how much people are playing

Or you can set up a server and database, where the player sends their play time when they are on the app

ContentLicense: CC BY-SA 3.0


问:
ul li elements have more space in between in IE than firefox
I am facing interoperability issues in IE7 and Firefox. li elements height is somewhat more in IE than Firefox.

Here is the attached image for more clarity.

http://img225.imageshack.us/i/interop.jpg/

Code for html and CSS:

```<code><ul class="sa-progress">
<li class="sa-progress-current"><span id="intro_idx" >Select VPN Type</span></li>
<li class="sa-progress-default"><span id="local_idx" >Local</span></li>
<li class="sa-progress-default"><span id="remote_idx" >Remote</span></li>
<li class="sa-progress-default"><span id="vpn_idx" >VPN</span></li>
<li class="sa-progress-default"><span id="remote_dyn_idx" >Remote Users</span></li>
<li class="sa-progress-default"><span id="traffic_idx" >Traffic Profile</span></li>
<li class="sa-progress-default"><span id="review_idx" >Review & Commit</span></li>
</ul>

ul.sa-progress {
    color: #333333;
    line-height: normal;
    padding: 7px 0 10px 10px;
}
ul.sa-progress {
    font-size: 12px;
}
</code>```

Please let me know what am missing here.
Any help would be greatly appreciated.

Thanks

答:
ul/li is one of the more common cross browser differences that crop up as they both have different interpretations of their default rules.

You should look into using a css reset sheet to start off with such as:

http://developer.yahoo.com/yui/3/cssreset/

This will apply consistent base rules to your formatting so that all browsers have a fair chance at matching.

Because you didn't start out with this reset stylesheet and then build your design on top of it you might find that applying it will make several other elements go a bit different when they react to the new defaults. I would say its better to fix these so they look right with the reset sheet and then you will have a consistent baseline to work from.

After that you still might have problems but from the css you have posted I think there are some more parts to it such as the double line spacing you have in some menu items.

If you are going to make these into menu items then a common way that I approach this kind of styling is to make the a tags display: block; and then work my spacings out from that. Try to keep your ul li stylings as lightweight as possible and work with other items you have (such as the container div for the menu and the anchor tags for the links).

Body:
I am facing interoperability issues in IE7 and Firefox. li elements height is somewhat more in IE than Firefox.

Here is the attached image for more clarity.

http://img225.imageshack.us/i/interop.jpg/

Code for html and CSS:

Select VPN Type

Local

Remote

VPN

Remote Users

Traffic Profile

Review & Commit

ul.sa-progress {
    color: #333333;
    line-height: normal;
    padding: 7px 0 10px 10px;
}
ul.sa-progress {
    font-size: 12px;
}

Please let me know what am missing here.
Any help would be greatly appreciated.

Thanks

ContentLicense: CC BY-SA 2.5


问:
Possible to reference previous query in new select query?
If i just created a select query and want to use the new data in a new query do I reference the previously created query as the FROM in a new select query? The query I just created in my database is listed as SQLQuery1.sql so is that what I put as the FROM for the new query?

答:
I would use CTE (Common Table Expression).

Have a look at the following code:

```<code>WITH MainQuery
AS
(
    select col1, col2, col3
    from dbo.TableName
)

select a.col1, a.col2, a.col3, b.col1
from MainQuery as a
join someotherdata as b
on a.col1 = b.col1;
</code>```

Body:
I would use CTE (Common Table Expression).

Have a look at the following code:

WITH MainQuery
AS
(
    select col1, col2, col3
    from dbo.TableName
)

select a.col1, a.col2, a.col3, b.col1
from MainQuery as a
join someotherdata as b
on a.col1 = b.col1;


问:
python3 sort object list by attr same values
I have a problem with my sorting method.

This is my object contained in list:
Address class, with city attribute

My list looklike (simplified) :

```<code>[Address('Paris'), Address('Denver'), Address('Paris'), Address('Test'), Address('Denver')]
</code>```

For this example, i have two duplicates cities: Paris and Denver,

I want to have a result like:

```<code>[Address('Devenr'), Address('Denver'), Address('Paris'), Address('Paris'), Address('Test')]
</code>```

Sorted by duplicates count, and in case of same number, by alphanumeric order.

I tried:

```<code>self.dictionnary.sort(key=lambda address: len([x for x in self.dictionnary if address.city == x.city]))
</code>```

By this don't work...

Can anyone help me?

Thank you in advance !

答:
The problem is that paris and denver both have count 2 so they don't get sorted.

If you add the string to the sort so ties are broken lexically it should work

Example:

```<code>from collections import Counter

l = ['a', 'b', 'a', 'b', 'c']
c = Counter(l)
l.sort(key=lambda x : -c[x])
# l is unchanged
l.sort(key=lambda x : (-c[x],x))
# l is ['a', 'a', 'b', 'b', 'c']
</code>```

edit: Mark's solution uses a counter which is much better than recounting every time.  I am going to steal that Idea

Body:
I have a problem with my sorting method.

This is my object contained in list:
Address class, with city attribute

My list looklike (simplified) :

[Address('Paris'), Address('Denver'), Address('Paris'), Address('Test'), Address('Denver')]

For this example, i have two duplicates cities: Paris and Denver,

I want to have a result like:

[Address('Devenr'), Address('Denver'), Address('Paris'), Address('Paris'), Address('Test')]

Sorted by duplicates count, and in case of same number, by alphanumeric order.

I tried:

self.dictionnary.sort(key=lambda address: len([x for x in self.dictionnary if address.city == x.city]))

By this don't work...

Can anyone help me?

Thank you in advance !

Body:
The problem is that paris and denver both have count 2 so they don't get sorted.

If you add the string to the sort so ties are broken lexically it should work

Example:

from collections import Counter

l = ['a', 'b', 'a', 'b', 'c']
c = Counter(l)
l.sort(key=lambda x : -c[x])
# l is unchanged
l.sort(key=lambda x : (-c[x],x))
# l is ['a', 'a', 'b', 'b', 'c']

edit: Mark's solution uses a counter which is much better than recounting every time.  I am going to steal that Idea


问:
Pandas Get Other Row in Group
Given the following DataFrame:

```<code>import pandas as pd
import numpy as np
d=pd.DataFrame({' ID':[1,1,1,1,2,2,2,2],
                'Benefit':['M','M','M','M','M','M','M','M'],
               'CED':[1,2,3,4,1,2,3,4],
               'CTD':[np.nan,np.nan,7,8,np.nan,np.nan,np.nan,np.nan],
               'CED_Rank':[4,3,2,1,4,3,2,1],
               'CED_Max':[4,4,4,4,4,4,4,4]})
d
    ID  Benefit     CED     CED_Max     CED_Rank    CTD
0   1         M       1           4           4     NaN
1   1         M       2           4           3     NaN
2   1         M       3           4           2     7
3   1         M       4           4           1     8
4   2         M       1           4           4     NaN
5   2         M       2           4           3     NaN
6   2         M       3           4           2     NaN
7   2         M       4           4           1     NaN
</code>```

CED_Max is the maximum CED value per group for ID and Benefit.

CED_Rank is the ranking of the CED value per group for ID and Benefit.

I would like to use the following conditions to update NaN values in the "CTD" column:
Within a row for a given ID and Benefit grouping:

if the CTD is null and

The CED is not equal to CED_Max

...then:

CTD should be equal to the CED of row with the next-highest CED_Rank value (highest rank = 1).

Here is the desired result:

```<code>    ID  Benefit     CED     CED_Max     CED_Rank    CTD
0   1         M       1           4           4     2
1   1         M       2           4           3     3
2   1         M       3           4           2     7
3   1         M       4           4           1     8
4   2         M       1           4           4     2
5   2         M       2           4           3     3
6   2         M       3           4           2     4
7   2         M       4           4           1     NaN
</code>```

Thanks in advance!

答:
Try this .</p>

```<code>d['CTD']=d.groupby('ID')['CTD'].fillna(d.CED.shift(-1))
# for The CED is not equal to CED_Max
# d.CTD[d.CED==(d.CED_Max)&d.CTD.isnull()]=np.nan or d['CTD']=np.where(d.CED==(d.CED_Max)&d.CTD.isnull(), np.nan, d.CTD)

Out[42]:
  Benefit  CED  CED_Max  CED_Rank  CTD  ID
0       M    1        4         4  2.0   1
1       M    2        4         3  3.0   1
2       M    3        4         2  7.0   1
3       M    4        4         1  8.0   1
4       M    1        4         4  2.0   2
5       M    2        4         3  3.0   2
6       M    3        4         2  4.0   2
7       M    4        4         1  NaN   2
</code>```

Title: Pandas Get Other Row in Group

Body:
Given the following DataFrame:

import pandas as pd
import numpy as np
d=pd.DataFrame({' ID':[1,1,1,1,2,2,2,2],
                'Benefit':['M','M','M','M','M','M','M','M'],
               'CED':[1,2,3,4,1,2,3,4],
               'CTD':[np.nan,np.nan,7,8,np.nan,np.nan,np.nan,np.nan],
               'CED_Rank':[4,3,2,1,4,3,2,1],
               'CED_Max':[4,4,4,4,4,4,4,4]})
d
    ID  Benefit     CED     CED_Max     CED_Rank    CTD
0   1         M       1           4           4     NaN
1   1         M       2           4           3     NaN
2   1         M       3           4           2     7
3   1         M       4           4           1     8
4   2         M       1           4           4     NaN
5   2         M       2           4           3     NaN
6   2         M       3           4           2     NaN
7   2         M       4           4           1     NaN

CED_Max is the maximum CED value per group for ID and Benefit.

CED_Rank is the ranking of the CED value per group for ID and Benefit.

I would like to use the following conditions to update NaN values in the "CTD" column:
Within a row for a given ID and Benefit grouping:

if the CTD is null and

The CED is not equal to CED_Max

...then:

CTD should be equal to the CED of row with the next-highest CED_Rank value (highest rank = 1).

Here is the desired result:

    ID  Benefit     CED     CED_Max     CED_Rank    CTD
0   1         M       1           4           4     2
1   1         M       2           4           3     3
2   1         M       3           4           2     7
3   1         M       4           4           1     8
4   2         M       1           4           4     2
5   2         M       2           4           3     3
6   2         M       3           4           2     4
7   2         M       4           4           1     NaN

Thanks in advance!

Body:
Try this .

d['CTD']=d.groupby('ID')['CTD'].fillna(d.CED.shift(-1))
# for The CED is not equal to CED_Max
# d.CTD[d.CED==(d.CED_Max)&d.CTD.isnull()]=np.nan or d['CTD']=np.where(d.CED==(d.CED_Max)&d.CTD.isnull(), np.nan, d.CTD)

Out[42]:
  Benefit  CED  CED_Max  CED_Rank  CTD  ID
0       M    1        4         4  2.0   1
1       M    2        4         3  3.0   1
2       M    3        4         2  7.0   1
3       M    4        4         1  8.0   1
4       M    1        4         4  2.0   2
5       M    2        4         3  3.0   2
6       M    3        4         2  4.0   2
7       M    4        4         1  NaN   2


问:
how to "reimport" module to python then code be changed after import
I have a foo.py

```<code>def foo():
    print "test"
</code>```

In IPython I use:

```<code>In [6]:  import foo
In [7]:  foo.foo()
test
</code>```

Then I changed the foo() to:

```<code>def foo():
    print "test changed"
</code>```

In IPython, the result for invoking is still test:

```<code>In [10]:  import foo
In [11]:  foo.foo()
test
</code>```

Then I use:

```<code>In [15]: del foo
In [16]:  import foo
In [17]:  foo.foo()
test
</code>```

I delete the foo.pyc in same folder foo.py exists, but still no luck.

May I know how to reimport the updated code in runtime?

答:
IPython3's autoreload feature works just right.

I am using the actual example from the webpage. First load the 'autoreload' feature.

```<code>In []: %load_ext autoreload
In []: %autoreload 2
</code>```

Then import the module you want to test:

```<code>In []: import foo
In []: foo.some_function()
Out[]: 42
</code>```

Open foo.py in an editor and change some_function to return 43

```<code>In []: foo.some_function()
Out[]: 43
</code>```

It also works if you import the function directly.

```<code>In []: from foo import some_function
In []: some_function()
Out[]: 42
</code>```

Make change in some_function to return 43.

```<code>In []: some_function()
Out[]: 43
</code>```

Body:
I have a foo.py

def foo():
    print "test"

In IPython I use:

In [6]:  import foo
In [7]:  foo.foo()
test

Then I changed the foo() to:

def foo():
    print "test changed"

In IPython, the result for invoking is still test:

In [10]:  import foo
In [11]:  foo.foo()
test

Then I use:

In [15]: del foo
In [16]:  import foo
In [17]:  foo.foo()
test

I delete the foo.pyc in same folder foo.py exists, but still no luck.

May I know how to reimport the updated code in runtime?

Body:
IPython3's autoreload feature works just right.

I am using the actual example from the webpage. First load the 'autoreload' feature.

In []: %load_ext autoreload
In []: %autoreload 2

Then import the module you want to test:

In []: import foo
In []: foo.some_function()
Out[]: 42

Open foo.py in an editor and change some_function to return 43

In []: foo.some_function()
Out[]: 43

It also works if you import the function directly.

In []: from foo import some_function
In []: some_function()
Out[]: 42

Make change in some_function to return 43.

In []: some_function()
Out[]: 43


问:
WPF Label Justify & Distribute Text
I have a Label just displaying a title.

How can I justify the text? and how can I distribute the text? Can I use a label or do I have to use another control?

答:
Label doesn't have any text alignment property, however TextBlock does have text alignment properties so you can use justify if that's what you're looking for:

```<code><TextBlock TextAlignment="Justify" />
</code>```

Title: WPF Label Justify & Distribute Text

Body:
Label doesn't have any text alignment property, however TextBlock does have text alignment properties so you can use justify if that's what you're looking for:

<TextBlock TextAlignment="Justify" />


问:
How to show left drawable in AppCompatEditText with passwordToggleEnabled?
I have an AppCompatEditText when add passwordToggleEnabled="true" my left drawable dissapears. What could be the reason ?

Password EditText Code :

```<code><android.support.design.widget.TextInputLayout
        app:passwordToggleEnabled="true"
        android:layout_height="wrap_content"
        android:layout_width="match_parent"
        android:layout_marginBottom="8dp"
        android:layout_marginTop="8dp"
        app:hintEnabled="false"
        app:passwordToggleEnabled="true">
            <android.support.v7.widget.AppCompatEditText
                android:id="@+id/input_password"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:drawablePadding="20dp"
                android:inputType="textPassword"
                android:hint="@string/password_hint"
                android:paddingLeft="15dp"
                android:theme="@style/EditTextTheme"/>
</android.support.design.widget.TextInputLayout>
</code>```

EditText drawable code:

```<code>_passwordEditText.setCompoundDrawablesWithIntrinsicBounds(passwordIcon, null, null, null);
</code>```

With app:passwordToggleEnabled="true" :

Without it:

Edit: I am able to set drawables on top and bottom but it doesn't work for left and right.

答:
Try this, instead of setting null to the existing drawable, get the drawable's and set yours on the left.

```<code>Drawable[] drawables = _passwordEditText.getCompoundDrawables();

_passwordEditText.setCompoundDrawablesWithIntrinsicBounds(passwordIcon, drawables[1], drawables[2], drawables[3]);
</code>```

(Source: example "Icon or button inside Custom Edit Text and its action and click listeners" from Stack Overflow Documentation; copyright 2017 by Muthukrishnan Rajendran; licensed under CC BY-SA 3.0. An archive of the full Stack Overflow Documentation content can be found at archive.org, in which this example is indexed by topic ID 5843 and example ID 32126.)

Body:
I have an AppCompatEditText when add passwordToggleEnabled="true" my left drawable dissapears. What could be the reason ?

Password EditText Code :

<android.support.design.widget.TextInputLayout
        app:passwordToggleEnabled="true"
        android:layout_height="wrap_content"
        android:layout_width="match_parent"
        android:layout_marginBottom="8dp"
        android:layout_marginTop="8dp"
        app:hintEnabled="false"
        app:passwordToggleEnabled="true">
            <android.support.v7.widget.AppCompatEditText
                android:id="@+id/input_password"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:drawablePadding="20dp"
                android:inputType="textPassword"
                android:hint="@string/password_hint"
                android:paddingLeft="15dp"
                android:theme="@style/EditTextTheme"/>
</android.support.design.widget.TextInputLayout>

EditText drawable code:

_passwordEditText.setCompoundDrawablesWithIntrinsicBounds(passwordIcon, null, null, null);

With app:passwordToggleEnabled="true" :

Without it:

Edit: I am able to set drawables on top and bottom but it doesn't work for left and right.

Body:
Try this, instead of setting null to the existing drawable, get the drawable's and set yours on the left.

Drawable[] drawables = _passwordEditText.getCompoundDrawables();

_passwordEditText.setCompoundDrawablesWithIntrinsicBounds(passwordIcon, drawables[1], drawables[2], drawables[3]);

(Source: example "Icon or button inside Custom Edit Text and its action and click listeners" from Stack Overflow Documentation; copyright 2017 by Muthukrishnan Rajendran; licensed under CC BY-SA 3.0. An archive of the full Stack Overflow Documentation content can be found at archive.org, in which this example is indexed by topic ID 5843 and example ID 32126.)


问:
getting one value from array output using ajax
My array:

```<code>result = {"ids":[{"tid":"121"}],"tid":[{"tid":"121"}]}
</code>```

I want to display the value of tid inside ids and tid inside tid using ajax but I don't know how to do it. I have tried result.val(result.ids.tid) but that gives me undefined. I have also tried result.val(result.ids["tid"]) with and without quotes on tid but it still doesn't work.

Does anyone know how I can get the output of 121 from the result array?

答:
You have an object that contains arrays of objects. You should reference the array index to get to the object inside the array.

result.ids[0].tid

Body:
My array:

result = {"ids":[{"tid":"121"}],"tid":[{"tid":"121"}]}

I want to display the value of tid inside ids and tid inside tid using ajax but I don't know how to do it. I have tried result.val(result.ids.tid) but that gives me undefined. I have also tried result.val(result.ids["tid"]) with and without quotes on tid but it still doesn't work.

Does anyone know how I can get the output of 121 from the result array?


问:
How can i Query Google Analytics into S3
The idea is to query with a python script google analytics and insert into an S3 amazon bucket. I already have both but i would like to make this more automatic and let the script run every day from a server. I was looking to use another AWS to do it for me but i can't figure out which one.

In lambda i find i couldn't upload the .json with the credential to authenticate the Google APIs, do you know what service i should use?

Since the final idea is to create a Data Warehouse in redshift I'm trying to stay away from google services.

答:
You can use AWS Lambda Scheduled events for this. Also you can include the Google Access Credentials in environmental variables and access them inside Lambda, so that it is not available outside. You should be able to use Google Analytics API SDK for JavaScript to write it in NodeJS.

Note: Make sure your Lambda execution role has access to the S3 bucket.


问:
Dynamic if Condition from any class In Unity
I want to create a dynamic conditional statement.

```<code>class Condition
{
    targetObject;   //Class or Struct or anythings..
    targetMemberVariable;  //the Member in targetObject

    conditionFilter;
    //It depends on the type of targetMemberVariable.
    //targetMemberVariable is Float type,
    //then conditionFilter automatically becomes a Float type.
    //No need to change it in "Inspector"

    comparisonValue;
    //This is based on the type of conditionFilter.
    //If it is a float type, the "Inspector" takes a float as its value.

    Public bool CheckCondition(object targetObject)
    {
        //It checks with the above information and returns a true value.
        return true or false;
    }
}
</code>```

I want to get the Unity Editor or C # library keywords.

The intention is to create something like the above.

Interactive elements in the game are likely to change.

In-game elements can be expanded or added.

I do not want to modify conditional statements for each change or extension.

example

ex1
ex2
I remember seeing the library used in dynamic compilation in C # or after adding classes during execution.

Of course I know that dynamic is not universal.
I want to do something like the validation of StarCraft Galaxy Editor.

Here is a game example

```<code>[Bleeding shot]
Give 10 damage to enemies.
If the enemy's Health is below 20, it adds 10 damage.

unit,health,amount,<=(below)
true-> adds 10 damage.
false -> none.

[Hooking]
If the enemy is enemy, it gives 5 damage and pulls to the front.
If the target is ally, pull to the front and reduce cooldown to 5 seconds.

unit,Tag,Enemy(enum),==
true-> 5 damage and pulls to the front.
false-> pull to the front and reduce cooldown to 5 seconds.

[Healing the Moon]
Heal the target by 10.
If the current time is night, heal 10 more.

GameTimer,DayNight(Enum),Night,==
true->heal 10 more.
</code>```

答:
Making this generic would probably help since the type being tested varies. This way your CheckCondition method is type safe.

You could start with just the interface. Down the road you might want a condition that's more complex than just comparing a particular member to some threshold.

```<code>public interface ICondition<T>
{
    bool CheckCondition(T subject);
}
</code>```

I suspect that in most cases you'll find it easier to just check the condition explicitly than to store member information in the class an use reflection.

For example,

```<code>public class SomeClass
{
    public int Value { get; set; }
}

public class MinimumValueCondition : ICondition<SomeClass>
{
    public bool CheckCondition(SomeClass subject)
    {
        return subject.Value > 5;
    }
}
</code>```

It's really easy to read, no reflection required. If some data required to evaluate the condition is variable, you could pass it in.

```<code>public class MinimumValueCondition : ICondition<SomeClass>
{
    private readonly int _minimumValue;

    public MinimumValueCondition(int minimumValue)
    {
        _minimumValue = minimumValue;
    }

    public bool CheckCondition(SomeClass subject)
    {
        return subject.Value >= _minimumValue;
    }
}
</code>```

You could also write a condition that takes a function as an argument.

```<code>public class Condition<T> : ICondition<T>
{
    private readonly Func<T, bool> _conditionFunction;

    public Condition(Func<T, bool> conditionFunction)
    {
        _conditionFunction = conditionFunction;
    }

    public bool CheckCondition(T subject)
    {
        return _conditionFunction(subject);
    }
}
</code>```

That way you could create a Condition from an expression or method.

```<code>var notZeroCondition = new Condition<SomeClass>(subject => subject.Value != 0);
var someOtherCondition = new Condition<SomeClass>(SomeEvaluationMethod);
</code>```

Body:
I want to create a dynamic conditional statement.

class Condition
{
    targetObject;   //Class or Struct or anythings..
    targetMemberVariable;  //the Member in targetObject

    conditionFilter;
    //It depends on the type of targetMemberVariable.
    //targetMemberVariable is Float type,
    //then conditionFilter automatically becomes a Float type.
    //No need to change it in "Inspector"

    comparisonValue;
    //This is based on the type of conditionFilter.
    //If it is a float type, the "Inspector" takes a float as its value.

    Public bool CheckCondition(object targetObject)
    {
        //It checks with the above information and returns a true value.
        return true or false;
    }
}

I want to get the Unity Editor or C # library keywords.

The intention is to create something like the above.

Interactive elements in the game are likely to change.

In-game elements can be expanded or added.

I do not want to modify conditional statements for each change or extension.

example

ex1
ex2
I remember seeing the library used in dynamic compilation in C # or after adding classes during execution.

Of course I know that dynamic is not universal.
I want to do something like the validation of StarCraft Galaxy Editor.

Here is a game example

[Bleeding shot]
Give 10 damage to enemies.
If the enemy's Health is below 20, it adds 10 damage.

unit,health,amount,<=(below)
true-> adds 10 damage.
false -> none.

[Hooking]
If the enemy is enemy, it gives 5 damage and pulls to the front.
If the target is ally, pull to the front and reduce cooldown to 5 seconds.

unit,Tag,Enemy(enum),==
true-> 5 damage and pulls to the front.
false-> pull to the front and reduce cooldown to 5 seconds.

[Healing the Moon]
Heal the target by 10.
If the current time is night, heal 10 more.

GameTimer,DayNight(Enum),Night,==
true->heal 10 more.

Body:
Making this generic would probably help since the type being tested varies. This way your CheckCondition method is type safe.

You could start with just the interface. Down the road you might want a condition that's more complex than just comparing a particular member to some threshold.

public interface ICondition<T>
{
    bool CheckCondition(T subject);
}

I suspect that in most cases you'll find it easier to just check the condition explicitly than to store member information in the class an use reflection.

For example,

public class SomeClass
{
    public int Value { get; set; }
}

public class MinimumValueCondition : ICondition<SomeClass>
{
    public bool CheckCondition(SomeClass subject)
    {
        return subject.Value > 5;
    }
}

It's really easy to read, no reflection required. If some data required to evaluate the condition is variable, you could pass it in.

public class MinimumValueCondition : ICondition<SomeClass>
{
    private readonly int _minimumValue;

    public MinimumValueCondition(int minimumValue)
    {
        _minimumValue = minimumValue;
    }

    public bool CheckCondition(SomeClass subject)
    {
        return subject.Value >= _minimumValue;
    }
}

You could also write a condition that takes a function as an argument.

public class Condition<T> : ICondition<T>
{
    private readonly Func<T, bool> _conditionFunction;

    public Condition(Func<T, bool> conditionFunction)
    {
        _conditionFunction = conditionFunction;
    }

    public bool CheckCondition(T subject)
    {
        return _conditionFunction(subject);
    }
}

That way you could create a Condition from an expression or method.

var notZeroCondition = new Condition<SomeClass>(subject => subject.Value != 0);
var someOtherCondition = new Condition<SomeClass>(SomeEvaluationMethod);


问:
Using Classes in Python not initialise all valiables in constructor
after looking online there are several ways having a pythonic way for a class definition but not the one I was looking for. I am initialising all variables and both function need all of them. What I want is that not all variables need to be used per function, but only the ones needed, so not all don't need to be initialised:

I have the following test code:

```<code>class TestClass:

    def __init__(self,a,b,c,d):

        self.a  = a
        self.b  = b
        self.c = c
        self.d = d

    def CalcA(self):

        TestA = self.a + self.b

        return TestA

    def CalcB(self):

        TestB = self.c * self.d

        return TestB

if __name__ == '__main__':

    a=5.0
    b=10.0
    c=2.0
    d =0.01

    TestingTheClass = TestClass(a,b,c,d)
    NewCalcA = TestingTheClass.CalcA()
    NewCalcB = TestingTheClass.CalcB()

    print(NewCalcA)
    print(NewCalcB)
</code>```

答:
Well this it is hard to figure out what you are asking for here, but i think you might want to check out the usage of default values + passing the parameters as an unpacked dictionary. Like this:

```<code>class TestClass:

    def __init__(self,a=0,b=0,c=0,d=0):

        self.a  = a
        self.b  = b
        self.c = c
        self.d = d

    def CalcA(self):

        TestA = self.a + self.b

        return TestA

    def CalcB(self):

        TestB = self.c * self.d

        return TestB

if __name__ == '__main__':
    params={"a": 5.0, "b": 10.0}

    TestingTheClass = TestClass(**params)
    NewCalcA = TestingTheClass.CalcA()
    NewCalcB = TestingTheClass.CalcB()
    print(NewCalcA) #15.0
    print(NewCalcB) #0

    params={"c": 2.0, "d":0.01}

    TestingTheClass = TestClass(**params)
    NewCalcA = TestingTheClass.CalcA()
    NewCalcB = TestingTheClass.CalcB()

    print(NewCalcA) #0
    print(NewCalcB) #0.02
</code>```

Now you have your values =0 by default, and you can populate the dict only with the ones that concern you.

Body:
after looking online there are several ways having a pythonic way for a class definition but not the one I was looking for. I am initialising all variables and both function need all of them. What I want is that not all variables need to be used per function, but only the ones needed, so not all don't need to be initialised:

I have the following test code:

class TestClass:

    def __init__(self,a,b,c,d):

        self.a  = a
        self.b  = b
        self.c = c
        self.d = d

    def CalcA(self):

        TestA = self.a + self.b

        return TestA

    def CalcB(self):

        TestB = self.c * self.d

        return TestB

if __name__ == '__main__':

    a=5.0
    b=10.0
    c=2.0
    d =0.01

    TestingTheClass = TestClass(a,b,c,d)
    NewCalcA = TestingTheClass.CalcA()
    NewCalcB = TestingTheClass.CalcB()

    print(NewCalcA)
    print(NewCalcB)

Body:
Well this it is hard to figure out what you are asking for here, but i think you might want to check out the usage of default values + passing the parameters as an unpacked dictionary. Like this:

class TestClass:

    def __init__(self,a=0,b=0,c=0,d=0):

        self.a  = a
        self.b  = b
        self.c = c
        self.d = d

    def CalcA(self):

        TestA = self.a + self.b

        return TestA

    def CalcB(self):

        TestB = self.c * self.d

        return TestB

if __name__ == '__main__':
    params={"a": 5.0, "b": 10.0}

    TestingTheClass = TestClass(**params)
    NewCalcA = TestingTheClass.CalcA()
    NewCalcB = TestingTheClass.CalcB()
    print(NewCalcA) #15.0
    print(NewCalcB) #0

    params={"c": 2.0, "d":0.01}

    TestingTheClass = TestClass(**params)
    NewCalcA = TestingTheClass.CalcA()
    NewCalcB = TestingTheClass.CalcB()

    print(NewCalcA) #0
    print(NewCalcB) #0.02

Now you have your values =0 by default, and you can populate the dict only with the ones that concern you.


问:
VBA Code for Filtering up through the current month
I have a sheet of work orders that have a column of complete by dates. I am trying to filter it down to show all orders with dates in the past going through to the end of the current month (EX: all past orders-End of July 2017).

The current code I'm am using works, but for some reason will not return 7/31/2017. It will return all prior date up to 7/30/2017. Can someone please help.

```<code>Sub Macro3()
Dim dtStart As Date
Dim dtFinal As Date

dtStart = CDate(Evaluate("DATE(YEAR(NOW()),-1,1)"))
dtFinal = CDate(Evaluate("EOMONTH(NOW(),0)"))

ActiveSheet.Range("$A$1:$N$709").AutoFilter 13, ">=" & dtStart, xlAnd, "<=" &
dtFinal, Operator:=xlFilterDynamic
End Sub
</code>```

答: dtFinal is July 31, 2017 at 12:00am. You will want to make your final date August 1 and then change your filter from "<=" to "<".

Body:
I have a sheet of work orders that have a column of complete by dates. I am trying to filter it down to show all orders with dates in the past going through to the end of the current month (EX: all past orders-End of July 2017).

The current code I'm am using works, but for some reason will not return 7/31/2017. It will return all prior date up to 7/30/2017. Can someone please help.

Sub Macro3()
Dim dtStart As Date
Dim dtFinal As Date

dtStart = CDate(Evaluate("DATE(YEAR(NOW()),-1,1)"))
dtFinal = CDate(Evaluate("EOMONTH(NOW(),0)"))

ActiveSheet.Range("$A$1:$N$709").AutoFilter 13, ">=" & dtStart, xlAnd, "<=" &
dtFinal, Operator:=xlFilterDynamic
End Sub


问:
How to run Azure Function app on a different port in Visual Studio
I am setting local host port in local.setting.json. Referring Microsoft doc https://learn.microsoft.com/en-us/azure/azure-functions/functions-run-local

The file looks like below

```<code>{
  "IsEncrypted": false,
  "Values": {
    "AzureWebJobsStorage": "",
    "AzureWebJobsDashboard": ""
  },
  "Host": {
    "LocalHttpPort": 7073
  }
}
</code>```

When I run/debug the solution , VS still host the app on default port (7071)

I have checked the bin directory, the local.setting.json file is geting there with above settings.
Running Azure Fucntion CLI (func host start) from bin directory correctly read the port number.

Looks like VS is not using the "LocalHttpPort" port. Is there any other changes required in the settings. I have Visual Studio 2017 Preview (2)

答:
Update: If you're just looking to change the port, you don't have to set it through the file specified in the question. Check Thuc Nguyen answer

Original answer:

the command line takes precedence over the settings file, the problem is that VS passes an explicit port on the command line.

work around is to go through project -> properties -> Debug, then under Application arguments take control of the args. you can type host start --pause-on-error

Edit from ravinsp:

Update for .Net Core 2.0 function project:

The command line arguments you have to pass are different. You have to pass in the path to a dll in front. Like this:
%AppData%\..\Local\Azure.Functions.V2.Cli\2.0.1-beta.22\Azure.Functions.Cli.dll host start --pause-on-error You can see for yourself by running the function in Visual Studio and using the process explorer to see command line args to dotnet.exe process.

edit: a word

Body:
I am setting local host port in local.setting.json. Referring Microsoft doc https://learn.microsoft.com/en-us/azure/azure-functions/functions-run-local

The file looks like below

{
  "IsEncrypted": false,
  "Values": {
    "AzureWebJobsStorage": "",
    "AzureWebJobsDashboard": ""
  },
  "Host": {
    "LocalHttpPort": 7073
  }
}

When I run/debug the solution , VS still host the app on default port (7071)

I have checked the bin directory, the local.setting.json file is geting there with above settings.
Running Azure Fucntion CLI (func host start) from bin directory correctly read the port number.

Looks like VS is not using the "LocalHttpPort" port. Is there any other changes required in the settings. I have Visual Studio 2017 Preview (2)

ContentLicense: CC BY-SA 4.0


问:
SpringBoot web services multiple data sources only one working
I have developed two webservices using Spring Boot framework and I have them in the same project. Each webservice use a different DB, say ws1 uses Oracle1 and ws2 uses Oracle2. I have defined a DataBaseConfig with the beans definition but when I run the app, always works one webservice ( and it's always the same ).

DataBaseConfig

```<code>@Configuration
public class DataBaseConfig {
@Bean(name = "ora1")
@ConfigurationProperties(prefix="spring.datasource")
public DataSource mysqlDataSource() {
    return DataSourceBuilder.create().build();}

@Bean(name = "ora2")
@ConfigurationProperties(prefix="spring.secondDatasource")
public DataSource sqliteDataSource() {
    return DataSourceBuilder.create().build();}

 @Bean(name = "clients")
    @Autowired
    @ConfigurationProperties(prefix = "spring.datasource")
    @Qualifier("datasource")
    public JdbcTemplate slaveJdbcTemplate(DataSource datasource) {
        return new JdbcTemplate(datasource); }

    @Bean(name = "places")
    @Autowired
     @Primary
        @ConfigurationProperties(prefix = "spring.secondDatasource")
     @Qualifier("secondDatasource")
    public JdbcTemplate masterJdbcTemplate(DataSource secondDatasource) {
        return new JdbcTemplate(secondDatasource);}
}
</code>```

I have the services definition with the sql statements and the definition

```<code>@Service
public class ClientsService {

@Autowired
@Qualifier("clients")
private JdbcTemplate jdbcTemplate;
</code>```

and the other service

```<code>@Service
public class PlacesService {

@Autowired
@Qualifier("places")
private JdbcTemplate jdbcTemplate;
</code>```

Then in each controller I have de mapping @RequestMapping. When I run the app I have no connection-related errors and if I separate the webservices in 2 projects, each works fine.

答:
You have a few things going wrong here, including some unnecessary annotations. See below, note the location of @Qualifier and the qualifier name:</p>

```<code>@Bean(name = "clients")
public JdbcTemplate slaveJdbcTemplate(@Qualifier("ora1") DataSource datasource) {
     return new JdbcTemplate(datasource);
}

@Bean(name = "places")
@Primary
public JdbcTemplate masterJdbcTemplate(@Qualifier("ora2") DataSource secondDatasource) {
    return new JdbcTemplate(secondDatasource);
}
</code>```

Body:
I have developed two webservices using Spring Boot framework and I have them in the same project. Each webservice use a different DB, say ws1 uses Oracle1 and ws2 uses Oracle2. I have defined a DataBaseConfig with the beans definition but when I run the app, always works one webservice ( and it's always the same ).

DataBaseConfig

@Configuration
public class DataBaseConfig {
@Bean(name = "ora1")
@ConfigurationProperties(prefix="spring.datasource")
public DataSource mysqlDataSource() {
    return DataSourceBuilder.create().build();}

@Bean(name = "ora2")
@ConfigurationProperties(prefix="spring.secondDatasource")
public DataSource sqliteDataSource() {
    return DataSourceBuilder.create().build();}

 @Bean(name = "clients")
    @Autowired
    @ConfigurationProperties(prefix = "spring.datasource")
    @Qualifier("datasource")
    public JdbcTemplate slaveJdbcTemplate(DataSource datasource) {
        return new JdbcTemplate(datasource); }

    @Bean(name = "places")
    @Autowired
     @Primary
        @ConfigurationProperties(prefix = "spring.secondDatasource")
     @Qualifier("secondDatasource")
    public JdbcTemplate masterJdbcTemplate(DataSource secondDatasource) {
        return new JdbcTemplate(secondDatasource);}
}

I have the services definition with the sql statements and the definition

@Service
public class ClientsService {

@Autowired
@Qualifier("clients")
private JdbcTemplate jdbcTemplate;

and the other service

@Service
public class PlacesService {

@Autowired
@Qualifier("places")
private JdbcTemplate jdbcTemplate;

Then in each controller I have de mapping @RequestMapping. When I run the app I have no connection-related errors and if I separate the webservices in 2 projects, each works fine.

Body:
You have a few things going wrong here, including some unnecessary annotations. See below, note the location of @Qualifier and the qualifier name:

@Bean(name = "clients")
public JdbcTemplate slaveJdbcTemplate(@Qualifier("ora1") DataSource datasource) {
     return new JdbcTemplate(datasource);
}

@Bean(name = "places")
@Primary
public JdbcTemplate masterJdbcTemplate(@Qualifier("ora2") DataSource secondDatasource) {
    return new JdbcTemplate(secondDatasource);
}


问:
Button animation only works for specific margin
I've got some strange problem. In my code the button css animation only works if the margin-top is set to be 125px (for sim-button class). I want to reduce the margin-top to 25px but then the animation doesn't works.

Codepen Here

HTML:

```<code><div class="media" style = "background-color:#000;">
                          <img class="media__image" src="https://www.offensive-security.com/wp-content/uploads/2012/01/security-risk-assessment-report.png">
                          <div class="media__body">
                            <h2>Penetration Report</h2>
                            <p>Get your hands on our Sample Presentation Report</p>
                            <div class="sim-button button1" data-toggle="modal" data-target="#getQuoteModal">Download Report</div>
                          </div>
                        </div>
</code>```

CSS:

```<code>    .media {
  display: inline-block;
  position: relative;
  vertical-align: top;
}

.media__image { display: block; }

.media__body {
  background: rgba(41, 128, 185, 0.7);
  bottom: 0;
  color: white;
  font-size: 1em;
  left: 0;
  opacity: 0;
  overflow: hidden;
  padding: 3.75em 3em;
  position: absolute;
  text-align: center;
  top: 0;
  right: 0;
  -webkit-transition: 0.6s;
  transition: 0.6s;
}

.media__body:hover { opacity: 1; }

.media__body:after,
.media__body:before {
  border: 1px solid rgba(255, 255, 255, 0.7);
  bottom: 1em;
  content: '';
  left: 1em;
  opacity: 0;
  position: absolute;
  right: 1em;
  top: 1em;
  -webkit-transform: scale(1.5);
  -ms-transform: scale(1.5);
  transform: scale(1.5);
  -webkit-transition: 0.6s 0.2s;
  transition: 0.6s 0.2s;
}

.media__body:before {
  border-bottom: none;
  border-top: none;
  left: 2em;
  right: 2em;
}

.media__body:after {
  border-left: none;
  border-right: none;
  bottom: 2em;
  top: 2em;
}

.media__body:hover:after,
.media__body:hover:before {
  -webkit-transform: scale(1);
  -ms-transform: scale(1);
  transform: scale(1);
  opacity: 1;
}

.media__body h2 { margin-top: 0; }

.media__body p { margin-bottom: 0em; }

.sim-button{
    line-height: 50px;
    height: 50px;
    text-align: center;
    margin-right: auto;
    margin-left: auto;
    margin-top: 125px;
    width: 60%;
    cursor: pointer;
}
.button1 {
    color: rgba(255,255,255,1);
    -webkit-transition: all 0.5s;
    -moz-transition: all 0.5s;
    -o-transition: all 0.5s;
    transition: all 0.5s;
    position: relative;
    border: 1px solid rgba(255,255,255,0.5);
}
.button1 a{
    color: rgba(51,51,51,1);
    text-decoration: none;
    display: block;
}
.button1:hover {
    background-color: rgba(255,255,255,0.2);
    -webkit-border-radius: 25px;
    -moz-border-radius: 25px;
    border-radius: 25px;
}
</code>```

Thanks for help in advance.

答:
Your button is being hidden underneath of your overlay:

```<code>z-index: 1;
</code>```

putting the above into your sim-button class gets the effect you want. It brings your button to the foreground and is able to be hovered over to activate the animation.

here is a fiddle I made with the change added in:
jsfiddle

Body:
I've got some strange problem. In my code the button css animation only works if the margin-top is set to be 125px (for sim-button class). I want to reduce the margin-top to 25px but then the animation doesn't works.

Codepen Here

HTML:

Penetration Report

Get your hands on our Sample Presentation Report

Download Report

CSS:

    .media {
  display: inline-block;
  position: relative;
  vertical-align: top;
}

.media__image { display: block; }

.media__body {
  background: rgba(41, 128, 185, 0.7);
  bottom: 0;
  color: white;
  font-size: 1em;
  left: 0;
  opacity: 0;
  overflow: hidden;
  padding: 3.75em 3em;
  position: absolute;
  text-align: center;
  top: 0;
  right: 0;
  -webkit-transition: 0.6s;
  transition: 0.6s;
}

.media__body:hover { opacity: 1; }

.media__body:after,
.media__body:before {
  border: 1px solid rgba(255, 255, 255, 0.7);
  bottom: 1em;
  content: '';
  left: 1em;
  opacity: 0;
  position: absolute;
  right: 1em;
  top: 1em;
  -webkit-transform: scale(1.5);
  -ms-transform: scale(1.5);
  transform: scale(1.5);
  -webkit-transition: 0.6s 0.2s;
  transition: 0.6s 0.2s;
}

.media__body:before {
  border-bottom: none;
  border-top: none;
  left: 2em;
  right: 2em;
}

.media__body:after {
  border-left: none;
  border-right: none;
  bottom: 2em;
  top: 2em;
}

.media__body:hover:after,
.media__body:hover:before {
  -webkit-transform: scale(1);
  -ms-transform: scale(1);
  transform: scale(1);
  opacity: 1;
}

.media__body h2 { margin-top: 0; }

.media__body p { margin-bottom: 0em; }

.sim-button{
    line-height: 50px;
    height: 50px;
    text-align: center;
    margin-right: auto;
    margin-left: auto;
    margin-top: 125px;
    width: 60%;
    cursor: pointer;
}
.button1 {
    color: rgba(255,255,255,1);
    -webkit-transition: all 0.5s;
    -moz-transition: all 0.5s;
    -o-transition: all 0.5s;
    transition: all 0.5s;
    position: relative;
    border: 1px solid rgba(255,255,255,0.5);
}
.button1 a{
    color: rgba(51,51,51,1);
    text-decoration: none;
    display: block;
}
.button1:hover {
    background-color: rgba(255,255,255,0.2);
    -webkit-border-radius: 25px;
    -moz-border-radius: 25px;
    border-radius: 25px;
}

Thanks for help in advance.

Body:
Your button is being hidden underneath of your overlay:

z-index: 1;

putting the above into your sim-button class gets the effect you want. It brings your button to the foreground and is able to be hovered over to activate the animation.

here is a fiddle I made with the change added in:
jsfiddle


问:
VBA Code too slow - Matching the value of a column
I have two sheets and they are put into TabName1 and TabName2. I am trying to take the value from a column and match it with all the values in the column and if the value is not found then I am deleting that row from sheet2

This is the Code,

```<code>For i = lastrow To 2 Step -1
    CombinedKeyVal = Sheets(TabName2).Range(CombinedKeyColLet & i).Value
    Present = Application.Match(CombinedKeyVal, Sheets(TabName1).Columns(CombinedKeyCol), 0)
    If IsError(Present) Then
        Sheets(TabName2).Rows(i & ":" & i).Select
        Selection.Delete
    End If

Next
</code>```

Yes , the lastrow is defined as,

```<code>lastrow = Sheets(TabName1).Cells(Rows.Count, BuColm).End(xlUp).Row
</code>```

It works. But it is too slow. My lastrow is around 5000. So, Any Idea or Suggestion to increase the Speed of the Process. Thanks in advance.

答:
Something like this, note also the use of Worksheet object variables, while this is probably negligible in performance, it is something of a best practice according to DRY: assign the object once, and then just use the object rather than repeatedly calling on Sheets("some sheet name").

```<code>Dim sh2 as Worksheet, sh1 As Worksheet
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual

Set sh2 = Sheets(TabName2)
Set sh1 = Sheets(TabName1)

''' more code goes here when you calculate lastrow, etc.

For i = lastrow To 2 Step -1
    CombinedKeyVal = sh2.Range(CombinedKeyColLet & i).Value
    Present = Application.Match(CombinedKeyVal, sh1.Columns(CombinedKeyCol), 0)
    If IsError(Present) Then
        sh2.Rows(i).EntireRow.Delete
    End If
Next
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
</code>```

Body:
I have two sheets and they are put into TabName1 and TabName2. I am trying to take the value from a column and match it with all the values in the column and if the value is not found then I am deleting that row from sheet2

This is the Code,

For i = lastrow To 2 Step -1
    CombinedKeyVal = Sheets(TabName2).Range(CombinedKeyColLet & i).Value
    Present = Application.Match(CombinedKeyVal, Sheets(TabName1).Columns(CombinedKeyCol), 0)
    If IsError(Present) Then
        Sheets(TabName2).Rows(i & ":" & i).Select
        Selection.Delete
    End If

Next

Yes , the lastrow is defined as,

lastrow = Sheets(TabName1).Cells(Rows.Count, BuColm).End(xlUp).Row

It works. But it is too slow. My lastrow is around 5000. So, Any Idea or Suggestion to increase the Speed of the Process. Thanks in advance.

Body:
Something like this, note also the use of Worksheet object variables, while this is probably negligible in performance, it is something of a best practice according to DRY: assign the object once, and then just use the object rather than repeatedly calling on Sheets("some sheet name").

Dim sh2 as Worksheet, sh1 As Worksheet
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual

Set sh2 = Sheets(TabName2)
Set sh1 = Sheets(TabName1)

''' more code goes here when you calculate lastrow, etc.

For i = lastrow To 2 Step -1
    CombinedKeyVal = sh2.Range(CombinedKeyColLet & i).Value
    Present = Application.Match(CombinedKeyVal, sh1.Columns(CombinedKeyCol), 0)
    If IsError(Present) Then
        sh2.Rows(i).EntireRow.Delete
    End If
Next
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True