小编Gag*_*gan的帖子

获取PowerShell中文件的完整路径

我需要获取所有文件,包括属于特定类型的子文件夹中存在的文件.

我正在做这样的事情,使用Get-ChildItem:

Get-ChildItem "C:\windows\System32" -Recurse | where {$_.extension -eq ".txt"}
Run Code Online (Sandbox Code Playgroud)

但是,它只返回文件名而不是整个路径.

powershell powershell-2.0

124
推荐指数
10
解决办法
34万
查看次数

选中复选框后禁用选择性下拉列表

我在我的html表单上实现了selectize.但是,只有单击"启用"复选框时,下拉列表才会变为活动状态.我知道在选择对象上有一个禁用属性,但是当单击该复选框时我不知道如何使用它.

我已经尝试将禁用的类添加到selectize div元素,但这也不起作用.任何帮助将不胜感激.

谢谢

javascript jquery selectize.js

20
推荐指数
2
解决办法
2万
查看次数

Laravel将数组转换为模型

我有一个数组如下

      'topic' => 
  array (
    'id' => 13,
    'title' => 'Macros',
    'content' => '<p>Macros. This is the updated content.</p>
',
    'created_at' => '2014-02-28 18:36:55',
    'updated_at' => '2014-05-14 16:42:14',
    'category_id' => '5',
    'tags' => 'tags',
    'referUrl' => '',
    'user_id' => 3,
    'videoUrl' => '',
    'useDefaultVideoOverlay' => 'true',
    'positive' => 0,
    'negative' => 1,
    'context' => 'macros',
    'viewcount' => 60,
    'deleted_at' => NULL,
  )
Run Code Online (Sandbox Code Playgroud)

我想使用这个数组并将其转换/转换为主题模型.有没有办法可以做到这一点.

谢谢

laravel laravel-4

14
推荐指数
2
解决办法
2万
查看次数

AppFabric ErrorCode <ERRCA0017> <ES0006>:

我在服务器上安装了AppFabric.我创建了一台计算机的集群.我还创建了一个名为"Gagan"的缓存.按顺序使用以下命令

Use-CacheCluster -Provider xml -ConnectionString\NB-GJANJUA\Cache Start-CacheCluster

结果是缓存服务已启动并运行..这么好.

然后我设置我的web.config文件,如下所示

<?xml version="1.0"?>
<configuration>
    <configSections>
    <section name="dataCacheClient"
type="Microsoft.ApplicationServer.Caching.DataCacheClientSection,
        Microsoft.ApplicationServer.Caching.Core, Version=1.0.0.0, 
        Culture=neutral, PublicKeyToken=31bf3856ad364e35"
allowLocation="true"
allowDefinition="Everywhere"/>   

</configSections>

<!-- cache client -->
<dataCacheClient>
<!-- cache host(s) -->

<hosts>
  <host
     name="NB-GJANJUA.com"
     cachePort="22233"/>
</hosts>
</dataCacheClient>

<system.web>    

<compilation debug="true" targetFramework="4.0" >
    <assemblies>
      <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
      <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
      <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
      <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
      <add assembly="Microsoft.ApplicationServer.Caching.Client, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
      <add assembly="Microsoft.ApplicationServer.Caching.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
    </assemblies>
</compilation>

<sessionState mode="Custom" customProvider="SessionStore" cookieless="true">
  <providers> …
Run Code Online (Sandbox Code Playgroud)

appfabric appfabric-cache

10
推荐指数
3
解决办法
2万
查看次数

在C#中向cmd提示符发送命令

对于我的一个实现,我正在研究一个应该向cmd窗口发送/检索命令/结果的工具.一切正常,但下面的用例没有做任何事情.好像我的应用程序正在等待某事(而不是显示结果)

从我的工具我导航到python文件夹.从python文件夹我尝试启动python.exe但此时,我的编辑器没有做任何事情.它只是在等待.

为了您的善意考虑,我也在这里链接视频.你们会更容易理解我想说的话.

在此处观看视频(在youtube上)

