我有以下存储过程,只能通过id找到一个对象.
function sample(id) {
var context = getContext();
var response = context.getResponse();
var collection = context.getCollection();
var findObject = "SELECT * FROM Objects o where o.userId='" + id +"'";
// Query documents and take 1st item.
var isAccepted = collection.queryDocuments(
collection.getSelfLink(),
findObject,
function (err, feed, options) {
if (err) throw err;
// Check the feed and if empty, set the body to 'no docs found',
// else take 1st element from feed
if (!feed || !feed.length) throw new Error("Object not …Run Code Online (Sandbox Code Playgroud) 我有一个简单的cloud-init用户数据,我将其传递给ec2.我通过右键单击实例并在其中设置用户数据,在我的ec2实例上设置此数据.
以下是我的cloud-init用户数据
#cloud-config
runcmd:
- [ ls, -l, / ]
- [ sh, -xc, "echo $(date) ': hello world!'" ]
- [ sh, -c, echo "=========hello world'=========" ]
- [ touch, /home/ec2-user/hello.txt ]
final_message: "The system is finally up, after 10 seconds"
Run Code Online (Sandbox Code Playgroud)
我从这里得到了这个例子,我添加了touch命令
我的期望是看到/var/log/cloud-init.log上的数据.但我不认为那里.此外,我没有看到任何错误,也没有看到创建的hello.txt文件
有什么东西我错过了吗?
我正在运行亚马逊linux实例而不是ubuntu实例
我正在尝试为我的 android 应用程序中的 java 类编写测试用例,但它似乎没有按预期工作。
这是我的测试用例:
public void testGetColor() throws Exception {
ShadesColor color = new ShadesColor(100, 200, 250);
Assert.assertEquals(Color.rgb(100, 200, 250), color.getColor());
Assert.assertEquals(100, color.getRed());
Assert.assertEquals(200, color.getGreen());
Assert.assertEquals(250, color.getBlue());
}
Run Code Online (Sandbox Code Playgroud)
以下是 ShadesColor 类。
public class ShadesColor {
int color;
public ShadesColor(int red, int green, int blue)
{
color = Color.rgb(red, green, blue);
}
public int getColor(){
return color;
}
public ShadesColor interpolate(ShadesColor endColor, double percentage){
int red = (int)(this.getRed() + (endColor.getRed() - this.getRed()) * percentage);
int green = (int)(this.getGreen() + …Run Code Online (Sandbox Code Playgroud)