是否适合使用产品架构进行服务?(Would it be Appropriate to use the Product Schema for Services?)

我感兴趣的是标记具有所有服务的页面。

我的特定行业Schema不提供span itemprop="itemOffered" 。 因此,我是否应该使每个服务页面反映产品架构而不是行业特定的项目类型,或者最好在服务页面上指定产品架构,然后在各个产品页面上使用行业特定的项目类型并列出产品使用makesoffer


I am interested in tagging the page that features all the services.

My particular industry Schema doesn't offer the span itemprop="itemOffered". Thus, should I make each the services page reflect the Product Schema rather than the industry specific itemtype, Or is it best to specify on the services page the product Schema and then on the individual product pages use the industry-specific itemtype and list the product using makesoffer?


原文:https://stackoverflow.com/questions/19231346
2023-08-18 18:08

满意答案

这里的例子是你可以适应和运作的:

https://docs.python.org/2/library/multiprocessing.html

您是否使用管理器对象来在进程之间共享内存。

在您的示例中,您使用管理器创建了一个字典,但是您使用正常字典将其删除

manager = Manager()
d = manager.dict()   # correct
d = dict([(c, 0) for c in C])  # d is not a manager.dict: no shared memory

而是这样做(测试,编译)

d = manager.dict([(c, 0) for c in C])

Example here that you could adapt and which works:

https://docs.python.org/2/library/multiprocessing.html

You have you use a manager object to be able to share memory between processes.

In your example you create a dictionary using the manager but you kill it with a normal dictionary the line after

manager = Manager()
d = manager.dict()   # correct
d = dict([(c, 0) for c in C])  # d is not a manager.dict: no shared memory

Instead do this (tested, compiles)

d = manager.dict([(c, 0) for c in C])

相关问答

更多

在Python中多处理一个字典(Multiprocessing a dictionary in python)

我过去所做的是创建一个处理数据条目的“工人类”。 然后我将启动X个线程,每个线程运行一个worker类的副本。 数据集中的每个项目都会被推送到工作线程正在观察的队列中。 当队列中没有更多项目时,线程停转。 使用这种方法,我能够在大约3秒内使用5个线程处理10,000多个数据项。 当应用程序只有单线程时,这将花费更长的时间。 查看: http : //docs.python.org/library/queue.html What I've done in the past is to create ...

Python multiprocessing.pool顺序运行进程(Python multiprocessing.pool sequential run of processes)

由于您正在创建进程池,因此命令实际上是按顺序启动的,但您无法保证首先完成哪个进程。 您会注意到,每次运行代码时订单都会有所不同。 Since you are creating a pool of processes, the commands are actually started sequentially, but you have no guarantee on which process is going to finish first. You will notice that the ...

python:使用多处理和数据帧进行地理编码(python: using multiprocessing with a dataframe for geocoding)

