我发现还有一个Akka演员模型,所以我想知道Akka的演员和Scala的演员模特之间有什么区别?
我在哪里可以找到官方的图谱API错误代码列表?
我已经使用Graph API半年了,在过去的6个月里,错误代码的格式已经改变了两次!
我第一次看到错误代码,它看起来像:
{
"error": {
"message": "Error invalidating access token: The session has been invalidated because the user has changed the password.",
"type": "OAuthException",
}
}
Run Code Online (Sandbox Code Playgroud)
这真的很奇怪,错误消息没有提供任何错误代码!
然后几个月后,引入了"预期的"错误代码.
{
"error": {
"message": "Error invalidating access token: The session has been invalidated because the user has changed the password.",
"type": "OAuthException",
"code": 190,
}
}
Run Code Online (Sandbox Code Playgroud)
但遗憾的是,你仍然无法通过检查"代码"来区分错误是什么,因为许多具有相同"类型"的错误具有相同的"代码".
刚才,我发现错误信息包含新字段:
{
"error": {
"message": "Error invalidating access token: The session has been invalidated because the user has changed the password.",
"type": "OAuthException", …Run Code Online (Sandbox Code Playgroud) 我看到一些代码写特征如下:
trait SelfAware { self: Self =>
....
}
class Self
val s = new Self with SelfAware // this is ok
println(s.self) // error happened
class X
new X with SelfAware // error happened here
Run Code Online (Sandbox Code Playgroud)
我想知道错误发生的原因以及如何以这种方式使用特征?
启动cygwin shell后,它只是位于错误的主目录中:
xfire@codingme.com ~
$ pwd
/cygdrive/c/Users/xfire
Run Code Online (Sandbox Code Playgroud)
但它曾经是/ home/xfire
xfire@codingme.com /etc
$ cat passwd | grep xfire
xfire:unused:22773:10513:U-CORP\xfire,S-1-5-21-527237240-725345543-682003330-12773:/home/xfire:/bin/bash
Run Code Online (Sandbox Code Playgroud)
并且/ home/xfire中的.bashrc没有被执行,即使我将它复制到/ cygdrive/c/Users/xfire,它也不起作用!
我正在绘制一个像这样的pyplot表:
sub_axes.table(cellText=table_vals,
colWidths = [0.15, 0.25],
rowLabels=row_labels,
loc='right')
Run Code Online (Sandbox Code Playgroud)
我想更改表格内容的字体大小,发现有一个fontsize属性,请参考'table'的定义.
所以它变成:
sub_axes.table(cellText=table_vals,
colWidths = [0.15, 0.25],
rowLabels=row_labels,
fontsize=12,
loc='right')
Run Code Online (Sandbox Code Playgroud)
但是当我执行代码时,我收到了一个错误:
TypeError: table() got an unexpected keyword argument 'fontsize'
Run Code Online (Sandbox Code Playgroud)
这个属性是否已被弃用?如何用pyplot更改表格的字体大小?
在Akka官方文件中,他们否认:
为了防止演员的可见性和重新排序问题,Akka保证以下两个"之前发生"规则:
actor发送规则:消息发送给一个actor发生在同一个actor接收到该消息之前.actor后续处理规则:一个消息的处理在同一个actor处理下一个消息之前发生.
请参阅文档以获取详细信息.
我想知道阿卡如何实现这个目标.我刚刚浏览了源代码(此时最新),我认为在执行之前应该有一个Lock Actor.receive,但我没有找到任何锁(我认为).最后,我发现了一条评论ActorCell.invoke:
//内存一致性由邮箱处理(读取邮箱状态,然后处理邮件,然后写入邮箱状态
是的Mailbox.status,我想这就是我在寻找的东西.我看到他们Unsafe用来访问/更新status字段,但我无法弄清楚如何确保内存可见性.
我在阅读ForkJoinPool的实现时遇到了sum.misc.Unsafe类.但是在JDK中没有找到源代码或api文档.
我在哪里可以找到sun.misc的源代码或api文档.*
我正在学习如何将Lua嵌入到C中,并从一个简单的例子开始:
demo.c
#include <stdio.h>
#include <string.h>
#include <lua.h>
#include <lauxlib.h>
#include <lualib.h>
int main (void) {
char buff[256];
int error;
lua_State *L = luaL_newstate(); /* opens Lua */
luaopen_base(L); /* opens the basic library */
luaopen_table(L); /* opens the table library */
luaopen_io(L); /* opens the I/O library */
luaopen_string(L); /* opens the string lib. */
luaopen_math(L); /* opens the math lib. */
while (fgets(buff, sizeof(buff), stdin) != NULL) {
error = luaL_loadbuffer(L, buff, strlen(buff), "line") ||
lua_pcall(L, 0, 0, …Run Code Online (Sandbox Code Playgroud) 我的git status命令最近变慢了.
我试图跟踪执行情况:
GIT_TRACE=1 GIT_CURL_VERBOSE=2 git status
Run Code Online (Sandbox Code Playgroud)
输出:
10:24:26.589696 run-command.c:640 trace: run_command: GIT_INDEX_FILE=.git/index git submodule summary --cached --for-status --summary-limit 1 HEAD
10:24:26.611043 git.c:576 trace: exec: git-submodule summary --cached --for-status --summary-limit 1 HEAD
10:24:26.611744 run-command.c:640 trace: run_command: git-submodule summary --cached --for-status --summary-limit 1 HEAD
10:24:26.688245 git.c:576 trace: exec: git-sh-i18n--envsubst --variables 'usage: $dashless $USAGE'
10:24:26.688921 run-command.c:640 trace: run_command: git-sh-i18n--envsubst --variables 'usage: $dashless $USAGE'
10:24:26.712823 git.c:576 trace: exec: git-sh-i18n--envsubst 'usage: $dashless $USAGE'
10:24:26.713851 run-command.c:640 trace: run_command: git-sh-i18n--envsubst 'usage: $dashless $USAGE'
10:24:26.754163 …Run Code Online (Sandbox Code Playgroud) 当评估Option的数据时,我试图使用fold[B](ifEmpty: => B)(f: A => B): B,但我对结果有点困惑:
scala> Some(1).fold(() => "empty")(d => d.toString)
res5: () => String = <function0>
scala> Some(1).fold(() => "empty")(d => d.toString)()
res6: String = 1
Run Code Online (Sandbox Code Playgroud)
这个方法的源代码:
@inline final def fold[B](ifEmpty: => B)(f: A => B): B =
if (isEmpty) ifEmpty else f(this.get)
Run Code Online (Sandbox Code Playgroud)
我预计结果是String,但得到了<function0>,为什么?
==================
我尝试使用以下代码模拟这种情况:
case class Demo(size: Int)
// version 1, with the same fold method as Option
case class X [A <: Demo](data: A) {
def fold[B](ifEmpty: => …Run Code Online (Sandbox Code Playgroud) 以下定义有什么区别?
1.def debug(msg: => AnyRef) = { println(String.valueOf(msg)) }
2.def debug(msg: () => AnyRef) = { println(String.valueOf(msg)) }
Run Code Online (Sandbox Code Playgroud)
第一个定义可以接受任何东西,字符串或函数等,但第二个定义只能接受函数.我想知道reazon.
scala> def debug(msg: => AnyRef) = { println(String.valueOf(msg)) }
debug: (msg: => AnyRef)Unit
scala> debug("hi")
hi
scala> debug(() => "xx")
<function0>
scala> def debug(msg: () => AnyRef) = { println(String.valueOf(msg)) }
debug: (msg: () => AnyRef)Unit
scala> debug("hi")
<console>:9: error: type mismatch;
found : java.lang.String("hi")
required: () => AnyRef
debug("hi")
^
Run Code Online (Sandbox Code Playgroud)