问题列表 - 第48972页

vim找不到并替换明显存在的简单短语

我有一个简单的vim问题,谷歌没有设法帮助我.任何想法都表示赞赏.

我执行以下搜索并替换:

:s/numnodes/numnodes1/g
Run Code Online (Sandbox Code Playgroud)

在包含以下文本的文件中:

numprocs=0  
numnodes=0
Run Code Online (Sandbox Code Playgroud)

我明白了

E486: Pattern not found
Run Code Online (Sandbox Code Playgroud)

绿色方块的位置表明我开始打字的位置明显高于模式.我试图寻找其他不涉及正则表达式的短语,这些短语也存在,但也失败了.简单/ numnodes按预期突出显示匹配项.有谁知道vim可能有什么问题?

vim replace scope-resolution

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

PHP - 用URL中的https替换http

一旦用户检查html表单中的框,我试图找出如何在HTTP之后添加s.

我有我的PHP,

$url = 'http://google.com';

if(!isset($_POST['https'])) { 
  //something here
}
Run Code Online (Sandbox Code Playgroud)

所以基本上,当用户选中名称为"https"的复选框时,我想将s添加到$ url的http,使其成为https://google.com.

我对PHP知之甚少,如果有人能向我解释如何去做,这将非常有用!谢谢.

html php checkbox

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

什么是ContentProviderOperation用于

我看到这个项目http://code.google.com/p/iosched/ 在像LocalRoomsHandler.java这样的内容中有"ContentProviderOperation",但是我无法理解它用于什么只用于联系人?谁能给我一个答案

android

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

如何在JavaScript函数中使用回调函数

我是JavaScript的新手,需要在我的java脚本函数中使用回调函数.我不知道如何使用回调函数.以下是我的代码:

function SelectedFeature() { 
 // Here is my code  call_Method1(); 
 call_Method2(); 
 } 
Run Code Online (Sandbox Code Playgroud)

上述函数中的问题是,call_method2()call_Method1()结束执行之前开始执行.为了解决这个问题,有人告诉我使用回调函数.现在我如何在我的SelectedFeature()函数中使用回调函数?请使用代码示例解释.

我正在进行异步请求call_method1().我需要call_Method2()在完成执行后调用call_method1().但就我而言,call_method2()之前的调用call_method1()完成了它的执行.现在我该如何解决这个问题?

javascript callback

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

使用套接字连接获取网站的状态代码


我正在使用套接字连接到网站,我想获取该网站的状态代码.

Socket socket_1 = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
IAsyncResult result = socket_1.BeginConnect(iis1, 80, null, null);

如何判断网站是启动还是404?
谢谢

c#

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

在ubuntu 10.10中编译和运行OpenGL(过剩)程序

我写了这段代码:

#include <stdio.h>
#include <stdlib.h>
#include <GL/glx.h>    
#include <GL/gl.h>
#include <GL/glut.h>


void init()
{
    glClearColor(1.0,1.0,1.0,0.0);
    glMatrixMode(GL_PROJECTION);
    gluOrtho2D(0.0,200.0,0.0,150.0);
 }

 void lineSegment()
 {
    glClear(GL_COLOR_BUFFER_BIT);
    glColor3f(0.0,0.0,1.0);
        glBegin(GL_TRIANGLES);
            glVertex2i(40,120);
            glVertex2i(40,20);
            glVertex2i(80,20);
        glEnd();
    glFlush();
 }
 int main()
 {
    glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB);
    glutInitWindowPosition(50,100);
    glutInitWindowSize(400,300);
    glutCreateWindow("An Example OpenGL....");
    init();
    glutDisplayFunc(lineSegment);
    glutMainLoop();
    return 0;
 }
Run Code Online (Sandbox Code Playgroud)

这是我的错误.

funfullson@funfullson:~$ gcc gl.cpp 
/tmp/cchfRGT2.o: In function `init()':
gl.cpp:(.text+0x2a): undefined reference to `glClearColor'
gl.cpp:(.text+0x36): undefined reference to `glMatrixMode'
gl.cpp:(.text+0x5a): undefined reference to `gluOrtho2D'
/tmp/cchfRGT2.o: In function `lineSegment()':
gl.cpp:(.text+0x6e): undefined reference to `glClear'
gl.cpp:(.text+0x8d): undefined reference …
Run Code Online (Sandbox Code Playgroud)

opengl

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

在VS2010中单击发布后,将DLL文件复制到bin目录

我在VS2010中有一个Web应用程序,它在VS2010中发布后需要将许多DLL复制到bin目录中.

我已经尝试将以下内容放入我的.csproj文件(位于Web应用程序的根文件夹中)但它似乎不起作用:

