text:
#include "BeetlBwt.hh"

#include "BCRext.hh"
#include "BCRexternalBWT.hh"
#include "Common.hh"
#include "DatasetMetadata.hh"
#include "parameters/BwtParameters.hh"
#include "config.h"
#include "libzoo/cli/Common.hh"
#include "libzoo/util/Logger.hh"

#include <algorithm>
#include <cassert>
#include <cstring>
#include <fstream>
#include <iostream>
#include <sstream>

using namespace std;
using namespace BeetlBwtParameters;

BwtParameters params;

class HardwareConstraints
{
public:
    /*
        float diskSpeed;
        float ramSpeed;
        float ramCongestionLimit;
    */
    float diskMaxSpeedPerProcess; // in MB/s
    float diskMaxTotalSpeed; // in MB/s
    float ramMaxSpeedPerProcess;  // in MB/s
    float ramMaxTotalSpeed;  // in MB/s

    HardwareConstraints()
    // Default values
        : diskMaxSpeedPerProcess( 50 ) // in MB/s
        , diskMaxTotalSpeed( 100 ) // in MB/s
        , ramMaxSpeedPerProcess( 50 ) // in MB/s
        , ramMaxTotalSpeed( 100 ) // in MB/s
    {}

    void init( const string &hardwareConstraintsFilename )
    {
        if ( !hardwareConstraintsFilename.empty() )
        {
            ifstream is( hardwareConstraintsFilename.c_str() );
            string line;
            while ( getline( is, line ) )
            {
                searchForKeywordInString( line, "diskMaxSpeedPerProcess=", diskMaxSpeedPerProcess );
                searchForKeywordInString( line, "diskMaxTotalSpeed=", diskMaxTotalSpeed );
                searchForKeywordInString( line, "ramMaxSpeedPerProcess=", ramMaxSpeedPerProcess );
                searchForKeywordInString( line, "ramMaxTotalSpeed=", ramMaxTotalSpeed );
            }
        }
    }

private:
    void searchForKeywordInString( const string &line, const string &keyword, float &result )
    {
        if ( line.substr( 0, keyword.length() ) == keyword )
        {
            string rhs = line.substr( keyword.length() );
            result = atoi( rhs.c_str() );
        }
    }

} hardwareConstraints;

struct ResourceEstimate
{
    ResourceEstimate()
    {
        unset();
    }

    bool operator==( const ResourceEstimate &rhs ) const
    {
        return ramRssMBytes == rhs.ramRssMBytes
               && ramVszMBytes == rhs.ramVszMBytes
               && timeSeconds == rhs.timeSeconds;
    }

    bool isSet() const
    {
        return ramRssMBytes != 0xFFFFFFFF
               || ramVszMBytes != 0xFFFFFFFF
               || timeSeconds != 0xFFFFFFFFFFFFFFFFull;
    }

    void unset()
    {
        ramRssMBytes = 0xFFFFFFFF;
        ramVszMBytes = 0xFFFFFFFF;
        timeSeconds = 0xFFFFFFFFFFFFFFFFull;
    }

    uint32_t ramRssMBytes;
    uint32_t ramVszMBytes;
    uint64_t timeSeconds;
};

typedef pair< BwtParameters, ResourceEstimate > BwtParamsAndEstimate;
vector< BwtParamsAndEstimate > allEstimates;

std::ostream &operator<<( std::ostream &os, const ResourceEstimate &obj )
{
    if ( !obj.isSet() )
    {
        os << "<undefined>";
        return os;
    }

    os << "RAM_RSS: " << obj.ramRssMBytes << "MB";
    os << ",\tRAM_VSZ: " << obj.ramVszMBytes << "MB";
    os << ",\ttime: " << obj.timeSeconds << "sec";
    if ( obj.timeSeconds >= 60 )
    {
        uint64_t time = obj.timeSeconds;
        // we don't show the seconds if we show the hours (and we round to the closest minutes)
        if ( time > 3600 )
        {
            time = ( ( time + 30 ) / 60 ) * 60;
        }

        int hours = ( time / 60 ) / 60;
        int minutes = ( time / 60 ) % 60;
        int seconds = time % 60;
        os << " (=";
        if ( hours )
        {
            os << hours << "h";
        }
        if ( minutes )
            os << minutes << "min";
        if ( seconds )
            os << seconds << "s";
        os << ")";
    }

    return os;
}

std::ostream &operator<<( std::ostream &os, const BwtParamsAndEstimate &obj )
{
    os << obj.second << "\tfor ";
    obj.first.print( os, true, AUTOMATED );
    return os;
}

ResourceEstimate estimateResourcesFor( BwtParameters &paramValues );

/*
void recursiveFillOptionValuesAndRunEstimate( BwtParameters &paramValues )
{
        int depth = paramValues.size();
        if ( paramValues.getOptionName( depth ) != "" )
        {
            for ( int i = 0; paramValues.getOptionPossibleValue( depth, i ) != ""; ++i )
            {
                paramValues.push_back( i );
                recursiveFillOptionValuesAndRunEstimate( paramValues );
                paramValues.pop_back();
            }
        }
        else
        {
            ResourceEstimate resourceEstimate = estimateResourcesFor( paramValues );
            if ( resourceEstimate.isSet() )
                allEstimates.push_back( make_pair( paramValues, resourceEstimate ) );
        }
}
*/

void recursiveGenerateInputCombinationsAndRunEstimate( BwtParameters &intermediateParams, int unsigned depth )
{
    if ( depth < intermediateParams.entries_.size() )
    {
        if ( !( intermediateParams.entries_[depth].flags & AUTOMATED ) || intermediateParams.entries_[depth].isSet() )
        {
            recursiveGenerateInputCombinationsAndRunEstimate( intermediateParams, depth + 1 );
        }
        else
        {
            static const string switchPossibleValues[] = { "0", "1", "" };
            const string *possibleValues = ( intermediateParams.entries_[depth].flags & TYPE_SWITCH ) ? switchPossibleValues : intermediateParams.entries_[depth].possibleValues;
            for ( int i = 0; possibleValues[i] != ""; ++i )
            {
                BwtParameters newParams = intermediateParams;
                newParams.entries_[depth].silentSet( i );
                recursiveGenerateInputCombinationsAndRunEstimate( newParams, depth + 1 );
            }
        }
    }
    else
    {
        ResourceEstimate resourceEstimate = estimateResourcesFor( intermediateParams );
        if ( resourceEstimate.isSet() )
            allEstimates.push_back( make_pair( intermediateParams, resourceEstimate ) );
    }
}

bool sortEstimatesByTime( const BwtParamsAndEstimate &lhs, const BwtParamsAndEstimate &rhs )
{
    if ( lhs.second.timeSeconds != rhs.second.timeSeconds )
        return ( lhs.second.timeSeconds < rhs.second.timeSeconds );
    else
    {
        if ( lhs.second.ramRssMBytes != rhs.second.ramRssMBytes )
            return ( lhs.second.ramRssMBytes < rhs.second.ramRssMBytes );
        else
            return ( lhs.second.ramVszMBytes < rhs.second.ramVszMBytes );
    }
}

void filterEstimates( const vector< pair< string, string > > &filters, BwtParameters &paramValues )
{
    /*
        for ( vector< pair< string, string > >::const_iterator filter = filters.begin(); filter != filters.end(); ++filter )
        {
            Logger_if( LOG_SHOW_IF_VERBOSE ) Logger::out() << "Filtering with " << filter->first << " = " << filter->second << endl;
            vector< BwtParamsAndEstimate > filteredEstimates;

            // Identify resource num
            int resourceNum = 0;
            for ( resourceNum = 0; paramValues.getOptionName( resourceNum ) != ""; ++resourceNum )
            {
                if ( strcasecmp( filter->first.c_str(), paramValues.getOptionName( resourceNum ).c_str() ) == 0 )
                {
                    break;
                }
            }
            if ( paramValues.getOptionName( resourceNum ) == "" )
            {
                cerr << "Error: Impossible to identify resource " << filter->first << endl;
                exit( 1 );
            }

            // Identify resource value
            int resourceValue = 0;
            for ( resourceValue = 0; paramValues.getOptionPossibleValue( resourceNum, resourceValue ) != ""; ++resourceValue )
            {
                if ( strcasecmp( filter->second.c_str(), paramValues.getOptionPossibleValue( resourceNum, resourceValue ).c_str() ) == 0 )
                {
                    break;
                }
            }
            if ( paramValues.getOptionPossibleValue( resourceNum, resourceValue ) == "" )
            {
                cerr << "Error: Impossible to identify resource value " << filter->second << endl;
                exit( 1 );
            }

            // Do the filtering
            // cout << " identified filter: " << paramValues.getOptionName(resourceNum) << " = " << paramValues.getOptionPossibleValue(resourceNum,resourceValue) << endl;
            for ( unsigned int i = 0; i < allEstimates.size(); ++i )
            {
                bool keep = ( allEstimates[i].first[resourceNum] == resourceValue );
                if ( keep )
                {
                    filteredEstimates.push_back( allEstimates[i] );
                }
            }
            allEstimates.swap( filteredEstimates );
        }
    */
}

void calculateResourceRequirements()
{
    const unsigned int memoryLimitMB = params["memory limit MB"];

    recursiveGenerateInputCombinationsAndRunEstimate( params, 0 );

    // Sort by estimated processing time
    sort( allEstimates.begin(), allEstimates.end(), sortEstimatesByTime );

    /*
        // Merge identical estimates
        for ( unsigned int i = 1; i < allEstimates.size(); ++i )
        {
            if ( allEstimates[i - 1].second == allEstimates[i].second )
            {
                allEstimates[i - 1].first.mergeWith( allEstimates[i].first );
                allEstimates.erase( allEstimates.begin() + i );
                --i;
            }
        }
    */

    // Filter out estimates above the memory limit
    Logger::out() << "RAM constraint: " << memoryLimitMB << " MB" << endl;
    bool filteringOutTopPicks = true;
    for ( unsigned int i = 0; i < allEstimates.size(); ++i )
    {
        if ( allEstimates[i].second.ramRssMBytes > memoryLimitMB )
        {
            Logger_if( filteringOutTopPicks ? LOG_SHOW_IF_VERBOSE : LOG_FOR_DEBUGGING ) Logger::out() << "RAM too low for: " << allEstimates[i] << endl;
            allEstimates.erase( allEstimates.begin() + i );
            --i;
        }
        else
            filteringOutTopPicks = false;
    }

    // Print out /*top 10*/ estimates
    for ( unsigned int i = 0; /*i<10 &&*/ i < allEstimates.size(); ++i )
    {
        Logger_if( LOG_SHOW_IF_VERBOSE ) Logger::out() << allEstimates[i] << endl;
    }
}

