在Z3 Python中具有函数作为属性的数据类型(Datatypes with functions as attributes in Z3 Python)
我正在使用Z3的Python绑定,并尝试创建属性为函数的Z3数据类型。 例如,我可能会执行以下操作:
Foo = Datatype('Foo') Foo.declare('foo', [('my_function', Function('f', IntSort(), BoolSort()))]) Foo.create()
这是尝试使用属性
my_function
创建数据类型Foo
,在那里我可以调用my_function x
(如果x
是Foo
类型的变量),以便从int到bool获得一些函数。但是,我在第二行遇到以下错误:
z3types.Z3Exception: Valid list of accessors expected. An accessor is a pair of the form (String, Datatype|Sort)
是否可以使用函数作为属性声明Z3数据类型,可能使用不同的语法?
或者是不允许的事情? z3中的post 函数声明向我建议Z3中不允许使用高阶函数,因此可能不允许向数据类型添加函数,以防止使用这些数据类型创建高阶函数。
I am using the Python bindings for Z3, and trying to create a Z3 datatype whose attributes are functions. For example, I might execute the following:
Foo = Datatype('Foo') Foo.declare('foo', [('my_function', Function('f', IntSort(), BoolSort()))]) Foo.create()
This is an attempt to create a datatype
Foo
with attributemy_function
, where I would be able to callmy_function x
(ifx
is a variable of typeFoo
) in order to get out some function from ints to bools.However, I run into the following error at the second line:
z3types.Z3Exception: Valid list of accessors expected. An accessor is a pair of the form (String, Datatype|Sort)
Is it possible to declare Z3 datatypes with functions as attributes, perhaps using a different syntax?
Or is it something that is not allowed? The post function declaration in z3 suggests to me that higher-order functions are not allowed in Z3, so perhaps adding a function to a datatype is disallowed so as to prevent the creation of higher-order functions using those datatypes.
原文:https://stackoverflow.com/questions/35708244
最满意答案
尝试一下。
在web.config中的系统web下
添加这一行..
<system.web> <httpRuntime executionTimeout="999" maxRequestLength="2097151"/>
然后你需要检查文件大小
if (AsyncFileUpload1.HasFile) { string FileName = Path.GetFileName(AsyncFileUpload1.PostedFile.FileName); string Extension = Path.GetExtension(AsyncFileUpload1.PostedFile.FileName); string FolderPath = ConfigurationManager.AppSettings["FolderPath"]; string FilePath = Server.MapPath("~/xl/" + FileName); double filesize = (double)AsyncFileUpload1.FileBytes.Length; if (filesize < 106496) { //do something } else { Response.Write("File size must be less than 2MB."); }
如果您觉得它有用,请将其标记为您的答案,否则请通知我。
Try this out.
Under system web in web.config
add this line..
<system.web> <httpRuntime executionTimeout="999" maxRequestLength="2097151"/>
Then you need to check the file size
if (AsyncFileUpload1.HasFile) { string FileName = Path.GetFileName(AsyncFileUpload1.PostedFile.FileName); string Extension = Path.GetExtension(AsyncFileUpload1.PostedFile.FileName); string FolderPath = ConfigurationManager.AppSettings["FolderPath"]; string FilePath = Server.MapPath("~/xl/" + FileName); double filesize = (double)AsyncFileUpload1.FileBytes.Length; if (filesize < 106496) { //do something } else { Response.Write("File size must be less than 2MB."); }
If you find it useful, please mark it as your answer else let me know..
相关问答
更多-
尝试一下。 在web.config中的系统web下 添加这一行..
然后你需要检查文件大小 if (AsyncFileUpload1.HasFile) { string FileName = Path.GetFileName(AsyncFileUpload1.PostedFile.FileName); ... -
通常ERR_CONNECTION_RESET是当您尝试连接的站点无法建立该连接时发生的错误。 这通常是由于ISP缓存问题上的防火墙阻塞等原因造成的。 但是在您的情况下,我觉得您要连接的站点是自愿关闭连接尝试,因为您尝试做的是循环并连续点击该API站点1600次。 API网站允许前800次尝试,但之后它担心你可能是一个试图伤害它的恶意脚本。 像DOS(拒绝服务)尝试的经典例子。 您应该检查客户端在固定时间内对API站点进行的尝试次数是否有任何限制(比如说每24小时点击500次),或者您应该在每次点击网站后N秒 ...
-
问题是我的UsageItem类,我缺少必要的DataContract和DataMember字段。 [DataContract] public class UsageItem { [DataMember] int ItemNumber; public UsageItem(int ItemNumber) { this.ItemNumber = ItemNumber; } } The problem was my UsageItem class, I was missing the ne ...
-
从IIS获取ERR_CONNECTION_RESET,日志中没有信息(Getting ERR_CONNECTION_RESET from IIS with no information in logs)[2023-09-12]
在使用localhost上的一些虚拟域并分配SSL证书后,我遇到了这个问题。 选择当前域的IIS开发证书时,错误消失。 It turns out this was caused by this line: Response.StatusDescription = e.Message; When e.Message has a newline (\r\n) sequence inside. The two options I had available to fix this error were: 1. ... -
错误101(net :: ERR_CONNECTION_RESET):连接已重置(Error 101 (net::ERR_CONNECTION_RESET): The connection was reset)[2023-10-28]
这里 executionTimeout="0" takes unlimited time maxRequestLength="51200" for 1mb=1024 so for 50mb=51200 Here executionTimeout="0" ta ... -
这是所有尺寸的m4吗? 如果此问题仅与较大的文件大小有关,请以这种方式检查您的网络服务器配置是否为nginx设置大小。 client_max_body_size 200M; Is this for all sizes of m4 ? If this issue is only related to the larger file size please check with your web server configuration for nginx set size in this way. clien ...
-
我通过运行32位版本的WAMP而不是64位解决了这个问题。 I resolved this issue by running the 32-bit version of WAMP instead of 64-bit.
-
好的,我解决了...... 解 如果这发生在其他人身上,请确保至少在WebService中访问Context.Request.Files一次。 因为,在我的测试中,我只是: Public Function UploadFilesWithAJAX() Return "RETURN SOMETHING" End Function 但这还不够......如果我只访问Context.Request.Files,如: Public Function UploadFilesWithAJAX() Di ...
-
你的python服务器在端口8080上运行,没有任何东西正在运行端口80(如netstat命令的输出所示) 在您的情况下,您需要将来宾端口更改为python服务器中的来宾端口 config.vm.network "forwarded_port", guest: 8080, host: 8080 Your python server is running on port 8080 and nothing is running port 80 (as the output of the netstat com ...
-
Web API 2和IIS 10 - 偶发的ERR_CONNECTION_RESET(Web API 2 and IIS 10 - Sporadic ERR_CONNECTION_RESET)[2022-06-22]
您绝对可以排除代码,CORS配置和IIS配置。 基于错误代码,您的服务器似乎没有间歇性响应,或者可能是中间设备/代理/防火墙阻止请求并因此超时。 由于您的网络管理员因为中间设备而排除了问题,您可以在托管了webAPI的计算机上尝试一些事情(这些都不会让您满意) 1)检查http.sys日志(C:\ Windows \ System32 \ LogFiles \ HTTPERR)并根据描述检查https://support.microsoft.com/en-in/kb/820729 2)尝试完全禁用防火墙。 ...