我正试图让我的头围绕碎片,以便为ICS准备我的应用程序.
我有以下文件来获取您可以拥有的最基本的片段应用程序.它应该在启动时具有此功能:一个片段布局,文本视图为"片段1",旁边是另一个带有"Fragment2"的片段布局.
我的包名是 com.mwerner.fragments
我的文件是:
FragmentsActivity.java的代码是:
package com.mwerner.fragments;
import android.app.Activity;
import android.os.Bundle;
public class FragmentsActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}
Run Code Online (Sandbox Code Playgroud)
ExamplesFragment.java
package com.mwerner.fragments;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
public class ExamplesFragment extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return …Run Code Online (Sandbox Code Playgroud) 我在远程机器上有一个 rails 服务器(debian wheezy、ruby 2.2、rails 4.2),当我尝试在本地浏览器或 curl 中连接到它时,服务器没有响应。请求超时。但是,当我通过 ssh 进入该框时,wget localhost:3000它完美地获得了根页面。有什么建议?
这是我的计划.非常简单地说,它应该将输入的数字舍入到给定的小数位数.即4.245舍入到2位小数将给出4.25.但是,我总是只将它四舍五入为整数...为什么?让我感到困惑的是,我在android中使用相同的代码并且它完美无缺
import java.util.Scanner;
public class Rounder {
public static void main(String[] args) {
double input1, roundednumber;
int input2;
Scanner keyboard = new Scanner(System.in);
System.out.println("number to round ");
input1 = keyboard.nextDouble();
System.out.println("decimals");
input2 = keyboard.nextInt();
roundednumber = rounder(input1, input2);
System.out.println(roundednumber);
}
public static double rounder(double number, int decimals){
int multiplier = (int) Math.pow(10, decimals);
double roundednumber;
roundednumber = Math.round(number*multiplier)/multiplier;
return roundednumber;
}
}
Run Code Online (Sandbox Code Playgroud)
这是我的android类的片段
double result1 = fv1/(Math.pow(1+(r1/n1),n1*t1));
result1 = (double) (Math.round(result1 * 100)) / 100;
Run Code Online (Sandbox Code Playgroud) 当我去生成设计视图时,我想修改新的注册页面以捕获不仅仅是电子邮件和密码.我的设计用户模型有类似的字段first name last name address等等.
这是我现在的表格
<div class="row">
<div class="col-sm-6 col-sm-offset-3">
<h2>Sign up</h2>
<%= simple_form_for(resource, as: resource_name, url: registration_path(resource_name), html: {class:'form-horizontal'}) do |f| %>
<%= f.error_notification %>
<div class="row">
<%= f.input :email, required: true, autofocus: true %>
<%= f.input :password, required: true %>
<%= f.input :password_confirmation, required: true %>
</div>
<div class="row">
<h2>About yourself</h2>
<%= f.input :first_name, required: true %>
<%= f.input :last_name, required: true %>
<%= f.input :phone, required: true %>
<%= f.input :addressL1, label: 'Address Line …Run Code Online (Sandbox Code Playgroud) 我有一个while循环,每次运行大约1000万次递增变量"day".我希望程序只在一百万天过后打印一条线(即
100万天过去了
200万天过去了
...
循环完成
到目前为止我有代码:
double dayMill; //outside the loop
...
dayMill = day/1000000; //every runthrough of the loop
Run Code Online (Sandbox Code Playgroud)
我正在考虑使用if语句
if( (int)dayMill == dayMill){}
Run Code Online (Sandbox Code Playgroud)
因为当天= 1,000,000然后daymill = 1所以作为一个int,它也是1.但这不起作用.它打印了0.0百万天...很多,直到1.0很多.....从来没有我想要的每一百万行的一行
Hii有一个只包含text_field_tag的ajax提交表单.我想在用户开始输入搜索字符串后立即提交表单.带宽/滞后不是问题,因为应用程序将托管在公司的内部网中.
我目前有这个:
<%= text_field_tag :search, params[:search], onchange: "$(this).parent('form').submit();"%>
Run Code Online (Sandbox Code Playgroud)
但是,当我开始输入表单时,它不会提交表单.只有当我点击进入.
怎么会?
android ×2
java ×2
ajax ×1
android-4.0-ice-cream-sandwich ×1
devise ×1
forms ×1
jquery ×1
rounding ×1
while-loop ×1