<Target Name="AfterBuild">
  <ItemGroup>
    <_CircularDependencies Include="DLLs\Circular\Dependencies\*.dll" />
  </ItemGroup>
  <Copy
    SourceFiles="@(_CircularDependencies)" 
    DestinationFiles="@(_CircularDependencies->'bin\%(Filename)%(Extension)')" 
    SkipUnchangedFiles="true" />
</Target>
Run Code Online (Sandbox Code Playgroud)

对于奖励积分,我有另一组DLL复制后发布复制,但我想在进行调试发布(对于Win32)时使用一组,在进行发布发布时使用不同的集(x86).

谢谢!

msbuild publish visual-studio-2010

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

使用块时的iPhone EXC_BAD_ACCESS

我试图使用块创建一个简单的回调.我有一个MainViewController addSubView另一个DatePickerViewController.view我创建了一个像这样的块

typedef void(^DateChangedBlock)(NSDate*);
Run Code Online (Sandbox Code Playgroud)

我在我的DatePickerViewController上调用了一个方法

setOnDateChangedCallback:(DateChangedBlock)callback
Run Code Online (Sandbox Code Playgroud)

我将回调存储在DatePickerViewController的属性中.DatePickerViewController的视图是一个UIDatePicker实例,我已将IBAction绑定到更改为执行此操作的方法的值.

- (IBAction)dateChanged:(id)sender {

    if (dateChangedCallback != nil)
    {
        dateChangedCallback(nil);
    }
}
Run Code Online (Sandbox Code Playgroud)

以下是我在MainViewController中注册块的方法

DatePickerViewController *dateController = [[DatePickerViewController alloc] initWithNibName:@"DatePickerView" bundle:nil];

self.datePicker = dateController;
UITextView *textView = [[UITextView alloc] initWithFrame:CGRectMake(0, 0, 100, 200)];
[self.view addSubview:textView];
DateChangedBlock myBlock = ^(NSDate *newDate) {
 textView.text = @"testing";
};

[self.datePicker setOnDateChanged: myBlock];
[self.datePicker dateChanged:self]; // force trigger (this works).
Run Code Online (Sandbox Code Playgroud)

当我强制触发DatePickerViewController上的dateChanged方法时,它没有问题.但是当datepicker本身通过IBAction触发方法时,我得到一个EXC_BAD_ACCESS错误.此方法在"int retVal"行上发生错误.

#import <UIKit/UIKit.h>

int main(int argc, char *argv[])
{
    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
    int retVal = UIApplicationMain(argc, …
Run Code Online (Sandbox Code Playgroud)

iphone cocoa-touch objective-c

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

用pqxx编译程序问题

我正在尝试使用pqxx编译一个非常简单的程序(不做任何操作的样本),但不能这样做.这是'程序':

$ cat xx.cpp

#include <pqxx/pqxx>
using namespace pqxx;


int main() 
{
    connection conn("dbname=dout1");
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

我以前尝试用C++编译的命令:

g++ -I /usr/local/include/ -L /usr/local/lib/ -l pqxx -I /opt/postgres_home/include/ -L /opt/postgres_home/lib/ -lpq xx.cpp
Run Code Online (Sandbox Code Playgroud)

消息返回:

/tmp/cc18wMEy.o: In function `pqxx::connect_direct::connect_direct(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
xx.cpp:(.text._ZN4pqxx14connect_directC1ERKSs[pqxx::connect_direct::connect_direct(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)]+0x1f): undefined reference to `pqxx::connectionpolicy::connectionpolicy(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
xx.cpp:(.text._ZN4pqxx14connect_directC1ERKSs[pqxx::connect_direct::connect_direct(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)]+0x2a): undefined reference to `vtable for pqxx::connect_direct'
/tmp/cc18wMEy.o: In function `pqxx::connect_direct::~connect_direct()':
xx.cpp:(.text._ZN4pqxx14connect_directD1Ev[pqxx::connect_direct::~connect_direct()]+0x13): undefined reference to `vtable for pqxx::connect_direct'
xx.cpp:(.text._ZN4pqxx14connect_directD1Ev[pqxx::connect_direct::~connect_direct()]+0x1f): undefined reference to `pqxx::connectionpolicy::~connectionpolicy()' …
Run Code Online (Sandbox Code Playgroud)

c++ postgresql g++ libpqxx

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

WPF MessageBox窗口样式

如何将默认Windows样式应用于MessageBoxWPF中的标准?

例如,当我执行下一个代码时:

MessageBox.Show("Hello Stack Overflow!", "Test", MessageBoxButton.OKCancel, 
    MessageBoxImage.Exclamation);
Run Code Online (Sandbox Code Playgroud)

我收到消息框:

在此输入图像描述

但是在WinForms中,风格一切都很好:

MessageBox.Show("Hello Stack Overflow!", "Test", MessageBoxButtons.OKCancel, 
    MessageBoxIcon.Exclamation);
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

c# wpf messagebox

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