问题列表 - 第36259页

为什么类变量不存储php类中的值?

我刚开始研究php中的类和对象.我有一个非常小的程序,如下所示.

<?PHP
class GetUserPermissions 
{
public $tab1;
public $tab2;
public $tab3;
public $tab4;

public function setMainPagePermissions()
{
    try
    {                   
        $this->SetPermissionsSelection(1,0,5,0);
    }
    catch(Exception $e)
    {
        echo $e->getMessage();
    }
}

public function SetPermissionsSelection($a,$b,$c,$d)
{       
    $this->$tab1=$a;
    $this->$tab2=$b;
    $this->$tab3=$c;
    $this->$tab4=$d;
}

 public function gettab1Status()
 {
    return $this->$tab1;
 }
  public function gettab2Status()
  {
  return $this->$tab2;

}
public function gettab3Status()
{
    return $this->$tab3;

}
public function gettab4Status()
{
    return $this->$tab4;
}

}

$test=new GetUserPermissions();
$test->setMainPagePermissions();

echo "<br>value 1 : ".$test->gettab1Status();
echo "<br>value 2 : ".$test->gettab2Status();
echo …
Run Code Online (Sandbox Code Playgroud)

php class

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

如何监视Python文件的更改?

如果代码发生变化,我想重新启动我的Python Web应用程序.但是可能会有大量文件可以更改,因为导入模块中的文件可能会发生变化......

如何从导入的包/模块中获取实际文件名?

如何有效地检测修改后的Python文件?有没有图书馆可以做到这一点?

python notifications monitoring file

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

HTML,可打印的超链接引用,如目录

HTML文档中的链接通常是可点击的.但是,在打印页面上,该功能是由于无法获得的自然原因.

<a href="#foo">Link to foo</a>
[... loads of content ...]
<a name="foo"/>Here is foo
Run Code Online (Sandbox Code Playgroud)

点击屏幕上的"Link to foo"将页面滚动到正确的位置.如果打印此文档,是否有办法引用页码?我想这样做

<a href="#foo" style="printing: page-reference;">Link to foo</a>
Run Code Online (Sandbox Code Playgroud)

使其打印页码而不是带下划线的文本"Link to foo".

这是可能的,使用HTML 4或5,XHTML,CSS 2或3,或者可能借助一些花哨的javascript?

html javascript css html5 printing-web-page

2
推荐指数
1
解决办法
759
查看次数

Python SocketServer

我怎么能叫shutdown()SocketServer接收到某个消息"退出"之后?据我所知,调用serve_forever()将阻止服务器.

谢谢!

python sockets socketserver

6
推荐指数
2
解决办法
3627
查看次数

检查矢量是否为空

假设我有std::vector发言权Vector

现在在对向量(插入或删除)执行某些操作之后,我想检查向量是否为空,并且基于此我想要执行某些操作.

哪种方法更好

方法1

if (Vector.size() == 0){ /* operations */ }
Run Code Online (Sandbox Code Playgroud)

方法2

if (Vector.empty()) { /* operations */ }
Run Code Online (Sandbox Code Playgroud)

哪种方法更好,1还是2

c++ stl vector

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

我们如何使用vb脚本打开word文件

任何人都可以告诉我如何使用vbs windows脚本打开word文件.

我尝试了这两组vbs,但是当脚本"The system cannot find the file specified", errorcode: 80070002存在于指定位置时,会显示Windows脚本Host error().

我试过的第一个vbs:

Dim sAppPath
Dim sPrgFolder
sPrgFolder=CreateObject("WScript.Shell").ExpandEnvironmentStrings("%ProgramFiles%") 
sAppPath =sPrgFolder + "c:\UserGuide.doc"
WScript.CreateObject("WScript.Shell").Run sAppPath)
Run Code Online (Sandbox Code Playgroud)

第二个vbs我试过:

OPTION EXPLICIT
dim fso, ws, file_to_open, OFFICE_PATH
Set ws = WScript.CreateObject("WScript.Shell")
OFFICE_PATH = "C:\Program Files\Microsoft Office\Office"
file_to_open = CHR(34) & "C:\UserGuide.doc" & CHR(34)
ws.Run CHR(34)& OFFICE_PATH & "\winword.exe" & CHR(34) & file_to_open, 0, "FALSE"
Run Code Online (Sandbox Code Playgroud)