我还附上了我目前拥有的代码.

            ProcessStartInfo info = new ProcessStartInfo("cmd.exe");

            string argument = null;
            if (!string.IsNullOrEmpty(startingDirectory) && System.IO.Directory.Exists(startingDirectory))
            {
               argument += @"cd\";
            }
            else
            {
                argument += "\"";
            }
            info.Arguments = argument;
            info.CreateNoWindow = true;
            info.RedirectStandardError = true;
            info.RedirectStandardInput = true;
            info.RedirectStandardOutput = true;
            info.UseShellExecute = false;
             this.shellProcess = System.Diagnostics.Process.Start(info);
            this.shellProcess.EnableRaisingEvents = true;
            //this.InputStream.AutoFlush = true;
            this.shellProcess.Exited += new EventHandler(ProcessExited);
            this.ErrorBeginRead();
            this.OutputBeginRead();

 private void OutputBeginRead()
    {
        this.shellProcess.StandardOutput.BaseStream.BeginRead(outputBuffer, 0, outputBuffer.Length, new AsyncCallback(this.OnOutputInput), this.shellProcess);
    }

        private void ErrorBeginRead()
    {
        this.shellProcess.StandardError.BaseStream.BeginRead(errorBuffer, 0, errorBuffer.Length, …
Run Code Online (Sandbox Code Playgroud)

c# cmd winforms

8
推荐指数
1
解决办法
3万
查看次数

如何快速加载winforms应用程序

我有一个winforms应用程序.主窗体有很多控件,这是导致加载非常慢的原因之一.我想做的是使表单加载更快.

我已经设置了beginupdate和endupdate.表单未在后台工作线程中呈现,因为这是主要表单.没有初始表格.当用户单击应用程序图标时,这是第一个加载的表单.添加进度条或任何初始形式对我来说不是一个好主意.

我已经在Stack溢出检查了其他问题,但它们似乎没有像我一样面临同样的问题.

如果您有一些想法/想法,如果您可以与我分享,那将是您的好事.

谢谢并问候Gagan Janjua

c# winforms

7
推荐指数
1
解决办法
9590
查看次数

C#内存泄漏?

我正在测试appfabric缓存性能.为此,从本地计算机上,我正在访问LAN上的缓存主机.此缓存主机在Windows Server 2008上运行,除了必需品之外没有安装任何内容.它有8演出的RAM.它也是VMware虚拟服务器,

一旦我点击缓存主机,我就可以看到正在使用的内存增加.但某些地方正在发生一些非常可疑的事情.正在使用的主要主要数据字节是1.5 Gigs.对象大小为1,744字节(使用ANTS分析器).总对象数为2,521,451.我已经禁用驱逐.但是,这很有趣,一旦服务器达到限制状态,我就可以看到服务器的RAM正在7.72 Gigs上使用,但除了使用1.8演出的分布式缓存之外,没有其他应用程序使用如此高的数量内存.

我正在使用Visual Studio 2010,我正在并行插入和读取对象

我想问的问题是:

我的记忆在哪里?处于限制状态的服务器说我正在使用7.72 gig的分配内存,而在任务管理器中,我可以看到几乎没有使用3个Gigs(如果我添加所有正在运行的进程的内存)

c# memory appfabric

6
推荐指数
1
解决办法
1087
查看次数

获取数据库中唯一约束和索引的列表

我必须得到所有唯一键约束的列表和特定数据库的索引.我正在做这样的事情:

SELECT * FROM sys.sysobjects WHERE type!='u' AND name LIKE <tablename> 
Run Code Online (Sandbox Code Playgroud)

只是想确认这是否是正确的方法,还是有更好的方法做同样的事情?

sql sql-server sql-server-2008

6
推荐指数
1
解决办法
7930
查看次数

使用PowerShell连接到SQL Server

我使用下面的powershell脚本连接到sql server的实例.我很确定我的用户名和密码是正确的.

$ connectionString ="server = {0}; database = {1}; uid = {2}; pwd = {3};"

$c = Get-Credential
Write-Host($ipAddress)
Write-Host  $c.username 
Write-Host  $c.GetNetworkCredential().password

$connectionString = [string]::Format( "server={0};database={1};uid={2};pwd={3};", "servername", "databasename",$c.username,$c.GetNetworkCredential().password) 
#open database connection to SQL Server

Write-Host  $connectionString
$conn = New-Object system.Data.SqlClient.SqlConnection
$conn.connectionstring = $connectionString
$conn.open

    switch ($conn.State)
{
"Open" { Write-Host "Do some work"; }
Default { Write-Host "The connection is $($conn.State).  There has been an error connecting to the database."; }
}
Run Code Online (Sandbox Code Playgroud)

它始终属于默认语句.

sql-server powershell sqlconnection

5
推荐指数
1
解决办法
1万
查看次数

上下文 API HOC 单元测试

我有一个 HOC 组件,它包装了 React 的上下文 API,如下所示

import React from 'react';
import { AppContext } from './Context';

export function withAppContext(Component) {
    return function WrapperComponent(props) {
        return (
            <AppContext.Consumer>
                {state => <Component {...props} context={state} />}
            </AppContext.Consumer>
        );
    };
}
Run Code Online (Sandbox Code Playgroud)

以及另一个使用此 HOC 的组件

class Hello extends Component {
    render() {
        return (
            <Fragment>
                <p>{this.props.context.state.name}</p>
                <p>{this.props.context.state.age}</p>
                <p>{this.props.user}</p>
            </Fragment>
        )
    }
}

export default withAppContext(Hello);
Run Code Online (Sandbox Code Playgroud)

我打算编写一个单元测试来测试Hello组件。为了实现这一点,我有以下单元测试

const getAppContext = (context = {
        state : {
            "name" : "Jane Doe",
            "age" : 28
        } …
Run Code Online (Sandbox Code Playgroud)

reactjs jestjs enzyme high-order-component

5
推荐指数
1
解决办法
744
查看次数