text:
'''
Manage DACLs on Windows

:depends:   - winreg Python module
'''

# Import python libs
from __future__ import absolute_import
import os
import logging

# TODO: Figure out the exceptions that could be raised and properly catch
#       them instead of a bare except that catches any exception at all
#       may also need to add the ability to take ownership of an object to set
#       permissions if the minion is running as a user and not LOCALSYSTEM

# Import salt libs
import salt.utils
from salt.exceptions import CommandExecutionError
from salt.ext.six import string_types
from salt.ext.six.moves import range  # pylint: disable=redefined-builtin

# Import third party libs
try:
    import salt.ext.six.moves.winreg  # pylint: disable=redefined-builtin,no-name-in-module,import-error
    import win32security
    import ntsecuritycon
    HAS_WINDOWS_MODULES = True
except ImportError:
    HAS_WINDOWS_MODULES = False

log = logging.getLogger(__name__)

# Define the module's virtual name
__virtualname__ = 'win_dacl'

class daclConstants(object):
    '''
    dacl constants used throughout the module
    '''
    # Definition in ntsecuritycon is incorrect (does not match winnt.h). The version
    # in ntsecuritycon has the extra bits 0x200 enabled.
    # Note that you when you set this permission what you'll generally get back is it
    # ORed with 0x200 (SI_NO_ACL_PROTECT), which is what ntsecuritycon incorrectly defines.

    def __init__(self):
        self.FILE_ALL_ACCESS = (ntsecuritycon.STANDARD_RIGHTS_REQUIRED | ntsecuritycon.SYNCHRONIZE | 0x1ff)

        self.hkeys_security = {
            'HKEY_LOCAL_MACHINE': 'MACHINE',
            'HKEY_USERS': 'USERS',
            'HKEY_CURRENT_USER': 'CURRENT_USER',
            'HKEY_CLASSES_ROOT': 'CLASSES_ROOT',
            'MACHINE': 'MACHINE',
            'USERS': 'USERS',
            'CURRENT_USER': 'CURRENT_USER',
            'CLASSES_ROOT': 'CLASSES_ROOT',
            'HKLM': 'MACHINE',
            'HKU': 'USERS',
            'HKCU': 'CURRENT_USER',
            'HKCR': 'CLASSES_ROOT',
            }
        self.rights = {
            win32security.SE_REGISTRY_KEY: {
                'READ': {
                    'BITS': salt.ext.six.moves.winreg.KEY_READ,
                    'TEXT': 'read'},
                'FULLCONTROL': {
                    'BITS': salt.ext.six.moves.winreg.KEY_ALL_ACCESS,
                    'TEXT': 'full control'}
            },
            win32security.SE_FILE_OBJECT: {
                'READ': {
                    'BITS': ntsecuritycon.FILE_GENERIC_READ,
                    'TEXT': 'read'},
                'WRITE': {
                    'BITS': ntsecuritycon.FILE_GENERIC_WRITE,
                    'TEXT': 'write'},
                'READ&EXECUTE': {
                    'BITS': ntsecuritycon.FILE_GENERIC_EXECUTE |
                    ntsecuritycon.FILE_GENERIC_READ,
                    'TEXT': 'read and execute'},
                'MODIFY': {
                    'BITS': ntsecuritycon.FILE_GENERIC_WRITE |
                    ntsecuritycon.FILE_GENERIC_READ |
                    ntsecuritycon.FILE_GENERIC_EXECUTE |
                    ntsecuritycon.DELETE,
                    'TEXT': 'modify'},
                'FULLCONTROL': {
                    'BITS': self.FILE_ALL_ACCESS,
                    'TEXT': 'full control'}
            }
        }
        self.validAceTypes = {
            'ALLOW': {'TEXT': 'allowed', 'BITS': 0},
            'DENY': {'TEXT': 'denied', 'BITS': 1}}
        self.validPropagations = {
            win32security.SE_REGISTRY_KEY: {
                'KEY': {
                    'TEXT': 'this key only',
                    'BITS': win32security.NO_INHERITANCE},
                'KEY&SUBKEYS': {
                    'TEXT': 'this key and subkeys',
                    'BITS': win32security.CONTAINER_INHERIT_ACE},
                'SUBKEYS': {
                    'TEXT': 'subkeys only',
                    'BITS': win32security.INHERIT_ONLY_ACE |
                    win32security.CONTAINER_INHERIT_ACE},
                'THIS KEY ONLY': {
                    'TEXT': 'this key only',
                    'BITS': win32security.NO_INHERITANCE},
                'THIS KEY AND SUBKEYS': {
                    'TEXT': 'this key and subkeys',
                    'BITS': win32security.CONTAINER_INHERIT_ACE},
                'SUBKEYS ONLY': {
                    'TEXT': 'subkeys only',
                    'BITS': win32security.INHERIT_ONLY_ACE |
                    win32security.CONTAINER_INHERIT_ACE}
            },
            win32security.SE_FILE_OBJECT: {
                'FILE': {
                    'TEXT': 'this file/folder only',
                    'BITS': win32security.NO_INHERITANCE},
                'FOLDER': {
                    'TEXT': 'this file/folder only',
                    'BITS': win32security.NO_INHERITANCE},
                'FOLDER&SUBFOLDERS&FILES': {
                    'TEXT': 'this folder, subfolders, and files',
                    'BITS': win32security.CONTAINER_INHERIT_ACE |
                    win32security.OBJECT_INHERIT_ACE},
                'FOLDER&SUBFOLDERS': {
                    'TEXT': 'this folder and subfolders',
                    'BITS': win32security.CONTAINER_INHERIT_ACE},
                'FOLDER&FILES': {
                    'TEXT': 'this folder and files',
                    'BITS': win32security.OBJECT_INHERIT_ACE},
                'SUBFOLDERS&FILES': {
                    'TEXT': 'subfolders and files',
                    'BITS': win32security.INHERIT_ONLY_ACE |
                    win32security.CONTAINER_INHERIT_ACE |
                    win32security.OBJECT_INHERIT_ACE},
                'SUBFOLDERS': {
                    'TEXT': 'subfolders only',
                    'BITS': win32security.INHERIT_ONLY_ACE |
                    win32security.CONTAINER_INHERIT_ACE},
                'FILES': {
                    'TEXT': 'files only',
                    'BITS': win32security.INHERIT_ONLY_ACE |
                    win32security.OBJECT_INHERIT_ACE},
                'THIS FILE ONLY': {
                    'TEXT': 'this file/folder only',
                    'BITS': win32security.NO_INHERITANCE},
                'THIS FOLDER ONLY': {
                    'TEXT': 'this file/folder only',
                    'BITS': win32security.NO_INHERITANCE},
                'THIS FOLDER, SUBFOLDERS, AND FILES': {
                    'TEXT': 'this folder, subfolders, and files',
                    'BITS': win32security.CONTAINER_INHERIT_ACE |
                    win32security.OBJECT_INHERIT_ACE},
                'THIS FOLDER AND SUBFOLDERS': {
                    'TEXT': 'this folder and subfolders',
                    'BITS': win32security.CONTAINER_INHERIT_ACE},
                'THIS FOLDER AND FILES': {
                    'TEXT': 'this folder and files',
                    'BITS': win32security.OBJECT_INHERIT_ACE},
                'SUBFOLDERS AND FILES': {
                    'TEXT': 'subfolders and files',
                    'BITS': win32security.INHERIT_ONLY_ACE |
                    win32security.CONTAINER_INHERIT_ACE |
                    win32security.OBJECT_INHERIT_ACE},
                'SUBFOLDERS ONLY': {
                    'TEXT': 'subfolders only',
                    'BITS': win32security.INHERIT_ONLY_ACE |
                    win32security.CONTAINER_INHERIT_ACE},
                'FILES ONLY': {
                    'TEXT': 'files only',
                    'BITS': win32security.INHERIT_ONLY_ACE |
                    win32security.OBJECT_INHERIT_ACE}
            }
        }
        self.reflection_mask = {
            True: salt.ext.six.moves.winreg.KEY_ALL_ACCESS,
            False: salt.ext.six.moves.winreg.KEY_ALL_ACCESS | salt.ext.six.moves.winreg.KEY_WOW64_64KEY,
            }
        self.objectType = {
            'FILE': win32security.SE_FILE_OBJECT,
            'DIRECTORY': win32security.SE_FILE_OBJECT,
            'REGISTRY': win32security.SE_REGISTRY_KEY}

    def getObjectTypeBit(self, t):
        '''
        returns the bit value of the string object type
        '''
        if isinstance(t, string_types):
            t = t.upper()
            try:
                return self.objectType[t]
            except KeyError:
                raise CommandExecutionError((
                    'Invalid object type "{0}".  It should be one of the following:  {1}'
                    ).format(t, ', '.join(self.objectType)))
        else:
            return t

    def getSecurityHkey(self, s):
        '''
        returns the necessary string value for an HKEY for the win32security module
        '''
        try:
            return self.hkeys_security[s]
        except KeyError:
            raise CommandExecutionError((
                'No HKEY named "{0}".  It should be one of the following:  {1}'
                ).format(s, ', '.join(self.hkeys_security)))

    def getPermissionBit(self, t, m):
        '''
        returns a permission bit of the string permission value for the specified object type
        '''
        try:
            if isinstance(m, string_types):
                return self.rights[t][m]['BITS']
            else:
                return m
        except KeyError:
            raise CommandExecutionError((
                'No right "{0}".  It should be one of the following:  {1}')
                .format(m, ', '.join(self.rights[t])))

    def getPermissionText(self, t, m):
        '''
        returns the permission textual representation of a specified permission bit/object type
        '''
        try:
            return self.rights[t][m]['TEXT']
        except KeyError:
            raise CommandExecutionError((
                'No right "{0}".  It should be one of the following:  {1}')
                .format(m, ', '.join(self.rights[t])))

    def getAceTypeBit(self, t):
        '''
        returns the acetype bit of a text value
        '''
        try:
            return self.validAceTypes[t]['BITS']
        except KeyError:
            raise CommandExecutionError((
                'No ACE type "{0}".  It should be one of the following:  {1}'
                ).format(t, ', '.join(self.validAceTypes)))

    def getAceTypeText(self, t):
        '''
        returns the textual representation of a acetype bit
        '''
        try:
            return self.validAceTypes[t]['TEXT']
        except KeyError:
            raise CommandExecutionError((
                'No ACE type "{0}".  It should be one of the following:  {1}'
                ).format(t, ', '.join(self.validAceTypes)))

    def getPropagationBit(self, t, p):
        '''
        returns the propagation bit of a text value
        '''
        try:
            return self.validPropagations[t][p]['BITS']
        except KeyError:
            raise CommandExecutionError((
                'No propagation type of "{0}".  It should be one of the following:  {1}'
                ).format(p, ', '.join(self.validPropagations[t])))

    def getPropagationText(self, t, p):
        '''
        returns the textual representation of a propagation bit
        '''
        try:
            return self.validPropagations[t][p]['TEXT']
        except KeyError:
            raise CommandExecutionError((
                'No propagation type of "{0}".  It should be one of the following:  {1}'
                ).format(p, ', '.join(self.validPropagations[t])))

    def processPath(self, path, objectType):
        '''
        processes a path/object type combo and returns:
            registry types with the correct HKEY text representation
            files/directories with environment variables expanded
        '''
        if objectType == win32security.SE_REGISTRY_KEY:
            splt = path.split("\\")
            hive = self.getSecurityHkey(splt.pop(0).upper())
            splt.insert(0, hive)
            path = r'\\'.join(splt)
        else:
            path = os.path.expandvars(path)
        return path