vbscript ms-word office-interop

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

当具有相同术语的HQL选择有效时,为什么此HQL删除失败?

为什么以下HQL查询失败?

string hql = @"delete MyLog log
               where
                    log.UtcTimestamp < :threshold and
                    log.Configuration.Application = :application";

session.CreateQuery(hql)
       .SetDateTime("threshold", threshold)
       .SetEnum("application", this.application)
       .ExecuteUpdate();
Run Code Online (Sandbox Code Playgroud)

在select中使用相同形式的查询:

string hql = @"from MyLog log
               where
                    log.UtcTimestamp < :threshold and
                    log.Configuration.Application = :application";
IList<MyLog> log = session.CreateQuery(hql)
    .SetDateTime("threshold", threshold)
    .SetEnum("application", this.application)
    .List<MyLog>();
Run Code Online (Sandbox Code Playgroud)

MyLog的映射包含:

References(x => x.Configuration)
     .Columns("CONFIGURATION_ID")
     .ReadOnly();      
Run Code Online (Sandbox Code Playgroud)

Configuration的映射包含:

Map(x => x.Application, "APPLICATION_ID");
Run Code Online (Sandbox Code Playgroud)

我得到的错误是:

从MYLOG中删除,CONFIGURATION countercon1_,其中UTC_TIMESTAMP <:p0和APPLICATION_ID =:p1; :p0 = 04/10/2010 17:15:52,:p1 = 7

NHibernate.Exceptions.GenericADOException:无法执行更新查询[SQL:

从MYLOG,CONFIGURATION中删除countercon1_,其中UTC_TIMESTAMP <?和APPLICATION_ID =?

] ---> Oracle.DataAccess.Client.OracleException:ORA-00933:SQL命令未正确结束

nhibernate hql fluent-nhibernate ora-00933 hql-delete

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

Ruby Mash相当于Python?

在Ruby中,有一个叫做Mash的真棒库,它是一个Hash但是通过巧妙地使用missing_method可以转换:

object['property']
Run Code Online (Sandbox Code Playgroud)

object.property
Run Code Online (Sandbox Code Playgroud)

这对模拟非常有用.有人知道Python中有类似的东西吗?

ruby python mocking

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

List <T>应该是私有的吗?

我需要你的意见,因为我已经阅读了很多不同的主题.如果您List<T>在类声明中有一个或任何类型的列表,您是否将其设为私有,然后使用特定方法添加或删除项目,还是将其公开?

每个选项的任何缺点/优点都会使您的观点受到高度赞赏.

举个例子,假设我们有class Employer私有字段nameList<Employees>.我的问题是,我们是否应该将员工名单列为私人或公开,以及两种情况下的优缺点.

c# visibility list

11
推荐指数
1
解决办法
508
查看次数

WPF Checkbox内容与复选框的垂直对齐方式

我有一个复选框,其XAML标记如下:

<CheckBox HorizontalContentAlignment="Stretch">
    <StackPanel Orientation="Vertical">
        <TextBox x:Name="editTextBox" 
            Text="{Binding Path=Caption, Mode=TwoWay}"
            TextWrapping="Wrap"
            Visibility="{Binding Path=IsBeingEdited, Converter={StaticResource booleanToVisibilityConverter}}" />
        <TextBlock x:Name="itemText"
            TextWrapping="Wrap"                        
            Text="{Binding Path=Caption}" 
            Visibility="{Binding Path=IsBeingEdited, Converter={StaticResource reverseBooleanToVisibilityConverter}}">
        </TextBlock>
    </StackPanel>
</CheckBox>
Run Code Online (Sandbox Code Playgroud)

我的想法是我可以在TextBlock(显示)和TextBox(编辑)之间切换.但是,在运行应用程序时,CheckBox visual(可检查方块)垂直居中.我希望它与TextBlock/TextBox的顶部对齐.

我注意到当我只包含一个TextBlock(所以没有StackPanel,没有TextBox)时,复选框实际上与TextBlock的顶部对齐,所以我假设我在StackPanel上缺少一些设置?

wpf checkbox wpf-controls

8
推荐指数
2
解决办法
9060
查看次数