ResourceEstimate estimateResourcesFor( BwtParameters &paramValues )
{
    struct ResourceEstimate result;
    result.ramRssMBytes = 0;
    result.ramVszMBytes = 0;
    result.timeSeconds = 0;

    //        cout << "Estimating resources for ";
    //        for (int i=0; i<paramValues.size(); ++i)
    //            cout << paramValues[i] << ", ";
    //        cout << endl;

    uint64_t nReads = datasetMetadata.nReads;
    if ( paramValues[ PARAMETER_ADD_REV_COMP ] == 1 )
        nReads *= 2;    // Reverse-complemented reads

    //    uint64_t dataSize = static_cast<uint64_t>( datasetMetadata.nBases * datasetMetadata.rleCompressibility / 8 );
    uint64_t dataRead = 0;
    uint64_t dataWritten = 0;
    for ( unsigned int i = 0; i < datasetMetadata.nCycles; ++i )
    {
        switch ( paramValues[PARAMETER_INTERMEDIATE_FORMAT] )
        {
            case INTERMEDIATE_FORMAT_ASCII:
            {
                dataRead += static_cast<uint64_t>( nReads * i );
                dataWritten += static_cast<uint64_t>( nReads * i );
                break;
            }
            case INTERMEDIATE_FORMAT_HUFFMAN:
                // unknown => special value so that it only gets selected if specified by the user
                result.timeSeconds = 10 * 60 * 60;
            case INTERMEDIATE_FORMAT_RLE:
            {
                float cycleRleCompressibility = 2 * datasetMetadata.rleCompressibility - datasetMetadata.rleCompressibility * i / datasetMetadata.nCycles;
                dataRead += static_cast<uint64_t>( nReads * i * cycleRleCompressibility / 8 );
                dataWritten += static_cast<uint64_t>( nReads * i * cycleRleCompressibility / 8 );
                break;
            }
            case INTERMEDIATE_FORMAT_MULTIRLE:
            {
                float cycleRleCompressibility = 2 * datasetMetadata.rleCompressibility - datasetMetadata.rleCompressibility * i / datasetMetadata.nCycles;
                dataRead += static_cast<uint64_t>( nReads * i * cycleRleCompressibility / 8 );
                dataWritten += static_cast<uint64_t>( 4 * nReads * cycleRleCompressibility / 8 );
                break;
            }
            default:
                assert( 0 && "should never reach here" );
        }
    }

    // Deactivate MultiRLE by estimating it slower (special value so that it only gets selected if specified by the user)
    if ( paramValues[PARAMETER_INTERMEDIATE_FORMAT] == INTERMEDIATE_FORMAT_MULTIRLE )
    {
        result.timeSeconds += 100 * 60 * 60;
    }

    switch ( paramValues[PARAMETER_ALGORITHM] )
    {
        case ALGORITHM_BCR:
            /*
                    // Beetl bcr -r
                PARAMETER_INPUT_FORMAT                     = not taken into consideration
                PARAMETER_ALGORITHM                        = bcr
                PARAMETER_INTERMEDIATE_FORMAT         = RLE
                PARAMETER_INTERMEDIATE_STORAGE_MEDIUM = disk
                PARAMETER_PARALLEL_PREFETCH                = OFF
                PARAMETER_PARALLEL_PROCESSING              = OFF
                PARAMETER_GENERATE_QUALITIES               = n/a
                PARAMETER_GENERATE_LCP                     = n/a
                PARAMETER_SINGLE_CYCLE                     = n/a

                    // Beetl bcr -r + parallel (branch027)
                PARAMETER_INPUT_FORMAT                     = not taken into consideration
                PARAMETER_ALGORITHM                        = bcr
                PARAMETER_INTERMEDIATE_FORMAT         = RLE
                PARAMETER_INTERMEDIATE_STORAGE_MEDIUM = disk
                PARAMETER_PARALLEL_PREFETCH                = ON
                PARAMETER_PARALLEL_PROCESSING              = OFF/2cores/4cores
                PARAMETER_GENERATE_QUALITIES               = n/a
                PARAMETER_GENERATE_LCP                     = n/a
                PARAMETER_SINGLE_CYCLE                     = n/a

                    // Beetl bcr -t (parallel)
                PARAMETER_INPUT_FORMAT                     = not taken into consideration
                PARAMETER_ALGORITHM                        = bcr
                PARAMETER_INTERMEDIATE_FORMAT         = MultiRLE
                PARAMETER_INTERMEDIATE_STORAGE_MEDIUM = RAM
                PARAMETER_PARALLEL_PREFETCH                = ON
                PARAMETER_PARALLEL_PROCESSING              = OFF/2cores/4cores
                PARAMETER_GENERATE_QUALITIES               = n/a
                PARAMETER_GENERATE_LCP                     = n/a
                PARAMETER_SINGLE_CYCLE                     = n/a
            */
        {
            float diskSpeed = min( hardwareConstraints.diskMaxSpeedPerProcess * ( 4/*1 << paramValues[PARAMETER_PARALLEL_PROCESSING]*/ )
                                   , hardwareConstraints.diskMaxTotalSpeed );
            float ramSpeed = min( hardwareConstraints.ramMaxSpeedPerProcess * ( 4/*1 << paramValues[PARAMETER_PARALLEL_PROCESSING]*/ )
                                  , hardwareConstraints.ramMaxTotalSpeed );

            // base RAM
            result.ramRssMBytes += 14 * nReads / 1024 / 1024; // main structures
            if ( true /*paramValues[PARAMETER_PARALLEL_PROCESSING]*/ )
            {
                result.ramRssMBytes += sizeof( struct sortElement ) * nReads / 1024 / 1024; // vectTriple duplicated for parallel action
                // buffer due to growing vectors: worst case is twice the data size of a well distributed data between the 16 buffers (multiplied by 4 as a precaution), max 1GB for each of the 16 buffers
                uint32_t bufferSize = min<uint32_t>( nReads / 16 * 4 * sizeof( struct sortElement ) / 1024 / 1024 * 2 / 16, 1024 );
                result.ramRssMBytes += 16 * bufferSize;
            }

            // TransposeFasta
            switch ( paramValues[PARAMETER_INPUT_FORMAT] )
            {
                case INPUT_FORMAT_FASTQ:
                    dataRead += static_cast<uint64_t>( 2 * nReads * datasetMetadata.nCycles );
                    dataWritten += static_cast<uint64_t>( nReads * datasetMetadata.nCycles );
                    break;
                case INPUT_FORMAT_FASTA:
                case INPUT_FORMAT_SEQ:
                    dataRead += static_cast<uint64_t>( nReads * datasetMetadata.nCycles );
                    dataWritten += static_cast<uint64_t>( nReads * datasetMetadata.nCycles );
                    break;
                case INPUT_FORMAT_CYC:
                case INPUT_FORMAT_BCL:
                    break;
            }

            uint64_t dataRw = dataRead + dataWritten;

            //#ifdef _OPENMP
            //always activated at the moment            if ( paramValues[PARAMETER_PARALLEL_PREFETCH] == true )
            {
                unsigned int prefetchRam = nReads / 1024 / 1024;
                result.ramRssMBytes += prefetchRam;
            }
            //else
            //#endif // ifdef _OPENMP
            {
                uint64_t prefetchTime = static_cast<uint64_t>( datasetMetadata.nBases /  hardwareConstraints.diskMaxSpeedPerProcess / 1024 / 1024 ) + 1;
                result.timeSeconds += prefetchTime;
            }

            if ( true /*paramValues[PARAMETER_INTERMEDIATE_STORAGE_MEDIUM] == INTERMEDIATE_STORAGE_MEDIUM_DISK*/ )
            {
                uint64_t dataRwTime = static_cast<uint64_t>( dataRw / diskSpeed / 1024 / 1024 ) + 16;
                result.timeSeconds += dataRwTime;
            }
            else // == INTERMEDIATE_STORAGE_MEDIUM_RAM
            {
                uint64_t dataRwTime = static_cast<uint64_t>( dataRw / ramSpeed / 1024 / 1024 ) + 16;
                result.timeSeconds += dataRwTime;

                result.ramRssMBytes += 14 * nReads / 1024 / 1024; //?
                result.ramRssMBytes += static_cast<uint64_t>( nReads * datasetMetadata.nCycles * datasetMetadata.rleCompressibility / 8 * 2 / 1024 / 1024 );
            }
            break;
        }

        case ALGORITHM_EXT:
        {
            // Beetl ext

            // Filter out unsupported options
            if ( paramValues[PARAMETER_INTERMEDIATE_FORMAT] == INTERMEDIATE_FORMAT_MULTIRLE )
            {
                result.unset();
                break;
            }

            // Fixed RAM consumption for all Beetl ext
            result.ramRssMBytes = 2;
            result.ramVszMBytes = 19;

            // TransposeFasta
            switch ( paramValues[PARAMETER_INPUT_FORMAT] )
            {
                case INPUT_FORMAT_CYC:
                case INPUT_FORMAT_BCL:
                    dataRead += static_cast<uint64_t>( nReads * datasetMetadata.nCycles );
                    dataWritten += static_cast<uint64_t>( nReads * datasetMetadata.nCycles );
                    break;
                case INPUT_FORMAT_FASTQ:
                case INPUT_FORMAT_FASTA:
                case INPUT_FORMAT_SEQ:
                    break;
            }

            // Main EXT formula
            uint64_t dataRw = dataRead + dataWritten;
            uint64_t dataSfiles_RW = static_cast<uint64_t>( nReads * datasetMetadata.nCycles );
            uint64_t dataPfiles_RW = static_cast<uint64_t>( nReads * 8 * datasetMetadata.nCycles );
            result.timeSeconds = static_cast<uint64_t>( ( dataRw + dataSfiles_RW + dataPfiles_RW ) / hardwareConstraints.diskMaxSpeedPerProcess / 1024 / 1024 ) + 19;
            break;
        }

        default:
            cerr << "Error: should never reach here" << endl;
            exit ( -1 );
    }

    Logger_if( LOG_FOR_DEBUGGING )
    {
        paramValues.print( Logger::out(), true, AUTOMATED );
        Logger::out() << " => " << result << endl;
    }
    return result;
}

