doc

Python pyquery

雨燕双飞 提交于 2019-11-28 22:08:45
pyquery 一个像 jQuery 一样的解析库 初始化 字符串初始化 from pyquery import PyQuery as pq html = '' doc = pq(html) 文件初始化 from pyquery import PyQuery as pq doc = pq(filename='') URL 初始化 from pyquery import PyQuery as pq doc = pq(url='https://cnblogs.com/dbf-') 选择器 from pyquery import PyQuery as pq html = '' doc = pq(html) doc('#i1') # id 选择器 doc('.c1') # class 选择器 doc('div') # 标签选择器 doc('#i1, #i2') # 组合选择器 id==i1 或 id==i2 doc('#i1.c1') # 组合选择器 id==i1 且 id==i2 doc('#i1 .c1') # 层级选择器 id==i1 下所有 class==c1 的标签 doc('div > .c1') # 层级选择器 id==i1 下一层 class==c1 的标签 伪类选择器 from pyquery import PyQuery as pq html = '' doc = pq

Generating word documents with PHP [duplicate]

时间秒杀一切 提交于 2019-11-28 18:24:12
This question already has an answer here: Create Word Document using PHP in Linux [closed] 10 answers Do you know any way to generate doc and docx files with PHP and without COM component? I've tried PHPWord , which creates docx files, but these cannot be opened in OpenOffice because they cause it to crash. I've also tried PHPDocx , but it didn't generate any files at all. See here: http://www.webcheatsheet.com/php/create_word_excel_csv_files_with_php.php To quote from the article the most common method: Using HTTP Headers In this method you need to format the HTML/PHP page using Word-friendly

Convert a .doc or .pdf to an image and display a thumbnail in Ruby?

橙三吉。 提交于 2019-11-28 16:35:35
Convert a .doc or .pdf to an image and display a thumbnail in Ruby? Does anyone know how to generate document thumbnails in Ruby (or C, python...) A simple RMagick example to convert a PDF to a PNG would be: require 'RMagick' pdf = Magick::ImageList.new("doc.pdf") thumb = pdf.scale(300, 300) thumb.write "doc.png" To convert a MS Word document, it won't be as easy. Your best option may be to first convert it to a PDF before generating the thumbnail. Your options for generating the PDF depend heavily on the OS you're running on. One might be to use OpenOffice and the Python Open Document

Elasticsearch之路由(routing)

一世执手 提交于 2019-11-28 16:33:11
路由   主要解决的是文档应该存储在哪个分片中   实际过程是根据公式计算出进行分配   1 # 路由哈希值 % 主分片的数量 2 shard = hash(routing) % number_of_primary_shards 3 # 路由默认值是文档的_id 自定义路由 1 PUT r1/doc/1?routing=user1 2 { 3 "title":"论母猪的产前保养" 4 } 5 PUT r1/doc/2?routing=user1 6 { 7 "title":"论母猪的产后护理" 8 } 这两篇文档都分配在一个分片上了 通过路由查询文档 GET r1/doc/1?routing=user1 # 结果如下 { "_index" : "r1", "_type" : "doc", "_id" : "1", "_version" : 3, "_routing" : "user1", "found" : true, "_source" : { "title" : "论母猪的产前保养" } } 通过路由值查找 1 GET r1/doc/_search 2 { 3 "query": { 4 "terms": { 5 "_routing":["user1"] 6 } 7 } 8 } 9 # 结果如下 10 { 11 "took" : 0, 12 "timed_out" : false

从命令行同时移动多个文件类型的小技巧

