text:
using System.Collections.Generic;
using System.Linq;
using System.Web.Http;
using AttributeRouting;
using AttributeRouting.Web.Http;
using DigitalLabels.Core.DomainModels;
using DigitalLabels.Core.Indexes;
using DigitalLabels.WebApi.Infrastructure;
using Raven.Client;
using Raven.Client.Linq;
using DigitalLabels.Core.Extensions;

namespace DigitalLabels.WebApi.Controllers.Apis
{
    [RoutePrefix("api/yulendj")]
    public class YulendjController : ApiController
    {
        private readonly IDocumentSession _documentSession;

        public YulendjController(
            IDocumentSession documentSession)
        {
            _documentSession = documentSession;
        }

        [GET("")]
        [ApiDoc("Returns the entire set of Yulendj Labels.")]
        public IEnumerable<YulendjLabel> GetAll()
        {
            // TODO: add paging and remove allresults when working on digital labels again.

            return _documentSession
                .Query<YulendjLabel, YulendjLabel_All>()
                .GetAllResultsWithPaging()
                .OrderBy(x => x.Order)
                .ToList();
        }

        [GET("{irn:long}")]
        [ApiDoc("Return a single Yulendj Label by primary image Irn.")]
        [ApiParameterDoc("irn", "The Irn of the label. [integer]")]
        public YulendjLabel GetByIrn(long irn)
        {
            return _documentSession
                .Load<YulendjLabel>(irn);
        }
    }
}


text:
<!DOCTYPE html>
<meta http-equiv="X-UA-Compatible" content="IE=Edge">

	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title>Francine Application</title>
	<link rel="stylesheet" href="/quickforms/css/quickforms/quickforms.css" />

	<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">

Francine App

		Subscribe
		Unsubscribe

		About

First Trimester

					1  |
					2  |
					3  |
					4  |
					5  |
					6

					7  |
					8  |
					9  |
					10  |
					11  |
					12

					Warning signs

Second Trimester

					13  |
					14  |
					15  |
					16  |
					17

					18  |
					19  |
					20  |
					21  |
					22

					23  |
					24  |
					25  |
					26

					Warning signs

Third Trimester

					27  |
					28  |
					29  |
					30  |
					31

					32  |
					33  |
					34  |
					35  |
					36

					37  |
					38  |
					39  |
					40

					Warning signs

					Signs of labour

Newborn

					1  |
					2  |
					3  |
					4

					Advantages of breast feeding

			  Previous

			  Next

					Powered By
					           uoDefacto

© 2014 Francine app

redpajama_set_name: RedPajamaGithub


text: Devices


text:
package com.google.samples.apps.iosched.util;

import com.google.android.gms.maps.model.BitmapDescriptor;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;
import com.google.maps.android.ui.IconGenerator;
import no.java.schedule.R;
import com.google.samples.apps.iosched.map.util.MarkerModel;

import com.jakewharton.disklrucache.DiskLruCache;

import android.content.Context;
import android.support.annotation.DrawableRes;
import android.text.TextUtils;

import java.io.File;
import java.io.FileOutputStream;
import java.io.FilenameFilter;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Locale;

import static com.google.samples.apps.iosched.util.LogUtils.LOGD;
import static com.google.samples.apps.iosched.util.LogUtils.LOGE;

public class MapUtils {

    private static final String TILE_PATH = "maptiles";
    private static final String TAG = LogUtils.makeLogTag(MapUtils.class);

    /**
     * Returns the room type for a {@link com.google.samples.apps.iosched.map.util.MarkerModel}
     * for a given String.
     */
    public static int detectMarkerType(String markerType) {
        if (TextUtils.isEmpty(markerType)) {
            return MarkerModel.TYPE_INACTIVE;
        }
        String tags = markerType.toUpperCase(Locale.US);
        if (tags.contains("SESSION")) {
            return MarkerModel.TYPE_SESSION;
        } else if (tags.contains("PLAIN")) {
            return MarkerModel.TYPE_PLAIN;
        } else if (tags.contains("LABEL")) {
            return MarkerModel.TYPE_LABEL;
        } else if (tags.contains("CODELAB")) {
            return MarkerModel.TYPE_CODELAB;
        } else if (tags.contains("SANDBOX")) {
            return MarkerModel.TYPE_SANDBOX;
        } else if (tags.contains("OFFICEHOURS")) {
            return MarkerModel.TYPE_OFFICEHOURS;
        } else if (tags.contains("MISC")) {
            return MarkerModel.TYPE_MISC;
        } else if (tags.contains("MOSCONE")) {
            return MarkerModel.TYPE_MOSCONE;
        } else if (tags.contains("INACTIVE")) {
            return MarkerModel.TYPE_INACTIVE;
        }
        return MarkerModel.TYPE_INACTIVE; // default
    }

