问题列表 - 第30815页

ASP.net相对路径不起作用?

这应该很简单,但它不起作用.

我的项目根目录下有一个文件.我想这样称呼它.

GetWorkbook("tplBud806_wRevenue.xls")
Run Code Online (Sandbox Code Playgroud)

我将项目发布到服务器并尝试运行它,服务器说它无法找到它.

Could not find file 'c:\windows\system32\inetsrv\tplBud806_wRevenue.xls'.
Run Code Online (Sandbox Code Playgroud)

这不是它应该采取的道路.它应该在E:\ IIServer\rootwww\reports\tplBud806_wRevenue.xls下.

我认为相对路径应该从项目运行的路径开始.我也尝试过.

GetWorkbook("/tplBud806_wRevenue.xls")
GetWorkbook("\tplBud806_wRevenue.xls")
GetWorkbook("~/tplBud806_wRevenue.xls")
GetWorkbook("~\tplBud806_wRevenue.xls")
Run Code Online (Sandbox Code Playgroud)

有什么设置我不见了?它必须是简单的......

asp.net path relative-path

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

在将表达式放入lambda之前对其进行求值

我的代码中包含以下代码.emacs:

(dolist (mode '(scheme emacs-lisp lisp clojure))
  (add-hook
   (intern (concat (symbol-name mode) "-mode-hook"))
   (lambda ()
     (progn
        (run-programming-hook)
        (message "%s" (concat (symbol-name mode) "-mode")))
Run Code Online (Sandbox Code Playgroud)

显然,mode当lambda执行时,该变量是无效的.问题是我如何mode以这样的方式评估它不是作为变量进入lambda而是作为该变量中的值进入?换句话说,我希望在运行钩子时打印消息.

lisp emacs elisp

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

C#从外部dll读取web.config中的<system.net> <mailSettings>

我的网络应用程序调用外部DLL.在dll中我想访问system.net/mailSettings/smtp部分中的specifiedPickupDirectory pickupDirectoryLocation值.如何从dll代码中获取它?

就像是

System.Configuration.ConfigurationSettings.GetConfig("configuration/system.net/mailSettings/smtp/specifiedPickupDirectory/pickupDirectoryLocation")
Run Code Online (Sandbox Code Playgroud)

但这不起作用

c# dll smtp web-config

7
推荐指数
2
解决办法
7406
查看次数

如何表明用例已经结束?

假设我正在Use Case填写测验.你只有5分钟的时间来完成测验.在进行Use Case"填写测验"时,我应该如何发出时间限制信号,之后Use Case结束了?我只是用文字写的,还是有更正式的用法?

我的用例可以是草图:

 1. The Actor tells the System he's ready to start the quiz.
 2. The System presents the Actor with the first question of the Quiz and its 4 possible answers and tells him how much time he has left.
 3. The Actor tells the System what is his chosen answer (a number between 1 and 4).

Repeat steps 2-3 until there are no questions left.

 4. The System registers …
Run Code Online (Sandbox Code Playgroud)

oop uml use-case

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

用于密码验证的正则表达式,不允许使用空格

我需要一个用于密码字段的Ruby on Rails应用程序的正则表达式.

除空格外,允许使用任何字符或数字或符号.

ruby regex ruby-on-rails

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

file_get_contents创建文件不存在

如果file_get_contents不存在,会创建该文件吗?我基本上是在找一行命令.我用它来计算程序的下载统计数据.我在预下载页面中使用此PHP代码:

Download #: <?php $hits = file_get_contents("downloads.txt"); echo $hits; ?>
Run Code Online (Sandbox Code Playgroud)

然后在下载页面中,我有这个.

<?php
    function countdownload($filename) {
        if (file_exists($filename)) {
            $count = file_get_contents($filename);
            $handle = fopen($filename, "w") or die("can't open file");
            $count = $count + 1;
        } else {
            $handle = fopen($filename, "w") or die("can't open file");
            $count = 0; 
        }
        fwrite($handle, $count);
        fclose($handle);
    }

    $DownloadName = 'SRO.exe';
    $Version = '1';
    $NameVersion = $DownloadName . $Version;

    $Cookie = isset($_COOKIE[str_replace('.', '_', $NameVersion)]);

    if (!$Cookie) {
        countdownload("unqiue_downloads.txt");
        countdownload("unique_total_downloads.txt");
    } else {
        countdownload("downloads.txt");
        countdownload("total_download.txt");
    } …
Run Code Online (Sandbox Code Playgroud)

php

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

这个功能有什么作用?

我正在读一个包含以下功能的程序,即

int f(int n) {
    int c;
    for (c=0;n!=0;++c) 
        n=n&(n-1);
    return c;
}
Run Code Online (Sandbox Code Playgroud)

我不太明白这个功能打算做什么?

c c++

20
推荐指数
4
解决办法
2673
查看次数

NullPointerException,在三元表达式中具有自动装箱功能

运行以下Java代码:

boolean b = false;
Double d1 = 0d;
Double d2 = null;
Double d = b ? d1.doubleValue() : d2;
Run Code Online (Sandbox Code Playgroud)

为什么会出现NullPointerException?

java autoboxing nullpointerexception

23
推荐指数
2
解决办法
6343
查看次数

C#需要停止导出标题行的代码

嘿伙计们,我有这么快的代码,我无法弄清楚如何停止导出标题行.

结果是

PrimaryRowGuid|Text  
| blah blah blahg blah  
blah blah blahg blahblah blah blahg blah  
blah blah blahg blah

我需要的结果是:

blah blah blahg blah  
blah blah blahg blahblah blah blahg blah  
blah blah blahg blah

任何帮助都是适当的!

using (StreamWriter writer = new StreamWriter(strm))
{
    SqlCommand cmd = new SqlCommand(sql, con);
    SqlDataReader reader = cmd.ExecuteReader();
    for (int i = 0; i < reader.FieldCount; i++)
        writer.Write((i == 0 ? "" : "|") + reader.GetName(i));
    writer.Write("\n");
    while (reader.Read())
    {
        for (int i = 1; …
Run Code Online (Sandbox Code Playgroud)

c#

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

如何告诉继承类不调用其基类'无参数构造函数?

我很惊讶地发现,无论何时调用派生类中的任何构造函数,都会调用我的基类的无参数构造函数.我认为这就是为什么: base(),如果我想要显式调用基础构造函数.

在实例化派生类时,如何防止调用基本构造函数?

using System;

namespace TestConstru22323
{
    class Program
    {
        static void Main(string[] args)
        {
            Customer customer = new Customer("Jim", "Smith");
            Customer c = new Customer();
            Console.WriteLine(customer.Display());

            Console.ReadLine();
        }
    }

    public class Person
    {
        public Person()
        {
            Console.WriteLine("I don't always want this constructor to be called. I want to call it explicitly.");
        }
    }

    public class Customer : Person
    {
        private string _firstName;
        private string _lastName;

        //public Customer(string firstName, string lastName): base()  //this …
Run Code Online (Sandbox Code Playgroud)

c# oop constructor

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