还在原地等你

文章 评论 浏览 29

还在原地等你 2025-02-12 19:05:44
    select Max(grp) grp,Max(abc) abc, Max(cde) cde,Max(efg) efg into #tmp2 from testtbl
    select * from #tmp2
    
    select grp,MX,qq from (select grp,abc,cde,efg from #tmp2) p
    UNPIVOT (qq for MX in (
    abc,cde,efg
    )
    ) as unpvt
    select Max(grp) grp,Max(abc) abc, Max(cde) cde,Max(efg) efg into #tmp2 from testtbl
    select * from #tmp2
    
    select grp,MX,qq from (select grp,abc,cde,efg from #tmp2) p
    UNPIVOT (qq for MX in (
    abc,cde,efg
    )
    ) as unpvt

选择最大行&列贡献最大值

还在原地等你 2025-02-12 18:49:16

一种粗略的方式(与当前给定的描述匹配)如下所示:

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;
}

demo

上述程序的输出是:

10-2-3

One crude way(that matches your current given description) is as shown below:

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;
}

Demo

The output of the above program is:

10-2-3

COMPOSIT成员C&#x2B;&#x2B;

还在原地等你 2025-02-12 08:07:28

事实证明,每次选择 +更新之前,由于A Mutex锁定的性能正在恶化。这是针对线程安全的,因为预计DB将从多个线程访问。
更改现在从单线访问DB的设计后,性能改善了歧管。在Ubuntu,它的速度快了5倍,在窗户中,它的速度快10倍!!

@prapins>@prapins评论也有一些优点。现在,我们正在单个事务中执行所有更新。这至少加快了Windows性能的速度2倍。

Turns out that the performance was worsening due to a Mutex lock every time before a SELECT + UPDATE. This was meant for the thread safety as the DB is expected to be accessed from the multiple threads.
After changing the design where the DB is now accessed from the single thread, the performance improved manifold. In Ubuntu it became 5X faster and in Windows it became 10X faster!!

@prapin's comments also has some merit. We are now executing all the UPDATEs within a single transaction. This speeds up at least the Windows performance by 2X.

为什么SQLite查询在Windows [服务器]机器中与Ubuntu&amp; macos?

还在原地等你 2025-02-12 04:01:17

可能是您可以尝试使用 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)
       }
}
    

May be you can try using map() or mapPartition() function to solve this usecase.
Something like below might work in your case.

You can call your generate Batch Id function for each row object in your dataframe.

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)
       }
}
    

如何使用正在运行的Pyspark流动作业向Delta表添加列和batch_id值?

还在原地等你 2025-02-11 22:37:16

我刚刚意识到我的主页设置已设置为私人...我已经更改为公开,现在很好!

I have just realized that my home page setup was set to private... I have changed to public and now its fine!

WordPress 404-错误 - 此页面不存在

还在原地等你 2025-02-11 21:26:34

所有表内容都应在单元格内,您的div在tbody中 - 这就是为什么表将其删除的原因。

在您的情况下 - 删除DIV并将其ID设置为&lt; tbody&gt;

<table style="border: 1px solid">
   <thead>
    <th>Name</th>
   </thead>
  <tbody id="demo"></tbody>
</table>

All table content should be inside cells, your div is in tbody - that's why table drop it out.

In your case - remove div and set his id to <tbody>

<table style="border: 1px solid">
   <thead>
    <th>Name</th>
   </thead>
  <tbody id="demo"></tbody>
</table>

无法使用HTML表循环JavaScript

还在原地等你 2025-02-11 13:50:12

我们怀疑您需要在更改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>();
}
}

We suspect that your requirement to change the ItemsSource of the grid when changing the Source property bound with ItemsSource property in SfDataGrid.

You can achieve this by implement the Underlying observable collection property with INotifyPropertyChanged. Please refer the below code snippet,

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>();
}
}

如何在UWP中刷新SFGRID?

还在原地等你 2025-02-10 18:45:39

我找到了一个解决方案:

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()

“在此处输入图像描述”
很高兴看到您的简单或更优雅。

I found a solution:

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()

enter image description here
Would be glad to see if you have simpler or more elegant ones.

Python Plotly-在子图中使用下拉菜单更新数据

还在原地等你 2025-02-10 16:17:36

将第二个数据框架中的列名从年更改_ Year 对第一df(年)进行SAAME。

merge(x=df2, y=df1, by='Year', all.x = TRUE)

Change column name in second data frame from Year_ to Year do the saame for the first df (year to Year).

merge(x=df2, y=df1, by='Year', all.x = TRUE)

将时间序列DF与面板数据合并

还在原地等你 2025-02-10 13:14:00

您可以使用以下功能。
基地来自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上上传了一个更具增强版本 版本:

