问题列表 - 第38724页

C++如何删除结构?

我创建的结构:

   struct VideoSample
  { 
      const unsigned char * buffer;
      int len;
  };

   VideoSample * newVideoSample = new VideoSample;
   newVideoSample->buffer = buf;
   newVideoSample->len = size;

       //...
Run Code Online (Sandbox Code Playgroud)

现在怎么删除呢?

c++ structure

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

与Linq的数学统计

我有一组人物对象(IEnumerable),每个人都有一个年龄属性.

我想在这个年龄属性上生成集合的统计数据,例如Max,Min,Average,Median等.

使用LINQ最优雅的方法是什么?

c# linq

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

goto的"语法错误,意外的T_STRING"问题

http://www.faressoft.org/test/hello.php

我的代码:

<?php
echo "hello World";
goto end; // this is line 3
echo "before end";
end:
echo "end";
?>
Run Code Online (Sandbox Code Playgroud)

错误:解析错误:语法错误,第3行/home/alfalah1/public_html/faressoft.org/test/hello.php中的意外T_STRING

它在我的localhost中工作得很好,但在justhost服务器上不起作用?为什么?

php string syntax goto

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

IIS 7的URLRewriter返回404服务器错误

我已经实现了" 方法3:使用HttpModuleIIS7执行无扩展URL重写 ": - http://weblogs.asp.net/scottgu/archive/2007/02/26/tip-trick-url -rewriting-与-ASP-net.aspx

这是基于URLRewriter模块: - http://urlrewriter.net/

它似乎适用于我的本地环境,但在生产服务器(运行IIS 7)上它显示" 404 - 文件或目录未找到 "页面.

我在Google上搜索过,似乎无法找到解决方案.

最后,我们回到IIS 6并按照此处的说明进行操作: - http://urlrewriter.net/index.php/support/installation/windows-server-2003

但是有一天我们可能不得不在共享托管环境中升级到IIS 7,同样的问题将再次出现!

asp.net iis-7 url-rewriting http-status-code-404

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

应该是validate_format_of.not_with在框架中有问题(或在我的理解中)

我将以下代码放入RSpec测试中:

it { should validate_format_of(:email).not_with('test@test')}
Run Code Online (Sandbox Code Playgroud)

并设置实际的类:

validates :email, :presence => true, :format => /\b[A-Z0-9._%-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,4}\b/i
Run Code Online (Sandbox Code Playgroud)

当我运行测试时,我得到:

失败:1)用户失败/错误:它{should validate_format_of(:email).not_with('test @ test')}当电子邮件设置为"test @ test"时,预期错误包括"不能为空"错误:["名称不能为空(nil)","电子邮件无效(\"test @ test \")"]#./ spec/model/user_spec.rb:8:in`block(2级)在''

当我做一个通过测试时:

it { should validate_format_of(:email).with('adam@trimediatlantic.com')}
Run Code Online (Sandbox Code Playgroud)

一切都按预期工作.有人可以告诉我,如果我做错了或者这是一个框架问题.谢谢.

ruby rspec shoulda ruby-on-rails-3

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

在 XML 文件中保存转义字符 0x1b

我们有一个使用打印机内部字体与打印机通信的应用程序。这需要使用字体描述属性以二进制格式发送一些数据。

要发送的字符之一是转义字符 (0x1b)。系统状态和所有更改的选项稍后保存在一个 XML 文件中,但是当我们尝试写入值时,我们得到以下异常:

System.InvalidOperationException: There is an error in XML document (1009, 26). ---> System.Xml.XmlException: '[Some small backwards arrow symbol]', hexadecimal value 0x1B, is an invalid character.
Run Code Online (Sandbox Code Playgroud)

我不确定为什么这个箭头可以用作转义,但它可以在打印机上使用。当我们尝试将其保存在 XML 文件中时会发生错误。有什么建议?

.net xml escaping

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

VB.NET相当于C#的using指令

我正在将一些代码从C#转换为VB.NET,我需要知道C#的using指令的等价物.

更新:对不起,但到目前为止我还没有得到答案.这是一个C#示例:

using moOutlook = Microsoft.Office.Interop.Outlook;
using moExcel = Microsoft.Office.Interop.Excel;

namespace ReportGen
{
    class Reports
Run Code Online (Sandbox Code Playgroud)

c# vb.net c#-to-vb.net

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

apache mod-rewrite:我可以对POST和GET请求有不同的规则吗?

我有一个重写规则,如下所示:

RewriteRule ^foo/bar/([\w]+)/files/([\S\s]+)$ /mydirectory/$1/$2
Run Code Online (Sandbox Code Playgroud)

我想让GET请求转到/ mydirectory/$ 1/$ 2,POST请求会有所不同.这是否可以使用mod-rewrite?

apache mod-rewrite

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

动态选择对象

情况如下:

我有3个对象都命名为**List,我有一个带String参数的方法;

    gameList = new StringBuffer();
  appsList = new StringBuffer();
  movieList = new StringBuffer();


  public void fetchData(String category) {
  URL url = null;
  BufferedReader input;
  gameList.delete(0, gameList.length());
Run Code Online (Sandbox Code Playgroud)

有没有办法做以下事情:

    public void fetchData(String category) {
  URL url = null;
  BufferedReader input;
  "category"List.delete(0, gameList.length());
Run Code Online (Sandbox Code Playgroud)

,所以我可以根据String参数选择要使用哪个列表?

java oop

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

Spring Injection - 访问构造函数中的注入对象

我有一个资源(Spring bean),它的一些字段由Spring注入,例如:

@Repository(value="appDao")
public class AppDaoImpl implements AppDao {
   @PersistenceContext
   EntityManager entityManager;

   public Resource() {
      ... use entityManager ... // doesn't work
   }
}
Run Code Online (Sandbox Code Playgroud)

我知道我不能在构造函数中访问注入的entityManager,并且应该@PostConstruct在不同的方法上使用注释.但是这有什么原因呢?

java spring dependency-injection

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