    /**
     * Returns the drawable Id of icon to use for a room type.
     */
    public static
    @DrawableRes
    int getRoomIcon(int markerType) {
        switch (markerType) {
            case MarkerModel.TYPE_SESSION:
                return R.drawable.ic_map_session;
            case MarkerModel.TYPE_PLAIN:
                return R.drawable.ic_map_pin;
            case MarkerModel.TYPE_CODELAB:
                return R.drawable.ic_map_codelab;
            case MarkerModel.TYPE_SANDBOX:
                return R.drawable.ic_map_sandbox;
            case MarkerModel.TYPE_OFFICEHOURS:
                return R.drawable.ic_map_officehours;
            case MarkerModel.TYPE_MISC:
                return R.drawable.ic_map_misc;
            case MarkerModel.TYPE_MOSCONE:
                return R.drawable.ic_map_moscone;
            default:
                return R.drawable.ic_map_pin;
        }
    }

    /**
     * True if the info details for this room type should only contain a title.
     */
    public static boolean hasInfoTitleOnly(int markerType) {
        return markerType == MarkerModel.TYPE_PLAIN;
    }

    /**
     * True if the info details for this room type contain a title and a list of sessions.
     */
    public static boolean hasInfoSessionList(int markerType) {
        return markerType != MarkerModel.TYPE_INACTIVE && markerType != MarkerModel.TYPE_LABEL
                && markerType != MarkerModel.TYPE_CODELAB;
    }

    /**
     * True if the info details for this room type contain a title and a list of sessions.
     */
    public static boolean hasInfoFirstDescriptionOnly(int markerType) {
        return markerType == MarkerModel.TYPE_CODELAB;
    }

    public static boolean hasInfoSessionListIcons(int markerType) {
        return markerType == MarkerModel.TYPE_SANDBOX;
    }

    /**
     * Creates a marker for a session.
     *
     * @param id Id to be embedded as the title
     */
    public static MarkerOptions createPinMarker(String id, LatLng position) {
        final BitmapDescriptor icon =
                BitmapDescriptorFactory.fromResource(R.drawable.map_marker_unselected);
        return new MarkerOptions().position(position).title(id).icon(icon).anchor(0.5f, 0.85526f)
                .visible(
                        false);
    }

    /**
     * Creates a new IconGenerator for labels on the map.
     */
    public static IconGenerator getLabelIconGenerator(Context c) {
        IconGenerator iconFactory = new IconGenerator(c);
        iconFactory.setTextAppearance(R.style.MapLabel);
        iconFactory.setBackground(null);

        return iconFactory;
    }

    /**
     * Creates a marker for a label.
     *
     * @param iconFactory Reusable IconFactory
     * @param id          Id to be embedded as the title
     * @param label       Text to be shown on the label
     */
    public static MarkerOptions createLabelMarker(IconGenerator iconFactory, String id,
            LatLng position, String label) {
        final BitmapDescriptor icon =
                BitmapDescriptorFactory.fromBitmap(iconFactory.makeIcon(label));

        return new MarkerOptions().position(position).title(id).icon(icon)
                .anchor(0.5f, 0.5f)
                .visible(false);
    }

    /**
     * Creates a marker for Moscone Center.
     */
    public static MarkerOptions createMosconeMarker(LatLng position) {
        final String title = "MOSCONE";

        final BitmapDescriptor icon =
                BitmapDescriptorFactory.fromResource(R.drawable.map_marker_moscone);

        return new MarkerOptions().position(position).title(title).icon(icon)
                .visible(false);
    }

    private static String[] mapTileAssets;

    /**
     * Returns true if the given tile file exists as a local asset.
     */
    public static boolean hasTileAsset(Context context, String filename) {

        //cache the list of available files
        if (mapTileAssets == null) {
            try {
                mapTileAssets = context.getAssets().list("maptiles");
            } catch (IOException e) {
                // no assets
                mapTileAssets = new String[0];
            }
        }

        // search for given filename
        for (String s : mapTileAssets) {
            if (s.equals(filename)) {
                return true;
            }
        }
        return false;
    }

    /**
     * Copy the file from the assets to the map tiles directory if it was
     * shipped with the APK.
     */
    public static boolean copyTileAsset(Context context, String filename) {
        if (!hasTileAsset(context, filename)) {
            // file does not exist as asset
            return false;
        }

        // copy file from asset to internal storage
        try {
            InputStream is = context.getAssets().open(TILE_PATH + File.separator + filename);
            File f = getTileFile(context, filename);
            FileOutputStream os = new FileOutputStream(f);

            byte[] buffer = new byte[1024];
            int dataSize;
            while ((dataSize = is.read(buffer)) > 0) {
                os.write(buffer, 0, dataSize);
            }
            os.close();
        } catch (IOException e) {
            return false;
        }

        return true;
    }