void launchBeetlBwt( BwtParamsAndEstimate &config )
{
    const string &inputFilename = config.first["input filename"];
    const string &outputFilename = config.first["output filename"];

    Logger::out() << "\nLaunching the following configuration of Beetl-bwt:" << endl;
    config.first.print( Logger::out(), false );
    Logger::out() << endl;

    Logger::out() << "Estimated RAM consumption: " << config.second.ramRssMBytes << " MB" << endl;
    Logger::out() << endl;

    switch ( config.first[PARAMETER_ALGORITHM] )
    {
        case ALGORITHM_BCR:
        {
            int bcrMode = 0 ; // 0=build BWT
            CompressionFormatType outputCompression = compressionIncrementalRunLength; // todo
            BCRexternalBWT bwt( ( char * )inputFilename.c_str(), ( char * )outputFilename.c_str(), bcrMode, outputCompression, &config.first );
        }
        break;

        case ALGORITHM_EXT:
        {
            bool isAsciiOutput = ( config.first["output format"] == OUTPUT_FORMAT_ASCII );
            bool isHuffmanOutput = ( config.first["output format"] == OUTPUT_FORMAT_HUFFMAN );
            bool isRunlengthOutput = ( config.first["output format"] == OUTPUT_FORMAT_RLE );
            bool isImplicitSort = ( config.first["SAP ordering"] == 1 );
            bool isSeqInput = ( config.first["input format"] == INPUT_FORMAT_CYC );

            assert ( isRunlengthOutput || isAsciiOutput || isHuffmanOutput );

            Algorithm *pBCRext = new BCRext( isHuffmanOutput,
                                             isRunlengthOutput,
                                             isAsciiOutput,
                                             isImplicitSort,
                                             isSeqInput,
                                             inputFilename,
                                             outputFilename );

            // run main method
            pBCRext->run();

            // clean up
            delete pBCRext;
        }
        break;
    }
}

void printUsage()
{
    params.printUsage();

    cout << "Notes:" << endl;
    cout << "    BCR only : The following options force algorithm=bcr: --reverse, --pause-between-cycle, --qualities=permute, --add-rev-comp" << endl;
    cout << "    RLE      : run-length-encoded format" << endl;
//    cout << "    multiRLE : run-length-encoded using an incremental strategy with multiple files" << endl;
    cout << "    SAP      : implicit permutation to obtain more compressible BWT" << endl;
    cout << "    LCP      : length of Longest Common Prefix shared between a BWT letter and the next one. Stored using 4 bytes per BWT letter in files with -Lxx suffix." << endl;
    cout << "               (Note: forces algorithm=bcr, non-parallel and intermediate-format=ascii)" << endl;
    cout << "               (++++ Sorry, for computing the LCP array, you must set BUILD_LCP to 1 in src/shared/Tools.hh and compile again! ++++)" << endl;
    cout << "    PBE      : prediction-based encoding" << endl;
#ifndef _OPENMP
    cout << endl;
    cout << "Warning:" << endl;
    cout << "    This version of BEETL hasn't been compiled with OpenMP parallelisation. Performance may be degraded." << endl;
#endif //ifndef _OPENMP
    cout << endl;
}

int main( const int argc, const char **argv )
{
    // Generated using: http://patorjk.com/software/taag/#p=display&f=Soft&t=BEETL%20BWT
    cout << ",-----.  ,------.,------.,--------.,--.       ,-----.  ,--.   ,--.,--------. " << endl;
    cout << "|  |) /_ |  .---'|  .---''--.  .--'|  |       |  |) /_ |  |   |  |'--.  .--' " << endl;
    cout << "|  .-.  \\|  `--, |  `--,    |  |   |  |       |  .-.  \\|  |.'.|  |   |  |    " << endl;
    cout << "|  '--' /|  `---.|  `---.   |  |   |  '--.    |  '--' /|   ,'.   |   |  |    " << endl;
    cout << "`------' `------'`------'   `--'   `-----'    `------' '--'   '--'   `--'    " << endl;
    cout << "Version " << PACKAGE_VERSION << endl;
    cout << endl;

    cout << "Command called:" << endl << "   ";
    for ( int i = 0; i < argc; ++i )
    {
        cout << " " << argv[i];
    }
    cout << "\n" << endl;

    if ( !params.parseArgv( argc, argv ) || params["help"] == 1 || !params.chechRequiredParameters() )
    {
        printUsage();
        exit( params["help"] == 0 );
    }

    // Auto-detection of missing arguments
    if ( !params["input format"].isSet() )
    {
        const string &filename = params["input filename"];
        string fileFormat = detectFileFormat( filename );
        if ( fileFormat.empty() )
        {
            cerr << "Error: file format not recognised for " << filename << endl;
            exit( -1 );
        }
        params["input format"] = fileFormat;
    }
    checkFileFormat( params["input filename"], params["input format"] );

    if ( params["memory limit MB"] <= 0 )
    {
        params["memory limit MB"] = detectMemoryLimitInMB();
    }

    // Special case of SAP ordering
    /*
        if ( params["SAP ordering"] == 1 )
        {
            if ( !params["algorithm"].isSet() || strcasecmp( params["algorithm"].userValue.c_str(), "ext" ) != 0 )
            {
                clog << "Warning: Forcing algorithm=ext for --sap-ordering" << endl;
                params["algorithm"] = "ext";
            }
            if ( !params["intermediate format"].isSet() || strcasecmp( params["intermediate format"].userValue.c_str(), "ascii" ) != 0 )
            {
                clog << "Warning: Forcing intermediate-format=ascii for --sap-ordering" << endl;
                params["intermediate format"] = "ascii";
            }
        }
    */

    // Special case of LCP generation
    if ( params["generate LCP"] == 1 )
    {
        if ( !params["algorithm"].isSet() || strcasecmp( params["algorithm"].userValue.c_str(), "bcr" ) != 0 )
        {
            clog << "Warning: Forcing algorithm=bcr for --generate-lcp" << endl;
            params["algorithm"] = "bcr";
        }
        if ( !params["intermediate format"].isSet() || strcasecmp( params["intermediate format"].userValue.c_str(), "ascii" ) != 0 )
        {
            clog << "Warning: Forcing intermediate-format=ascii for --generate-lcp" << endl;
            params["intermediate format"] = "ascii";
        }
    }

    // Switches only available with the BCR algorithm
    if ( params["reverse"] == 1
         || params["pause between cycles"] == 1
         || params["process qualities"] == "permute"
         || params["add reverse complement"] == 1
       )
    {
        if ( !params["algorithm"].isSet() || strcasecmp( params["algorithm"].userValue.c_str(), "bcr" ) != 0 )
        {
            clog << "Warning: Forcing algorithm=bcr for --reverse/--pause-between-cycle/--qualities=permute/--add-rev-comp" << endl;
            params["algorithm"] = "bcr";
        }
    }

    // Use default parameter values where needed
    params.commitDefaultValues();

    datasetMetadata.init( params["input filename"], params["input format"] );
    // TODO: hardwareConstraints.init( params["HardwareConstraints"] );

    // Resource estimation
    calculateResourceRequirements();

    // Launch the fastest estimated configuration of Beetl
    if ( allEstimates.empty() )
    {
        cerr << "Error: Beetl doesn't seem to be able to run under these constraints. Try to relax some of them." << endl;
        exit( 2 );
    }
    launchBeetlBwt( allEstimates[0] );

    return 0;
}

redpajama_set_name: RedPajamaGithub


text:
Prime Minister Justin Trudeau stands with Bill Morneau as he remains Minister of Finance during the swearing-in of the new cabinet at Rideau Hall in Ottawa on Wednesday, Nov. 20, 2019. THE CANADIAN PRESS/Sean Kilpatrick
Liberals' fiscal update shows billions more in deficits this year and next
Last time, they projected a $19.8-billion deficit. This time, it's $26.6 billion
Dec. 16, 2019 12:40 p.m.
Canada's federal budget deficit will be billions of dollars deeper than it was supposed to be this year and next, according to the Finance Department.
The figures released Monday morning show that the Liberals' projected deficit of $19.8 billion for the 12-month period that ends in March is now slated to hit $26.6 billion.
And next year's deficit is expected to be $28.1 billion, before accounting for promises the Liberals will unveil in their 2020 budget.
The Liberals' election platform projected four years of deficits of more than $20 billion, including almost $27.4 billion in the upcoming fiscal year that begins in April 2020.
The Finance Department says the deeper deficit is largely driven by changes to how employee pensions and benefits are calculated, but also accounts for a tax break that takes effect on Jan. 1.
Still, the Liberals say their preferred measure of the state of federal finances — which calculates the deficit relative to the size of the economy — will keep improving, if not as quickly as it was supposed to.
Spending is also expected to go up faster on the Canada Child Benefit than the Liberals projected earlier this year, a reflection of pegging the value of payments to inflation and "an increase in the projected number of children eligible."
The government also says that increased spending announced in the March 2019 budget will be "entirely offset" over the coming years by what the Liberals higher-than-anticipated personal and corporate income-tax revenue.
At the same time, revenues will decline for excise taxes and duties this year — largely from the Liberals' lifting retaliatory tariffs on American steel and aluminum earlier than they planned — and over the coming years from "lower expected growth in taxable consumption."
READ MORE: Re-elected Liberals would still run big deficits, despite new taxes
Federal officials are also promising the first phase of a spending and tax review that the Liberals say will result in $1.5 billion in savings starting next fiscal year, which the government has accounted for.
The update provided today from Finance Minister Bill Morneau comes on the heels of a week where the opposition Conservatives accused the government of creating the conditions for a "made-in-Canada recession."
The government, however, projects that the economy itself will continue to grow over the coming years at roughly the rate calculated in the March budget.
The Finance Department projects growth will be 1.7 per cent this year and 1.6 per cent next year, after weakness late last year and early this year, particularly in the mining and oil-and-gas sectors. The projections would make Canada the second-fastest-growing economy among G7 countries, behind only the United States.
VIDEO: Fire destroys popular chalet at Big White Ski Resort
Sentence hearing begins for B.C. dad convicted of killing two young daughters
Cranbrook sees five COVID-19 cases in first week of January
To date, there have been nearly 230 cases reported in the East Kootenay region
SD5 joins teachers in calling for end to FSAs
School District 5 has sent a letter to the Ministry of Education to replace FSAs with alternate testing
Cranbrook SAR rescues injured snowmobiler from Lumberton area
A helicopter crew assisted in safely and quickly located the injured person
OPINION: Cranbrook needs a homeless shelter
Whether at 209 16th Ave. N or in another location, the city is in desperate need of a year-round shelter
2021 well underway, so here are some … Hugs & Slugs!
Hugs: We would like to give a big hug out to the…
Pompeo: One Land-Mine a Day
Gwynne Dyer on the U.S. Secretary of State's last days in office
BC Housing provides details on proposed homeless shelter during info session
Over one hundred people attended a virtual information session hosted by BC Housing, local advocates
Innis Avenue to close to all traffic starting January 18
Avenue facing new development will be closed from Monday, Jan. 18 to Thursday, Jan. 21, for sewer connection
It happened this week in 1914
Jan. 10 - 16: Compiled by Dave Humphrey from the newspapers at the Cranbrook History Centre and Archives
Shoreacres resident flees just before tree crushes house

