问题列表 - 第8495页

如何正确地使我的makefile编译和运行?

问题可能不是描述我的问题的最佳问题,但我想不出更好的问题.我的makefile是这样的:

PROGRAM_NAME = prog

OBJECT_FILES = $(PROGRAM_NAME).o
CFLAGS = -O2 -Wall -g

$(PROGRAM_NAME) : $(OBJECT_FILES)
    gcc $(CFLAGS) -o $@ $(OBJECT_FILES)

$(PROGRAM_NAME).o : $(PROGRAM_NAME).c data.h
    gcc $(CFLAGS) -c $<

clean :
    $(RM) $(PROGRAM_NAME)
    $(RM) $(OBJECT_FILES)
    $(RM) *~ *.bak

run :
    @$(MAKE) && ./$(PROGRAM_NAME) $(ARGS)
Run Code Online (Sandbox Code Playgroud)

当我想编译并运行时,我只是做"运行".这个问题是我的程序处理Ctrl + Z产生的信号,如果我用"make run"启动我的程序,信号将被发送到"make run"而不是我的程序本身.

基本上,调用"make run"与直接调用"make && ./prog"不同,因为在第一种情况下,"make run"不会终止,除非"prog"首先终止.

有没有解决的办法?

c signals makefile

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

如何使用MIT-Scheme执行.scm脚本(在REPL之外)?

我想键入类似'scheme file.scm'的内容并让它解释文件,然后将我带回我的shell,而不是将其加载到REPL中.

编辑:我尝试了scheme <test.scm,它仍然使用REPL,唯一的区别是当流结束时方案退出.

scheme mit-scheme

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

继承WCF中的通用契约

更多WCF问题...... :)

我的所有工作流程都实现了相同的3种方法.经过大量的复制和粘贴后,我决定让它们从相同的界面继承:

[ServiceContract(Namespace = "http://schema.company.com/messages/")]
public interface IBasicContract<TRequest, TResponse>
  where TRequest : class
  where TResponse : class
{
  [OperationContract(Name = "GetReport",
    Action = "http://schema.company.com/messages/GetReport",
    ReplyAction = "http://schema.company.com/messages/GetReportResponse")]
  TResponse GetReport(TRequest inquiry);

  [OperationContract(Name = "GetRawReport",
    Action = "http://schema.company.com/messages/GetRawReport",
    ReplyAction = "http://schema.company.com/messages/GetRawReportResponse")]
  string GetRawReport(string guid);

  [OperationContract(Name = "GetArchiveReport",
    Action = "http://schema.company.com/messages/GetArchiveReport",
    ReplyAction = "http://schema.company.com/messages/GetArchiveReportResponse")]
  TResponse GetArchiveReport(string guid);
}
Run Code Online (Sandbox Code Playgroud)

我还决定创建服务客户端的通用实现:

public class BasicSvcClient<TRequest, TResponse> : ClientBase<IBasicContract<TRequest, TResponse>>, IBasicContract<TRequest, TResponse>
  where TRequest : class
  where TResponse : class
{
  public BasicSvcClient()
  {
  }

  public …
Run Code Online (Sandbox Code Playgroud)

c# generics wcf

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

sharepoint中的一项功能是什么?

..."功能"的基本组件(所需文件)是什么......并且任何人都可以指向任何有关创建功能的最佳实践教程(使用"12个蜂巢")...

sharepoint dev对我来说是新的,我只是在寻找最佳实践开发.教程/截屏将是一个奖金

谢谢

sharepoint

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

为什么使用HTTP PUT和DELETE方法而不是POST?

 new_story GET     /story/new(.:format)  {:action=>"new", :controller=>"stories"}
edit_story GET     /story/edit(.:format) {:action=>"edit", :controller=>"stories"}
     story GET     /story(.:format)      {:action=>"show", :controller=>"stories"}
           PUT     /story(.:format)      {:action=>"update", :controller=>"stories"}
           DELETE  /story(.:format)      {:action=>"destroy", :controller=>"stories"}
           POST    /story(.:format)      {:action=>"create", :controller=>"stories"}
Run Code Online (Sandbox Code Playgroud)

在网络工作中,我已经完成了其他技术,我只使用过GET和POST方法.但是在Rails中使用RESTful路由时,默认情况下,PUT和DELETE方法用于更新和销毁操作.使用PUT和DELETE的优点或需求是什么?我假设这些方法只是做POST的另一种方式 - 但为什么不坚持使用POST?

ruby-on-rails http delete-method

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

如何允许下载暂停/恢复?

通常,当我想允许用户下载文件而不泄露确切的位置时,我只是使用这样的东西让他们下载文件:

header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=\"" . $filename) . "\";");
header("Content-Transfer-Encoding: binary");
header("Content-Length: " . filesize($filename));
readfile("$filename");
Run Code Online (Sandbox Code Playgroud)

