我正在尝试用Jenkins构建一个android项目,但我有错误:
23:15:39 Could not initialize analytics, treating as opt-out.
23:15:39 java.io.FileNotFoundException: /var/jenkins_home/.android/analytics.settings (No such file or directory)
Run Code Online (Sandbox Code Playgroud)
如何解决这个问题?
我写简单的库,返回名称列表.
但是,如果我找不到任何东西,我应该返回什么?
return new List<String>();
Run Code Online (Sandbox Code Playgroud)
要么
return null;
Run Code Online (Sandbox Code Playgroud)
例:
var resultColl=FindNames(...);
Run Code Online (Sandbox Code Playgroud)
此代码可以从其他组件使用,我不想破坏它.如果我返回null-我认为这是检查它的正确方法.但是,可能我应该返回空列表?
谢谢.
我有DevExpress GridControl,它有7列.我试图将最后一列扩展到右边,但没有任何反应.相反,列延伸一段距离,并且在网格的右边缘,有一个没有名称的空列,无法拉伸.
所以,我尝试谷歌它:我觉得像一些答案这个,但它并没有为我工作.
这里有一些XAML的和平,我删除所有绑定.
<dxg:GridControl Grid.Row="0"
x:Name="dgGrid"
VerticalAlignment="Stretch"
HorizontalAlignment="Stretch"
dx:ThemeManager.ThemeName="Seven"
ScrollViewer.CanContentScroll="True"
ScrollViewer.HorizontalScrollBarVisibility="Auto"
ScrollViewer.VerticalScrollBarVisibility="Auto"
>
<dxg:GridControl.View>
<!--region #RowCellMenuCustomization-->
<dxg:TableView x:Name="view" AutoWidth="True" NavigationStyle="Cell">
<dxg:TableView.RowCellMenuCustomizations>
<dxb:BarButtonItem Content="Link"
ItemClick="CellDataItem_Link_ItemClick"
></dxb:BarButtonItem>
<dxb:BarButtonItem Content="UnLink"
ItemClick="CellDataItem_UnLink_ItemClick"
></dxb:BarButtonItem>
</dxg:TableView.RowCellMenuCustomizations>
</dxg:TableView>
<!--endregion #RowCellMenuCustomization-->
</dxg:GridControl.View>
<dxg:GridControl.Columns>
<dxg:GridColumn Header="Column0"
AllowEditing="False"
HorizontalHeaderContentAlignment="Stretch"
FixedWidth="True"
AllowResizing="True"
MinWidth="80"
></dxg:GridColumn>
<dxg:GridColumn Header="Column1"
AllowEditing="False"
HorizontalHeaderContentAlignment="Stretch"
FixedWidth="True"
AllowResizing="True"
MinWidth="80"
></dxg:GridColumn>
<dxg:GridColumn Header="Column2"
AllowEditing="False"
HorizontalHeaderContentAlignment="Stretch"
AllowResizing="True"
FixedWidth="True"
Visible="False"
MinWidth="80"
></dxg:GridColumn>
<dxg:GridColumn Header="Column3"
HorizontalHeaderContentAlignment="Center"
AllowEditing="False"
Width="35"
FixedWidth="True"
AllowResizing="False"
></dxg:GridColumn>
<dxg:GridColumn Header="Column4"
HorizontalHeaderContentAlignment="Center"
FixedWidth="True"
AllowEditing="False"
AllowResizing="False"
Width="35"
></dxg:GridColumn>
<dxg:GridColumn …Run Code Online (Sandbox Code Playgroud) 我编写了简单的Asp.Net Core WebAPI 2.0应用程序,它可以在本地计算机上运行。但我想将其部署到服务器。所以,我做到了。
我的系统:
Ubuntu 16.04.
Asp.Net WebAPI 2.0 (and dotnet version 2.1.105)
Run Code Online (Sandbox Code Playgroud)
但是,当应用启动时,它会写:
Now listening on:http://localhost:53115
Run Code Online (Sandbox Code Playgroud)
当我尝试从中获取价值时:
http://id_address:53115/api/values
Run Code Online (Sandbox Code Playgroud)
而且我无法得到回应。在邮递员中:
Could not get any response
There was an error connecting to
http://id_address:53115/api/values.
Why this might have happened:
The server couldn't send a response:
Ensure that the backend is working properly
Self-signed SSL certificates are being blocked:
Fix this by turning off 'SSL certificate verification' in Settings > General
Proxy configured incorrectly
Ensure that proxy is configured correctly in Settings …Run Code Online (Sandbox Code Playgroud) ubuntu kestrel asp.net-core asp.net-core-webapi asp.net-core-2.0
我在本地提要上将 nuget 包从 2.2.x 更新到 3.1.0。然后,在构建机器上尝试构建项目,但是:
Project.csproj(0,0): Error NU1102: Unable to find package Microsoft.NETCore.App.Host.win-x64 with version (= 2.2.7)
- Found 1 version(s) in localfeed [ Nearest version: 3.1.0 ]
Run Code Online (Sandbox Code Playgroud)
nuget.org 链接说我不应该直接使用它。所以我没有直接使用它。
csproj 示例:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup Label="Globals">
<SccProjectName>SAK</SccProjectName>
<SccProvider>SAK</SccProvider>
<SccAuxPath>SAK</SccAuxPath>
<SccLocalPath>SAK</SccLocalPath>
</PropertyGroup>
<PropertyGroup>
<ProjectGuid>{9B42C5B4-188E-482F-BC44-C3B243F92848}</ProjectGuid>
<OutputType>Exe</OutputType>
<TargetFrameworks>netcoreapp3.1</TargetFrameworks>
<PackageId>Project</PackageId>
<AssemblyName>Projectr</AssemblyName>
<Version>1.1.0</Version>
Run Code Online (Sandbox Code Playgroud)
为什么.net core 不能使用 Microsoft.NETCore.App.Host.win-x64 3.1.0 版本?
我有 .net core 5.0 应用程序并尝试从 appsettings.json 获取 DateTime
应用程序设置.json:
"TimeModel": {
"RestartDuration": "27.10.2021 12:30:00"
}
Run Code Online (Sandbox Code Playgroud)
代码:
services.Configure<TimeModel>(
configuration.GetSection("TimeModel"));
Run Code Online (Sandbox Code Playgroud)
错误:
System.InvalidOperationException: Failed to convert configuration value at 'TimeModel:RestartDuration' to type 'System.DateTime'.
---> System.FormatException: 27.10.2021 12:30:00 is not a valid value for DateTime.
---> System.FormatException: String '27.10.2021 12:30:00' was not recognized as a valid DateTime.
Run Code Online (Sandbox Code Playgroud) 美好的一天!
我有一个ValueObj列表:
class ValueObj
{
int ID;
float value;
}
Run Code Online (Sandbox Code Playgroud)
如何通过ID获取二进制搜索对象?(列出tempValues)
我做ValueComparer类,但是不知道我说的对吗?
class ValueComparer<ValueObj>
{
public int Compare(ValueObjx, ValueObjy)
{
if (x == y) return 0;
if (x == null) return -1;
if (y == null) return 1;
return -1; ///???
}
}
Run Code Online (Sandbox Code Playgroud)
我需要按ID对列表进行排序。像那样?:
tempValues.Sort(new ValueComparer());
以及如何使用BinarySearch?
我是asp.core的新手,所以我尝试制作有效的路线 {id}/visits
我的代码:
[Produces("application/json")]
[Route("/Users")]
public class UserController
{
[HttpGet]
[Route("{id}/visits")]
public async Task<IActionResult> GetUser([FromRoute] long id)
{
throw new NotImplementedException()
}
}
Run Code Online (Sandbox Code Playgroud)
但是,在路由{id}生成方法上相同:
// GET: /Users/5
[HttpGet("{id}")]
public async Task<IActionResult> GetUser([FromRoute] long id)
{
return Ok(user);
}
Run Code Online (Sandbox Code Playgroud)
如何制作路线/Users/5/visitsnethod?
我GetUser应该添加哪些参数?
这很奇怪,但我的HTML表单通过GET发送数据,而不是POST.
<form name="mistake" action="http://web-server.com:8888/WebApp/Email/Create" method=post>
<input type="text" name="url" size="50" readonly="readonly">
<br />
<span class="text">
Error :
</span>
<br />
<textarea rows="5" name="mis" cols="37" readonly="readonly"></textarea>
<br />
<span class="text">
Comment :
</span>
<br />
<textarea rows="5" name="comment" cols="37"></textarea>
<input type="hidden" name="email" value="admin@admin.com">
<input type="hidden" name="subject" value="Errors">
<div style="margin-top: 7px"><input type="submit" value="Submit">
<input onclick="hide()" type="button" value="Close" id="close" name="close">
</div>
</form>
Run Code Online (Sandbox Code Playgroud)
我使用标准选项在IE10上测试它.
HTML表单非常简单,我只写了很少的代码示例.
怎么解决?
谢谢!
PS更改URL.此URL web-server.com:8888/WebApp/Email/Create - 属于asp mvc app.
当我运行我的网络应用程序和本地机器上的静态网站 - 它的工作原理.但是当我在本地机器上运行静态页面 - 而在服务器上运行mvc时 - 它不起作用.
PPS-形式的这种变体是起源的(我削减了一些标签).现在它起源于.
我不知道为什么,但它的确有效.可能是 - 服务器端的问题?
FileSystemWatcher:如何仅为目录中的新文件引发事件?
我有一个目录,我的服务扫描.我使用FileSystemWatcher:
构造函数:
if(Directory.Exists(_dirPath))
{
_fileSystemWatcher = new FileSystemWatcher(_dirPath);
}
Run Code Online (Sandbox Code Playgroud)
然后,我在目录上订阅:
public void Subscribe()
{
try
{
//if (_fileSystemWatcher != null)
//{
// _fileSystemWatcher.Created -= FileSystemWatcher_Created;
// _fileSystemWatcher.Dispose();
//}
if (Directory.Exists(_dirPath))
{
_fileSystemWatcher.EnableRaisingEvents = true;
_fileSystemWatcher.Created += FileSystemWatcher_Created;
_fileSystemWatcher.Filter = "*.txt";
}
}
Run Code Online (Sandbox Code Playgroud)
但是,问题是我想在新文件创建(或复制)时获取事件.相反,我从该目录中的所有文件中获取事件已经存在.
如何仅从新文件中获取事件?谢谢!