scope

Spring Batch - “job” scoped beans can not be injected into “job” or “step” scoped beans

亡梦爱人 提交于 2019-12-11 02:53:47
问题 I am using spring batch version 3.0.2.RELEASE and spring framework version 3.2.12.RELEASE. And I am trying to inject a job scoped bean to another job scoped bean. My configuration looks like this <bean id="beanA" class="com.trial.BeanA" scope="job" > <property name="beanB" ref="beanB" /> </bean> <bean id="beanB" class="com.trial.BeanB" scope="job"/> It throws an exception with details: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scopedTarget.beanA'

Haxe: define a function/macro which fires when an object goes out of scope?

喜欢而已 提交于 2019-12-11 02:53:05
问题 Is this possible in Haxe to have the compiler automatically insert a function call / code segment at the point where an object instance goes out of scope? I have object instances that require manual cleanup beyond what garbage collection does (for the JS target). More Info I'm experimenting with allocating small data structures in JavaScript code manually inside a virtual heap (an ArrayBuffer ), similar to what is done with compiled asm.js programs. I am using Haxe in part because I can

ReactJS and RequireJS -> How to use multiple classes returned from one module?

ε祈祈猫儿з 提交于 2019-12-11 02:49:36
问题 I've got a RequireJS module that returns multiple ReactJS classes that I'd like to be immediately available to the JSX scope. e.g. define(["require"], function (require) { var SimpleClass = React.createClass({displayName: 'SimpleClass', render: function() { return <div>HELLO DUDE {this.props.name}</div>; } }); var AnotherSimpleClass = React.createClass({displayName: 'AnotherSimpleClass', render: function() { return <div>SUPER DUDE {this.props.name}</div>; } }); var result = {

How to set a private variable for a jQuery plugin?

感情迁移 提交于 2019-12-11 02:48:20
问题 I would like to create a simple plugin, which works with the text of the element as a default value, or you can set this value, when you call the plugin. But if I don't set the value, and call the plugin for more than one element, the default value getting multiplied. (function($) { $.fn.reText = function(options) { var settings = $.extend({ label : $(this).text() }, options); return this.each(function() { $(this).text(settings.label); }); }; })(jQuery); call: $(function() { $('div').reText()

Scope of implicits

纵然是瞬间 提交于 2019-12-11 02:43:25
问题 As a follow up to my other question, see comments / questions in code: case class Implicit(name: String) def foo(implicit i: Implicit = null) = println(Option(i)) def bar1(implicit i: Implicit) { foo // prints None implicit val i = Implicit("J") // Why is call to foo above affected although this line comes after? foo // prints Some(Implicit(I)) } def bar2(implicit i: Implicit) { foo // prints None implicit val i = null implicit val j = Implicit("J") foo // prints None // Why? Should raise

JavaScript nested function prototype scope

随声附和 提交于 2019-12-11 02:33:33
问题 I'm still having trouble figuring on how to manage scopes in JavaScript. In this particular example, I have a draw function containing certain properties and a function that needs to draw lines based on an array. function Draw (canvas) { this.ctx = canvas.getContext('2d'); this.street_size = 20; } Draw.prototype.street = function (MAP) { MAP.forEach(function (name) { this.ctx.moveTo(name.start.x,name.start.y); this.ctx.lineTo(name.end.x,name.end.y) this.ctx.stroke(); }); } Of course, "this

javascript scope, why does $(this) equal [window]?

我是研究僧i 提交于 2019-12-11 02:31:31
问题 I have an ajax function (not sure if relevant) that updates html and creates a few links: <a href="#" class="clickme" onclick="column_click()" title="my title">click me</a> I'm not sure why, but onclick, if I alert $(this).attr('title') it shows as undefined , and if I alert $(this) it shows [window] function column_click(){ value = $(this); console.log(value); thetitle= $(this).attr('title'); console.log(thetitle); } Does anyone know why this is the case? 回答1: You're confusing the obtrusive

Javascript - Why are global variables hidden throughout the (body of the) function?

a 夏天 提交于 2019-12-11 02:23:19
问题 I understand how it works (the disparities between local and global functions), but I don’t quite get the rationale behind hiding the global variables in a functions while a “local” variable is not yet defined or initialized. var scope = "global"; function checkscope() { console.log(scope); } //this returns >> undefined I’m reading "Javascript: The Definitive Guide (6th edition)" and I’m talking about chapter 3.10 here. (page 54 to be exact). 2 pages later, at page 56 the book says: “In a non

php bind variable to function's scope in older PHP

家住魔仙堡 提交于 2019-12-11 01:56:00
问题 I would like to bind a variable to a function's scope, I can do this in php use the 'use' keyword after PHP 5.3, however how do I do the equivalent in versions < PHP 5.3? test_use_keyword(); function test_use_keyword(){ $test =2; $res=array_map( function($el) use ($test){ return $el * $test; }, array(3) ); print_r($res); } 回答1: You can use a global variable, but you should always avoid globals variables whereever possible. As a suggestion, without knowing, what you are trying to solve with

Non-static method next() cannot be referenced from a static context

对着背影说爱祢 提交于 2019-12-11 01:54:50
问题 I am trying to parse out a mm/dd/yyyy formatted date into separate fields, but I get the following error when I try to compile: non-static method next() cannot be referenced from a static context What could be causing the error? import java.util.Scanner; public class Problem39 { public static void main(String [ ] args) { boolean isLeapYear =false; int maxDay=0; String stringDate; System.out.println("Enter the date in mm/dd/yyyy format. "); //user input Scanner keyboard = new Scanner(System.in