我的Html
<div class="product-line">
<a href="#" alt="close" class="btn-close" title="Remove"><img alt="remove" src="img/close.png" /></a>
<input class="input-text" name="product-code" type="text" placeholder="Product Code" />
<input class="input-text" name="product-quantity" type="text" placeholder="Quantity" />
<input class="input-text" name="product-discript" type="text" placeholder="Discription of Product" disabled />
<label class="label-sign">£</label>
<input class="input-text price" name="product-price" type="text" placeholder="RRP Price" disabled />
<br>
</div>
Run Code Online (Sandbox Code Playgroud)
我的JS代码行
price = $(this).parent("div.product-line").find("input[name=product-price]").val( Number(price).toFixed(2) * quantity )
Run Code Online (Sandbox Code Playgroud)
基本上,如果我乘以例如40.2数量3,我得到类似120.600000000 ....我怎么能将它限制为2小数点.
数据通过JSON(由其他人制作)传入.
我是一名JS新手
我正在从带有datareader的表中获取值,如下所示:
string query = @"SELECT XMLConfig, Enable FROM TableCfg";
using (SqlConnection cnction = new SqlConnection(cnnstr))
{
cnction.Open();
using (SqlCommand sqlCmd = new SqlCommand(query, cnction))
{
SqlDataReader dtRead = sqlCmd.ExecuteReader();
while (dtRead.Read())
{
xmlConf = dtRead.GetString(0);
enabl = dtRead.GetString(1);
}
dtRead.Close();
}
}
Run Code Online (Sandbox Code Playgroud)
Enable字段是布尔值(True/False).有没有办法只获取行,其中field enable ="True"?我尝试使用LINQ,但我是新手,我一定是做错了.
using (SqlCommand sqlCmd = new SqlCommand(query, cnction))
{
SqlDataReader dtRead = sqlCmd.ExecuteReader();
var ob =(from IDataRecord r in sqlCmd.ExecuteReader()
where r.GetString(3).ToString() == "True"
select "Enable");
}
Run Code Online (Sandbox Code Playgroud)
请帮帮我.最好的祝福.
我不确定如何构建标题,但解释更简单.我正在使用c ++ 11 range for loops(链接).
我写了以下内容:
for(auto &elem:vec){
elem/=vec[0];
}
Run Code Online (Sandbox Code Playgroud)
哪个编译但不会改变向量'vec'中的任何内容.
另一方面,这有效:
elem0 = vec[0];
for(auto &elem:vec){
elem/=elem0;
}
Run Code Online (Sandbox Code Playgroud)
这是预期的吗?第一种方法有什么问题?如果有帮助,我的编译器版本是g ++ 4.6.3.
我在w3schools.com上进行了CSS测验,除了下面的答案之外,我得到了所有正确的答案.我试图搜索这个主题,但据我所知,答案应该是正确的.我哪里错了?真的很困惑.
15.哪个属性用于更改元素的字体?
你回答:
字体系列
错误的答案!
我正在尝试对List<String>一些项目进行排序。这是 unsorted List,以及它当前的排序方式:
Unsorted: [Pineapple, pineapple, apple, apricot, Banana, mango, Mango, melon, peach]
Sorted: [apple, apricot, Banana, mango, Mango, melon, peach, Pineapple, pineapple]
Run Code Online (Sandbox Code Playgroud)
怎么Mango不放在前面mango,又为什么放在Pineapple前面pineapple?
这是我的代码:
import java.util.*;
import java.lang.*;
import java.io.*;
class Test {
public static void main (String[] args) throws java.lang.Exception {
List<String> fruits = new ArrayList<String>(7);
fruits.add("Pineapple");
fruits.add("pineapple");
fruits.add("apple");
fruits.add("apricot");
fruits.add("Banana");
fruits.add("mango");
fruits.add("Mango");
fruits.add("melon");
fruits.add("peach");
System.out.println("Unsorted: " + fruits);
Collections.sort(fruits, new Comparator<String>() {
@Override
public int compare(String …Run Code Online (Sandbox Code Playgroud) 我看到了类似的帖子,但不完全是我要完成的任务。
我要做的就是将当前日期和时间保存在一个可以添加到数据库表的变量中。但是,当表单提交时,出现500 Server页面错误
下面是我到目前为止的代码:
<cfif isDefined("FORM.submit") AND #FORM.submit# IS NOT "">
<cfoutput>
<cfset var submit_date = #DateFormat(Now(),"mm/dd/yy - HH:mm:ss")#>
<cfquery name="InsertSuggestion" datasource="MainDB">
INSERT INTO Suggestion_Form (Submission_Date,Submission_Content)
VALUES ('#submit_date#','#FORM.suggestion_text#')
</cfquery>
</cfoutput>
<div style="text-align:center;width:100%;">We value your feedback. Your request has been recieved.</div>
<cfelse>
Run Code Online (Sandbox Code Playgroud) 我搜索并找到了一些相似但不完全的答案。
我有一个数组SongList(为简洁起见,显示 2 个项目...) - 第一对是键,第二对是一些 JSON。
SongList={
song_1:{title:"title of first song",artist:"the artist",mp3:"http://mysite/song1.mp3"},
song_2:{title:"title of second song",artist:"the artist",mp3:"http://mysite/song2mp3"}
...
};
Run Code Online (Sandbox Code Playgroud)
我希望能够检索给定值中的键(song_1或song_2)title。
我将循环遍历一个临时i项目数组,该数组中的每个项目都会有一个匹配项SongList,并且我会将键 ( song_1, song_2) 保存在最终数组中。
我做了一个小程序,用数学计算物理计算.
我有几个if语句做同样的事情,但对不同的变量,但它必须是它们好像一个TextBox是空的,int将是0.
这是一个例子:
if (firstForceTextBox.Text == "")
{
firstForceInt = 0;
}
else
{
firstForceInt = Convert.ToInt16(firstForceTextBox.Text);
}
if (secondForceTextBox.Text == "")
{
secondForceInt = 0;
}
else
{
secondForceInt = Convert.ToInt16(secondForceTextBox.Text);
}
Run Code Online (Sandbox Code Playgroud)
我想确保两者firstForceTextBox.Text == ""并secondForceTextBox.Text == ""做同样的工作,但要确保一个人不干预其他人.
在我的Android XML图形布局中,我无法显示我的ToggleButton.我收到一些错误(见下文).此外,我无法使用图形布局编辑任何其他内容.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.thunder4apps.lanterna.corinthians.MainActivity" >
<ToggleButton
android:id="@+id/togglebutton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textOn="Vibrate on"
android:textOff="Vibrate off"
android:onClick="onToggleClicked"/>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
错误:
Exception raised during rendering: -1
Exception details are logged in Window > Show View > Error LogThe graphics preview in the layout editor may not be accurate:
Different corner sizes are not supported in Path.addRoundRect. (Ignore for this session)
Path.isConvex is not supported. (Ignore for this session)
Run Code Online (Sandbox Code Playgroud) 我必须按照以下问题解决.我必须从总价中计算出价.例如,客户想要支付2000美元的总价格,但是从这个价格来看,会增加成本:
- 价格是投标价格的10%,最低10美元,最高50美元
- 销售价格:投标价格的2%
- 加价:5美元,出价在1到500之间10美元,出价在501到1000之间15美元,出价在1001到3000之间20美元,出价超过3000美元
- 存储成本:100美元
从这一切来看,我必须计算出总价为2000美元的竞标价格.我不知道如何做到这一点.任何人都可以给我一些关于算法应该是什么的提示或答案吗?
编辑:好的,我得到了如何计算代数,现在我卡住的是如何在代码或伪代码中编写算法.有人有提示吗?
c# ×2
java ×2
javascript ×2
algorithm ×1
alphabetical ×1
android ×1
arrays ×1
auto ×1
c++ ×1
c++11 ×1
coldfusion ×1
css ×1
datareader ×1
date ×1
decimal ×1
eclipse ×1
fetch ×1
font-family ×1
fonts ×1
for-loop ×1
if-statement ×1
jquery ×1
layout ×1
linq ×1
math ×1
operators ×1
sorting ×1
tofixed ×1
xml ×1