restriction

Generic Restriction Hell: Bound Mismatch

落花浮王杯 提交于 2019-12-04 07:21:46
I'm working on a project that has an extensive tree of generic inheritance and dependencies. Go to edit to see better example. The basics look something like this: class A { ... } class B { ... } class C extends B { ... } class D<T extends B> extends A { ... } class StringMap<T extends A> { HashMap<String, T> _elements; ... } So now I'm going to write a class that contains a specific StringMap type. class X { StringMap<D<C>> _thing = new StringMap<D<C>>; ... } So far this all works fine. D<C> is actually a very long name and the specific combination is going to show up very frequently in other

Restrict what can create a PHP Class

偶尔善良 提交于 2019-12-04 05:50:30
I got two classes, "A" and "B". In the application logic no one is allowed to create an object of class "B", except for class "A". But, since I dont want to have the two classes in the same file I cant restrict it with the "private" properity. Is it possible to create this kind of restriction? If someone other then "A" tries to create an object of class "B", you say piss off!? This is as hacky as it get's and you should not use it. I only post it, because I like hacky things ;) Furthermore this will throw an error if E_STRICT error reporting is enabled: class B { private function __construct()

XSD: How to restrict enumeration values of a derived complex type?

末鹿安然 提交于 2019-12-04 05:18:55
Given the following example: <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:complexType name="Book" abstract="true"> <xs:sequence> <xs:element name="titel" type="xs:string"> </xs:element> <xs:element name="bookCode" type="BookEnum"/> </xs:sequence> </xs:complexType> <xs:complexType name="Lyric"> <xs:complexContent> <xs:extension base="Book"> <xs:sequence> <xs:element name="author" type="xs:string"> </xs:element> </xs:sequence> </xs:extension> </xs:complexContent> </xs:complexType> <xs:simpleType name="BookEnum"> <xs:restriction base="xs:int"> <xs:enumeration value="Paperback"/>

Incorporating shareware restrictions in C++ software

南楼画角 提交于 2019-12-03 11:27:05
I wish to implement my software on a shareware basis, so that the user is given a maximum trial period of (say) 30 days with which to try out the software. On purchase I intend the user to be given a randomly-generated key, which when entered enables the software again. I've never been down this route before, so any advice or feedback or pointers to 'standard' ways of how this is done would be much appreciated. I do not anticipate users cheating by changing the system date or anything like that, though this is probably worth considering. Apologies if this topic has appeared before. With

Rails: Restrict API requests to JSON format

放肆的年华 提交于 2019-12-03 08:24:25
问题 I would like to restrict requests to all API controllers to being redirected to the JSON path. I would like to use a redirect since also the URL should change according to the response. One option would be to use a before_filter which redirects the request to the same action but forces the JSON format. The example is not working yet! # base_controller.rb class Api::V1::BaseController < InheritedResources::Base before_filter :force_response_format respond_to :json def force_response_format

Add attributes to a simpletype or restriction to a complextype in Xml Schema

删除回忆录丶 提交于 2019-12-03 01:34:24
问题 The problem is as follows: I have the following XML snippet: <time format="minutes">11:60</time> The problem is that I can't add both the attribute and the restriction at the same time. The attribute format can only have the values minutes, hours and seconds. The time has the restrictionpattern \d{2}:\d{2} <xs:element name="time" type="timeType"/> ... <xs:simpleType name="formatType"> <xs:restriction base="xs:string"> <xs:enumeration value="minutes"/> <xs:enumeration value="hours"/> <xs

Rails: Restrict API requests to JSON format

三世轮回 提交于 2019-12-02 22:08:27
I would like to restrict requests to all API controllers to being redirected to the JSON path. I would like to use a redirect since also the URL should change according to the response. One option would be to use a before_filter which redirects the request to the same action but forces the JSON format. The example is not working yet! # base_controller.rb class Api::V1::BaseController < InheritedResources::Base before_filter :force_response_format respond_to :json def force_response_format redirect_to, params[:format] = :json end end Another option would be to restrict the format in the routes

How can I set material-ui TextField to accept only Hexidecimal characters

流过昼夜 提交于 2019-12-02 17:40:28
问题 I want my TextField to accept only the values from 0-9 and letters A-F. Thanks. 回答1: See the Formatted Inputs portion of the documentation. Here is an example I put together (using the formatted inputs demo code as a starting point) using react-text-mask that only accepts up to 8 hexidecimal characters: 来源: https://stackoverflow.com/questions/53981996/how-can-i-set-material-ui-textfield-to-accept-only-hexidecimal-characters

Add attributes to a simpletype or restriction to a complextype in Xml Schema

两盒软妹~` 提交于 2019-12-02 15:03:04
The problem is as follows: I have the following XML snippet: <time format="minutes">11:60</time> The problem is that I can't add both the attribute and the restriction at the same time. The attribute format can only have the values minutes, hours and seconds. The time has the restrictionpattern \d{2}:\d{2} <xs:element name="time" type="timeType"/> ... <xs:simpleType name="formatType"> <xs:restriction base="xs:string"> <xs:enumeration value="minutes"/> <xs:enumeration value="hours"/> <xs:enumeration value="seconds"/> </xs:restriction> </xs:simpleType> <xs:complexType name="timeType"> <xs

How can I set material-ui TextField to accept only Hexidecimal characters

久未见 提交于 2019-12-02 12:39:50
I want my TextField to accept only the values from 0-9 and letters A-F. Thanks. See the Formatted Inputs portion of the documentation. Here is an example I put together (using the formatted inputs demo code as a starting point) using react-text-mask that only accepts up to 8 hexidecimal characters: 来源: https://stackoverflow.com/questions/53981996/how-can-i-set-material-ui-textfield-to-accept-only-hexidecimal-characters