我有7.125(双),需要使它7.15.什么是最简单的方法?
发现回合,但我得到7.13,请帮忙.
谢谢
好的。我正在制作一个带有数据库后端的 java web 应用程序来对一些数据做一些 CRUD。单击项目旁边的编辑按钮时,它会导航到包含当前数据的表单进行编辑。其中一个字段是布尔值,我想将它显示为一个复选框,以便True选中False它而不选中它。
我尝试了许多不同的变体,但似乎都不起作用。以下是一些示例,其中<%= action.get("stable")%>返回带有True或的字符串False
<input TYPE=checkbox name="stable" value=<%= action.get("stable") %>
<input TYPE=checkbox name="stable" value=<%= action.get("stable")?"True":"False" %><%= action.get("stable")?"checked":"" %>
<input TYPE=checkbox name="stable" checked=<%= action.get("stable")%>/>
Run Code Online (Sandbox Code Playgroud)
那么如何根据返回的字符串将复选框设置为选中/取消选中 action.get("stable")
如果问题有点微不足道,谢谢您的帮助。
我有一个适配器,我加载我的用户和一个按钮/ textfiled发送邀请.在适配器中我这样做:
@Override
public View getView(int position, View convertView, ViewGroup parent) {
UserAgenda ua = getItem(position);
ViewHolder holder;
if (convertView == null) {
//...
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
if(ua.getInvited() != null){
if(ua.getInvited().equals("true")){
addTextViewInvited(convertView);//add a textview as the user is invited
}
else if(ua.getInvited().equals("false")){
addButton2Invite(convertView,ua);//add the button to invite
}
}
return convertView;
}
Run Code Online (Sandbox Code Playgroud)
在addButton2Invite的方法上,我发送邀请为:
private void addButton2Invite(final View convertView, UserAgenda ua) {
bt2Invited.setOnClickListener(new OnClickListener() {
@Override
public void onClick(final View v) {
final Button bt2Invited …Run Code Online (Sandbox Code Playgroud) 嗨所有,当封闭它的线程完成后,守护程序线程是否会停止工作?或者"主"线程完成时守护程序线程会停止吗?
我在jre6上测试了这个例子,结果是daemon thread stopped working when the enclosing it thread finished.请注意,java docs表示当没有其他应用程序线程时,守护程序线程将被终止.并且不会说父级非守护程序线程保留时会杀死守护程序线程.
请给我答案.请寄给我关于这个问题的任何材料.对不起我的英语不好.
public class Main {
public static void main(String[] args) {
Thread simple = new Thread(new SimpleTask());
simple.start();
}
}
class SimpleTask implements Runnable {
public void run() {
try {
Thread daemon = new Thread(new DaemonTask());
daemon.setDaemon(true);
daemon.start();
Thread.sleep(5000);
} catch (InterruptedException e) {}
};
}
class DaemonTask implements Runnable {
public void run() {
int i = 0;
while (true) {
try {
System.out.println("a" …Run Code Online (Sandbox Code Playgroud) 我有一个包含许多字段的java bean.我知道如何toString()使用StringBuilder 重写并直接使用字段名称.有没有办法以更好的方式做到这一点,没有字段名称?
提前致谢.
PS:这个bean已经在我的产品中实现了.
是否可以在其单元格渲染器中设置JTable列的宽度?我试过以下代码,但似乎什么也没做.
//in main class where table defined;
table.getColumnModel().getColumn(0).setCellRenderer(renderer);
//in renderer class;
setSize(10, getPreferredSize().height);
Run Code Online (Sandbox Code Playgroud) 我需要从Date对象中删除时间。这是我的尝试,
代码:
System.out.println("date " + dbDate);
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
System.out.println("formatter.format(dbDate) " + formatter.format(dbDate));
System.out.println("final " + formatter.parse(formatter.format(dbDate)));
Run Code Online (Sandbox Code Playgroud)
输出:
date 2011-12-03 23:59:59.0
formatter.format(dbDate) 2011-12-03
final Sat Dec 03 00:00:00 IST 2011
Run Code Online (Sandbox Code Playgroud)
我想在2011-12-03. 但转换toString()后Date是不同的格式。我错过了一些东西。请帮忙。
更新:
在我的应用程序中,我有两种不同的方法来获取dbDate. EXPIRY_DATE列是DATE.
第一个查询使用dbDate = (java.util.Date) rs.getDate("EXPIRY_DATE");.
为此dbDate,System.out.println("date " + dbDate);给date 2011-12-03
第二个查询使用 dbDate = rs.getTimestamp("EXPIRY_DATE");
为此dbDate,System.out.println("date " + dbDate);给date 2011-12-03 …
我正在进入一个需要一些自动审查工具的项目.上周我们System.exit()在代码中找到了一些关闭应用服务器的内容.
似乎FindBugs没有捕获System.exit().还有其他工具可以捕捉System.exit()到我可以从日食中运行吗?
保持Util类方法静态是一个好习惯还是实例方法好?
各位程序员再次问好.
所以我正在创建一个程序,允许用户指定他们想要的保险类型作为保险单的一部分.
由于它们只有4种类型的封面可供选择,我想使用一套或散列集来跟踪提供给用户的封面类型.
问题是,似乎没有摆脱重复,它正在将它视为arraylist,当我打印出集合的内容时,我得到重复,这不应该发生在集合中.
这是我用来将创建的保险类型对象传递给保险单类的代码.在实例化之后.
CoverType theInsuranceType = new CoverType("Fire",250);
theInsurancePolicy.includeCover(theInsuranceType);
Run Code Online (Sandbox Code Playgroud)
这是我在保险单类中使用的代码,用于跟踪用户已采取的保险类型.
import java.util.*;
// Class: InsurancePolicy
// Purpose: To represent a particular customer's insurance agreement
public class InsurancePolicy {
//ArrayList<Product> orderList = new ArrayList<Product>();
private static int totalPolicyCost;
private static String name = null;
private static int price = 0;
private int amount = 0;
private static int total = 0, claims = 0;
private static Set<CoverType> TheCoverType = new HashSet<CoverType>();
public static boolean includeCover(CoverType which)
{
TheCoverType.add(which);
System.out.println(which.getName()+" …Run Code Online (Sandbox Code Playgroud) 嘿,这是我的用户注册表(register_hirer.php),其中我正在尝试输入员工的详细信息但不起作用.它在行之后给出一个解析错误:if(isset($ _ POST ['submit']),它只有一个{.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>The Freelance World</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<body>
<?php
include"include/connection.php";
if (isset($_POST['submit'])
{
mysql_real_escape_string($_POST['username']);
$checkusername=mysql_query("SELECT * FROM employer WHERE eusername='{$_POST['username']}'");
if (mysql_num_rows($checkusername)==1)
{
echo "username already exist";
}
else
{
$query = "insert into employer(efname,elname,egender,eemail,eusername,epwd,eadd,ephone,ecity,ecountry) values ('".$_POST['first_name']."','".$_POST['last_name']."','".$_POST['gender']."','".$_POST['email']."','".$_POST['username']."','".$_POST['password']."','".$_POST['address']."','".$_POST['phone']."','".$_POST['city']."','".$_POST['country']."')";
$result = mysql_query($query) or die (mysql_error());
echo " Thanks for registration";
}
}
?>
<form name="register_hirer" method="post" action="register_hirer.php" >
<pre><strong>First Name</strong> <input type="text" name="first_name" > </pre>
<pre><strong>Last Name </strong> <input …Run Code Online (Sandbox Code Playgroud)