    /**
     * Return a {@link File} pointing to the storage location for map tiles.
     */
    public static File getTileFile(Context context, String filename) {
        File folder = new File(context.getFilesDir(), TILE_PATH);
        if (!folder.exists()) {
            folder.mkdirs();
        }
        return new File(folder, filename);
    }

    public static void removeUnusedTiles(Context mContext, final ArrayList<String> usedTiles) {
        // remove all files are stored in the tile path but are not used
        File folder = new File(mContext.getFilesDir(), TILE_PATH);
        File[] unused = folder.listFiles(new FilenameFilter() {

            @Override
            public boolean accept(File dir, String filename) {
                return !usedTiles.contains(filename);
            }
        });

        if (unused != null) {
            for (File f : unused) {
                f.delete();
            }
        }
    }

    public static boolean hasTile(Context mContext, String filename) {
        return getTileFile(mContext, filename).exists();
    }

    private static final int MAX_DISK_CACHE_BYTES = 1024 * 1024 * 2; // 2MB

    public static DiskLruCache openDiskCache(Context c) {
        File cacheDir = new File(c.getCacheDir(), "tiles");
        try {
            return DiskLruCache.open(cacheDir, 1, 3, MAX_DISK_CACHE_BYTES);
        } catch (IOException e) {
            LOGE(TAG, "Couldn't open disk cache.");

        }
        return null;
    }

    public static void clearDiskCache(Context c) {
        DiskLruCache cache = openDiskCache(c);
        if (cache != null) {
            try {
                LOGD(TAG, "Clearing map tile disk cache");
                cache.delete();
                cache.close();
            } catch (IOException e) {
                // ignore
            }
        }
    }
}


text:
////////////////////////////////////////////////////////////////////////////////////
///
///  \file setvelocitycommand.cpp
///  \brief This file contains the implementation of a JAUS message.
///
///
Author(s): Bo Sun
///
Created: 2 December 2009
///
Copyright (c) 2009
///
Applied Cognition and Training in Immersive Virtual Environments
///
(ACTIVE) Laboratory
///
Institute for Simulation and Training (IST)
///
University of Central Florida (UCF)
///
All rights reserved.
///
Email: bsun@ist.ucf.edu
///
Web:  http://active.ist.ucf.edu
///
///  Redistribution and use in source and binary forms, with or without
///  modification, are permitted provided that the following conditions are met:
///      * Redistributions of source code must retain the above copyright
///        notice, this list of conditions and the following disclaimer.
///      * Redistributions in binary form must reproduce the above copyright
///        notice, this list of conditions and the following disclaimer in the
///        documentation and/or other materials provided with the distribution.
///      * Neither the name of the ACTIVE LAB, IST, UCF, nor the
///        names of its contributors may be used to endorse or promote products
///        derived from this software without specific prior written permission.
///
///  THIS SOFTWARE IS PROVIDED BY THE ACTIVE LAB''AS IS'' AND ANY
///  EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
///  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
///  DISCLAIMED. IN NO EVENT SHALL UCF BE LIABLE FOR ANY
///  DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
///  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
///  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
///  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
///  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
///  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
///
////////////////////////////////////////////////////////////////////////////////////
#include "jaus/mobility/drivers/reportvelocitycommand.h"
#include "jaus/core/scaledinteger.h"
#include <cxutils/math/cxmath.h>

const double JAUS::ReportVelocityCommand::Limits::MinVelocity = -327.68;
const double JAUS::ReportVelocityCommand::Limits::MaxVelocity = 327.67;
const double JAUS::ReportVelocityCommand::Limits::MinRotationalRate = -32.768;
const double JAUS::ReportVelocityCommand::Limits::MaxRotationalRate = 32.767;

using namespace JAUS;

////////////////////////////////////////////////////////////////////////////////////
///
///   \brief Constructor, initializes default values.
///
///   \param[in] src Source ID of message sender.
///   \param[in] dest Destination ID of message.
///
////////////////////////////////////////////////////////////////////////////////////
ReportVelocityCommand::ReportVelocityCommand(const Address& dest, const Address& src) : Message(REPORT_VELOCITY_COMMAND, dest, src)
{
    mPresenceVector = 0;
    mCommandType = SetCurrentCommand;
    mVelocityX = 0;
    mVelocityY = 0;
    mVelocityZ = 0;
    mRollRate = 0;
    mPitchRate = 0;
    mYawRate = 0;
}

////////////////////////////////////////////////////////////////////////////////////
///
///   \brief Copy constructor.
///
////////////////////////////////////////////////////////////////////////////////////
ReportVelocityCommand::ReportVelocityCommand(const ReportVelocityCommand& message) : Message(REPORT_VELOCITY_COMMAND)
{
    *this = message;
}

////////////////////////////////////////////////////////////////////////////////////
///
///   \brief Destructor.
///
////////////////////////////////////////////////////////////////////////////////////
ReportVelocityCommand::~ReportVelocityCommand()
{
}