但是,如果他们使用现代浏览器或其他下载客户端,并且他们暂停下载并尝试恢复它,脚本(假设它们仍然经过身份验证或其他)将从头开始重新发送标头和文件内容,从而打破了下载,基本上要求从头开始重新下载文件.

如何启用我的脚本以补偿暂停(以及相应的恢复)下载?

php http download

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

如何在C#中使用Guids?

本规范:

Something = new Guid() 
Run Code Online (Sandbox Code Playgroud)

正在回归:

00000000-0000-0000-0000-000000000000

所有的时间,我不知道为什么?所以为什么?

c# guid

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

关于Ubuntu Hardy的Cron Job执行但未按预期删除文件

我在这里有点腌菜,想知道是否有人可以给我一些指示:

我有一个cron作业,每天为特定用户执行,并且应该扫描特定目录中的文件.从技术上讲,这是两个工作.我已经打开cron.log来验证它们是否正在执行,它们是:

May 24 11:03:01 AppNameGoesHere /USR/SBIN/CRON[11257]: (mongrel_AppNameGoesHere) 
  CMD (rm -rf /var/www/apps/AppNameGoesHere/current/public/
  {popular,index,purchasing,purchasing-alternate,support,about-us,guarantee,screenshots}.htm{,l})
May 24 11:04:01 AppNameGoesHere /USR/SBIN/CRON[11260]: (mongrel_AppNameGoesHere)
  CMD (rm -rf /var/www/apps/AppNameGoesHere/current/public/
  {stats,popular,bcf,articles,expenses})
Run Code Online (Sandbox Code Playgroud)

我删除了实际的用户名并对其进行了格式化,以便在StackOverflow上不那么难看.

现在,我的问题:尽管我可以看到这些删除执行并且显然在日志中成功,但如果我转到指定的目录,文件仍然存在.我最初怀疑hijinx正在进行许可,但我已经验证我可以通过进入mongrel_AppNameGoesHere用户并发出单独的rm命令或通过将cron作业复制/粘贴到命令行来手动删除文件.尽管cron作业成功执行了几天,但我没有手动删除的任何内容仍然没有被删除.

关于可能发生的事情的任何建议?我以前直接在/ etc/crontab文件中使用Dapper Drake和这些cron作业,当我升级到Hardy时,我将它们移动到用户特定的crontabs(via sudo crontab -e - u mongrel_AppNameGoesHere),这是他们似乎停止工作的地方.)

ubuntu cron rm

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

python中的链调用父构造函数

考虑一下 - 基类A,继承自A的类B,继承自B的类C.什么是在构造函数中调用父类构造函数的通用方法?如果这仍然听起来太模糊,这里有一些代码.

class A(object):
    def __init__(self):
        print "Initialiser A was called"

class B(A):
    def __init__(self):
        super(B,self).__init__()
        print "Initialiser B was called"

class C(B):
    def __init__(self):
        super(C,self).__init__()
        print "Initialiser C was called"

c = C()
Run Code Online (Sandbox Code Playgroud)

这就是我现在这样做的方式.但它仍然看起来有点过于非泛型 - 您仍然必须手动传递正确的类型.

现在,我尝试使用self.__class__作为super()的第一个参数,但是,显然它不起作用 - 如果你把它放在C的构造函数中 - 公平,B的构造函数被调用.如果你在B中做同样的事情,"self"仍然指向一个C的实例,所以你最终再次调用B的构造函数(这以无限递归结束).

现在没有必要考虑钻石继承,我只想解决这个具体问题.

python oop inheritance constructor

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

使用Python读取UTF8 CSV文件

我正在尝试使用Python(只有法语和/或西班牙语字符)读取带有重音字符的CSV文件.基于csvreader的Python 2.5文档(http://docs.python.org/library/csv.html),我提出了以下代码来读取CSV文件,因为csvreader仅支持ASCII.

def unicode_csv_reader(unicode_csv_data, dialect=csv.excel, **kwargs):
    # csv.py doesn't do Unicode; encode temporarily as UTF-8:
    csv_reader = csv.reader(utf_8_encoder(unicode_csv_data),
                            dialect=dialect, **kwargs)
    for row in csv_reader:
        # decode UTF-8 back to Unicode, cell by cell:
        yield [unicode(cell, 'utf-8') for cell in row]

def utf_8_encoder(unicode_csv_data):
    for line in unicode_csv_data:
        yield line.encode('utf-8')

filename = 'output.csv'
reader = unicode_csv_reader(open(filename))
try:
    products = []
    for field1, field2, field3 in reader:
        ...
Run Code Online (Sandbox Code Playgroud)

以下是我试图阅读的CSV文件的摘录:

0665000FS10120684,SD1200IS,Appareil photo numérique PowerShot de 10 Mpx de Canon avec trépied (SD1200IS) …
Run Code Online (Sandbox Code Playgroud)

python csv utf-8 character-encoding

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