def _getUserSid(user):
    '''
    return a state error dictionary, with 'sid' as a field if it could be returned
    if user is None, sid will also be None
    '''
    ret = {}
    try:
        sid = win32security.LookupAccountName('', user)[0] if user else None
        ret['result'] = True
        ret['sid'] = sid
    except Exception as e:
        ret['result'] = False
        ret['comment'] = 'Unable to obtain the security identifier for {0}.  The exception was {1}.'.format(
            user, e)
    return ret

def __virtual__():
    '''
    Only works on Windows systems
    '''
    if salt.utils.is_windows() and HAS_WINDOWS_MODULES:
        return __virtualname__
    return (False, "Module win_dacl: module only works on Windows systems")

def _get_dacl(path, objectType):
    '''
    gets the dacl of a path
    '''
    try:
        dacl = win32security.GetNamedSecurityInfo(
            path, objectType, win32security.DACL_SECURITY_INFORMATION
            ).GetSecurityDescriptorDacl()
    except Exception:
        dacl = None
    return dacl

def get(path, objectType, user=None):
    '''
    Get the acl of an object. Will filter by user if one is provided.
    '''
    ret = {'Path': path,
           'ACLs': []}

    sidRet = _getUserSid(user)

    if path and objectType:
        dc = daclConstants()
        objectTypeBit = dc.getObjectTypeBit(objectType)
        path = dc.processPath(path, objectTypeBit)
        tdacl = _get_dacl(path, objectTypeBit)
        if tdacl:
            for counter in range(0, tdacl.GetAceCount()):
                tAce = tdacl.GetAce(counter)
                if not sidRet['sid'] or (tAce[2] == sidRet['sid']):
                    ret['ACLs'].append(_ace_to_text(tAce, objectTypeBit))
    return ret

def add_ace(path, objectType, user, permission, acetype, propagation):
    r'''
    add an ace to an object

    path:  path to the object (i.e. c:\\temp\\file, HKEY_LOCAL_MACHINE\\SOFTWARE\\KEY, etc)
    user: user to add
    permission:  permissions for the user
    acetype:  either allow/deny for each user/permission (ALLOW, DENY)
    propagation: how the ACE applies to children for Registry Keys and Directories(KEY, KEY&SUBKEYS, SUBKEYS)

    CLI Example:

    .. code-block:: bash

        allow domain\fakeuser full control on HKLM\\SOFTWARE\\somekey, propagate to this key and subkeys
            salt 'myminion' win_dacl.add_ace 'HKEY_LOCAL_MACHINE\\SOFTWARE\\somekey' 'Registry' 'domain\fakeuser' 'FULLCONTROL' 'ALLOW' 'KEY&SUBKEYS'
    '''
    ret = {'result': None,
           'changes': {},
           'comment': ''}

    if (path and user and
            permission and acetype
            and propagation):
        if objectType.upper() == "FILE":
            propagation = "FILE"
        dc = daclConstants()
        objectTypeBit = dc.getObjectTypeBit(objectType)
        path = dc.processPath(path, objectTypeBit)
        user = user.strip()
        permission = permission.strip().upper()
        acetype = acetype.strip().upper()
        propagation = propagation.strip().upper()

        sidRet = _getUserSid(user)
        if not sidRet['result']:
            return sidRet
        permissionbit = dc.getPermissionBit(objectTypeBit, permission)
        acetypebit = dc.getAceTypeBit(acetype)
        propagationbit = dc.getPropagationBit(objectTypeBit, propagation)
        dacl = _get_dacl(path, objectTypeBit)

        if dacl:
            acesAdded = []
            try:
                if acetypebit == 0:
                    dacl.AddAccessAllowedAceEx(win32security.ACL_REVISION, propagationbit, permissionbit, sidRet['sid'])
                elif acetypebit == 1:
                    dacl.AddAccessDeniedAceEx(win32security.ACL_REVISION, propagationbit, permissionbit, sidRet['sid'])
                win32security.SetNamedSecurityInfo(
                    path, objectTypeBit, win32security.DACL_SECURITY_INFORMATION,
                    None, None, dacl, None)
                acesAdded.append((
                    '{0} {1} {2} on {3}'
                    ).format(
                    user, dc.getAceTypeText(acetype), dc.getPermissionText(objectTypeBit, permission),
                    dc.getPropagationText(objectTypeBit, propagation)))
                ret['result'] = True
            except Exception as e:
                ret['comment'] = 'An error occurred attempting to add the ace.  The error was {0}'.format(e)
                ret['result'] = False
                return ret
            if acesAdded:
                ret['changes']['Added ACEs'] = acesAdded
        else:
            ret['comment'] = 'Unable to obtain the DACL of {0}'.format(path)
    else:
        ret['comment'] = 'An empty value was specified for a required item.'
        ret['result'] = False
    return ret

def rm_ace(path, objectType, user, permission=None, acetype=None, propagation=None):
    r'''
    remove an ace to an object

    path:  path to the object (i.e. c:\\temp\\file, HKEY_LOCAL_MACHINE\\SOFTWARE\\KEY, etc)
    user: user to remove
    permission:  permissions for the user
    acetypes:  either allow/deny for each user/permission (ALLOW, DENY)
    propagation: how the ACE applies to children for Registry Keys and Directories(KEY, KEY&SUBKEYS, SUBKEYS)

    If any of the optional parameters are omitted (or set to None) they act as wildcards.

    CLI Example:

    .. code-block:: bash

        remove allow domain\fakeuser full control on HKLM\\SOFTWARE\\somekey propagated to this key and subkeys
            salt 'myminion' win_dacl.rm_ace 'Registry' 'HKEY_LOCAL_MACHINE\\SOFTWARE\\somekey' 'domain\fakeuser' 'FULLCONTROL' 'ALLOW' 'KEY&SUBKEYS'
    '''
    ret = {'result': None,
           'changes': {},
           'comment': ''}

    if path and user:
        dc = daclConstants()
        if propagation and objectType.upper() == "FILE":
            propagation = "FILE"
        objectTypeBit = dc.getObjectTypeBit(objectType)
        path = dc.processPath(path, objectTypeBit)

        user = user.strip()
        permission = permission.strip().upper() if permission else None
        acetype = acetype.strip().upper() if acetype else None
        propagation = propagation.strip().upper() if propagation else None

        if check_ace(path, objectType, user, permission, acetype, propagation, True)['Exists']:
            sidRet = _getUserSid(user)
            if not sidRet['result']:
                return sidRet
            permissionbit = dc.getPermissionBit(objectTypeBit, permission) if permission else None
            acetypebit = dc.getAceTypeBit(acetype) if acetype else None
            propagationbit = dc.getPropagationBit(objectTypeBit, propagation) if propagation else None
            dacl = _get_dacl(path, objectTypeBit)
            counter = 0
            acesRemoved = []
            while counter < dacl.GetAceCount():
                tAce = dacl.GetAce(counter)
                if (tAce[0][1] & win32security.INHERITED_ACE) != win32security.INHERITED_ACE:
                    if tAce[2] == sidRet['sid']:
                        if not acetypebit or tAce[0][0] == acetypebit:
                            if not propagationbit or ((tAce[0][1] & propagationbit) == propagationbit):
                                if not permissionbit or tAce[1] == permissionbit:
                                    dacl.DeleteAce(counter)
                                    counter = counter - 1
                                    acesRemoved.append(_ace_to_text(tAce, objectTypeBit))

                counter = counter + 1
            if acesRemoved:
                try:
                    win32security.SetNamedSecurityInfo(
                        path, objectTypeBit, win32security.DACL_SECURITY_INFORMATION,
                        None, None, dacl, None)
                    ret['changes']['Removed ACEs'] = acesRemoved
                    ret['result'] = True
                except Exception as e:
                    ret['result'] = False
                    ret['comment'] = 'Error removing ACE.  The error was {0}.'.format(e)
                    return ret
        else:
            ret['comment'] = 'The specified ACE was not found on the path.'
    return ret

def _ace_to_text(ace, objectType):
    '''
    helper function to convert an ace to a textual representation
    '''
    dc = daclConstants()
    objectType = dc.getObjectTypeBit(objectType)
    try:
        userSid = win32security.LookupAccountSid('', ace[2])
        if userSid[1]:
            userSid = '{1}\\{0}'.format(userSid[0], userSid[1])
        else:
            userSid = '{0}'.format(userSid[0])
    except Exception:
        userSid = win32security.ConvertSidToStringSid(ace[2])
    tPerm = ace[1]
    tAceType = ace[0][0]
    tProps = ace[0][1]
    tInherited = ''
    for x in dc.validAceTypes:
        if dc.validAceTypes[x]['BITS'] == tAceType:
            tAceType = dc.validAceTypes[x]['TEXT']
            break
    for x in dc.rights[objectType]:
        if dc.rights[objectType][x]['BITS'] == tPerm:
            tPerm = dc.rights[objectType][x]['TEXT']
            break
    if (tProps & win32security.INHERITED_ACE) == win32security.INHERITED_ACE:
        tInherited = '[Inherited]'
        tProps = (tProps ^ win32security.INHERITED_ACE)
    for x in dc.validPropagations[objectType]:
        if dc.validPropagations[objectType][x]['BITS'] == tProps:
            tProps = dc.validPropagations[objectType][x]['TEXT']
            break
    return ((
        '{0} {1} {2} on {3} {4}'
        ).format(userSid, tAceType, tPerm, tProps, tInherited))