You can use the following function.
The base was from the P/Invoke folk, but has been adapted and enhanced by me.
P/Invoke base: https://pinvoke.net/default.aspx/wtsapi32.WTSEnumerateSessions

Function

This code is a simple and high-level function.
Meanwhile I also created an enhanced version, published here:
https://gist.github.com/swbbl/205694b7e1bdf09e74f25800194d5bcd

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)
            }
        }
    }
}

How to use

Using the function without the parameter ComputerName will ask your for a name.
Just hit [ENTER] if you want to get the sessions of the local computer/server or provide an empty string for the parameter ComputerName

Example

For a local query.

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    :

Each property is (more or less) explained here:
https://learn.microsoft.com/en-us/windows/win32/api/wtsapi32/ns-wtsapi32-wts_session_info_1w

Enhanced version

I've also created and uploaded a more enhanced version on gist:
https://gist.github.com/swbbl/205694b7e1bdf09e74f25800194d5bcd

如何查询所有Windows终端服务(WTS) / RDP会话?

还在原地等你 2025-02-10 12:49:53

截至2022年,Azure存储服务不支持公共IP,但是Azure API管理层确实如此。

使用公共静态IP配置APIM服务,然后为每种存储类型创建一个“通过”端点。

每个客户端的app.config需要更新“ azurewebjobsstorage”,以通过每个端点类型的API管理路由发送请求。我目前正在使用一个通用连接未指定端点,因此每个客户端将需要更新以使用'显式存储端点连接

apim的替代方案:调查dotnet yarp作为反向代理托管在Azure WebApp上,并以这种方式管理重新路由。

As of 2022, Azure Storage service does not support public IPs, but Azure API management does.

Configuring APIm service with a public static IP, then create a 'pass through' endpoint for each storage type.

Each client's app.config needs "AzureWebJobsStorage" updated to send requests through an API Management route for each endpoint type. I am currently using a generic connection not specifying the endpoints, so each client will need updating to use the 'explicit storage endpoint connection string

Alternative to APIm: investigate dotnet YARP as a reverse proxy hosted on an Azure WebApp and manage re-routing that way.

如何将公共静态IP地址设置为存储帐户?

还在原地等你 2025-02-10 08:31:49

您可以尝试更改IDEA中的选择“运行/调试配置”。将构建构建项目更改。它对我有用。

“在这里您可以找到更改”

You can try to change Select Run/Debug configuration in idea. Change Build to Build Project. It worked for me.

here you can find changes

change build to build project here

Intellij- IDE的工作障碍,不在运行/调试上构建模块

还在原地等你 2025-02-10 02:09:44

如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的测试结果

It is indeed a bug in Intellij IDEA console as mentioned in Dan's answer.
This was already reported and fixed as per their tracker. Fix should be available in 2022.1.2 version.

https://youtrack.jetbrains.com/issue/IDEA-293951/Console-readLine-skips-input-in-2022-1-1

Until then you can try to use any command line terminal to test the program which is working perfectly fine as expected.

enter image description here - Test result with Build #IC-221.5591.52

第二个readline()返回Intellij Idea上的空字符串

还在原地等你 2025-02-09 13:15:56

解决方案是为.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>

the solution is to specify the position from left for .text.

(tipp: i think it is a good idea to start with bootstrap. with bootstrap you can build up the basic framework of a website relatively easy, so that it also works on the smartphone. afterwards you can customize everything yourself as you like. to build up the basic framework of a website yourself and make it responsive for different devices is very difficult as a beginner. so you run from one big problem into the next. latest when you start with media-queries, you can hardly keep track of it all.)

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>

如何将标题中心并弹出文本在HTML和CSS中的图像上

还在原地等你 2025-02-09 12:30:30

通常,这个话题是广泛而复杂的。对于那些有兴趣的人,我建议 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 $;

db&lt;&gt; fiddle。

如您所见,该模式只是一个格式良好的答案的一个示例。为每个问题定义一个模式,为答案表创建一个触发器,然后在触发函数中使用上述函数来验证新的或修改的答案。

In general, the topic is extensive and complex. For those interested, I recommend the JSON Schema website.

For our purposes, we can use a very simple method of validation, limited to two issues, commented in the function body:

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 $;

Test the function in Db<>Fiddle.

As you can see, the pattern is just an example of a well-formatted answer. Define a pattern for each question, create a trigger for the answers table and use the above function inside the trigger function to verify new or modified answers.

如何在Postgres中执行JSON/JSONB的形状?

更多

推荐作者

佚名

文章 0 评论 0

今天

文章 0 评论 0

゛时过境迁

文章 0 评论 0

达拉崩吧

文章 0 评论 0

呆萌少年

文章 0 评论 0

孤者何惧

文章 0 评论 0

更多

友情链接

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文