redpajama_set_name: RedPajamaCommonCrawl


text:
Do you need a CV to get a job?
Are traditional CV's obsolete?
hackajob launches Contract Jobs
You asked, we listened: This week, we're thrilled to announce that we've launched Contract Jobs for candidates and employers.
myhackajobstory
My hackajob Story: Removing the toxicity from tech
When relaying her experiences as a software engineer, Meryem admits that working in the world of tech hasn't always been easy. Here, she shares her story of how hackajob worked for her, and explains why more must be done to protect women working in technical roles.
The rise of the bootcamp developer
A few years ago, it was the norm to find technical candidates with a Computer Science (CS) degree, but now the landscape has changed and we're seeing a world filled with bootcamp and self-taught developers.
Unhappy at work? Maybe it's time to make your move
Do you look forward to getting out of bed in the morning? Ok, we're kidding, obviously nobody looks forward to leaving the house and hitting the traffic jam that is most morning commutes, so the real question is...
From Designer to Developer: Why I changed roles
When Francesco held his university prospectus in his hands, he felt confident that he had made the right decision in choosing to study graphic design. Now four years on and with almost two
How to engineer your career
Thinking of changing it up? Make sure to use our handy checklist and kickstart 2019 by learning to engineer your career.
Get a job that 'gets' you
This January, it's time to get a job that gets you.


text:
Posts Tagged 'Cosmopolitan'
On newspapers – Time (Inc.) for a shift in strategy
July 6, 2014 davidllewelynjones 1 comment
It's no secret that the publishing industry is struggling mightily as customers shift from paying for physical newspapers and magazines to reading information online, often for free. The shift has caused ruptures among other places at that bastion of French journalism, Le Monde, with the recent exit of the editor as staff rued the switch to online. So-called 'lad's mags', the FHMs and Loaded magazines of the world, have been hit particularly hard, as the family PC and dial-up internet gave way to personal, portable devices and broadband connections, which provided easier access to more salacious content than the likes of Nuts could ever hope to provide. FHM's monthly circulation is down almost 90% from a 1998 peak, according to the Financial Times. Condé Nast have pushed bravely into the new digital era, launching a comprehensive list of digital editions of its wares when the iPad launched in 2010. More recently, the company launched a new venture, La Maison. In association with Publicis and Google, the idea is to provide luxury goods companies with customer insights as well as content and technology solutions. We've often written about the need for more rigorous customer insights in the world of luxury, so it's refreshing to see Condé Nast innovating and continuing to look beyond newsstand sales. We've written about other ways publishers are monetising their content here and here.
Time Warner is not alone then in its struggles for new ways of making money from previously flourishing revenue streams. According to The New York Times, Time Warner will be spinning off its publishing arm, Time Inc., with 90 magazines, 45 websites and $1.3bn in debt. In 2006, the article reports, Time Inc. produced $1bn in earnings, which has now receded to $370m. Revenue has declined in 22 of the last 24 quarters. This kind of move is not new. Rupert Murdoch acted in similar fashion recently when he split up News Corporation, creating 21st Century Fox. But with the publishing side of the business there were some diamonds in the rough for investors to take interest in; a couple of TV companies, as well as of course Dow Jones' Wall Street Journal, which has been invested in heavily. Conversely, the feeling of the Time Inc spin-off was more one of being put out to pasture, particularly as the company will not have enough money to make any significant acquisitions. Like the turmoil at Le Monde, there have been managerial controversies, as those seeking to shake things up have tried to overcome historical divisions between the sales and editorial teams – something other large business journalism companies are reportedly struggling with – only to be met with frustration.
Setting that aside, Time Warner moved swiftly. A day later, the FT reported that the company was "finalising an investment" in Vice Media. We have written extensively about Vice previously, here. The company certainly seems to know how to reach fickle millennials, through a combination of interesting, off-beat journalism, content designed to create its own news, as well as compelling video documentaries that take an unusual look at topical subjects. Such an outlook however does not preclude it from partnering with corporations. As a millennial myself, it seems what people look for from those like Vice is authenticity, rather than the vanilla mediocrity arguably offered by others. We don't mind commercialism as long as it's transparent. It does not jar then when Intel is a major investor in its 'content verticals', or when last year 21st Century Fox invested $70m in the company. This bore fruit for the movie studio most recently in a tie-up promoting the upcoming Dawn of the Planet of the Apes. The sequel takes place 10 years after the 2011 film, and Fox briefed Vice to create three short films that would fill in the gaps. A great ploy, and the result is some compelling content to keep fans engaged in the run-up to the film's release, particularly in territories where the film opens after the US market. Such activity is far beyond the purview of the traditional newspaper. But this is not necessarily a bad thing. Publishers must face up to the reality that newspapers alone will not deliver enough revenue to be sustainable. Seeking other content revenue streams while engaging in strategic partnerships with other companies looks, for now, to be a winning formula.
UPDATE 08/07/14: When it comes to engaging with millennials, mobile is most definitely the medium of choice. The FT reported today on Cosmopolitan magazine's 200% surge in web visitors, year on year in May. Fully 69% of page views were from mobile devices (compared to a 25% average for the rest of the web). The publication has also wised up to the type of content this group likes to consume, as well as create. Troy Young, Hearst's president of digital media, said the new site is "designed for fast creation of content of all types… Posts aren't just text and pictures. They're gifs, Tweets, Instagrams." Mobile will only get the company so far though. PwC thinks US mobile advertising spending will account for only 4.6% of total media and entertainment advertising outlays this year. Cosmo is looking beyond mobile though to "exclusive events or experiences", perhaps along the same lines as those other businesses are practicing who are looking for additional revenue streams. The article suggests users might "pay to see the first pictures of an occasion like Kanye West's and Kim Kardashian's recent wedding". Beggars can't be choosers.
UPDATE 10/07/14: Have all these corporate manoeuvres on the part of Time Warner been in the service of making itself appear an attractive acquisition? As the famous and clandestine Sun Valley conference takes place this week, rumours abounded that Google or 21st Century Fox were both interested in buying TW. This according to entertainment industry trade mag Variety, which commented, "Time Warner could be an attractive target. Moreover, unlike Fox or Liberty Media, it is not controlled by a founder or a founder's family and with a market cap of $63.9 billion it is a relative bargain compared to the Walt Disney Co. and its $151 billion market cap".
Categories: Uncategorized Tags: 21st Century Fox, AdWeek, Bloomberg, Circulation, Conde Nast, Cosmo, Cosmopolitan, Dawn of the Planet of the Apes, Disney, Dow Jones, FHM, Film, Fox, FT, Google, Hearst, Hearst Magazines, Hearst Media, Innovation, Instagram, Investment, iPad, La Maison, Lad's mags, Le Monde, Liberty Media, Loaded, Luxury, M&A, Millennials, Mobile, New York Times, New Yorker, New Yorker cartoon, News Corporation, Newspapers, Nuts, PC, PricewaterhouseCoopers, Publicis, Publishing, PwC, Strategy, Sun Valley, Time Inc, Time Warner, TMT, Troy Young, TV, Tweet, Variety, Vice, Vice Media, Wall Street Journal, WSJ


Shop for smart lock food carrier 14cm x 3 layer)free stainless steel spoon, the product is a popular item this season. the product is a new item sold by Perwarm store and shipped from China. Smart Lock Food Carrier (14cm X 3 Layer)FREE Stainless Steel Spoon is sold at lazada.sg with a really cheap expense of SGD53.00 (This price was taken on 21 May 2018, please check the latest price here). what are the features and specifications this Smart Lock Food Carrier (14cm X 3 Layer)FREE Stainless Steel Spoon, let's examine the important points below.
This item is for your convenience to carry food everywhere. Airtight lid help carry soup , curry without leaking.
For detailed product information, features, specifications, reviews, and guarantees or another question that is certainly more comprehensive than this Smart Lock Food Carrier (14cm X 3 Layer)FREE Stainless Steel Spoon products, please go straight to the seller store that is coming Perwarm @lazada.sg.
Perwarm is often a trusted shop that already is skilled in selling Kitchen Storage & Accessories products, both offline (in conventional stores) and online. lots of their customers are incredibly satisfied to get products from your Perwarm store, that may seen with the many 5 star reviews provided by their buyers who have purchased products inside the store. So you do not have to afraid and feel concerned with your products or services not up to the destination or not prior to precisely what is described if shopping in the store, because has several other clients who have proven it.
In addition Perwarm in addition provide discounts and product warranty returns in the event the product you get does not match whatever you ordered, of course together with the note they feature. For example the product that we are reviewing this, namely "Smart Lock Food Carrier (14cm X 3 Layer)FREE Stainless Steel Spoon", they dare to offer discounts and product warranty returns when the products you can purchase don't match what's described.
So, if you need to buy or search for Smart Lock Food Carrier (14cm X 3 Layer)FREE Stainless Steel Spoon however strongly suggest you purchase it at Perwarm store through marketplace lazada.sg.
Why should you buy Smart Lock Food Carrier (14cm X 3 Layer)FREE Stainless Steel Spoon at Perwarm shop via lazada.sg?
Obviously there are many benefits and advantages that you can get when shopping at lazada.sg, because lazada.sg is really a trusted marketplace and also have a good reputation that can provide security from all of kinds of online fraud. Excess lazada.sg in comparison with other marketplace is lazada.sg often provide attractive promotions such as rebates, shopping vouchers, free freight, and quite often hold flash sale and support which is fast and that's certainly safe. as well as what I liked is simply because lazada.sg can pay on the spot, that was not there in almost any other marketplace.