def _set_dacl_inheritance(path, objectType, inheritance=True, copy=True, clear=False):
    '''
    helper function to set the inheritance
    '''
    ret = {'result': False,
           'comment': '',
           'changes': {}}

    if path:
        try:
            sd = win32security.GetNamedSecurityInfo(path, objectType, win32security.DACL_SECURITY_INFORMATION)
            tdacl = sd.GetSecurityDescriptorDacl()
            if inheritance:
                if clear:
                    counter = 0
                    removedAces = []
                    while counter < tdacl.GetAceCount():
                        tAce = tdacl.GetAce(counter)
                        if (tAce[0][1] & win32security.INHERITED_ACE) != win32security.INHERITED_ACE:
                            tdacl.DeleteAce(counter)
                            removedAces.append(_ace_to_text(tAce, objectType))
                        else:
                            counter = counter + 1
                    if removedAces:
                        ret['changes']['Removed ACEs'] = removedAces
                else:
                    ret['changes']['Non-Inherited ACEs'] = 'Left in the DACL'
                win32security.SetNamedSecurityInfo(
                    path, objectType,
                    win32security.DACL_SECURITY_INFORMATION | win32security.UNPROTECTED_DACL_SECURITY_INFORMATION,
                    None, None, tdacl, None)
                ret['changes']['Inheritance'] = 'Enabled'
            else:
                if not copy:
                    counter = 0
                    inheritedAcesRemoved = []
                    while counter < tdacl.GetAceCount():
                        tAce = tdacl.GetAce(counter)
                        if (tAce[0][1] & win32security.INHERITED_ACE) == win32security.INHERITED_ACE:
                            tdacl.DeleteAce(counter)
                            inheritedAcesRemoved.append(_ace_to_text(tAce, objectType))
                        else:
                            counter = counter + 1
                    if inheritedAcesRemoved:
                        ret['changes']['Removed ACEs'] = inheritedAcesRemoved
                else:
                    ret['changes']['Previously Inherited ACEs'] = 'Copied to the DACL'
                win32security.SetNamedSecurityInfo(
                    path, objectType,
                    win32security.DACL_SECURITY_INFORMATION | win32security.PROTECTED_DACL_SECURITY_INFORMATION,
                    None, None, tdacl, None)
                ret['changes']['Inheritance'] = 'Disabled'
            ret['result'] = True
        except Exception as e:
            ret['result'] = False
            ret['comment'] = 'Error attempting to set the inheritance.  The error was {0}.'.format(e)

    return ret

def enable_inheritance(path, objectType, clear=False):
    '''
    enable/disable inheritance on an object

    clear = True will remove non-Inherited ACEs from the ACL
    '''
    dc = daclConstants()
    objectType = dc.getObjectTypeBit(objectType)
    path = dc.processPath(path, objectType)

    return _set_dacl_inheritance(path, objectType, True, None, clear)

def disable_inheritance(path, objectType, copy=True):
    '''
    disable inheritance on an object

    copy = True will copy the Inerhited ACEs to the DACL before disabling inheritance
    '''
    dc = daclConstants()
    objectType = dc.getObjectTypeBit(objectType)
    path = dc.processPath(path, objectType)

    return _set_dacl_inheritance(path, objectType, False, copy, None)

def check_inheritance(path, objectType, user=None):
    '''
    check a specified path to verify if inheritance is enabled
    returns 'Inheritance' of True/False

    path: path of the registry key or file system object to check
    user: if provided, will consider only the ACEs for that user
    '''

    ret = {'result': False,
           'Inheritance': False,
           'comment': ''}

    sidRet = _getUserSid(user)

    dc = daclConstants()
    objectType = dc.getObjectTypeBit(objectType)
    path = dc.processPath(path, objectType)

    try:
        sd = win32security.GetNamedSecurityInfo(path, objectType, win32security.DACL_SECURITY_INFORMATION)
        dacls = sd.GetSecurityDescriptorDacl()
    except Exception as e:
        ret['result'] = False
        ret['comment'] = 'Error obtaining the Security Descriptor or DACL of the path: {0}.'.format(e)
        return ret

    for counter in range(0, dacls.GetAceCount()):
        ace = dacls.GetAce(counter)
        if (ace[0][1] & win32security.INHERITED_ACE) == win32security.INHERITED_ACE:
            if not sidRet['sid'] or ace[2] == sidRet['sid']:
                ret['Inheritance'] = True
                break

    ret['result'] = True
    return ret

def check_ace(path, objectType, user, permission=None, acetype=None, propagation=None, exactPermissionMatch=False):
    '''
    checks a path to verify the ACE (access control entry) specified exists
    returns 'Exists' true if the ACE exists, false if it does not

    path:  path to the file/reg key
    user:  user that the ACL is for
    permission:  permission to test for (READ, FULLCONTROl, etc)
    acetype:  the type of ACE (ALLOW or DENY)
    propagation:  the propagation type of the ACE (FILES, FOLDERS, KEY, KEY&SUBKEYS, SUBKEYS, etc)
    exactPermissionMatch:  the ACL must match exactly, IE if READ is specified, the user must have READ exactly and not FULLCONTROL (which also has the READ permission obviously)

    '''
    ret = {'result': False,
           'Exists': False,
           'comment': ''}

    dc = daclConstants()
    objectTypeBit = dc.getObjectTypeBit(objectType)
    path = dc.processPath(path, objectTypeBit)

    permission = permission.upper() if permission else None
    acetype = acetype.upper() if permission else None
    propagation = propagation.upper() if propagation else None

    permissionbit = dc.getPermissionBit(objectTypeBit, permission) if permission else None
    acetypebit = dc.getAceTypeBit(acetype) if acetype else None
    propagationbit = dc.getPropagationBit(objectTypeBit, propagation) if propagation else None

    sidRet = _getUserSid(user)
    if not sidRet['result']:
        return sidRet

    dacls = _get_dacl(path, objectTypeBit)
    ret['result'] = True
    if dacls:
        for counter in range(0, dacls.GetAceCount()):
            ace = dacls.GetAce(counter)
            if ace[2] == sidRet['sid']:
                if not acetypebit or ace[0][0] == acetypebit:
                    if not propagationbit or (ace[0][1] & propagationbit) == propagationbit:
                        if not permissionbit:
                            ret['Exists'] = True
                            return ret
                        if exactPermissionMatch:
                            if ace[1] == permissionbit:
                                ret['Exists'] = True
                                return ret
                        else:
                            if (ace[1] & permissionbit) == permissionbit:
                                ret['Exists'] = True
                                return ret
    else:
        ret['comment'] = 'No DACL found for object.'
    return ret


This is an intervention, y'all. It's time to stop.
You guys. We need to stop for a second and think about the things we've been saying regarding the current state of the Mets and their front office. We're contradicting ourselves with tweets and statements that will age poorly. Trust me, I know. Rays fans are still letting me have it after suggesting trading 2018 Cy Young Winner Blake Snell. Your words will not age like a fine wine.
My point here is this, we cannot sit in the stands at Citi Field cursing the Wilpons and the Front Office for not making moves and bettering the team, for trotting out cheap and inefficient players, and throwing money at guys likes Jason Vargas, Todd Frazier, and Jay Bruce, all of whom are being paid for their talents at their ceiling, for not taking the time to think about the consequences of their actions. We can't do all of that and then sit here and bemoan the loss of top prospects.
This is how a big market ball club operates. And for years we've been screaming at the top of our lungs to become a big market ball club.
Think about the 2018 World Champion Boston Red Sox, who traded away their entire farm system, including the MLB's #1 prospect Yoan Moncada, for Chris Sale. Sale was an intregal part to the Red Sox road to a World Series ring in both of his years in Boston. He was worth the trade even if they gave up the future.
The Red Sox then let their young studs in Mookie Betts, Xander Bogaerts, Andrew Benintendi and Rafael Devers, off the leash to wreak havoc on the AL East.
Yes, they spent the money on J.D. Martinez, David Price, and Rick Porcello, but they also spent money on Pablo Sandoval and Rusney Castillo. That was dumb money for the latter.
But the prospects were sent away for the missing piece: Chris Sale.
The Cubs similarly let go of some top-tier prospects on their way to the 2016 World Series, sending 2018 Rookie of the Year finalist Gleyber Torres to the Yankees in a deal for Aroldis Chapman. They also shipped Dan Vogelbach to the Mariners, a guy Seattle believes to be their future at first base… whenever he decides to show up.
Also in 2016, the Cleveland Indians sent Clint Frazier and Justus Sheffield to the Yankees in exchange for the services of Andrew Miller, who was a key component to their 2016 World Series run. That deal was insane when it happened, but it panned out well for the Tribe, despite their extra inning defeat in Game 7.
Justus Sheffield was then sent to the Mariners as the big piece in the trade that sent James Paxton to the Yankees.
The Milwaukee Brewers landed Christian Yelich by sending four prospects, Lewis "Future of the Marlins" Brinson, and the current #2, #9 and #17 players in the Marlins system, down to Miami. Christian Yelich goes on to win the 2018 MVP. The Brewers come within one game of the World Series after making the playoffs for the first time since 2011.
Hell, even more recently, Manny Machado was shipped to Los Angeles for FIVE players, four of which are within the Orioles current top 30 prospects, including their #1: Yusniel Diaz.
This is a move that a big market ballclub makes.
At what point do we decide what kind of team we want to be? Do we want to the Minnesota Twins? Or do we want to play with the big dogs, like the one in the Bronx? You cannot have it both ways. You gotta pick one.
So if, as expected, the trade is finalized Fri it will be Diaz, Cano, $ to offset some of Cano's contract for Bruce/Swarzak/Kelenic/Dunn/Bautista. Bruce and Swarzak are owed $39M.
Jared Kelenic was drafted this year, with an MLB ETA of 2022. Justin Dunn would have to shoe-horn himself into what could be the best rotation in baseball.
You know who the Mets still have? Jacob deGrom, Noah Syndergaard, Zack Wheeler, JEFF MCNEIL, Michael Conforto, Brandon Nimmo, Amed Rosario and will soon have Peter Alonso, the #1 first base prospect in the game.
Once this deal is done they'll have an elite closer, arguably the best in the game, who'll be under team control for the next four years. The Mets also get a top 10 second baseman, something they haven't had in a long time.
It's worth it, you guys.
This team is young as hell, and Jared Kelenic won't reach the majors for another 3 years. When he does, all the guys mentioned above will be in their PRIME.
Also, take a look at Luis Santana, the Mets #26 prospect. Santana tore up the Appalachian League and put up better offensive numbers than his teammate, Jared Kelenic. Santana also did all of that for much less money.
You're upset about losing one guy, and I get that. Kelenic was good in the Gulf Coast League, but didn't continue that success in Kingsport. Regardless, the kid has a lot of potential. Think of it like this: without winning games now, all the guys I named could walk to a winning club once their time in Queens is up. I'd rather keep them here with rings. I'd rather give them a connection to this city and to all of us fans than see them win in a jersey that's not Orange and Blue.
Prospects are casualties of Big Market Clubs making Big Market moves.
You cannot have it both ways, you guys.
Mets Fans During the Season: We're a big market city, why can't we act like a big market team?
Mets Fans, When The Mets Act Like a Big Market Team: Why are we losing all our cheap prospects for expensive talent?
You can't have it both ways. Prospects get dealt for big players.
When you want to be a big dog, you have to start trading like a big dog.


text:
Q: datatype conversion without using buildExpressionParser I am stuck at a point in converting a expression entered by the user to my own datatype
I did it using biuldExpressionParser , but using simple parser and recursion  I did as follows
 openBrace = char '('

 closeBrace :: GenParser Char st Char
 closeBrace = char ')'

