小编Nan*_* HE的帖子

如何在Perl中查看目录是否存在?

要在使用文件之前查看文件是否存在,我们可以使用:

if (-e "filename.cgi")
{
 #proceed with your code
} 
Run Code Online (Sandbox Code Playgroud)

但是如何识别目录是否存在?

directory perl file-io

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

如何在C#中获取子字符串?

我可以使用下面的函数获得前三个字符.

但是,如何通过函数获得最后五个字符()的输出Substring().或者将使用其他字符串函数?

static void Main()
{
    string input = "OneTwoThree";

    // Get first three characters
    string sub = input.Substring(0, 3);
    Console.WriteLine("Substring: {0}", sub); // Output One. 
}
Run Code Online (Sandbox Code Playgroud)

c# string

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

C中的十六进制浮点常数

0x0.3p10 代表什么价值?

p上面的陈述中含义是什么?

c hex constants

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

setcookie,无法修改标题信息 - 已发送的标题

我是PHP的新手,我刚刚练习PHP setcookie()并且失败了.

http:// localhost/test/index.php

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title></title>

    </head>
    <body>
     <?php
     $value = 'something from somewhere';

     setcookie("TestCookie", $value);
     ?>
    </body>
</html>
Run Code Online (Sandbox Code Playgroud)

http:// localhost/test/view.php

<?php
 // I plan to view the cookie value via view.php
 echo $_COOKIE["TestCookie"];

?>
Run Code Online (Sandbox Code Playgroud)

但我没能运行index.php,这样的IE警告.

Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\test\index.php:9) in C:\xampp\htdocs\test\index.php on line 12
Run Code Online (Sandbox Code Playgroud)

毫无疑问,我启用了IE 6 cookie.

上面的程序有什么问题吗?谢谢.

使用WinXP OS和XAMPP 1.7.3.

php cookies http httpresponse

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

如何使用C#中的XmlDocument和XmlNode修改现有的XML文件

我已经实现了在应用程序初始化时使用XmlTextWriter创建下面的XML文件.

并且知道我不知道如何使用XmlDocumentXmlNode更新childNode id值.

是否有一些属性来更新id值?我试过InnerText但是失败了.谢谢.

<?xml version="1.0" encoding="UTF-8"?>
<Equipment xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <License licenseId="" licensePath=""/>
  <DataCollections>
    <GroupAIDs>
      <AID id="100">
        <Variable id="200"/>
        <Variable id="201"/>
      </AID>
      <AID id="">
        <Variable id="205"/>
      </AID>
      <AID id="102"/>
    </GroupAIDs>
    <GroupBIDs>
      <BID id="2000">
        <AID id="100"/>
      </BID>
      <BID id="2001">
        <AID id="101"/>
        <AID id="102"/>
      </BID>
    </GroupBIDs>
    <GroupCIDs>
      <BID id="8"/>
      <BID id="9"/>
      <BID id="10"/>
    </GroupCIDs>
  </DataCollections>
</Equipment>
Run Code Online (Sandbox Code Playgroud)

c# xml xmldocument xmlnode

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

如何修复PHP中date()的警告"

我在winxp上使用XAMPP(PHP版本5.3.1).当我尝试在我的localhost上调用time()或date()函数时.它会显示警告信息,

严重性:警告

消息:date()[function.date]:依赖系统的时区设置是不安全的.您需要 使用date.timezone设置或date_default_timezone_set()函数.如果您使用了这些方法中的任何一种并且仍然收到此警告,则很可能拼错了时区标识符.我们选择'UTC'代替'8.0 /无DST'

文件名:helpers/date_helper.php

如何禁用警告?谢谢.

php xampp warnings date

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

如何重置字典

如果我宣布这样的字典:

private static Dictionary<string, object> aDict = new Dictionary<string, object>();
Run Code Online (Sandbox Code Playgroud)

现在我想在另一个地方使用它.我该如何重置?

aDict = new Dictionary<string, object>(); // like this?

aDict = null; // or like this?
Run Code Online (Sandbox Code Playgroud)

或其他重置样式?

c# dictionary

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

如何删除所有ListBox项目?

我创建了两个RadioButton(重量和高度).我会在两个类别之间切换.但是它们共享相同的ListBox控制器(listBox1和listBox2).

有没有什么好方法可以更简单地清除所有ListBox项?我找不到ListBox的removeAll().我不喜欢我在这里发布的复杂的多行样式.

private void Weight_Click(object sender, RoutedEventArgs e)
    {
        // switch between the radioButton "Weith" and "Height"
        // Clear all the items first
        listBox1.Items.Remove("foot"); 
        listBox1.Items.Remove("inch");
        listBox1.Items.Remove("meter");
        listBox2.Items.Remove("foot");
        listBox2.Items.Remove("inch");
        listBox2.Items.Remove("meter");

        // Add source units items for listBox1
        listBox1.Items.Add("kilogram");
        listBox1.Items.Add("pound");

        // Add target units items for listBox2
        listBox2.Items.Add("kilogram");
        listBox2.Items.Add("pound");
    }

    private void Height_Click(object sender, RoutedEventArgs e)
    {
        // switch between the radioButton "Weith" and "Height"
        // Clear all the items first
        listBox1.Items.Remove("kilogram");
        listBox1.Items.Remove("pound");
        listBox2.Items.Remove("kilogram");
        listBox2.Items.Remove("pound");

        // Add source units items for listBox1 …
Run Code Online (Sandbox Code Playgroud)

c# wpf listbox

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

XML文件编码格式为"utf-8"VS"UTF-8"?

当XML文件转换为ASCII时.这是用户在这三个人物不同的价值观utfUTF.

<?xml version="1.0" encoding="utf-8"?>


<?xml version="1.0" encoding="UTF-8"?>
Run Code Online (Sandbox Code Playgroud)

我试图用vs2005创建一个新的xml文件.utf-8默认生成的表单文件.

哪一个是更标准的定义?谢谢.

xml encoding utf-8

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

如何从C#中Path.GetDirectoryName()的返回值中删除'file:\\'

string path = Path.GetDirectoryName(
                     Assembly.GetAssembly(typeof(MyClass)).CodeBase);
Run Code Online (Sandbox Code Playgroud)

输出:

文件:\ d:\学习\ CS \测试\的test.xml

返回d:\ learning\cs\test\test.xml的最佳方法是什么

file:\\doc.Save(returnPath)但是doc.Load(returnPath),当我打电话时会抛出异常; 效果很好.谢谢.

c# path

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

标签 统计

c# ×5

php ×2

xml ×2

c ×1

constants ×1

cookies ×1

date ×1

dictionary ×1

directory ×1

encoding ×1

file-io ×1

hex ×1

http ×1

httpresponse ×1

listbox ×1

path ×1

perl ×1

string ×1

utf-8 ×1

warnings ×1

wpf ×1

xampp ×1

xmldocument ×1

xmlnode ×1