////////////////////////////////////////////////////////////////////////////////////
///
///   \brief Sets the velocity x and update the presence vector for the message
///
///   \param[in] value Desired velocity x in meters per second [-327.68, 327.67].
///
///   \return true on success, otherwise false.
///
////////////////////////////////////////////////////////////////////////////////////
bool ReportVelocityCommand::SetVelocityX(const double value)
{
    if(value >= Limits::MinVelocity && value <= Limits::MaxVelocity)
    {
        mVelocityX = value;
        mPresenceVector |= PresenceVector::VelocityX;
        return true;
    }
    return false;
}

////////////////////////////////////////////////////////////////////////////////////
///
///   \brief Sets the velocity y and update the presence vector for the message
///
///   \param[in] value Desired velocity y in meters per second [-327.68, 327.67].
///
///   \return true on success, otherwise false.
///
////////////////////////////////////////////////////////////////////////////////////
bool ReportVelocityCommand::SetVelocityY(const double value)
{
    if(value >= Limits::MinVelocity && value <= Limits::MaxVelocity)
    {
        mVelocityY = value;
        mPresenceVector |= PresenceVector::VelocityY;
        return true;
    }
    return false;
}

////////////////////////////////////////////////////////////////////////////////////
///
///   \brief Sets the velocity z and update the presence vector for the message
///
///   \param[in] value Desired velocity z in meters per second [-327.68, 327.67].
///
///   \return true on success, otherwise false.
///
////////////////////////////////////////////////////////////////////////////////////
bool ReportVelocityCommand::SetVelocityZ(const double value)
{
    if(value >= Limits::MinVelocity && value <= Limits::MaxVelocity)
    {
        mVelocityZ = value;
        mPresenceVector |= PresenceVector::VelocityZ;
        return true;
    }
    return false;
}

////////////////////////////////////////////////////////////////////////////////////
///
///   \brief Sets the roll rate and update the presence vector for the message
///
///   \param[in] value Desired roll rate in Radians per second [-32.768, 32.767].
///
///   \return true on success, otherwise false.
///
////////////////////////////////////////////////////////////////////////////////////
bool ReportVelocityCommand::SetRollRate(const double value)
{
    if(value >= Limits::MinRotationalRate && value <= Limits::MaxRotationalRate)
    {
        mRollRate = value;
        mPresenceVector |= PresenceVector::RollRate;
        return true;
    }
    return false;
}

////////////////////////////////////////////////////////////////////////////////////
///
///   \brief Sets the pitch rate and update the presence vector for the message
///
///   \param[in] value Desired pitch rate in Radians per second [-32.768, 32.767].
///
///   \return true on success, otherwise false.
///
////////////////////////////////////////////////////////////////////////////////////
bool ReportVelocityCommand::SetPitchRate(const double value)
{
    if(value >= Limits::MinRotationalRate && value <= Limits::MaxRotationalRate)
    {
        mPitchRate = value;
        mPresenceVector |= PresenceVector::PitchRate;
        return true;
    }
    return false;
}

////////////////////////////////////////////////////////////////////////////////////
///
///   \brief Sets the yaw rate and update the presence vector for the message
///
///   \param[in] value Desired yaw rate in Radians per second [-32.768, 32.767].
///
///   \return true on success, otherwise false.
///
////////////////////////////////////////////////////////////////////////////////////
bool ReportVelocityCommand::SetYawRate(const double value)
{
    if(value >= Limits::MinRotationalRate && value <= Limits::MaxRotationalRate)
    {
        mYawRate = value;
        mPresenceVector |= PresenceVector::YawRate;
        return true;
    }
    return false;
}