bracketExpr = do
            spaces >> openBrace
            expr <- expressionParser
            spaces >> closeBrace
            return expr

bracketExpr will return the entered expression in my own datatype
to convert it into my datatype I did for negation,if expression is a number or a variable as follows:
 expressionParser = negate1
                 <|> number
                 <|> variable
                 --<|> addition
                 <?> "simple expression"

 negate1 :: Parser Expr
 negate1 = do{ char '-'
             ;ds <-  number
             ;return (ExprNeg (ds) )
             }
        <?> "negate"

variable :: Parser Expr
variable = do{ ds<- many1 (letter <|> digit)
             ; return (ExprVar ds)}
         <?> "variable"

number :: Parser Expr
number = do{ ds<- many1 digit
           ; return (ExprNum (read ds))}
          <?> "number"

To do the same for addtion I tried by seperating the expression using sepBy but I am encountering several issues.
If the extered expreesion is 1+2
Then I should getExprAdd (ExprNum 1) (ExprNum 2)
I am unable to proceed further from here .Help would be great.
Thank you.

A: If you want to be writing a parser with parser combinators you need to think in terms of high-level rules first. Here's a skeleton parser in Parsec; it does not 100% meet your needs because all of the operators are same-precedence and right-associative, whereas you probably want different precedences and left-associativity. Still, this is the basic way to write a parser:
import Text.Parsec
import Text.Parsec.Char
import Data.Char (isDigit)

-- basic data type
data Expr = Op Char Expr Expr | N Integer deriving (Show)
type Parser x = Parsec String () x

-- reverse-sequenced >>, used to implement `parenthesized` and `whitespaced`
(<<) :: Monad m => m x -> m y -> m x
mx << my = mx >>= \x -> my >> return x
infixl 1 <<

parenthesized :: Parser e -> Parser e
parenthesized e = char '(' >> e << char ')'

whitespaced :: Parser e -> Parser e
whitespaced e = spaces >> e << spaces

number :: Parser Expr
number = do
    c <- oneOf "123456789" -- leading 0's can be reserved for octal/hexadecimal
    cs <- many digit
    return (N (read (c:cs)))

operator :: Parser Expr
operator = do
    e1 <- expr_no_op
    o <- whitespaced (oneOf "+*/-")
    e2 <- expression
    return (Op o e1 e2)

expr_no_op :: Parser Expr
expr_no_op = whitespaced (try number <|> parenthesized expression)

expression :: Parser Expr
expression = whitespaced (try operator <|> try number <|> parenthesized expression)

Notice that you define tokens (above, just 'number') and then combine them with a "try this <|> try that <|> otherwise..." syntax. Notice also that you have to stop operator from taking an expression as its first argument otherwise you'll get a operator -> expression -> operator loop in the parsing. This is called "left factoring."

redpajama_set_name: RedPajamaStackExchange


← Our new book is published!
Chandi is probably best known for her appearances on Britain's Got Talent in 2010 – we received a standing ovation from the judges at our audition then went onto win our semi final with the second largest public vote of the series (a staggering 58.2%), and eventually placed fourth overall in the Final.
Winning our semi final on BGT!
Britain's Got Talent (BGT) was not the first show we did together though … we have been competing in Heelwork to Music and Freestyle competitions (dog dancing!) since 1999, and Chandi quickly became a force to be reckoned with!
Having fished Chandi out of the dog pound in 1997, we won the inaugural Crufts HTM/Freestyle Final in 2005 and then clocked up an impressive hat trick of wins in 2009 at Crufts, winning all three HTM, Freestyle and International Freestyle Finals in the same year setting three records (that still remain): first dog to win a total of four Crufts titles; first dog to win both HTM and Freestyle at the same Crufts; and first dog to win all three Finals in the same year!
Winning the International Freestyle competition on the final day!
Crufts is the ultimate dream for many dog trainers around the world – you get to compete against the best in your sport and these four Crufts titles are definitely our proudest moment. Bear in mind that Chandi was a former pound hound and I paid just £10 for the honour of taking her home with me. In fact, maybe that should be *four* records we hold – only rescue dog to win four titles in HTM and Freestyle at Crufts …!
For many weeks before our book was officially released on March 29, 2012, it was at number one in 'hot new release dog books'. Last week we reached the dizzy heights of number nine in 'dog books' just a few days after it was released, and we are currently at number 8!
"This is a memoir with the very widest appeal … you don't have to be an animal lover to fall for Tina Humphrey and Chandi. Theirs is a heart-warming and often humorous story of pain and perseverance, resilience and mutual reliance, grief and glamour, work and play, love and selflessness.
Photo shoot for Dogs Today Magazine – taken by Tim Rose.
Our book 'Chandi: the rescue dog who stole a nation's heart' is available in both paperback and Kindle edition, from Waterstones, WHSmith, click here to buy from Amazon.co.uk, and all good book stores, including Burway Books in Church Stretton.
We will also be signing at Waterstones in Macclesfield and Croydon, but dates and times are yet to be confirmed.
If you would like to join our page on Facebook, click here.
2 Responses to Our new book is published!
just been reading the book on the train to aberysthwyth and think its a proper nice story. the way she talks about chandi is something i can relate to, because i felt the same affinity with my dog called Frodo, they were good days. all the best for the future, hope she does a book signnig in shrewsbury sometime.


Some residents in Nahant, Massachusetts, are trying to stop plans for a new Northeastern University science center on East Point, saying it will increase pollution and wipe out animal habitats.
On virtually every street in Nahant, Massachusetts, you'll find messages of pride and passion.
"I think the tiniest towns in Massachusetts are the most passionate towns in Massachusetts," said Susanne Macarelli, who called 'Talk to Ten' late last month.
Macarelli was born in the tiny North Shore town, and is one of the hundreds of residents trying to stop plans for a new Northeastern University science center on East Point, located at the very tip of the community.
For many, East Point is treasured.
One of our NBC10 Boston viewers received quite the surprise recently when she couldn't get a loan because someone had opened an Eversource energy account in her name.
Dr. Marie Pasinski, who lives nearby, described it as "the most scenic vista in all of Nahant."
Decades ago, East Point was a military installation. Eventually, ownership was transferred in part to Northeastern University.
Inside the war-time bunkers it opened a Marine Science Center, focused on marine research and teaching. Sitting next to the Marine Science Center is Lodge Park, which is owned by the Town of Nahant.
Northeastern's facility in town drew little opposition for years. But that changed in February 2018, when the University suddenly unveiled plans for a new 60,000-square-foot science center.
Geoffrey Trussell, the director of the Marine Science Center, admits "we really got off on the wrong foot, so that's on us."
An NBC10 Boston viewer in Boston's Roxbury neighborhood reached out to let us know one of her neighbors won't do their part in shoveling. Yma Arrington has been calling that neighbor, Eversource, for years but it took a call from us to get action.
He hopes the new center, which will roughly double the capabilities of the current facility, can focus on things like climate change, sea level rise, and fisheries exploitation.
"We see this institute as addressing some really fundamental problems that are a threat to the nation's security," Trussell adds.
In the wake of last year's outcry, Northeastern changed its original plans, and in December presented three new possible layout options.
In each case, the new building would sit on top of the existing bunker, a key concern amongst opponents.
Many of those opponents say by building the facility on top of the bunker, it will increase light pollution, and will wipe out plants and nearby animal habitats.
"You can't not see the irony in this," says Jeff Musman, a resident nearby who says a center designed to study the environment shouldn't harm it.
In response, developers say that's the only spot where they can build while adhering to local wetlands rules, while also offering the required parking as dictated by the town.
"The last thing we would want to do is embark on a project that's going to be bad for the environment," Trussell notes.
Trussell goes a step further, saying that many of the plants on the property now are invasive, or non-native to the area. He says they grew up after the military cleared the land many years ago.
"Why didn't they manage them before?" Linda Pivacek asked in response, while talking to NBC10 Boston. "It's hard for me to think that they'll do it now."
Pivacek is an avid birder, and goes on to explain her concern about the impact of this new building on various species that frequent East Point.
"The birds are migrating down the coast, and they land here. It's a great spot for them," she says.
In response, Trussell says, "We see this as a great opportunity to actually restore the native species composition out here and as a result enhance the ecological functioning."
He adds that after hearing concerns from birders, and other residents, both about the threat to animals and light pollution, the design of the building is now likely to involve less glass.
Another major area of concern involves traffic. Residents say the construction of this new facility, and the fact that more staff and students will work out of the building, may tie up local roads, or threaten the town's fragile infrastructure.
The first traffic study conducted by the University determined that right now, 2 percent of the total traffic that enters Nahant goes to the Marine Science Center. Northeastern says it will conduct more studies going forward at various times of the year.
Numerous residents also said Northeastern has ignored some of their suggestions, or refused to answer questions.
Vi Patek said she reached out to the University on several occasions.
"It was absolute silence. No reply to my letter, which I sent by email and by paper," Patek said.
She adds that her comments raised at three different public meetings were also not addressed.
Trussell says the University is listening, and points to changes in the plans as evidence that action is being taken based on feedback.
He does add, however, that "there are some questions that folks ask in terms of our financial model or business model that we're just not going to get into."
Water discharges from the Marine Science Center have been the focus of much questioning, particularly by Nahant's fishing community.
Some have suggested that water being sent from the Center, back into the ocean, has warmed the temperature of the nearby sea.
"In collaboration with the Department of Environmental Protection, since mid-March we have been monitoring seawater intake and discharge temperatures in Bathing Beach Cove. The data reveal that neither our current system nor our proposed future system will lead to elevated water temperatures in the cove. Furthermore, our proposed subsurface design will discharge farther out, beyond Bathing Beach."
A spokesperson said, "The Marine Science Center conducted this monitoring and has submitted information to the EPA and MassDEP for further evaluation. At this time, EPA and MassDEP have not made a determination on the potential impacts of the discharge."
Thinking big picture, residents freely admit that this is a battle that may take some time.
"You're talking a David and Goliath kind of story," Musman says, referencing Northeastern's deep financial pockets, compared to the small budget of Nahant.
In spite of that, he expects "that people will continue to try to fight this." Musman adds that few residents are against the scientific mission of the Marine Science Center, but rather the way in which this particular project is playing out.
For his part, Trussell is hoping for further compromise.
"I'm hoping that we can find some harmony here, so that we can do the good science and education that's going to be a benefit to not only Nahant but to other coastal communities, and the town can look at this institute as something they're proud of," Trussell said.


