问题列表 - 第27997页

批处理文件将命令返回的值分配给变量(来自powershell)

我正在引用这个问题 ASSIGN win XP命令行输出到变量

我试图在powershell代码段上使用它,所以我输入

powershell date (get-date).AddDays(-1) -format yyyyMMdd
Run Code Online (Sandbox Code Playgroud)

并确认它返回如

20100601
Run Code Online (Sandbox Code Playgroud)

但是如果我试着的话

for /f "tokens=*" %a in ('powershell date get-date -format yyyyMMdd
') do set var=%a
Run Code Online (Sandbox Code Playgroud)

然后它没能按预期工作.如何将日期转移到变量?

powershell batch-file

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

使用Jquery验证防止重复值

我有使用JSP动态生成的表单和表单文本字段.我正在使用Jquery验证,但希望添加functionlaty以防止表单中的重复输入.

例如

<form name="myForm" id="myForm">
      <input type="text" name="text1" id="text1">
      <input type="text" name="text2" id="text2">
      <input type="text" name="text3" id="text3">
      =
      = 
      N number of form fields
      <input type="text" name="textn" id="textn">

</form>
Run Code Online (Sandbox Code Playgroud)

我想检查是否使用jQuery验证在文本字段中输入了任何重复值.

jquery

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

C++'new'关键字和C.

可能重复:
在C++中使用关键字class作为变量名

在库的C头文件中,我使用其中一个变量命名为'new'.不幸的是,我在C++项目中使用这个库,并且"new"作为变量名称的出现使编译器变得怪异.我已经在使用extern"C"{#include <...>},但在这方面似乎没有帮助.

我是否需要让库开发人员更改该变量的名称,即使从他的角度来看,作为C开发人员,代码绝对正常,因为"new"不是C关键字?

c c++ keyword extern new-operator

5
推荐指数
2
解决办法
3799
查看次数

如何从字符串中找到第一个非重复字符?

我花了半天的时间试图找出这个,最后我得到了解决方案.但是,我觉得这可以用更简单的方式完成.我认为这段代码不是真的可读.

问题:从字符串中查找第一个非重复字符.

$ string ="abbcabz"

在这种情况下,函数应输出"c".

我使用连接而不是$input[index_to_remove] = '' 从给定字符串中删除字符的原因是因为如果我这样做,它实际上只留下空单元格,以便我的返回值$ input [0]不会返回我想要返回的字符.

例如,

$str = "abc";
$str[0] = '';
echo $str;
Run Code Online (Sandbox Code Playgroud)

这将输出"bc"

但实际上,如果我测试,

var_dump($str);
Run Code Online (Sandbox Code Playgroud)

它会给我:

string(3) "bc"
Run Code Online (Sandbox Code Playgroud)

这是我的意图:

Given: input

while first char exists in substring of input {
  get index_to_remove
  input = chars left of index_to_remove . chars right of index_to_remove

  if dupe of first char is not found from substring
     remove first char from input 
}
return first char of input
Run Code Online (Sandbox Code Playgroud)

码:

function find_first_non_repetitive2($input) {

    while(strpos(substr($input, 1), …
Run Code Online (Sandbox Code Playgroud)

php string

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

当存在基于触发器隐藏显示元素的复杂数据模板时,我的ListView或ListBox控件大小不会缩小?

我有一个ListView元素,每个ListViewItem都有一个DataTemplate定义如下.运行时,ListView的高度不会折叠到视图中的项目上,这是不合需要的行为:

<DataTemplate x:Key="LicenseItemTemplate">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"  />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <TextBlock Grid.Row="0" Text="{Binding company}"></TextBlock>
        <Grid Grid.Row="1" Style="{StaticResource HiddenWhenNotSelectedStyle}">
            <Grid.RowDefinitions>
                <RowDefinition />
            </Grid.RowDefinitions>
            <Button Grid.Row="0">ClickIt</Button>
        </Grid>
    </Grid>
</DataTemplate>
Run Code Online (Sandbox Code Playgroud)

外部网格的第二行应用了一个样式,如下所示.样式的目的是公开所选数据项的详细视图:

<Style TargetType="{x:Type Grid}" x:Key="HiddenWhenNotSelectedStyle" >
    <Style.Triggers>
        <DataTrigger
            Binding="{Binding Path=IsSelected, 
                        RelativeSource={
                        RelativeSource 
                        Mode=FindAncestor, 
                        AncestorType={x:Type ListViewItem}
                        }
                        }" 
            Value="False">
            <Setter Property="Grid.Visibility" Value="Collapsed" />
        </DataTrigger>
        <DataTrigger
            Binding="{Binding Path=IsSelected, 
                        RelativeSource={
                        RelativeSource 
                        Mode=FindAncestor, 
                        AncestorType={x:Type ListViewItem}
                        }
                        }" 
            Value="True">
            <Setter
                Property="Grid.Visibility"
                Value="Visible"
            />
        </DataTrigger>
    </Style.Triggers>
</Style>
Run Code Online (Sandbox Code Playgroud)

ListView呈现如下: ListView的高度是应该的两倍.

当没有选择任何元素时,所需的外观是这样的: ListView的高度折叠为列出项目.

...当然,当通过选择使第二个网格可见时,ListView的高度调整以适应附加内容.我该怎么做才能获得理想的行为?

silverlight wpf height xaml listview

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

使用GTK在emacs 23.2中滚动滞后

我正在使用带有GTK工具包的emacs 23.2.我使用以下configure-params从源代码构建了emacs:

./configure --prefix=/usr --without-makeinfo --without-sound
Run Code Online (Sandbox Code Playgroud)

使用以下配置构建emacs:

  Where should the build process find the source code?    /home/****/incoming/emacs-23.2
  What operating system and machine description files should Emacs use?
        `s/gnu-linux.h' and `m/intel386.h'
  What compiler should emacs be built with?               gcc -g -O2 -Wdeclaration-after-statement -Wno-pointer-sign  
  Should Emacs use the GNU version of malloc?             yes
      (Using Doug Lea's new malloc from the GNU C Library.)
  Should Emacs use a relocating allocator for buffers?    yes
  Should Emacs use mmap(2) for buffer allocation?         no
  What window …

emacs emacs23

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

UI 选择是功能性需求还是非功能性需求?

今天我们在办公室讨论了所需文档中的UI元素。

问题是 UI 需求是功能性的还是非功能性的。

  • “背景必须是蓝色”

这是功能性需求还是非功能性需求?

uml requirements

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

枚举数据类型与MySQL中的数据表?

我有一个MySQL表users,包含以下列:

  1. user_id(PK)
  2. 电子邮件
  3. 名称
  4. 密码

要管理角色系统,以下任何一个选项都会有缺点吗?

选项1:

创建了第一个表roles有三列:role_id(主键),namedescription,然后关联users.user_idroles.role_id在第三表作为外键叫users_roles

要么...

选项2:

roles使用两列创建第二个表:( user_id外键来自users.user_id)和role(ENUM)?ENUM数据类型列允许将允许的角色的简短列表作为值插入.

我以前从未在MySQL中使用ENUM数据类型,所以我只是好奇,因为选项2意味着少一个表.我希望这是有道理的,这是我第一次尝试在论坛中描述MySQL表.

mysql database database-design

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

Python模板引擎

如果有人可以帮助我开始编写python模板引擎吗?我是python的新手,当我学习语言时,我已经设法编写了一个在自己的轻量级WSGI类服务器上运行的MVC框架.

我设法编写了一个脚本来查找和替换值的键:(显然,这不是我的脚本的结构或实现方式.这只是一个例子)

from string import Template

html  = '<html>\n'
html += '  <head>\n'
html += '  <title>This is so Cool : In Controller HTML</title>\n'
html += '  </head>\n'
html += '  <body>\n'
html += '    Home | <a href="/hi">Hi ${name}</a>\n'
html += '  </body>\n'
html += '<html>'

Template(html).safe_substitute(dict(name = 'Arturo'))
Run Code Online (Sandbox Code Playgroud)

我的下一个目标是实现自定义语句,修饰符,函数等(如'for'循环)但我真的不知道我是否应该使用另一个我不知道的模块.我想到了正则表达式,但我觉得这不是一种有效的方法

任何帮助表示赞赏,我相信这对其他人也有用.

谢谢

python templates

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

任何非铁轨红宝石论坛应用程序在那里?

我有一个基于sinatra的相当完整的应用程序.我觉得需要一个易于集成的论坛模块(代码,扩展等).在我的小型VPS计划中运行并行Rails应用程序不是一个选项(我甚至使用redis来保持较小的占用空间).基于sinatra的论坛将是一个好消息.谢谢

ruby forum sinatra redis

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