Ingolstadt put a halt to the seemingly unstoppable force of RB Leipzig on Matchday 14.
Werder Bremen proved age is just a number, Artjoms Rudnevs demonstrated why Borussia Dortmund are his favourite opponents and Uli Hoeneß is quickly becoming Bayern München's lucky charm. It's the Matchday 14 stat-attack!
RB Leipzig's historic unbeaten start in the Bundesliga came to an end against unlikely opponents FC Ingolstadt 04. This was also the first time the newcomers were unable to find the back of the net on a Matchday.
For the first time this calendar year, Hamburg have won two consecutive Bundesliga games. They beat SV Darmstadt 98 on Matchday 14 before clinching a 1-0 victory against FC Augsburg on Saturday.
1. FC Köln's Artjoms Rudnevs has scored more goals against Borussia Dortmund than any other club. His effort on the weekend was also his first goal for 1. FC Köln in Germany's top flight.
Since Uli Hoeneß was re-elected as club president, FC Bayern München have won all four of their competitive fixtures.
Eintracht Frankfurt are unbeaten in eight Bundesliga games. Friedhelm Funkel was head coach the last time the Eagles boasted such an impressive streak.
In 12 Bundesliga games against VfL Wolfsburg, Torjägerkanone candidate Robert Lewandowski has netted 12 times.
Nils Petersen netted for the 15th time in the Bundesliga as a super-sub on Matchday 14. He sits level in the all-time rankings alongside Bremen's Claudio Pizarro. The SC Freiburg player is only three goals short of title holder, Alexander Zickler.
With his 28th shot on goal this season, Thomas Müller was finally successful against VfL Wolfsburg. His goalless drought lasted 12 Bundesliga games; a total of 999 minutes.
With Jaroslav Drobny, Claudio Pizarro and Clemens Fritz in Bremen's starting line-up, three players were over 36 years old. Never before have Die Grün-Weißen fielded so many players over the age of 36.
For the first time in his career and on his 166th Bundesliga appearance, Hamburger SV's Lewis Holtby was shown a red card.
Nils Petersen scored SC Freiburg's 700th goal in the Bundesliga.
Ingolstadt against Leipzig was the 900th pairing in Bundesliga history. Freiburg against Darmstadt. which had an earlier kick-off on Matchday 14, was pairing number 899.
Click here for the Matchday 14 round-up!
Click here for the Matchday 14 talking points!


or More Simply: Man's Best Friend!
Pharaoh happily jumped out of my car being almost as familiar as I was with this weekly trip across to see Jon.
Just as naturally, once in Jon's room and almost as soon as Jon and I had started talking, Pharaoh rolled over on to his right side and closed his eyes.
Jon was quiet for a moment then, after looking down at the sleeping Pharaoh, looked back up at me.
Jon continued: "One of the critical innovations that Hawkins did was to find a way of measuring in an objective manner how an individual behaved from the perspective of being fundamentally a truthful or false person.
I made a note to get myself a copy of the book.
"Anyway, Paul, there's a chart in his book that shows how Hawkins sets out those behaviours as a scale with the value of 200 being the mid-way point. In other words, persons who are rated above the value of 200 are essentially truthful persons with integrity and those who score below 200 are fundamentally false persons.
And here's the magical point I wanted to make, that so directly affects you and Pharaoh.
Dr. Hawkins has measured dogs as creatures who rate above 200. Approximately in the range of 205 through to 210.
It was a Monday afternoon in the month of May. The year being 2008. I will never forget the date. For that evening, when I had returned with Pharaoh to my home in the small village of Harberton, just a few miles from the Devon town of Totnes, I went online and registered the domain name LearningfromDogs.com. I had no idea then of what I had set in motion.
However, one aspect of my future was falling into place. In a few months time I would be travelling one-way from England to Mexico with Pharaoh. A result of the most beautiful and fortuitous meeting of a woman; the woman who would become my wife in 2010.
I'll not say too much for this essay is about dogs. But it is highly relevant to explain that Suzann, a friend of mine from way back, invited me to spend the Christmas of 2007 with her and her husband in San Carlos, Mexico. San Carlos is 250 miles south of the Arizona border town of Nogales. I had never previously been to Mexico.
I flew down from LA to the main city of Hermosillo, some 80 miles north of San Carlos and was met by Suzann and her closest female friend: Jean.
Jean had been living in San Carlos for a number of years, her American husband having died in 2005, and within a very short time of us all being in Su's car and setting off to San Carlos I explored what I heard to be an English accent in Jean's voice. It turned out to be an Essex accent for Jean had been born in Dagenham. Dagenham is a large suburb of east London about 11.5 miles east of Charing Cross and 9.5 miles east of the City of London.
I quickly learnt that Jean and her late husband, Ben, had been living in Mexico for a number of years and that Jean's passion was rescuing dogs from the streets of Mexico, in and around San Carlos, paying to have them either spayed or neutered, and then finding good, loving homes for them primarily in Arizona. That explained why my seat behind Su and Jean was practically walled in with shrink-wrapped cardboard trays containing more tins of dog food than I had seen in a lifetime!
Just a few weeks later, in early 2008, before I left San Carlos to return to Devon there was no question that I had fallen deeply in love with this very beautiful woman and, miracle of miracles, Jean likewise had with me. To put a small detail to this miracle, I had been born in Acton, north-west London, and the straight line distance between Dagenham and Acton is 23 miles!
Thus when in December of 2008 I arrived in San Carlos with Pharaoh I rapidly started to appreciate what life was like living with 15 other dogs; in other words 16 with Pharaoh. More precisely described as me starting to learn from the dogs around me. That learning has continued unabated for over 8 years and I don't see any end in sight to that education for a very long time.
The starting point to learning about dogs must be the history of the relationship. Looked at from a general perspective of dogs and humans it is a breathtakingly wonderful story.
The origins of that first grey wolf or two starting to follow us humans around are lost in the mists of time. But we are certain that it was long before modern man settled down to an agricultural way of life, back when we were still hunting and gathering.
Most hunter-gatherers were nomadic and survived more on scavenging than hunting, according to Lewis Binford.[ii] But either way there would have been a great propensity to attract wolves and other similar animals. Somehow, somewhere a human reached out to a wolf and slowly over time each species became comfortable with the other.
Charles Darwin (1809-1882) knew without doubt that humans had a very special relationship with dogs but was unable to determine how far back that went. The origins of that relationship are still a complex puzzle.
Previously, archeological evidence in examining the different shape of the dog's skull compared to the skull of a wolf, had put the 'split' back to around 12,000 to 13,000 years ago.
However, the mitochondrial DNA sequence offered evidence that the domestication of the wolf, as in the dog, went back more than 100,000 years. All scientists are now agreed that the domestication of the dog goes back thousands of years further than with any other pet animal.
Modern molecular genetics, as in DNA, offers us the knowledge that our mitochondrial DNA sequence is passed down through the maternal line.[iii] Thus not only do these DNA markers set out a timeline they also show dogs to be more closely related to grey wolves than any other species: Dogs are domesticated wolves; without a doubt.
Back to timelines. For we are not saying that the domesticated wolf, the dog, goes back before the origins of homo sapiens for that is back to around 200,000 years ago.[iv] That is far too long ago. But dogs were certainly on the scene long before the Neanderthals came to an end around 28,000 years ago. The other fascinating aspect is that it is probable that we had dogs in our lives during the last glacial period, as in the last Ice Age, which occurred from circa 110,000 years ago right through to 11,700 years ago.
Another important aspect of how wolves and early humans may have become familiar with each other comes from Dr. Kaminski for she has identified that we share with wolves the fact that we are both social carnivores that live, as in feeding ourselves, in daylight.
While it is difficult to draw a clear evolutionary line between hunter-gatherer societies and agricultural societies, the widespread adoption of agriculture and the resulting cultural changes that have flowed from that has most definitely occurred in the last 10,000 years.
But again I say that this essay is about dogs, not the history of humans! Well, I stand corrected: It is about the relationship between dogs and humans.
No, the real importance of the story of dogs and humans is our relationship with each other.
As in Germany, where remains were found of a person buried with their dog that was estimated to be 14,000 years old. Or that when a pet dog died in ancient Egypt, well-to-do owners would have their dog mummified with the same care as a human family member.
Then in ancient China dogs were regarded as a gift from heaven and the blood of dogs was considered so sacred it was used in sealing oaths and swearing allegiances.
Or, closer to home, the Mayans, in the Americas, kept dogs as pets yet also associated their dogs with the gods. More than that! The souls of dead Mayans were conducted by dogs across a watery expanse called Xibalba. Then when the human soul arrived in this netherworld, guidance was on hand from a dog to see the deceased through the challenges set out by the lords of Xibalba in order to reach paradise.
But back to more earthly facts.
Did you know that our faces are not similar in terms of left side versus right side? In other words, if one takes a photograph of a person's face, cuts it vertically down through the centre of the nose (the photograph that is; not the face!), and creates two images, one made up of the two left-hand images and one made up of the two right-hand images they won't be the same.
This fascinating aspect of us humans flows from the fact that our feelings and emotions show more on the right-hand side of our face. Instinctively and subconsciously, we always look to the left when we are looking at a person, to read those emotions being shown in that person's right-hand side of their face.
In other words, we have a left-gaze bias.
It doesn't stop there; not by a mile!
Dr. Ádám Miklósi, of the Eötvös Loránd University, Budapest, has dedicated many years to investigating the human-dog relationship.[viii] He has proved that there is wonderful agreement between many, many people as to what the different barks of a dog mean. Humans are easily able to discriminate six different dog barks and what they mean. Some people can go beyond six different barks.
This has been proved through double-blind testing and is still more evidence of what that 'domestic' relationship between us and our dogs has produced. Not just that we are incredibly attuned to each other in a way unique to both species but also that dogs' wild relatives don't really bark. The bark has evolved especially to permit dogs to communicate with us!
The connection between dog and human is even closer than that.
Any woman who has had a baby knows how very quickly mother and child develop a strong, positive bond. The special nature of that bond most likely is beyond the true emotional understanding of the father irrespective of how much the father also loves his new child.
Why do we respond in such an amazing manner? Here are three ideas.
Firstly, by highlighting what Associate Professor Brian Hare of Duke University[xi] has discovered in his work of understanding the traits of domestication. That being that while the dog is not a socialised wolf, domestication has produced an animal, ergo the dog, that is like a juvenile wolf.
Finally, Dr. Morten Kringelbach of the Department of Psychiatry at Oxford University[xii] explains that the need to nurture is very deep in us humans and that dogs produce an instinctive parental response in us that is very similar to our nurturing instinct for our children.
If the magic of having dogs in our lives for such a long time ended there it would still be breathtakingly wonderful. But dogs could now be offering us humans the capacity to understand many human diseases. Literally, our dogs could be saving our lives!
The challenge in understanding human diseases is that within our 'breed' there is a great variability of genes. Not surprising when one considers the incredible diversity and variation within us humans.
But when we turn to dogs then we have a bonus. For despite there being, as mentioned earlier, 400 or more different breeds of dog, within each breed dogs are very similar to each other. In other words, that narrow gene pool within a specific dog breed makes if far easier to pinpoint genetic mutations than it is in humans.
Elinor Karlsson is the director of the Vertebrate Genomics Group at the Broad Institute of MIT and Harvard.[xiii] As a geneticist, Dr. Karlsson has identified, "hundreds of diseases common to dogs and humans". In 2005, the dog's genome was fully mapped; all 2.4 billion letters of the dog's genome code.
Among those common diseases between us humans and our wonderful dogs are diabetes, cardiac diseases, epilepsy, many cancers especially bone cancers, and breast cancer and even brain tumours.
Yes, of course, dogs are extremely more proficient than us humans in such aspects as their sense of smell or their ability to herd. Many would extend that proficiency of dogs to their sense of loyalty and forgiveness, to and of us humans, but that all pales into insignificance when compared to what our understanding of dogs is giving us.
No less than the capacity to help cure many of our diseases, to deeply understand the workings of the human mind, and above all else, the insight into our very existence.
Acknowledgement; I am very grateful to the BBC Horizon television programme The Secret Life of Dogs, first broadcast early 2010, for stimulating me to study much of the research presented in this essay.
[ii] Binford, Louis (1986). "Human ancestors: Changing views of their behavior". Journal of Anthropological Archaeology. 3: 235–57.
[iv] "Fossil Reanalysis Pushes Back Origin of Homo sapiens". Scientific American. Stuttgart: Georg von Holtzbrinck Publishing Group. February 17, 2005. ISSN 0036-8733. Retrieved 2015-05-04. The oldest fossil remains of anatomically modern humans are the Omo remains, which date to 195,000 (±5,000) years ago and include two partial skulls as well as arm, leg, foot and pelvis bones.
Paul Handover is a child of the post-war era in Great Britain having been born in London just six months before the end of World War II. After a rather shaky attempt at being educated, including two years studying for a diploma in electrical engineering, his first job was as a commercial apprentice at the British Aircraft Corporation in Hertfordshire, England. Paul has travelled widely through his work, spending some time living in Australia before returning to the UK to build his own company.
In 2007, Paul met his present wife and fellow-born Londoner, Jean, who for many years had been rescuing homeless dogs from the streets of San Carlos, Mexico where she then lived. Paul subsequently moved out with Pharaoh, his German Shepherd dog, to be with Jean, and in 2010 the couple, along with 14 dogs and 5 cats, moved to the USA eventually settling in Southern Oregon close to the small town of Merlin. In July, 2009 Paul started writing a blog under the same name as this book, a blog that the author still maintains on a daily basis.
There's a tiny amount of domesticated wolf in all of us. The relationship between canids and humans goes back nearly 40,000 years, when dogs split away from wolves. With our dogs, we have traveled the ancient track from hunter-gatherers to modern humans. However, this track now seems to offer an uncertain future for humankind and society.
With just the right blend of humor, story-telling, perception, compassion, and insight, the author shares his unusual perspective and how he came to share what he's learned through a lifetime of observation and interaction with dogs.
This entry was posted in Dogs, nature, Photography and tagged Alsatian, domesticated wolf, German Shepherd, Humane Society, relationship between dog and man, rescue dogs, wolf. Bookmark the permalink.
I really enjoyed the results of Paul's research for this post.
Great! It seems to me, cats, however, are more intelligent. Until three years ago we had a cat who was only peaceful with dogs, if these were not on a leash. All the other dogs he regarded as slaves of his master. 😉 Really!
Meet author Paul Handover through his guest post on Sue Vincent's blog.


