Hi.

please see my attach.

My changes:

1. Added line 175-179

code

if (!nTileBytes)

{ //Tile is Empty

reinterpret_cast<GByte*>(pImage), nTileBytes //

return CE_None;

}

this need maybe for skip empty tiles.

2.

line 232:

int tailBytes = 7000;

line 234:

VSIMalloc( nTileBytes + tailBytes) ); //GetMore Memory for tail

line 252:

(*poGDS->Decompress)( pabyTile, nTileBytes + tailBytes,

I can't explain whyright stockat the announcementof the buffer andits
transmissioninthe process of decompressionandespeciallyhowto choose the right
size.The problem is thatin the procedureof decompressionis happeningor incompletetreatmentorearly
withdrawalin consequence of thatthe last couple of rows in the tile tobe
returned.if setto > 4096everything works,but it is not clearwhat valueshould be.(не
могу объяснить почему нужен запас при объявлении буфера и его передаче в
процедуру декомпрессии и тем более какой правильно подобрать размер. Проблема в
том что в процедуре декомпресии происходит или неполная обработка или
преждевременный выход в следствии чего последние пару строк в тайле на
возвращаются. при значении в > 4096 вроде все работает, но не понятно какое
значение должно быть.)

С уважением Овсянников Олег

  29.06.2016, 0:28:45 пользователь drons (notifications@github.com) написал:

  Hm.
  Do you have some examples?
  @sag3ll0, try following:

  #!/bin/sh
  export LD_LIBRARY_PATH=/home/my_gdal_home/lib:$LD_LIBRARY_PATH
  export PATH=/home/my_gdal_home/bin:$PATH
  export TEST_DATA=my_test_file.tif

  gdal_translate --debug on -of RMF -co RMFHUGE=YES $TEST_DATA ./huge.rsw
  gdal_translate --debug on -of RMF -co RMFHUGE=NO  $TEST_DATA ./norm.rsw

  gdal_translate --debug on -of GTiff ./huge.rsw ./huge.tif
  gdal_translate --debug on -of GTiff ./norm.rsw ./norm.tif

  md5sum ./huge.tif
  md5sum ./norm.tif

  You must see equal md5 sums. Send me bad file, if not.

  —
  You are receiving this because you were mentioned.
  Reply to this email directly, view it on GitHub, or mute the thread.

/******************************************************************************
 * $Id$
 *
 * Project:  Raster Matrix Format
 * Purpose:  Read/write raster files used in GIS "Integratsia"
 *           (also known as "Panorama" GIS).
 * Author:   Andrey Kiselev, dron@ak4719.spb.edu
 *
 ******************************************************************************
 * Copyright (c) 2005, Andrey Kiselev <dron@ak4719.spb.edu>
 * Copyright (c) 2007-2012, Even Rouault <even dot rouault at mines-paris dot org>
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included
 * in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * DEALINGS IN THE SOFTWARE.
 ****************************************************************************/

#include "cpl_string.h"
#include "gdal_frmts.h"
#include "ogr_spatialref.h"

#include "rmfdataset.h"

CPL_CVSID("$Id$");

static const int RMF_DEFAULT_BLOCKXSIZE = 256;
static const int RMF_DEFAULT_BLOCKYSIZE = 256;

static const char RMF_SigRSW[] = { 'R', 'S', 'W', '\0' };
static const char RMF_SigRSW_BE[] = { '\0', 'W', 'S', 'R' };
static const char RMF_SigMTW[] = { 'M', 'T', 'W', '\0' };

static const char RMF_UnitsEmpty[] = "";
static const char RMF_UnitsM[] = "m";
static const char RMF_UnitsCM[] = "cm";
static const char RMF_UnitsDM[] = "dm";
static const char RMF_UnitsMM[] = "mm";

/************************************************************************/
/* ==================================================================== */
/*                            RMFRasterBand                             */
/* ==================================================================== */
/************************************************************************/

/************************************************************************/
/*                           RMFRasterBand()                            */
/************************************************************************/

RMFRasterBand::RMFRasterBand( RMFDataset *poDSIn, int nBandIn,
                              GDALDataType eType ) :
    nBytesPerPixel(poDSIn->sHeader.nBitDepth / 8),
    nLastTileWidth(poDSIn->GetRasterXSize() % poDSIn->sHeader.nTileWidth),
    nLastTileHeight(poDSIn->GetRasterYSize() % poDSIn->sHeader.nTileHeight),
    nDataSize(GDALGetDataTypeSize( eType ) / 8)
{
    poDS = poDSIn;
    nBand = nBandIn;

    eDataType = eType;
    nBlockXSize = poDSIn->sHeader.nTileWidth;
    nBlockYSize = poDSIn->sHeader.nTileHeight;
    nBlockSize = nBlockXSize * nBlockYSize;
    nBlockBytes = nBlockSize * nDataSize;

#ifdef DEBUG
    CPLDebug( "RMF",
              "Band %d: tile width is %d, tile height is %d, "
              " last tile width %u, last tile height %u, "
              "bytes per pixel is %d, data type size is %d",
              nBand, nBlockXSize, nBlockYSize,
              nLastTileWidth, nLastTileHeight,
              nBytesPerPixel, nDataSize );
#endif
}

/************************************************************************/
/*                           ~RMFRasterBand()                           */
/************************************************************************/

RMFRasterBand::~RMFRasterBand() {}

/************************************************************************/
/*                              ReadBuffer()                            */
/*                                                                      */
/* Helper function to read specified amount of bytes from the input     */
/* file stream.                                                         */
/************************************************************************/

CPLErr RMFRasterBand::ReadBuffer( GByte *pabyBuf, GUInt32 nBytes ) const
{
    RMFDataset  *poGDS = reinterpret_cast<RMFDataset *>( poDS );

    CPLAssert( pabyBuf != NULL && poGDS->fp != NULL );

    const vsi_l_offset nOffset = VSIFTellL( poGDS->fp );

    if ( VSIFReadL( pabyBuf, 1, nBytes, poGDS->fp ) < nBytes )
    {
        // XXX
        if( poGDS->eAccess == GA_Update )
        {
            return CE_Failure;
        }
        else
        {
            CPLError( CE_Failure, CPLE_FileIO,
                      "Can't read at offset %ld from input file.\n%s\n",
                      static_cast<long>( nOffset ), VSIStrerror( errno ) );
            return CE_Failure;
        }
    }

#ifdef CPL_MSB
    if ( poGDS->eRMFType == RMFT_MTW )
    {
        if ( poGDS->sHeader.nBitDepth == 16 )
        {
            for ( GUInt32 i = 0; i < nBytes; i += 2 )
                CPL_SWAP16PTR( pabyBuf + i );
        }

        else if ( poGDS->sHeader.nBitDepth == 32 )
        {
            for ( GUInt32 i = 0; i < nBytes; i += 4 )
                CPL_SWAP32PTR( pabyBuf + i );
        }

        else if ( poGDS->sHeader.nBitDepth == 64 )
        {
            for ( GUInt32 i = 0; i < nBytes; i += 8 )
                CPL_SWAPDOUBLE( pabyBuf + i );
        }
    }
#endif

    return CE_None;
}

/************************************************************************/
/*                             IReadBlock()                             */
/************************************************************************/

CPLErr RMFRasterBand::IReadBlock( int nBlockXOff, int nBlockYOff,
                                  void * pImage )
{
    RMFDataset  *poGDS = reinterpret_cast<RMFDataset *>( poDS );

    CPLAssert( poGDS != NULL
               && nBlockXOff >= 0
               && nBlockYOff >= 0
               && pImage != NULL );

    memset( pImage, 0, nBlockBytes );

    GUInt32 nTile = nBlockYOff * poGDS->nXTiles + nBlockXOff;
    if (2 * nTile + 1 >= poGDS->sHeader.nTileTblSize / sizeof(GUInt32))
    {
        return CE_Failure;
    }

    GUInt32 nTileBytes = poGDS->paiTiles[2 * nTile + 1];
	if (!nTileBytes)
	{ //Tile is Empty
		reinterpret_cast<GByte*>(pImage), nTileBytes //
		return CE_None;
	}
    GUInt32 nCurBlockYSize;

    if ( nLastTileHeight
         && static_cast<GUInt32>( nBlockYOff ) == poGDS->nYTiles - 1 )
        nCurBlockYSize = nLastTileHeight;
    else
        nCurBlockYSize = nBlockYSize;

    vsi_l_offset nTileOffset = poGDS->GetFileOffset( poGDS->paiTiles[2 * nTile] );

    if ( VSIFSeekL( poGDS->fp, nTileOffset, SEEK_SET ) < 0 )
    {
        // XXX: We will not report error here, because file just may be
	// in update state and data for this block will be available later
        if( poGDS->eAccess == GA_Update )
            return CE_None;

        CPLError( CE_Failure, CPLE_FileIO,
                  "Can't seek to offset %ld in input file to read data.\n%s\n",
                  static_cast<long>( nTileOffset ),
                  VSIStrerror( errno ) );
        return CE_Failure;
    }

    if ( poGDS->nBands == 1 &&
         ( poGDS->sHeader.nBitDepth == 8
           || poGDS->sHeader.nBitDepth == 16
           || poGDS->sHeader.nBitDepth == 32
           || poGDS->sHeader.nBitDepth == 64 ) )
    {
        if ( nTileBytes > nBlockBytes )
            nTileBytes = nBlockBytes;

/* -------------------------------------------------------------------- */
/*  Decompress buffer, if needed.                                       */
/* -------------------------------------------------------------------- */
        if ( poGDS->Decompress )
        {
            GUInt32 nRawBytes;

            if ( nLastTileWidth && (GUInt32)nBlockXOff == poGDS->nXTiles - 1 )
                nRawBytes = poGDS->nBands * nLastTileWidth * nDataSize;
            else
                nRawBytes = poGDS->nBands * nBlockXSize * nDataSize;

            if ( nLastTileHeight && (GUInt32)nBlockYOff == poGDS->nYTiles - 1 )
                nRawBytes *= nLastTileHeight;
            else
                nRawBytes *= nBlockYSize;

            if ( nRawBytes > nTileBytes )
            {
				int tailBytes = 7000; //Some Value >4096, i dont fully understand how mach need, but on my data work perfect on this value
                GByte *pabyTile = reinterpret_cast<GByte *>(
                    VSIMalloc( nTileBytes + tailBytes) ); //GetMore Memory for tail

                if ( !pabyTile )
                {
                    CPLError( CE_Failure, CPLE_FileIO,
                            "Can't allocate tile block of size %lu.\n%s\n",
                            (unsigned long) nTileBytes, VSIStrerror( errno ) );
                    return CE_Failure;
                }

                if ( ReadBuffer( pabyTile, nTileBytes ) == CE_Failure )
                {
                    // XXX: Do not fail here, just return empty block
                    // and continue reading.
                    CPLFree( pabyTile );
                    return CE_None;
                }

                (*poGDS->Decompress)( pabyTile, nTileBytes + tailBytes,
                                      reinterpret_cast<GByte*>( pImage ),
                                      nRawBytes ); //Using additional tail value in decompress sub
                CPLFree( pabyTile );
                /*nTileBytes = nRawBytes;*/
            }
            else
            {
              if ( ReadBuffer( reinterpret_cast<GByte *>( pImage ),
                               nTileBytes ) == CE_Failure )
                {
                    // XXX: Do not fail here, just return empty block
                    // and continue reading.
                    return CE_None;
                }
            }
        }

        else
        {

          if ( ReadBuffer( reinterpret_cast<GByte *>( pImage ),
                           nTileBytes ) == CE_Failure )
            {
                // XXX: Do not fail here, just return empty block
                // and continue reading.
                return CE_None;
            }

        }

    }

    else if ( poGDS->eRMFType == RMFT_RSW )
    {
        GByte *pabyTile = reinterpret_cast<GByte *>( VSIMalloc( nTileBytes ) );

        if ( !pabyTile )
        {
            CPLError( CE_Failure, CPLE_FileIO,
                      "Can't allocate tile block of size %lu.\n%s\n",
                      (unsigned long) nTileBytes, VSIStrerror( errno ) );
            return CE_Failure;
        }

        if ( ReadBuffer( pabyTile, nTileBytes ) == CE_Failure )
        {
            // XXX: Do not fail here, just return empty block
            // and continue reading.
            CPLFree( pabyTile );
            return CE_None;
        }

/* -------------------------------------------------------------------- */
/*  If buffer was compressed, decompress it first.                      */
/* -------------------------------------------------------------------- */
        if ( poGDS->Decompress )
        {
            GUInt32 nRawBytes;

            if ( nLastTileWidth && (GUInt32)nBlockXOff == poGDS->nXTiles - 1 )
                nRawBytes = poGDS->nBands * nLastTileWidth * nDataSize;
            else
                nRawBytes = poGDS->nBands * nBlockXSize * nDataSize;

            if ( nLastTileHeight && (GUInt32)nBlockYOff == poGDS->nYTiles - 1 )
                nRawBytes *= nLastTileHeight;
            else
                nRawBytes *= nBlockYSize;

            if ( nRawBytes > nTileBytes )
            {
                GByte *pszRawBuf = reinterpret_cast<GByte *>(
                    VSIMalloc( nRawBytes ) );
                if (pszRawBuf == NULL)
                {
                    CPLError( CE_Failure, CPLE_FileIO,
                              "Can't allocate a buffer for raw data of "
                              "size %lu.\n%s\n",
                              static_cast<unsigned long>( nRawBytes ),
                              VSIStrerror( errno ) );

                    VSIFree( pabyTile );
                    return CE_Failure;
                }

                (*poGDS->Decompress)( pabyTile, nTileBytes,
                                      pszRawBuf, nRawBytes );
                CPLFree( pabyTile );
                pabyTile = pszRawBuf;
                nTileBytes = nRawBytes;
            }
        }

/* -------------------------------------------------------------------- */
/*  Deinterleave pixels from input buffer.                              */
/* -------------------------------------------------------------------- */
        if ( poGDS->sHeader.nBitDepth == 24 || poGDS->sHeader.nBitDepth == 32 )
        {
            GUInt32 nTileSize = nTileBytes / nBytesPerPixel;

            if ( nTileSize > nBlockSize )
                nTileSize = nBlockSize;

            for( GUInt32 i = 0; i < nTileSize; i++ )
            {
                // Colour triplets in RMF file organized in reverse order:
                // blue, green, red. When we have 32-bit RMF the forth byte
                // in quadruplet should be discarded as it has no meaning.
                // That is why we always use 3 byte count in the following
                // pabyTemp index.
                reinterpret_cast<GByte *>( pImage )[i] =
                    pabyTile[i * nBytesPerPixel + 3 - nBand];
            }
        }

        else if ( poGDS->sHeader.nBitDepth == 16 )
        {
            GUInt32 nTileSize = nTileBytes / nBytesPerPixel;

            if ( nTileSize > nBlockSize )
                nTileSize = nBlockSize;

            for( GUInt32 i = 0; i < nTileSize; i++ )
            {
                switch ( nBand )
                {
                    case 1:
                        reinterpret_cast<GByte *>( pImage )[i] =
                            static_cast<GByte>((reinterpret_cast<GUInt16 *>(
                                pabyTile )[i] & 0x7c00) >> 7);
                        break;
                    case 2:
                        reinterpret_cast<GByte *>( pImage )[i] =
                            static_cast<GByte>((reinterpret_cast<GUInt16 *>(
                                pabyTile )[i] & 0x03e0) >> 2);
                        break;
                    case 3:
                        reinterpret_cast<GByte *>( pImage )[i] =
                            static_cast<GByte>((reinterpret_cast<GUInt16 *>(
                                pabyTile)[i] & 0x1F) << 3);
                        break;
                    default:
                        break;
                }
            }
        }

        else if ( poGDS->sHeader.nBitDepth == 4 )
        {
            GByte *pabyTemp = pabyTile;

            if( nTileBytes != (nBlockSize+1) / 2 )
            {
                CPLError(CE_Failure, CPLE_AppDefined,
                         "Tile has %d bytes, %d were expected",
                         nTileBytes, (nBlockSize+1) / 2 );
                CPLFree( pabyTile );
                return CE_Failure;
            }

            for( GUInt32 i = 0; i < nBlockSize; i++ )
            {
                // Most significant part of the byte represents leftmost pixel
                if ( i & 0x01 )
                    reinterpret_cast<GByte *>( pImage )[i] = *pabyTemp++ & 0x0F;
                else
                    reinterpret_cast<GByte *>( pImage )[i]
                        = (*pabyTemp & 0xF0) >> 4;
            }
        }

        else if ( poGDS->sHeader.nBitDepth == 1 )
        {
            GByte *pabyTemp = pabyTile;

            if( nTileBytes != (nBlockSize+7) / 8 )
            {
                CPLError(CE_Failure, CPLE_AppDefined,
                         "Tile has %d bytes, %d were expected",
                         nTileBytes, (nBlockSize+7) / 8 );
                CPLFree( pabyTile );
                return CE_Failure;
            }

            for( GUInt32 i = 0; i < nBlockSize; i++ )
            {
                switch ( i & 0x7 )
                {
                    case 0:
                        reinterpret_cast<GByte *>( pImage )[i] = (*pabyTemp & 0x80) >> 7;
                        break;
                    case 1:
                        reinterpret_cast<GByte *>( pImage )[i] = (*pabyTemp & 0x40) >> 6;
                        break;
                    case 2:
                        reinterpret_cast<GByte *>( pImage )[i] = (*pabyTemp & 0x20) >> 5;
                        break;
                    case 3:
                        reinterpret_cast<GByte *>( pImage )[i] = (*pabyTemp & 0x10) >> 4;
                        break;
                    case 4:
                        reinterpret_cast<GByte *>( pImage )[i] = (*pabyTemp & 0x08) >> 3;
                        break;
                    case 5:
                        reinterpret_cast<GByte *>( pImage )[i] = (*pabyTemp & 0x04) >> 2;
                        break;
                    case 6:
                        reinterpret_cast<GByte *>( pImage )[i] = (*pabyTemp & 0x02) >> 1;
                        break;
                    case 7:
                        reinterpret_cast<GByte *>( pImage )[i] = *pabyTemp++ & 0x01;
                        break;
                    default:
                        break;
                }
            }
        }

        CPLFree( pabyTile );
    }

    if ( nLastTileWidth
         && static_cast<GUInt32>( nBlockXOff ) == poGDS->nXTiles - 1 )
    {
        for ( GUInt32 iRow = nCurBlockYSize - 1; iRow > 0; iRow-- )
        {
            memmove( reinterpret_cast<GByte *>( pImage )
                     + nBlockXSize * iRow * nDataSize,
                     reinterpret_cast<GByte *>( pImage ) +
                     iRow * nLastTileWidth * nDataSize,
                     nLastTileWidth * nDataSize );
        }

    }

    return CE_None;
}

/************************************************************************/
/*                            IWriteBlock()                             */
/************************************************************************/

CPLErr RMFRasterBand::IWriteBlock( int nBlockXOff, int nBlockYOff,
                                   void * pImage )
{
    RMFDataset  *poGDS = reinterpret_cast<RMFDataset *>( poDS );
    GUInt32     nTile = nBlockYOff * poGDS->nXTiles + nBlockXOff;
    GUInt32     nTileBytes = nDataSize * poGDS->nBands;
    GUInt32     iInPixel, iOutPixel, nCurBlockYSize;
    GByte       *pabyTile;

    CPLAssert( poGDS != NULL
               && nBlockXOff >= 0
               && nBlockYOff >= 0
               && pImage != NULL );

    vsi_l_offset nTileOffset = poGDS->GetFileOffset( poGDS->paiTiles[2 * nTile] );

    if ( nTileOffset )
    {
        if ( VSIFSeekL( poGDS->fp, nTileOffset, SEEK_SET ) < 0 )
        {
            CPLError( CE_Failure, CPLE_FileIO,
                "Can't seek to offset %ld in output file to write data.\n%s",
                      static_cast<long>( nTileOffset ),
                      VSIStrerror( errno ) );
            return CE_Failure;
        }
    }
    else
    {
        if ( VSIFSeekL( poGDS->fp, 0, SEEK_END ) < 0 )
        {
            CPLError( CE_Failure, CPLE_FileIO,
                "Can't seek to offset %ld in output file to write data.\n%s",
                      static_cast<long>( nTileOffset ),
                      VSIStrerror( errno ) );
            return CE_Failure;
        }
        vsi_l_offset    nNewTileOffset;
        nTileOffset = VSIFTellL( poGDS->fp );
        poGDS->paiTiles[2 * nTile] = poGDS->GetRMFOffset( nTileOffset, &nNewTileOffset );

        if( nTileOffset != nNewTileOffset )
        {   //May be it is better to write some zeros here?
            if ( VSIFSeekL( poGDS->fp, nNewTileOffset, SEEK_SET ) < 0 )
            {
                CPLError( CE_Failure, CPLE_FileIO,
                    "Can't seek to offset %ld in output file to write data.\n%s",
                          static_cast<long>( nNewTileOffset ),
                          VSIStrerror( errno ) );
                return CE_Failure;
            }
        }
        nTileOffset = nNewTileOffset;
        poGDS->bHeaderDirty = TRUE;
    }

    if ( nLastTileWidth
         && static_cast<GUInt32>( nBlockXOff ) == poGDS->nXTiles - 1 )
        nTileBytes *= nLastTileWidth;
    else
        nTileBytes *= nBlockXSize;

    if ( nLastTileHeight
         && static_cast<GUInt32>( nBlockYOff ) == poGDS->nYTiles - 1 )
        nCurBlockYSize = nLastTileHeight;
    else
        nCurBlockYSize = nBlockYSize;

    nTileBytes *= nCurBlockYSize;

    pabyTile = reinterpret_cast<GByte *>( VSICalloc( nTileBytes, 1 ) );
    if ( !pabyTile )
    {
        CPLError( CE_Failure, CPLE_FileIO,
                  "Can't allocate space for the tile block of size %lu.\n%s",
                  static_cast<unsigned long>( nTileBytes ),
                  VSIStrerror( errno ) );
        return CE_Failure;
    }

    if ( nLastTileWidth
         && static_cast<GUInt32>( nBlockXOff ) == poGDS->nXTiles - 1 )
    {
        GUInt32 iRow;

        if ( poGDS->nBands == 1 )
        {
            for ( iRow = 0; iRow < nCurBlockYSize; iRow++ )
            {
                memcpy( pabyTile + iRow * nLastTileWidth * nDataSize,
                        reinterpret_cast<GByte *>( pImage )
                        + nBlockXSize * iRow * nDataSize, nLastTileWidth * nDataSize );
            }
        }
        else
        {
            if ( poGDS->paiTiles[2 * nTile + 1] )
            {
                VSIFReadL( pabyTile, 1, nTileBytes, poGDS->fp );
                VSIFSeekL( poGDS->fp, nTileOffset, SEEK_SET );
            }

            for ( iRow = 0; iRow < nCurBlockYSize; iRow++ )
            {
                for ( iInPixel = 0, iOutPixel = nBytesPerPixel - nBand;
                      iOutPixel < nLastTileWidth * nDataSize * poGDS->nBands;
                      iInPixel++, iOutPixel += poGDS->nBands )
                    (pabyTile + iRow * nLastTileWidth * nDataSize * poGDS->nBands)[iOutPixel] =
                        (reinterpret_cast<GByte *>( pImage ) + nBlockXSize
                         * iRow * nDataSize)[iInPixel];
            }
        }
    }
    else
    {
        if ( poGDS->nBands == 1 )
            memcpy( pabyTile, pImage, nTileBytes );
        else
        {
            if ( poGDS->paiTiles[2 * nTile + 1] )
            {
                VSIFReadL( pabyTile, 1, nTileBytes, poGDS->fp );
                VSIFSeekL( poGDS->fp, nTileOffset, SEEK_SET );
            }

            for ( iInPixel = 0, iOutPixel = nBytesPerPixel - nBand;
                  iOutPixel < nTileBytes;
                  iInPixel++, iOutPixel += poGDS->nBands )
                pabyTile[iOutPixel] = reinterpret_cast<GByte *>( pImage )[iInPixel];

        }
    }

#ifdef CPL_MSB
    if ( poGDS->eRMFType == RMFT_MTW )
    {;
        if ( poGDS->sHeader.nBitDepth == 16 )
        {
            for( GUInt32 i = 0; i < nTileBytes; i += 2 )
                CPL_SWAP16PTR( pabyTile + i );
        }

        else if ( poGDS->sHeader.nBitDepth == 32 )
        {
            for( GUInt32 i = 0; i < nTileBytes; i += 4 )
                CPL_SWAP32PTR( pabyTile + i );
        }

        else if ( poGDS->sHeader.nBitDepth == 64 )
        {
            for( GUInt32 i = 0; i < nTileBytes; i += 8 )
                CPL_SWAPDOUBLE( pabyTile + i );
        }
    }
#endif

    if ( VSIFWriteL( pabyTile, 1, nTileBytes, poGDS->fp ) < nTileBytes )
    {
        CPLError( CE_Failure, CPLE_FileIO,
                  "Can't write block with X offset %d and Y offset %d.\n%s",
                  nBlockXOff, nBlockYOff, VSIStrerror( errno ) );
        VSIFree( pabyTile );
        return CE_Failure;
    }

    poGDS->paiTiles[2 * nTile + 1] = nTileBytes;
    VSIFree( pabyTile );

    poGDS->bHeaderDirty = TRUE;

    return CE_None;
}

/************************************************************************/
/*                          GetNoDataValue()                            */
/************************************************************************/

double RMFRasterBand::GetNoDataValue( int *pbSuccess )

{
    RMFDataset *poGDS = reinterpret_cast<RMFDataset *>( poDS );

    if ( pbSuccess )
        *pbSuccess = TRUE;

    return poGDS->sHeader.dfNoData;
}

/************************************************************************/
/*                            GetUnitType()                             */
/************************************************************************/

const char *RMFRasterBand::GetUnitType()

{
    RMFDataset *poGDS = reinterpret_cast<RMFDataset *>( poDS );

    return (const char *)poGDS->pszUnitType;
}

/************************************************************************/
/*                            SetUnitType()                             */
/************************************************************************/

CPLErr RMFRasterBand::SetUnitType( const char *pszNewValue )

{
    RMFDataset *poGDS = reinterpret_cast<RMFDataset *>( poDS );

    CPLFree(poGDS->pszUnitType);
    poGDS->pszUnitType = CPLStrdup( pszNewValue );

    return CE_None;
}

/************************************************************************/
/*                           GetColorTable()                            */
/************************************************************************/

GDALColorTable *RMFRasterBand::GetColorTable()
{
    RMFDataset *poGDS = reinterpret_cast<RMFDataset *>( poDS );

    return poGDS->poColorTable;
}

/************************************************************************/
/*                           SetColorTable()                            */
/************************************************************************/

CPLErr RMFRasterBand::SetColorTable( GDALColorTable *poColorTable )
{
    RMFDataset *poGDS = reinterpret_cast<RMFDataset *>( poDS );

    if ( poColorTable )
    {
        if ( poGDS->eRMFType == RMFT_RSW && poGDS->nBands == 1 )
        {
            if ( !poGDS->pabyColorTable )
                return CE_Failure;

            GDALColorEntry  oEntry;
            for( GUInt32 i = 0; i < poGDS->nColorTableSize; i++ )
            {
                poColorTable->GetColorEntryAsRGB( i, &oEntry );
                poGDS->pabyColorTable[i * 4] = (GByte) oEntry.c1;     // Red
                poGDS->pabyColorTable[i * 4 + 1] = (GByte) oEntry.c2; // Green
                poGDS->pabyColorTable[i * 4 + 2] = (GByte) oEntry.c3; // Blue
                poGDS->pabyColorTable[i * 4 + 3] = 0;
            }

            poGDS->bHeaderDirty = TRUE;
        }
        return CE_None;
    }

    return CE_Failure;
}

/************************************************************************/
/*                       GetColorInterpretation()                       */
/************************************************************************/

GDALColorInterp RMFRasterBand::GetColorInterpretation()
{
    RMFDataset *poGDS = reinterpret_cast<RMFDataset *>( poDS );

    if( poGDS->nBands == 3 )
    {
        if( nBand == 1 )
            return GCI_RedBand;
        else if( nBand == 2 )
            return GCI_GreenBand;
        else if( nBand == 3 )
            return GCI_BlueBand;

        return GCI_Undefined;
    }

    if ( poGDS->eRMFType == RMFT_RSW )
        return GCI_PaletteIndex;

    return GCI_Undefined;
}

/************************************************************************/
/* ==================================================================== */
/*                              RMFDataset                              */
/* ==================================================================== */
/************************************************************************/

/************************************************************************/
/*                           RMFDataset()                               */
/************************************************************************/

RMFDataset::RMFDataset() :
    eRMFType(RMFT_RSW),
    nXTiles(0),
    nYTiles(0),
    paiTiles(NULL),
    nColorTableSize(0),
    pabyColorTable(NULL),
    poColorTable(NULL),
    pszProjection(CPLStrdup( "" )),
    pszUnitType(CPLStrdup( RMF_UnitsEmpty )),
    bBigEndian(FALSE),
    bHeaderDirty(FALSE),
    pszFilename(NULL),
    fp(NULL),
    Decompress(NULL)
{
    nBands = 0;
    adfGeoTransform[0] = 0.0;
    adfGeoTransform[1] = 1.0;
    adfGeoTransform[2] = 0.0;
    adfGeoTransform[3] = 0.0;
    adfGeoTransform[4] = 0.0;
    adfGeoTransform[5] = 1.0;
    memset( &sHeader, 0, sizeof(sHeader) );
    memset( &sExtHeader, 0, sizeof(sExtHeader) );
}

/************************************************************************/
/*                            ~RMFDataset()                             */
/************************************************************************/

RMFDataset::~RMFDataset()
{
    FlushCache();

    CPLFree( paiTiles );
    CPLFree( pszProjection );
    CPLFree( pszUnitType );
    CPLFree( pabyColorTable );
    if ( poColorTable != NULL )
        delete poColorTable;
    if ( fp )
        VSIFCloseL( fp );
}

/************************************************************************/
/*                          GetGeoTransform()                           */
/************************************************************************/

CPLErr RMFDataset::GetGeoTransform( double * padfTransform )
{
    memcpy( padfTransform, adfGeoTransform, sizeof(adfGeoTransform[0]) * 6 );

    if( sHeader.iGeorefFlag )
        return CE_None;

    return CE_Failure;
}

/************************************************************************/
/*                          SetGeoTransform()                           */
/************************************************************************/

CPLErr RMFDataset::SetGeoTransform( double * padfTransform )
{
    memcpy( adfGeoTransform, padfTransform, sizeof(double) * 6 );
    sHeader.dfPixelSize = adfGeoTransform[1];
    if ( sHeader.dfPixelSize != 0.0 )
        sHeader.dfResolution = sHeader.dfScale / sHeader.dfPixelSize;
    sHeader.dfLLX = adfGeoTransform[0];
    sHeader.dfLLY = adfGeoTransform[3] - nRasterYSize * sHeader.dfPixelSize;
    sHeader.iGeorefFlag = 1;

    bHeaderDirty = TRUE;

    return CE_None;
}

/************************************************************************/
/*                          GetProjectionRef()                          */
/************************************************************************/

const char *RMFDataset::GetProjectionRef()
{
    if( pszProjection )
        return pszProjection;

    return "";
}

/************************************************************************/
/*                           SetProjection()                            */
/************************************************************************/

CPLErr RMFDataset::SetProjection( const char * pszNewProjection )

{
    if ( pszProjection )
        CPLFree( pszProjection );
    pszProjection = CPLStrdup( (pszNewProjection) ? pszNewProjection : "" );

    bHeaderDirty = TRUE;

    return CE_None;
}

/************************************************************************/
/*                           WriteHeader()                              */
/************************************************************************/

CPLErr RMFDataset::WriteHeader()
{
/* -------------------------------------------------------------------- */
/*  Setup projection.                                                   */
/* -------------------------------------------------------------------- */
    if( pszProjection && !EQUAL( pszProjection, "" ) )
    {
        OGRSpatialReference oSRS;
        char *pszProj = pszProjection;

        if ( oSRS.importFromWkt( &pszProj ) == OGRERR_NONE )
        {
            long iProjection, iDatum, iEllips, iZone;
            double  adfPrjParams[7];

            oSRS.exportToPanorama( &iProjection, &iDatum, &iEllips, &iZone,
                                   adfPrjParams );
            sHeader.iProjection = static_cast<int>(iProjection);
            sHeader.dfStdP1 = adfPrjParams[0];
            sHeader.dfStdP2 = adfPrjParams[1];
            sHeader.dfCenterLat = adfPrjParams[2];
            sHeader.dfCenterLong = adfPrjParams[3];

            sExtHeader.nEllipsoid = static_cast<int>(iEllips);
            sExtHeader.nDatum = static_cast<int>(iDatum);
            sExtHeader.nZone = static_cast<int>(iZone);
        }
    }

#define RMF_WRITE_LONG( ptr, value, offset )            \
do {                                                    \
    GInt32  iLong = CPL_LSBWORD32( value );             \
    memcpy( (ptr) + (offset), &iLong, 4 );              \
} while(0);

#define RMF_WRITE_ULONG( ptr,value, offset )            \
do {                                                    \
    GUInt32 iULong = CPL_LSBWORD32( value );            \
    memcpy( (ptr) + (offset), &iULong, 4 );             \
} while(0);

#define RMF_WRITE_DOUBLE( ptr,value, offset )           \
do {                                                    \
    double  dfDouble = (value);                         \
    CPL_LSBPTR64( &dfDouble );                          \
    memcpy( (ptr) + (offset), &dfDouble, 8 );           \
} while(0);

/* -------------------------------------------------------------------- */
/*  Write out the main header.                                          */
/* -------------------------------------------------------------------- */
    {
        GByte   abyHeader[RMF_HEADER_SIZE];

        memset( abyHeader, 0, sizeof(abyHeader) );

        memcpy( abyHeader, sHeader.bySignature, RMF_SIGNATURE_SIZE );
        RMF_WRITE_ULONG( abyHeader, sHeader.iVersion, 4 );
        //
        RMF_WRITE_ULONG( abyHeader, sHeader.nOvrOffset, 12 );
        RMF_WRITE_ULONG( abyHeader, sHeader.iUserID, 16 );
        memcpy( abyHeader + 20, sHeader.byName, RMF_NAME_SIZE );
        RMF_WRITE_ULONG( abyHeader, sHeader.nBitDepth, 52 );
        RMF_WRITE_ULONG( abyHeader, sHeader.nHeight, 56 );
        RMF_WRITE_ULONG( abyHeader, sHeader.nWidth, 60 );
        RMF_WRITE_ULONG( abyHeader, sHeader.nXTiles, 64 );
        RMF_WRITE_ULONG( abyHeader, sHeader.nYTiles, 68 );
        RMF_WRITE_ULONG( abyHeader, sHeader.nTileHeight, 72 );
        RMF_WRITE_ULONG( abyHeader, sHeader.nTileWidth, 76 );
        RMF_WRITE_ULONG( abyHeader, sHeader.nLastTileHeight, 80 );
        RMF_WRITE_ULONG( abyHeader, sHeader.nLastTileWidth, 84 );
        RMF_WRITE_ULONG( abyHeader, sHeader.nROIOffset, 88 );
        RMF_WRITE_ULONG( abyHeader, sHeader.nROISize, 92 );
        RMF_WRITE_ULONG( abyHeader, sHeader.nClrTblOffset, 96 );
        RMF_WRITE_ULONG( abyHeader, sHeader.nClrTblSize, 100 );
        RMF_WRITE_ULONG( abyHeader, sHeader.nTileTblOffset, 104 );
        RMF_WRITE_ULONG( abyHeader, sHeader.nTileTblSize, 108 );
        RMF_WRITE_LONG( abyHeader, sHeader.iMapType, 124 );
        RMF_WRITE_LONG( abyHeader, sHeader.iProjection, 128 );
        RMF_WRITE_DOUBLE( abyHeader, sHeader.dfScale, 136 );
        RMF_WRITE_DOUBLE( abyHeader, sHeader.dfResolution, 144 );
        RMF_WRITE_DOUBLE( abyHeader, sHeader.dfPixelSize, 152 );
        RMF_WRITE_DOUBLE( abyHeader, sHeader.dfLLY, 160 );
        RMF_WRITE_DOUBLE( abyHeader, sHeader.dfLLX, 168 );
        RMF_WRITE_DOUBLE( abyHeader, sHeader.dfStdP1, 176 );
        RMF_WRITE_DOUBLE( abyHeader, sHeader.dfStdP2, 184 );
        RMF_WRITE_DOUBLE( abyHeader, sHeader.dfCenterLong, 192 );
        RMF_WRITE_DOUBLE( abyHeader, sHeader.dfCenterLat, 200 );
        *(abyHeader + 208) = sHeader.iCompression;
        *(abyHeader + 209) = sHeader.iMaskType;
        *(abyHeader + 210) = sHeader.iMaskStep;
        *(abyHeader + 211) = sHeader.iFrameFlag;
        RMF_WRITE_ULONG( abyHeader, sHeader.nFlagsTblOffset, 212 );
        RMF_WRITE_ULONG( abyHeader, sHeader.nFlagsTblSize, 216 );
        RMF_WRITE_ULONG( abyHeader, sHeader.nFileSize0, 220 );
        RMF_WRITE_ULONG( abyHeader, sHeader.nFileSize1, 224 );
        *(abyHeader + 228) = sHeader.iUnknown;
        *(abyHeader + 244) = sHeader.iGeorefFlag;
        *(abyHeader + 245) = sHeader.iInverse;
        memcpy( abyHeader + 248, sHeader.abyInvisibleColors,
                sizeof(sHeader.abyInvisibleColors) );
        RMF_WRITE_DOUBLE( abyHeader, sHeader.adfElevMinMax[0], 280 );
        RMF_WRITE_DOUBLE( abyHeader, sHeader.adfElevMinMax[1], 288 );
        RMF_WRITE_DOUBLE( abyHeader, sHeader.dfNoData, 296 );
        RMF_WRITE_ULONG( abyHeader, sHeader.iElevationUnit, 304 );
        *(abyHeader + 308) = sHeader.iElevationType;
        RMF_WRITE_ULONG( abyHeader, sHeader.nExtHdrOffset, 312 );
        RMF_WRITE_ULONG( abyHeader, sHeader.nExtHdrSize, 316 );

        VSIFSeekL( fp, 0, SEEK_SET );
        VSIFWriteL( abyHeader, 1, sizeof(abyHeader), fp );
    }

/* -------------------------------------------------------------------- */
/*  Write out the extended header.                                      */
/* -------------------------------------------------------------------- */

    if ( sHeader.nExtHdrOffset && sHeader.nExtHdrSize )
    {
        GByte *pabyExtHeader = reinterpret_cast<GByte *>(
            CPLCalloc( sHeader.nExtHdrSize, 1 ) );

        RMF_WRITE_LONG( pabyExtHeader, sExtHeader.nEllipsoid, 24 );
        RMF_WRITE_LONG( pabyExtHeader, sExtHeader.nDatum, 32 );
        RMF_WRITE_LONG( pabyExtHeader, sExtHeader.nZone, 36 );

        VSIFSeekL( fp, GetFileOffset( sHeader.nExtHdrOffset ), SEEK_SET );
        VSIFWriteL( pabyExtHeader, 1, sHeader.nExtHdrSize, fp );

        CPLFree( pabyExtHeader );
    }

#undef RMF_WRITE_DOUBLE
#undef RMF_WRITE_ULONG
#undef RMF_WRITE_LONG

/* -------------------------------------------------------------------- */
/*  Write out the color table.                                          */
/* -------------------------------------------------------------------- */

    if ( sHeader.nClrTblOffset && sHeader.nClrTblSize )
    {
        VSIFSeekL( fp, GetFileOffset( sHeader.nClrTblOffset ), SEEK_SET );
        VSIFWriteL( pabyColorTable, 1, sHeader.nClrTblSize, fp );
    }

/* -------------------------------------------------------------------- */
/*  Write out the block table, swap if needed.                          */
/* -------------------------------------------------------------------- */

    VSIFSeekL( fp, GetFileOffset( sHeader.nTileTblOffset ), SEEK_SET );

#ifdef CPL_MSB
    GUInt32 *paiTilesSwapped = reinterpret_cast<GUInt32 *>(
        CPLMalloc( sHeader.nTileTblSize ) );
    if ( !paiTilesSwapped )
        return CE_Failure;

    memcpy( paiTilesSwapped, paiTiles, sHeader.nTileTblSize );
    for ( GUInt32 i = 0; i < sHeader.nTileTblSize / sizeof(GUInt32); i++ )
        CPL_SWAP32PTR( paiTilesSwapped + i );
    VSIFWriteL( paiTilesSwapped, 1, sHeader.nTileTblSize, fp );

    CPLFree( paiTilesSwapped );
#else
    VSIFWriteL( paiTiles, 1, sHeader.nTileTblSize, fp );
#endif

    bHeaderDirty = FALSE;

    return CE_None;
}

/************************************************************************/
/*                             FlushCache()                             */
/************************************************************************/

void RMFDataset::FlushCache()

{
    GDALDataset::FlushCache();

    if ( !bHeaderDirty )
        return;

    if ( eRMFType == RMFT_MTW )
    {
        GDALRasterBand *poBand = GetRasterBand(1);

        if ( poBand )
        {
            poBand->ComputeRasterMinMax( FALSE, sHeader.adfElevMinMax );
            bHeaderDirty = TRUE;
        }
    }
    WriteHeader();
}

/************************************************************************/
/*                              Identify()                              */
/************************************************************************/

int RMFDataset::Identify( GDALOpenInfo *poOpenInfo )

{
    if( poOpenInfo->pabyHeader == NULL)
        return FALSE;

    if( memcmp(poOpenInfo->pabyHeader, RMF_SigRSW, sizeof(RMF_SigRSW)) != 0
        && memcmp(poOpenInfo->pabyHeader, RMF_SigRSW_BE, sizeof(RMF_SigRSW_BE)) != 0
        && memcmp(poOpenInfo->pabyHeader, RMF_SigMTW, sizeof(RMF_SigMTW)) != 0 )
        return FALSE;

    return TRUE;
}

/************************************************************************/
/*                                Open()                                */
/************************************************************************/

GDALDataset *RMFDataset::Open( GDALOpenInfo * poOpenInfo )
{
    if ( !Identify(poOpenInfo) )
        return NULL;

/* -------------------------------------------------------------------- */
/*  Create a corresponding GDALDataset.                                 */
/* -------------------------------------------------------------------- */
    RMFDataset *poDS = new RMFDataset();

    if( poOpenInfo->eAccess == GA_ReadOnly )
        poDS->fp = VSIFOpenL( poOpenInfo->pszFilename, "rb" );
    else
        poDS->fp = VSIFOpenL( poOpenInfo->pszFilename, "r+b" );
    if ( !poDS->fp )
    {
        delete poDS;
        return NULL;
    }

#define RMF_READ_SHORT(ptr, value, offset)                              \
do {                                                                    \
    if ( poDS->bBigEndian )                                             \
    {                                                                   \
        (value) = CPL_MSBWORD16(*(GInt16*)((ptr) + (offset)));          \
    }                                                                   \
    else                                                                \
    {                                                                   \
        (value) = CPL_LSBWORD16(*(GInt16*)((ptr) + (offset)));          \
    }                                                                   \
} while(0);

#define RMF_READ_ULONG(ptr, value, offset)                              \
do {                                                                    \
    if ( poDS->bBigEndian )                                             \
    {                                                                   \
        (value) = CPL_MSBWORD32(*(GUInt32*)((ptr) + (offset)));         \
    }                                                                   \
    else                                                                \
    {                                                                   \
        (value) = CPL_LSBWORD32(*(GUInt32*)((ptr) + (offset)));         \
    }                                                                   \
} while(0);

#define RMF_READ_LONG(ptr, value, offset)                               \
do {                                                                    \
    if ( poDS->bBigEndian )                                             \
    {                                                                   \
        (value) = CPL_MSBWORD32(*(GInt32*)((ptr) + (offset)));          \
    }                                                                   \
    else                                                                \
    {                                                                   \
        (value) = CPL_LSBWORD32(*(GInt32*)((ptr) + (offset)));          \
    }                                                                   \
} while(0);

#define RMF_READ_DOUBLE(ptr, value, offset)                             \
do {                                                                    \
    (value) = *reinterpret_cast<double*>((ptr) + (offset));             \
    if ( poDS->bBigEndian )                                             \
    {                                                                   \
        CPL_MSBPTR64(&(value));                                         \
    }                                                                   \
    else                                                                \
    {                                                                   \
        CPL_LSBPTR64(&(value));                                         \
    }                                                                   \
} while(0);

/* -------------------------------------------------------------------- */
/*  Read the main header.                                               */
/* -------------------------------------------------------------------- */

    {
        GByte   abyHeader[RMF_HEADER_SIZE];

        VSIFSeekL( poDS->fp, 0, SEEK_SET );
        if( VSIFReadL( abyHeader, 1, sizeof(abyHeader), poDS->fp ) != sizeof(abyHeader) )
        {
            delete poDS;
            return NULL;
        }

        if ( memcmp(abyHeader, RMF_SigMTW, sizeof(RMF_SigMTW)) == 0 )
            poDS->eRMFType = RMFT_MTW;
        else if ( memcmp(abyHeader, RMF_SigRSW_BE, sizeof(RMF_SigRSW_BE)) == 0 )
        {
            poDS->eRMFType = RMFT_RSW;
            poDS->bBigEndian = TRUE;
        }
        else
            poDS->eRMFType = RMFT_RSW;

        memcpy( poDS->sHeader.bySignature, abyHeader, RMF_SIGNATURE_SIZE );
        RMF_READ_ULONG( abyHeader, poDS->sHeader.iVersion, 4 );
        RMF_READ_ULONG( abyHeader, poDS->sHeader.nSize, 8 );
        RMF_READ_ULONG( abyHeader, poDS->sHeader.nOvrOffset, 12 );
        RMF_READ_ULONG( abyHeader, poDS->sHeader.iUserID, 16 );
        memcpy( poDS->sHeader.byName, abyHeader + 20,
                sizeof(poDS->sHeader.byName) );
        poDS->sHeader.byName[sizeof(poDS->sHeader.byName) - 1] = '\0';
        RMF_READ_ULONG( abyHeader, poDS->sHeader.nBitDepth, 52 );
        RMF_READ_ULONG( abyHeader, poDS->sHeader.nHeight, 56 );
        RMF_READ_ULONG( abyHeader, poDS->sHeader.nWidth, 60 );
        RMF_READ_ULONG( abyHeader, poDS->sHeader.nXTiles, 64 );
        RMF_READ_ULONG( abyHeader, poDS->sHeader.nYTiles, 68 );
        RMF_READ_ULONG( abyHeader, poDS->sHeader.nTileHeight, 72 );
        RMF_READ_ULONG( abyHeader, poDS->sHeader.nTileWidth, 76 );
        RMF_READ_ULONG( abyHeader, poDS->sHeader.nLastTileHeight, 80 );
        RMF_READ_ULONG( abyHeader, poDS->sHeader.nLastTileWidth, 84 );
        RMF_READ_ULONG( abyHeader, poDS->sHeader.nROIOffset, 88 );
        RMF_READ_ULONG( abyHeader, poDS->sHeader.nROISize, 92 );
        RMF_READ_ULONG( abyHeader, poDS->sHeader.nClrTblOffset, 96 );
        RMF_READ_ULONG( abyHeader, poDS->sHeader.nClrTblSize, 100 );
        RMF_READ_ULONG( abyHeader, poDS->sHeader.nTileTblOffset, 104 );
        RMF_READ_ULONG( abyHeader, poDS->sHeader.nTileTblSize, 108 );
        RMF_READ_LONG( abyHeader, poDS->sHeader.iMapType, 124 );
        RMF_READ_LONG( abyHeader, poDS->sHeader.iProjection, 128 );
        RMF_READ_DOUBLE( abyHeader, poDS->sHeader.dfScale, 136 );
        RMF_READ_DOUBLE( abyHeader, poDS->sHeader.dfResolution, 144 );
        RMF_READ_DOUBLE( abyHeader, poDS->sHeader.dfPixelSize, 152 );
        RMF_READ_DOUBLE( abyHeader, poDS->sHeader.dfLLY, 160 );
        RMF_READ_DOUBLE( abyHeader, poDS->sHeader.dfLLX, 168 );
        RMF_READ_DOUBLE( abyHeader, poDS->sHeader.dfStdP1, 176 );
        RMF_READ_DOUBLE( abyHeader, poDS->sHeader.dfStdP2, 184 );
        RMF_READ_DOUBLE( abyHeader, poDS->sHeader.dfCenterLong, 192 );
        RMF_READ_DOUBLE( abyHeader, poDS->sHeader.dfCenterLat, 200 );
        poDS->sHeader.iCompression = *(abyHeader + 208);
        poDS->sHeader.iMaskType = *(abyHeader + 209);
        poDS->sHeader.iMaskStep = *(abyHeader + 210);
        poDS->sHeader.iFrameFlag = *(abyHeader + 211);
        RMF_READ_ULONG( abyHeader, poDS->sHeader.nFlagsTblOffset, 212 );
        RMF_READ_ULONG( abyHeader, poDS->sHeader.nFlagsTblSize, 216 );
        RMF_READ_ULONG( abyHeader, poDS->sHeader.nFileSize0, 220 );
        RMF_READ_ULONG( abyHeader, poDS->sHeader.nFileSize1, 224 );
        poDS->sHeader.iUnknown = *(abyHeader + 228);
        poDS->sHeader.iGeorefFlag = *(abyHeader + 244);
        poDS->sHeader.iInverse = *(abyHeader + 245);
        memcpy( poDS->sHeader.abyInvisibleColors,
                abyHeader + 248, sizeof(poDS->sHeader.abyInvisibleColors) );
        RMF_READ_DOUBLE( abyHeader, poDS->sHeader.adfElevMinMax[0], 280 );
        RMF_READ_DOUBLE( abyHeader, poDS->sHeader.adfElevMinMax[1], 288 );

        if (poDS->sHeader.nBitDepth == 8)
        {
            poDS->sHeader.dfNoData = *reinterpret_cast<char *>(abyHeader + 296);
        }
        else if (poDS->sHeader.nBitDepth == 16)
        {
            RMF_READ_SHORT(abyHeader, poDS->sHeader.dfNoData, 296);
        }
        else if (poDS->sHeader.nBitDepth == 32)
        {
            RMF_READ_LONG(abyHeader, poDS->sHeader.dfNoData, 296);
        }
        else if (poDS->sHeader.nBitDepth == 64)
        {
            RMF_READ_DOUBLE(abyHeader, poDS->sHeader.dfNoData, 296);
        }

        RMF_READ_ULONG( abyHeader, poDS->sHeader.iElevationUnit, 304 );
        poDS->sHeader.iElevationType = *(abyHeader + 308);
        RMF_READ_ULONG( abyHeader, poDS->sHeader.nExtHdrOffset, 312 );
        RMF_READ_ULONG( abyHeader, poDS->sHeader.nExtHdrSize, 316 );
    }

/* -------------------------------------------------------------------- */
/*  Read the extended header.                                           */
/* -------------------------------------------------------------------- */

    if ( poDS->sHeader.nExtHdrOffset && poDS->sHeader.nExtHdrSize )
    {
        /* coverity[tainted_data] */
        GByte *pabyExtHeader = reinterpret_cast<GByte *>(
            VSICalloc( poDS->sHeader.nExtHdrSize, 1 ) );
        if (pabyExtHeader == NULL)
        {
            delete poDS;
            return NULL;
        }

        VSIFSeekL( poDS->fp, poDS->GetFileOffset( poDS->sHeader.nExtHdrOffset ), SEEK_SET );
        VSIFReadL( pabyExtHeader, 1, poDS->sHeader.nExtHdrSize, poDS->fp );

        RMF_READ_LONG( pabyExtHeader, poDS->sExtHeader.nEllipsoid, 24 );
        RMF_READ_LONG( pabyExtHeader, poDS->sExtHeader.nDatum, 32 );
        RMF_READ_LONG( pabyExtHeader, poDS->sExtHeader.nZone, 36 );

        CPLFree( pabyExtHeader );
    }

#undef RMF_READ_DOUBLE
#undef RMF_READ_LONG
#undef RMF_READ_ULONG

    CPLDebug( "RMF", "Version %d", poDS->sHeader.iVersion );

#ifdef DEBUG

    CPLDebug( "RMF", "%s image has width %d, height %d, bit depth %d, "
              "compression scheme %d, %s, nodata %f",
              (poDS->eRMFType == RMFT_MTW) ? "MTW" : "RSW",
              poDS->sHeader.nWidth, poDS->sHeader.nHeight,
              poDS->sHeader.nBitDepth, poDS->sHeader.iCompression,
              poDS->bBigEndian ? "big endian" : "little endian",
              poDS->sHeader.dfNoData );
    CPLDebug( "RMF", "Size %d, offset to overview %#lx, user ID %d, "
              "ROI offset %#lx, ROI size %d",
              poDS->sHeader.nSize,
              static_cast<unsigned long>( poDS->sHeader.nOvrOffset ),
              poDS->sHeader.iUserID,
              static_cast<unsigned long>( poDS->sHeader.nROIOffset ),
              poDS->sHeader.nROISize );
    CPLDebug( "RMF", "Map type %d, projection %d, scale %f, resolution %f, ",
              poDS->sHeader.iMapType, poDS->sHeader.iProjection,
              poDS->sHeader.dfScale, poDS->sHeader.dfResolution );
    CPLDebug( "RMF", "Georeferencing: pixel size %f, LLX %f, LLY %f",
              poDS->sHeader.dfPixelSize,
              poDS->sHeader.dfLLX, poDS->sHeader.dfLLY );
    if ( poDS->sHeader.nROIOffset && poDS->sHeader.nROISize )
    {
        GInt32 nValue;

        CPLDebug( "RMF", "ROI coordinates:" );
        /* coverity[tainted_data] */
        for ( GUInt32 i = 0; i < poDS->sHeader.nROISize; i += sizeof(nValue) )
        {
            if( VSIFSeekL( poDS->fp,
                           poDS->GetFileOffset( poDS->sHeader.nROIOffset + i ),
                           SEEK_SET ) != 0 ||
                VSIFReadL( &nValue, 1, sizeof(nValue), poDS->fp ) != sizeof(nValue) )
            {
                delete poDS;
                return NULL;
            }

            CPLDebug( "RMF", "%d", nValue );
        }
    }
#endif

/* -------------------------------------------------------------------- */
/*  Read array of blocks offsets/sizes.                                 */
/* -------------------------------------------------------------------- */
    if ( VSIFSeekL( poDS->fp,
                    poDS->GetFileOffset( poDS->sHeader.nTileTblOffset ),
                    SEEK_SET ) < 0)
    {
        delete poDS;
        return NULL;
    }

    /* coverity[tainted_data] */
    poDS->paiTiles = reinterpret_cast<GUInt32 *>(
        VSIMalloc( poDS->sHeader.nTileTblSize ) );
    if ( !poDS->paiTiles )
    {
        delete poDS;
        return NULL;
    }

    if ( VSIFReadL( poDS->paiTiles, 1, poDS->sHeader.nTileTblSize,
                    poDS->fp ) < poDS->sHeader.nTileTblSize )
    {
        CPLDebug( "RMF", "Can't read tiles offsets/sizes table." );
        delete poDS;
        return NULL;
    }

#ifdef CPL_MSB
    if ( !poDS->bBigEndian )
    {
        for ( GUInt32 i = 0; i < poDS->sHeader.nTileTblSize / sizeof(GUInt32); i++ )
            CPL_SWAP32PTR( poDS->paiTiles + i );
    }
#else
    if ( poDS->bBigEndian )
    {
        for ( GUInt32 i = 0; i < poDS->sHeader.nTileTblSize / sizeof(GUInt32); i++ )
            CPL_SWAP32PTR( poDS->paiTiles + i );
    }
#endif

#ifdef DEBUG
    CPLDebug( "RMF", "List of block offsets/sizes:" );

    for ( GUInt32 i = 0; i < poDS->sHeader.nTileTblSize / sizeof(GUInt32); i += 2 )
    {
        CPLDebug( "RMF", "    %d / %d",
                  poDS->paiTiles[i], poDS->paiTiles[i + 1] );
    }
#endif

/* -------------------------------------------------------------------- */
/*  Set up essential image parameters.                                  */
/* -------------------------------------------------------------------- */
    GDALDataType eType = GDT_Byte;

    poDS->nRasterXSize = poDS->sHeader.nWidth;
    poDS->nRasterYSize = poDS->sHeader.nHeight;

    if (!GDALCheckDatasetDimensions(poDS->nRasterXSize, poDS->nRasterYSize))
    {
        delete poDS;
        return NULL;
    }

    if ( poDS->eRMFType == RMFT_RSW )
    {
        switch ( poDS->sHeader.nBitDepth )
        {
            case 32:
            case 24:
            case 16:
                poDS->nBands = 3;
                break;
            case 1:
            case 4:
            case 8:
                {
                    // Allocate memory for colour table and read it
                    poDS->nColorTableSize = 1 << poDS->sHeader.nBitDepth;
                    if ( poDS->nColorTableSize * 4 > poDS->sHeader.nClrTblSize )
                    {
                        CPLDebug( "RMF",
                                  "Wrong color table size. Expected %d, got %d.",
                                  poDS->nColorTableSize * 4,
                                  poDS->sHeader.nClrTblSize );
                        delete poDS;
                        return NULL;
                    }
                    /* coverity[tainted_data] */
                    poDS->pabyColorTable = reinterpret_cast<GByte *>(
                        VSIMalloc( poDS->sHeader.nClrTblSize ) );
                    if (poDS->pabyColorTable == NULL)
                    {
                        CPLDebug( "RMF", "Can't allocate color table." );
                        delete poDS;
                        return NULL;
                    }
                    if ( VSIFSeekL( poDS->fp,
                                    poDS->GetFileOffset( poDS->sHeader.nClrTblOffset ),
                                    SEEK_SET ) < 0 )
                    {
                        CPLDebug( "RMF", "Can't seek to color table location." );
                        delete poDS;
                        return NULL;
                    }
                    if ( VSIFReadL( poDS->pabyColorTable, 1,
                                    poDS->sHeader.nClrTblSize, poDS->fp )
                         < poDS->sHeader.nClrTblSize )
                    {
                        CPLDebug( "RMF", "Can't read color table." );
                        delete poDS;
                        return NULL;
                    }

                    GDALColorEntry oEntry;
                    poDS->poColorTable = new GDALColorTable();
                    for( GUInt32 i = 0; i < poDS->nColorTableSize; i++ )
                    {
                        oEntry.c1 = poDS->pabyColorTable[i * 4];     // Red
                        oEntry.c2 = poDS->pabyColorTable[i * 4 + 1]; // Green
                        oEntry.c3 = poDS->pabyColorTable[i * 4 + 2]; // Blue
                        oEntry.c4 = 255;                             // Alpha

                        poDS->poColorTable->SetColorEntry( i, &oEntry );
                    }
                }
                poDS->nBands = 1;
                break;
            default:
                break;
        }
        eType = GDT_Byte;
    }
    else
    {
        poDS->nBands = 1;
        if ( poDS->sHeader.nBitDepth == 8 )
            eType = GDT_Byte;
        else if ( poDS->sHeader.nBitDepth == 16 )
            eType = GDT_Int16;
        else if ( poDS->sHeader.nBitDepth == 32 )
            eType = GDT_Int32;
        else if ( poDS->sHeader.nBitDepth == 64 )
            eType = GDT_Float64;
    }

    if (poDS->sHeader.nTileWidth == 0 || poDS->sHeader.nTileWidth > INT_MAX ||
        poDS->sHeader.nTileHeight == 0 || poDS->sHeader.nTileHeight > INT_MAX)
    {
        CPLDebug ("RMF", "Invalid tile dimension : %u x %u",
                  poDS->sHeader.nTileWidth, poDS->sHeader.nTileHeight);
        delete poDS;
        return NULL;
    }

    const int nDataSize = GDALGetDataTypeSize( eType ) / 8;
    const int nBlockXSize = static_cast<int>(poDS->sHeader.nTileWidth);
    const int nBlockYSize = static_cast<int>(poDS->sHeader.nTileHeight);
    if( nDataSize == 0 ||
        nBlockXSize > INT_MAX / nBlockYSize ||
        nBlockYSize > INT_MAX / nDataSize ||
        nBlockXSize > INT_MAX / (nBlockYSize * nDataSize) )
    {
        CPLDebug ("RMF", "Too big raster / tile dimension");
        delete poDS;
        return NULL;
    }

    poDS->nXTiles = DIV_ROUND_UP( poDS->nRasterXSize, nBlockXSize );
    poDS->nYTiles = DIV_ROUND_UP( poDS->nRasterYSize, nBlockYSize );

#ifdef DEBUG
    CPLDebug( "RMF", "Image is %d tiles wide, %d tiles long",
              poDS->nXTiles, poDS->nYTiles );
#endif

/* -------------------------------------------------------------------- */
/*  Choose compression scheme.                                          */
/*  XXX: The DEM compression method seems to be only applicable         */
/*  to Int32 data.                                                      */
/* -------------------------------------------------------------------- */
    if ( poDS->sHeader.iCompression == RMF_COMPRESSION_LZW )
        poDS->Decompress = &LZWDecompress;
    else if ( poDS->sHeader.iCompression == RMF_COMPRESSION_DEM
              && eType == GDT_Int32 )
        poDS->Decompress = &DEMDecompress;
    else    // No compression
        poDS->Decompress = NULL;

/* -------------------------------------------------------------------- */
/*  Create band information objects.                                    */
/* -------------------------------------------------------------------- */
    for( int iBand = 1; iBand <= poDS->nBands; iBand++ )
        poDS->SetBand( iBand, new RMFRasterBand( poDS, iBand, eType ) );

/* -------------------------------------------------------------------- */
/*  Set up projection.                                                  */
/*                                                                      */
/*  XXX: If projection value is not specified, but image still have     */
/*  georeferencing information, assume Gauss-Kruger projection.         */
/* -------------------------------------------------------------------- */
    if( poDS->sHeader.iProjection > 0 ||
        (poDS->sHeader.dfPixelSize != 0.0 &&
         poDS->sHeader.dfLLX != 0.0 &&
         poDS->sHeader.dfLLY != 0.0) )
    {
        OGRSpatialReference oSRS;
        GInt32  nProj =
            (poDS->sHeader.iProjection) ? poDS->sHeader.iProjection : 1;
        double  padfPrjParams[8];

        padfPrjParams[0] = poDS->sHeader.dfStdP1;
        padfPrjParams[1] = poDS->sHeader.dfStdP2;
        padfPrjParams[2] = poDS->sHeader.dfCenterLat;
        padfPrjParams[3] = poDS->sHeader.dfCenterLong;
        padfPrjParams[4] = 1.0;
        padfPrjParams[5] = 0.0;
        padfPrjParams[6] = 0.0;

        // XXX: Compute zone number for Gauss-Kruger (Transverse Mercator)
        // projection if it is not specified.
        if ( nProj == 1L && poDS->sHeader.dfCenterLong == 0.0 )
        {
            if ( poDS->sExtHeader.nZone == 0 )
            {
                double centerXCoord = poDS->sHeader.dfLLX +
                    (poDS->nRasterXSize * poDS->sHeader.dfPixelSize / 2.0);
                padfPrjParams[7] =
                    floor((centerXCoord - 500000.0 ) / 1000000.0);
            }
            else
                padfPrjParams[7] = poDS->sExtHeader.nZone;
        }
        else
            padfPrjParams[7] = 0.0;

        oSRS.importFromPanorama( nProj, poDS->sExtHeader.nDatum,
                                 poDS->sExtHeader.nEllipsoid, padfPrjParams );
        if ( poDS->pszProjection )
            CPLFree( poDS->pszProjection );
        oSRS.exportToWkt( &poDS->pszProjection );
    }

/* -------------------------------------------------------------------- */
/*  Set up georeferencing.


I thought that they are all refactored but anyway this concept of winner condition is one concept that i just wanted to test later and see if it changes the performance, I just forget to delete this class :P I will do it soon.


Shouldn't this be "sizeof(computerName) / sizeof(CHAR);" so that nSize is the number of chars?


наполнение заголовков полная шляпа.


As i said im going to delete this class because it is just a concept that i didn't test it yet. Sorry for such mistake i will delete it.


Oh yeah, you're right
On Jun 29, 2016 2:11 PM, "Adam Dunlap" <notifications@github.com> wrote:

> If I used isize I'd have to cast whenever doing array indexing
>
> —
> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub
> <https://github.com/AdamCDunlap/RustAStar/commit/d8f14080ff656fc42756df8489c815f850996e8f#commitcomment-18065909>,
> or mute the thread
> <https://github.com/notifications/unsubscribe/AFik9vFLIcuSIkde2iLd4sve0Gmxzofsks5qQrVRgaJpZM4I_s3l>
> .
>


The go way of doing this is to define a String() method.
So in your case you would do `func (robots []Robot) String() string {}`

Then you can use it like `toString()` in Java


I don't understand why is necessary to detach boot2docker.iso from the VM?


I think it's better to save on changes rather than just periodically, much like you did in the DNS, any reason you didn't go that route for cmass?


Can you please explain the meaning of `@accid="hidden"` in the examples above?  A written accidental (which is what `@accid` captures) is either present or it's not.


You should probably take the port number as an integer that way if they supply an invalid port number, the flags package will catch it, rather than crashing your `ListenAndServe` call


:mag: :gun: :ru:


I welcome your suggestion. I submitted as follows
DK_0_0,0,-25,25,10,0.002
which I believe already makes the ck =10.  Am I not correct?(I may be confused about which parameter is which.)  So just bumping the rk from 0.002 to 0.006 and the limits to +-50 then?


Never mind. I see what you're getting at now.


Golang supports first-class functions, so you can avoid having to define these two almost identical functions, check it out and see if you can rewrite this!


Dear Ian,

The link you gave me worked perfectly! I have revised the code and updated to process_data.py.
The resulting CSV file is processed_data_revised_063016.csv. I have looked for so many ways to deal with this issue and your link was the best. The result seems to be nice and clean. My only concern right now is that there are instances where exhibits are available but through dates are not. My understanding is that if exhibits are available, through dates are always provided in the documents. This means that there are some through dates that I am not catching; my guess based on looking through several documents is that the through dates in some documents, when converted from pdf, are laid out differently than the rest. I have used print df['order_text'] to check some of these texts. Would you have a suggestion as to how I should go about looking through these cases other than printing out potentially problematic texts using the print command? Thank you always for your help.

Sincerely,

Yeayeun

________________________________
From: Ian Gow <notifications@github.com>
Sent: Monday, June 27, 2016 5:25:50 PM
To: iangow/ct_orders
Cc: Park, Yeayeun; Author
Subject: Re: [iangow/ct_orders] each obs at exhibit level -not perfect yet (e79aa9f)

Yeayeun:

Doing unnest is easiest in PostgreSQL, but this<http://stackoverflow.com/a/37797497/745737> Python-baed approach may help.

-Ian

-
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<https://github.com/iangow/ct_orders/commit/e79aa9fed675ab1b526cb5fa3a1054cfab567e69#commitcomment-18031783>, or mute the thread<https://github.com/notifications/unsubscribe/ASwupx7965Oh5N5cP3UWz5G6kOFE4Tauks5qQD_egaJpZM4I_hde>.


Does this need braces around it?


You probably want to store the x and y coordinates as floats rather than strings


Golang has an IP struct (https://golang.org/pkg/net/#IP) which may or may not be worth using here instead


Bool?


This does not actually start the statedump, I'm not sure if we need to call handle_pending_statedump (which is internal to lttng-ust-comm) or lttng_handle_pending_statedump instead. Can you tell me if we need the ctor_passed check at this point ?


Go has `time.Time` which supports comparisons such as `before`, `after`, etc.. may be better than storings strings


Just a quick comment without otherwise looking at the code. String == String won't work for String comparisons. Use String.equals(String) instead.


@m-kuhn so you are saying this?
- measure the area of a 10dp circle using QgsDistanceArea and calculate its radius

`measured_area_radius  = sqrt(measured_area/3.14)`

- the measure of the accuracy radius to be drawn is proportional to the calculated one

`10 / measured_area_radius = wanted_radius_in_dp / accuracy_in_m`
`wanted_radius_in_dp = accuracy_in_m * 10 / measured_area_radius`


@NathanW2
does that look sane to you? (It's only this line that's important, the rest is pure cosmetics)


This looks like a cool feature! Feel free to submit a pull request to the main repo if you'd like to 👍


Measure 1 pixel horizontal and 1 pixel vertical (in meters), take the average.

accurracy in meters / average -> circle radius.


wstawiłam warunek do pętli, ale niestety nie zadziałało, bo kompilator zwraca 1 a nie 0


I think that was left in by mistake


And totally forget about dp in this scenario, it's just pixels, map units and meters :)


Good call. I'll merge them.


Hi Juan
It's great to be here! It has been too many years since we spoke last.

Thanks for the offer, I'm just dipping my toes into PCL and will inevitably
have questions as I progress, so most appreciated.

On 30 Jun 2016 4:28 am, "Juan Conejero" <notifications@github.com> wrote:

> Hi Eddie,
>
> Nice to meet you here! It's been a long time since we last talked by
> email. I'm glad to know you are involved in PCL development. Let me know if
> you need any support or information and I'll be happy to help you as I can.
>
> —
> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub
> <https://github.com/PixInsight/PCL/commit/06cdd542359ad5ef35963bc2b594062212b1917f#commitcomment-18066177>,
> or mute the thread
> <https://github.com/notifications/unsubscribe/ATFLlzUTEMxQXraYimLaNbX1o8oMZ17Nks5qQrk-gaJpZM4ISCg6>
> .
>


Ah wait... give me one more try


Hola Juan, refactorizamos el realizarla haciendo que utilice el puedeRealizarla, creamos un método heroeMasApto que se encarga de validar, peeero no esta del todo separado del hecho de hacer una tarea... Separarlo implicaría que al desligarse de esa validación, en todos los otros lugares donde se llamaba a realizara, se llame antes al método que valida, si no rompe. O no estamos entendiendo bien :P

Y además se modifico el método realizarMisiones del tablón para que la evaluación del elegirMision en base al criterio se realice del lado del equipo y no del tablón, entonces el tablón sabe como recorrerse, desde el equipo se le pasa el objeto inicial y la operación a realizar.

Gracias y Saludos!

Pd: acá esta el link del commit https://github.com/Lea-angiolini/TADeQuest/commit/dfef157922c2c4e6fc40797f009f4aaab66e02f5


@balloob is that code for handle HA events okay? (L310-316)


No... that actually does make sense, we don't even care about map units :+1:


@trevorbaca Doesn't this make more sense as a method in your `SegmentMaker`?


This is MATLAB code.


If you look at my screenshot in issue #21 you'll see the new problem.  I am not very good a scss, so I can't help much, but I know that if I revert this block of deletions, then the alignment gets fixed.


It has to be required, otherwise it will not fix the issue. Upgrading to the newest version of MEI will indeed require to look if the gestural domain is encoded or not. This is not unrealistic.


@JamesPHoughton oh?  I had thought I tested both vensim + stella here ( https://github.com/SDXorg/test-models/commit/46b21237c5265b01de6ecd4e8260fbe2cf227ac5 ) -- I seem to have added 2 output files but they roughly seem to match


A little spelling error here that I noticed while reading ("reserializatoin"). Very helpful documentation though!


Ah, I see. Thanks for the help!


I think you are moving too fast to the Parser.  The abstract syntax is not correct in Syntax.hs

Recall during our meeting I said to hold off on promote, copy, and derelicit, because i am thinking about how to do those.  The way you are doing it now is incorrect.

So for now, just delete those completely and focus on the other syntax.

The term

Let Term Term Term

is not correct.

Recall from the meeting the concrete syntax is

let t be x (x) y in t'
let t be unit in t'

So you need two lets one for tensor and one for unit.

So we need something like:

LetTensor Term (Bind TmName (Bind TmName Term))
LetUnit Term Term

Perhaps it might be best if you started bringing a notebook to our meetings so that you can take better notes on what we talk about.

Does this make sense?


Try to reuse the frame, if possible, e.g. :

  if not lib.frame then
    lib.frame = _G.CreateFrame("Frame")
    lib.frame :SetScript("OnEvent", function(self, event, ...) self[event](self, ...) end)
  end
  local frame = lib.frame


Thanks to @xem for suggesting to not use the frame count as score.
It was too easy to get a massive score. It is still possible but it takes 512x longer.


Why do you keep moving private static methods to the top?


It sucks not watching in realtime, I want to shout at the screen when you get stuck on stuff I did too! =)

It won't be useful for much longer as you're catching up, but maybe it's useful to see what I did when you get stuck.. here's my method for Indirect reading, which has this same wrap-around fix (and a nice comment about it!) 😄

https://github.com/DanTup/DaNES/blob/master/DaNES.Emulation/Cpu.cs#L520


@robcalcroft Thanks, glad you like it! I'll make it so that it also does this in the selected transaction view and then send a pull request.


However, I don't think there's a big problem here.

Technically, there's nothing wrong with `<note pname="f" accid.ges="n"/>`.  That is, it satisfies the schematron rule that keeps `@accid` and `@accid.ges` from having the same value.  In effect, this is a default value for accid.ges.

However, there's also nothing inherently incorrect about `<note pname="f"/>` either.  It may be sufficient for some needs and insufficient for others.  Those who want it to be there can make it so (by using the construct above), and those who don't want / need it, don't have to encode it and may ignore its presence.

As I said at https://github.com/music-encoding/music-encoding/issues/318, the indication of which domains are encoded can't be required, so the ambiguity of `<note pname="f"/>` will persist when it's not present.  Therefore, the only logical place to deal with this is in the software that consumes MEI.


Yeah, it does make sense. I had the 4 LL operations just in the Syntax to represent that they will be implemented, not as if they're good to go. I can remove or comment them out instead.

I haven't touched Let since I wrote that down. I tend to write placeholder code even if its not all correct. I recall the two Lets. I'll bring my notebook again next meeting.

How does everything else look, discounting the 4 LL ops and let? How about the parser?


@sean-duffy awesome


TaskCluster-GitHub: https://tools.taskcluster.net/task-graph-inspector/#Y2gOlMsIQRu-moT1aHNs8w


TaskCluster-GitHub: https://tools.taskcluster.net/task-graph-inspector/#AliHFjLoQI2L2ZVWGtQG2Q


TaskCluster-GitHub: https://tools.taskcluster.net/task-graph-inspector/#L6DdG2BpRIu6MO-JgwfGXw


TaskCluster-GitHub: https://tools.taskcluster.net/task-graph-inspector/#TqG86dnjRJeg5Dtg8C-tWw


See my response at https://github.com/rism-ch/verovio/commit/c7940282694baa9abf3aa668919ae2f98c3f7122#commitcomment-18056481.


Why it cannot be required? If it is not required it is useless and we should not bother adding it ;-)


Could this just define `.emoji` as the selector? Prefixing it with those other classes limits its reusability.


Hab aktualisiert, hat sich aber nix geändert. Composer selbst hab ich natürlich vorher auch aktualisiert.
Entweder sind die Änderungen schon bei uns drin, oder sie sind noch nicht in einem Composer-Release drin?


Hmmm.... I don't understand why this method is named 'getPlanet'.


Requiring would be good, particularly in the long run when doing automated processing of lots of data from different encoders, but for me it would be OK for it not to be.  Not requiring it would create three possible states:

(1) an unspecified accid.ges means accid.ges is natural
(2) an unspecified accid.ges means accid.ges is undefined
(3) a super-position of (1) and (2) at the same time (the current condition).

If the header indicates #1 or #2, then that excludes the possibility of #3 in a file (unless there is an encoding error), which is the case that I want to avoid.

Of course there could be also header specifications that say the data encodes the accid.ges data and leaves the accid attribute undefined (if not explicitly given).  Then verovio would be responsible for calculating accid as I originally wanted :-).  How does the MIDI exporter currently work?  Does it calculate @accid.ges  if it is empty, or assume @accid.ges being empty means natural?  With a switch in the header, it could be more intelligent in how to generate MIDI note numbers that are correct (I can't see how it can be done at the moment :-), and now I know why I keeping hearing Der Lindenbaum in my head in lydian mode ;-).


@DHainzl-Seekda , thanks for sharing your fix. It helped me, but it caused deleting the input value on tabbing through the input on a loaded form. The following fix enhances it, if the menu contains the exact value as an entry:

devmi/typeahead.js@995f2f2


You know that's what pull requests are for ;-)


Yeah it's fine 👍


:) thanks


I'm struggling to replicate the problem as you're describing it. Please could you raise an issue with a test case that demonstrates it?


My reasoning behind making everything strings is that it ends up in JSON anyways, so instead of

cmass
->recieve data via URL->parse into different data types->convert to JSON->send data->...

virtour
...->recieve data->parse into different data types-> do web stuff

it would just parse once. SO instead of going through the effort of parsing everything when it is just going to be stored/sent as a string(JSON) anyways, I just made them strings in the first place.

I'm not sure that it's the right way to do it, it made sense when I wrote it.


F


Can you spot the easy refactor/redundancy in this method?


local repo had old REAME.


Hi @mikestreety this merge created a new README.md file :D


I'm not sure why I did that, it would be better to only save on change


IIRC the path to the iso file is stored as an absolute path and will be different for everyone.
So we detach it prior to packaging the box together with the iso and Vagranfile.
The iso later mounted at runtime in the box Vagrantfile: https://github.com/blinkreaction/boot2docker-vagrant-box/blob/master/Vagrantfile#L10


occurs to me now that it would be better to `xit.('should....` rather than comment out.  will change next time i touch....


@SleepSpace9 no, its not finished and not for public using at the moment - but i love this awesome work and the time he spend to do this for the community!


Cool!


The point is precisely that a software cannot deal with this because the encoding ambiguous.


We could, but I think that makes more sense to add to the DetectNet documentation, rather than to this data extension.


TeamCity ReOpenLDAP :: devel [Build 285](https://binbug.bigbrother-matrix.ru/teamcity/viewLog.html?buildId=2521&buildTypeId=ReOpenLDAP_Devel&guest=1) is now running


There you go ... this test class should have been here before DirListHtml class was even added!

Remember - test first - always forever and ever amen!


Yes, this is correct. You can now take the actual values as a starting point, of course.


Ambiguous encoding, like the poor, is always with us.


Lets not do this place holder code or random commented out blocks.  Let's focus on what we can actually implement correctly right away.

So just focus on the other syntax without having these in there at all.  It will make things less confusing and easier to understand.

Then we will add new features as we go.  This will also make testing, and understanding programs easier.

There are a few things that need fixing.

We are not using "*" for the unit, but instead we are using "unit".

The base type, UnitTy, should just be I (capital i).

Also, the application parser will not work.  See the grady parser for how to do that.

Let me know if you have more questions.


Haha, yeah @montogeek I realised that. Got the removal ready to push. 😊


Good idea. I will submit a test tomorrow.


Oh, yeah. It could just be one line of code `return contentHeaders(body, path)`
But, I should probably just move the code in the private method `contentHeaders` into this method and then delete `contentHeaders`


Cool, tks


All encoding is interpretation (which is by nature ambiguous).
Software is a kind of interpretation and is, therefore, ambiguous as well.  :-)


Just checked – looks great – thanks! :)

On Wed, Jun 29, 2016 at 5:17 PM, Marc-Antoine Lemieux <
notifications@github.com> wrote:

> @malthejorgensen <https://github.com/malthejorgensen> should be out now!
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <https://github.com/smooch/smooch-js/commit/dfff49d5581040d095deedcbc074198dec4c21aa#commitcomment-18062537>,
> or mute the thread
> <https://github.com/notifications/unsubscribe/AAllYMUX5uSBczOa50s37I7NF3JJ5t2Gks5qQoylgaJpZM4JA5sJ>
> .
>


develop (evanweaver) - x86_64-Linux-Ubuntu-14.04-clang-3.5: OK (2361 of 2434 tests passed, 0 test warnings)

![Build Badge](http://img.shields.io/badge/build%20status-warnings-yellow.svg) ![Test Badge](http://img.shields.io/badge/tests%20passed-97.0%25-yellow.svg)


oshit datboi


Great, we can close music-encoding/music-encoding#318 ;-)


@JoeMurray Yes - Authorize.net & several Omnipay processors & eway currently support a future start date. This is something the payment processor code implements by adding a function to the payment processor class ie

https://github.com/civicrm/civicrm-core/blob/master/CRM/Core/Payment/AuthorizeNet.php#L72-L72

Backoffice forms already check this when deciding whether to offer a future start date

https://github.com/civicrm/civicrm-core/blob/master/CRM/Contribute/Form/AbstractEditPayment.php#L426

Although a more normal syntax for dealing with a single processor would be

if ($paymentObject->supports('FutureStartDate') {
 // blah
}

We made a pretty deliberate decision to give this control to the extensions rather than store it in the DB & I suspect you would be better to ditch this commit & use the existing pattern.


OK, I haven't checked out Grady that much yet, but I'll look through that on how to parse application.


> Does it calculate @accid.ges if it is empty, or assume @accid.ges being empty means natural?

Doesn't the first (calculation of a missing `@accid.ges`) make the second (assumption) unnecessary?


Travis builds for JDK6 are failing now for new pull request: https://travis-ci.org/apache/groovy/jobs/141155140


Do these need to be package-private? It's a backwards-incompatible change because anything subclassing JavaSupport now needs to be in the same package.


@ronichoudhury FYI, I needed to tweak this line in semantic_assetstore_adapter.py to get the internal calls to work


No worries, I've replicated it now.


## rooms socketio

El concepto de rooms es que yo puedo crear diferentes rooms o salas donde puedo tener lugares especificos para enviar mensajes y hacer broadcast de mensajes


No need to pass an input here


If calculation of a missing `@accid.ges` makes assumption of a value unnecessary, then why not require calculation?


develop (evanweaver) - x86_64-Linux-Ubuntu-14.04-cppcheck-1.61: OK (0 of 0 tests passed, 0 test warnings)

![Build Badge](http://img.shields.io/badge/build%20status-warnings-yellow.svg)


TaskCluster-GitHub: https://tools.taskcluster.net/task-graph-inspector/#IW5uTwL6RXa6J3nAMMnHBg


Ok Thanks!  I will go w/ your suggestions.  Also I have figured out a better way to split the board using the PSQT as a hint so I have stopped the current run and will just reschedule the new improved version when it's ready.


I fixed one part of it here https://github.com/tomakehurst/wiremock/pull/446


TaskCluster-GitHub: https://tools.taskcluster.net/task-graph-inspector/#CleMGg2oT1uMAAaJJ3ijLg


TaskCluster-GitHub: https://tools.taskcluster.net/task-graph-inspector/#SGVFyTbJQ_6kBzFoqwLTYw


Commit details:
- Added multiple levels, a menu at the end of each level, and a record of high-scores.
- Changed endCursor() to endGame(). It now opens the menu as well.
- Added Source Code Pro and Open Sans fonts.


This should not have been there. I'll remove it in the next commit.


contrib/codeanalysis/runcppcheck.sh: line 9: ../cppcheck-1.66/cppcheck: No such file or directory


Es müsste eine zusätzlich classsmap entstehen, https://github.com/composer/composer/pull/5174


Make background position center for mobile


I have forgotten to mention that this was a result of pair-programming with Lukasz.


os_2_0_build_shared (kbenne) - x86_64-Linux-Ubuntu-14.04-clang-3.5: Build Failed

![Build Badge](http://img.shields.io/badge/build%20status-failing-red.svg) ![Test Badge](http://img.shields.io/badge/tests%20passed-NA-red.svg)


Oh wait, It's the sign thing and not a message.
Well, I don't exactly know how it's there.
But we could edit the sign with the plugin so it shows a colour.


Forgot to mention that this was done by having pair-programmed with Lukasz.


War das absicht oder commit von debug code?


Thanks!


Named the commit wrong. It must be One plus Two


Nein, ist tatsächlich Absicht, da ich nicht wusste, wie ich es sonst lösen sollte.
Hier werden Kombis abgefangen wie, "ist schon aktiviert, und trotzdem wird die Aktivier-Aktion aufgerufen". Und sowas passiert eben, wenn man ein Addon aktiviert, und anschließend einen Reload macht.
Dann bekam man eine Fehlermeldung "Illegal operation 'activate' for package ...", was sehr verwirrend ist.
Daher liefere ich hier jetzt ein Erfolgs-Result ohne Message.


Even fairly unintelligent people, like singers and viola players, can figure out what actual note needs to be played, so why can't software?  If it can, and I'm fairly (but perhaps overly) confident that it's possible, then an explicitly encoded `@accid.ges` is only necessary to contradict the "usual" procedure.


lol


os_2_0_build_shared (kbenne) - x86_64-Linux-Ubuntu-14.04-cppcheck-1.61: OK (0 of 0 tests passed, 0 test warnings)

![Build Badge](http://img.shields.io/badge/build%20status-warnings-yellow.svg)


The library is awesome


👮  I'm going to step in and take objection to that last comment, @pe-ro . It's probably not constructive to slag singers and viola players, even if you just meant it in jest.


I think that this unintentionally broke the build on FreeBSD:

```
[43/573] Building CXX object stdlib/public/stubs/CMakeFiles/swiftStdlibStubs-freebsd-x86_64.dir/UnicodeNormalization.cpp.o
FAILED: stdlib/public/stubs/CMakeFiles/swiftStdlibStubs-freebsd-x86_64.dir/UnicodeNormalization.cpp.o
/usr/bin/clang++   -DGTEST_HAS_RTTI=0 -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/usr/home/user/development/swift/include -Iinclude -I/usr/home/user/development/llvm/include -I/usr/home/user/development/build/Ninja-DebugAssert/llvm-freebsd-x86_64/include -I/usr/home/user/development/build/Ninja-DebugAssert/llvm-freebsd-x86_64/tools/clang/include -I/usr/home/user/development/llvm/tools/clang/include -I/usr/home/user/development/cmark/src -I/usr/home/user/development/build/Ninja-DebugAssert/cmark-freebsd-x86_64/src -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wcovered-switch-default -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Werror=date-time -std=c++11 -fcolor-diagnostics -Wdocumentation -Wimplicit-fallthrough -Wunreachable-code -Woverloaded-virtual -g    -fno-exceptions -fno-rtti -Wglobal-constructors -Wexit-time-destructors -fvisibility=hidden -target x86_64-unknown-freebsd11.0-ALPHA5 -O0 -g -UNDEBUG -MMD -MT stdlib/public/stubs/CMakeFiles/swiftStdlibStubs-freebsd-x86_64.dir/UnicodeNormalization.cpp.o -MF stdlib/public/stubs/CMakeFiles/swiftStdlibStubs-freebsd-x86_64.dir/UnicodeNormalization.cpp.o.d -o stdlib/public/stubs/CMakeFiles/swiftStdlibStubs-freebsd-x86_64.dir/UnicodeNormalization.cpp.o -c /usr/home/user/development/swift/stdlib/public/stubs/UnicodeNormalization.cpp
/usr/home/user/development/swift/stdlib/public/stubs/UnicodeNormalization.cpp:24:10: fatal error: 'unicode/ustring.h' file not found
#include <unicode/ustring.h>
         ^
1 error generated.
ninja: build stopped: subcommand failed.
./utils/build-script: fatal error: command terminated with a non-zero exit status 1, aborting
```


```
"""
Missing Docstring!
"""
```


```
"""
Un noch einmal ... wo ist der Doc String?
"""
```


Any idea why nictype1 is removed? I think **virtio** has good performance

Tks.


If the `lib` folder is not available then the following files should also not be included in the bower package, because they need the `lib` folder:
* `gulpfile.js`
* `index-graph3d.js`
* `index-network.js`
* `index-timeline-graph2d.js`
* `index.js`


all should be INT32


Programmers are obviously less intelligent than viola players... More seriously, the problem is still that if you don't tell explicitly if ```@accid.ges``` is encoded or not in your data the programmer will not know if it needs to be calculated or not when no there.


```
"""
Missing Docstring.
"""
```


os_2_0_dependency_reduction_signals_slots (schrismartin) - x86_64-Linux-Ubuntu-14.04-clang-3.5: Build Failed

![Build Badge](http://img.shields.io/badge/build%20status-failing-red.svg) ![Test Badge](http://img.shields.io/badge/tests%20passed-NA-red.svg)


> As I said at music-encoding/music-encoding#318, the indication of which domains are encoded can't be required, so the ambiguity of <note pname="f"/> will persist when it's not present. Therefore, the only logical place to deal with this is in the software that consumes MEI.

For software to handle it, there must be an indication in the file for how to interpret missing @accid.ges.  Putting something in the meiHead/encodingDesc (or similar) which is machine readable (i.e, not a free-form comment) is needed to do any large-scale processing of MEI data.

This encoding:

```
    <note pname="f"/>
```

can mean either f-natural gestural or f-sharp gestural at the moment, so it is quite impossible for software to do anything 100% correctly with it.  Gestural-based software processing (such as the MIDI exporter from verovio) should refuse to process an ambiguous file unless it is given a specific manual instruction to force an interpretation model.

> Ambiguous encoding, like the poor, is always with us.

No hiding behind aphorisms allowed.  This is a black-and-white problem: the current specification allows for the super-position of two states for when an @accid.ges which is omitted from the data: it means both that accid.ges is natural (or the same as accid) and that it is undefined.  There is no reason to have that ambiguity, and being ambiguous serves no purpose.  There is the case of musica ficta I mentioned, but that would be a sub-case indicating @accid.ges is undefined if not given.


though implicit def is usually a bit more understable in weird overriding scenarios (for system) :-)


$insertComment->findAllUsersId() ? En général on met des noms de variables cohérents ;-)


Die Änderung scheint schon seit 1.1.0 drin zu sein. Müsste also eigentlich bei uns auch schon drin sein. Habs mir aber nicht im Detail angeschaut, was da überhaupt geändert wurde etc.


That's what @craigsapp means by "undefined"


Can we have a few intermediate variables here?


Well.. this code solve the problem when languages is a **string**. For example:

languages return => pt-br,en-us,zh-cn

so... the `languages.split(',');` transform this string an array :)


@ahankinson: Sorry, it was a joke.


Had to change this to `req.url.endsWith('png')` to get this working.


Misleading title.
Temporarily disabled renaming.


Needed to `npm install --save-dev heapdump` to add this to `package.json`


@lpugin: Isn't determining whether a value needs to be calculated part of the calculation process?


> @ahankinson: Sorry, it was a joke.
I think he was also joking.  Everyone knows that three violists playing a uninson are sounding a chord...


Done in 6238fa095313df3b94e7a8f0928cd107472ed193 (I originally wanted it static for performance reasons, but needed `tenantInternalApi` eventually).


os_2_0_dependency_reduction_signals_slots (schrismartin) - x86_64-Linux-Ubuntu-14.04-cppcheck-1.61: OK (0 of 0 tests passed, 0 test warnings)

![Build Badge](http://img.shields.io/badge/build%20status-warnings-yellow.svg)


@pe-ro I know. Didn't mean to be a downer, but there may be other viola players and singers out there getting notifications that may not be in on the joke.


Yup, it's a no-op for `ByteArrayInputStream`:

```
    /**
     * Closing a <tt>ByteArrayInputStream</tt> has no effect. The methods in
     * this class can be called after the stream has been closed without
     * generating an <tt>IOException</tt>.
     * <p>
     */
    public void close() throws IOException {
    }
```


.get() obtiene el elemento DOM para poder sacar la propiedad scrollHeight


Shall we move this to fontTools.unicode?  Ie. add support for bidi direction there?  That way there's one central place that one would need to provide custom unicode data.


Replaced it with JDK 8 in this commit: https://github.com/apache/groovy/pull/360/files#r69032404


COLLISION_TYPE is not defined?


Hi @gauravsarwal,

I am not sure what would caused the issue you are seeing. If you are still having issues connecting to the Finicity Facade API, please contact Finicity support through the Finicity developer portal. (https://developer.finicity.com)


This commit in particular is a complete revamp of the project - switch to using docker-machine for provisioning. Since then we rely on docker-machine defaults for pretty much everything.

The original code came from here: https://github.com/dduportal/boot2docker-vagrant-box


Is the point of this commit that you can have multiple instances?


Yeah saving the students in the array in the driver program would be better.
The String == String did work for the String comparison, as in the project worked. I have heard that it might cause problems, but I've never experienced it.

But I know in android it does causes problems so String.equals(String) is usually better.


TaskCluster-GitHub: https://tools.taskcluster.net/task-graph-inspector/#Sl9nnlpbTiOeiDU3hkHg2g


TaskCluster-GitHub: https://tools.taskcluster.net/task-graph-inspector/#cJYOq2FATei8hB0Q2Xz-Ng


Hi mesuvash, could you please explain a bit why it's a dot product on this line, or where I can find the corresponding math? I thought it's about derivative of a matrix (`x.dot(Wx)`) with respect to another matrix (`x`), but I am not sure how.


Hi Chris, I just recently started the mean Machine book. Everything has been going great so far and I did not face any problems until I started with the front end. I dont know the problem but this is what my index.html produced as an output.
![capture](https://cloud.githubusercontent.com/assets/16390339/16469717/7be3645a-3e20-11e6-9607-597f6792d41c.JPG)


Es müsste eine autoload_static datei erzeugt werden sie unter 5.6/7.x dann included wird ausgehend von vendor/autoload


You know you can squash commits, right?


Maybe update the method javadoc to also mention the JaxRSFeature.DYNAMIC_OBJECT_MAPPER_LOOKUP


I don't like to mess with the history


Die Datei ist vorhanden: https://github.com/redaxo/redaxo/blob/master/redaxo/src/core/vendor/composer/autoload_static.php


My question is related a problem I have with using this repository. I was thinking that the networking can cause the problem.

I haven't the problem with dduportal/boo2docker-vagrant-box, but I like your approach using docker-machine to build the boot2docker.


...it's not changing history if it only exists in your local repo. <_<


FixWindDirectionInterpolation (JasonGlazer) - x86_64-Linux-Ubuntu-14.04-gcc-4.8-IntegrationCoverage-Debug: OK (1669 of 1669 tests passed, 0 test warnings)

![Build Badge](http://img.shields.io/badge/build%20status-passing-green.svg) ![Test Badge](http://img.shields.io/badge/tests%20passed-100.0%25-green.svg) ![Coverage Badge](http://img.shields.io/badge/coverage%20status-70.98%25-green.svg)


By the way, many thanks for this repository. 👍


> Perhaps unlikely, but when a project becomes successful and is used by millions of people, very unlikely things happen every day!

I wish you're right and millions of people use Fable, though I'd be more than happy if the number is just in the thousands ;)

I appreciate your comments, I'm already [keeping a counter for unique variables](https://github.com/fsprojects/Fable/blob/master/src/fable-fsharp/Util/Util.fs#L116-L119) and [a list of already escaped names](https://github.com/fsprojects/Fable/blob/master/src/fable-fsharp/Util/Util.fs#L163-L167). But TBH, I don't think it's worth trying to be absolutely 100% safe (instead of 99.999%) here. I know this is not very reassuring but there are other rough edges at the moment and as this is an open source project, I've a time budget for it (my free time, basically) so I have to balance how much work I can dedicate to each issue.

I still need to create a thorough contributors guide so it's easier for other people to jump in and help maintain the project. At that moment, we can decide together where we want to focus and add extra safety check. We're in beta so it's still possible to change things a bit.