text:
'''Intel HEX format manipulation library.'''

__docformat__ = "javadoc"

from array import array
from binascii import hexlify, unhexlify
from bisect import bisect_right
import os
import sys

from intelhex.compat import (
    IntTypes,
    StrType,
    StringIO,
    asbytes,
    asstr,
    dict_items_g,
    dict_keys,
    dict_keys_g,
    range_g,
    range_l,
    )

class _DeprecatedParam(object):
    pass

_DEPRECATED = _DeprecatedParam()

class IntelHex(object):
    ''' Intel HEX file reader. '''

    def __init__(self, source=None):
        ''' Constructor. If source specified, object will be initialized
        with the contents of source. Otherwise the object will be empty.

        @param  source      source for initialization
                            (file name of HEX file, file object, addr dict or
                             other IntelHex object)
        '''
        # public members
        self.padding = 0x0FF
        # Start Address
        self.start_addr = None

        # private members
        self._buf = {}
        self._offset = 0

        if source is not None:
            if isinstance(source, StrType) or getattr(source, "read", None):
                # load hex file
                self.loadhex(source)
            elif isinstance(source, dict):
                self.fromdict(source)
            elif isinstance(source, IntelHex):
                self.padding = source.padding
                if source.start_addr:
                    self.start_addr = source.start_addr.copy()
                self._buf = source._buf.copy()
            else:
                raise ValueError("source: bad initializer type")

    def _decode_record(self, s, line=0):
        '''Decode one record of HEX file.

        @param  s       line with HEX record.
        @param  line    line number (for error messages).

        @raise  EndOfFile   if EOF record encountered.
        '''
        s = s.rstrip('\r\n')
        if not s:
            return          # empty line

        if s[0] == ':':
            try:
                bin = array('B', unhexlify(asbytes(s[1:])))
            except (TypeError, ValueError):
                # this might be raised by unhexlify when odd hexascii digits
                raise HexRecordError(line=line)
            length = len(bin)
            if length < 5:
                raise HexRecordError(line=line)
        else:
            raise HexRecordError(line=line)

        record_length = bin[0]
        if length != (5 + record_length):
            raise RecordLengthError(line=line)

        addr = bin[1]*256 + bin[2]

        record_type = bin[3]
        if not (0 <= record_type <= 5):
            raise RecordTypeError(line=line)

        crc = sum(bin)
        crc &= 0x0FF
        if crc != 0:
            raise RecordChecksumError(line=line)

        if record_type == 0:
            # data record
            addr += self._offset
            for i in range_g(4, 4+record_length):
                if not self._buf.get(addr, None) is None:
                    raise AddressOverlapError(address=addr, line=line)
                self._buf[addr] = bin[i]
                addr += 1   # FIXME: addr should be wrapped
                            # BUT after 02 record (at 64K boundary)
                            # and after 04 record (at 4G boundary)

        elif record_type == 1:
            # end of file record
            if record_length != 0:
                raise EOFRecordError(line=line)
            raise _EndOfFile

        elif record_type == 2:
            # Extended 8086 Segment Record
            if record_length != 2 or addr != 0:
                raise ExtendedSegmentAddressRecordError(line=line)
            self._offset = (bin[4]*256 + bin[5]) * 16

        elif record_type == 4:
            # Extended Linear Address Record
            if record_length != 2 or addr != 0:
                raise ExtendedLinearAddressRecordError(line=line)
            self._offset = (bin[4]*256 + bin[5]) * 65536

        elif record_type == 3:
            # Start Segment Address Record
            if record_length != 4 or addr != 0:
                raise StartSegmentAddressRecordError(line=line)
            if self.start_addr:
                raise DuplicateStartAddressRecordError(line=line)
            self.start_addr = {'CS': bin[4]*256 + bin[5],
                               'IP': bin[6]*256 + bin[7],
                              }

        elif record_type == 5:
            # Start Linear Address Record
            if record_length != 4 or addr != 0:
                raise StartLinearAddressRecordError(line=line)
            if self.start_addr:
                raise DuplicateStartAddressRecordError(line=line)
            self.start_addr = {'EIP': (bin[4]*16777216 +
                                       bin[5]*65536 +
                                       bin[6]*256 +
                                       bin[7]),
                              }

    def loadhex(self, fobj):
        """Load hex file into internal buffer. This is not necessary
        if object was initialized with source set. This will overwrite
        addresses if object was already initialized.

        @param  fobj        file name or file-like object
        """
        if getattr(fobj, "read", None) is None:
            fobj = open(fobj, "r")
            fclose = fobj.close
        else:
            fclose = None

        self._offset = 0
        line = 0

        try:
            decode = self._decode_record
            try:
                for s in fobj:
                    line += 1
                    decode(s, line)
            except _EndOfFile:
                pass
        finally:
            if fclose:
                fclose()

    def loadbin(self, fobj, offset=0):
        """Load bin file into internal buffer. Not needed if source set in
        constructor. This will overwrite addresses without warning
        if object was already initialized.

        @param  fobj        file name or file-like object
        @param  offset      starting address offset
        """
        fread = getattr(fobj, "read", None)
        if fread is None:
            f = open(fobj, "rb")
            fread = f.read
            fclose = f.close
        else:
            fclose = None

        try:
            self.frombytes(array('B', asbytes(fread())), offset=offset)
        finally:
            if fclose:
                fclose()

    def loadfile(self, fobj, format):
        """Load data file into internal buffer. Preferred wrapper over
        loadbin or loadhex.

        @param  fobj        file name or file-like object
        @param  format      file format ("hex" or "bin")
        """
        if format == "hex":
            self.loadhex(fobj)
        elif format == "bin":
            self.loadbin(fobj)
        else:
            raise ValueError('format should be either "hex" or "bin";'
                ' got %r instead' % format)

    # alias (to be consistent with method tofile)
    fromfile = loadfile

    def fromdict(self, dikt):
        """Load data from dictionary. Dictionary should contain int keys
        representing addresses. Values should be the data to be stored in
        those addresses in unsigned char form (i.e. not strings).
        The dictionary may contain the key, ``start_addr``
        to indicate the starting address of the data as described in README.

        The contents of the dict will be merged with this object and will
        overwrite any conflicts. This function is not necessary if the
        object was initialized with source specified.
        """
        s = dikt.copy()
        start_addr = s.get('start_addr')
        if start_addr is not None:
            del s['start_addr']
        for k in dict_keys_g(s):
            if type(k) not in IntTypes or k < 0:
                raise ValueError('Source dictionary should have only int keys')
        self._buf.update(s)
        if start_addr is not None:
            self.start_addr = start_addr

    def frombytes(self, bytes, offset=0):
        """Load data from array or list of bytes.
        Similar to loadbin() method but works directly with iterable bytes.
        """
        for b in bytes:
            self._buf[offset] = b
            offset += 1

    def _get_start_end(self, start=None, end=None, size=None):
        """Return default values for start and end if they are None.
        If this IntelHex object is empty then it's error to
        invoke this method with both start and end as None.
        """
        if (start,end) == (None,None) and self._buf == {}:
            raise EmptyIntelHexError
        if size is not None:
            if None not in (start, end):
                raise ValueError("tobinarray: you can't use start,end and size"
                                 " arguments in the same time")
            if (start, end) == (None, None):
                start = self.minaddr()
            if start is not None:
                end = start + size - 1
            else:
                start = end - size + 1
                if start < 0:
                    raise ValueError("tobinarray: invalid size (%d) "
                                     "for given end address (%d)" % (size,end))
        else:
            if start is None:
                start = self.minaddr()
            if end is None:
                end = self.maxaddr()
            if start > end:
                start, end = end, start
        return start, end

    def tobinarray(self, start=None, end=None, pad=_DEPRECATED, size=None):
        ''' Convert this object to binary form as array. If start and end
        unspecified, they will be inferred from the data.
        @param  start   start address of output bytes.
        @param  end     end address of output bytes (inclusive).
        @param  pad     [DEPRECATED PARAMETER, please use self.padding instead]
                        fill empty spaces with this value
                        (if pad is None then this method uses self.padding).
        @param  size    size of the block, used with start or end parameter.
        @return         array of unsigned char data.
        '''
        if not isinstance(pad, _DeprecatedParam):
            print ("IntelHex.tobinarray: 'pad' parameter is deprecated.")
            if pad is not None:
                print ("Please, use IntelHex.padding attribute instead.")
            else:
                print ("Please, don't pass it explicitly.")
                print ("Use syntax like this: ih.tobinarray(start=xxx, end=yyy, size=zzz)")
        else:
            pad = None
        return self._tobinarray_really(start, end, pad, size)

    def _tobinarray_really(self, start, end, pad, size):
        if pad is None:
            pad = self.padding

        bin = array('B')

        if self._buf == {} and None in (start, end):
            return bin

        if size is not None and size <= 0:
            raise ValueError("tobinarray: wrong value for size")

        start, end = self._get_start_end(start, end, size)

        for i in range_g(start, end+1):
            bin.append(self._buf.get(i, pad))

        return bin

    def tobinstr(self, start=None, end=None, pad=_DEPRECATED, size=None):
        ''' Convert to binary form and return as binary string.
        @param  start   start address of output bytes.
        @param  end     end address of output bytes (inclusive).
        @param  pad     [DEPRECATED PARAMETER, please use self.padding instead]
                        fill empty spaces with this value
                        (if pad is None then this method uses self.padding).
        @param  size    size of the block, used with start or end parameter.
        @return         string of binary data.
        '''
        if not isinstance(pad, _DeprecatedParam):
            print ("IntelHex.tobinstr: 'pad' parameter is deprecated.")
            if pad is not None:
                print ("Please, use IntelHex.padding attribute instead.")
            else:
                print ("Please, don't pass it explicitly.")
                print ("Use syntax like this: ih.tobinstr(start=xxx, end=yyy, size=zzz)")
        else:
            pad = None
        return self._tobinstr_really(start, end, pad, size)

    def _tobinstr_really(self, start, end, pad, size):
        return asbytes(self._tobinarray_really(start, end, pad, size).tostring())

    def tobinfile(self, fobj, start=None, end=None, pad=_DEPRECATED, size=None):
        '''Convert to binary and write to file.

        @param  fobj    file name or file object for writing output bytes.
        @param  start   start address of output bytes.
        @param  end     end address of output bytes (inclusive).
        @param  pad     [DEPRECATED PARAMETER, please use self.padding instead]
                        fill empty spaces with this value
                        (if pad is None then this method uses self.padding).
        @param  size    size of the block, used with start or end parameter.
        '''
        if not isinstance(pad, _DeprecatedParam):
            print ("IntelHex.tobinfile: 'pad' parameter is deprecated.")
            if pad is not None:
                print ("Please, use IntelHex.padding attribute instead.")
            else:
                print ("Please, don't pass it explicitly.")
                print ("Use syntax like this: ih.tobinfile(start=xxx, end=yyy, size=zzz)")
        else:
            pad = None
        if getattr(fobj, "write", None) is None:
            fobj = open(fobj, "wb")
            close_fd = True
        else:
            close_fd = False

        fobj.write(self._tobinstr_really(start, end, pad, size))

        if close_fd:
            fobj.close()

    def todict(self):
        '''Convert to python dictionary.

        @return         dict suitable for initializing another IntelHex object.
        '''
        r = {}
        r.update(self._buf)
        if self.start_addr:
            r['start_addr'] = self.start_addr
        return r

    def addresses(self):
        '''Returns all used addresses in sorted order.
        @return         list of occupied data addresses in sorted order.
        '''
        aa = dict_keys(self._buf)
        aa.sort()
        return aa

    def minaddr(self):
        '''Get minimal address of HEX content.
        @return         minimal address or None if no data
        '''
        aa = dict_keys(self._buf)
        if aa == []:
            return None
        else:
            return min(aa)

    def maxaddr(self):
        '''Get maximal address of HEX content.
        @return         maximal address or None if no data
        '''
        aa = dict_keys(self._buf)
        if aa == []:
            return None
        else:
            return max(aa)

    def __getitem__(self, addr):
        ''' Get requested byte from address.
        @param  addr    address of byte.
        @return         byte if address exists in HEX file, or self.padding
                        if no data found.
        '''
        t = type(addr)
        if t in IntTypes:
            if addr < 0:
                raise TypeError('Address should be >= 0.')
            return self._buf.get(addr, self.padding)
        elif t == slice:
            addresses = dict_keys(self._buf)
            ih = IntelHex()
            if addresses:
                addresses.sort()
                start = addr.start or addresses[0]
                stop = addr.stop or (addresses[-1]+1)
                step = addr.step or 1
                for i in range_g(start, stop, step):
                    x = self._buf.get(i)
                    if x is not None:
                        ih[i] = x
            return ih
        else:
            raise TypeError('Address has unsupported type: %s' % t)

    def __setitem__(self, addr, byte):
        """Set byte at address."""
        t = type(addr)
        if t in IntTypes:
            if addr < 0:
                raise TypeError('Address should be >= 0.')
            self._buf[addr] = byte
        elif t == slice:
            if not isinstance(byte, (list, tuple)):
                raise ValueError('Slice operation expects sequence of bytes')
            start = addr.start
            stop = addr.stop
            step = addr.step or 1
            if None not in (start, stop):
                ra = range_l(start, stop, step)
                if len(ra) != len(byte):
                    raise ValueError('Length of bytes sequence does not match '
                        'address range')
            elif (start, stop) == (None, None):
                raise TypeError('Unsupported address range')
            elif start is None:
                start = stop - len(byte)
            elif stop is None:
                stop = start + len(byte)
            if start < 0:
                raise TypeError('start address cannot be negative')
            if stop < 0:
                raise TypeError('stop address cannot be negative')
            j = 0
            for i in range_g(start, stop, step):
                self._buf[i] = byte[j]
                j += 1
        else:
            raise TypeError('Address has unsupported type: %s' % t)

    def __delitem__(self, addr):
        """Delete byte at address."""
        t = type(addr)
        if t in IntTypes:
            if addr < 0:
                raise TypeError('Address should be >= 0.')
            del self._buf[addr]
        elif t == slice:
            addresses = dict_keys(self._buf)
            if addresses:
                addresses.sort()
                start = addr.start or addresses[0]
                stop = addr.stop or (addresses[-1]+1)
                step = addr.step or 1
                for i in range_g(start, stop, step):
                    x = self._buf.get(i)
                    if x is not None:
                        del self._buf[i]
        else:
            raise TypeError('Address has unsupported type: %s' % t)

    def __len__(self):
        """Return count of bytes with real values."""
        return len(dict_keys(self._buf))

    def write_hex_file(self, f, write_start_addr=True):
        """Write data to file f in HEX format.

        @param  f                   filename or file-like object for writing
        @param  write_start_addr    enable or disable writing start address
                                    record to file (enabled by default).
                                    If there is no start address in obj, nothing
                                    will be written regardless of this setting.
        """
        fwrite = getattr(f, "write", None)
        if fwrite:
            fobj = f
            fclose = None
        else:
            fobj = open(f, 'w')
            fwrite = fobj.write
            fclose = fobj.close

        # Translation table for uppercasing hex ascii string.
        # timeit shows that using hexstr.translate(table)
        # is faster than hexstr.upper():
        # 0.452ms vs. 0.652ms (translate vs. upper)
        if sys.version_info[0] >= 3:
            # Python 3
            table = bytes(range_l(256)).upper()
        else:
            # Python 2
            table = ''.join(chr(i).upper() for i in range_g(256))

        # start address record if any
        if self.start_addr and write_start_addr:
            keys = dict_keys(self.start_addr)
            keys.sort()
            bin = array('B', asbytes('\0'*9))
            if keys == ['CS','IP']:
                # Start Segment Address Record
                bin[0] = 4      # reclen
                bin[1] = 0      # offset msb
                bin[2] = 0      # offset lsb
                bin[3] = 3      # rectyp
                cs = self.start_addr['CS']
                bin[4] = (cs >> 8) & 0x0FF
                bin[5] = cs & 0x0FF
                ip = self.start_addr['IP']
                bin[6] = (ip >> 8) & 0x0FF
                bin[7] = ip & 0x0FF
                bin[8] = (-sum(bin)) & 0x0FF    # chksum
                fwrite(':' +
                       asstr(hexlify(bin.tostring()).translate(table)) +
                       '\n')
            elif keys == ['EIP']:
                # Start Linear Address Record
                bin[0] = 4      # reclen
                bin[1] = 0      # offset msb
                bin[2] = 0      # offset lsb
                bin[3] = 5      # rectyp
                eip = self.start_addr['EIP']
                bin[4] = (eip >> 24) & 0x0FF
                bin[5] = (eip >> 16) & 0x0FF
                bin[6] = (eip >> 8) & 0x0FF
                bin[7] = eip & 0x0FF
                bin[8] = (-sum(bin)) & 0x0FF    # chksum
                fwrite(':' +
                       asstr(hexlify(bin.tostring()).translate(table)) +
                       '\n')
            else:
                if fclose:
                    fclose()
                raise InvalidStartAddressValueError(start_addr=self.start_addr)

        # data
        addresses = dict_keys(self._buf)
        addresses.sort()
        addr_len = len(addresses)
        if addr_len:
            minaddr = addresses[0]
            maxaddr = addresses[-1]

            if maxaddr > 65535:
                need_offset_record = True
            else:
                need_offset_record = False
            high_ofs = 0

            cur_addr = minaddr
            cur_ix = 0

            while cur_addr <= maxaddr:
                if need_offset_record:
                    bin = array('B', asbytes('\0'*7))
                    bin[0] = 2      # reclen
                    bin[1] = 0      # offset msb
                    bin[2] = 0      # offset lsb
                    bin[3] = 4      # rectyp
                    high_ofs = int(cur_addr>>16)
                    b = divmod(high_ofs, 256)
                    bin[4] = b[0]   # msb of high_ofs
                    bin[5] = b[1]   # lsb of high_ofs
                    bin[6] = (-sum(bin)) & 0x0FF    # chksum
                    fwrite(':' +
                           asstr(hexlify(bin.tostring()).translate(table)) +
                           '\n')

                while True:
                    # produce one record
                    low_addr = cur_addr & 0x0FFFF
                    # chain_len off by 1
                    chain_len = min(15, 65535-low_addr, maxaddr-cur_addr)

                    # search continuous chain
                    stop_addr = cur_addr + chain_len
                    if chain_len:
                        ix = bisect_right(addresses, stop_addr,
                                          cur_ix,
                                          min(cur_ix+chain_len+1, addr_len))
                        chain_len = ix - cur_ix     # real chain_len
                        # there could be small holes in the chain
                        # but we will catch them by try-except later
                        # so for big continuous files we will work
                        # at maximum possible speed
                    else:
                        chain_len = 1               # real chain_len

                    bin = array('B', asbytes('\0'*(5+chain_len)))
                    b = divmod(low_addr, 256)
                    bin[1] = b[0]   # msb of low_addr
                    bin[2] = b[1]   # lsb of low_addr
                    bin[3] = 0          # rectype
                    try:    # if there is small holes we'll catch them
                        for i in range_g(chain_len):
                            bin[4+i] = self._buf[cur_addr+i]
                    except KeyError:
                        # we catch a hole so we should shrink the chain
                        chain_len = i
                        bin = bin[:5+i]
                    bin[0] = chain_len
                    bin[4+chain_len] = (-sum(bin)) & 0x0FF    # chksum
                    fwrite(':' +
                           asstr(hexlify(bin.tostring()).translate(table)) +
                           '\n')

                    # adjust cur_addr/cur_ix
                    cur_ix += chain_len
                    if cur_ix < addr_len:
                        cur_addr = addresses[cur_ix]
                    else:
                        cur_addr = maxaddr + 1
                        break
                    high_addr = int(cur_addr>>16)
                    if high_addr > high_ofs:
                        break

        # end-of-file record
        fwrite(":00000001FF\n")
        if fclose:
            fclose()

    def tofile(self, fobj, format):
        """Write data to hex or bin file. Preferred method over tobin or tohex.

        @param  fobj        file name or file-like object
        @param  format      file format ("hex" or "bin")
        """
        if format == 'hex':
            self.write_hex_file(fobj)
        elif format == 'bin':
            self.tobinfile(fobj)
        else:
            raise ValueError('format should be either "hex" or "bin";'
                ' got %r instead' % format)

    def gets(self, addr, length):
        """Get string of bytes from given address. If any entries are blank
        from addr through addr+length, a NotEnoughDataError exception will
        be raised. Padding is not used."""
        a = array('B', asbytes('\0'*length))
        try:
            for i in range_g(length):
                a[i] = self._buf[addr+i]
        except KeyError:
            raise NotEnoughDataError(address=addr, length=length)
        return asstr(a.tostring())

    def puts(self, addr, s):
        """Put string of bytes at given address. Will overwrite any previous
        entries.
        """
        a = array('B', asbytes(s))
        for i in range_g(len(a)):
            self._buf[addr+i] = a[i]

    def getsz(self, addr):
        """Get zero-terminated string from given address. Will raise
        NotEnoughDataError exception if a hole is encountered before a 0.
        """
        i = 0
        try:
            while True:
                if self._buf[addr+i] == 0:
                    break
                i += 1
        except KeyError:
            raise NotEnoughDataError(msg=('Bad access at 0x%X: '
                'not enough data to read zero-terminated string') % addr)
        return self.gets(addr, i)

    def putsz(self, addr, s):
        """Put string in object at addr and append terminating zero at end."""
        self.puts(addr, s)
        self._buf[addr+len(s)] = 0

    def dump(self, tofile=None, width=16, withpadding=False):
        """Dump object content to specified file object or to stdout if None.
        Format is a hexdump with some header information at the beginning,
        addresses on the left, and data on right.

        @param  tofile          file-like object to dump to
        @param  width           number of bytes per line (i.e. columns)
        @param  withpadding     print padding character instead of '--'
        @raise  ValueError      if width is not a positive integer
        """

        if not isinstance(width,int) or width < 1:
            raise ValueError('width must be a positive integer.')
        # The integer can be of float type - does not work with bit operations
        width = int(width)
        if tofile is None:
            tofile = sys.stdout

        # start addr possibly
        if self.start_addr is not None:
            cs = self.start_addr.get('CS')
            ip = self.start_addr.get('IP')
            eip = self.start_addr.get('EIP')
            if eip is not None and cs is None and ip is None:
                tofile.write('EIP = 0x%08X\n' % eip)
            elif eip is None and cs is not None and ip is not None:
                tofile.write('CS = 0x%04X, IP = 0x%04X\n' % (cs, ip))
            else:
                tofile.write('start_addr = %r\n' % start_addr)
        # actual data
        addresses = dict_keys(self._buf)
        if addresses:
            addresses.sort()
            minaddr = addresses[0]
            maxaddr = addresses[-1]
            startaddr = (minaddr // width) * width
            endaddr = ((maxaddr // width) + 1) * width
            maxdigits = max(len(hex(endaddr)) - 2, 4)   # Less 2 to exclude '0x'
            templa = '%%0%dX' % maxdigits
            rangewidth = range_l(width)
            if withpadding:
                pad = self.padding
            else:
                pad = None
            for i in range_g(startaddr, endaddr, width):
                tofile.write(templa % i)
                tofile.write(' ')
                s = []
                for j in rangewidth:
                    x = self._buf.get(i+j, pad)
                    if x is not None:
                        tofile.write(' %02X' % x)
                        if 32 <= x < 127:   # GNU less does not like 0x7F (128 decimal) so we'd better show it as dot
                            s.append(chr(x))
                        else:
                            s.append('.')
                    else:
                        tofile.write(' --')
                        s.append(' ')
                tofile.write('  |' + ''.join(s) + '|\n')

    def merge(self, other, overlap='error'):
        """Merge content of other IntelHex object into current object (self).
        @param  other   other IntelHex object.
        @param  overlap action on overlap of data or starting addr:
                        - error: raising OverlapError;
                        - ignore: ignore other data and keep current data
                                  in overlapping region;
                        - replace: replace data with other data
                                  in overlapping region.

        @raise  TypeError       if other is not instance of IntelHex
        @raise  ValueError      if other is the same object as self
                                (it can't merge itself)
        @raise  ValueError      if overlap argument has incorrect value
        @raise  AddressOverlapError    on overlapped data
        """
        # check args
        if not isinstance(other, IntelHex):
            raise TypeError('other should be IntelHex object')
        if other is self:
            raise ValueError("Can't merge itself")
        if overlap not in ('error', 'ignore', 'replace'):
            raise ValueError("overlap argument should be either "
                "'error', 'ignore' or 'replace'")
        # merge data
        this_buf = self._buf
        other_buf = other._buf
        for i in other_buf:
            if i in this_buf:
                if overlap == 'error':
                    raise AddressOverlapError(
                        'Data overlapped at address 0x%X' % i)
                elif overlap == 'ignore':
                    continue
            this_buf[i] = other_buf[i]
        # merge start_addr
        if self.start_addr != other.start_addr:
            if self.start_addr is None:     # set start addr from other
                self.start_addr = other.start_addr
            elif other.start_addr is None:  # keep existing start addr
                pass
            else:                           # conflict
                if overlap == 'error':
                    raise AddressOverlapError(
                        'Starting addresses are different')
                elif overlap == 'replace':
                    self.start_addr = other.start_addr

    def segments(self):
        """Return a list of ordered tuple objects, representing contiguous occupied data addresses.
        Each tuple has a length of two and follows the semantics of the range and xrange objects.
        The second entry of the tuple is always an integer greater than the first entry.
        """
        addresses = self.addresses()
        if not addresses:
            return []
        elif len(addresses) == 1:
            return([(addresses[0], addresses[0]+1)])
        adjacent_differences = [(b - a) for (a, b) in zip(addresses[:-1], addresses[1:])]
        breaks = [i for (i, x) in enumerate(adjacent_differences) if x > 1]
        endings = [addresses[b] for b in breaks]
        endings.append(addresses[-1])
        beginings = [addresses[b+1] for b in breaks]
        beginings.insert(0, addresses[0])
        return [(a, b+1) for (a, b) in zip(beginings, endings)]
#/IntelHex

class IntelHex16bit(IntelHex):
    """Access to data as 16-bit words. Intended to use with Microchip HEX files."""

    def __init__(self, source=None):
        """Construct class from HEX file
        or from instance of ordinary IntelHex class. If IntelHex object
        is passed as source, the original IntelHex object should not be used
        again because this class will alter it. This class leaves padding
        alone unless it was precisely 0xFF. In that instance it is sign
        extended to 0xFFFF.

        @param  source  file name of HEX file or file object
                        or instance of ordinary IntelHex class.
                        Will also accept dictionary from todict method.
        """
        if isinstance(source, IntelHex):
            # from ihex8
            self.padding = source.padding
            self.start_addr = source.start_addr
            # private members
            self._buf = source._buf
            self._offset = source._offset
        elif isinstance(source, dict):
            raise IntelHexError("IntelHex16bit does not support initialization from dictionary yet.\n"
                                "Patches are welcome.")
        else:
            IntelHex.__init__(self, source)

        if self.padding == 0x0FF:
            self.padding = 0x0FFFF

    def __getitem__(self, addr16):
        """Get 16-bit word from address.
        Raise error if only one byte from the pair is set.
        We assume a Little Endian interpretation of the hex file.

        @param  addr16  address of word (addr8 = 2 * addr16).
        @return         word if bytes exists in HEX file, or self.padding
                        if no data found.
        """
        addr1 = addr16 * 2
        addr2 = addr1 + 1
        byte1 = self._buf.get(addr1, None)
        byte2 = self._buf.get(addr2, None)

        if byte1 != None and byte2 != None:
            return byte1 | (byte2 << 8)     # low endian

        if byte1 == None and byte2 == None:
            return self.padding

        raise BadAccess16bit(address=addr16)

    def __setitem__(self, addr16, word):
        """Sets the address at addr16 to word assuming Little Endian mode.
        """
        addr_byte = addr16 * 2
        b = divmod(word, 256)
        self._buf[addr_byte] = b[1]
        self._buf[addr_byte+1] = b[0]

    def minaddr(self):
        '''Get minimal address of HEX content in 16-bit mode.

        @return         minimal address used in this object
        '''
        aa = dict_keys(self._buf)
        if aa == []:
            return 0
        else:
            return min(aa)>>1

    def maxaddr(self):
        '''Get maximal address of HEX content in 16-bit mode.

        @return         maximal address used in this object
        '''
        aa = dict_keys(self._buf)
        if aa == []:
            return 0
        else:
            return max(aa)>>1

    def tobinarray(self, start=None, end=None, size=None):
        '''Convert this object to binary form as array (of 2-bytes word data).
        If start and end unspecified, they will be inferred from the data.
        @param  start   start address of output data.
        @param  end     end address of output data (inclusive).
        @param  size    size of the block (number of words),
                        used with start or end parameter.
        @return         array of unsigned short (uint16_t) data.
        '''
        bin = array('H')

        if self._buf == {} and None in (start, end):
            return bin

        if size is not None and size <= 0:
            raise ValueError("tobinarray: wrong value for size")

        start, end = self._get_start_end(start, end, size)

        for addr in range_g(start, end+1):
            bin.append(self[addr])

        return bin

#/class IntelHex16bit

def hex2bin(fin, fout, start=None, end=None, size=None, pad=None):
    """Hex-to-Bin convertor engine.
    @return     0   if all OK

    @param  fin     input hex file (filename or file-like object)
    @param  fout    output bin file (filename or file-like object)
    @param  start   start of address range (optional)
    @param  end     end of address range (inclusive; optional)
    @param  size    size of resulting file (in bytes) (optional)
    @param  pad     padding byte (optional)
    """
    try:
        h = IntelHex(fin)
    except HexReaderError:
        e = sys.exc_info()[1]     # current exception
        txt = "ERROR: bad HEX file: %s" % str(e)
        print(txt)
        return 1

    # start, end, size
    if size != None and size != 0:
        if end == None:
            if start == None:
                start = h.minaddr()
            end = start + size - 1
        else:
            if (end+1) >= size:
                start = end + 1 - size
            else:
                start = 0

    try:
        if pad is not None:
            # using .padding attribute rather than pad argument to function call
            h.padding = pad
        h.tobinfile(fout, start, end)
    except IOError:
        e = sys.exc_info()[1]     # current exception
        txt = "ERROR: Could not write to file: %s: %s" % (fout, str(e))
        print(txt)
        return 1

    return 0
#/def hex2bin

def bin2hex(fin, fout, offset=0):
    """Simple bin-to-hex convertor.
    @return     0   if all OK

    @param  fin     input bin file (filename or file-like object)
    @param  fout    output hex file (filename or file-like object)
    @param  offset  starting address offset for loading bin
    """
    h = IntelHex()
    try:
        h.loadbin(fin, offset)
    except IOError:
        e = sys.exc_info()[1]     # current exception
        txt = 'ERROR: unable to load bin file:', str(e)
        print(txt)
        return 1

    try:
        h.tofile(fout, format='hex')
    except IOError:
        e = sys.exc_info()[1]     # current exception
        txt = "ERROR: Could not write to file: %s: %s" % (fout, str(e))
        print(txt)
        return 1

    return 0
#/def bin2hex

def diff_dumps(ih1, ih2, tofile=None, name1="a", name2="b", n_context=3):
    """Diff 2 IntelHex objects and produce unified diff output for their
    hex dumps.

    @param ih1        first IntelHex object to compare
    @param ih2        second IntelHex object to compare
    @param tofile     file-like object to write output
    @param name1      name of the first hex file to show in the diff header
    @param name2      name of the first hex file to show in the diff header
    @param n_context  number of context lines in the unidiff output
    """
    def prepare_lines(ih):
        sio = StringIO()
        ih.dump(sio)
        dump = sio.getvalue()
        lines = dump.splitlines()
        return lines
    a = prepare_lines(ih1)
    b = prepare_lines(ih2)
    import difflib
    result = list(difflib.unified_diff(a, b, fromfile=name1, tofile=name2, n=n_context, lineterm=''))
    if tofile is None:
        tofile = sys.stdout
    output = '\n'.join(result)+'\n'
    tofile.write(output)

class Record(object):
    """Helper methods to build valid ihex records."""

    def _from_bytes(bytes):
        """Takes a list of bytes, computes the checksum, and outputs the entire
        record as a string. bytes should be the hex record without the colon
        or final checksum.

        @param  bytes   list of byte values so far to pack into record.
        @return         String representation of one HEX record
        """
        assert len(bytes) >= 4
        # calculate checksum
        s = (-sum(bytes)) & 0x0FF
        bin = array('B', bytes + [s])
        return ':' + asstr(hexlify(bin.tostring())).upper()
    _from_bytes = staticmethod(_from_bytes)

    def data(offset, bytes):
        """Return Data record. This constructs the full record, including
        the length information, the record type (0x00), the
        checksum, and the offset.

        @param  offset  load offset of first byte.
        @param  bytes   list of byte values to pack into record.

        @return         String representation of one HEX record
        """
        assert 0 <= offset < 65536
        assert 0 < len(bytes) < 256
        b = [len(bytes), (offset>>8)&0x0FF, offset&0x0FF, 0x00] + bytes
        return Record._from_bytes(b)
    data = staticmethod(data)

    def eof():
        """Return End of File record as a string.
        @return         String representation of Intel Hex EOF record
        """
        return ':00000001FF'
    eof = staticmethod(eof)

    def extended_segment_address(usba):
        """Return Extended Segment Address Record.
        @param  usba     Upper Segment Base Address.

        @return         String representation of Intel Hex USBA record.
        """
        b = [2, 0, 0, 0x02, (usba>>8)&0x0FF, usba&0x0FF]
        return Record._from_bytes(b)
    extended_segment_address = staticmethod(extended_segment_address)

    def start_segment_address(cs, ip):
        """Return Start Segment Address Record.
        @param  cs      16-bit value for CS register.
        @param  ip      16-bit value for IP register.

        @return         String representation of Intel Hex SSA record.
        """
        b = [4, 0, 0, 0x03, (cs>>8)&0x0FF, cs&0x0FF,
             (ip>>8)&0x0FF, ip&0x0FF]
        return Record._from_bytes(b)
    start_segment_address = staticmethod(start_segment_address)

    def extended_linear_address(ulba):
        """Return Extended Linear Address Record.
        @param  ulba    Upper Linear Base Address.

        @return         String representation of Intel Hex ELA record.
        """
        b = [2, 0, 0, 0x04, (ulba>>8)&0x0FF, ulba&0x0FF]
        return Record._from_bytes(b)
    extended_linear_address = staticmethod(extended_linear_address)

    def start_linear_address(eip):
        """Return Start Linear Address Record.
        @param  eip     32-bit linear address for the EIP register.

        @return         String representation of Intel Hex SLA record.
        """
        b = [4, 0, 0, 0x05, (eip>>24)&0x0FF, (eip>>16)&0x0FF,
             (eip>>8)&0x0FF, eip&0x0FF]
        return Record._from_bytes(b)
    start_linear_address = staticmethod(start_linear_address)

class _BadFileNotation(Exception):
    """Special error class to use with _get_file_and_addr_range."""
    pass

def _get_file_and_addr_range(s, _support_drive_letter=None):
    """Special method for hexmerge.py script to split file notation
    into 3 parts: (filename, start, end)

    @raise _BadFileNotation  when string cannot be safely split.
    """
    if _support_drive_letter is None:
        _support_drive_letter = (os.name == 'nt')
    drive = ''
    if _support_drive_letter:
        if s[1:2] == ':' and s[0].upper() in ''.join([chr(i) for i in range_g(ord('A'), ord('Z')+1)]):
            drive = s[:2]
            s = s[2:]
    parts = s.split(':')
    n = len(parts)
    if n == 1:
        fname = parts[0]
        fstart = None
        fend = None
    elif n != 3:
        raise _BadFileNotation
    else:
        fname = parts[0]
        def ascii_hex_to_int(ascii):
            if ascii is not None:
                try:
                    return int(ascii, 16)
                except ValueError:
                    raise _BadFileNotation
            return ascii
        fstart = ascii_hex_to_int(parts[1] or None)
        fend = ascii_hex_to_int(parts[2] or None)
    return drive+fname, fstart, fend

##
# IntelHex Errors Hierarchy:
#
#  IntelHexError    - basic error
#       HexReaderError  - general hex reader error
#           AddressOverlapError - data for the same address overlap
#           HexRecordError      - hex record decoder base error
#               RecordLengthError    - record has invalid length
#               RecordTypeError      - record has invalid type (RECTYP)
#               RecordChecksumError  - record checksum mismatch
#               EOFRecordError              - invalid EOF record (type 01)
#               ExtendedAddressRecordError  - extended address record base error
#                   ExtendedSegmentAddressRecordError   - invalid extended segment address record (type 02)
#                   ExtendedLinearAddressRecordError    - invalid extended linear address record (type 04)
#               StartAddressRecordError     - start address record base error
#                   StartSegmentAddressRecordError      - invalid start segment address record (type 03)
#                   StartLinearAddressRecordError       - invalid start linear address record (type 05)
#                   DuplicateStartAddressRecordError    - start address record appears twice
#                   InvalidStartAddressValueError       - invalid value of start addr record
#       _EndOfFile  - it's not real error, used internally by hex reader as signal that EOF record found
#       BadAccess16bit - not enough data to read 16 bit value (deprecated, see NotEnoughDataError)
#       NotEnoughDataError - not enough data to read N contiguous bytes
#       EmptyIntelHexError - requested operation cannot be performed with empty object

class IntelHexError(Exception):
    '''Base Exception class for IntelHex module'''

    _fmt = 'IntelHex base error'   #: format string

    def __init__(self, msg=None, **kw):
        """Initialize the Exception with the given message.
        """
        self.msg = msg
        for key, value in dict_items_g(kw):
            setattr(self, key, value)

    def __str__(self):
        """Return the message in this Exception."""
        if self.msg:
            return self.msg
        try:
            return self._fmt % self.__dict__
        except (NameError, ValueError, KeyError):
            e = sys.exc_info()[1]     # current exception
            return 'Unprintable exception %s: %s' \
                % (repr(e), str(e))

class _EndOfFile(IntelHexError):
    """Used for internal needs only."""
    _fmt = 'EOF record reached -- signal to stop read file'

class HexReaderError(IntelHexError):
    _fmt = 'Hex reader base error'

class AddressOverlapError(HexReaderError):
    _fmt = 'Hex file has data overlap at address 0x%(address)X on line %(line)d'

# class NotAHexFileError was removed in trunk.revno.54 because it's not used

class HexRecordError(HexReaderError):
    _fmt = 'Hex file contains invalid record at line %(line)d'

class RecordLengthError(HexRecordError):
    _fmt = 'Record at line %(line)d has invalid length'

class RecordTypeError(HexRecordError):
    _fmt = 'Record at line %(line)d has invalid record type'

class RecordChecksumError(HexRecordError):
    _fmt = 'Record at line %(line)d has invalid checksum'

class EOFRecordError(HexRecordError):
    _fmt = 'File has invalid End-of-File record'

class ExtendedAddressRecordError(HexRecordError):
    _fmt = 'Base class for extended address exceptions'

class ExtendedSegmentAddressRecordError(ExtendedAddressRecordError):
    _fmt = 'Invalid Extended Segment Address Record at line %(line)d'

class ExtendedLinearAddressRecordError(ExtendedAddressRecordError):
    _fmt = 'Invalid Extended Linear Address Record at line %(line)d'

class StartAddressRecordError(HexRecordError):
    _fmt = 'Base class for start address exceptions'

class StartSegmentAddressRecordError(StartAddressRecordError):
    _fmt = 'Invalid Start Segment Address Record at line %(line)d'

class StartLinearAddressRecordError(StartAddressRecordError):
    _fmt = 'Invalid Start Linear Address Record at line %(line)d'

class DuplicateStartAddressRecordError(StartAddressRecordError):
    _fmt = 'Start Address Record appears twice at line %(line)d'

class InvalidStartAddressValueError(StartAddressRecordError):
    _fmt = 'Invalid start address value: %(start_addr)s'

class NotEnoughDataError(IntelHexError):
    _fmt = ('Bad access at 0x%(address)X: '
            'not enough data to read %(length)d contiguous bytes')

class BadAccess16bit(NotEnoughDataError):
    _fmt = 'Bad access at 0x%(address)X: not enough data to read 16 bit value'

class EmptyIntelHexError(IntelHexError):
    _fmt = "Requested operation cannot be executed with empty object"

redpajama_set_name: RedPajamaGithub


text:
Kayla-Joleen Doris
Freelance writer and creator of website Reset Travel.
nataal.com
AaKs
Akosua Afriyie-Kumi's ethical fashion brand AAKS has been producing handcrafted luxury handbags in Ghana since 2014 and these days she's spreading the love worldwide. The designer blends traditional African textiles and craftsmanship with contemporary designs – an approach that is a result of her experiences both at home and abroad as well as a reflection of how deeply interwoven she is with her canny business strategy and heartfelt creative vision.
SUITCASE Magazine
Five Unaffected Caribbean Islands You Won't Know (But Should Visit) | SUITCASe Magazine
The Caribbean probably isn't currently at the top of your winter sun wishlist. As the aftermath of hurricanes Irma and Maria continue to play out on our newsfeeds, it would be ignorant to downplay the destruction caused by the storms. The category five hurricanes were some of the worst recorded in the Atlantic, with Cuba, Anguilla and the British Virgin Islands among those bearing the brunt of Irma.
Wake Up Here: Wilderness Country Reserve | SUITCASE Magazine
Sprawled out across the East Anglian countryside, luxury estate Wilderness Reserve spans 5000 acres of preserved meadows, woodland and lakes, positioning itself as the go-to for a quintessential English stay. Choose between rustic cottages, farmhouses or a converted barn, with Georgian manor house Sibton Park offering a Downton Abbey-esque experience thanks to traditional decor, a formal dining room and private courtyard.
Union Times
London Fashion Exhibitions Not To Miss This Year
Alexander McQueen: Savage Beauty raised the bar last year when it became the V&A's most popular exhibition in history with almost half a million visitors. Not one to rest on its laurels, London is continuing to showcase the best of the fashion industry with numerous exhibitions this year.
Spindle Magazine
When Did Food Become Fashionable?
It's the latest snapshot that your Instagram needs to stay trendy. Nothing shouts hip more than a salacious oversized burger put with a pair of skinny fries and a full length Coke. And nothing screams nonchalance more than someone who doesn't care how many calories are in their feast.
The Enduring Appeal of the Bohemian | SUITCASE Magazine
Fashion's love affair with the bohemian reignited this year. Exotic embellishments sparkled, jeans flared and burnt oranges and browns constituted the season's colour palette. A flirtation in early 2014 involved saturated hues, dalliances with suede and teases of slouchy trouser shapes at Milan Fashion Week; by the end of the year a full-on romance had bloomed.
Best Riads in Morocco
Summer may be coming to an end but that doesn't mean your fun has to end too. In an effort to prolong our favourite season, we've teamed up with boutique hotel experts Mr and Mrs Smith to find the perfect places to extend summer.
Preview: Meatopia x Sailor Jerry
Vegans and vegetarians look away now. Carnivores - this one's for you. Meatopia will be taking place this weekend. That's meat utopia. Meat heaven. Where God is played by chef Richard Turner, creator of this meaty festival, and the singing angels come in the form of Groove Armada, Severino and Love Glove.
Best Boutique Hotels in Tel Aviv | SUITCASE Magazine
A city that is attracting more and more visitors every year for its art, food and nightlife - Tel Aviv should be one of the places on your bucketlist. These are the best boutique hotels in Tel Aviv.
Southbank's Festival of Love
If you hadn't heard, Southbank Centre is giving Saint Valentine a run for his money. Why just spend one day celebrating love, when you could spend sixty? The Centre has been hosting The Festival of Love since June, celebrating the Same Sex Couples Act by rejoicing and revelling in all things lovey.
Preview: Beacons Festival
Beacons Festival returns to Yorkshire for a third time after its remarkable success in previous years. The music and arts festival has recently revealed its art and film schedule, and looks set on becoming their strongest event to date.
Preview: Scarlett Raven Debut at Mayfair's Fine Art Gallery
Up and coming artist Scarlett Raven will be debuting her contemporary collection in Mayfair this month. The cited 'Van Gogh in the making' (no pressure then), will display her newly unveiled collection at the Castle Fine Art gallery for two weeks. The Central Saint Martins graduate is set to impress us with her art work entitled 'The Eleventh Hour.'
Preview: Simon Constin's Impossible Catwalk Shows
Fashion's favourite month is fast approaching and whilst we don't want summer to be over, the lure of this September's Fashion Week is calling our names. Adding to the autumn appeal is Simon Costin's Impossible Catwalk Show, a new exhibition that kicks off on the first day of Fashion Week and explores the possibilities of catwalk shows if there were to be no limits.
The Edinburgh Festival Fringe
The largest arts festival in the world returns this month for three weeks. The Edinburgh Festival Fringe begins on the 1st of August, ready to showcase even more artists after the 2,871 shows that were held last year. With over 250 venues showcasing extraordinary talent, there is no doubt that there is something for everyone.
Review: Man Meets Woman
Man meets woman. Man fantasises of next few hours. Woman fantasises of next few decades. Yang Liu's humorous graphic novel highlights the differences between the male and female thought process, using a series of simple diagrams that both sexes can understand.
Black Mirror Christmas Special
This winter, Channel 4 brings you a new nightmare before Christmas. No not Christmas shopping. And not X Factor-winners Christmas number one. In fact we're very sorry to have even mentioned the C-word at all. But this seasonal gift we think you may like, as Channel 4 bear to us the Black Mirror Christmas Special.

redpajama_set_name: RedPajamaCommonCrawl


Where will you go in 2017? If you said "nowhere," then get in line behind the rest of America. But there's still time to change your answer — and you might want to.
Nearly half of U.S. travelers surveyed by digital marketing firm Fluent say they don't intend to take any vacation trips next year. Of the respondents with plans, 45 percent say that they will travel only domestically.
Fluent's latest numbers don't paint as grim a picture as did its Thanksgiving travel survey, which suggested that 78 percent of Americans were grounding themselves for the holidays because of a variety of fears and uncertainties, including worries about the Zika virus, terrorism and the results of the presidential election.
"Until there's greater confidence in the economy and state of affairs in the country in general, I wouldn't expect to see large numbers of consumers saying that they will be taking exotic and expensive vacations in 2017," says Jordan Cohen, Fluent's chief marketing officer.
That's normal for a post-election year, says Mark Noennig, executive vice president and general manager at Mark Travel, which owns the brands and handles tours for Funjet Vacations, United Vacations, and Southwest Vacations among others.
So why are we talking about not traveling — in, of all places, a travel column? Because in light of some promising industry trends, there may be more travel opportunities in 2017 than you think.
Let's review a few more 2017 numbers. The largest agency consortium in America says travel will remain affordable next year.
"We see modest price increases for 2017," says John Lovell, president of Travel Leaders Network and Leisure Group. "It is really a function of the specific time in which you're traveling and to where." For example, he says, overall airfares are expected to rise between 3 and 5 percent in 2017. About the same increase is predicted for hotels, but cruise prices should only rise "slightly" in the new year.
"Some of the price increases are mitigated by consumers seeing lower than typical pricing in some European destinations, especially in cities like Paris and London," Lovell says.
If you look for bargains, you'll probably find them. Reduced travel demand, lower energy prices and a strong dollar could set the stage for some real steals. "It makes next year a great year for international travel," says Adam Cooper, senior vice president for North America at STA Travel.
What are the trends that will shape next year? In email interviews with travel industry insiders, I found that most reflect a more conservative, less-is-more approach.
Alternative accommodations: One of the big trends of the past decade has been toward vacation rentals and apartments, and away from traditional hotels. As travelers stay closer to home, that trend should continue to accelerate. But a contrarian booking strategy might be helpful, says Henrik Kjellberg, president of Hotwire, an online travel site. "There's a greater supply of available hotel rooms, and the rates for travelers to secure great lodging will be lower in 2017 than 2016," he says.
The need for authenticity: When people travel in 2017, they'll be picky about where they go, according to Jay Schwartz, founder of IdeaWork Studios, a branding agency that specializes in the hospitality industry. "People are craving authentic experiences," he says. Think unique neighborhoods, boutique hotels and other only in experiences. On the flip side, this may mean more competitive pricing on vacation experiences deemed less authentic, such as theme parks.
Instant gratification: Another theme for 2017 is the increase in short-term bookings. "I'm anticipating a noticeable shift in consumer behavior toward on-demand bookings," says Sam Shank, chief executive of HotelTonight, a discount reservation agency. "I believe that we're migrating towards shorter lead times in accordance with more accessible and mobile booking options that open things up and don't require extensive lead times," he says. In other words, more people are waiting until the last minute to book. The contrarian strategy? Plan now for your 2017 vacation. You could be rewarded with a better rate.
Taken together, these trends suggest that defying conventional wisdom may yield the best results. Travelers are setting the bar high — perhaps too high. They're spending so much time looking for something different that they might miss the bargains in front of them.


text:
Music Friday: Neil Diamond Retires Due to Parkinson's Diagnosis; Ride Has Been 'So Good, So Good, So Good'
Welcome to Music Friday when we normally bring you fun songs with jewelry, gemstones or precious metals in the title or lyrics. Today we bend the rules just a bit to pay tribute to the incomparable Neil Diamond, who was forced to cancel the third leg of his year-long, worldwide golden anniversary tour due to a Parkinson's diagnosis.
Diamond made the announcement on Monday, just two days short of his 77th birthday.
"It is with great reluctance and disappointment that I announce my retirement from concert touring," said the Brooklyn native. "I have been so honored to bring my shows to the public for the past 50 years. My thanks go out to my loyal and devoted audiences around the world. You will always have my appreciation for your support and encouragement. This ride has been 'so good, so good, so good' thanks to you."
Diamond's "so good" comment is a nod to his timeless 1969 hit, "Sweet Caroline," a song that has been woven into the fabric of American culture. Played at sporting events from coast to coast, when Diamond sings the line, "Good times never seemed so good," the crowd chants back, "So good, so good, so good."
Originally believed to be an ode to Caroline Kennedy, the then-11-year-old daughter of late President John F. Kennedy, "Sweet Caroline" was actually written for Diamond's second wife, Marcia.
Diamond revealed the truth during a 2014 appearance on the Today show.
"I was writing a song in Memphis, Tenn., for a session. I needed a three-syllable name," Diamond said. "The song was about my wife at the time — her name was Marcia — and I couldn't get a 'Marcia' rhyme."
The song was released in the summer of 1969 and zoomed to #4 on the U.S. Billboard Hot 100 chart. Over the course of his 56-year career as a singer-songwriter-musician, Diamond has sold more than 130 million albums worldwide and placed 38 singles in the Top 10 on the U.S. Billboard Adult Contemporary chart. None has been more enduring than "Sweet Caroline." The song has been covered by Elvis Presley, Frank Sinatra, Roy Orbison, Julio Iglesias and many more.
Born and raised in Brooklyn, Diamond was a member of Erasmus Hall High School's Chorus and Choral Club along with close friend Barbara Streisand. Diamond got his first inspiration to write his own songs when folk singer Pete Seeger visited a summer camp he was attending as a teenager.
"And the next thing, I got a guitar when we got back to Brooklyn, started to take lessons and almost immediately began to write songs," he told Rolling Stone.
Just 10 credits short of an undergraduate degree from New York University, Diamond dropped out of college to take a 16-week assignment writing songs for Sunbeam Music Publishing. The job paid $50 per week. Later in his career, he would joke, "If this darn songwriting thing hadn't come up, I would have been a doctor now."
Please check out the rare video of a 33-year-old Diamond singing "Sweet Caroline" on the Shirley Bassey Show in 1974. The lyrics are below, but you probably already know the words...
"Sweet Caroline"
Written and performed by Neil Diamond.
Where it began, I can't begin to knowing
But then I know it's growing strong
Was in the spring
Then spring became the summer
Who'd have believed you'd come along
Hands, touching hands
Reaching out, touching me, touching you
Good times never seemed so good
I'd be inclined
To believe they never would
But now I
Look at the night and it don't seem so lonely
We filled it up with only two
And when I hurt
Hurting runs off my shoulders
How can I hurt when I'm holding you
One, touching one
Oh no, no
I believe they never could


text:
Basketball Development
Head Coach Lisa Bluder
Hawkeyes in the WNBA *Coming Soon
2020-21 Media Guide (PDF)
2020 Golf Extravaganza
Hawk Talk Schedule
Women's Basketball / March 3, 2019
WBB: IOWA VS NORTHWESTERN ON SENIOR DAY
Iowa Hawkeyes seniors Hannah Stewart, Tania Davis, and Megan Gustafson wave to the fans during senior day ceremonies following their game against the Northwestern Wildcats Sunday, March 3, 2019 at Carver-Hawkeye Arena. (Brian Ray/hawkeyesports.com)
Iowa Hawkeyes forward Megan Gustafson (10) against the Northwestern Wildcats Sunday, March 3, 2019 at Carver-Hawkeye Arena. (Brian Ray/hawkeyesports.com)
Iowa Hawkeyes forward Megan Gustafson (10) hugs forward Amanda Ollinger (43), and guard Tomi Taiwo (1) as she lives the court for the final time against the Northwestern Wildcats Sunday, March 3, 2019 at Carver-Hawkeye Arena. (Brian Ray/hawkeyesports.com)
Iowa Hawkeyes forward Megan Gustafson (10) hugs center Monika Czinano (25) as she lives the court for the final time against the Northwestern Wildcats Sunday, March 3, 2019 at Carver-Hawkeye Arena. (Brian Ray/hawkeyesports.com)
Iowa Hawkeyes forward Megan Gustafson (10) waves to the fans as she lives the court for the final time against the Northwestern Wildcats Sunday, March 3, 2019 at Carver-Hawkeye Arena. (Brian Ray/hawkeyesports.com)
Iowa Hawkeyes forward Megan Gustafson (10) hugs head coach Lisa Bluder as she lives the court for the final time against the Northwestern Wildcats Sunday, March 3, 2019 at Carver-Hawkeye Arena. (Brian Ray/hawkeyesports.com)
Iowa Hawkeyes forward Megan Gustafson (10) hugs guard Tania Davis (11) and forward Hannah Stewart (21) after they were taken out of the game against the Northwestern Wildcats Sunday, March 3, 2019 at Carver-Hawkeye Arena. (Brian Ray/hawkeyesports.com)
Iowa Hawkeyes forward Megan Gustafson (10) and guard Makenzie Meyer (3) against the Northwestern Wildcats Sunday, March 3, 2019 at Carver-Hawkeye Arena. (Brian Ray/hawkeyesports.com)
Iowa Hawkeyes forward Megan Gustafson (10), forward Hannah Stewart (21), and guard Tania Davis (11) against the Northwestern Wildcats Sunday, March 3, 2019 at Carver-Hawkeye Arena. (Brian Ray/hawkeyesports.com)
Iowa Hawkeyes forward Megan Gustafson (10) and SID Brandee Britt against the Northwestern Wildcats Sunday, March 3, 2019 at Carver-Hawkeye Arena. (Brian Ray/hawkeyesports.com)
Iowa Hawkeyes head coach Lisa Bluder against the Northwestern Wildcats Sunday, March 3, 2019 at Carver-Hawkeye Arena. (Brian Ray/hawkeyesports.com)
Iowa Hawkeyes guard Tania Davis (11) against the Northwestern Wildcats Sunday, March 3, 2019 at Carver-Hawkeye Arena. (Brian Ray/hawkeyesports.com)
Iowa Hawkeyes guard Kathleen Doyle (22) against the Northwestern Wildcats Sunday, March 3, 2019 at Carver-Hawkeye Arena. (Brian Ray/hawkeyesports.com)
Iowa Hawkeyes guard Tania Davis (11) and guard Tomi Taiwo (1) against the Northwestern Wildcats Sunday, March 3, 2019 at Carver-Hawkeye Arena. (Brian Ray/hawkeyesports.com)
Iowa Hawkeyes forward Hannah Stewart (21) and forward Amanda Ollinger (43) against the Northwestern Wildcats Sunday, March 3, 2019 at Carver-Hawkeye Arena. (Brian Ray/hawkeyesports.com)
Iowa Hawkeyes forward Hannah Stewart (21) and head coach Lisa Bluder against the Northwestern Wildcats Sunday, March 3, 2019 at Carver-Hawkeye Arena. (Brian Ray/hawkeyesports.com)
The Iowa Hawkeyes against the Northwestern Wildcats Sunday, March 3, 2019 at Carver-Hawkeye Arena. (Brian Ray/hawkeyesports.com)
The Iowa Women's Basketball Managers during senior day ceremonies following their game against the Northwestern Wildcats Sunday, March 3, 2019 at Carver-Hawkeye Arena. (Brian Ray/hawkeyesports.com)
Iowa Hawkeyes forward Hannah Stewart (21) during senior day ceremonies following their game against the Northwestern Wildcats Sunday, March 3, 2019 at Carver-Hawkeye Arena. (Brian Ray/hawkeyesports.com)
Iowa Hawkeyes forward Megan Gustafson (10) during senior day ceremonies following their game against the Northwestern Wildcats Sunday, March 3, 2019 at Carver-Hawkeye Arena. (Brian Ray/hawkeyesports.com)
The parents of Hannah Stewart during senior day ceremonies following their game against the Northwestern Wildcats Sunday, March 3, 2019 at Carver-Hawkeye Arena. (Brian Ray/hawkeyesports.com)
Iowa Hawkeyes head coach Lisa Bluder during senior day ceremonies following their game against the Northwestern Wildcats Sunday, March 3, 2019 at Carver-Hawkeye Arena. (Brian Ray/hawkeyesports.com)
Iowa Hawkeyes guard Tania Davis (11) during senior day ceremonies following their game against the Northwestern Wildcats Sunday, March 3, 2019 at Carver-Hawkeye Arena. (Brian Ray/hawkeyesports.com)
Iowa Hawkeyes guard Tania Davis (11) and forward Hannah Stewart (21) during senior day ceremonies following their game against the Northwestern Wildcats Sunday, March 3, 2019 at Carver-Hawkeye Arena. (Brian Ray/hawkeyesports.com)
Iowa Hawkeyes forward Megan Gustafson (10) and head coach Lisa Bluder during senior day ceremonies following their game against the Northwestern Wildcats Sunday, March 3, 2019 at Carver-Hawkeye Arena. (Brian Ray/hawkeyesports.com)
Iowa Hawkeyes forward Megan Gustafson (10) and associate head coach Jan Jensen during senior day ceremonies following their game against the Northwestern Wildcats Sunday, March 3, 2019 at Carver-Hawkeye Arena. (Brian Ray/hawkeyesports.com)
Iowa Hawkeyes forward Megan Gustafson (10), guard Tania Davis (11), and forward Hannah Stewart (21) during senior day ceremonies following their game against the Northwestern Wildcats Sunday, March 3, 2019 at Carver-Hawkeye Arena. (Brian Ray/hawkeyesports.com)
The Iowa Hawkeyesduring senior day ceremonies following their game against the Northwestern Wildcats Sunday, March 3, 2019 at Carver-Hawkeye Arena. (Brian Ray/hawkeyesports.com)
Iowa Hawkeyes forward Hannah Stewart (21) and guard Tania Davis (11) during senior day ceremonies following their game against the Northwestern Wildcats Sunday, March 3, 2019 at Carver-Hawkeye Arena. (Brian Ray/hawkeyesports.com)
The Iowa Hawkeyes during senior day ceremonies following their game against the Northwestern Wildcats Sunday, March 3, 2019 at Carver-Hawkeye Arena. (Brian Ray/hawkeyesports.com)
Iowa Hawkeyes forward Megan Gustafson (10) and guard Kathleen Doyle (22) during senior day ceremonies following their game against the Northwestern Wildcats Sunday, March 3, 2019 at Carver-Hawkeye Arena. (Brian Ray/hawkeyesports.com)
Iowa Hawkeyes forward Megan Gustafson (10) takes, photos, signs autographs, and gives hugs following senior day ceremonies Sunday, March 3, 2019 at Carver-Hawkeye Arena. (Brian Ray/hawkeyesports.com)
Iowa Hawkeyes forward Megan Gustafson (10), forward Hannah Stewart (21), guard Kathleen Doyle (22) against the Northwestern Wildcats Sunday, March 3, 2019 at Carver-Hawkeye Arena. (Brian Ray/hawkeyesports.com)
Iowa Hawkeyes forward Megan Gustafson (10), forward Hannah Stewart (21), and guard Kathleen Doyle (22) against the Northwestern Wildcats Sunday, March 3, 2019 at Carver-Hawkeye Arena. (Brian Ray/hawkeyesports.com)
Eva Gustafson against the Northwestern Wildcats Sunday, March 3, 2019 at Carver-Hawkeye Arena. (Brian Ray/hawkeyesports.com)
Iowa Hawkeyes forward Hannah Stewart (21) against the Northwestern Wildcats Sunday, March 3, 2019 at Carver-Hawkeye Arena. (Brian Ray/hawkeyesports.com)
Iowa Hawkeyes head coach Lisa Bluder and Eva Gustafson (10) against the Northwestern Wildcats Sunday, March 3, 2019 at Carver-Hawkeye Arena. (Brian Ray/hawkeyesports.com)
Iowa Hawkeyes head coach Lisa Bluder kisses her mother before their game against the Northwestern Wildcats Sunday, March 3, 2019 at Carver-Hawkeye Arena. (Brian Ray/hawkeyesports.com)
Iowa Hawkeyes head coach Lisa Bluder kisses her father before their game against the Northwestern Wildcats Sunday, March 3, 2019 at Carver-Hawkeye Arena. (Brian Ray/hawkeyesports.com)
Eva Gustafson (10) against the Northwestern Wildcats Sunday, March 3, 2019 at Carver-Hawkeye Arena. (Brian Ray/hawkeyesports.com)
Iowa Hawkeyes forward Megan Gustafson (10) and center Monika Czinano (25) against the Northwestern Wildcats Sunday, March 3, 2019 at Carver-Hawkeye Arena. (Brian Ray/hawkeyesports.com)
Iowa Hawkeyes head coach Lisa Bluder watches as her daughter Emma sings the National Anthem before the Iowa Hawkeyes game against the Northwestern Wildcats Sunday, March 3, 2019 at Carver-Hawkeye Arena. (Brian Ray/hawkeyesports.com)
Iowa Hawkeyes guard Kathleen Doyle (22) and guard Zion Sanders (24) against the Northwestern Wildcats Sunday, March 3, 2019 at Carver-Hawkeye Arena. (Brian Ray/hawkeyesports.com)
Iowa Hawkeyes guard Makenzie Meyer (3) against the Northwestern Wildcats Sunday, March 3, 2019 at Carver-Hawkeye Arena. (Brian Ray/hawkeyesports.com)
Iowa Hawkeyes guard Alexis Sevillian (5) against the Northwestern Wildcats Sunday, March 3, 2019 at Carver-Hawkeye Arena. (Brian Ray/hawkeyesports.com)
Former players are introduced during the Iowa Hawkeyes game against the Northwestern Wildcats Sunday, March 3, 2019 at Carver-Hawkeye Arena. (Brian Ray/hawkeyesports.com)
Iowa Hawkeyes center Monika Czinano (25) against the Northwestern Wildcats Sunday, March 3, 2019 at Carver-Hawkeye Arena. (Brian Ray/hawkeyesports.com)
The Iowa Hawkeyes take on the Northwestern Wildcats Sunday, March 3, 2019 at Carver-Hawkeye Arena. (Brian Ray/hawkeyesports.com)
People line up for Carver Cones during the Iowa Hawkeyes game against the Northwestern Wildcats Sunday, March 3, 2019 at Carver-Hawkeye Arena. (Brian Ray/hawkeyesports.com)
Women's Basketball at Maryland Postponed
Women's Basketball / January 19, 2021 Women's Basketball at Maryland Postponed
Women's Basketball at Rutgers Postponed
Women's Basketball / January 19, 2021 Women's Basketball at Rutgers Postponed
Late Run Propels Hawkeyes Past Boilermakers
Women's Basketball / January 18, 2021 Late Run Propels Hawkeyes Past Boilermakers


Damen Bell-Holter is used to making headlines, as the first member of the Haida Nation to ever step on an NBA floor.
Now the 25-year-old, 6'9″ gentle giant, a former member of the Boston Celtics, is making headlines of a different kind. Bell-Holter, now playing professionally overseas in Finland, is speaking out about the issue of youth suicides, which have plagued First Nations communities.
I sat down with him to find out why the issue touches home for him — and how he is taking action.
CT: Why has youth suicide become a signature issue for you?
DBH: Growing up in Hydaburg, Alaska, it was a big problem. My home life wasn't ideal, with alcoholism and abuse and all those things. I had cousins who committed suicide. When you're in a town that small, with only around 300 people, almost everyone's family has been through it. It seemed like there was a suicide every year.
CT: What's going on, and why is this happening?
DBH: When you're stuck in small communities, that's all you can see. You don't really have big hopes for the future. I was extremely fortunate because I had basketball as an outlet, which was huge for me. But if you don't have an outlet like that, there's a lot of negativity in these small towns. And all it takes is one moment of weakness and struggle.
CT: What have you decided to do about it?
DBH: Since my sophomore year in college, I've been holding basketball camps for kids every single year. My goal was to give back and work with kids, and since I started doing that, I discovered what a big issue youth suicide is in so many communities. It's a real pattern.
As a result, about 60-70 per cent of the time in my camps doesn't even involve basketball. I talk to kids about domestic violence, about alcohol abuse, about drugs. I've done over 40 of these camps over the last few years, all the way from Alaska, to Haida Gwaii, to mainland B.C., to reservations in lower 48 states like Washington, Oregon and Utah.
CT: Why is it so important for First Nations kids to hear from you?
CT: Losing young people in this way is particularly heartbreaking. What would you say to communities going through this?
DBH: The biggest thing is to keep kids involved. Demonstrate a lot of positivity, make sure kids are coming to the gym, keep them active, and show them that you care. Some communities, like Skidegate on Haida Gwaii, are really great at that.
CT: To kids who are in a dark place right now, what would you say to them?
DBH: Your home-life doesn't have to dictate your future and how you feel about yourself. Suicide doesn't have to be an option. Everyone has struggles: I had thoughts of suicide when I was a kid, too. I thought there was nothing better for me out there. But if I had taken my own life, I would have affected my family and my community for generations to come. I wouldn't be here sharing my story right now.
CT: How has the response been to your youth camps?
DBH: The great thing about native communities is that when someone does something special, everyone really comes together to support them. I've had so much support from Haida Gwaii, and towns like Skidegate and Masset, with people telling me they're proud of me. Hopefully I'll have an effect on these kids, even just a few of them, because here I am — Haida from a small Alaska town of 300 — and I've seen the highest levels of basketball in the world, doing things I never thought I'd have the opportunity to do.
This entry was posted in Health, Sports and tagged Damen Bell-Holter, First Nations, suicide, youth by Kim Kalliber. Bookmark the permalink.


As with transactions on any eCommerce websites, there will always be a small element of risk. In order to minimize that, every item that arrives the China logistics will be inspected**, and it is estimated that around 90% of all visibly defective items can discover during inspection. After you have received your parcel, you may request for refund if goods received is damaged, or goods deviate from your order.
Quantity of items will be checked to see if they match the quantity ordered.
Items will be compared with the photograph of the item on the third party seller's website. Do note that we might not be able to discover or non-apparent defects.
General colour of the product will be checked.
Size will be checked according to the label on the item. We cannot be held responsible if the seller tag the wrong size to the item.
Obvious defects which can be detected visually such as tears, holes, scratches, stains, dents etc will be checked for.
* For purchases with unit price below RMB 50.00, only the quantity of your purchases will be checked.
* For items that come in wooden crates or original packaging, inspection will not be conducted.
* Authenticity of product cannot be verified, please see note ** below.
Quality/functionality tests will not be conducted during the inspection. SGshop will not be held responsible for any quality or functionality related issues.
Upon receiving of item, if quality/functionality issue is discovered, you can report to us, and we will try to assist by contacting the seller for repair/exchange,but shipping cost will be borne by you.
If item has already been used, and quality/functionality issue is discovered, you can still report to SGshop as long as item is still within warranty period, and original purchase receipts and quality assurance cards are still present.
SGshop cannot promise that the sellers will fully satisfy your requirements; however, we will try our best to help you contact with the sellers.
d) Items that show wear and tear from use.
If good received are damaged, or goods deviate from your order (except in relation to goods that you feel are counterfeit - please see note ** below), please take a photograph of the item and packaging (including barcode), and submit it to 'Submit a Ticket' on our website, complete with information such as parcel number, ID, and description, within three (3) working days. SGshop will investigate before getting back to you. Possible compensation up to RM100.00.
* Customers who confirm that they have received their goods are confirming that their goods arrived in good condition.
Disputes will not be entertained after confirmation of order.
* Fragile Item is not included in the coverage of compensation, even if you have bought SG-Care for Fragile Item, SGshop does not hold responsibility to damage incurred during delivery process.
Please note that our inspection services does not include verifying the authenticity of a product. Accordingly, neither the logistics centre in China nor we at the SGshop are able to check on or verify the authenticity of any products that you order. You agree to fully check all information and photographs made available by the seller that you have selected, and to communicate with such seller for additional information as you may require in order to satisfy yourself on the authenticity of the products that you with the price of similar products sold in retail shop in Malaysia, and if the prices of the online seller are very much lower than the retail shops in Malaysia, the products may not be authentic. Do not buy if you have any doubts on the authenticity of any products from any online seller. We will not be responsible for any counterfeit products, and you agree that you will bear full liability as the principal of the indemnified parties, fully defend, hold harmless and indemnify SGshop, the logistics centre in China, all directors, shareholders, employees, officers and agents of SGshop ("indemnified parties") in the event that any of the indemnified parties face a third party claim or suffer damages or incur expenses as a result of the counterfeit products ordered by you and brought into Malaysia on your behalf by SGshop as your agent acting on your instructions, including but not limited to settlement fees, court action fees, statutory penalties, and legal fees on a solicitor-client basis.


4 Bedroom Detached House For Sale in Stoke-on-Trent for Offers Over £270,000.
This spacious family home is situated in a popular residential area of Alsager and within walking distance of the High School, several local primary schools and the village centre. This four bedroom detached modern property boasts a light lounge through dining room, contemporary fitted cream kitchen, utility rom, family room, conservatory and downstairs WC. To the first floor there are four bedrooms, a lovely family bathroom and an en-suite to the master bedroom. A block paved driveway offers parking and gardens to the front and rear. A great versatile family home.
another useful reception room having double glazing throughout and twin opening doors leading to the rear garden. single pan radiator and TV aerial point.
Space and plumbing for washing machine and Tumble dryer, wall mounted gas central heating boiler.
Double glazed frosted window to the side and radiator. Two piece suite, comprising WC and wash hand basin. Laminate flooring.
Brilliant second reception room, with double glazed window to the front elevation and a single panel radiator. TV aerial point.
Built in airing cupboard and doors leading off.
Double glazed window to front elevation, single panel radiator range of built in wardrobes with sliding doors, over bed storage with matching bedside cabinets and chest of drawers. Door to the ensuite.
White three piece suite, comprising vanity unit with wash hand basin with concealed cistern and WC, fully tiled shower cubicle with multi jet power shower over, Inset ceiling spot lighting, extractor fan and laminate flooring, Upvc double glazed window to front elevation.
Double size room with double glazed window to the front elevation and single panel radiator. Built in wardrobes, TV point and useful storage cupboard.
Double size room with double glazed window to the rear and radiator. Built in wardrobes.
double size room with double glazed window to the rear elevation and single panel radiator. Built in wardrobes.
Double glazed obscure window to rear elevation and feature chrome radiator, twin ended bath with chrome effect electric shower over, wash hand basin with water fall tap and WC. Oak flooring, pvc bathroom wall cladding, inset spot lighting with coloured led lights and panel having multi changing coloured led lighting.
To the front of the property there is a blocked paved driveway leading to parking, lawned area and flower border. Indian slate paved path at the side leads to the rear garden. The rear garden is enclosed having lawned area, flower borders, useful tool store and Indian slate paved patio.


The cabins are rustic wooden structures that have two rooms, sleeping 6 in each room. Generally, our older campers (ages 15-17) sleep in the cabins. They have bunk beds and shelves.
Most campers will stay in tent cabins, which we call "Miner's Tents" because they are walled tents reminiscent of the miner's tents used during the gold rush not too far from Camp. There are eight Miner's Tents, which are pitched on a deck up off the ground. Each deck has one walled tent. Each tent has 4 bunk beds and sleep a total of 8 (one counselor and 7 campers).
Our youngest campers will stay in tipis. These tipis are large (20'+) and sleep up to one counselor and 6 campers on 5" thick foam mattresses on a tarped floor. These are particularly well-suited for fostering community building and are a great way to introduce kids to the great outdoors.
All kids use the bathhouse for private showers and real flush toilets.


text:
ADVOCACY FOR WHAT REALLY MATTERS.
WORKING TO SUSTAIN QUALITY JOURNALISM
The News Media Alliance diligently advocates on the pressing issues affecting today's news media organizations, including monetization by the tech platforms, COVID-19 response and relief, technology policy and advancements, postal rates, journalist protection and free press issues, and other important issues that matter most to you.
As the media landscape becomes increasingly digital, it is critical that publishers find ways to monetize digital content and be fairly compensated for use of their digital content, including in search engines and for advertising sold against that content. The Alliance strongly supports safe harbor legislation that would allow news publishers to collectively negotiate with the platforms for this purpose.
Follow our regular Public Policy Updates here and subscribe to receive weekly Public Policy email alerts with the latest posts here.
Click on the buttons below to learn more about each Public Policy issue.
Legal Guidance and Trackers
News Media Alliance PAC
Fill out the News Media Alliance PAC Prior Authorization form here.
View All Advertising Advocacy Business Ops Copyright Digital Free Press International Policy Updates Postal Rates Privacy Tech Platforms
Staff / January 10, 2022
On December 29, New York Governor Kathy Hochul vetoed a bill that would have required electronic book publishers to issue licenses to state libraries on "reasonable terms." … Read More
Staff / January 7, 2022
On January 5, the News Media Alliance submitted additional comments to the Register of Copyrights and Director of the U.S. Copyright Office, Shira Perlmutter, in response to a request for additional comments to assist it in the preparation of the "Publishers' Protection Study." … Read More
On December 22, the Alliance signed on to a letter by the Reporters Committee to the congressional committee investigating the January 6th attack on the Capitol. That congressional committee recently issued a subpoena to photojournalist Amy Harris … Read More
Staff / December 10, 2021
Statement: News Media Alliance Supports AAP's Suit to Protect Copyright
On December 9, the Association of American Publishers (AAP) filed a lawsuit in U.S. District Court in Maryland to block legislation that would force publishers to license literary works to state libraries … Read More
Staff / December 2, 2021
News Media Alliance, National Newspaper Association Agree to Combine Forces on Postal, Public Policy
The News Media Alliance and National Newspaper Association, both long-standing newspaper advocacy organizations with Washington, D.C., area offices, have created a joint policy group to assist their members in the newspaper industry with postal issues and public policy … Read More
Alliance Writes Letter Urging DC Council to Preserve First Amendment Protections
On November 30, the Alliance and seven other national and local associations sent a letter to the DC Council opposing an Amendment to DC's anti-SLAPP law under consideration. The Attorney General of DC Karl Racine requested an Amendment that the anti-SLAPP motion "shall not apply to any claim for relief … Read More


text:
« Skrufff Chart (704): Locked Groove/ Rona Geffen/ Wigbert/ Marco Bailey/ Terrence…
Pariah Robbed in London »
Simon Napier Bell: the Dodgy Business of Popular Music: On the Road….
Published December 2, 2014 | By skrufff
Simon Napier-Bell (who previously managed Wham, Marc Bolan, Japan and Led Zeppelin's Jimmy Page (during his Yardbirds phase) is back in Skrufff, delivering a short series of excerpts from his must-read new history of the music business book 'TA-RA-RA-BOOM-DE-AY- the Dodgy Business of Popular Music'. (Click here to download/ buy )
"There were new mammoths of rock coming up all the time – David Bowie, Queen, Metallica, Aerosmith, Jefferson Starship, Little Feat, Alice Cooper, Blue Oyster Cult – all of them with the same style of rock circus, all of them running round America in a continual spiralling loop of excess, though the excesses weren't always violent.
Elton John's excess was in his theatrical exuberance. He started his show like a Broadway finale, then built further – eight grand pianos, fifty dancing girls, thirteen changes of costume.
But whatever the differences in their stage shows, when it came to drug-taking every group told the same story. After being onstage and getting sent sky-high by the intense release of adrenalin it produced, rock performers found they couldn't come down when the show was finished.
The periods between performances became an intolerable vacuum. People thought it was all parties, but it wasn't; it's just that the parties were what people remembered. Mainly it was boring. Waiting. Staring blankly at TV. Ordering room service.
For all rock artists the problem was the same; when the audience wasn't in front of them the emptiness was all-consuming. And usually there was just one answer. Drugs.
"Fucking rock-star ridiculousness . . ." said Butch Trucks, the drummer with the Allman Brothers " . . . the cocaine was pouring . . . you would go backstage and there would be a line of thirty dealers waiting outside."
"Hangers-on came backstage with piles of drugs like 'the three Kings off to see Jesus in his stable'," said Robert Greenfield in his book on touring with the Stones.
Steven Tyler of Aerosmith believed, "anything that was worth doing was worth overdoing".
Musicians did drugs to have fun, to pass time, to kill the craving for being on stage, to obliterate themselves – going up, coming down.
Brian Jones told friends it was like being dead in an elevator."
TA-RA-RA-BOOM-DE-AY- the Dodgy Business of Popular Music: "click here to download/ buy: http://amzn.to/1nZFlM2
Posted in contributors | Tagged 70s, aerosmith, Alice Cooper, Blue Oyster Cult, Cocaine, David Bowie, heroin, Jefferson Starship, led zeppelin, Little Feat, metallica, queen, simon napier-bell, steven tyler, TA-RA-RA-BOOM-DE-AY


The Google Project Glass has been the hot topic in the tech world recently. While the futuristic glasses have the potential of being the next big thing, here's a funny parody of how the glasses might actually work.
Google's Project Glass was announced recently and it's been in the news a lot recently. There's a lot of excitement about the project, and speculation on how well it will work too.
Here's an amusing look at how the glasses could actually work via Tom Scott.
Here's the official video Google is presenting on the concept behind the high tech glasses. Find out more about the project here.
What is your opinion on these futuristic glasses?
@ShockerSH It is pretty funny huh? I think when he runs into the guy is the funniest part.
annoyances that could be introduced. I hope Tom has some time to add to it.
tragic accidents along with cell phones.


Provide breakfast the second Tuesday of each month.
Collection of warm weather gear(hats, gloves & coats) distributed through the IRC.
A. Support pantry with food and essential items. Collected weekly at church.
Financial and moral support to this organization.


text:
Q: sql: "Query the total amount of each revenue and expenditure category"? table: category_info
field: category_code, category_name, parent_category_code, ...
table: income_expend_info
field: user_id, category_code, ie_amount, ...

A: select sum(ie_amount) from income_expend_table group by category_code

redpajama_set_name: RedPajamaStackExchange


text:
Q: OpenCL 1.2: mem_fence() or barrier() or both I have just started openCL C programming. All work items of a work group update unique locations of local memory. Later, a private variable of a work item is updated based on local data updated by two other work items. Something like this:
__kernel MyKernel(__global int *in_ptr)
         {
           /* Define a variable in private address space */
           int priv_data;
           /* Define two indices in private address space */
           int index1, index2;

           /* index1 and index2 are legitimate local work group indices */
           index1 = SOME_CORRECT_VALUE;
           index2 = ANOTHER_CORRECT_VALUE;

           /* Define storage in local memory large enough to cater to all work items of this work group */
           __local int tempPtr[WORK_GROUP_SIZE];
           tempPtr[get_local_id(0)] = SOME_RANDOM_VALUE;

           /* Do not proceed until the update of tempPtr by this WI has completed */
           mem_fence(CLK_LOCAL_MEM_FENCE);

           /* Do not proceed until all WI of this WG have updated tempPtr */
           barrier(CLK_LOCAL_MEM_FENCE);

           /* Update private data */
           priv_data = tempPtr[index1] + tempPtr[index2];
       }

Although the snippet above is conservative, wouldn't barrier have done the job as it internally does fencing?

A: Yes, barrier already does fencing.
A barrier will sync the execution in that point. So, all previous instructions have to be executed, therefore memory is consistent at that point.
A fence will only ensure all reads/writes are finished before any further read/write is performed, but the workers may be executing different instructions.
In some cases you can go with a single fencing. If you do not care about local workers going out of sync, and you just want the previous memory writes/read be completed. In your case a fence would be enough. (unless that code is running in a loop and there is extra code you have not put in the example).


text:
Edison Johnson free on time served after manslaughter plea
Belize and China sign health agreement
Old Northern Highway man jailed for assault on pre-teen girl
Published by Victor Castillo at February 10, 2016
Posted: Wednesday, February 10, 2016. 5:25 pm CST.
By Aaron Humes: 39 year old Francisco Gomez, aka "Indian", was sentenced to 3 years today by Chief Magistrate, Ann-Marie Smith, after she found him guilty of sexual assault on an 11 year old. She also found him guilty of common assault and using threatening words for which he was concurrently sentenced to 6 months' imprisonment for each offence.
On April 19, 2015, in Burrell Boom, Belize District, according to the child's testimony, she was at her grandmother's house watching television and when she got up to get some water Gomez slapped her on her buttocks and told her she had a "fat behind" for her age.
She said Gomez, who smelled of liquor, also slapped her face and threatened to kill her and throw her in the creek if she told anyone what he did. She said Gomez then put his hand around her waist and tried to kiss her.
The girl said that her grandmother, who was asleep, awoke and when she told her grandmother what had happened her grandmother drove Gomez from the house. The child's mother testified that her daughter told her what had happened when she arrived at the house.
Gomez gave a statement from the dock in which he denied committing the offences. Gomez said he was at the house watching a movie on a DVD player when the child entered the living room and sat down beside him. He said the child told him he was watching a "simple" movie and she took out his DVD and put in one of her own.
They argued, he said; he removed her DVD and she started to cry. He said she then went into the bedroom and her aunt came and asked him why he slapped her. He said he then threw the remote control on the table and left the house. He said he did not go to the house until the following day and his boss drove him from the house and he went to his sister's house and told her what had happened. Chief Magistrate Smith called it a "Harry Potter story" and she found him guilty.
In 2007, the record shows that Gomez was convicted of aggravated assault where he was fined $700. Then in 2013, he was found guilty of wounding. Gomez claim he served his fine in jail time for this offense. He denied ever having a conviction for aggravated assault.