拥有回忆 提交于 2019-11-28 16:27:08
我们知道,将某个类型的多个文件从一个目录移动到另一个目录很简单,但同时移动多种类型的多个文件或许会很麻烦,这里介绍一些让你在 Linux 中移动多种文件类型的小技巧。 同时移动多种文件类型 方法1: 假设 dir1 的目录中有多种类型的文件,如 .pdf .doc .mp3 .mp4 .txt 等,我们先来查看 dir1 中的内容: $ ls dir1 file.txt image.jpg mydoc.doc personal.pdf song.mp3 video.mp4 这时,你希望将某些文件类型(不是所有文件类型)移动到不同的位置。例如,你想将 doc,pdf 和 txt 文件一次性移动到另一个名为 dir2 的目录中,你可以使用如下命令: $ mv dir1/*.{doc,pdf,txt} dir2/ 然后,我们分别查看一下 dir1 和 dir2 目录中的内容,看看是否移动过来了: $ ls dir1/ song.mp3 video.mp4 $ ls dir2/ file.txt mydoc.doc personal.pdf 可以看出来, dir1 中的 .doc .pdf 和 .txt 类型的文件确实被移动到了 dir2 。 上面命令中的花括号内可以添加任意文件类型,来将它们移动到另一个目录中。怎么样,是不是很简单? 方法2: 我们先切换到源目录,我们这里是 dir1 :

elasticSearch学习笔记

為{幸葍}努か 提交于 2019-11-28 14:06:39
1 GET _search 2 { 3 "query": { 4 "match_all": {} 5 } 6 } 7 GET _all/_settings 8 PUT lib/_create/aaa 9 { 10 "first_name":"denny", 11 "age":20, 12 "interesta":["music"] 13 } 14 15 16 17 POST lib/_doc/user 18 { 19 "first_name":"denny1", 20 "age":20, 21 "interesta":["music"] 22 } 23 24 GET lib/_doc/aa?_source=age 25 26 GET lib/_doc/aa 27 28 PUT lib/_doc/aa 29 { 30 "first_name":"denny", 31 "age":20, 32 "interesta":["music"] 33 } 34 POST lib/_doc/aa 35 { 36 "age":111 37 } 38 39 DELETE lib/_doc/aa 40 41 DELETE lib2 来源: https://www.cnblogs.com/dennylau/p/11410142.html

Elasticsearch之建议器suggester

非 Y 不嫁゛ 提交于 2019-11-28 13:33:08
建议器功能   对用户搜索的内容做纠正帮助用户搜索到精确度高的关键字   搜索关键字的时候做出补全的功能 建议器种类   词条建议器(term suggester)   词组建议器(phrase suggester)   完成建议器 (completion suggester)   上下文建议器(context suggester) term suggester 功能:主要做纠正 但是是短语就不能做了(分析后) PUT s1 { "mappings": { "doc":{ "properties": { "title":{ "type":"text", "analyzer":"standard" } } } } } PUT s1/doc/1 { "title": "Lucene is cool" } PUT s1/doc/2 { "title": "Elasticsearch builds on top of lucene" } GET s1/doc/_search { "query": { "match": { "title": "lucene" } }, "suggest": { "my_s1": { "text": "lucne", "term": { "field": "title" } } } } GET s1/doc/_search { "suggest": { "my

Android - convert doc, docx pages and xls, xlsx sheets to html using apache POI

情到浓时终转凉″ 提交于 2019-11-28 11:33:57
问题 I am developing an android application. In which I want to show the doc, docx, xlx, xlsx files in my application. After searched in google, I came to know that the apachi POI will convert these files into html. So that I have added the "poi-3.8-20120326.jar" into the libs folder and try to build the app. But I did face some dalvik build issue. So, I searched about this issue and found that the POI jar is supporting for java apps not fully supported for android. I got some opensource for

Reading doc and docx files using C# without having MS Office installed on server

懵懂的女人 提交于 2019-11-28 11:22:30
I'm working on a project (asp.net, c#, vb 2010, .net 4) and I need to read both DOC and DOCX files, that I've previosly uploaded (I've done uploading part). Tricky part is that I don't have MS Office installed on server and that I can't use it. Is there any public library that I can include into my project without having to install anything? Both docs are very simple: NUMBER TAB STRING NUMBER TAB STRING NUMBER TAB STRING ... I need to extract number and string for each row (paragraph). May someone help with this? I should repeat once again that I'm limited in a way that I can't install

How to create and save a .rtf, .doc, .docx in Objective-C for iOS

可紊 提交于 2019-11-28 10:29:57
I am looking to create and save either a rtf, doc or docx file on an iPad (iOS). The scenario is that we'd like to assist a user in creating content on their iPad and then let them email this as an editable document cross-platform (OS X, WIN). I am open to other solutions besides the rtf, doc or docx file format. Thanks, James RTF is going to be the easiest, because it's a plain text format. It's kind of like HTML, but without closing tags. Here is a class for writing an RTF, but it requires a lot of dependencies from elsewhere in the framework. DOCX would be rather difficult. It's actually a