我有一个动态的表单,我用rails写的.我想确保用户可以添加不超过五个链接.
我从两个链接开始,我有另一个链接,允许用户添加另一个字段.我还在链接旁边有一个链接,允许用户删除一个字段,该字段设置隐藏字段,然后用slideUp();隐藏字段.
我想知道用户希望提交的屏幕上是否有5个字段.
这是我目前正在使用的 - 这只是计算具有该类名的所有div.
if($(".classname").length <5){
//create element dynamically
}
Run Code Online (Sandbox Code Playgroud)
我想检查"style ='display:none;'"我怎么能这样做?
我正在尝试创建一个BeanPostProcessor用于将一些值注册到 Map 的。
的BeanPostProcessor,如果我通过创建XML定义bean实例工作正常,但如果我的bean定义更改为@Configuration它不工作。
后处理器
public class InstantiationTracingBeanPostProcessor implements BeanPostProcessor {
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
return bean;
}
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
System.out.println("Bean '" + beanName );
return bean;
}
}
Run Code Online (Sandbox Code Playgroud)
Bean 配置
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
@org.springframework.context.annotation.Configuration
public class Configuration {
@Bean
public @Qualifier("InstantiationTracingBeanPostProcessor")
InstantiationTracingBeanPostProcessor activitiConfigurationBeanPostProcessor() {
return new InstantiationTracingBeanPostProcessor();
}
}
Run Code Online (Sandbox Code Playgroud)
组件扫描配置
<context:component-scan base-package="xyz.config"/>
<context:annotation-config/>
Run Code Online (Sandbox Code Playgroud)
如果我使用上述配置,应用程序就会挂起。但是,如果我使用下面给出的基于 xml 的配置,它就可以正常工作。
<bean class="xyz.bean.InstantiationTracingBeanPostProcessor"/>
Run Code Online (Sandbox Code Playgroud)
我在这里做错了什么?
我正在尝试用2行创建一个JQ Plot.第一行每小时都有第1天的数据,第二行是每小时数据的第2行.当我使用这两行创建图表时,我希望在第二行的顶部显示一行来显示每小时数据比较.但我在图表上看到这两条线彼此相邻.
我在这里有样品
请让我知道如何调整图表选项以在另一行之上显示一行.谢谢.
这是我的代码:
<html>
<head>
<script src="http://www.jqplot.com/deploy/dist/jquery.min.js"></script>
<script src="http://www.jqplot.com/deploy/dist/jquery.jqplot.min.js"></script>
<script src=""></script>
<link class="include" rel="stylesheet" type="text/css" href="http://www.jqplot.com/deploy/dist/jquery.jqplot.min.css" />
<script class="include" type="text/javascript" src="http://www.jqplot.com/deploy/dist/plugins/jqplot.cursor.min.js"></script>
<script class="include" type="text/javascript" src="http://www.jqplot.com/deploy/dist/plugins/jqplot.dateAxisRenderer.min.js"></script>
<script class="include" type="text/javascript" src="http://www.jqplot.com/deploy/dist/plugins/jqplot.logAxisRenderer.min.js"></script>
<script class="include" type="text/javascript" src="http://www.jqplot.com/deploy/dist/plugins/jqplot.canvasTextRenderer.min.js"></script>
<script class="include" type="text/javascript" src="http://www.jqplot.com/deploy/dist/plugins/jqplot.canvasAxisTickRenderer.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
line1 = [["6/22/2009 10:00",425.32], ["6/22/2009 11:00",424.84], ["6/22/2009 12:00",417.23], ["6/22/2009 13:00",390],
["6/22/2009 14:00",393.69], ["6/22/2009 15:00",392.24], ["6/22/2009 16:00",369.78], ["6/22/2009 17:00",330.16], ["6/22/2009 18:00",308.57],
["6/22/2009 19:00",346.45], ["6/22/2009 20:00",371.28], ["6/22/2009 21:00",324.7]];
line2 = [["6/23/2009 10:00",325.32], ["6/23/2009 11:00",324.84], ["6/23/2009 12:00",217.23], ["6/23/2009 13:00",190], …Run Code Online (Sandbox Code Playgroud) 当我使用Spring,Hibernate和SQL Server的组合时,我收到以下错误.
19:17:09,137 ERROR [org.hibernate.tool.hbm2ddl.SchemaValidator] (MSC service thread 1-8) HHH000319: Could not get database metadata: com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host falmumapp20/testdb, port 1433 has failed. Error: "null. Verify the connection properties. Make sure that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port. Make sure that TCP connections to the port are not blocked by a firewall.".
Run Code Online (Sandbox Code Playgroud)
它不仅仅是一个TCP IP问题,因为如果我没有Spring工作,我可以使用hibernate连接到SQL Server.
下面是我的applicationContext.xml
<!-- Resource Definition -->
<!-- Data Source Connection Pool …Run Code Online (Sandbox Code Playgroud) 当我运行下面显示的代码时,输出为[50,20,5,40,10,30].我不理解这个命令.为什么输出不是[10,5,20,30,40,50]?
List list = Arrays.asList(10, 5, 10, 20, 30, 40, 50);
System.out.println(new HashSet(list));
Run Code Online (Sandbox Code Playgroud) 我有一个extjs网格面板设置,我希望能够根据用户点击网格中的文本或图标来做事情.例如,如果用户单击(或双击)列中的单词,则过滤网格,或者如果用户单击图标,则显示弹出窗口.我可以很容易地获取他们点击的行,并按该行的列名称输入值,但我不知道单击了哪一列.
或者,我可以将onClick添加到整个网格,然后我可以从行/列中获取单个文本,但我不知道该值属于哪个行索引或列.我可以添加一个CSS类来告诉我一个列名,但这似乎是一个黑客.
有什么内置可以做到这一点?
我有两个窗户.在一个窗口中调用的事件,但处理程序(侦听器)必须在另一个窗口中.可以这样做吗?如果是,怎么样?
我正在尝试编写一个递归方法,它可以array/value作为输入然后处理输入.
<html>
<body>
<script>
function process(array){
if (array instanceof Array) {
for(i=0; i < array.length; i++){
process(array[i]);
}
} else {
document.write(array + "<br />");
}
}
process([3, 4, 5, [4,1], [5,1,2],[6,1]]);
</script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
当我尝试运行这个程序时,它看起来像是一个无限循环.为什么?
$('.image-remove').click(function() {
Run Code Online (Sandbox Code Playgroud)
当我点击时,这个代码会重复两次.image-remove我不明白为什么!
$(function() {
var uploader = new plupload.Uploader({
runtimes : 'html5,flash,html4', // Runtimes in order of priority. If browser does not have HTML5, it will load flash.
browse_button : 'agregarArchivo', // Button to select files
max_file_size : '300mb',
dragdrop: true,
drop_element : 'agregarArchivo',
url : 'tempupload.php', // PHP file that the images will be sent to server side
resize : {width : 400, quality : 60}, // File resize BEFORE it is sent to PHP url
unique_names:true,
flash_swf_url …Run Code Online (Sandbox Code Playgroud) 我有以下内容:
<div id="parentCalculation">
<div class="btn-group" role="group">
<button type="button" id="calculate" class="btn btn-default">Add</button>
</div>
Calculate below. Click on "Add to make another calculation
<div id="CalculateDiv">
<div class="calculation form-group well well-lg col-md-4">
<label for="cost">Enter Amount</label>
<input type="text" id="amount" class="form-control" placeholder="0.00">
<label for="type">Type</label>
<input type="text" id="type" class="form-control" placeholder="e.g. transfers">
<label for="comments">Comments</label>
<textarea class="form-control" id="cost-comments" placeholder="Enter comments"></textarea>
</div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
我想要做的是附加父div CalculateDiv,calculation以便有重复的值.
我使用以下JQuery:
$(document).ready(function()
{
$("#calculate").click(function()
{
var x = $('.CalculateDiv');
alert(x);
$("#parentCalculation").append(x);
});
});
Run Code Online (Sandbox Code Playgroud)
问题是它没有添加到父div,我似乎无法弄清楚为什么.
见例子:这里