////////////////////////////////////////////////////////////////////////////////////
///
///   \brief Writes message payload to the packet.
///
///   Message contents are written to the packet following the JAUS standard.
///
///   \param[out] packet Packet to write payload to.
///
///   \return -1 on error, otherwise number of bytes written.
///
////////////////////////////////////////////////////////////////////////////////////
int ReportVelocityCommand::WriteMessageBody(Packet& packet) const
{
    int expected = BYTE_SIZE;
    int written = 0;

    written += packet.Write(mPresenceVector);

    expected += BYTE_SIZE;
    written += packet.Write((Byte)mCommandType);

    if((mPresenceVector & PresenceVector::VelocityX) > 0)
    {
        expected += UINT_SIZE;
        written += ScaledInteger::Write(packet, mVelocityX, Limits::MaxVelocity, Limits::MinVelocity, ScaledInteger::UInt);
    }
    if((mPresenceVector & PresenceVector::VelocityY) > 0)
    {
        expected += UINT_SIZE;
        written += ScaledInteger::Write(packet, mVelocityY, Limits::MaxVelocity, Limits::MinVelocity, ScaledInteger::UInt);
    }
    if((mPresenceVector & PresenceVector::VelocityZ) > 0)
    {
        expected += UINT_SIZE;
        written += ScaledInteger::Write(packet, mVelocityZ, Limits::MaxVelocity, Limits::MinVelocity, ScaledInteger::UInt);
    }
    if((mPresenceVector & PresenceVector::RollRate) > 0)
    {
        expected += USHORT_SIZE;
        written += ScaledInteger::Write(packet, mRollRate, Limits::MaxRotationalRate, Limits::MinRotationalRate, ScaledInteger::UShort);
    }
    if((mPresenceVector & PresenceVector::PitchRate) > 0)
    {
        expected += USHORT_SIZE;
        written += ScaledInteger::Write(packet, mPitchRate, Limits::MaxRotationalRate, Limits::MinRotationalRate, ScaledInteger::UShort);
    }
    if((mPresenceVector & PresenceVector::YawRate) > 0)
    {
        expected += USHORT_SIZE;
        written += ScaledInteger::Write(packet, mYawRate, Limits::MaxRotationalRate, Limits::MinRotationalRate, ScaledInteger::UShort);
    }

    return expected == written ? written : -1;
}

////////////////////////////////////////////////////////////////////////////////////
///
///   \brief Reads message payload from the packet.
///
///   Message contents are read from the packet following the JAUS standard.
///
///   \param[in] packet Packet containing message payload data to read.
///
///   \return -1 on error, otherwise number of bytes written.
///
////////////////////////////////////////////////////////////////////////////////////
int ReportVelocityCommand::ReadMessageBody(const Packet& packet)
{
    int expected = BYTE_SIZE;
    int read = 0;

    read += packet.Read(mPresenceVector);

    expected += BYTE_SIZE;
    read += packet.Read((Byte &)mCommandType);

    if((mPresenceVector & PresenceVector::VelocityX) > 0)
    {
        expected += UINT_SIZE;
        read += ScaledInteger::Read(packet, mVelocityX, Limits::MaxVelocity, Limits::MinVelocity, ScaledInteger::UInt);
    }
    if((mPresenceVector & PresenceVector::VelocityY) > 0)
    {
        expected += UINT_SIZE;
        read += ScaledInteger::Read(packet, mVelocityY, Limits::MaxVelocity, Limits::MinVelocity, ScaledInteger::UInt);
    }
    if((mPresenceVector & PresenceVector::VelocityZ) > 0)
    {
        expected += UINT_SIZE;
        read += ScaledInteger::Read(packet, mVelocityZ, Limits::MaxVelocity, Limits::MinVelocity, ScaledInteger::UInt);
    }
    if((mPresenceVector & PresenceVector::RollRate) > 0)
    {
        expected += USHORT_SIZE;
        read += ScaledInteger::Read(packet, mRollRate, Limits::MaxRotationalRate, Limits::MinRotationalRate, ScaledInteger::UShort);
    }
    if((mPresenceVector & PresenceVector::PitchRate) > 0)
    {
        expected += USHORT_SIZE;
        read += ScaledInteger::Read(packet, mPitchRate, Limits::MaxRotationalRate, Limits::MinRotationalRate, ScaledInteger::UShort);
    }
    if((mPresenceVector & PresenceVector::YawRate) > 0)
    {
        expected += USHORT_SIZE;
        read += ScaledInteger::Read(packet, mYawRate, Limits::MaxRotationalRate, Limits::MinRotationalRate, ScaledInteger::UShort);
    }

    return expected == read ? read : -1;
}

////////////////////////////////////////////////////////////////////////////////////
///
///   \brief Clears message payload data.
///
////////////////////////////////////////////////////////////////////////////////////
void ReportVelocityCommand::ClearMessageBody()
{
    mPresenceVector = 0;
    mCommandType = SetCurrentCommand;
    mVelocityX = 0;
    mVelocityY = 0;
    mVelocityZ = 0;
    mRollRate = 0;
    mPitchRate = 0;
    mYawRate = 0;
}

////////////////////////////////////////////////////////////////////////////////////
///
///   \brief Runs a test case to validate the message class.
///
///   \return 1 on success, otherwise 0.
///
////////////////////////////////////////////////////////////////////////////////////
int ReportVelocityCommand::RunTestCase() const
{
    int result = 0;

    Packet packet;

    ReportVelocityCommand msg1, msg2;

    msg1.SetCommandType(SetMinimumAllowedValues);
    msg1.SetVelocityZ(50);
    msg1.SetPitchRate(-15.25);

    if((msg1.WriteMessageBody(packet) != -1) &&
        (msg2.ReadMessageBody(packet) != -1))
    {
        if(msg2.AreFieldsPresent(PresenceVector::VelocityZ | PresenceVector::PitchRate) &&
            msg1.GetCommandType() == msg2.GetCommandType())
         {
                result = 1;
         }
    }

    return result;
}

