我希望使用Tesseract将大量图像文件转换为文本.
我查看了他们的文档,但不知道这与PHP有什么关系以及我的php脚本将如何与tesseract ocr交互.我已经看到其他问题表明php exec()可能就是这样.
$img = myimage.png;
$text = exec($img,'tesseract');
Run Code Online (Sandbox Code Playgroud)
我已经下载并安装了tesseract.使用安装了最新版xampp的Windows 7.我有初学者对PHP的中级知识.我错过了什么知识?
更新我现在让它在powershell和cmd中使用
tesseract.exe D:\Documents\Web_Development\Sandbox\php\images\23.png D:\Documents\Web_Development\Sandbox\php\images\23
Run Code Online (Sandbox Code Playgroud)
但是当我尝试通过这样的exec运行它时:
<?php
exec('tesseract.exe D:\Documents\Web_Development\Sandbox\images\23.png D:\Documents\Web_Development\Sandbox\images\23');
?>
Run Code Online (Sandbox Code Playgroud)
我从Windows中弹出一个说明tesseract.exe已停止工作的弹出窗口.以下是错误详细信息,如果它们对任何人都有意义.
Problem signature:
Problem Event Name: BEX
Application Name: tesseract.exe
Application Version: 0.0.0.0
Application Timestamp: 4ca507b3
Fault Module Name: MSVCR90.dll
Fault Module Version: 9.0.30729.4926
Fault Module Timestamp: 4a1743c1
Exception Offset: 0002f93e
Exception Code: c0000417
Exception Data: 00000000
OS Version: 6.1.7600.2.0.0.768.3
Locale ID: 1033
Additional Information 1: e958
Additional Information 2: e95831f9d00a16a326250da660e931c5
Additional Information 3: 040a
Additional Information …
Run Code Online (Sandbox Code Playgroud) 我正在构建一个用于录制语音消息的Web应用程序,并且正在寻找将语音消息转换为文本的最佳选项.有没有人对使用什么进行转换有一些建议?System.Speech会工作吗?
我nside一个html.erb,我想使用记录器
<script type="text/javascript">
$j(function(){
$j('#AddQuestion').click(function(){
//Send and http transaction to the server to get the address
$j('#dialog').dialog(
{buttons:{OK:function (event) {
say('You clicked the ' + $(event.target).text() + ' button' );
}, No:function (event) {
say('You clicked the ' + $(event.target).text() + ' button' );
}
}
});
$j('#dialog').dialog('open');
});
});
</script>
Run Code Online (Sandbox Code Playgroud) 我的module.views.inc和.module文件位于同一个文件夹中
我想使用hook_views_api()来调用.views.inc文件以下代码不起作用
function module_name_views_api(){
return array(
'api' => 2,
'path' => array('module','module_name'),
);
}
有任何想法吗?
我不能决定这是不是一个愚蠢的问题,但我会承担风险.:)
我是一个相当简单的SQL用户 - 我理解CREATE/DROP表和SELECT,INSERT,DELETE的基本形式,但不是更多.我想知道的是,如果有一种方法可以使用SQL来请求表的模式吗?
我有一个使用SQLite的PC应用程序,我正在为它编写一个移动客户端.我不需要PC DB中的所有表,也不需要表中的所有列.在SQLite Spy中,我可以右键单击一个表并选择"显示CREATE语句",它会生成重新创建表所需的SQL.
我想做什么(使用PC上的代码)来获取我需要的SQLite表的CREATE语句(或至少是模式),然后编辑字符串以仅包含我需要的列.然后可以将这些传递到我的移动应用程序,以便它可以在设备上创建"子集"数据库.可能吗?
编辑:对于任何追求我寻找类似答案的人.感谢dan04指向正确的方向.使用结果......
SELECT * FROM sqlite_master
Run Code Online (Sandbox Code Playgroud)
...包含一个名为'sql'的列,其中包含CREATE语句.正是我在寻找的东西.:)
MySQL(表):
+----+------+
| id | text |
+----+------+
| 1 | |
+----+------+
| 2 | blah |
+----+------+
| 3 | |
+----+------+
| 4 | blah |
+----+------+
| 5 | blah |
+----+------+
Run Code Online (Sandbox Code Playgroud)
PHP:
$a = mysql_query("SELECT COUNT(*) AS count1 FROM `table`");
$b = mysql_fetch_assoc($a);
echo $b['count1'];
Run Code Online (Sandbox Code Playgroud)
输出:
5
Run Code Online (Sandbox Code Playgroud)
不过,我也想算文本字段被填满 -在同一查询中,如果可能的话.
结果:
5 in total
3 with filled text fields
Run Code Online (Sandbox Code Playgroud) 由于交通在24小时内分布不均匀,我想在偷看期间禁止爬行者,并允许他们在非繁忙时段.
有没有办法实现这个目标?
编辑:感谢所有好建议.
这是我们发现的另一种解决方案
2bits.com有一篇关于设置IPTables防火墙的文章,以限制来自某些IP地址的连接数.
IPTables的设置:
在较新的Linux内核中,有一个用于iptables的connlimit模块.它可以像这样使用:
iptables -I INPUT -p tcp -m connlimit --connlimit-above 5 -j REJECT
这会将每个IP地址的连接限制为不超过5个同时连接.这种"口粮"连接,并防止爬虫同时点击该网站.*
我在XCode中得到了上面的编译器错误,我无法弄清楚发生了什么.
#import <UIKit/UIKit.h>
// #import "HeaderPanelViewController.h"
#import "HTTPClientCommunicator.h"
#import "WebSocket.h"
@class HeaderPanelViewController;
@protocol ServerDateTimeUpdating
-(void)serverDateTimeHasBeenUpdatedWithDate:(NSString *) dateString andTime:(NSString *) timeString;
@end
@interface SmartWardPTAppDelegate : NSObject <UIApplicationDelegate, WebSocketDelegate> {
}
@property (nonatomic, retain) id<ServerDateTimeUpdating> *serverDateTimeDelegate;
....
@end
Run Code Online (Sandbox Code Playgroud)
然后在这一行
@synthesize serverDateTimeDelegate;
Run Code Online (Sandbox Code Playgroud)
在ApplicationDelegate.m中我收到错误"从不兼容的指针类型传递'obj_setProperty'的参数4".我做了一些研究,发现'retain'只适用于类类型,这是公平的.如果我实际上删除了行中的"保留"
@property (nonatomic, retain) id<ServerDateTimeUpdating> *serverDateTimeDelegate;
Run Code Online (Sandbox Code Playgroud)
它没有投诉就编译.但是,我认为,这是错误的做法.当然我的'id' 是类类型,当然它应该保留在setter中.顺便说一句,这是我的HeaderPanelViewController的声明,它实现了上述协议:
@interface HeaderPanelViewController : UIViewController<ServerDateTimeUpdating> {
}
...
@end
Run Code Online (Sandbox Code Playgroud)
另外,如果我真的做删除保留后,我得到一个问题走下赛场时,我实际调用的setter注册我的HeaderPanelViewController为代表:
// Register this instance as the delegate for ServerDateTimeUpdating
// Retrieve the ApplicationDelegate...
ApplicationDelegate *applicationDelegate = (ApplicationDelegate *) [UIApplication …
Run Code Online (Sandbox Code Playgroud) 我建了这样的字典列表
lst = [{'name': nameobj, Classobj1: "string", Classobj2: "string"}, \
{'name': nameobj, Classobj1: "string", Classobj2: "string"}]
Run Code Online (Sandbox Code Playgroud)
我正在使用
for dic in lst:
for k,v in dic: # here is the line has probloem! What it happens?
#process
Run Code Online (Sandbox Code Playgroud)
错误消息类似于"Classname"对象不可迭代.
我有一些代码可以执行一些功能异常处理,一切运行正常,当我想要它们时会引发异常,但是当我调试时,行跟踪并不总是完全符合我的要求.
例A:
>>> 3/0
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ZeroDivisionError: integer division or modulo by zero
Run Code Online (Sandbox Code Playgroud)
例B:
>>> try: 3/0
... except Exception as e: raise e
...
Traceback (most recent call last):
File "<stdin>", line 2, in <module>
ZeroDivisionError: integer division or modulo by zero
Run Code Online (Sandbox Code Playgroud)
在这两个示例中,异常实际发生在第1行,我们尝试执行3/0,但在后一个示例中,我们被告知它发生在第2行,它被引发.
在Python中是否有一种方法可以引发异常,就好像它是另一个异常,会产生以下输出:
>>> try: 3/0
... except Exception as e: metaraise(e)
...
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ZeroDivisionError: integer division or modulo …
Run Code Online (Sandbox Code Playgroud) php ×2
python ×2
apache ×1
count ×1
delegates ×1
dictionary ×1
django ×1
drupal ×1
iptables ×1
javascript ×1
jquery-ui ×1
list ×1
mysql ×1
objective-c ×1
ocr ×1
robots.txt ×1
sql ×1
sqlite ×1
tesseract ×1
web-crawler ×1
xcode ×1