一种粗略的方式(与当前给定的描述匹配)如下所示:
class DateOfBirth
{
private:
int month = 0, day = 0, year = 0;
public:
//getters
int getMonth() const
{
return month;
}
int getDay() const
{
return day ;
}
int getYear() const
{
return year;
}
//setters
void setMonth(int pmonth)
{
month = pmonth;
}
void setDay(int pday)
{
day = pday ;
}
void setYear(int pyear)
{
year = pyear;
}
};
class AnotherClas
{
DateOfBirth d;
public:
//getter
DateOfBirth getDateOfBirth() const
{
return d;
}
//setter
void setDateOfBirth(int pmonth, int pday, int pyear)
{
d.setMonth(pmonth); //set month
d.setDay(pday); //set day
d.setYear(pyear); //set year
}
};
int main()
{
//create instance of another class
AnotherClas a;
a.setDateOfBirth(10, 2, 3);
//lets confirm by printing
std::cout << a.getDateOfBirth().getMonth() << "-" << a.getDateOfBirth().getDay() << "-" << a.getDateOfBirth().getYear() <<std::endl;
return 0;
}
上述程序的输出是:
10-2-3
事实证明,每次选择 +更新
之前,由于A Mutex锁定的性能正在恶化。这是针对线程安全的,因为预计DB将从多个线程访问。
更改现在从单线访问DB的设计后,性能改善了歧管。在Ubuntu,它的速度快了5倍,在窗户中,它的速度快10倍!!
@prapins>@prapins评论也有一些优点。现在,我们正在单个事务中执行所有更新
。这至少加快了Windows性能的速度2倍。
可能是您可以尝试使用 map()
或 mappartition()
函数来求解此用语酶。
在您的情况下,下面可能有效。
您可以在数据框架中调用每个行对象的生成批次ID函数。
df.mapPartitions(iterator => {
val resultList = new List
entityIterator.foreach(rowObject => {
val batchId = generateBatchId()
val fileNumber = rowObject.getAs("fileNumber")
val value = rowObject.getAs("value")
val rowData = Row(fileNumber,value,batchId)
itr.add(rowData)
}
}
所有表内容都应在单元格内,您的div在tbody中 - 这就是为什么表将其删除的原因。
在您的情况下 - 删除DIV并将其ID设置为&lt; tbody&gt;
<table style="border: 1px solid">
<thead>
<th>Name</th>
</thead>
<tbody id="demo"></tbody>
</table>
我们怀疑您需要在更改SFDATAGRID中使用项目的属性的源属性时更改网格的物品的需求。
您可以通过使用InotifyPropertyChanged实施基本可观察的收集属性来实现这一目标。请参阅以下代码段,
public class ViewModel : INotifyPropertyChanged
{
private ObservableCollection<OrderInfo> _orders;
public ObservableCollection<OrderInfo> ItemsCollection
{
get { return _orders; }
set
{
_orders = value;
OnPropertyChanged("ItemsCollection");
}
}
public event PropertyChangedEventHandler PropertyChanged;
private void OnPropertyChanged(string propertyName)
{
if (PropertyChanged != null)
this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
public ViewModel()
{
_orders = new ObservableCollection<OrderInfo>();
}
}
我找到了一个解决方案:
fig = make_subplots(rows=2, cols=1, shared_xaxes=True)
fig.add_trace(go.Scatter(x=data1[1]['x'], y=data1[1]['y']), row=1, col=1)
fig.add_trace(go.Scatter(x=data2[1]['x'], y=data2[1]['y']), row=2, col=1)
fig.add_trace(go.Scatter(x=data1[2]['x'], y=data1[2]['y'], visible=False), row=1, col=1)
fig.add_trace(go.Scatter(x=data2[2]['x'], y=data2[2]['y'], visible=False), row=2, col=1)
fig.add_trace(go.Scatter(x=data1[3]['x'], y=data1[3]['y'], visible=False), row=1, col=1)
fig.add_trace(go.Scatter(x=data2[3]['x'], y=data2[3]['y'], visible=False), row=2, col=1)
buttons=[]
for df in data1.keys():
buttons.append(dict(method='update',
label=str(df),
visible=True,
args=[{'visible': list(sum([(True,True) if i == df else (False,False) for i in range(1,4)], ()))}]
)
)
updatemenu=[]
your_menu=dict()
updatemenu.append(your_menu)
updatemenu[0]['buttons']=buttons
updatemenu[0]['direction']='down'
updatemenu[0]['showactive']=True
fig.update_layout(showlegend=False, updatemenus=updatemenu)
fig.show()
将第二个数据框架中的列名从年更改_
到 Year
对第一df(年)进行SAAME。
merge(x=df2, y=df1, by='Year', all.x = TRUE)
您可以使用以下功能。
基地来自p/p/undoke folk,但我已经改编和增强了。
P/Invoke base: https://pinvoke.net/default.aspx/wtsapi32.WTSEnumerateSessions
函数
此代码是一个简单且高级的功能。
同时,我还创建了一个增强版本
,在此处发布:
function Get-ComputerSession {
[CmdletBinding()]
param(
# The computer name to get the current sessions from.
[Parameter(Mandatory, ValueFromPipeline, ValueFromPipelineByPropertyName)]
[AllowEmptyString()]
[String]
$ComputerName
)
begin {
# this script is based on the PS code example for WTSEnumerateSessions from:
# https://pinvoke.net/default.aspx/wtsapi32.WTSEnumerateSessions
# but has many adaptions and enhancements.
# thanks for the input!
Add-Type -TypeDefinition @'
using System;
using System.Runtime.InteropServices;
using System.ComponentModel;
namespace WTS
{
public class API {
// https://learn.microsoft.com/en-us/windows/win32/api/wtsapi32/nf-wtsapi32-wtsopenserverexw
[DllImport("wtsapi32.dll", SetLastError=true, CharSet = CharSet.Unicode)]
public static extern IntPtr WTSOpenServerEx(string pServerName);
// https://learn.microsoft.com/en-us/windows/win32/api/wtsapi32/nf-wtsapi32-wtscloseserver
[DllImport("wtsapi32.dll", SetLastError=true, CharSet = CharSet.Unicode)]
public static extern void WTSCloseServer(System.IntPtr hServer);
// https://learn.microsoft.com/en-us/windows/win32/api/wtsapi32/nf-wtsapi32-wtsenumeratesessionsexw
[DllImport("wtsapi32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
public static extern int WTSEnumerateSessionsEx(
System.IntPtr hServer,
ref int pLevel,
int Filter,
ref System.IntPtr ppSessionInfo,
ref int pCount);
[DllImport("wtsapi32.dll", SetLastError=true)]
public static extern int WTSQuerySessionInformationW(
System.IntPtr hServer,
int SessionId,
int WTSInfoClass ,
ref System.IntPtr ppSessionInfo,
ref int pBytesReturned );
// https://learn.microsoft.com/en-us/windows/win32/api/wtsapi32/nf-wtsapi32-wtsfreememoryexw
[DllImport("wtsapi32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
public static extern bool WTSFreeMemoryEx(
WTS_TYPE_CLASS WTSTypeClass,
IntPtr pMemory,
UInt32 NumberOfEntries);
}
// https://learn.microsoft.com/en-us/windows/win32/api/wtsapi32/ns-wtsapi32-wts_session_info_1w
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WTS_SESSION_INFO_1
{
public int ExecEnvId;
public WTS_CONNECTSTATE_CLASS State;
public UInt32 SessionId;
public String SessionName;
public String HostName;
public String UserName;
public String DomainName;
public String FarmName;
}
public enum WTS_TYPE_CLASS
{
TypeProcessInfoLevel0,
TypeProcessInfoLevel1,
TypeSessionInfoLevel1
}
// https://learn.microsoft.com/en-us/windows/win32/api/wtsapi32/ne-wtsapi32-wts_connectstate_class
public enum WTS_CONNECTSTATE_CLASS
{
[Description("A user is logged on to the WinStation. This state occurs when a user is signed in and actively connected to the device.")]
Active,
[Description("The WinStation is connected to the client.")]
Connected,
[Description("The WinStation is in the process of connecting to the client.")]
ConnectQuery,
[Description("The WinStation is shadowing another WinStation.")]
Shadow,
[Description("The WinStation is active but the client is disconnected. This state occurs when a user is signed in but not actively connected to the device, such as when the user has chosen to exit to the lock screen.")]
Disconnected,
[Description("The WinStation is waiting for a client to connect.")]
Idle,
[Description("The WinStation is listening for a connection. A listener session waits for requests for new client connections. No user is logged on a listener session. A listener session cannot be reset, shadowed, or changed to a regular client session.")]
Listen,
[Description("The WinStation is being reset.")]
Reset,
[Description("The WinStation is down due to an error.")]
Down,
[Description("The WinStation is initializing.")]
Init
}
}
'@
$wtsSessionDataSize = [System.Runtime.InteropServices.Marshal]::SizeOf([System.Type][WTS.WTS_SESSION_INFO_1])
}
process {
[UInt32] $pLevel = 1 # for a reserved parameter. must be always 1
[UInt32] $pCount = 0
[IntPtr] $ppSessionInfo = 0
try {
[IntPtr] $wtsServerHandle = [WTS.API]::WTSOpenServerEx($ComputerName)
if (-not $wtsServerHandle) {
throw [System.ComponentModel.Win32Exception]::new([Runtime.InteropServices.Marshal]::GetLastWin32Error())
}
[bool] $wtsSessionsCheck = [WTS.API]::WTSEnumerateSessionsEx($wtsServerHandle, [ref] $pLevel, [UInt32] 0, [ref] $ppSessionInfo, [ref] $pCount)
if (-not $wtsSessionsCheck) {
throw [System.ComponentModel.Win32Exception]::new([Runtime.InteropServices.Marshal]::GetLastWin32Error())
}
for ($i = 0; $i -lt $pCount; $i++) {
$wtsSessionInfoOffset = $wtsSessionDataSize * $i
[System.Runtime.InteropServices.Marshal]::PtrToStructure([IntPtr]::Add($ppSessionInfo, $wtsSessionInfoOffset), [type][WTS.WTS_SESSION_INFO_1])
}
} catch {
Write-Error -ErrorRecord $_
} finally {
try {
$wtsSessionInfoFreeMemCheck = [WTS.API]::WTSFreeMemoryEx([WTS.WTS_TYPE_CLASS]::TypeSessionInfoLevel1, $ppSessionInfo, $pCount)
if (-not $wtsSessionInfoFreeMemCheck) {
throw [System.ComponentModel.Win32Exception]::new([Runtime.InteropServices.Marshal]::GetLastWin32Error())
}
} finally {
$ppSessionInfo = [IntPtr]::Zero
[WTS.API]::WTSCloseServer($wtsServerHandle)
}
}
}
}
使用无需
函数而没有参数 computername
将要求您提供名称。
如果要获取本地计算机/服务器的会话,请点击[ENTER],或为参数 Computername
为本地查询提供空
字符串
。
PS> Get-ComputerSession -ComputerName ''
ExecEnvId : 0
State : Disconnected
SessionId : 0
SessionName : Services
HostName :
UserName :
DomainName :
FarmName :
ExecEnvId : 1
State : Active
SessionId : 1
SessionName : Console
HostName :
UserName : svenw
DomainName : SVEN-PC
FarmName :
ExecEnvId : 2
State : Disconnected
SessionId : 2
SessionName :
HostName :
UserName : Test
DomainName : Sven-PC
FarmName :
的
我还创建并在GIST上上传了一个更具增强版本 版本:
您可以尝试更改IDEA中的选择“运行/调试配置”。将构建构建项目更改。它对我有用。
如Dan的答案中所述,这确实是Intellij Idea Console中的错误。
根据其跟踪器,这已经报告并修复了。修复应在2022.1.2版本中提供。
https:https:// youtrack。 jetbrains.com/issue/idea-293951/console-readline-skips-input-in-2022-1-1-
在此之前,您可以尝试使用任何命令行终端来测试该程序,该程序工作正常,预期的。
在此处输入图像描述 - 构建#IC -221.5591.52的测试结果
解决方案是为.TEXT指定左侧位置。
(Tipp:我认为从
figcaption {
color: white;
font-style: oblique;
position: relative;
text-align: center;
}
* {
box-sizing: border-box;
}
.column1 {
position: relative;
width: 200px;
height: 300px;
overflow: hidden;
}
p {
color: black; /* changed to black, so you can see the text */
font: 25px Sulphur Point, sans-serif;
}
.text {
position: absolute;
bottom: 0;
/* right: 0;*/
left: 0; /* here */
width: 200px;
height: 0;
text-align: center;
transition: height 0.7s ease-out;
}
.column1:hover>.text {
height: 150px;
}
.column1 {
float: left;
width: 33.33%;
padding: 5px;
margin-bottom: 50px;
}
/* Clearfix (clear floats) */
.row1::after {
content: "";
clear: both;
display: table;
margin-bottom: 50px;
}
<div class="row1">
<div class="column1">
<img src="img/hi_bild.jpg" height="200px" width="200px">
<figcaption> John Smith</figcaption>
<div class="text">
<p>This is a cat</p>
<span class="arrow-link">ARROW IMG HERE</span>
</div>
</div>
<div class="column1">
<img src="img/hi_bild.jpg" height="200px" width="200px">
<div class="text">
<p>This is a cat</p>
</div>
</div>
<div class="column1">
<img src="img/hi_bild.jpg" height="200px" width="200px">
<div class="text">
<p>This is a cat</p>
</div>
</div>
</div>
通常,这个话题是广泛而复杂的。对于那些有兴趣的人,我建议 json Schema 网站。
出于我们的目的,我们可以使用一种非常简单的验证方法,仅限于两个问题,在功能体系中发表了评论:
create or replace function validate_answer(answer jsonb, pattern jsonb)
returns bool language plpgsql as $
declare
rec record;
begin
-- does the answer contain exactly the same keys as the pattern?
if not (
select array_agg(keys_ans) = array_agg(keys_pat)
from (
select
jsonb_object_keys(answer) as keys_ans,
jsonb_object_keys(pattern) as keys_pat
) s
) then return false;
end if;
-- are the value types of all keys the same in the answer and pattern?
for rec in
select *
from jsonb_each(pattern)
loop
if jsonb_typeof(answer->rec.key) <> jsonb_typeof(rec.value)
then return false;
end if;
end loop;
return true;
end $;
如您所见,该模式只是一个格式良好的答案的一个示例。为每个问题定义一个模式,为答案表创建一个触发器,然后在触发函数中使用上述函数来验证新的或修改的答案。
选择最大行&amp;列贡献最大值