试试是: import geocoder import multiprocessing as mp import pandas as pd def reverse_gecode(coordinates): return geocoder.google(coordinates, method = 'reverse').postal if __name__ == '__main__': gps = pd.DataFrame({'lat': [27.95057...

字典到DataFrame(Dictionary into DataFrame)

pd.DataFrame.from_dict可能就是您所需要的。 myStates = pd.DataFrame.from_dict(states, orient='index').reset_index() myStates.columns = ['a', 'b'] myStates.head(5) # a b # 0 OH Ohio # 1 KY Kentucky # 2 AS American Samoa #...

Python 3控制多处理(Python 3 control multiprocessing)

这两个例子对我来说都很好 - 也许你误解了它们应该如何工作? 在第一个例子中,当主线程运行时,它启动子进程并发送12.然后它等待加入子进程。 在那一刻,一切都停滞不前,因为孩子正在等待“退出”。 但是如果你按ctrl-C然后发送'exit',则子进程退出,第二次连接成功: > python3.3 example1.py 12 ...

如何用字典和数据帧编写多处理python代码(How to write multiprocessing python codes with dictionary and dataframe)

这里的例子是你可以适应和运作的: https://docs.python.org/2/library/multiprocessing.html 您是否使用管理器对象来在进程之间共享内存。 在您的示例中,您使用管理器创建了一个字典,但是您使用正常字典将其删除 manager = Manager() d = manager.dict() # correct d = dict([(c, 0) for c in C]) # d is not a manager.dict: no shared mem...

熊猫和多处理(Pandas and Multiprocessing)

您不必自己实现并行性,有比urllib更好的库,例如请求[0]和使用线程或期货的一些衍生产品[1]。 我想你需要检查自己哪一个是最快的。 由于少量的依赖关系,我最喜欢请求 - 期货,这里我使用十个线程实现你的代码。 如果你相信或者发现它在某种程度上更好,那么图书馆甚至会支持流程: import pandas as pd import numpy as np import urllib import time import json from concurrent.futures import Th...

python数据帧到字典,键值问题(python dataframe to dictionary, key value issue)

使用pd.Series.to_dict方法 frame.groupby('A').B.median().to_dict() {'1': 6, '2': 5, '3': 2} Use the pd.Series.to_dict method frame.groupby('A').B.median().to_dict() {'1': 6, '2': 5, '3': 2}

python字典到pandas dataframe返回空数据帧(python dictionary to pandas dataframe returns empty dataframe)

#use from_dict and set orient to index and then transpose in the end. pd.DataFrame.from_dict(dictio,orient='index').T Out[263]: a c b 0 abc prq zyx #use from_dict and set orient to index and then transpose in the end. pd.DataFrame.from...

并行处理将字典写入多个csv文件(parallel processing write dictionary to multiple csv files)

你的问题是,make_slices返回一个字典,而不是一个列表,并且pool.map()不喜欢那个。 它只是将你的字典键传递给你的工作人员,这意味着他们是字符串(尝试打印你收到的inputDict )。 它不是字典,而是钥匙。 def make_slices(files, df): outlist = [] for item in files: data = df + item outlist.append({item: data}) ret...

相关文章

更多

solr schema.xml 详解

solr中所有域都定义在 schema.xml配置文件中,在solr中域必须是先定义再使用,如果你想修 ...

关于 solr schema.xml 的配置说明

schema.xml位于solr/conf/目录下,类似于数据表配置文件, 定义了加入索引的数据的数据 ...

关于solr schema.xml 和solrconfig.xml的解释

一、字段配置(schema) schema.xml位于solr/conf/目录下,类似于数据表配置文件 ...

Solr Schema.xml和solrconfig.xml分析

现在我们开始研究载入的数据部分(importing data) 在正式开始前,我们先介绍一个存储了大量 ...

USER AND SCHEMA

官方文档里面说得比较明白,schema是数据对象的集合,包括像表、视图、索引、同义词等等都可以说是sc ...

SOLR 中 Schema.xml 的filedType 的一些属性的理解

1. dynamicField 的作用是什么? 如果你需要在schema.xml文件中的<fie ...

初始SolrJ开发, schema.xml的配置与服务初始化.

schema.xml位于solr/collection1/conf/目录下,是Solr中用户定义字段类 ...

最新问答

更多

获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)

我用Google搜索了一个解决方案。 “EnumDisplayModeProvider”是我自己设置网站的各种模式的枚举。 public EnumDisplayModeProvider GetDisplayModeId() { foreach (var mode in DisplayModeProvider.Instance.Modes) if (mode.CanHandleContext(HttpContext)) {

如何通过引用返回对象?(How is returning an object by reference possible?)

这相对简单:在类的构造函数中,您可以分配内存,例如使用new 。 如果你制作一个对象的副本,你不是每次都分配新的内存,而是只复制指向原始内存块的指针,同时递增一个也存储在内存中的引用计数器,使得每个副本都是对象可以访问它。 如果引用计数降至零,则销毁对象将减少引用计数并仅释放分配的内存。 您只需要一个自定义复制构造函数和赋值运算符。 这基本上是共享指针的工作方式。 This is relatively easy: In the class' constructor, you allocate m

矩阵如何存储在内存中?(How are matrices stored in memory?)

正如它在“熵编码”中所说的那样,使用Z字形图案,与RLE一起使用,在许多情况下,RLE已经减小了尺寸。 但是,据我所知,DCT本身并没有给出稀疏矩阵。 但它通常会增强矩阵的熵。 这是compressen变得有损的点:输入矩阵用DCT传输,然后量化量化然后使用霍夫曼编码。 As it says in "Entropy coding" a zig-zag pattern is used, together with RLE which will already reduce size for man

每个请求的Java新会话?(Java New Session For Each Request?)

你是如何进行重定向的? 您是否事先调用了HttpServletResponse.encodeRedirectURL()? 在这里阅读javadoc 您可以使用它像response.sendRedirect(response.encodeRedirectURL(path)); The issue was with the path in the JSESSIONID cookie. I still can't figure out why it was being set to the tomca

css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)

我认为word-break ,如果你想在一个单词中打破行,你可以指定它,这样做可以解决问题: .column { word-break:break-all; } jsFiddle演示。 您可以在此处阅读有关word-break属性的更多信息。 I think word-break, with which you can specify if you want to break line within a word, will do the trick: .column { word-break

无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)

我认为您忘记在分类时间内缩放输入图像,如train_test.prototxt文件的第11行所示。 您可能应该在C ++代码中的某个位置乘以该因子,或者使用Caffe图层来缩放输入(请查看ELTWISE或POWER图层)。 编辑: 在评论中进行了一次对话之后,结果发现在classification.cpp文件中错误地删除了图像均值,而在原始训练/测试管道中没有减去图像均值。 I think you have forgotten to scale the input image during cl

xcode语法颜色编码解释?(xcode syntax color coding explained?)

转到: Xcode => Preferences => Fonts & Colors 您将看到每个语法高亮颜色旁边都有一个简短的解释。 Go to: Xcode => Preferences => Fonts & Colors You'll see that each syntax highlighting colour has a brief explanation next to it.

在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)

你考虑过第三方拼写检查吗? 您可以将在C#中开发的自定义WinForms控件插入访问数据库吗? VB6控件怎么样? 如果你能找到一个使用第三方库进行拼写检查的控件,那可能会有效。 Have you considered a third party spell checker? Can you insert a custom WinForms controls developed in C# into an access database? What about a VB6 control? If

从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)

我有同样的问题,因为我在远程服务器上有两个图像,我需要在每天的预定义时间复制到我的本地服务器,这是我能够提出的代码... try { if(@copy('url/to/source/image.ext', 'local/absolute/path/on/server/' . date("d-m-Y") . ".gif")) { } else { $errors = error_get_last(); throw new Exception($err

从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))

我不确定我完全明白你在说什么。 你能编辑你的帖子并包含你正在做的Subversion命令/操作的特定顺序吗? 最好使用命令行svn客户端,以便容易为其他人重现问题。 如果您只是想获取文件的旧副本(即使该文件不再存在),您可以使用如下命令: svn copy ${repo}/trunk/moduleA/file1@${rev} ${repo}/trunk/moduleB/file1 其中${repo}是您的存储库的URL, ${rev}是您想要的文件的版本。 这将恢复该文件的旧版本,包括最高版本