我有一个HashMap定义如下:
public Map<Integer, String> staticBlockPositions = new HashMap<Integer, String>();
我通过获取每个键来迭代地图,如下所示:
for (Integer key : blockPositions.keySet()) {
System.out.println(key);
}
Run Code Online (Sandbox Code Playgroud)
我的问题是,我可以依靠值key
始终按升序排列.所以,如果我的HashMap看起来像这样:
{
4: "abc123",
1: "def456",
11: "qwe789",
10: "iop019"
}
Run Code Online (Sandbox Code Playgroud)
(我知道这是JSON格式,这只是让你了解数据集).
请问我的循环总是输出
1
4
10
11
Run Code Online (Sandbox Code Playgroud)
不管我的数据顺序如何?
需要注意的是,添加密钥的顺序是完全随机的,我无法控制何时添加密钥.
这是一个俄罗斯方块风格的游戏,所以按升序获得键是必须的.
对于我的一个应用程序(用 WPF 编写),我需要获取有关监视器的一些信息:当前分辨率、比例因子和实际分辨率。
我知道这个问题已经被问过很多次了,但我无法在所有讨论这个问题的 SO 问题中找到一个好的答案......
例如,就我而言,我按以下顺序放置了 3 个显示器:
使用 System.Windows.Forms.Screen.AllScreens 时,我的第一台显示器的分辨率为 1536x864。没关系,因为 1536*1.25 = 1920。但我找不到 1.25 或 1920 ^^(对于其他显示器,这没关系,因为它们按 100% 缩放)。
但是如果我将监视器 1 设置为主监视器,我可以获得它的实际分辨率,但是对于监视器 2 和 3,我得到 2400*1350...它是 1920x1080 乘以主监视器的缩放因子:1.25
我尝试了很多方法已经2天了。我已经在 Windows.Forms 中尝试过 AllScreens。在 WinAPI 中,我尝试过 EnumDisplayMonitors、GetDeviceCaps、GetScaleFactorForMonitor、GetDpiForMonitor ......对于我的第一台显示器,一切总是给我一个 100% 的缩放因子或 96 的 DPI,这是一个错误......
您知道获取这些信息的安全方法吗?在 WMI 中,在注册表中,等等...
谢谢你的帮助 !
(PS:如果需要,我可以提供我尝试过的代码示例,但我不想淹没第一篇文章)
编辑:我忘了提到我需要在没有任何可视化应用程序的情况下获取这些信息(我的 DLL 是从 VB 应用程序调用的)
对于我到目前为止看到的所有类型的情节,matplotlib
当没有xlim(), ylim()
给出值时,它们会自动居中.例:
import matplotlib.pyplot as plt
A_pts = [(162.5, 137.5), (211.0, 158.3), (89.6, 133.7)]
ax = plt.subplot(111)
ax.scatter(*A_pts)
plt.show()
Run Code Online (Sandbox Code Playgroud)
但是当我画一个 Polygon
ax = plt.subplot(111)
triangle = plt.Polygon(A_pts, fill=None, edgecolor='r')
ax.add_patch(triangle)
plt.show()
Run Code Online (Sandbox Code Playgroud)
绘图窗口显示[0, 1]
两个轴的限制,这导致多边形不可见.我必须明确传递适当的限制,以便它将显示在绘图窗口中
ax.set_xlim(80, 250)
ax.set_ylim(120, 170)
Run Code Online (Sandbox Code Playgroud)
这是设计还是我错过了什么?
我正在尝试将ASP.NET Core应用程序转换为VS 2017.不幸的是,由于我不断收到TypeScript错误,我无法编译该站点.我宁愿VS甚至没有触摸我的TypeScript,因为我正在使用Webpack进行实际构建和捆绑.
该网站有一个Angular 2应用程序,包括一些测试.这是一个示例错误:
错误TS2665构建:增强中的模块名称无效.模块'angular-mocks/ngMock'解析为'D:/myapp/source/MySite/node_modules/angular-mocks/ngMock.js'中的无类型模块,该模块无法扩充.MySite D:\ myapp\source\MySite \node_modules\@types\angularjs\angular-mocks.d.ts 8
我的app/tsconfig.json文件如下所示:
{
"compilerOptions": {
"noImplicitAny": false,
"noEmitOnError": true,
"removeComments": false,
"experimentalDecorators": false,
"sourceMap": false,
"module": "commonjs",
"moduleResolution": "node",
"skipLibCheck": true,
"skipDefaultLibCheck": true,
"target": "es5",
"typeRoots": [
"../node_modules/@types"
],
"lib": [
"es2016",
"dom"
]
},
"exclude": [
"../node_modules",
"../wwwroot"
],
"compileOnSave": false
}
Run Code Online (Sandbox Code Playgroud)
有没有办法告诉VS在构建时完全忽略我的TypeScript?我不知道为什么它甚至看着这些文件.
我在云CRM Dynamics 365中安装托管包时遇到了问题.由于我无法跟踪问题,因此很头疼.
让我解释一下要点:
我已false
为所有组件设置了可自定义
我已经在Sandbox模式下注册了插件.我使用插件注册工具获取许可证和其他一些功能.
我试过两种方法.
第一:当我第一次尝试安装时,我从工作流程中获得了未处理状态.
第二:为解决上述问题,我尝试删除许可证处理相关组件.现在我从更新销售订单的插件组件中获取未处理状态.
最糟糕的是我没有在日志文件中收到任何错误消息或错误代码.
最后,这里有几个日志.有人可以提出解决方案吗?
--------------------------------------------------------------------------------------------------------
AsynchronousProcessingService Failed to add the item to the sync item collection for the mailbox : {8CBF53D0-896B-E611-80F2-FC15B4288714}. Exception details : Unhandled Exception: Microsoft.Crm.CrmArgumentException: Invalid input.
at Microsoft.Crm.Asynchronous.EmailConnector.ExchangeItemFinder.AddItemToSyncItemChangeInfoCollection(Item item, String itemId, SyncItemChangeType itemChangeType, ItemObjectType itemObjectType, String crmId)
Inner Exception: System.ArgumentException: Invalid input.
AsynchronousProcessingService Failed to add the item to the ItemFinder sync error collection for the mailbox : {8CBF53D0-896B-E611-80F2-FC15B4288714}. Exception details : Unhandled Exception: Microsoft.Crm.CrmArgumentException: Invalid input.
at …
Run Code Online (Sandbox Code Playgroud) 我可以使用以下命令创建模型和资源控制器(绑定到模型)
php artisan make:controller TodoController --resource --model=Todo
Run Code Online (Sandbox Code Playgroud)
我想用上面的命令创建一个迁移,有可能吗?
我在elastic-search 5中有一个文档,如下
{
"_index": "my_index",
"_type": "json",
"_id": "document_id",
"_score": 1,
"_source": {
"message": "{\"the_id\": \"custom_id\", \"more\": \"Data\"}",
"type": "json",
"the_id": "custom_id",
"@timestamp": "2017-04-03T13:31:39.995Z",
"port": 48038,
"@version": "1",
"host": "127.0.0.1"
}
}
Run Code Online (Sandbox Code Playgroud)
当我使用 Kibana 控制台查询_id时,如下所示,它工作正常并获取记录
GET _search
{
"query": {
"bool": {
"filter": [
{ "term": { "_id": "document_id" }}
]
}
}
}
Run Code Online (Sandbox Code Playgroud)
但是,如果我查询 _source 级别字段(在本例中为the_id ),则不会得到任何结果。
GET _search
{
"query": {
"bool": {
"filter": [
{ "term": { "the_id": "custom_id" }}
]
}
} …
Run Code Online (Sandbox Code Playgroud) 我有以下假定的数据帧
a b c d e F
0.02 0.62 0.31 0.67 0.27 a
0.30 0.07 0.23 0.42 0.00 a
0.82 0.59 0.34 0.73 0.29 a
0.90 0.80 0.13 0.14 0.07 d
0.50 0.62 0.94 0.34 0.53 d
0.59 0.84 0.95 0.42 0.54 d
0.13 0.33 0.87 0.20 0.25 d
0.47 0.37 0.84 0.69 0.28 e
Run Code Online (Sandbox Code Playgroud)
列F表示数据帧的列.对于列的每一行,FI希望从数据帧的其余部分查找相关的行和列,并将值返回到一列
结果将如下所示:
a b c d e f To_Be_Filled
0.02 0.62 0.31 0.67 0.27 a 0.02
0.30 0.07 0.23 0.42 0.00 a 0.30
0.82 0.59 …
Run Code Online (Sandbox Code Playgroud) 您好,我正尝试制作一个小脚本来每次给定我的墙纸时,我都有一个文件夹,其中的图片名为1.bmp,2.bmp等
我做了这个脚本,但根本不起作用
PS D:\Téléchargements\images\Wallpapers> for($i=1; $i -le 6; $i++){
>> reg add "HKEY_CURRENT_USER\Control Panel\Desktop" /v Wallpaper /t REG_SZ
/d D:\Téléchargements\images\Wallpapers\$i.bmp /f
>> Start-Sleep -s 10
>> rundll32.exe user32.dll, UpdatePerUserSystemParameters
>> Start-Sleep -s 2
>> }
Run Code Online (Sandbox Code Playgroud)
有人可以解释为什么请:(
PS:起始睡眠值是完全随机的,在这里进行测试
对此非常陌生,我目前正在尝试为我的网站创建一个登录系统。我创建了一个 html 登录表单,我计划用于用户创建帐户。我创建了一个 php 页面,其中包含连接到服务器的代码,如下所示。
当我填写表格时,我没有得到任何输出。我不确定 php 代码是否在错误的地方(它是一个单独的文件)或者没有输出。提交表单时,当我在测试时手动提交时,数据库似乎没有改变。
我的最终目标是能够将用户添加到我的数据库中名为 users 的表中。
这是我的登录表单代码:
<body>
<h2>Sign Up</h2>
<p></p>
<form action="Create_User.php" method="post">
<div class="imgcontainer">
<img src="http://fc05.deviantart.net/fs70/f/2012/361/1/6/albert_einstein_by_zuzahin-d5pcbug.jpg" alt="Einstein the lad" class="img" />
</div>
<div class="container">
<label><b>Username</b></label>
<input type="text" placeholder="Please Enter your desired Username" name="username" required />
<label><b>Password</b></label>
<input type="password" placeholder="Please Enter Your Desired Password" name="password" required />
<label><b>Email Address</b></label>
<input type="email" placeholder="Please Enter Your Email Address" name="email" required />
<label><b>Date Of Birth</b></label>
<input type="date" name="date_of_birth" required />
<label><b>First Name</b></label>
<input type="text" placeholder="Please Enter your …
Run Code Online (Sandbox Code Playgroud) python ×2
angular ×1
artisan ×1
c# ×1
dataframe ×1
dynamics-crm ×1
forms ×1
hashmap ×1
html ×1
interop ×1
java ×1
laravel ×1
laravel-5.4 ×1
matplotlib ×1
mysql ×1
pandas ×1
php ×1
polygon ×1
powershell ×1
typescript ×1
winapi ×1
wpf ×1