试图让操作员工作,但给我一堆错误:
我的头文件
template <unsigned short n>
class Vector {
public:
std::vector<float> coords;
Vector();
Vector(std::vector<float> crds);
friend std::ostream& operator <<(std::ostream& out, const Vector& v);
};
template <unsigned short n>
Vector<n>::Vector() {
coords.assign(n, 0.0);
}
template <unsigned short n>
std::ostream& operator<<(std::ostream& out, const Vector<n>& v) {
out << "(" << v.coords[1] << " - " << v.coords[2] << ")";
return out;
}
Run Code Online (Sandbox Code Playgroud)
测试文件
#include <iostream>
#include "vector.h"
using namespace std;
int main() {
Vector<3> toomas;
cout << toomas;
}
Run Code Online (Sandbox Code Playgroud)
错误:
C:\ CodeBlocks\kool\praks3\vector.h …
如何让这个查询起作用?
SELECT weather.id, cities.name, weather.date, weather.degree
FROM weather JOIN weather.city_id ON cities.id
WHERE weather.date = '2011-04-30';
Run Code Online (Sandbox Code Playgroud)
错误:架构"天气"不存在.
天气不是架构,它是一张桌子!
我有点熟悉C++,我知道对于几乎每个头文件,我都必须创建源文件.
现在我正在研究java接口和实现,它看起来是一样的.首先,您只需在一个类中命名变量和方法,然后在其他类中定义它们.
这些东西在C++和Java中是基本相同还是相似?
<head> #set($test = "works")) </head>
<script>
var get = "${test}"; // I also tried using '$test' and "$test" also
alert(get);
</script>
Run Code Online (Sandbox Code Playgroud)
它提醒了$ {}测试,但应打印作品.
我怎样才能让它发挥作用?
我正在尝试将字符串解析为日期,这就是我所拥有的:
SimpleDateFormat sdf = new SimpleDateFormat("EEE MMM dd yyyy HH:mm:ss zZ (zzzz)");
Date date = new Date();
try {
date = sdf.parse(time);
} catch (ParseException e) {
e.printStackTrace();
}
Run Code Online (Sandbox Code Playgroud)
要解析的字符串是这样的:
Sun Jul 15 2012 12:22:00 GMT+0300 (FLE Daylight Time)
Run Code Online (Sandbox Code Playgroud)
我关注了http://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html
很确定我已经完成了这本书的所有内容.但是它给了我ParseException.
java.text.ParseException: Unparseable date:
"Sun Jul 15 2012 12:22:00 GMT+0300 (FLE Daylight Time)"
Run Code Online (Sandbox Code Playgroud)
我究竟做错了什么?我试过的模式:
EEE MMM dd yyyy HH:mm:ss zzz
EEE MMM dd yyyy HH:mm:ss zZ (zzzz)
Run Code Online (Sandbox Code Playgroud) 我有一个值y,我想知道这个值是否在这组值中:x1, x2, ... xn.
我可以这样做:
if(y = x1 or y = x2 or .....)
Run Code Online (Sandbox Code Playgroud)
但是有更好的方法吗?伪代码:
if(y in (x1, x2, ...., xn))
Run Code Online (Sandbox Code Playgroud) 我将变量值设置为null,但有问题:
public class BestObject {
private Timestamp deliveryDate;
public void setDeliveryDate(Timestamp deliveryDate) {
this.deliveryDate = deliveryDate;
}
}
BeanUtils.setProperty(new BestObject(), "deliveryDate", null); // usually the values are not hardcoded, they come from configuration etc
Run Code Online (Sandbox Code Playgroud)
这是错误:
org.apache.commons.beanutils.ConversionException: No value specified
at org.apache.commons.beanutils.converters.SqlTimestampConverter.convert(SqlTimestampConverter.java:148)
at org.apache.commons.beanutils.ConvertUtils.convert(ConvertUtils.java:379)
at org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:999)
Run Code Online (Sandbox Code Playgroud)
基本上它试图将java.sql.Timestamp值设置为null,但由于某种原因它不起作用.
另一方面,我使用反射包装器BeanUtils(http://commons.apache.org/proper/commons-beanutils/),也许这可以用简单的反射?
这是购买东西的标准paypal形式.
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="you@youremail.com">
<input type="hidden" name="item_name" value="Item Name">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="amount" value="0.00">
<input type="image" src="http://www.paypal.com/en_US/i/btn/x-click-but01.gif" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
</form>
Run Code Online (Sandbox Code Playgroud)
我不想要这个表单,我想用angularJS做这个:
<button ng-click="checkOut()" class="btn btn-default">Buy</button>
this.checkOut = function () {
var data = {
... // handle all data
};
$http.post('https://www.paypal.com/cgi-bin/webscr', data).success(function (data) {
console.log("success " + data);
}).error(function (data) {
console.log("error " + data);
});
}
Run Code Online (Sandbox Code Playgroud)
这给了我一个错误:
XMLHttpRequest无法加载https://www.paypal.com/cgi-bin/webscr …
instanceof如何正常工作?当我有一个扩展并实现彼此的对象层次结构时,某些事物的实例是否通过这两条线工作?
例如,我想知道如果我的对象是实例List或ArrayList或Collection?
我检查了这棵树,http://docs.oracle.com/javase/6/docs/api/java/util/package-tree.html
而且他们似乎完全属于Object当下,但我认为我需要的是AbstractCollection,甚至是正常的Collection,因为这似乎是层次结构中最高的.
当我检查一个对象只Collection覆盖所有这三个类时,我会没事吗?
using (var browser = new WebBrowser()) {
browser.Navigate(location);
browser.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(wb_DocumentCompleted);
while (browser.ReadyState != WebBrowserReadyState.Complete) {
Application.DoEvents();
}
log.Info("READY " + browser.Document.GetElementById("main").InnerText);
}
private void wb_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) {
WebBrowser wb = (WebBrowser)sender;
log.Info("COMPLETED " + wb.Document.GetElementById("main").InnerText);
}
Run Code Online (Sandbox Code Playgroud)
两个日志都返回尚未应用JavaScript更改的元素.
现在我在WinForms中有另一个WebBrowser,它将在启动时加载页面.这次我也使用了这个DocumentCompleted活动,但是我没有得到任何javascripted消息.
form.webBrowser1.DocumentCompleted += (sender, e) => {
log.Info("READY HIAAR" + form.webBrowser1.Document.GetElementById("main").InnerText);
};
Run Code Online (Sandbox Code Playgroud)
最后,我尝试使用按钮获取源代码.首先我让WebBrowser在WinForms中加载页面,然后在5秒后按下按钮:
form.dataButton.Click += (sender, e) => {
log.Info("READY HIAAR" + form.webBrowser1.Document.GetElementById("main").InnerText);
};
Run Code Online (Sandbox Code Playgroud)
只有最后一个log.info返回我需要的实际内容.
如何在所有JavaScript加载并运行时捕获事件?点击击败目的.
java ×4
javascript ×3
c++ ×2
.net ×1
angular-http ×1
angularjs ×1
date ×1
html ×1
instanceof ×1
jquery ×1
ostream ×1
paypal ×1
postgresql ×1
reflection ×1
string ×1
vba ×1
velocity ×1