@Override
public void onClick(View view) {
Context context = view.getContext();
switch(view.getId()) {
case R.id.getGreetingButton:
Pair <Context,Integer>p=new Pair(context,1);
new RestTask().execute(p);
break;
}
}
private class RestTask extends AsyncTask<Pair<Context,Integer>, Void, Pair<Context,String>> {
@Override
protected Pair doInBackground(Pair<Context,Integer>... p) {
String text = "hello";
Pair <Context,String>result=new Pair(p.first,text);
return result;
}
@Override
protected void onPostExecute(Pair<Context,String>... p) {toaster(p.first, p.second);}
}
Run Code Online (Sandbox Code Playgroud)
1)你怎么称呼这个...东西,它做了什么?
2)为什么编译器找不到p.first和p.second?
3)你什么时候使用Pair.create(a,b)?
[supervisord]
nodaemon=true
logfile=/dev/stdout
pidfile=/var/run/supervisord.pid
childlogdir=/var/log/supervisor
Run Code Online (Sandbox Code Playgroud)
当我这样做时,主管会崩溃,因为它无法在/ dev/stdout中寻找
如何禁用supervisord在docker容器中创建任何日志文件?
data User = User { city :: Text
, country :: Text
, phone :: Text
, email :: Text}
instance ToJSON User where
toJSON (User a b c d)= object ["a" .= a
,"b" .= b
,"c" .= c
,"d" .= d]
test:: User -> IO Value
test u = do
let j = toJSON u
return j
Run Code Online (Sandbox Code Playgroud)
我想要的是文字
test::User -> IO Text
test u = do
let j = pack ("{\"city\":\"test\",\"country\":\"test\",\"phone\":\"test\",\"email\":\"test\"}")
return j
Run Code Online (Sandbox Code Playgroud)
我无法弄清楚如何从Value到Text
fmt.Println(v.Kind())
fmt.Println(reflect.TypeOf(v))
Run Code Online (Sandbox Code Playgroud)
如何找出切片的反射值的类型?
以上结果在
v.Kind = slice
typeof = reflect.Value
Run Code Online (Sandbox Code Playgroud)
当我尝试Set创建错误的切片时它会崩溃
t := reflect.TypeOf([]int{})
s := reflect.MakeSlice(t, 0, 0)
v.Set(s)
Run Code Online (Sandbox Code Playgroud)
例如[]int{},[]string{}在创建之前,我需要知道反射值的确切切片类型,而不是这样。
好的,所以我使用javascript/greasemonkey将以下html添加到网站中.(只是样品)
<ul>
<li><a id='abc'>HEllo</a></li>
<li><a id='xyz'>Hello</a></li>
</ul>
Run Code Online (Sandbox Code Playgroud)
我还为元素添加了一个click事件监听器.到目前为止,所有工作都很好,单击元素时会触发click事件.
但是...我在脚本中有另一个函数,在某个条件下修改了html,即它附加了它,所以它看起来像:
<ul>
<li><a id='abc'>Hello</a></li>
<li><a id='xyz'>Hello</a></li>
<li><a id='123'>Hello</a></li>
</ul>
Run Code Online (Sandbox Code Playgroud)
但是当这个完成时,它会破坏我为前两个元素添加的监听器...当我点击它们时没有任何反应.
如果我注释掉对附加函数的调用,它就会重新开始工作!
请帮忙...
不起作用
echo ${REV%%\n*}
Run Code Online (Sandbox Code Playgroud)
确实有效
echo ${REV%%
*}
Run Code Online (Sandbox Code Playgroud)
通过http://tldp.org/LDP/abs/html/parameter-substitution.html阅读后,我仍然无法弄清楚如何使其工作.
class Monad m => MonadState s m | m -> s where
-- | Return the state from the internals of the monad.
get :: m s
get = state (\s -> (s, s))
-- | Replace the state inside the monad.
put :: s -> m ()
put s = state (\_ -> ((), s))
-- | Embed a simple state action into the monad.
state :: (s -> (a, s)) -> m a
state f = do
s …Run Code Online (Sandbox Code Playgroud) 使用go 1.2 python 2.7和appengine 1.8.9
dev_appserver.py 在dos框中工作,位于Windows路径中。
goapp.exe 也可以在dos框中使用,并且位于Windows路径中。
知道为什么goapp.exe serve不起作用吗?
https://developers.google.com/web/fundamentals/getting-started/primers/shadowdom
这让我非常兴奋,我可以从头开始编写自己的自定义网页而无需聚合物。
例如,仅发现CSS :host在Edge和FireFox中不起作用。import在w3c弄清楚他们要使用es6模块之前,我现在可以不用html 了,但是每个浏览器都有自己的一半实现的Shadow DOM版本,而没有CSS会推动我的工作。
因此,我仍然需要完整的聚合物堆栈,以在所有浏览器中具有Web组件。
<script src="../webcomponentsjs/webcomponents-lite.js"></script>
<link rel="import" href="../hello-world.html">
<hello-world>Hello World Polymer 2.x</hello-world>
有人知道如何将Edge和FireFox填充为一个实际的Shadow DOM,而不是一个伪装成一个本地的Shadow DOM吗?
这是我尝试过的方法,但是我不知道如何告诉Edge和FireFox将其Shadow想要放置在其他位置并使用阴影/阴影。
<!DOCTYPE html>
<html>
<head>
<title>Components</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0"/>
</head>
<body>
<hello-world>Hello World ES2015</hello-world>
<script>
function loadScript(src, main) {
return new Promise(function(resolve, reject) {
const script = document.createElement('script');
script.async = true;
script.src = src;
script.onload = resolve;
script.onerror = reject;
document.head.appendChild(script);
});
}
let polyfilled = false;
const loadPromises = []; …Run Code Online (Sandbox Code Playgroud)go get -u github.com/junegunn/fzf 可以正常工作,但是想要像这样测试开发分支:
gert@gert ~/ GO111MODULE=on go get -u github.com/junegunn/fzf@devel
go: finding github.com/junegunn/fzf devel
go: finding golang.org/x/crypto latest
go: finding github.com/smartystreets/assertions latest
go: finding github.com/gopherjs/gopherjs latest
go: finding github.com/smartystreets/goconvey latest
go: finding github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1
go: finding golang.org/x/sys latest
go: finding golang.org/x/tools v0.0.0-20190328211700-ab21143f2384
go: gopkg.in/DATA-DOG/go-sqlmock.v1@v1.3.3: go.mod has non-....v1 module path "github.com/DATA-DOG/go-sqlmock" at revision v1.3.3
go get: error loading module requirements
Run Code Online (Sandbox Code Playgroud)
不知道这是怎么回事?如果我做得到相同的结果
GO111MODULE=on go get -u github.com/junegunn/fzf
go ×3
haskell ×2
android ×1
bash ×1
docker ×1
firefox ×1
innerhtml ×1
java ×1
javascript ×1
shadow-dom ×1
shady-dom ×1
supervisord ×1
windows ×1