////////////////////////////////////////////////////////////////////////////////////
///
///   \brief Sets equal to.
///
////////////////////////////////////////////////////////////////////////////////////
ReportVelocityCommand& ReportVelocityCommand::operator=(const ReportVelocityCommand& message)
{
    if(this != &message)
    {
        CopyHeaderData(&message);
        mPresenceVector = message.mPresenceVector;
        mCommandType = message.mCommandType;
        mVelocityX = message.mVelocityX;
        mVelocityY = message.mVelocityY;
        mVelocityZ = message.mVelocityZ;
        mRollRate = message.mRollRate;
        mPitchRate = message.mPitchRate;
        mYawRate = message.mYawRate;

    }
    return *this;
}

/*  End of File */


text:
using PIT.Business;
using PIT.Business.Entities;

namespace PIT.WPF.ViewModels.Issues
{
    public class IssueViewModel : ViewModel<Issue>
    {
        public IssueViewModel(Issue issue)
        {
            Issue = issue;
        }

        public Issue Issue { get; set; }

        public int Id
        {
            get { return Issue.Id; }
        }

        public string IssueNumber
        {
            get { return string.Format("#{0}", Issue.Id); }
        }

        public string Short
        {
            get { return Issue.Short; }
            set
            {
                Issue.Short = value;
                NotifyOfPropertyChange(() => Short);
            }
        }

        public string Description
        {
            get { return Issue.Description; }
            set
            {
                Issue.Description = value;
                NotifyOfPropertyChange(() => Description);
            }
        }

        public IssueStatus Status
        {
            get { return Issue.Status; }
            set
            {
                Issue.Status = value;
                NotifyOfPropertyChange(() => Status);
            }
        }
    }
}


text:
package org.h2.dev.util;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.sql.SQLException;
import java.util.ArrayList;

import org.h2.message.DbException;
import org.h2.util.Tool;

/**
 * A text file viewer that support very large files.
 */
public class FileViewer extends Tool {

    /**
     * Run the viewer.
     *
     * @param args the command line arguments
     */
    public static void main(String... args) throws SQLException {
        new FileViewer().runTool(args);
    }

    @Override
    protected void showUsage() {
        out.println("A text file viewer that support very large files.");
        out.println("java "+getClass().getName() + "\n" +
                " -file <file>     The name of the file to view\n" +
                " [-find <text>]   Find a string and display the next lines\n" +
                " [-start <x>]     Start at the given position\n" +
                " [-head]          Display the first lines\n" +
                " [-tail]          Display the last lines\n" +
                " [-lines <x>]     Display only x lines (default: 30)\n" +
                " [-quiet]         Do not print progress information");
    }

    @Override
    public void runTool(String... args) throws SQLException {
        String file = null;
        String find = null;
        boolean head = false, tail = false;
        int lines = 30;
        boolean quiet = false;
        long start = 0;
        for (int i = 0; args != null && i < args.length; i++) {
            String arg = args[i];
            if (arg.equals("-file")) {
                file = args[++i];
            } else if (arg.equals("-find")) {
                find = args[++i];
            } else if (arg.equals("-start")) {
                start = Long.decode(args[++i]).longValue();
            } else if (arg.equals("-head")) {
                head = true;
            } else if (arg.equals("-tail")) {
                tail = true;
            } else if (arg.equals("-lines")) {
                lines = Integer.decode(args[++i]).intValue();
            } else if (arg.equals("-quiet")) {
                quiet = true;
            } else if (arg.equals("-help") || arg.equals("-?")) {
                showUsage();
                return;
            } else {
                showUsageAndThrowUnsupportedOption(arg);
            }
        }
        if (file == null) {
            showUsage();
            return;
        }
        if (!head && !tail && find == null) {
            head = true;
        }
        try {
            process(file, find, head, tail, start, lines, quiet);
        } catch (IOException e) {
            throw DbException.toSQLException(e);
        }
    }

    private static void process(String fileName, String find,
            boolean head, boolean tail, long start, int lines,
            boolean quiet) throws IOException {
        RandomAccessFile file = new RandomAccessFile(fileName, "r");
        long length = file.length();
        if (head) {
            file.seek(start);
            list(start, "Head", readLines(file, lines));
        }
        if (find != null) {
            file.seek(start);
            long pos = find(file, find.getBytes(), quiet);
            if (pos >= 0) {
                file.seek(pos);
                list(pos, "Found " + find, readLines(file, lines));
            }
        }
        if (tail) {
            long pos = length - 100L * lines;
            ArrayList<String> list = null;
            while (pos > 0) {
                file.seek(pos);
                list = readLines(file, Integer.MAX_VALUE);
                if (list.size() > lines) {
                    break;
                }
                pos -= 100L * lines;
            }
            // remove the first (maybe partial) line
            list.remove(0);
            while (list.size() > lines) {
                list.remove(0);
            }
            list(pos, "Tail", list);
        }
    }

