自1970年1月1日以来,如何获得Scala UTC时间戳(以秒为单位)?
这是我的代码:
class testActor extends Actor {
var test = "test2"
def receive = {
case "test" ?
"works"
}
}
def test = Action {
var test = "test"
val system = ActorSystem("MySystem")
val myActor = system.actorOf(Props[testActor.testActor], name = "testActor")
test = Await.result(myActor ? "test", Duration(1, TimeUnit.SECONDS))
}
Run Code Online (Sandbox Code Playgroud)
我收到这行错误:
test = Await.result(myActor ? "test", Duration(1, TimeUnit.SECONDS))
Run Code Online (Sandbox Code Playgroud)
错误是:
找不到参数超时的隐含值:akka.util.Timeout
我有这个字符串:
var htmlString;
Run Code Online (Sandbox Code Playgroud)
分配给:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<html>
<head>
<title>Payment Receipt</title>
<link rel="stylesheet" type="text/css" href="content/PaymentForm.css">
<style type="text/css">
</style>
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/>
</head>
<body>
<div id="divPageOuter" class="PageOuter">
<div id="divPage" class="Page">
<!--[1]-->
<div id="divThankYou">
Thank you for your order!
</div>
<hr class="HrTop">
<div id="divReceiptMsg">
You may print this receipt page for your records.
</div>
<div class="SectionBar">
Order Information
</div>
<table id="tablePaymentDetails1Rcpt">
<tr>
<td class="LabelColInfo1R">
Merchant:
</td>
<td class="DataColInfo1R">
<!--Merchant.val-->
Ryan
<!--end-->
</td>
</tr>
<tr>
<td class="LabelColInfo1R"> …Run Code Online (Sandbox Code Playgroud) 这是我的代码:
class testActor extends Actor {
var test = "test2"
def receive = {
case "test" ?
test="works"
"works"
}
}
def test = Action {
var test = "test"
val system = ActorSystem("MySystem")
val myActor = system.actorOf(Props[testActor.testActor], name = "testActor")
myActor ! "test"
test = myActor.test
Ok(views.html.test(test))
}
Run Code Online (Sandbox Code Playgroud)
行:test = myActor.test不起作用.
我要么需要一种方法来访问actor函数返回的内容,在本例中是"works",或者是一种访问Actor内变量的方法.
我需要能够发送证书文件(.pem,我认为),使用scala和dispatch发送get请求.
你是怎样做的?
这段代码工作正常:
在控制器中:
Ok(views.html.payment(message,test,x_card_num,x_exp_date,exp_year,exp_month,x_card_code,x_first_name,x_last_name,x_address,x_city,x_state,x_zip,save_account,product_array,x_amount,products_json,auth_net_customer_profile_id,auth_net_payment_profile_id,customer_id))
Run Code Online (Sandbox Code Playgroud)
在视图中:
@(message: String, test: String, x_card_num: String, x_exp_date: String,exp_year: String, exp_month: String, x_card_code: String, x_first_name: String, x_last_name: String, x_address: String, x_city: String, x_state: String, x_zip: String, save_account: String, product_array: Map[String,Map[String,Any]], x_amount: String, products_json: String, auth_net_customer_profile_id: String,auth_net_payment_profile_id: String,customer_id: String)
Run Code Online (Sandbox Code Playgroud)
但是,当我尝试向控制器添加一个变量并像这样查看时:
Ok(views.html.payment(message,test,x_card_num,x_exp_date,exp_year,exp_month,x_card_code,x_first_name,x_last_name,x_address,x_city,x_state,x_zip,save_account,product_array,x_amount,products_json,auth_net_customer_profile_id,auth_net_payment_profile_id,customer_id,saved_payments_xml))
@(message: String, test: String, x_card_num: String, x_exp_date: String,exp_year: String, exp_month: String, x_card_code: String, x_first_name: String, x_last_name: String, x_address: String, x_city: String, x_state: String, x_zip: String, save_account: String, product_array: Map[String,Map[String,Any]], x_amount: String, products_json: String, auth_net_customer_profile_id: String,auth_net_payment_profile_id: String,customer_id: String, …Run Code Online (Sandbox Code Playgroud) 我读过的所有教程都是这样的:
class HelloWorldActor extends Actor {
def receive = {
case "Hello" => self.reply("World")
}
}
val myActor = system.actorOf(Props[MyActor], name = "myactor")
Run Code Online (Sandbox Code Playgroud)
我想知道AKKA是否支持Actor类中的act()函数,如下所示:
class HelloWorldActor extends Actor {
def act() = {
}
}
Run Code Online (Sandbox Code Playgroud)
然后你可以打电话:
val myActor = new HelloWorldActor
myActor.start()
Run Code Online (Sandbox Code Playgroud)
我想这样做是因为我的演员不会收到任何消息.它只是自己工作.那么我可以在我的AKKA演员中使用act()函数吗?
这个MD5调用有3个参数,"MD5",字符串,然后是$ transaction_key
hash_hmac("md5", $api_login_id . "^" . $fp_sequence . "^" . $fp_timestamp . "^" . $amount . "^", $transaction_key);
Run Code Online (Sandbox Code Playgroud)
我将如何在Scala中重现这一点?我找不到带有"键"的MD5功能.