Coffee lovers know how they like their brew and a quick instant cup is not going to hit the spot. Freshly ground coffee, brewed on the stove or using a filter coffee machine is a cheap and easy way to enjoy fresh coffee. However, if you want to have a perfect cup of coffee every time, made just the way you like it, you will need to get yourself a great coffee machine, with functions to suit your needs and your lifestyle. Let us take a look at how to choose the ideal coffee machine for your home.
Most types of home coffee machine make espresso-based drinks. From espressos and americanos, to cappucinos and lattes, choosing a good quality home coffee machine will enable you to enjoy a barista quality beverage in the comfort of your own home.
For those short on time,a bean-to-cup coffee is the ideal option. These labour-saving machines will grind your beans, taking the hassle out of making fresh coffee every morning. One of the major advantages of home coffee machines is the ability to make milky coffee drinks such as espressos and lattes. Most of the major makes of bean-to-cup coffee makers come with a milk frothing attachment so you can heat your milk, even skinny or soya, to the desired temperature and consistency. Alternatively, these machines can be used to whip up a soothing milky drink before bedtime.
For those who like super-fast technology and want to enjoy a variety of espresso-based coffees, a pod or capsule coffee maker is the ideal choice. As with the bean-to-cup machine, a capsule coffee maker means you don`t have to grind your own beans. Indeed, these foil-sealed capsules mean that you don`t have to bother with beans at all. Simply place a capsule in the machine, press the button and fresh, home-made coffee is yours in an instant. With a wide-range of different makes and models on the market, you will need to ensure that you have the right pods for your machine, as the pods and capsules are not a one-size-fits-all solution. Whilst, cup for cup, drinks from a capsule coffee machine are more costly than a stove top espresso or a bean-to-cup brew, these high quality beverages still work out far cheaper than a typical takeaway habit.
For real caffeine fiends, a home coffee maker is an essential piece of kit which is bound to save you time and money. Whatever your tastes, there is a coffee machine out there for you. From simply filter machines such as those available from CS Catering Equipment, to state-of-the-art capsule-based espresso machines, you will find a coffee maker meeting your needs and your budget.


In this poster you have the details of two courses that will be help in April and in May, specifically designed for you. The first is a basic course, like the one organized last scholastic year, intended for those who could not make it then. The second course is designed specifically for those who already covered the basic course last year. I can only promise you that if you attend you won't regret it. You will certainly find such courses very helpful indeed. Thanks and regards.


