restriction

How can we restrict the user from saving a web page?

ぃ、小莉子 提交于 2019-12-07 05:47:44
问题 How can we restrict a user from saving the page? Please provide some tips to disable File->Save and View Source options EDIT: Obviously it can't be done, and probably shouldn't be attempted. But possibly a more interesting variant on this question is how can we make is sufficiently hard for a user to save a page in a usable format such that it is not worth their while doing so? The question doesn't pose a value, but say we were protecting an article subscription site where the user is paying

Restrict access to certain folders using NSOpenPanel

こ雲淡風輕ζ 提交于 2019-12-07 05:23:27
问题 I'm using NSOpenPanel to allow a user to select a folder to save documents into. I would like to restrict what folder (in terms of hierarchy) they can save into. Essentially, I want to prevent them from choosing any folder above: /Users/username/ So the folder /Users/username/cats/ would be acceptable but /Users/username/ /Applications/cats/ would not be allowed. I was wondering how to implement this restriction. Thanks. 回答1: Note that NSOpenPanel inherits from NSSavePanel, which in turn

PostgreSQL column values must be in a sequence

对着背影说爱祢 提交于 2019-12-06 06:13:06
How would I define a column in PostgreSQL such that each value must be in a sequence, not the sequence you get when using type serial but one such that a value 2 cannot be inserted unless there exists a value 1 already in the column? Theoretically, you could use a constraint that worked like this. (But it won't work in practice.) Count the rows. Evaluate max(column) - min(column) + 1 . Compare the results. You'd probably have to insert one row before creating the CHECK constraint. If you didn't, max(column) would return NULL. With one row, Count the rows (1). Evaluate max(column) - min(column)

Check if background restriction data is enabled or not?

﹥>﹥吖頭↗ 提交于 2019-12-06 05:03:34
问题 I have a service which is running on the main thread not in the background. In the service I'm checking net connection via broadcastreciver. When I enable restriction data enabled in Settings, broadcastreciver is catching intent well, but internet connection(Mobile data) is disabled to my app although it has on my device. I've seen this question, and android docs. intentFilter.addAction("android.net.conn.ACTION_BACKGROUND_DATA_SETTING_CHANGED"); intentFilter.addAction("android.net.conn

Generic Restriction Hell: Bound Mismatch

假装没事ソ 提交于 2019-12-06 00:37:53
问题 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>

Restrict access to certain folders using NSOpenPanel

孤街醉人 提交于 2019-12-05 12:43:08
I'm using NSOpenPanel to allow a user to select a folder to save documents into. I would like to restrict what folder (in terms of hierarchy) they can save into. Essentially, I want to prevent them from choosing any folder above: /Users/username/ So the folder /Users/username/cats/ would be acceptable but /Users/username/ /Applications/cats/ would not be allowed. I was wondering how to implement this restriction. Thanks. Note that NSOpenPanel inherits from NSSavePanel , which in turn defines a delegate and a corresponding delegate protocol NSOpenSavePanelDelegate . You can use the delegate to

Content restriction and attribute validation on the same element in XSD

三世轮回 提交于 2019-12-05 03:35:55
I would like to validate that an element 'Test' should Have its content restricted (for example, using a pattern restriction), and Contain certain attributes (for example, 'id', 'class' and 'name'). The XSD I'm writing looks like this: <xsd:element name="Test" minOccurs="0" maxOccurs="unbounded"> <xsd:complexType mixed="true"> <xsd:simpleContent> <xsd:restriction> <xsd:pattern value="xyz"/> </xsd:restriction> </xsd:simpleContent> <xsd:attribute name="id" type="xsd:string"></xsd:attribute> <xsd:attribute name="class" type="xsd:string"></xsd:attribute> <xsd:attribute name="name" type="xsd:string

Can I define an enum as a subset of another enum's cases?

亡梦爱人 提交于 2019-12-05 03:04:27
Note: This is basically the same question as another one I've posted on Stackoverflow yesterday. However, I figured that I used a poor example in that question that didn't quite boil it down to the essence of what I had in mind. As all replies to that original post refer to that first question I thought it might be a better idea to put the new example in a separate question — no duplication intended. Model Game Characters That Can Move Let's define an enum of directions for use in a simple game: enum Direction { case up case down case left case right } Now in the game I need two kinds of

CROSS APPLY with table valued function restriction performance

こ雲淡風輕ζ 提交于 2019-12-05 02:13:07
I have problem with CROSS APPLY with parametrised table valued function. Here is simplified pseudo code example: SELECT * FROM ( SELECT lor.* FROM LOT_OF_ROWS_TABLE lor WHERE ... ) AS lor CROSS APPLY dbo.HeavyTableValuedFunction(lor.ID) AS htvf INNER JOIN ANOTHER_TABLE AS at ON lor.ID = at.ID WHERE ... Inner select on table LOT_OF_ROWS_TABLE is returning many rows. Joining tables LOT_OF_ROWS_TABLE and ANOTHER_TABLE returns only one or few rows. Table valued function is very time consuming and when calling for a lot of rows the select lasts very long time. My problem: The function is called for

Incorporating shareware restrictions in C++ software

杀马特。学长 韩版系。学妹 提交于 2019-12-04 17:43:09
问题 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