Restricting generic types to one of several classes in Typescript

I banged my head on this for a few hours, but the solution seems obvious in retrospect. First I present the solution, then I compare it to prior approaches. (Tested in Typescript 2.6.2.) // WORKING SOLUTION: union of types with type checks class MustBeThis { method1() { } } class OrThis { method2() { } … Read more

How to limit user commands in Linux [closed]

There are lots of different ways that you could achieve this. I’m going to list one of several possible solutions. I would propose using several different layers of protection to prevent users from running the commands that they shouldn’t be allowed to access. All of the directions here assume that users have their own /home/[username] … Read more

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

Browsers impose a per-domain limit of 6-8 connections when using HTTP/1.1, depending on the browser implementation. This allows at most 6-8 concurrent requests per domain. With HTTP/2, browsers open only 1 connection per domain. However, thanks to the multiplexing feature of the HTTP/2 protocol, the number of concurrent requests per domain is not limited to … Read more

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

Your question is somewhat unclear. Assuming “Category” is a root entity and “2,3” are ids (or values of some property of the category”) you can exclude them using the following: Criteria criteria = …; // obtain criteria from somewhere, like session.createCriteria() criteria.add( Restrictions.not( // replace “id” below with property name, depending on what you’re filtering … Read more

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

To add attributes you have to derive by extension, to add facets you have to derive by restriction. Therefore this has to be done in two steps for the element’s child content. The attribute can be defined inline: <xsd:simpleType name=”timeValueType”> <xsd:restriction base=”xsd:token”> <xsd:pattern value=”\d{2}:\d{2}”/> </xsd:restriction> </xsd:simpleType> <xsd:complexType name=”timeType”> <xsd:simpleContent> <xsd:extension base=”timeValueType”> <xsd:attribute name=”format”> <xsd:simpleType> <xsd:restriction … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)