text:
Books Online Free
"Simon…," she whispered—then she heard the sharp two-tone beep that signaled that a text message had just arrived on her cell phone. The phone itself was lying folded on the bedside table; Clary picked it up and saw that the message was from Isabelle.
She flipped the phone open and scrolled hastily down to the text. She read it twice, just to make sure she wasn't imagining things. Then she ran to the closet to get her coat.
The voice spoke out of the blackness: slow, dark, familiar as pain. Jace blinked his eyes open and saw only darkness. He shivered. He was lying curled on the icy flagstone floor. He must have fainted. He felt a stab of fury at his own weakness, his own frailty.
He rolled onto his side, his torn wrist throbbing in its manacle. "Is anyone there?"
"Surely you recognize your own father, Jonathan." The voice came again, and Jace did know it: its sound of old iron, its smooth near-tonelessness. He tried to scramble to his feet but his boots slipped on a puddle of something and he skidded backward, his shoulders hitting the stone wall hard. His chain rattled like a chorus of steel wind chimes.
"Are you hurt?" A light blazed upward, searing Jace's eyes. He blinked away burning tears and saw Valentine standing on the other side of the bars, beside the corpse of Brother Jeremiah. A glowing witchlight stone in one hand cast a sharp whitish glow over the room. Jace could see the stains of old blood on the walls—and newer blood, a small lake of it, which had spilled from Jeremiah's open mouth. He felt his stomach roil and clench, and thought of the black formless shape he'd seen before with eyes like burning jewels. "That thing," he choked out. "Where is it? What was it?"
"You are hurt." Valentine moved closer to the bars. "Who ordered you locked up here? Was it the Clave? The Lightwoods?"
"It was the Inquisitor." Jace looked down at himself. There was more blood on his pants legs and on his shirt. He couldn't tell if any of it was his. Blood was seeping slowly from beneath his manacle.
Valentine regarded him thoughtfully through the bars. It was the first time in years Jace had seen his father in real battle dress—the thick leather Shadowhunter clothes that allowed freedom of movement while protecting the skin from most kinds of demon venom; the electrum-plated braces on his arms and legs, each marked with a series of glyphs and runes. There was a wide strap across his chest and the hilt of a sword gleamed above his shoulder. He squatted down then, putting his cool black eyes on a level with Jace's. Jace was surprised to see no anger in them. "The Inquisitor and the Clave are one and the same. And the Lightwoods should never have allowed this to happen. I would never have let anyone do this to you."
Jace pressed his shoulders back against the wall; it was as far as his chain would let him get from his father. "Did you come down here to kill me?"
"Kill you? Why would I want to kill you?"
"Well, why did you kill Jeremiah? And don't bother feeding me some story about how you just happened to wander along after he spontaneously died. I know you did this."
For the first time Valentine glanced down at the body of Brother Jeremiah. "I did kill him, and the rest of the Silent Brothers as well. I had to. They had something I needed."
"What? A sense of decency?"
"This," said Valentine, and drew the Sword from his shoulder sheath in one swift movement. "Maellartach."
Jace choked back the gasp of surprise that rose in his throat. He recognized it well enough: The huge, heavy-bladed silver Sword with the hilt in the shape of outspread wings was the one that hung above the Speaking Stars in the Silent Brothers' council room. "You took the Silent Brothers' sword?"
"It was never theirs," Valentine said. "It belongs to all Nephilim. This is the blade with which the Angel drove Adam and Eve out of the garden. And he placed at the east of the garden of Eden cherubim, and a flaming sword which turned every way," he quoted, gazing down at the blade.
Jace licked his dry lips. "What are you going to do with it?"
"I'll tell you that," said Valentine, "when I think I can trust you, and I know that you trust me."
"Trust you? After the way you sneaked through the Portal at Renwick's and smashed it so I couldn't come after you? And the way you tried to kill Clary?"
"I would never have hurt your sister," said Valentine, with a flash of anger. "Any more than I would hurt you."
"All you've ever done is hurt me! It was the Lightwoods who protected me!"
"I'm not the one who locked you up here. I'm not the one who threatens and distrusts you. That's the Lightwoods and their friends in the Clave." Valentine paused. "Seeing you like this—how they've treated you, and yet you remain stoic—I'm proud of you."
At that, Jace looked up in surprise, so quickly that he felt a wave of dizziness. His hand gave an insistent throb. He pushed the pain down and back until his breathing eased. "What?"
"I realize now what I did wrong at Renwick's," Valentine went on. "I was picturing you as the little boy I left behind in Idris, obedient to my every wish. Instead I found a headstrong young man, independent and courageous, yet I treated you as if you were still a child. No wonder you rebelled against me."
"Rebelled? I—" Jace's throat tightened, cutting off the words he wanted to say. His heart had begun pounding in rhythm with the throbbing in his hand.
Valentine pressed on. "I never had a chance to explain my past to you, to tell you why I've done the things I've done."
"There's nothing to explain. You killed my grandparents. You held my mother prisoner. You slew other Shadowhunters to further your own ends." Every word in Jace's mouth tasted like poison.
"You only know half the facts, Jonathan. I lied to you when you were a child because you were too young to understand. Now you are old enough to be told the truth."
"So tell me the truth."
Valentine reached through the bars of the cell and laid his hand on top of Jace's. The rough, callused texture of his fingers felt exactly the way it had when Jace had been ten years old.
"I want to trust you, Jonathan," he said. "Can I?"
Jace wanted to reply, but the words wouldn't come. His chest felt as if an iron band was being slowly tightened around it, cutting off his breath by inches. "I wish…," he whispered.
A noise sounded above them. A noise like the clang of a metal door; then Jace heard footsteps, whispers echoing off the City's stone walls. Valentine started to his feet, closing his hand over the witchlight until it was only a dim glow and he himself was a faintly outlined shadow. "Quicker than I thought," he murmured, and looked down at Jace through the bars.
Jace looked past him, but he could see nothing but blackness beyond the faint illumination of the witchlight. He thought of the roiling dark form he had seen before, crushing out all light before it. "What's coming? What is it?" he demanded, scrabbling forward on his knees.
"I must go," said Valentine. "But we're not done, you and I."
Jace put his hand to the bars. "Unchain me. Whatever it is, I want to be able to fight it."
"Unchaining you would hardly be a kindness now." Valentine closed his hand around the witchlight stone completely. It winked out, plunging the room into darkness. Jace flung himself against the bars of the cell, his broken hand screaming its protest and pain.
"No!" he shouted. "Father, please."
"When you want to find me," Valentine said, "you will find me." And then there was only the sound of his footsteps rapidly receding and Jace's own ragged breathing as he slumped against the bars.
On the subway ride uptown Clary found herself unable to sit down. She paced up and down the near-empty train car, her iPod headphones dangling around her neck. Isabelle hadn't picked up the phone when Clary had called her, and an irrational sense of worry gnawed at Clary's insides.
She thought of Jace at the Hunter's Moon, covered in blood. With his teeth bared in snarling anger, he'd looked more like a werewolf himself than a Shadowhunter charged with protecting humans and keeping Downworlders in line.
She charged up the stairs at the Ninety-sixth Street subway stop, only slowing to a walk as she approached the corner where the Institute hulked like a huge gray shadow. It had been hot down in the tunnels, and the sweat on the back of her neck was prickling coldly as she made her way up the cracked concrete walk to the Institute's front door.
She reached for the enormous iron bellpull that hung from the architrave, then hesitated. She was a Shadowhunter, wasn't she? She had a right to be in the Institute, just as much as the Lightwoods did. With a surge of resolve, she seized the door handle, trying to remember the words Jace had spoken. "In the name of the Angel, I—"
The door swung open onto a darkness starred by the flames of dozens of tiny candles. As she hurried between the pews, the candles flickered as if they were laughing at her. She reached the elevator and clanged the metal door shut behind her, stabbing at the buttons with a shaking finger. She willed her nervousness to subside—was she worried about Jace, she wondered, or just worried about seeing Jace? Her face, framed by the upturned collar of her coat, looked very white and small, her eyes big and dark green, her lips pale and bitten. Not pretty at all, she thought in dismay, and forced the thought back. What did it matter how she looked? Jace didn't care. Jace couldn't care.
The elevator came to a clanging stop and Clary pushed the door open. Church was waiting for her in the foyer. He greeted her with a disgruntled meow.
"What's wrong, Church?" Her voice sounded unnaturally loud in the quiet room. She wondered if anyone were here in the Institute. Maybe it was just her. The thought gave her the creeps. "Is anyone home?"
The blue Persian turned his back and headed down the corridor. They passed the music room and the library, both empty, before Church turned another corner and sat down in front of a closed door. Right, then. Here we are, his expression seemed to say.
Before she could knock, the door opened, revealing Isabelle standing on the threshold, barefoot in a pair of jeans and a soft violet sweater. She started when she saw Clary. "I thought I heard someone coming down the hall, but I didn't think it would be you," she said. "What are you doing here?"
Clary stared at her. "You sent me that text message. You said the Inquisitor threw Jace in jail."
"Clary!" Isabelle glanced up and down the corridor, then bit her lip. "I didn't mean you should race down here right now."
Clary was horrified. "Isabelle! Jail!"
"Yes, but—" With a defeated sigh, Isabelle stood aside, gesturing for Clary to enter her room. "Look, you might as well come in. And shoo, you," she said, waving a hand at Church. "Go guard the elevator."
Church gave her a horrified look, lay down on his stomach, and went to sleep.
"Cats," Isabelle muttered, and slammed the door.
"Hey, Clary." Alec was sitting on Isabelle's unmade bed, his booted feet dangling over the side. "What are you doing here?"
Clary sat down on the padded stool in front of Isabelle's gloriously messy vanity table. "Isabelle texted me. She told me what happened to Jace."
Isabelle and Alec exchanged a meaningful look. "Oh, come on, Alec," Isabelle said. "I thought she should know. I didn't know she'd come racing up here!"
Clary's stomach lurched. "Of course I came! Is he all right? Why on earth did the Inquisitor throw him in prison?"
"It's not prison exactly. He's in the Silent City," said Alec, sitting up straight and pulling one of Isabelle's pillows across his lap. He picked idly at the beaded fringe sewed to its edges.
"In the Silent City? Why?"
Alec hesitated. "There are cells under the Silent City. They keep criminals there sometimes before deporting them to Idris to stand trial before the Council. People who've done really bad things. Murderers, renegade vampires, Shadowhunters who break the Accords. That's where Jace is now."
"Locked up with a bunch of murderers?" Clary was on her feet, outraged. "What's wrong with you people? Why aren't you more upset?"
Alec and Isabelle exchanged another look. "It's just for a night," Isabelle said. "And there isn't anyone else down there with him. We asked."
"But why? What did Jace do?"
"He mouthed off to the Inquisitor. That was it, as far as I know," said Alec.
Isabelle perched herself on the edge of the vanity table. "It's unbelievable."
"Then the Inquisitor must be insane," said Clary.
"She's not, actually," said Alec. "If Jace were in your mundane army, do you think he'd be allowed to mouth off to his superiors? Absolutely not."
"Well, not during a war. But Jace isn't a soldier."
"But we're all soldiers. Jace as much as the rest of us. There's a hierarchy of command and the Inquisitor is near the top. Jace is near the bottom. He should have treated her with more respect."
"If you agree that he ought to be in jail, why did you ask me to come here? Just to get me to agree with you? I don't see the point. What do you want me to do?"
"We didn't say he should be in jail," Isabelle snapped. "Just that he shouldn't have talked back to one of the highest-ranked members of the Clave. Besides," she added in a smaller voice, "I thought that maybe you could help."
P/S: Copyright -->www_Novel12_Com
Novel12.Com - Copyright © 2014 - 2017
Books Online FreeNovels Online
All The Data From The Network AND User Upload, If Infringement, Please Contact Us To Delete!
Email: admin@novel12.com


