Questions tagged [restriction]

A restriction is anything that constrains or limits the code in some fashion.

Restriction is a very broad tag that denotes a requirement to restrict the code in some fashion.

706 questions
468
votes
22 answers

What does the 'static' keyword do in a class?

To be specific, I was trying this code: package hello; public class Hello { Clock clock = new Clock(); public static void main(String args[]) { clock.sayTime(); } } But it gave the error Cannot access non-static field in…
Ali
  • 261,656
  • 265
  • 575
  • 769
69
votes
2 answers

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

The problem is as follows: I have the following XML snippet: 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…
Ikke
  • 99,403
  • 23
  • 97
  • 120
53
votes
1 answer

Is the per-host connection limit raised with HTTP/2?

Browsers have a per-host limit regarding number of parallel XHR (about 6 nowadays). Does this restriction apply to multiplexed HTTP/2 connections?
Warren Seine
  • 2,311
  • 2
  • 25
  • 38
53
votes
3 answers

How to achieve "not in" by using Restrictions and criteria in Hibernate?

I have list of category. I need a list of category by excluding 2,3 row. Can we achieve through hibernate by using Criteria and Restriction?
Shashi
  • 12,487
  • 17
  • 65
  • 111
40
votes
6 answers

Why I can't extend bool in Python?

>>> class BOOL(bool): ... print "why?" ... why? Traceback (most recent call last): File "", line 1, in TypeError: Error when calling the metaclass bases type 'bool' is not an acceptable base type I thought Python trusted…
Juanjo Conti
  • 28,823
  • 42
  • 111
  • 133
32
votes
6 answers

How to limit user commands in Linux

I have a user in a group: "demo". I want to set the policy that this user can run only 10 commands, like vim, nano, cd, etc. Or, set the policy to have access on all commands except ssh and cat commands.
mortymacs
  • 3,456
  • 3
  • 27
  • 53
30
votes
4 answers

Inconsistent accessibility: field type 'world' is less accessible than field 'frmSplashScreen

I have this error called Inconsistent accessibility: field type 'world' is less accessible than field 'frmSplashScreen' In my code there is a public partial class called frmSplashScreen There is also a public class called world The line that…
user1761786
  • 321
  • 1
  • 3
  • 6
27
votes
1 answer

Restricting generic types to one of several classes in Typescript

In Typescript, how do you restrict a generic type to one of several classes at compile time? For example, how do you implement this pseudocode? class VariablyTyped { method(hasOneType: T) { if T has type…
Joe Lapp
  • 2,435
  • 3
  • 30
  • 42
25
votes
3 answers

Rails: Restrict API requests to JSON format

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…
JJD
  • 50,076
  • 60
  • 203
  • 339
25
votes
2 answers

XSD Restriction on Attribute

I think I have searched a lot about this but still no go. Will appreciate any help. I am trying to restrict an attribute for an element with empty content. color should have a restriction to only hold 3 digit or minLength=3 and maxLength=3. It…
ZiggyStardust
  • 415
  • 1
  • 7
  • 18
24
votes
6 answers

How to restrict a column value in SQLite / MySQL

I would like to restrict a column value in a SQL table. For example, the column values can only be "car" or "bike" or "van". My question is how do you achieve this in SQL, and is it a good idea to do this on the DB side or should I let the…
Maro
  • 4,065
  • 7
  • 33
  • 34
23
votes
5 answers

readonly-fields as targets from subclass constructors

A readonly field should be used when you have a variable that will be known at object-instatiation which should not be changed afterwards. However one is not allowed to assign readonly fields from constructors of subclasses. This doesn't even work…
19
votes
4 answers

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

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…
Mischa
  • 15,816
  • 8
  • 59
  • 117
16
votes
1 answer

DataOutputStream: purpose of the "encoded string too long" restriction

There is a strange restriction in java.io.DataOutputStream.writeUTF(String str) method, which limits the size of an UTF-8 encoded string to 65535 bytes: if (utflen > 65535) throw new UTFDataFormatException( "encoded string…
Andremoniy
  • 34,031
  • 20
  • 135
  • 241
15
votes
2 answers

Restricting IP addresses for Jetty and Solr

I'm setting up Solr using Jetty. I would like to restrict access to only a few IP addresses. It doesn't seem immediately obvious that this can be done using Jetty. Is it possible and if so, how?
Lyndsay
  • 233
  • 1
  • 2
  • 9
1
2 3
46 47