Okay, look, this may be a bit out there, but I know there are people who are utilizing all of the assists available to post up these ridiculously low lap times meanwhile the rest of us simracers are pushing track times 10-15 seconds or even more behind them. I'm putting down the absolute best possible outcome in every corner on some maps and my times come no where near the top leaders... Then I realized... Oh, that's right, people play this game with assists and don't have to deal with clutching a 5 speed gearbox through a 16 turn Nuerburgring lap.
Look, pCars team, please help us separate the leaderboards by Assists vs. No Assists. I know you want to attract all crowds, and I also know this game is more "simcade" than "simracing"... But it's definitely not marketed as so, and you do have players that take this game very seriously in many respects. I enjoy every minute that I play, but when I rail every turn perfectly and end up with a 2:21 time vs. the best time on the map is 2:05... I know the person who achieved that time has GOT to be using assists, if not, at the very least using an automatic clutch and shifter.
True, more filtering options (either ingame or through an external website) would be great.
I honestly thought this would have been an obvious thing to do, really. Either separate lists, or have all the times with 'real' and 'no assists' ranked first, and then the rest with assist ranked afterwords. I turned on the assists and hacked a second off my best lap my first lap out, and it moved me up the leaderboard. Not much point to a leaderboard if you mix those who are only doing a portion of the driving with those who are driving the cars as they would be in real life, or with no assists at all.
Real life racing all use somekind of assists, so deal with it your slower without tcs etc then accept your place, otherwise put on some assists n if its so easy go take 20 sec off your time lol...you'll be lucky to find 1sec lol...no assist drivers always think there better than they actually are, fact.
Real life racing all use some kind of assists, so deal with it your slower without tcs etc then accept your place, otherwise put on some assists n if its so easy go take 20 sec off your time lol...you'll be lucky to find 1sec lol...no assist drivers always think there better than they actually are, fact.
If you have assists on your car that it doesn't have in real life, you really aren't driving that car, but instead are driving a non-existant car with artificial advantages over the rest.
But, thats neither here nor there. If someone wants to use all the assists and make the game easier than reality they should be free to do so, but it should be noted in the record books. Most all sports maintain different time sheets/records books for different classes and level of assists and modifications. Pcars should do the same and acknowledge the level of skill required to drive the cars as found in reality.
you do realise that often having no assists is quicker than with having assists... if other guys are leaving you in the dust and you have a perfect lap it can be off two things.
:When coming to the top of the Leaderboards your setup/tune plays a bit part.
Sometimes, yes. But when you are driving a formula A for car for example where your downforce is dependent on speed and your weight to HP ratio is very high, a computer controlling something like traction control makes you consistantly faster than a human. Its one of the reasons it was removed from formula one, and why they don't allow automatics and such. There would be no contest between a human with human limitations and a computer that senses any wheel slip many, many times a second and instantly corrects, while keeping your wheels from locking in similar fashion, etc. All of this allows the driver using unreal assists to place more focus on racing lines, etc because they don't have to worry nearly as much about throttle control, break control, shift points, and so on.
Now, if they factored this into the assists and placed a limitation on what you can do with them as some games do, then its a non-issue. But if adding traction control to a car that never had it makes it behave like a high performance car with high performance traction control, then their lap record should indicate it was done with additional assists, and that it is not a simulation of a fast lap done with that car with its accompanying real world abilities. If its a case of the latter, then there should definitely be two separate time sheets, one for real/no assists, and the other for an open/modified class that would allow the modifications necessary to add those things to cars that didn't have them stock.
This is assuming of course that Pcars wishes to be taken seriously as a simulator rather than being viewed as just another Shift type arcade game.
No assists will be faster, just wait and see as the tunes get better. Trust me on this.


Find out more by requesting a call back!
If you are not suited then that is fine!
Just know that this event is for guys who are keen to get along with each other in an environment where everybody can feel open to discuss issues that are needed to be addressed in order to reach the health and wellness goals they have.
What is this retreat all about anyway?


We can naturally produce your entire range of equipment.
Do you require complete modules? No problem, we will assemble, test and pack your products according to your requirements and naturally in observance of the strictest quality criteria. Have a word with us. We will be pleased to prepare a quote for your individual modules!


541 Art Space presents its latest collaborative exhibit, Rhythm. This unique exhibition explores the boundaries of art, translating sound and landscape into abstract compositions. Starting at 6pm on Friday 24 February, guests are invited to make their way the opening night of the exhibition, concealed and waiting in the state of the art gallery at 1/541 Kent Street. Complimentary drinks will be available at the event, which will run until 8pm.
A film festival dedicated to saving the world debuts in Sydney—Transitions Film Festival, which is part of the Sustainable Living Festival Australia, offers inspirational documentaries on people and ideas that are leading the way towards a better world. Sydney screenings are happening at the Zenith Theatre, Hayden Orpheum, Dendy Newtown and Concourse Urban Screen. Films fall into roughly three groups: stories of innovation, stories of business, and stories of people power. Topics range from wellness to tackling climate change to immortality and the future of work and death.
'This Is Where They Travelled' profiles the lives of a number of Aboriginal people who lived around the coastal part of Sydney between the early 1800s and the 1930s. To outsiders, these people seemed to have lost the 'authentic' Aboriginality of their ancestors. However their travel tells a different story, as they continued to move, marry and live almost exclusively within areas which they were connected to by ancestry.
Enjoy the end of summer at The Spot Festival - a splendid multicultural celebration of culture, food and live music. There will also be plenty of free kids activities, cultural performances on the Harmony Day stage, tarot readings and a much-loved pizza eating competition. The Spot Festival is held at the corner of St Pauls Street and Perouse Road, Randwick, on Sunday 5 March 2017 from 1pm - 8pm.
Experience the Burrawang Walk in the Kamay Botany Bay National Park with Community Cultural Leader and Elder, Dean Kelly, who will connect you to the area's extensive Aboriginal history. Learn traditional medicine and bush tucker, how to play the clap sticks, and how to throw a boomerang. A catered lunch by Fred's Bush Tucker is included. The event is held on Tuesday 7 March from 9:45 a.m. to 2 p.m. It is free of charge but booking is required.


Here is my #WednesdayWishlist for this week. Just a few accessories for the Playstation4 I feel could improve my PS4 gaming experience.
A device designed to link your Dualshock4 to your smartphone. This can be used either to play smartphone games or far more importantly to play your PS4 games on your mobile if used in conjunction with the PS4 Remote Play App. Great if there are no TVs available for your gaming session.
This accessory has a slick visual design to accompany a slick function. Wirelessly charges up to two Dualshock4 controllers upon contact with the mat. A cool way to charge your controllers when you're not using them.
You can stream your PS4 games via this device to the bedroom TV so you can carry on gaming when the main TV is being used to watch Come Dine With Me… this has the potential to avoid many arguments.
The PlayStation TV's price keeps dropping and dropping. I am just waiting for the lowest of low price before purchasing. That charging mat looks extremely slick.
When The PlayStation TV first came out, I definitely thought the price was too high for what it delivered. I do feel that the price is more realistic now, however I wouldn't be surprised if it did drop down in price and I definitely wouldn't complain if it did.


