问题列表 - 第32298页

为什么我的布局/ CSS被搞砸了?

我无法找到问题的原因:

css被"破坏"的页面:凌乱的布局

相同的页面,但在其中的另一个文本显示结果为例外:良好的布局

谢谢 ;)

css

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

什么是c#中的"??"运算符?

可能重复:
什么是"??"运算符?

什么是"??" 运算符在表达式中执行?

public NameValueCollection Metadata
{
    get { return metadata ?? (metadata = new NameValueCollection()); }
}
Run Code Online (Sandbox Code Playgroud)

c#

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

Bibtex在网页上?

是否有任何python包来解析Bibtex文件,并使用html/xhtml格式输出结果,并具有可自定义的样式?

最好,我想使用python,否则PHP中最常用的是什么?

python bibtex

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

在.aspx页面上将字节显示为图像

我正在使用数据库将客户端的图像存储为字节.如何在.aspx页面上呈现这些图像?

html asp.net image

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

Filling std vector

I can't understand why does vector empty after it's filling.

The code is:

bool fillArray (vector<int> &array)
{        
    string temp;
    getline(cin, temp);

    if (temp  == "-1")
       return false
    else
       return true;

    int res = atoi(temp.c_str());
    array.push_back(res);
}

void showArray(const vector<int> array)
{
    for (int i = 0; i < array.size(); i ++)
        cout << array[i] << " ";
}


int main(int argc, char** argv)
{
    vector<int> array;

    while (fullArray (array))
    {}

    showArray(array);
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

When I input -1 the …

c++ vector std fill

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

使用哪种Delphi技术?

我有一个用Delphi编写的Client/Server应用程序.基本上所有应用程序正在做的是在服务器应用程序和连接的客户端之间传输xml数据流.我目前正在使用Indy TIdTCPServer组件.但是服务器端应用程序在我的部分安装中不断崩溃.调试非常困难.所以我想知道是否有一些"架构",我应该利用它来完成所有tcp/ip连接管理和数据库连接池,让我专注于业务逻辑.

这里有更多细节:

  • 客户必须保持"持久"连接.有时服务器必须通知并向所有连接的客户端发送数据.
  • 客户使用无线空中卡通过笔记本电脑连接.因此网络"下降"非常普遍.
  • 后端数据库是SqlServer.
  • 一次可以同时连接100台计算机.当服务器获得新连接(TCPServer.OnConnect)时,我实例化我自己的包含它自己的SqlServer数据库连接的对象.当删除tcp连接时,我依次释放这些对象(以及相关的数据库连接).
  • 客户端应用程序内置了TTimer.他们经常将心跳发送到服务器.如果他们"丢弃"/"丢失"他们的连接,他们会在网络恢复后自动建立新连接.

有人对这里最好的方法/架构有任何建议吗?
我认为Indy组件可以工作,但同时感觉我在管理连接方面"重新发明轮子".

architecture delphi client-server

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

如何使用CMake最好地处理数据文件?

我有一个包含代码和一些数据文件的CMake项目(图像是精确的).

我的目录结构是这样的:

  • SRC
  • 数据

src包含源代码,数据包含数据文件.CMake建议在源代码构建之外,所以当我调用make时,我有可执行程序,但不是数据文件,因此我无法执行该程序.

当然,make install会将我的数据文件复制到所需的位置并使其正常工作,因此我现在就这样开发:

  1. cmake -DCMAKE_INSTALL_DIR = dist
  2. <edit source code>
  3. make install
  4. DIST/myprogram.exe

如果我正在使用命令行和编辑器,那没关系,但我最近决定转向Eclipse CDT.从CMake生成Eclipse项目效果很好,但是从Eclipse 手动执行安装目标并不是那么好.

你们是如何解决这个问题的呢?你的程序是否有一些聪明的算法来尝试找到它的数据目录,即使它不是二进制文件的位置?或者你不使用源代码构建?

eclipse-cdt cmake

19
推荐指数
2
解决办法
6245
查看次数

PHP - 使用file_get_contents发送cookie

PHP手册上的示例显示了如何使用流上下文发送cookie.以下是摘录:

// Create a stream
$opts = array(
  'http'=>array(
    'method'=>"GET",
    'header'=>"Accept-language: en\r\n" .
              "Cookie: foo=bar\r\n"
  )
);

$context = stream_context_create($opts);

// Open the file using the HTTP headers set above
$file = file_get_contents('http://www.example.com/', false, $context);
Run Code Online (Sandbox Code Playgroud)

你如何发送多个cookie?像#1或#2,或者什么?

#1

"Cookie: user=3345&pass=abcd\r\n"
Run Code Online (Sandbox Code Playgroud)

#2

"Cookie: user=3345\r\n" . 
"Cookie: pass=abcd\r\n"
Run Code Online (Sandbox Code Playgroud)

php

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

使用file_get_contents进行良好的错误处理

我正在使用simplehtmldom,它有这个功能:

// get html dom form file
function file_get_html() {
    $dom = new simple_html_dom;
    $args = func_get_args();
    $dom->load(call_user_func_array('file_get_contents', $args), true);
    return $dom;
}
Run Code Online (Sandbox Code Playgroud)

我这样使用它:

$html3 = file_get_html(urlencode(trim("$link")));
Run Code Online (Sandbox Code Playgroud)

有时,URL可能无效,我想处理这个问题.我以为我可以使用try和catch但是这没有用,因为它没有抛出异常,它只是给出一个像这样的php警告:

[06-Aug-2010 19:59:42] PHP Warning:  file_get_contents(http://new.mysite.com/ghs 1/) [<a href='function.file-get-contents'>function.file-get-contents</a>]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found  in /home/example/public_html/other/simple_html_dom.php on line 39
Run Code Online (Sandbox Code Playgroud)

第39行在上面的代码中.

我怎样才能正确处理这个错误,我可以只使用普通if条件,它看起来不像是返回一个布尔值.

谢谢大家的帮助

更新

这是一个好的解决方案吗?

if(fopen(urlencode(trim("$next_url")), 'r')){

    $html3 = file_get_html(urlencode(trim("$next_url")));

}else{
    //do other stuff, error_logging
    return false;

}
Run Code Online (Sandbox Code Playgroud)

php error-handling

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

突出显示所选单词的所有出现?

如何在GVim中突出显示所有选定单词,如Notepad ++?

vim macvim

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

标签 统计

php ×2

architecture ×1

asp.net ×1

bibtex ×1

c# ×1

c++ ×1

client-server ×1

cmake ×1

css ×1

delphi ×1

eclipse-cdt ×1

error-handling ×1

fill ×1

html ×1

image ×1

macvim ×1

python ×1

std ×1

vector ×1

vim ×1