我在List类型的对象上使用SubList函数.问题是我正在使用RMI,因为java.util.ArrayList $ SubList是由一个非可序列化的类实现的,当我尝试将结果对象作为参数传递给远程函数时,我得到了上面描述的异常同样.我已经看到我应该将生成的List复制到新的LinkedList或ArrayList并传递它.
有没有人知道一个功能,有助于为此轻松做到这一点?
List<String> list = originalList.subList(0, 10);
Run Code Online (Sandbox Code Playgroud) 在这里,我正在尝试填写联系表格然后发送.但是,当我填写表单并单击发送时,我有以下异常:
UndefinedMethodException: Attempted to call method "bindRequest" on class "Symfony\Component\Form\Form" in /symfony/src/tuto/WelcomeBundle/Form/Handler/ContactHandler.php line 47.
Run Code Online (Sandbox Code Playgroud)
这是ContactHandler.php的内容:
namespace tuto\WelcomeBundle\Form\Handler;
使用Symfony\Component\Form\Form; 使用Symfony\Component\HttpFoundation\Request;
/**
* The ContactHandler.
* Use for manage your form submitions
*
* @author Abderrahim
*/
class ContactHandler
{
protected $request;
protected $form;
protected $mailer;
/**
* Initialize the handler with the form and the request
*
* @param Form $form
* @param Request $request
* @param $mailer
*
*/
public function __construct(Form $form, Request $request, $mailer)
{
$this->form = $form; …Run Code Online (Sandbox Code Playgroud) 我正在使用jQuery div通过单击显示/隐藏按钮来显示/隐藏a .但是,我的代码不起作用,因为每次它返回到我点击按钮之前的方式.我几乎可以肯定这是由于页面重新加载,因为每次我点击一个按钮它都会重新加载页面.
有谁知道这背后的原因是什么?
这是重要的代码块:
<form role="form" method="post" action="./something.php">
...
<button id="hidemultmachines" onclick="$('#multmachines').hide(); $(this).hide(); $('#showmultmachines').show();">
Hide section below ...
</button>
<button id="showmultmachines" onclick="$('#multmachines').show(); $(this).hide(); $('#hidemultmachines').show();">
... Create multiple entries
</button>
<div id="multmachines">
...
</div>
<div>
<div>
<input type="hidden" name="total" value="{ $smarty.section.i.total }">
<button type="submit" name="Submit" value="Save">Save</button>
</div>
</div>
</form>
Run Code Online (Sandbox Code Playgroud)
这是我在标题中的jQuery代码:
$(document).ready(function(){
$('#hidemultmachines').hide();
$('#multmachines').hide();
}
Run Code Online (Sandbox Code Playgroud)
当我把按钮放在表格外面时它起作用.为什么?
我有一组文件组成如下:
Product: Name
Description: description of product
Run Code Online (Sandbox Code Playgroud)
我想在没有'Product:'和的情况下只提取名称和描述的内容'Description:'.为此我做:
div = re.split('Product:\s+|Description:\s+', contentOfFile)
Run Code Online (Sandbox Code Playgroud)
问题是我得到一个包含3个元素的表而不是2个,在开头有一个''(空格).我不知道是否总是考虑空间因为我只是想在这种情况下:
["Name","description of product"]
Run Code Online (Sandbox Code Playgroud) 我正在尝试构建一个简单的 DialogFragment,其中包含一个文本视图和两个按钮(发送和取消)。
我想在 textview 第一个为空时禁用该按钮,但我的代码中的 positiveButton 变量始终为空,并且出现以下异常:
java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.Button.setEnabled(boolean)' on a null object reference
Run Code Online (Sandbox Code Playgroud)
这是代码:
public class SendFriendRequestFragment extends DialogFragment {
private TextView tvEmail = null;
Button positiveButton = null;
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
// Use the Builder class for convenient dialog construction
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
// Get the layout inflater
final LayoutInflater inflater = getActivity().getLayoutInflater();
final View layout = inflater.inflate(R.layout.fragment_send_friend_request, null);
// Inflate and set the layout for the …Run Code Online (Sandbox Code Playgroud) 我使用explode只从整行中提取字符串.但是使用这个:
$array = explode(" ", $line);
Run Code Online (Sandbox Code Playgroud)
它只将一行空格分开,而不是单词.例如,如果$ line是
$line="word1 word2 word3"
Run Code Online (Sandbox Code Playgroud)
然后我在数组中的条目之间也有空格(它包含:"word1","word2"和"word3",但也包含一个或两个"").
有谁知道如何只获得数组中的三个条目"word1","word2"和"word3"?