text:
Miss Julie by Simon Stone after August Strindberg
Photo by Ellis Parrinder
Belvoir presents MISS JULIE by Simon Stone after August Strindberg in the Upstairs Theatre at Belvoir, Surry Hills.
This is the third production of MISS JULIE that I have seen in Sydney this year. The first, an adaptation of the 1888, August Strindberg play, by Cristabel Sved and Kate Box at the Darlinghurst Theatre in October last year. The other, in March this year, using the 'classic' 1964, Michael Meyer translation of the play. Interestingly, I am aware (and read, two of them) of three other recent, high profile versions of this text, internationally. MIES JULIE, adapted by Yael Farber, set on Freedom Day, in 2012, in post-apartheid South Africa - one of the arresting contemporary tensions is in the casting of a black actor as Jean to the white, wealthy, Julie. From the Schaubuhne Theatre, under the direction of the avant garde explorer, English Director, Katie Mitchell, FRAULIEN JULIE, which, using camera techniques, looks at the story unravelling through the eyes of Kristine, making the financée of Jean, the centre of the story. In Los Angeles, in March, Neil LaBute presented his examination of the play and shifted the location to pre-Stockmarket Crash, in 1929, in New York. There is, apparently, something about this great play that urges, this classic of naturalism, to be adapted for our times (my favourite adaptation is still the 2003, Patrick Marber: AFTER MISS JULIE).
Miss Julie at Belvoir is a new play, by Simon Stone, much like the texts/productions above, using the structure and characters of the original as a frame work, for his own cultural exploration of the Australian psyche. Mr Stone has broken this one act play into two separate acts and shifted his location to that of Australia - a cool, white, chic architecturally, spare, modern working kitchen and a cheap motel room (Set Design, Robert Cousins; Costume Design, Tess Schofield) - and to the present time. Miss Julie (Taylor Ferguson) has been infantilised and become a 16 year old, (in contrast to the mature woman of the original), daughter of a single parent, an absent father, a powerful politician (her feminist mother having committed suicide), bursting with unexplored hormonal sexual inclinations, with all the arrogant psychology of the materially rich, but emotionally neglected child - a first cousin, indeed, to the young women examined in the recent Sofia Coppola film, THE BLING RING. A rampant tease, of Lolita proportions, plus the willingness to exert the power that wealth can give. Jean (Brendan Cowell) has become the gofer, chauffeur, visible gun-toting body guard, to this young woman. This Jean an ill educated and delusional social aspirant, equipped with a spreading, hulking physical decline and the sexual confidence of a balding middle aged predator - his greatest attraction, his sex, on the verge of extinction - is apparently, desperately restless in his needs - is Miss Julie the last opportunity for Jean's juvenile ambitions to be achieved? Christine (Blazey Best), Jean's fiancee is the patient realist to Jean, and the cook and house keeper for the Julie in her household. A dutiful employee, content, if not happy, with her circumstances - but at least they are her own - she has made and accepted them.
The play works as a sexual thriller, where our cultural cringe at the sexual dance between the inappropriate pairing of this young Julie with the grotesquely ambitious Jean is underlined by the sexual preening of the male against the, relatively, innocent ripening of the young female. The tension of sexual taboo is what creates enormous frisson, thrill, for the audience - the explicit nudity, of the second act, directed by Leticia Caceres, with the showcase reveal/display of the genitals of Jean (causing a vocal response from my audience "Oh, My god!") including, then, centre stage, a bending over, to giving us the arse end view of Jean, ratchets up the wholly fascinating attraction/revulsion of the watching of the aged nakedness of Jean, and of Miss Julie's youthful response to it all (looking for daddy-father?) The Belvoir audience become complicit voyeurs in this primary cultural transgression.(Does the experience of this thrill justify this new work by Mr Stone and his appropriation of August Strindberg's name and title of play? Whatever, using the famous progenitor is undoubtedly a good marketing ploy/ publicity tool at the box office.) It is a confronting moral tendentiousness that this production offers to us theatre goers to, ultimately, deal with (in more ways than one!) Does it recall the audience confrontations that Mr Stone set up in his very theatrical production of THYESTES, using the source material of the Roman poet, Seneca, a few years ago? Is it to much of a stretch to include his production of BAAL, Brecht's text, in this dramaturgical familiarity of in-yet-face artistry?
Coincidently, down at the atyp, at present, a play written by a 17 year old, Anya Reiss, SPUR OF THE MOMENT, deals with a similar situation and creates the same tension - neglectful adult figures and an inappropriate sexual behaviour between a 13 year old girl and a 21 year old man. The physical age differences are closer and less glaring in their contrast (and there is no nudity), but the psychological immaturity of the male figure and the biological urgings of the female, is shockingly similar and just as culpable. The juvenile writer, Ms Reiss, squibs, ultimately, on the possible consequences to such behaviour, and defuses, over simply, the resolution of the situation. Mr Stone's MISS JULIE, does not do that, and it seems to count, a little, on our knowledge of the original play by Strindberg, as Julie finds Jean's gun and begins a choreographed debate with it, in the motel climax to the play. The tension to the ending of this production is shocking and double edged in its contemporary moral resolution - a very youthful 'Tarantino' destination.
The performances are good. Ms Ferguson, making her stage debut, finds the range of this emotionally disabled young woman, from the innocent, gentle kitten to the clawed and vicious panther - the fittest, the best equipped, will continue to survive against the less prepared - and the ambiguity of the insights of the character and her actions are wonderfully, clearly demarcated throughout the unravelling of the narrative. Mr Cowell seems to inhabit this menace of stupid cruelty and opportunism with convincing physical choices, and psychologically, smoothly, moves the character choices to inevitable, excruciating fatalities, in front of us (this was as impressive, for me, as Mr Cowell's work in the film NOISE, was, a few years ago). Ms Best has the least opportunity in this production to reveal a fully rounded character and is not as complex in her choices as she often can be - I was, vaguely, surprised, disappointed with what I was given to read.
This use of Strindberg's creation, MISS JULIE, by Mr Stone is interesting in it's narrowness of pre-occupation considering the richness of themes in the original. This MISS JULIE is, on the night I attended, reduced to a kind of sexual thriller, that I have not experienced since the Sam Peckinpah film of STRAW DOGS (1971) or Scorsese's CAPE FEAR 1991 (or even the J.Lee Thompson 1962 original). It is, on those terms, not a bad night out for an R-rated entertainment. I don't believe it is a very deep investigation of the original offers of the Strindberg. Two aberrantly behaved, emotionally juvenile men, the father (by implication) and the body guard, Jean, confront, in the battle of the sexes, two clever manipulative women, Christine and Julie, is a possible summary of this production of the play material offered by Mr Stone. When reading the MIES JULIE by Yael Farber, set in contemporary South Africa, even the Neil LaBute American version, one is captured by the reflection of the complexities of those cultures using the framework and interests of the original play. Just what the rest of the world might read from the pre-occupation of Mr Stone and Ms Caeres of the state of the Australian culture, psyche, as represented by this new play, and production, is of tantalising interest to me.
P.S. I wished the slow naturalism of the original had been really extended further by Ms Caceres, and I certainly loved the work of the Sound Designer, The Sweats.
Posted by Editor at 7:13 PM
Labels: August Strindberg, Belvoir St Theatre, Blazey Best, Leticia Caceres, Robert Cousins, Simon Stone, Taylor Ferguson, Tess Schofield, Upstairs Theatre
The Winslow Boy
A Sign of the Times
The Grief Parlour
Nightbook
Empire: Terror on the High Seas

redpajama_set_name: RedPajamaCommonCrawl


WE ARE A HARD ROCK BAND FROM BRAZIL. GO TO OUR MYSPACE BAND PAGE AND CHECK IT. www.myspace.com/535416394 http://vids.myspace.com/index.cfm?fuseaction=vids.individual&videoid=&release=106848430 If this chat room is illegal, click here.


text:
Multi-national logistics firm delivers £1M fleet investment
In the last year alone, one of the UK's leading multi-modal and logistics organisations has ploughed over £1 million into vehicles to support its continued growth.
Kingscote Rojay Ltd (KRL), a member of Palletways, Europe's largest and fastest growing express palletised freight network, has invested in a mixture of 18-tonne, 12-tonne and 7.5-tonne vehicles, which are all Euro 6 compliant and meet the latest emission requirements. The company has also invested in four Scania 44-tonne tractor units to support its fleet.
KRL has been successfully trading for over 25 years and provides a range of logistics services including air and sea freight, import and export, warehouse, logistics, pick and pack, UK transportation and European distribution.
The company, which runs Palletways services from depots in Frome and Telford, joined the network in 2013, enabling existing and new clients to benefit from industry-leading technology and high-quality logistics services into the UK and Europe.
Andy Mead, UK Director at KRL said: "Our mission is to satisfy the international freight and supply chain needs of our clients, so it's incredibly important to invest in market-leading equipment and infrastructure that can support our drivers and offers the best service for our customers.
"It's an exciting time for KRL and we believe this recent investment sends out a strong signal to the marketplace about our capabilities which we believe are unparalleled amongst our competitors."
The company's ongoing success has recently been recognised by SME News, who awarded KRL the 'The Best for Freight and Supply Chain award' at their annual ceremony celebrating the best small and medium-sized businesses in the UK.
KRL is one of over 115 independent transport providers that are part of the Palletways UK network. They benefit from shared expertise and resources from within the group to deliver consignments of palletised freight to market faster and more cost-effectively than ever before. The Palletways Group comprises 450+ depots and 20 hub operations, through which it provides collection and distribution services across 20 European countries, including the UK.


text:
Fred Chang elected to National Academy of Engineering
Posted on February 10, 2016 Updated: February 11, 2016
Fred Chang, director of SMU's Darwin Deason Institute for Cyber Security and former director of research for the National Security Agency, has been elected to the National Academy of Engineering.
Chang and other new members will be formally inducted during a ceremony at the NAE's Annual Meeting in Washington, D.C., on Oct. 9, 2016.
The U.S. National Academy of Engineering is a private, independent, nonprofit institution that supports engineering leadership. Its mission is to advance the wellbeing of the nation by promoting a vibrant engineering profession and by marshaling the expertise and insights of eminent engineers to provide independent advice to the federal government on matters involving engineering and technology.
"I feel incredibly honored to be elected into the National Academy of Engineering," Chang said. "The level of innovation and accomplishment achieved by its members is inspiring, and I take great pride in joining them. I am grateful to many, many colleagues who have worked with me and helped me over the course of my career, including those at SMU.
"This recognition further motivates me to continue pursuing the challenge of securing cyberspace," Chang said. "It means continuing the important research we are doing at SMU, to help advance the science of cyber security, and training a workforce of skilled cyber defenders."
Chang joined SMU in September 2013 as Bobby B. Lyle Endowed Centennial Distinguished Chair in Cyber Security, computer science and engineering professor and Senior Fellow in the John Goodwin Tower Center for Political Studies in Dedman College. The Darwin Deason Institute for Cyber Security was launched in SMU's Lyle School of Engineering in January 2014, with Chang named as its director.
"Being inducted into the National Academy of Engineering is one of the highest honors a professor can achieve," said Lyle School Dean Marc Christensen. "We are so pleased that Professor Chang is being recognized as one of the brightest minds of our generation at a time when his expertise in cyber security is so critical to our nation's future."
Chang is the second Lyle School professor to be named to the NAE. Delores Etter, the founding director of the Caruth Institute for Engineering Education in the Lyle School, a Caruth Professor of Engineering Education, a distinguished fellow in the Darwin Deason Institute for Cyber Security and a senior fellow in the John Goodwin Tower Center for Political Studies was elected to the NAE in 2000.
In addition to his positions at SMU, Chang is a distinguished scholar in the Robert S. Strauss Center for International Security and Law at the University of Texas at Austin. Chang has been professor and AT&T Distinguished Chair in Infrastructure Assurance and Security at the University of Texas at San Antonio and he was at the University of Texas at Austin as an associate dean in the College of Natural Sciences and director of the Center for Information Assurance and Security. Additionally, Chang's career spans service in the private sector and in government including as the former Director of Research at the National Security Agency.
Chang has been awarded the National Security Agency Director's Distinguished Service Medal and was the 2014 Information Security Magazine 'Security 7' award winner for Education. He has served as a member of the Commission on Cyber Security for the 44th Presidency and as a member of the Computer Science and Telecommunications Board of the National Academies. He has also served as a member of the National Academies Committee on Responding to Section 5(d) of Presidential Policy Directive 28: The Feasibility of Software to Provide Alternatives to Bulk Signals Intelligence Collection.
He is the lead inventor on two U.S. patents (U.S. patent numbers 7272645 and 7633951), and he appeared in the televised National Geographic documentary, Inside the NSA: America's Cyber Secrets. He has twice served as a cyber security expert witness at hearings convened by the U.S. House of Representatives Committee on Science, Space and Technology.
Dr. Chang received his B.A. degree from the University of California, San Diego and his M.A. and Ph.D. degrees from the University of Oregon. He has also completed the Program for Senior Executives at the Sloan School of Management at the Massachusetts Institute of Technology.
Chang joins the National Academy of Engineering with 79 other new U.S. members and 22 new international members, bringing the group's total membership to 2,275 U.S. members and 232 foreign members. Membership honors those who have made outstanding contributions to engineering research, practice, or education, including, where appropriate, significant contributions to the engineering literature, and to the pioneering of new and developing fields of technology, making major advancements in traditional fields of engineering, or developing/implementing innovative approaches to engineering education.
Categories: Faculty in the News, For the Record, NewsTags: awards and honors, Bobby B. Lyle School of Engineering, Darwin Deason Institute for Cyber Security, endowed chairs, endowed professors, Fred Chang, Frederick R. Chang, John Goodwin Tower Center for Political Studies, Lyle School of Engineering, Marc Christensen, National Academy of Engineering, Tower Center for Political Studies
Student achievement in the spotlight during SMU Engaged Learning Week, Feb. 8-12, 2016
Sports: SMU Athletics on the Rise


Posted on January 14, 2019 by Internet of Words.	This entry was posted in Here is the News, Life of Grumpy, Personal Data and tagged getting there, how to cope, organising my sorry arse, Relationship 101. Bookmark the permalink.


Hiring the maintenance of Osakidetza Business Intelligence platform.
Deployment Service business management tool Microsoft Dynamics Nav 2015 Alokabide (file prepared for electronic tendering).
Servicios Generales de Gestión, S.L.U.
Support service to the public and administrative management of Amvisa.
Maintaining Osakidetza Business Intelligence platform. Osakidetza defined a Strategic Plan for Business Intelligence as a basis for corporately, models that allow the use of data in all areas with the aim of both output the great potential of information is the set of systems Osakidetza, as starting operation Competence Centre in Osakidetza Business Intelligence (CCBI). As a dynamic figure in Osakidetza to ensure alignment with business initiatives Business Intelligence Competence Center is constituted in Business Intelligence Osakidetza, hereinafter CCBI, whose mission is to act as the strategic, tactical and operational body all needs in the organization's Business Intelligence, and therefore be key in the standardization process.
Announcement for recruitment support service to customer service and administrative management of Amvisa.
Service-level agreement for the development and operation of business systems management training for employment and the common system of centers and users.
Lanbide announcement Basque Employment Service by publicly disclosing the contract to the tender which aims to service-level agreement for the development and operation of business systems management and job training system common centers and users.
Services for call center business user Osakidetza.
Resolution of the Public Entity Osakidetza Basque Health Service for which the tender for "Services to the spotlight Osakidetza corporate user" is announced.
Hiring the services necessary for the development and evolution of business management, development and related linguistic normalization process of the Administration of Justice in the Autonomous Basque Community support.
Announcement of the Heritage and contract procurement tendering aimed "Hiring the services necessary for the development and evolution of business management, development and support related to the process of linguistic normalization of the Administration of Justice in Basque Country ".
Services for Business Development and Operation of the Common infrastructure to support interoperability with financial institutions.
Services for the development and operation of business support Common infrastructure presence in Internet / intranet Basque Government (PLATEA).
Service-level agreement for the development and operation of business management systems Training for Employment.
Services for the development and operation of the common business support infrastructure interoperability with financial institutions.
Services for the development and operation of business support infrastructure common presence in Internet / intranet Basque Government (Stalls).
Services for the development and operation of business support Common infrastructure presence in Internet / Intranet Basque Government (Stalls).
Services for the development and operation of the common business infrastructure support interoperability with financial institutions.
Service implementation of business management tool Microsoft Dynamics Nav 2015 Alokabide (file prepared for electronic bidding).


text:
Redwood City: (650) 299-0500 | San Jose: (408) 217-8818
Home > San Jose Domestic Violence Attorney > What To Do When You Have Been Falsely Accused
What To Do When You Have Been Falsely Accused of Domestic Violence in San Jose
Were you falsely accused of domestic violence in San Jose, California? Even if you're unequivocally innocent, don't take these allegations lightly. If you're charged and convicted, you could face jail time, fines, child custody issues, and a restrictive restraining order.
The first thing you should do is retain legal counsel to protect your rights and reduce your chances of being convicted. A San Jose domestic violence attorney at Ahmed & Sukaram, Attorneys at Law will advocate for you and present a strong defense on your behalf you can contact us 24/7 at (408) 217-8818
Before we explain the steps to take after a false domestic violence accusation, we'll explain how our experienced legal team can help.
How Can Our San Jose Criminal Defense Lawyers Help If You Were Falsely Accused of Domestic Violence?
Law enforcement officers, prosecutors, and judges take domestic violence allegations seriously. They often err on the side of caution and take the alleged victim's word at face value. Unfortunately, this often results in wrongful convictions that can haunt the alleged abuser for years.
That's why hiring experienced San Jose criminal defense lawyers is crucial. You need someone who is familiar with the criminal justice system on your side to defend your rights.
The legal team at Ahmed & Sukaram, Attorneys at Law can help you fight false domestic violence allegations by:
Investigating the charges against you and evaluating weaknesses in the prosecution's case (or helping you get ahead of charges if you've only been accused)
Gathering evidence to prove your innocence
Using our experience, skills, and knowledge to have your charges dropped or the case dismissed
Negotiating on your behalf and representing your best interests throughout the legal process
Advocating for you in court proceedings if it's beneficial to your case
Retaining an attorney is the best way to protect yourself against false accusations in a domestic abuse case. We offer a free consultation to discuss your situation and provide honest legal advice, so call today to schedule an appointment with our attorneys in San Jose, CA.
Steps To Take If Someone Falsely Accuses You of Domestic Violence in San Jose, CA
As we've mentioned, your first step after a false domestic violence allegation is to consult an experienced criminal defense lawyer.
Even if the accuser has only hinted at accusing you, you should seek legal advice to get ahead of any potential criminal charges that may arise. The attorney may advise you to speak with a family lawyer for advice on removing yourself from a volatile relationship – especially if you share children in common.
The other actions you take will depend on the circumstances, as every case is unique and involves different parties. However, we provide some tips that may be helpful if you're facing this unfortunate situation.
Do Not Communicate With the Accuser
Whether you've been accused, arrested, or charged with a domestic violence crime, do not communicate with the alleged victim in any way.
Communication could include:
Seeing them in person
Speaking with them on the phone
Sending messages through a third party
Engaging with them on social media
Sending gifts or notes to their residence or workplace
Any other form of direct or indirect communication
You may think that once things have calmed down, you can reach out to your accuser, discuss the issue, and move on. However, this often results in further accusations and problems. If you absolutely must convey a message, do so through an attorney to protect yourself.
Record What Happened Immediately After the Incident
If you're facing false charges or allegations after a heated argument or another incident, write down or record what happened while it's fresh in your memory. You need to be able to tell your attorney your version of events and relay important information that can help them prepare a defense tailored to your case.
Write down what was said and done, where it happened, the parties who witnessed the incident (if any), the time and date, and any other relevant facts that can help your case. If nothing happened and your accuser is fabricating their entire story, note where you were and who you were with during the alleged incident.
Gather and Preserve Evidence Supporting Your Innocence
Jotting down your version of events will help you and your attorney gather exculpatory evidence, including:
Eyewitness statements
Surveillance footage
Cell phone records
Statements from an alibi verifying your version of events
Character witness statements
Other evidence may be available to prove your innocence, depending on your case. Our San Jose domestic violence attorneys are here to help clear your name and mitigate the consequences of false domestic violence accusations.
Do Not Violate the Terms of a Restraining Order
In some cases, an alleged victim may get an emergency protective order (EPO) or a domestic violence restraining order (DVRO). If this happens to you, carefully read the terms of the order and comply with every requirement or restriction.
A restraining order can impose strict terms, such as preventing you from seeing your children and forcing you to move out of your home.
Violating a restraining order is a crime that can carry harsh penalties, including jail time, fines, and more. If you've been falsely accused of domestic violence and served with a restraining order, seek legal help as soon as possible.
Schedule a Free Consultation With Our San Jose Domestic Violence Attorneys If You've Been Falsely Accused
Dealing with domestic violence charges or accusations is stressful and frightening – especially if you know they're false. With your rights, freedom, and reputation on the line, it's essential to get an experienced legal professional in your corner.
Our San Jose criminal defense lawyers will protect you and ensure you're treated fairly. We'll devise a custom legal strategy to prove that the accusations are untruthful.
Contact our law firm today for a free initial consultation to discuss the allegations you're facing and how best to fight them.
What To Do When You Have Been Falsely Accused of Domestic Violence
Our Criminal Law Offices
1922 The Alameda, Suite 201, San Jose, CA 95126
600 Allerton Street, Suite 201G, Redwood City, CA 94063
Describe your case
600 Allerton Street
Suite 201G
1922 The Alameda
© 2022 | Ahmed & Sukaram, Attorneys at Law | All Rights Reserved
Disclaimer | Privacy Policy | Sitemap |


