小编mea*_*gar的帖子

可能会通过git丢失一些更改

前几天我试图将一些更改推送到远程服务器.

我一直收到错误,所以我想看看我在哪个分店.

我看到我在本地不是一个未定义的分支,这真的很怪异所以我检查了主人然后能够推动.

刚检查出合并,我的更改都没有.他们不在当地.超过10个小时的工作,我无法在任何地方找到它.

我做了一个gitk,我没有看到任何改变.我看到大师的合并看起来像这样:

Author: Sara Chipps <sarajchipps@Sara-Chippss-MacBook-Pro.local>  2012-01-04 13:48:20
Committer: Sara Chipps <sarajchipps@Sara-Chippss-MacBook-Pro.local>  2012-01-04 13:48:20
Parent: 1a294db3a244d7aeaafbc99c986af86ce7cf17da (Merge branch 'master' of https://github.com/thing/thing)
Parent: 8ed995c7a5a370333ab27485be07f6a5f647e8d4 (added subscription button to edit profile section)
Child:  0dbf7e53737c0e7ee7ab908812299c1d60ef0c46 (removed coffee icon on getting started)
Branches: master, remotes/origin/master
Follows: 
Precedes: 

    Merge branch 'master' of https://github.com/thing/thing
Run Code Online (Sandbox Code Playgroud)

我不是唯一一个承诺这个项目的人,我不知道我是如何在本地获得一个未定义的分支.有人可以建议修复吗?担心会失去很多工作.

谢谢.

git

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

LL(*)与PEG解析器:有什么区别?

我想知道将内部解析算法呈现为"LL(*)"的ANTLR v3是否完全代表PEG(解析表达式语法)解析器.

有区别吗?

parsing antlr

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

为什么要写一个std :: string给cout导致一个未知的运算符<<错误?

我尝试从我的一个方法输出返回值时收到错误:

Error: No operator "<<" matches these operands. Operand types are: std::ostream << std::string
Run Code Online (Sandbox Code Playgroud)

Main.cpp的

#include <iostream>
using namespace std;

#include "Book.h"

int main()
{
    book.setTitle("Advanced C++ Programming");
    book.setAuthorName("Linda", "Smith");
    book.setPublisher("Microsoft Press", "One Microsoft Way", "Redmond");
    book.setPrice(49.99);

    cout << book.getBookInfo(); // <-= this won't compile because of the error above.

    int i;
    cin >> i;

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

应该返回字符串的方法:

string Book::getBookInfo()
{
    stringstream ss;
    ss << title << endl << convertDoubleToString(price) << endl;

    return ss.str();
}
Run Code Online (Sandbox Code Playgroud)

c++ cout

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

为什么我的Scrapy CrawlSpider规则不起作用?

我已经设法使用Scrapy编写一个非常简单的爬虫程序,具有以下约束条件:

  • 存储所有链接信息(例如:锚文本,页面标题),因此存在2个回调
  • 使用CrawlSpider来利用规则,因此没有BaseSpider

它运行良好,除非我在第一个请求中添加回调时没有实现规则!

这是我的代码:(工作但不正确,有一个实例)

from scrapy.contrib.spiders import CrawlSpider,Rule
from scrapy.selector import HtmlXPathSelector
from scrapy.http import Request
from scrapySpider.items import SPage
from scrapy.contrib.linkextractors.sgml import SgmlLinkExtractor

class TestSpider4(CrawlSpider):
    name = "spiderSO"
    allowed_domains = ["cumulodata.com"]
    start_urls = ["http://www.cumulodata.com"]
    extractor = SgmlLinkExtractor()

    def parse_start_url(self, response):
        #3
        print('----------manual call of',response)
        self.parse_links(response)
        print('----------manual call done')
        # 1 return Request(self.start_urls[0]) # does not call parse_links(example.com)
        # 2 return Request(self.start_urls[0],callback = self.parse_links) # does not call parse_links(example.com)

    rules = (
        Rule(extractor,callback='parse_links',follow=True),
        )

    def parse_links(self, response):
        hxs = …
Run Code Online (Sandbox Code Playgroud)

python scrapy

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

Maven编译给出:找不到符号 - 对于坐在同一个应用程序中的类

我遇到这样令人费解的问题已经有一段时间了.我有一个类引用另一个坐在同一个应用程序中的另一个包中的类,也就是说,不在另一个jar存档文件中.

包含类是learnintouch-rest/src/test/java/com/thalasoft/learnintouch/rest/acceptance/AbstractControllerTest.java

包含的类是/home/stephane/dev/java/projects/learnintouch-rest/src/test/java/com/thalasoft/learnintouch/rest/config/WebTestConfiguration.java

在Eclipse下,编辑器中没有问题,也没有编译错误.

但是运行Maven构建会产生编译错误:

mvn clean test-compile -Pacceptance

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:testCompile (default-testCompile) on project learnintouch-rest: Compilation failure: Compilation failure:
[ERROR] /home/stephane/dev/java/projects/learnintouch-rest/src/test/java/com/thalasoft/learnintouch/rest/acceptance/AbstractControllerTest.java:[16,46] cannot find symbol
[ERROR] symbol:   class WebTestConfiguration
[ERROR] location: package com.thalasoft.learnintouch.rest.config
[ERROR] /home/stephane/dev/java/projects/learnintouch-rest/src/test/java/com/thalasoft/learnintouch/rest/acceptance/AbstractControllerTest.java:[21,116] cannot find symbol
[ERROR] symbol: class WebTestConfiguration
Run Code Online (Sandbox Code Playgroud)

这是包含类的代码:

@RunWith(SpringJUnit4ClassRunner.class)
@Transactional
@WebAppConfiguration
@ContextConfiguration(classes = {
    ApplicationConfiguration.class,
    WebSecurityConfig.class,
    WebConfiguration.class,
    WebTestConfiguration.class
})
public abstract class AbstractControllerTest {
Run Code Online (Sandbox Code Playgroud)

此抽象测试类位于验收测试目录下,该目录要求在运行Maven命令时显式激活-Pacceptance配置文件.

默认配置文件不运行此验收测试,而只执行某些集成测试.

需要注意的一点是,这个抽象类看起来像集成测试中使用的一个抽象类.

这是集成测试的包含类:

import com.thalasoft.learnintouch.rest.config.WebTestConfiguration;

@RunWith(SpringJUnit4ClassRunner.class)
@WebAppConfiguration
@ContextConfiguration(classes = {ApplicationConfiguration.class},
        WebSecurityConfig.class,
        WebConfiguration.class,
        WebTestConfiguration.class
        })
@Transactional

public abstract …
Run Code Online (Sandbox Code Playgroud)

java eclipse spring maven

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

printf中"%.6d"是什么意思

这是什么%.6d意思的:

printf("%s.%.6d len:%d ", timestr, header->ts.tv_usec, header->len);
Run Code Online (Sandbox Code Playgroud)

这是一个错字吗?

它似乎%.6d是一样的%6d.

c formatting printf

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

Rails 3不需要的html转义

我正在转换我的胖Rails2应用程序以在Rails3上运行.经过长时间激烈的争斗与我的老板大吼大叫,页面全部呈现为转义的html字符串.所以所有的div,图像等都是为用户字面写的.

由于某种原因,这个部分调用呈现一个转义字符串

<%= render :partial => 'something_really_interesting' %>
Run Code Online (Sandbox Code Playgroud)

正如所有Ruby on Rails应用程序一样,这条指令并没有被调用太多!那么我如何处理所有这些不通常不作为转义字符串渲染的调用?

ruby render partial ruby-on-rails-3

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

如何创建网站API

我让很多客户问我关于制作连接到他们网站的移动应用程序来检索数据,允许用户登录等等.他们中的大多数都有基于PHP的网站,但是没有任何关于使API与之交互的线索他们.他们问我为什么不能直接连接到他们的SQL数据库.我不认为从移动应用程序做这件事是件好事.我希望他们有一些API.

对于基于PHP的站点,在为此目的实现API时,最佳选择是什么?

php iphone api android ios

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

这个指针构建是否会破坏严格的别名规则?

这是Quake III Arena的快速反平方根实现:

float Q_rsqrt( float number )
{
        long i;
        float x2, y;
        const float threehalfs = 1.5F;

        x2 = number * 0.5F;
        y  = number;
        i  = * ( long * ) &y;                       // evil floating point bit level hacking
        i  = 0x5f3759df - ( i >> 1 );               // what?
        y  = * ( float * ) &i;
        y  = y * ( threehalfs - ( x2 * y * y ) );   // 1st iteration
// …
Run Code Online (Sandbox Code Playgroud)

c pointers casting c99 strict-aliasing

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

Ruby 2.0中适当的哈希语法是什么?

我应该用吗?

{ :first_name => "Mathieu", :last_name => "Jackson" }
Run Code Online (Sandbox Code Playgroud)

要么

{ first_name: "Mathieu", last_name: "Jackson" } 
Run Code Online (Sandbox Code Playgroud)

ruby

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