    private static long find(RandomAccessFile file, byte[] find, boolean quiet)
            throws IOException {
        long pos = file.getFilePointer();
        long length = file.length();
        int bufferSize = 4 * 1024;
        byte[] data = new byte[bufferSize * 2];
        long last = System.currentTimeMillis();
        while (pos < length) {
            System.arraycopy(data, bufferSize, data, 0, bufferSize);
            if (pos + bufferSize > length) {
                file.readFully(data, bufferSize, (int) (length - pos));
                return find(data, find, (int) (bufferSize + length - pos - find.length));
            }
            if (!quiet) {
                long now = System.currentTimeMillis();
                if (now > last + 5000) {
                    System.out.println((100 * pos / length) + "%");
                    last = now;
                }
            }
            file.readFully(data, bufferSize, bufferSize);
            int f = find(data, find, bufferSize);
            if (f >= 0) {
                return f + pos - bufferSize;
            }
            pos += bufferSize;
        }
        return -1;
    }

    private static int find(byte[] data, byte[] find, int max) {
        outer:
        for (int i = 0; i < max; i++) {
            for (int j = 0; j < find.length; j++) {
                if (data[i + j] != find[j]) {
                    continue outer;
                }
            }
            return i;
        }
        return -1;
    }

    private static void list(long pos, String header, ArrayList<String> list) {
        System.out.println("-----------------------------------------------");
        System.out.println("[" + pos + "]: " + header);
        System.out.println("-----------------------------------------------");
        for (String l : list) {
            System.out.println(l);
        }
        System.out.println("-----------------------------------------------");
    }

    private static ArrayList<String> readLines(RandomAccessFile file,
            int maxLines) throws IOException {
        ArrayList<String> lines = new ArrayList<String>();
        ByteArrayOutputStream buff = new ByteArrayOutputStream(100);
        boolean lastNewline = false;
        while (maxLines > 0) {
            int x = file.read();
            if (x < 0) {
                break;
            }
            if (x == '\r' || x == '\n') {
                if (!lastNewline) {
                    maxLines--;
                    lastNewline = true;
                    byte[] data = buff.toByteArray();
                    String s = new String(data);
                    lines.add(s);
                    buff.reset();
                }
                continue;
            }
            if (lastNewline) {
                lastNewline = false;
            }
            buff.write(x);
        }
        byte[] data = buff.toByteArray();
        if (data.length > 0) {
            String s = new String(data);
            lines.add(s);
        }
        return lines;
    }

}


text:
ACCEPTED

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Nova Hedwigia 28(2-3): 493 (1977)

#### Original name
Zopheromyces B. Sutton & Hodges

### Remarks
null


text:
module.exports.handleV1 = function(response, resolve, reject) {
  if ( response.status === 200 || response.status === 201 ) {
    resolve(response.data);
  } else {
    reject(response.data);
  }
};

module.exports.errorV1 = function(err, reject) {
  if ( err.data ) {
    reject(err.data);
  } else {
    reject(err);
  }
};

module.exports.handleV2 = function(response, resolve, reject) {
  if ( response.status === 200 || response.status === 201 ) {
    resolve(response.data);
  } else {
    reject(response.data);
  }
};

module.exports.errorV2 = function(err, reject) {
  if ( err.data ) {
    reject(err.data);
  } else {
    reject(err);
  }
};


text:
class TodosController < ApplicationController

  before_filter :load_todo, only: %w(show update destroy)
  respond_to :json

  def index
    @todos = Todo.all

    respond_with @todos
  end

  def show
    respond_with @todo
  end

  def update
    @todo.update_attributes params[:todo]

    respond_with @todo
  end

  def create
    @todo = Todo.create params[:todo]

    respond_with @todo
  end

  def destroy
    @todo.destroy

    respond_with @todo
  end

  private

  def load_todo
    @todo = Todo.find params[:id]
  end
end


text:
- Know of `try..rescue`'s additional options:
  - `after`
  - `else`
- Know about dynamic dispatch
  - Using an module atom to invoke a function.

## Out of scope

- `throw` and `catch`

## Concepts

- `try-rescue-else-after`
- `dynamic-dispatch`

## Prerequisites

- `file`
- `try-rescue`

## Analyzer

- ensure functions appear in each section:
  - open before `try`
  - write in `try`
  - handle the happy path in `else`
  - clean up in `after`


text:
CREATE DATABASE IF NOT EXISTS fate_flow;
CREATE USER fate@'localhost' IDENTIFIED BY 'fate';
GRANT ALL ON fate_flow.* TO fate@'localhost';
GRANT ALL ON eggroll_meta.* TO fate@'localhost;
use eggroll_meta;
INSERT INTO server_node (host, port, node_type, status) values ('127.0.0.1', '4670', 'CLUSTER_MANAGER', 'HEALTHY');
INSERT INTO server_node (host, port, node_type, status) values ('127.0.0.1', '4671', 'NODE_MANAGER', 'HEALTHY');