text:
Ибариља има више значења:

 Ибариља (Леон), насеље у савезној држави Гванахуато у Мексику
 Ибариља, Ринкон де Ибариља (Арамбери), насеље у савезној држави Нови Леон у Мексику

redpajama_set_name: RedPajamaWikipedia


These small double-sided chalkboards will make perfect buffet markers or place cards at your shabby chic-themed wedding reception's tabletops when paired with our small wooden easels, available separately as Product Code: ER-9584-08. PLEASE NOTE: Pictured easels and chalk are not included. Sold as a set of six (6) and prices quoted below are per set.


text:
Justin Bieber Hopes Anne Frank Would've Been a 'Belieber'
The 19-year old stirred outrage after writing in the Anne Frank Museum guest book
By: Ashley Baylen
Published: April 15th, 2013 in Culture » Society » News
Justin Bieber has made a lot of mistakes this year ranging from losing his cool with paparazzi and speeding way too many times to abandoning his pet monkey in Germany, and well, even owning a pet monkey.
Now, his narcissism has resulted in fury among the media and various Internet social communities after a recent visit to the Anne Frank House in Amsterdam.
During a stop on his European tour, Bieber visited the Anne Frank House museum dedicated to preserving the memory of the young Holocaust victim who chronicled her experiences hiding from the Nazi's in 'The Diary of Anne Frank.'
Before leaving, the 'Boyfriend' singer stopped to write in the guest book. According to the Anne Frank House's Facebook page, he wrote "Truly inspiring to be able to come here. Anne was a great girl. Hopefully she would have been a belieber."
Since posting the pop star's comment on their Facebook page, they have received over 1,300 comments including insults ranging from "vile" and "disgusting" to calling Bieber a "shallow doofus".
On Twitter, many people offered comedic, yet insightful commentary on the situation.
"Come on, Twitter, settle down about Justin Bieber. It's just a made-up controversy. We all know Justin Bieber can't read or write," tweeted Joe Garden.
"'I've been thinking, and I now believe that people are really terrible and self-absorbed at heart.'—Anne Frank," wrote Ken Jennings.
However, the Anne Frank House has decided to defend Bieber, explaining that he could've chosen to go absolutely anywhere while on tour, and chose Anne Frank.
"He's 19. It's a crazy life he's living, he didn't mean bad… and also it's nice that he made the effort, he didn't have to come," said museum spokesperson Maatje Mostart to the BBC.
What do you think of Bieber's comment?
FYI- for those of you confused about what a "Belieber" is, it is one that loves (and believes in) Justin Bieber. Also known as a fan.
Related articles: Justin Bieber, Anne Frank House, Museum, Amsterdam, Belieber, Nazi, Holocaust, Guest Book, Controversy, Jewish
Anne Frank House Defends Justin Bieber Comment
Joan Rivers Defends Justin Bieber's Anne Frank Comment...
Was Adolf Hitler a Meth Dealer?
The History Channel is Seeking Hitler Look-alikes
Adam Lambert Sings 'The Star Spangled Banner' at AIDS Benefit
The former 'American Idol' contestant performs at BROADWAY BARES 23
Bette Midler Sings 'Wind Beneath My Wings' to Fan Dying
The legendary actress sang to Anna Greenberg over the phone while in hospital
Shalom, Costa Rica: A Jewish Culture Guide
With its lush, pristine rainforests, stunning beaches, sweeping vistas, not to mention a history that spans from Pre-Columbian to Spanish Colonialism, to the modern age, Costa Rica has become a haven for travelers who are on a quest to find paradise.
Sarah Silverman's Father Thinks JAP's Are 'Assholes' [VIDEO]
Donald Silverman discusses Jewish American princesses on HuffPost Live
Proud New Yorker, Billy Crystal, Raises $1 Million For Hurricane
The 'Monsters University' star is doing whatever he can to rebuild his hometown on Long Island
Aspiring Actresses Shout Nazi Propaganda at Fake Casting Call
30 young women in L.A were tricked into screaming offensive slurs.
Gene Simmons Comes to Kanye West and Kim Kardashian's Defense
The KISS rocker stands up for the celebrity couple's baby name choice among social media attacks.
Take Responsibility for Your Own
The 19 year old sophomore sat on the exam table looking at the floor. A college student with obvious charm
The Stanford Prison Experiment at
In 1971, researchers set up a prison in the basement of Stanford University's Psychology Department. The idea was to
U.S. vs. Europe: Health Care
As I have tried to make abundantly clear the United States is the only country in the industrialized world that
Hands Off America
Alright, that does it.Since the terrorist attacks of September 11, 2001, Americans have been willing to do their part for
Fat Returns After Liposuction ...
A study appeared in a journal titled "Obesity" which was reported by a group from the University of Colorado. In
What does Victory Look Like?
Sixty-five years ago today, World War II officially came to an end. On September 2, 1945, Japanese Foreign Minister
(This information will not be displayed publicly)
Top 50 Hottest Jewish Men (10-1) Culture » Society » News
About Shalom Life
Shalom Life's mission is to share, discuss and inspire our readers with stories about Jewish culture and life.
Shalom Life launched in 2009 and has become Canada's largest independent Jewish news source dedicated to covering culture, arts, society, technology, business, and general news, both locally and internationally.
Shalom Life's content has also been syndicated on some of the world's top publications including Macleans, National Post, ABC News, Ynet, Forbes, USA Today and many more, helping expand it's reach to millions of other readers.
Shalom Life's head office is in Toronto, Canada. Shalom Life has recently expanded into Los Angeles, with plans of opening offices across the United States.
About UsContact UsAdvertiseSupportTerms of UsePrivacy Policy
HomeNewsBusinessCultureHealthVideosNewsletterArtStageMusicFilmTVBooksFoodSociety
Facebook Twitter Pinterest Google+ Tumbler YouTube RSS
© ShalomLife Reproduction of any material without written authorization is strictly prohibited.


