Questions tagged [enforcement]
41 questions
10
votes
3 answers
Is it Possible to Enforce Data Checking in MySQL using Regular expression
Suppose I have an attribute called phone number and I would like to enforce certain validity on the entries to this field. Can I use regular expression for this purpose, since Regular Expression is very flexible at defining constraints.

Shamim Hafiz - MSFT
- 21,454
- 43
- 116
- 176
7
votes
3 answers
Force try-with-resources Java 7
I have a class which implements AutoCloseable, and is intended to be used with Java 7's new try-with-resources construct. However, I can't figure out a way to guarantee that the user of my class uses try-with-resources. If this doesn't happen, then…

joshlf
- 21,822
- 11
- 69
- 96
7
votes
2 answers
Datomic - db/isComponent equivalent to enforcing a foreign key dependency?
In the Datomic Schema doco - they mention a schema attribute called db/isComponent. This appears to refer to relationships defined by :db.type/ref.
The db/isComponent isn't used in the Seattle example. Is it fair to say that :db.type/ref…

hawkeye
- 34,745
- 30
- 150
- 304
6
votes
6 answers
Good approaches to enforce building with increased warning level for new C++ code
I've inherited a large C++ codebase for several Windows applications that successfully is in use by many customers.
The codebase is large, >1mill LOC.
The codebase has a history of 15+ years.
The codebase is in some areas dominated by C programming…

Michael S.
- 95
- 1
- 7
6
votes
2 answers
Concise way to enforce implementation of factory in Scala
Let us assume we have a trait T. What is the best way to achieve the following:
Everybody who writes an implementation of T should be forced to provide a possibility that allows a parameter-free initialization of T, i.e., we probably have to…

bluenote10
- 23,414
- 14
- 122
- 178
5
votes
3 answers
Python 2.x: how to automate enforcing unicode instead of string?
How can I automate a test to enforce that a body of Python 2.x code contains no string instances (only unicode instances)?
Eg.
Can I do it from within the code?
Is there a static analysis tool that has this feature?
Edit:
I wanted this for an…

Ian Mackinnon
- 13,381
- 13
- 51
- 67
5
votes
4 answers
iOS Subclassing and compulsory methods
I have a base view controller that a number of other view controllers subclass. Is there a way of enforcing certain methods which have to be overridden in a subclass?
For safety sake more than anything.
Cheers

Dann
- 323
- 5
- 17
5
votes
6 answers
Is there a way I can enforce a method to follow certain method signature?
let's say I have
public delegate DataSet AutoCompleteDelegate(
string filter, long rowOffset);
can I make the following class to enforce that method signature? (just a conjured up idea):
public class MiddleTier
{
…

Hao
- 8,047
- 18
- 63
- 92
4
votes
5 answers
How to force all derived classes to implement a virtual method?
Say you have a base class Dep for a tree of classes. There is a virtual method Dep* Dep::create() that I want to be implemented by every single leaf class. Is there any way to enforce this?
Note: The problem here is that there could be intermediate…

bitmask
- 32,434
- 14
- 99
- 159
4
votes
3 answers
assert() vs enforce(): Which to choose?
I'm having a hard time choosing whether I should "enforce" a condition or "assert" a condition in D. (This is language-neutral, though.)
Theoretically, I know that you use assertions to find bugs, and you enforce other conditions in order to check…

user541686
- 205,094
- 128
- 528
- 886
3
votes
2 answers
Android APN Enforcement
Someone know if there's a programmatically way to use a specific defined APN on the device which is not the default one?
Thanks.

Paz
- 365
- 2
- 4
- 8
3
votes
1 answer
Is it possible to enforce two classes to implement the same field names but of differing type at compile time?
Let's say there's two parallel classes:
class A(
val stringField: String,
val intField: Int,
val floatField: Float
)
class B(
val stringField: Boolean,
val intField: Boolean,
val floatField:…

Hans Cauwenbergh
- 65
- 4
3
votes
3 answers
Why doesn't VB.NET enforce handling exceptions?
Possible Duplicate:
Why are Exceptions not Checked in .NET?
If I remember correctly, Java enforces catching and handling any exceptions a called method may throw. Why doesn't .NET do the same?

jrsconfitto
- 1,134
- 1
- 11
- 33
3
votes
1 answer
Can't enforce the use of base constructor of an abstract class into derived class
I am trying to enforce the use of a specific parameterised constructor in my derived classes as per this below answer:
Abstract Class with Constructor
Using the example provided in the above answer, the code compilation fails as expected. Even…

Sven M.
- 509
- 3
- 16
2
votes
1 answer
Keycloak UMA Authorization REST API requires to send thousands requests
I have configured Keycloak and public client which is just react frontend app and web-api backend. Authentication works fine. User open front page, redirect to Keycloak login\password form, get his access_token and do some requests to web-api with…

Vladimir Titkov
- 171
- 10