Kommentare: I got the benefit of organization and never forgetting an appointment.
Vorteile: I am someone who likes to stay organized. Having a great software to help me remember when to meet with students I am tutoring or when to go to business meetings for my freelance clients, when I have doctor appointments, etc. really helps me out. I have a busy schedule and can forget important appointments without this software! It is easy to use and fairly intuitive. It is also cloud-based, which helps me in case I don't have my computer or phone.
Nachteile: It has a bit of a learning curve. It took some trial and error to perfect use. Customer service is there to help, however.
Thank you for your review of the system. It sounds like you are a tutor. We have hundreds of tutors who use AppointmentPlus. I'm glad the software helps keep you organized with your busy schedule. And yes, the fact that it's cloud-based does make it convenient because you can access your account anywhere at any time. With regard to your comment about the learning curve, it's true. Like most software systems, it takes a little while to get the hang of using the system. But, once you are used to it, it's easy. And, as noted, our customer service team is always ready to help. Thank you again for the excellent review!
Our expeditors love this tool!
Kommentare: Improved customer service & employee satisfaction, enhanced management analytics.
Vorteile: - Major timesaver for our Logistics & Customer Service Teams - dramatically reduced email/phone calls relating to 2500 shipments/month.
- Carriers very receptive to self serve appointment setting. easy to implement.
- Appointment templates have allowed us to tailor our dock schedules by load type, and align manpower to demand.
- Excellent people to work with - from Sales, to Implementation, and post launch Account Management!
Colleen, thank you for the stellar review! It's great to hear that AppointmentPlus has improved the efficiency of your operations. With regard to the feature suggestions you noted, both are already on the roadmap. Thank you again for the review!


text:
By Matthew Lopez
The Legend of Georgia McBride will run October 2 - October 13, 2019. If tickets are available, the times will appear as a maroon button. To purchase tickets, click on the time of the show in which you're interested. TICKETS: $39 (Student/OLLI: $19.50)
Wednesday: October 2, 2019
Thursday: October 3, 2019
Friday: October 4, 2019
Sunday: October 6, 2019
Tuesday: October 8, 2019
Thursday: October 10, 2019
Friday: October 11, 2019
Saturday: October 12, 2019
Sunday: October 13, 2019
STEVE SCOTT is an Artistic Associate at the Goodman Theatre in Chicago, and was the Goodman's producer until his retirement in 2017. His Goodman directing credits include The Santaland Diaries; Ah, Wilderness; Vanya and Sonia and Masha and Spike; Horton Foote's Blind Date; the world premiere of Tom Mula's Jacob Marley's Christmas Carol; and six productions of A Christmas Carol. He has directed productions at most of Chicago's professional theaters including Northlight, A Red Orchid, American Blues, Shattered Globe, Redtwist Theatre (where he is an ensemble member), and the Eclipse Theatre, where he is a 20-year company member and serves currently as Interim Artistic Director. Mr. Scott has been a member of the faculty of the Theatre Conservatory of the College of Performing Arts at Roosevelt University for more than twenty years; he has also taught at Columbia College Chicago, Loyola University of Chicago, Northwestern University, Northern Illinois University, and the Theatre School at DePaul University. Prior to moving to Chicago, he was the head of the theater program at Baker University (Baldwin, KS) and the Artistic Director of the Creede (CO) Repertory Theatre. He received his B.S.E. at the University of Kansas (Phi Beta Kappa) and his M.A. at the University of Denver. Mr. Scott has also served on panels or advisory committees for Chicago's Department of Cultural Affairs, the Illinois Arts Council, the National Endowment for the Arts, the Stage Directors and Choreographers Society, United States Arts, and the PEW Charitable Trust/Philadelphia Theatre Initiative. For his work as a director, he has received six Joseph Jefferson Award nominations, an After Dark Award, and numerous Broadway World nominations; for his work in the Chicago theater community he has received the 2017 Special Jeff Award and the 2018 Lifetime Achievement Award from the League of Chicago Theatres.
A music-filled comedy with a huge heart
He's young, he's broke, his landlord's knocking at the door, and he's just found out his wife is going to have a baby! To make matters even more desperate, Casey is fired from his gig as an Elvis impersonator in a small, run-down bar. When the bar owner brings in a drag show to replace his act, Casey finds that he has a whole lot to learn about show business—and himself. Find out what happens when the 'The King' becomes a queen!


text:
Q: C++ sector aligned read Im asking this because i am having trouble understanding sector aligned reading when we are reading raw device.
Lets assume whe are in a Windows machined, and we are using the ReadFile() C function to read x bytes from a device.
I know we can only read sector aligned data, but recently i discovered the SetFilePointer() function, that allow us to put a pointer in x bytes of the device we have previously opened with CreateFile().
My question is, if we need to read sector aligned data, if we use SetFilePointer() for example like this:
SetFilePointer(device, 12, NULL, FILE_BEGIN);

(device is a HANDLE to an existing device,for the sake of this example lets assume its a USB pen drive), in that example we set a pointer thatis pointing to the 12th byte starting from FILE_BEGIN.
If i were to read the equivalent of one sector (512 bytes) starting from that 12th byte, would i need to make my read fucntion like this:
ReadFile(device, sector, (512 - 12), &bytesRead, NULL)

or like this:
ReadFile(device, sector, 512, &bytesRead, NULL)

Regardless, thanks!

A:
My question is, if we need to read sector aligned data, if we use SetFilePointer() for example like this:
SetFilePointer(device, 12, NULL, FILE_BEGIN);

... then you are no longer reading sector-aligned data, and you'll get error 87 in the ReadFile call. Reading sector-aligned data doesn't just mean that you have to read in sector-sized blocks, but you must always read blocks that start on sector boundaries.
You have to seek to the sector containing the bytes of your interest (so, position/sector_size*sector_size), read the whole sector and extract the bytes of your interest from the data you read.

A: Well, it depends..

*

*if you want what's in your buffer to represent an entire sector of the device, and map it using a struct* or byte offsets - that's usually how it's done.  then your offsets sent to SetFilePointer should be aligned on the sector size, then read sector sized buffers. So SetFilePointer(0) -> ReadFile(512 bytes)

*If you don't care, and just want bytes 12-16, SetFilePointer(12) -> Read(4bytes).
I'd go for solution 1, because it would probably make the code easier to read and maintain in the long run.

redpajama_set_name: RedPajamaStackExchange


The end of winter is fast approaching, as evident by this little plum tree that we pass every week on the way to church. Each week, more and more pink buds have appeared and burst into blossoms. This week, I finally captured it in it's beauty.
The last fall IMAGE, that is. At least for this year. With temperatures dropping below freezing for several nights in a row, Winter is definitely ready to make its entrance. Wind and rain have hastened the dropping of the last remaining leaves from the trees around our neighborhood. Goodbye Autumn. You were so lovely.
A few interesting notes on this image (yes, this is a photography post, not a Japan or ministry post).
It is an intentional double exposure. This is literally one of the last photos of Autumn I took this year. After taking thousands of photos Autumn leaves, I have to admit, it gets tiresome. That's not Autumn's fault. That's the fault of a photographer who gets lazy with the creative process and shoots the same image of the same subject over and over. By this time, I realized I needed to try something different, so I began to experiment. Experiment with focus, with camera movement, with new angles. And finally, multiple exposures. Yes, it is nice to let the beauty of nature speak for itself sometimes, but you can also lend some God-given creativity to the process. You might be surprised.
It sat around untouched for nearly two weeks before I noticed it. I had so many beautiful shots from that day, I never even gave this shot a second look. When I had reviewed it quickly in my camera, it had not seemed like anything special to me. It was only when I opened it up and really checked the details that I realized this shot was special. In the creative process, don't be too hasty with your work. Look closely at the details, post-process the image to its strengths, and see what materializes. And even if you reject an image once, give it a second a chance a week or two later. Perhaps your perspective will have changed.
Of all my Autumn images, this one captures my feelings of the season best. That's a difficult thing to say because I have taken so many lovely images of Autumn here in Japan. Everywhere you turn, you see the beauty of Autumn, from mountains bursting with fall color to gardens punctuated with strategically planted momiji to the bicycle path on the street outside our front door where autumn leaves fall into a clear stream full of koi. In this image, my intent was to layer the familiar colors and shapes of Fall in an almost abstract way. Like looking through the Autumn leaves at the Autumn leaves. Unlike many of my other images, I also subdued the brashness of the color, deadened it, as a reminder that Autumn, like every season, also must come to an end. Compared to some of my other fall images, it might even seem a bit drab color-wise. But that too is part of Autumn.
With Autumn gone, I can now turn my attention to capturing the feel of Winter here in Japan. What will I find that defines Winter in our city and in the great metropolis of Tokyo? Let's find out together!
Tokyo Redux – Better Than Paris?
I have heard it said that getting macarons in Tokyo is better than getting them in Paris because you get the same quality without the French snobbery. Whatever the case, macarons are certainly not scarce in the counters of upscale depachika (the basement level of Japanese department stores, known for counters full of prepared foods of all kinds) all over the city.
In Japan, kittens are selectively bred for cuteness. Seriously.


With more than 40 years of personalized metaphysical research, Jasmuheen presents her FOUR BODY FITNESS Program in this her 17th book. BLISS is described in the Oxford Dictionary as being: perfect joy or happiness; blessedness; being in heaven. If the Recipes & Programs covered in this book are applied we can all experience complete fulfillment and harmony on earth. This is neither New Age nor religious dreaming; BIOFIELD BLISS is the outcome of holistic education based on RECIPE 2000> which incorporates the Four Body Fitness principles. FOUR BODY FITNESS: Biofields & Bliss is a simple, pragmatic manual that is designed to bring us all into a state of both personal and global paradise. To be achieved by using Biofield Science, this system deals with environmental field control and can be applied with fast results. Accepting metaphysical principles and quantum mechanics, Biofield Science is a bridge for all pathways on earth as it is the basic mathematics of achieving health and lasting happiness.


Comprehensive list of Riverside, California based professional wedding, family, commercial, event or general photographers, studios and freelancers in Riverside, CA.
Every especial moment is our special moment. Check our gallery to learn how special your event can be. Le us capture your special event we're specialists who care. Brides on a budget we can work with you. The most important thing on your wedding day is the memories you will remember for years to come.
Located in Riverside, California, Cean One is a leading wedding and portrait photographer providing the very highest in fine art portraiture. Each photography session or event is carefully planned to capture a customer's unique moments in time, whether it be photography for a wedding, engagement, graduation or family sitting in Southern California or beyond.
Rachel Rhien Tucker is a modern lifestyle Wedding Photographer who specializes in Maternity, Baby, and Child Photography. Serving Orange County and the Inland Empire in Southern California as well as NW New Mexico and SW Colorado. She is available for travel as well as commercial work. Rachel is a proud member of Professional Photographers of America PPA.