text:
/*
 * main.cpp
 * Name: FILL ME IN
 *
 * This file has NO PURPOSE, other than allowing you to 'play'
 * with your List(s) and verify operation.  What you do here
 * will probably be what you should put in your unit tests!
 *
 * Nov 12 ,2013
 */

#include <iostream>

#include "List.h"

using namespace std;

int main(int argc, char* argv[]){
	cout << "Nothing provided.\n";
	return 0;
}


text:
<title>
The return of an anti-imperialist classic
</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<?php include "../../legacy-includes/Script.htmlf" ?>

<?php include "../../legacy-includes/TopLogo.htmlf" ?>

<?php include "../../legacy-includes/TopAd.htmlf" ?>

<?php include "../../legacy-includes/LeftButtons.htmlf" ?>

<?php include "../../legacy-includes/BodyInsert.htmlf" ?>

The return of an anti-imperialist classic

Review by Laura Durkay | February 20, 2004 | Page 9

The Battle of Algiers, directed by written by Gillo Pontecorvo, co-written by Franco Solinas. Visit www.rialtopictures.com for local screenings.

A WOMAN plants a bomb in a crowded cafe. Occupying troops dynamite a home in a crowded Arab neighborhood. But this is not Iraq or Palestine in 2003--it's a scene from the 1965 film The Battle of Algiers, recently re-released in selected cities.

The Battle of Algiers depicts the Algerian struggle to throw off 130 years of French colonial rule. Filmed in a documentary style using mostly non-professional actors, it takes an unflinching look at urban guerilla warfare and the even more brutal tactics that French occupiers used to maintain their rule.

The film is based on the prison notebooks of Saadi Yacef, who was a leader of the Algerian National Liberation Front (FLN), an underground resistance group that fought a fierce guerrilla war against the French from 1954-57. Yacef and Italian director Gillo Pontecorvo spent two years in the Casbah, the huge Arab ghetto of Algiers, looking for ordinary Algerians who could convey the burning hatred of colonialism that saturates the film.

In a riveting sequences, three Arab women disguise themselves as French to plant bombs in the French quarter. The wide streets and posh buildings of Algiers' European quarter are contrasted to the crowded, dilapidated Arab slums of the Casbah. The incredible power of the film is that while it doesn't whitewash the violence of national liberation struggles, it stands firmly and confidently on the side of the oppressed.

In August, the Pentagon showed The Battle of Algiers to officers planning the occupation of Iraq, advertising it as "how to win a battle against terrorism and lose the war of ideas." But the Pentagon hacks missed the point of the film--that there is no other way to maintain colonialism except with terror, and imperialism inevitably produces anti-imperialism.

Through midnight raids, demolitions and torture, the French paratroopers in the film virtually destroy the covert military organization of the FLN. But ultimately even this repression is useless--as the end of the film shows mass protest of Algerians confronting tanks and tear gas to win their independence. With its obvious relevance to today's struggles, The Battle of Algiers should be required viewing for anti-imperialists.

<?php include "../../legacy-includes/BottomNavLinks.htmlf" ?>

<?php include "../../legacy-includes/RightAdFolder.htmlf" ?>


text:
  GOOGLE_CLOUD_CPP_VEVAL(BIGQUERY_CLIENT_VERSION_MAJOR, \
                         BIGQUERY_CLIENT_VERSION_MINOR)

namespace google {
namespace cloud {
namespace bigquery {

// The inlined, versioned namespace for the client APIs.
//
// Applications may need to link multiple versions of the C++ client,
// for example, if they link a library that uses an older version of
// the client than they do.  This namespace is inlined, so
// applications can use `bigquery::Foo` in their source, but the
// symbols are versioned, e.g., the symbol becomes
// `bigquery::v1::Foo`.
inline namespace BIGQUERY_CLIENT_NS {
int constexpr VersionMajor() { return BIGQUERY_CLIENT_VERSION_MAJOR; }
int constexpr VersionMinor() { return BIGQUERY_CLIENT_VERSION_MINOR; }
int constexpr VersionPatch() { return BIGQUERY_CLIENT_VERSION_PATCH; }

// Returns a single integer representing the major, minor, and patch
// version.
int constexpr Version() {
  return 100 * (100 * VersionMajor() + VersionMinor()) + VersionPatch();
}

// Returns the version as a string in the form `MAJOR.MINOR.PATCH`.
std::string VersionString();

}  // namespace BIGQUERY_CLIENT_NS
}  // namespace bigquery
}  // namespace cloud
}  // namespace google

#endif  // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_BIGQUERY_VERSION_H