text:
package workbench.util;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.channels.FileChannel;
import java.nio.charset.CharacterCodingException;
import java.nio.charset.Charset;
import java.nio.charset.CharsetDecoder;
import workbench.interfaces.CharacterSequence;
import workbench.log.LogMgr;

/**
 * An implementatio of CharacterSequence that does not read the
 * entire file but only a part of it into memory
 * @author Thomas Kellerer
 */
public class FileMappedSequence
	implements CharacterSequence
{
	// the current size of the chunk read from the file
	// this will be adjusted dynamically according to the
	// calls to substring
	private int chunkSize;

	// The current chunk that has been read from the file
	private String chunk;

	// The decoder used to convert the bytes from the file
	// into a String object
	private CharsetDecoder decoder;

	// Stores the starting position of the current chunk in the file
	private int chunkByteStart = -1;

	// The character index in the complete sequence where the current chunk starts
	// (for single byte character sets this will be equal to chunkByteStart
	private int chunkCharStart;

	// The length of the underlying file
	private long fileSize;

	// The real length in characters
	private long charLength;

	private FileInputStream input;
	private FileChannel channel;
	private ByteBuffer readBuffer;
	private int increasedChunkSize = -1;

	public FileMappedSequence(File f, String characterSet)
		throws IOException
	{
		this(f, characterSet, 512 * 1024);
	}

	public FileMappedSequence(File f, String characterSet, int size)
		throws IOException
	{
		this.chunkSize = size;
		init(f, characterSet);
		// Read the first chunk in order to initialize the character counters properly
		readFirstChunk();
	}

	private void init(File f, String characterSet)
		throws IOException
	{
		this.fileSize = f.length();
		if (characterSet.toLowerCase().startsWith("utf"))
		{
			charLength = FileUtil.getCharacterLength(f, characterSet);
		}
		else
		{
			charLength = fileSize;
		}
		this.input = new FileInputStream(f);
		this.channel = input.getChannel();
		this.chunk = "";
		readBuffer = ByteBuffer.allocateDirect(chunkSize);
		Charset charset = Charset.forName(characterSet);
		this.decoder = charset.newDecoder();
	}

	@Override
	public int length()
	{
		return (int)this.charLength;
	}

	/**
	 * this is only package visible in order to be callable from the unit test
	 */
	final void readFirstChunk()
	{
		chunkByteStart = -1;
		readNextChunk();
	}

	/**
	 * this is only package visible in order to be callable from the unit test
	 */
	final void readNextChunk()
	{
		boolean success = false;
		int tries = 0;

		int oldChunkCharEnd = chunkCharStart + chunk.length();

		int newChunkSize = (increasedChunkSize <= 0 ? chunkSize : increasedChunkSize);
		increasedChunkSize = -1;
		int nextStart = (chunkByteStart == -1 ? 0 : chunkByteStart + chunkSize);

		while (!success)
		{
			try
			{
				_readChunk(nextStart, newChunkSize);
				success = true;
				chunkCharStart = oldChunkCharEnd;
				chunkSize = newChunkSize;
				chunkByteStart = nextStart;
			}
			catch (CharacterCodingException cc)
			{
				tries ++;
				if (tries > 3)
				{
					// then something serious is wrong!
					LogMgr.logError("FileMappedSequence.readNextChunk()", "Error reading file", cc);
					throw new IllegalStateException("Could not read next chunk");
				}
				// This can happen if the chunk ends in the middle
				// of an UTF8 sequence, and the decoder was missing a byte
				// I can't think of any other solution, than to simply increase
				// the window by 1 byte and try again
				newChunkSize ++;
			}
			catch (IOException io)
			{
				LogMgr.logError("FileMappedSequence.ensureWindow()", "Error reading file", io);
				throw new IllegalStateException("Could not read next chunk");
			}
		}
	}

	void readPreviousChunk()
	{
		if (chunkByteStart == 0) return;
		int newStart = chunkByteStart - chunkSize;
		int newSize = chunkSize;
		int oldCharStart = chunkCharStart;
		if (newStart < 0) newStart = 0;
		int tries = 0;
		boolean success = false;
		while (!success)
		{
			try
			{
				_readChunk(newStart, newSize);
				success = true;
				chunkSize = newSize;
				chunkByteStart = newStart;
				chunkCharStart = (newStart > 0 ? oldCharStart - chunk.length() : 0);
			}
			catch (IOException io)
			{
				tries ++;
				if (tries > 3)
				{
					// then something serious is wrong!
					LogMgr.logError("FileMappedSequence.readPreviousChunk()", "Error when reading chunk from: " + newStart + " with size: " + chunkSize, io);
					throw new IllegalStateException("Could not read previous chunk");
				}
				// This can happen if the chunk ends in the middle
				// of an UTF8 sequence, and the decoder was missing a byte
				// I can't think of any other solution, than to simply increase
				// the window by 1 byte and try again
				if (newStart > 0) newStart --;
				newSize ++;
			}
		}
	}

	private void _readChunk(int byteStart, int size)
		throws CharacterCodingException, IOException
	{
		// prepare for requests larger then the chunkSize
		if (size > readBuffer.capacity())
		{
			readBuffer = ByteBuffer.allocateDirect(size);
		}

		if (byteStart + size > this.fileSize)
		{
			chunkSize = (int)(this.fileSize - byteStart);
		}

		readBuffer.clear();
		readBuffer.limit(size);
		int read = this.channel.read(readBuffer, byteStart);
		if (read == -1) return;

		// Rewind is necessary because the decoder starts at the
		// current position
		readBuffer.rewind();

		// Setting the limit to the number of bytes read
		// is also necessary because the decoder uses that
		// information to find out how many bytes it needs
		// to decode from the buffer
		readBuffer.limit(read);

		CharBuffer cb = decoder.decode(readBuffer);
		this.chunk = cb.toString();
	}

	@Override
	public void done()
	{
		try
		{
			if (this.input != null) input.close();
		}
		catch (Exception e)
		{
			LogMgr.logError("FileMappedSequence.done()", "Error closing input stream", e);
		}
	}

	public int getCurrentChunkLength()
	{
		return chunk.length();
	}

	@Override
	public char charAt(int index)
	{
		if (index > this.charLength || index < 0) throw new StringIndexOutOfBoundsException(index + " > " + charLength);

		int chunkLength = chunk.length();
		if (index >= chunkCharStart + chunkLength)
		{
			while (index >= chunkCharStart + chunkLength)	readNextChunk();
		}
		else if (index < chunkCharStart)
		{
			while (index < chunkCharStart) readPreviousChunk();
		}
		int indexInChunk = index - chunkCharStart;

		return this.chunk.charAt(indexInChunk);
	}

	@Override
	public String subSequence(int start, int end)
	{
		if (end > this.charLength) throw new StringIndexOutOfBoundsException(end + " > " + charLength);
		if (start < 0) throw new StringIndexOutOfBoundsException(end + " > " + charLength);

		// ensure the current chunk includes the start index
		charAt(start);

		int startInChunk = start - chunkCharStart;
		int sequenceLength = (end - start);
		int endInChunk = startInChunk + sequenceLength;

		if (endInChunk < chunk.length())
		{
			return chunk.substring(startInChunk, endInChunk);
		}
		// requested sequence extends into the next chunk(s)
		StringBuilder result = new StringBuilder(sequenceLength);
		result.append(chunk.substring(startInChunk));
		int nextStart = start + result.length();
		result.append(subSequence(nextStart, end));
		return result.toString();
	}
}

redpajama_set_name: RedPajamaGithub


text:
Nicolas Cage is Superman in Teen Titans GO! to the Movies
Spencer Perry Tuesday, March 13, 2018
Following the failed Tim Burton-directed movie from the 1990s, fans never expected they would get to see Nicolas Cage suit up as the Man of Steel. Now, the Academy Award winner is finally getting his chance and will voice the hero in the upcoming Teen Titans GO! to the Movies (via USA Today).
Cage joins singer/songwriter Halsey, who is playing Wonder Woman, and rapper Lil Yachty, who is playing Green Lantern, as the first of several A-List celebrities that will join the cast, according to USA Today.
When the Teen Titans go to the big screen, they go big! Teen Titans GO! to the Movies finds our egocentric, wildly satirical Super Heroes in their first feature film extravaganza—a fresh, gleefully clever, kid-appropriately crass and tongue-in-cheek play on the superhero genre, complete with musical numbers.
Teen Titans GO! to the Movies stars Scott Menville as Robin, Hynden Walch as Starfire, Tara Strong as Raven, Khary Payton as Cyborg, Greg Cipes as Beast Boy, Will Arnett as Slade Wilson and Kristen Bell as Jade Wilson.
See if the Teen Titans succeed in becoming the next Hollywood stars when Teen Titans GO! to the Movies premieres in theaters on July 27, 2018.
Tags: Superman, Teen Titans GO! to the movies