builder

symfony 2.3 form getData doesn't work in subforms collections

爱⌒轻易说出口 提交于 2019-12-02 17:46:18
I have a form which contains a collection. So I have: /* my type */ public function buildForm(FormBuilderInterface $builder, array $options) { $builder ->add('name') ->add('photos','collection',array( 'type'=> new PhotoType(), 'allow_add'=>true)); } /*Photo Type*/ public function buildForm(FormBuilderInterface $builder, array $options) { $builder ->add('photoname') ->add('size') } But I want to access the data inside the photo, so I tried inside the PhotoType: $data = $builder->getData(); But it seems that it doesn't work, even if I am editting the form, so the photo collection has data. Why

Can I have an abstract builder class in java with method chaining without doing unsafe operations?

ε祈祈猫儿з 提交于 2019-12-02 17:33:33
I'm trying to have an abstract base class for some builder classes so I can easily reuse code between the Builder implementations. I want my builders to support method chaining therefore a method has to return "this" instance of the most specific type. I figured I could probably do this with generics. Unfortunatly I did not manage to do it without using unsafe operations. Is it possible? Sample code of how I'm trying it (and how it works) below. I'd like to avoid casting to T in "foo()" (which causes an unchecked warning), can this be done? public class Builders { public static void main(

Add exsiting query to report

最后都变了- 提交于 2019-12-02 15:21:25
问题 My report calculates the stock of inks in my stores. I built a SQL statement in VB.NET and got the correct results. How can I display these results in my Crystal Report? Or design a report such that same results will be retrieved? I tried to use SQL Expression builder but failed. 回答1: Usually you will link Data Tables to your report using Database Expert . Do the same in Database Expert, select the Database and you can see Add Command . Select that and click the > button. You will get a

How to open the keyboard automatically on UITextField?

岁酱吖の 提交于 2019-12-02 14:50:47
I have a very simple table and when tocuh a cell it opens a new view with one UITextfield. All I want is that the keyboard will automatically opens, without the user have to touch the UITextfield. Its all done in Interface Builder, so I am not sure how I do this. I guess I need to set the focus at some point ? Thanks To cause the keyboard to show up immediately you'll need to set the text field as the first responder using the following line: [textField becomeFirstResponder]; You may want to place this in the viewDidAppear: method. Swift 3 & 4: override func viewDidAppear(_ animated: Bool) {

When I use WebDriverWait rather than Thread.sleep I get a StaleElementReferenceException

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-02 13:14:56
I am trying to write a Selenium object Builder for a Swagger page, in groovy . For the purposes of this discussion, my problem code can be reduced down to the following: class SwaggerBuilder { WebDriver driver def resources SwaggerBuilder(WebDriver driver) { this.driver = driver Thread.sleep(2000) resources = driver.findElements(By.className("resource")).collectEntries { def resourceName = it.findElement(By.tagName("a")).getText().replaceFirst("[/]", "") [(resourceName): it] } } Object invokeMethod(String name, Object args) { if(resources[(name)] == null) throw new NoSuchElementException(

How to use Builder pattern as described by Joshua Bloch's version in my ModelInput class?

做~自己de王妃 提交于 2019-12-02 09:43:55
问题 I am trying to use Builder Pattern for my below class.. Initially I was using constructor of my class to set all the parameters but accidentally I came across Builder pattern and it is looking good for my use case. Below is my class in which people will mostly pass userId , clientId and parameterMap always but other fields are optional and they may or may not pass it. And also if they are not passing any timeout value, I need to have default timeout value set as 500 always but if they are

Disable stage button X

随声附和 提交于 2019-12-02 06:30:46
I'm going fast to the point because I haven't a very fluent english, sorry. I'm learning javafx and I want when I click the X's windows after close it appear a warning. I know to do this in a button created by me in the middle of the windows, but I don't know how to control when the user press the X to close the programm. Thanks You should not focus on the X, but instead on the common close request like this: primaryStage.setOnCloseRequest(new EventHandler<WindowEvent>() { @Override public void handle(WindowEvent event) { // consume event event.consume(); // show close dialog Alert alert = new

How to use Builder pattern as described by Joshua Bloch's version in my ModelInput class?

▼魔方 西西 提交于 2019-12-02 02:59:40
I am trying to use Builder Pattern for my below class.. Initially I was using constructor of my class to set all the parameters but accidentally I came across Builder pattern and it is looking good for my use case. Below is my class in which people will mostly pass userId , clientId and parameterMap always but other fields are optional and they may or may not pass it. And also if they are not passing any timeout value, I need to have default timeout value set as 500 always but if they are passing any timeout value then it should override my default timeout value. Here Preference is an ENUM

【jni 编程】—— NDK环境搭建

好久不见. 提交于 2019-12-01 08:35:57
在《站在巨人的肩膀上,谈app的创新性》一文中 http://my.oschina.net/liusicong/blog/311971 ,我提到过构建app技术壁垒的必要性。在构建技术壁垒时,我们往往需要调用许多库函数,例如:图像处理的库函数,音频处理的库函数。我们发现一个有效可行的方案就是使用NDK工具来交叉调用C++函数。 我习惯于把我搜到的数篇帖子中特别好的帖子的地址附在问题后,这也是一种资源整合,面向想要入门学习android的java和c++交叉调用技能的读者盆友。 本文将分两部分来介绍如何在android下使用NDK实现c++开发:NDK环境的搭建,调用C++函数。 一. NDK环境搭建 1. 下载,解压 android-ndk-r5c-windows.zip 2. Cygwin 安装,同时参考以下两个教程 图文教程: http://wenku.baidu.com/link?url=JW5SDYlQAeGBWGm_gber3QJ3bGvIfaIElEpj1btc4WOmLuYSVqC7HjgDX4QKpbZp6yXSnXgGrOucpc_dnvwIpPiD-Saj_IlTcX_izN-npUu 图文教程: http://blog.csdn.net/pengchua/article/details/7582949 3. 配置 NDK builder

use Builder pattern from the constructor in a subclass

痴心易碎 提交于 2019-11-30 15:20:21
I am currently using the Builder pattern, following closely the Java implementation suggested in the Wikipedia article Builder pattern http://en.wikipedia.org/wiki/Builder_pattern This is a sample code that ilustrates my implementation public class MyPrimitiveObject { private String identifier="unknown"; public static class Builder { private final MyPrimitiveObject obj = new MyPrimitiveObject(); public MyPrimitiveObject build() { return obj; } public Builder setidentifier (String val) { obj.identifier = val; return this; } } public static Builder createBuilder() { return new Builder(); }