小编mer*_*esi的帖子

'strcasecmp'未在此范围内声明

我正在尝试构建一个名为lipiTk的源代码

我有很多这样的错误:

Documents/lipi/lipi/src/reco/shaperec/activedtw/ActiveDTWShapeRecognizer.cpp:1222:78: 
 error: ‘strcasecmp’ was not declared in this scope
Run Code Online (Sandbox Code Playgroud)

我该怎么办,代码中有太多的cpp文件会产生类似的错误.我不认为我可以测试写入包含string.h到每个提供错误的cpp文件,可能问题是关于我的编译器?

我在Ubuntu,GCC是4.5.

我在手册中看到,我的sw配置高于lipitk需求.

c++

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

如何在正则表达式中提供 OR 运算符?

我想将我的字符串与一个或另一个序列匹配,并且它必须至少匹配其中一个。

and我所知,它可以通过以下方式完成:

(?=one)(?=other)
Run Code Online (Sandbox Code Playgroud)

OR 有这样的东西吗?

我正在使用 Java、Matcher 和 Pattern 类。

java regex

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

不能在tesseract中使用ChoiceIterator

首先,我想确认我理解选择迭代器的权利.

例如,如果我在图像"范围"上有一个单词,

选择迭代器必须给我类似"s"的东西,也许在Next(),"5"之后.

对于3.字母"o"它可能给我"0",在Next()"O"之后和Next()"o"之后.

我理解对吗?

这是我所有相关的代码,

api.SetImage((uchar*)img->imageData,img->width,img->height,img->depth/8,img->widthStep);

api.SetRectangle(0,0,img->width, img->height);
int left,top,right,bottom;
left=0;top=0;right=0;bottom=0;
api.Recognize(NULL);
tesseract::ResultIterator *ri=api.GetIterator();
tesseract::ChoiceIterator *choiceItr;
const tesseract::ResultIterator itr = *ri;
choiceItr = new tesseract::ChoiceIterator(itr);
const char * out=choiceItr->GetUTF8Text();
char * out2=(*ri).GetUTF8Text(tesseract::RIL_SYMBOL);
printf("out:%s,out2:%s",out,out2);
Run Code Online (Sandbox Code Playgroud)

控制台上的输出是:

出:(空),OUT2:P

p是预期的结果迭代器结果,但是选择迭代器输出为null.

谢谢你的想法.

大致解决了:

// This ensures Tesseract's "blob_choices" structures are filled
    SetVariable("save_best_choices", "T");
Run Code Online (Sandbox Code Playgroud)

http://code.google.com/p/tesseract-ocr/issues/detail?id=555

ocr tesseract

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

实现SelectableDataModel

XHTML方面:

<p:dataTable id="selectProductTable" var="product"  value="#{manageFormsView.productModel}" selection="#{manageFormsView.product}" >
Run Code Online (Sandbox Code Playgroud)

豆边:

  private SelectableDataModel<Product>  productModel=new SelectableDataModel<Product>() {


                @Override  
                public Product getRowData(String rowKey) {  
                    //In a real app, a more efficient way like a query by rowKey should be implemented to deal with huge data  


                    for(Product product : productList) {  
                        if(product.getModel().equals(rowKey))  
                            return product;  
                    }  

                    return null;  
                }  

                @Override  
                public Object getRowKey(Product p) {  
                    return p.getModel();  
                }  
        };
Run Code Online (Sandbox Code Playgroud)

我不想生成一个实现SDM的新类,我不能像上面那样进行内联实现吗?

我得到例外:

javax.faces.FacesException: DataModel must implement org.primefaces.model.SelectableDataModel when selection is enabled.
Run Code Online (Sandbox Code Playgroud)

jsf primefaces

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

通过TELNET发布一些JSON

我被告知通过发送JSON作为请求将图像上传到服务器.

JSON就像下面这样:

{"action":"setMap","data":{"mapName":"myMapName","mapURL":"http://tinypic.com/myimg"}}
Run Code Online (Sandbox Code Playgroud)

我不知道如何使用TELNET来发布JSON.

我想我应该写下面的东西

terminal>telnet my.ip.num.ber port

POST /setMap HTTP/1.1
Run Code Online (Sandbox Code Playgroud)

但不知道如何继续.

我应该写

DATA : {"action":"setMap","data":{"mapName":"myMapName","mapURL":"http://tinypic.com/myimg"}}
Run Code Online (Sandbox Code Playgroud)

我怎样才能收到JSON?

upload json telnet httprequest

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

加入Hibernate查询

我有课:

class User{
String id;
ArrayList<UserAttribute> attributeList=new ArrayList<UserAttribute>();
}

class UserAttribute{
User user;
String value;
String key;
}
Run Code Online (Sandbox Code Playgroud)

我有与表相关的表.

用户

column id
Run Code Online (Sandbox Code Playgroud)

table user_attribute

column user_id
column key
column value
Run Code Online (Sandbox Code Playgroud)

示例用户表内容

user_id="123"

user_id="234"
Run Code Online (Sandbox Code Playgroud)

示例user_attribute表内容

user_id="123", key="address", value="green house street"

