在我的Windows机器上,我安装了Visual Studio代码.要手动运行测试,我将进入项目文件夹并输入
go test main_test.go
Run Code Online (Sandbox Code Playgroud)
它完美地运作.
但我有一种情况需要调试我的测试以了解正在发生的事情.
为此,我打开launch.json并添加配置
{
"name": "Tests",
"type": "go",
"request": "launch",
"mode": "test",
"remotePath": "",
"port": 2346,
"host": "127.0.0.1",
"program": "${workspaceRoot}",
"env": {},
"args": [
"main_test.go"
],
"showLog": true
}
Run Code Online (Sandbox Code Playgroud)
按完F5后,我有
2017/03/29 13:28:11 server.go:73: Using API v1
2017/03/29 13:28:11 debugger.go:68: launching process with args: [./debug.test main_test.go main_go]
not an executable file
Process exiting with code: 1
Run Code Online (Sandbox Code Playgroud)
任何想法为什么会出现这个错误以及它正在寻找什么可执行文件?
我有两个微服务。第一个服务使用google protobuf(google docs)对消息进行编码并发送到第二个。第二个解码此消息并使用数据。
现在我需要向这个消息对象添加一个字段。如果我只在一侧进行,它会破坏另一侧吗?
例如,如果我添加一些东西,json这不会破坏任何东西。真的一样google protobuf吗?
我有一个简单的对象
@Data
@Builder
public class Address {
private Long id;
private String street;
}
Run Code Online (Sandbox Code Playgroud)
我做了@Builder注释的delombok,我看到下一个代码生成
@Data
public class Address {
private Long id;
private String street;
@java.beans.ConstructorProperties({"id", "street"})
Address(Long id, String street) {
this.id = id;
this.street = street;
}
public static AddressBuilder builder() {
return new AddressBuilder();
}
public static class AddressBuilder {
private Long id;
private String street;
AddressBuilder() {
}
public AddressBuilder id(Long id) {
this.id = id;
return this;
}
public AddressBuilder street(String street) …Run Code Online (Sandbox Code Playgroud) 我有一个简单的警报对话框,其中包含单选项目
val alertDialog = AlertDialog.Builder(this)
alertDialog.setTitle("My Title")
val array = arrayOf("aa", "bb", "cc")
alertDialog.setSingleChoiceItems(array, 0) { _, selectedItem ->
}
alertDialog.setNegativeButton("Cancel") { _, _ ->
}
alertDialog.create()
alertDialog.show()
Run Code Online (Sandbox Code Playgroud)
我已将警报对话框的自定义样式添加到我的主题中
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
.........
<item name="android:timePickerDialogTheme">@style/DefaultAlertDialogTheme</item>
<item name="android:datePickerDialogTheme">@style/DefaultAlertDialogTheme</item>
<item name="android:alertDialogTheme">@style/DefaultAlertDialogTheme</item>
</style>
Run Code Online (Sandbox Code Playgroud)
这是我的风格
<style name="DefaultAlertDialogTheme" parent="Theme.AppCompat.Light.Dialog.Alert">
<item name="android:colorAccent">@color/greenButtonBackgroundColor</item>
<item name="android:textColorSecondary">@color/greenButtonBackgroundColor</item>
<!--title-->
<item name="android:textColor">@color/toolbarTitleTextColor</item>
</style>
Run Code Online (Sandbox Code Playgroud)
当我运行该应用程序时,我看到此警报
有没有办法在不创建自定义布局的情况下更改单选按钮附近文本的颜色?
我对 Sumologic 中的搜索查询有点迷失。我需要获取_sourceHost包含的日志production
对于 SQL,它看起来像这样
WHERE app="my-app" AND _sourceHost LIKE "%production%"
Run Code Online (Sandbox Code Playgroud)
有人知道 Sumologic 是否可能吗?
在Auth0中,有两种用于jwt令牌签名的算法:RS256和HS256。
RS256是一种非对称算法,这意味着有两个密钥:一个公共密钥和一个私有密钥(秘密)。Auth0具有用于生成签名的密钥,而JWT的使用者具有用于验证签名的公共密钥。
HS256是一种对称算法,这意味着只有一个秘密密钥,在两方之间共享。相同的密钥可用于生成签名并进行验证。为了使密钥保持机密,应格外小心。
他们在文档中描述了的优势RS256。有人可以向我解释使用HS256算法的优点,我现在看不到它们,但是我很确定有一些优点。
在我的Kotlin应用程序中,我有像这样的可空变量
private var myCallback : (() -> Unit)? = null
Run Code Online (Sandbox Code Playgroud)
是否可以使用null安全运算符?来调用它?这给了我一个编译错误.
myCallback?()
Run Code Online (Sandbox Code Playgroud)
如果它不是空的话,我发现只有这种丑陋的方式
if(myCallback != null)
myCallback!!()
Run Code Online (Sandbox Code Playgroud) 我在 Kotlin 创建的 Android 单元测试中看到这样的代码
`when`(context.getSharedPreferences(anyString(), anyInt())).thenReturn(sharedPreferences)
Run Code Online (Sandbox Code Playgroud)
你能解释一下为什么when在里面``?如果我删除 `` 周围,when我会看到一个thenReturn无法解决的问题。
我正在将Auth0添加到简单项目中并尝试了解中间件的工作原理.
在我的Startup.cs中我有这个代码
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, IOptions<AuthSettings> auth0Settings)
{
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
loggerFactory.AddDebug();
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseStaticFiles();
// Add the cookie middleware
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AutomaticAuthenticate = true,
AutomaticChallenge = true
});
// Add the OIDC middleware
var options = new OpenIdConnectOptions("Auth0")
{
// here there are some configurations
// .....................
};
options.Scope.Clear();
options.Scope.Add("openid");
options.Scope.Add("name");
options.Scope.Add("email");
options.Scope.Add("picture");
app.UseOpenIdConnectAuthentication(options);
app.UseMvc(routeBuilder =>
{
routeBuilder.MapRoute("Default", "{controller=Home}/{action=Index}");
});
}
Run Code Online (Sandbox Code Playgroud)
如果我在我们的示例中正确理解ASP.NET Core中的中间件的想法,如果存在cookie并且可以通过它进行身份验证
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AutomaticAuthenticate = true,
AutomaticChallenge = true …Run Code Online (Sandbox Code Playgroud) c# ×2
kotlin ×2
unit-testing ×2
android ×1
asp.net-core ×1
builder ×1
datetime ×1
go ×1
jwt ×1
lombok ×1
middleware ×1
mockito ×1
signature ×1
sumologic ×1