proc

Error installing JDK: the keytool command requires a mounted proc fs (/proc). Windows subsystem for Linux

我只是一个虾纸丫 提交于 2019-12-10 11:27:21
问题 I am trying to install Oracle JDK 1.7 on Windows subsytem for Linux (Ubuntu 14.04) and I get the following error: the keytool command requires a mounted proc fs (/proc). And the installation of Java fails with tons of errors: the keytool command requires a mounted proc fs (/proc). dpkg: error processing package ca-certificates-java (--configure): subprocess installed post-installation script returned error exit status 1 dpkg: dependency problems prevent configuration of openjdk-6-jre-headless

Change Block Binding Without Eval?

陌路散爱 提交于 2019-12-09 23:00:42
问题 I realize that you can change the binding of a block using instance_eval class Foo def bar &block instance_eval &block end end Foo.new.bar { self } # returns the instance But some built in methods accept blocks and in that case it doesn't seem possible to change the binding of the block without messing with the internals of the built in method. class Foo def enum &block Enumerator.new &block end end Foo.new.enum { self }.each {} # returns main!!! Is there a way around this? 回答1: You can work

Is it possible to see the ruby code in a proc?

喜你入骨 提交于 2019-12-09 05:23:02
问题 p = Proc.new{ puts 'ok' } Is is possible to see the ruby code in the proc? inspect returns the memory location: puts p.inspect #<Proc:0x007f9e42980b88@(irb):2> Ruby 1.9.3 回答1: Take a look at the sourcify gem: proc { x + y }.to_source # >> "proc { (x + y) }" 回答2: Do you mean the original source code or its bytecode representation ? For the former you may use standard Proc's method source_location p.source_location => ["test.rb", 21] and read the appropriate lines of code. For the latter it may

Why can't I pass a block to the proc in Ruby?

China☆狼群 提交于 2019-12-07 07:08:35
问题 Why can't I do something like this: do_once = Proc.new { yield } do_once.call { puts 1 } irb throws LocalJumpError: no block given (yield) 回答1: yield applies to the block passed to the wrapping method context. In your case, I presume it is whichever method irb relies upon ( lib/ruby/2.0.0/irb/workspace.rb:86 evaluate , if caller is anything to go by). If you wrap it in a function it'll work, because you change the method context: def do_stuff do_once = Proc.new { yield } do_once.call end do

Dynamic PL/SQL date parameter with time value retained

点点圈 提交于 2019-12-07 06:54:56
问题 It might be a silly problem but I cant find a solution with "DATE" type passed in a PL/SQL proc which is called dynamically. What I need is to pass both date and time parts in the called proc: create or replace PROCEDURE DATE_TIME_TEST ( dte_Date_IN IN DATE ) IS vch_SQL_Stmnt VARCHAR2(2000); BEGIN DBMS_OUTPUT.PUT_LINE('Date is :'||TO_CHAR(dte_Date_IN, 'DD-Mon-YYYY HH24:MI:SS')); END; / declare v_sql varchar2(2000); begin v_sql := 'begin DATE_TIME_TEST( dte_Date_IN => '''|| sysdate || ''''|| '

How to convert method or lambda to non-lambda proc

放肆的年华 提交于 2019-12-07 00:16:29
问题 As shown in the ruby example below, I can't call a lambda with wrong number of arguments as Proc created from a Method because it is strict about the number of arguments: # method with no args def a; end instance_eval(&method(:a)) # ArgumentError: wrong number of arguments (1 for 0) method(:a).to_proc.call(1, 2, 3) # ArgumentError: wrong number of arguments (3 for 0) method(:a).to_proc.lambda? # => true How do I get a Proc that is not a lambda from either a Proc that is or from a Method ? 回答1

Plotting mean ROC curve for multiple ROC curves, R

拥有回忆 提交于 2019-12-06 07:38:22
I have a dataset of 100 samples, each of which has 195 mutations with their corresponding known clinical significance ("RealClass") and predicted value according to some prediction tool ("PredictionValues") For the demonstration, this is a random dataset that has the same structure as my dataset: predictions_100_samples<-as.data.frame(matrix(nrow=19500,ncol=3)) colnames(predictions_100_samples)<-c("Sample","PredictionValues","RealClass") predictions_100_samples$Sample<-rep(c(1:100), each = 195) predictions_100_samples$PredictionValues<-sample(seq(0,1,length.out=19500)) predictions_100_samples

Reference the invoking object in the passed block in Ruby

一世执手 提交于 2019-12-05 21:58:11
Is there any way to get hold of the invoked object inside the block thats being called. For instance, is there any way for the blocks to get access to the scope of the method batman or the class SuperHeros class SuperHeros attr_accessor :news def initialize @news = [] end def batman task puts "Batman: #{task} - done" yield "feed cat" @news << task end end cat_woman = lambda do |task| puts "Cat Woman: #{task} - done" # invoker.news << task end robin = lambda do |task| puts "Robin: #{task} - done" # invoker.news << task end characters = SuperHeros.new characters.batman("kick Joker's ass", &cat

Why can't I pass a block to the proc in Ruby?

谁说胖子不能爱 提交于 2019-12-05 17:54:14
Why can't I do something like this: do_once = Proc.new { yield } do_once.call { puts 1 } irb throws LocalJumpError: no block given (yield) yield applies to the block passed to the wrapping method context. In your case, I presume it is whichever method irb relies upon ( lib/ruby/2.0.0/irb/workspace.rb:86 evaluate , if caller is anything to go by). If you wrap it in a function it'll work, because you change the method context: def do_stuff do_once = Proc.new { yield } do_once.call end do_stuff { puts 1 } Note the absence of block for do_once.call in the above: yield applies to the block passed

Dynamic PL/SQL date parameter with time value retained

≯℡__Kan透↙ 提交于 2019-12-05 11:30:26
It might be a silly problem but I cant find a solution with "DATE" type passed in a PL/SQL proc which is called dynamically. What I need is to pass both date and time parts in the called proc: create or replace PROCEDURE DATE_TIME_TEST ( dte_Date_IN IN DATE ) IS vch_SQL_Stmnt VARCHAR2(2000); BEGIN DBMS_OUTPUT.PUT_LINE('Date is :'||TO_CHAR(dte_Date_IN, 'DD-Mon-YYYY HH24:MI:SS')); END; / declare v_sql varchar2(2000); begin v_sql := 'begin DATE_TIME_TEST( dte_Date_IN => '''|| sysdate || ''''|| '); end;'; execute immediate v_sql; end; / The output here is - Date is :27-Aug-2013 00:00:00. I want it