user_id=234, key="address", value="blue house street"

user_id="123", key="phone", value="234324"

user_id="234", key="phone", value="786988"
Run Code Online (Sandbox Code Playgroud)

我想让有"绿屋街"地址的用户(不是或)有电话"234324"

我在sql编辑器中编写sql(oracle):

 select u.* from user u left join user_attribute prop on u.id=prop.user_id inner join user_attribute prop2 on prop.user_id = prop2.user_id where prop.value = 'green house street' …
Run Code Online (Sandbox Code Playgroud)

sql hibernate

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

Hibernate可以在没有Spring的情况下生成表吗?

我的项目有Hibernate,

但还没有春天.

我怀疑是否:

问题1:

persistence.xml中的Hibernate注释和方言属性足以让Hibernate生成表吗?

问题2:我猜也是,必须有类似Spring的东西来寻找注释并解雇生成事件并开始其他一些事情吗?

编辑:

我的persistence.xml文件

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
    <persistence-unit name="Kutuphane2" transaction-type="RESOURCE_LOCAL">
        <non-jta-data-source>kutuphaneDS</non-jta-data-source>
        <properties>
            <property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost:3306/kutuphane"/>
            <property name="javax.persistence.jdbc.user" value="root"/>
            <property name="javax.persistence.jdbc.password" value="root"/>
            <property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver"/>
            <property name="hibernate.show_sql" value="true"/>
            <property name="hibernate.format_sql" value="true"/>
            <property name="hibernate.hbm2ddl.auto" value="create"/>
            <property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect"/>
        </properties>
    </persistence-unit>
</persistence>
Run Code Online (Sandbox Code Playgroud)

java spring hibernate jpa

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

由于堆/堆栈损坏导致的分段错误

#include <stdio.h>
      #include <dirent.h> 
      #include <sys/types.h> 
      #include <sys/param.h> 
      #include <sys/stat.h> 
      #include <unistd.h> 
      #include <string.h>
      #include <string>
      #include <stdlib.h>
      #include <limits.h>
      #include <list>
      #include <math.h>
      #include <vector>
      #include <iostream>

      using namespace std;

      enum ElementType { NONE,SIMPLEFILE, DIRECTORY, SYMBOLICLINK };



      class Element{
      public:
          Element():exists(false){
        name=std::string("");
        full_path_name=std::string("");;
        element_type=NONE;
        element_size=0;
        exists=false;

          };

          std::string name;
          std::string full_path_name;
          ElementType element_type;
          long element_size;
          bool exists;

      };



      int inspect( std::list<Element>& result_element_array, long *dir_size,std::string full_path ) {

        std::list<Element> result_element_array_temp;
        result_element_array.clear();
        DIR *d;
        struct dirent *dir;
        struct stat buf;
        std::string …
Run Code Online (Sandbox Code Playgroud)

c++ segmentation-fault

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

从bash到perl脚本的STDIN

我有一个perl脚本(myscript.pl)

use strict;
use IO::Handle;

open OUTPUT, '>', "output.txt" or die $!;

STDOUT->fdopen( \*OUTPUT, 'w' ) or die $!;

while (<STDIN>){
print $_;
}
Run Code Online (Sandbox Code Playgroud)

我可以粘贴到output.txt我在命令行上写的东西

我有一个bash脚本:

cat >in.$$ 

cat in.$$> /tmp/msg 
Run Code Online (Sandbox Code Playgroud)

我可以将我所拥有的东西粘贴到/ tmp/msg中

我需要使用来自bash脚本的stdin运行perl脚本.

是可能的,怎么样?

我试过,尽管我知道它太傻了

cat in.$$> ./myscript.pl
in.$$> ./myscript.pl
in.$$> perl myscript.pl
Run Code Online (Sandbox Code Playgroud)

bash perl

0
推荐指数
2
解决办法
1321
查看次数

需要"一个"对象,如何使用"新"

我写;

Element element=new Element;
Run Code Online (Sandbox Code Playgroud)

我收到了错误;

homework.cpp: In function 'int main(int, char**)':
homework.cpp:227:29: error: conversion from 'Element*' to non-scalar type 'Element' requested

*** 1 errors, 0 warnings
Run Code Online (Sandbox Code Playgroud)

我不想要指针或元素数组,

我应该写一下Element *element= new Element;.有人解释一下吗?

编辑:

元素类:

class Element{
  public:
      Element():exists(false){};

      std::string name;
      std::string full_path_name;
      ElementType element_type;
      long element_size;
      bool exists;

  };
Run Code Online (Sandbox Code Playgroud)

c++ new-operator

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

贡献于开源C++库

我应该如何得到它,由SVN?我可以使用Eclipse及其Subversive Team Provider来管理我的更改吗?然后,如果我做了一些改变,我怎么能承诺,谁决定我的变化是友好和足够的?老实说,我想尝试为某些图书馆做出贡献,因为有助于我学习C++细节的动力.

我搜索并阅读了一些关于Boost的内容,但我认为它太复杂而不能成为一个起点.

那么你能提供一个开始并成为开源库贡献者的途径吗?

c++ boost

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