text:
import DS from 'ember-data';

export default DS.JSONAPISerializer.extend({

    normalizeSingleResponse(store, primaryModelClass, payload, id,
      requestType) {
      var children = [];
      if (payload.queues) {
        payload.queues.queue.forEach(function(queue) {
          children.push(queue.queueName);
        });
      }

      var includedData = [];
      var relationshipUserData = [];

      // update user models
      if (payload.users && payload.users.user) {
        payload.users.user.forEach(function(u) {
          includedData.push({
            type: "YarnUser",
            id: u.username + "_" + payload.queueName,
            attributes: {
              name: u.username,
              queueName: payload.queueName,
              usedMemoryMB: u.resourcesUsed.memory || 0,
              usedVCore: u.resourcesUsed.vCores || 0,
            }
          });

          relationshipUserData.push({
            type: "YarnUser",
            id: u.username + "_" + payload.queueName,
          });
        });
      }

      var fixedPayload = {
        id: id,
        type: primaryModelClass.modelName, // yarn-queue
        attributes: {
          name: payload.queueName,
          parent: payload.myParent,
          children: children,
          capacity: payload.capacity,
          usedCapacity: payload.usedCapacity,
          maxCapacity: payload.maxCapacity,
          absCapacity: payload.absoluteCapacity,
          absMaxCapacity: payload.absoluteMaxCapacity,
          absUsedCapacity: payload.absoluteUsedCapacity,
          state: payload.state,
          userLimit: payload.userLimit,
          userLimitFactor: payload.userLimitFactor,
          preemptionDisabled: payload.preemptionDisabled,
          numPendingApplications: payload.numPendingApplications,
          numActiveApplications: payload.numActiveApplications,
        },
        // Relationships
        relationships: {
          users: {
            data: relationshipUserData
          }
        }
      };

      return {
        queue: this._super(store, primaryModelClass, fixedPayload, id, requestType),
        includedData: includedData
      };
    },

    handleQueue(store, primaryModelClass, payload, id, requestType) {
      var data = [];
      var includedData = [];
      var result = this.normalizeSingleResponse(store, primaryModelClass,
        payload, id, requestType);

      data.push(result.queue);
      includedData = includedData.concat(result.includedData);

      if (payload.queues) {
        for (var i = 0; i < payload.queues.queue.length; i++) {
          var queue = payload.queues.queue[i];
          queue.myParent = payload.queueName;
          var childResult = this.handleQueue(store, primaryModelClass, queue,
            queue.queueName,
            requestType);

          data = data.concat(childResult.data);
          includedData = includedData.concat(childResult.includedData);
        }
      }

      return {
        data: data,
        includedData: includedData
      };
    },

    normalizeArrayResponse(store, primaryModelClass, payload, id,
      requestType) {
      var normalizedArrayResponse = {};
      var result = this.handleQueue(store,
        primaryModelClass,
        payload.scheduler.schedulerInfo, "root", requestType);

      normalizedArrayResponse.data = result.data;
      normalizedArrayResponse.included = result.includedData;

      console.log(normalizedArrayResponse);

      return normalizedArrayResponse;

      /*
      // return expected is { data: [ {}, {} ] }
      var normalizedArrayResponse = {};

      // payload has apps : { app: [ {},{},{} ]  }
      // need some error handling for ex apps or app may not be defined.
      normalizedArrayResponse.data = payload.apps.app.map(singleApp => {
        return this.normalizeSingleResponse(store, primaryModelClass, singleApp, singleApp.id, requestType);
      }, this);
      return normalizedArrayResponse;
      */
    }
});


text:
<ion-view view-title="Ionic 中文论坛">
    <ion-nav-buttons side="right">
        <button ng-disabled="topicsData.accesstoken== ''" class="button button-icon icon ion-plus-round" ng-click="openModal()"></button>
    </ion-nav-buttons>
    <ion-content scroll="true" lazy-scroll>
        <ion-refresher on-refresh="doRefresh()"></ion-refresher>

置顶

精华

        <ion-infinite-scroll ng-if="more" on-infinite="loadMore()" distance="10%"></ion-infinite-scroll>
    </ion-content>
</ion-view>

redpajama_set_name: RedPajamaGithub


text:
package com.matthew.slideshow.citypass;

import android.os.Build;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ListView;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by matthew on 27/12/2015.
 */
public class AnnouncementFragment extends Fragment {

    ListView listView;
    //private AnnouncementAdapter announcementAdapter;
    //String []data = null;
    FragmentManager fragmentManager;

/*
    private List<AnnouncementCourse> announcementCourses;
    private List<String> course_names = new ArrayList<>();

    private LMSExt network = new LMSExt(AnnouncementFragment.this.getContext());
*/

    /**
     * Returns a new instance of this fragment for the given section
     * number.
     */
//    private AnnouncementRW announcementRW = null;

    @Override
    public View onCreateView(LayoutInflater inflater, final ViewGroup container,
                             Bundle savedInstanceState) {

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            Window window = getActivity().getWindow();
            window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
            window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
            window.setStatusBarColor(getResources().getColor(R.color.notification_bar_color));
        }

        View view = inflater.inflate(
                R.layout.fragment_announcement, container, false);

        fragmentManager = getActivity().getSupportFragmentManager();
        listView = (ListView) view.findViewById(R.id.holiday_list);

        /*new entryJSON().execute();
        swipeRefreshLayout = (SwipeRefreshLayout) view.findViewById(R.id.swipeContainer);

        swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
            @Override
            public void onRefresh() {
                new Refresh().execute();
            }
        });
*/
        return view;
    }

/*
    private void getJSON() {
        announcementRW = new AnnouncementRW(getContext().getApplicationContext());

        int count = announcementRW.getCount();
        if (count == 0) {
            final String CANVAS = "canvas";
            final String COURSE = "course";
            final String COURSE_CODE = "course_code";

            final String ANNOUNCEMENT = "annoucement";
            final String HEADER = "header";
            final String POST_AT = "posted_at";
            final String BODY = "body";
            final String NAME = "name";

            network.getAnnouncement();

            try {
                if (network.getError()) {
                    throw new JSONException("Error occur in network component.");
                }
                String str1 = network.getResponse().toString();
                str1 = str1.replace("\\u003C", "<").replace("\\u003E", ">").replace("\\r", "\n").replace("\\n", "\n").replace("\\u0026", "&").replace("'", "'");
                str1 = str1.replace("<p>", "").replace("</p>", "");
                JSONObject j1 = new JSONObject(str1);
                JSONArray jArr1 = j1.getJSONArray(COURSE);

                for (int a = 0; a < jArr1.length(); a++) {
                    JSONObject j2 = jArr1.getJSONObject(a);
                    String course_name = j2.getString(NAME);
                    String course_code = j2.getString(COURSE_CODE);

                    AnnouncementCourse announcementCourse = new AnnouncementCourse(course_code, course_name.replace("'", "'"));

                    announcementRW.insertCourseName(announcementCourse);
                }

                JSONArray jArr2 = j1.getJSONArray(ANNOUNCEMENT);
                for (int a = 1; a < jArr2.length(); a++) {
                    JSONObject j3 = jArr2.getJSONObject(a);
                    String title = j3.getString(HEADER);
                    String post_at = j3.getString(POST_AT);
                    String message = j3.getString(BODY);

                    String course = j3.getString(COURSE_CODE);
                    if (!course.equals("55")) {
                        Announcement announcement = new Announcement(title.replace("'", "'"), message.replace("'", "'"), post_at.replace("'", "'"));
                        announcement.setCourse_code(course);

                        announcementRW.insertAnnouncement(announcement);
                    }

                }

            } catch (Exception e) {
                Log.d("Announcement json error", e.getMessage());
            }
        }

        announcementCourses = announcementRW.getAllCourse();
        if (announcementCourses == null)
            announcementCourses = new ArrayList<>();
        else {
            for (int a = 0; a < announcementCourses.size(); a++) {
                course_names.add(announcementCourses.get(a).getCourse_name().replace("'", "'"));
            }
        }
    }
*/

    @Override
    public void onDestroy() {
        // TODO Auto-generated method stub
        super.onDestroy();
/*        Log.d("on destory", "main");
        if (announcementRW != null)
            announcementRW.close();
*/    }

    @Override
    public void onPause() {
        // TODO Auto-generated method stub
        super.onPause();
        Log.d("on pause", "main");
    }

    @Override
    public void onResume() {
        // TODO Auto-generated method stub
        super.onResume();
        Log.d("on resume", "main");
    }

    @Override
    public void onStart() {
        // TODO Auto-generated method stub
        super.onStart();
        Log.d("on start", "main");
    }

    @Override
    public void onStop() {
        // TODO Auto-generated method stub
        super.onStop();
        Log.d("on stop", "main");
    }

/*
    public class AnnouncementAdapter extends ArrayAdapter<String> {
        List<String> data;
        int layoutResourceId;
        TextView textView;

        @Override
        public View getView(final int position, View convertView, ViewGroup parent) {
            View rootView = convertView;
            if (rootView == null) {
                LayoutInflater inflater = ((AppCompatActivity) getActivity()).getLayoutInflater();
                rootView = inflater.inflate(layoutResourceId, parent, false);
            }

            textView = (TextView) rootView.findViewById(R.id.cource_name_textview);
            textView.setText(data.get(position));

            switch (position % 6) {
                case 0:
                    textView.setBackgroundColor(Color.rgb(242, 136, 115));
                    break;
                case 1:
                    textView.setBackgroundColor(Color.rgb(170, 204, 126));
                    break;
                case 2:
                    textView.setBackgroundColor(Color.rgb(179, 152, 227));
                    break;
                case 3:
                    textView.setBackgroundColor(Color.rgb(242, 124, 170));
                    break;
                case 4:
                    textView.setBackgroundColor(Color.rgb(115, 172, 233));
                    break;
                case 5:
                    textView.setBackgroundColor(Color.rgb(139, 139, 143));
                    break;
            }

            return rootView;
        }
    }
*/
}


text:
using Newtonsoft.Json;

namespace WGnet.Model.WGN.Clan
{
    /// <summary>
    /// Базовая информация о клане
    /// См описание <see cref="http://ru.wargaming.net/developers/api_reference/wgn/clans/list/"/>
    /// </summary>
    public class Clan
    {
        /// <summary>
        /// Идентификатор клана
        /// </summary>
        [JsonProperty("clan_id")]
        public long ClanId { get; set; }

        /// <summary>
        /// Цвет клана в формате HEX #RRGGBB
        /// </summary>
        [JsonProperty("color")]
        public string Color { get; set; }

        /// <summary>
        /// Дата создания клана
        /// </summary>
        [JsonProperty("created_at")]
        public long CreatedAt { get; set; }

        /// <summary>
        /// Количество участников клана
        /// </summary>
        [JsonProperty("members_count")]
        public long MembersCount { get; set; }

        /// <summary>
        /// Название клана
        /// </summary>
        [JsonProperty("name")]
        public string Name { get; set; }

        /// <summary>
        /// Тег клана
        /// </summary>
        [JsonProperty("tag")]
        public string Tag { get; set; }

        /// <summary>
        /// Информация об эмблемах клана в играх и на клановом портале
        /// См. <see cref="ClanEmblems"/>
        /// </summary>
        [JsonProperty("emblems")]
        public ClanEmblems Emblems { get; set; }
    }
}


text:
package com.gs.fw.common.mithra.test.util;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.TimeZone;

import com.gs.fw.common.mithra.test.MithraTestDataParser;
import com.gs.fw.common.mithra.test.TestMithraTestDataParser;
import com.gs.fw.common.mithra.util.fileparser.BinaryCompressor;
import com.gs.fw.common.mithra.util.fileparser.MithraParsedData;
import junit.framework.TestCase;

import com.gs.fw.common.mithra.finder.DeepRelationshipAttribute;
import com.gs.fw.common.mithra.test.ConnectionManagerForTests;
import com.gs.fw.common.mithra.test.MithraTestResource;
import com.gs.fw.common.mithra.test.domain.OrderFinder;
import com.gs.fw.common.mithra.test.domain.ParaDeskFinder;
import com.gs.fw.common.mithra.test.domain.TestBinaryArrayFinder;
import com.gs.fw.common.mithra.util.dbextractor.DbExtractor;
import com.gs.fw.common.mithra.util.dbextractor.FitnesseHeaderFormatter;
import com.gs.fw.common.mithra.util.dbextractor.FitnesseRowFormatter;

public class DbExtractorTest extends TestCase
{
    private MithraTestResource mithraTestResource;
    static final String COMPARE_PATH = "reladomo" + File.separator + "src" + File.separator + "test" + File.separator+ "resources" + File.separator+ "testdata" + File.separator;
    static final String OUTPUT_PATH = "reladomo" + File.separator + "target" + File.separator + "tmp" + File.separator;

    protected void setUp() throws Exception
    {
        super.setUp();
        String xmlFile = System.getProperty("mithra.xml.config");

        mithraTestResource = new MithraTestResource(xmlFile);

        ConnectionManagerForTests connectionManager = ConnectionManagerForTests.getInstance();
        connectionManager.setDefaultSource("A");
        connectionManager.setDatabaseTimeZone(TimeZone.getDefault());
        connectionManager.setDatabaseType(mithraTestResource.getDatabaseType());

        mithraTestResource.createSingleDatabase(connectionManager, "A", "testdata/DbExtractorTest_source.txt");
        mithraTestResource.setTestConnectionsOnTearDown(true);
        mithraTestResource.setUp();
    }

    public void testMithraTestDataExtractor() throws Exception
	{
        DbExtractor extractor = new DbExtractor(OUTPUT_PATH + "DbExtractorTest_target.txt", false);
        this.executeTest(extractor, "DbExtractorTest_target.txt", "DbExtractorTest_source.txt");
        deleteFile("DbExtractorTest_target.txt");
    }

    public void testMithraTestDataExtractorCompressed() throws Exception
	{
        DbExtractor extractor = new DbExtractor(OUTPUT_PATH + "DbExtractorTest_target.txt.ccbf", false);
        deleteFile("DbExtractorTest_target.txt.ccbf");

        extractStuff(extractor);
        List<MithraParsedData> compressedData = new BinaryCompressor().decompress(OUTPUT_PATH + "DbExtractorTest_target.txt.ccbf");
        List<MithraParsedData> uncompressedData = new MithraTestDataParser(COMPARE_PATH + "DbExtractorTest_source.txt").getResults();
        TestMithraTestDataParser.compareData(uncompressedData, compressedData);
        deleteFile("DbExtractorTest_target.txt.ccbf");
    }

    public void testInMemoryMithraTestDataExtractorCompressed() throws Exception
    {
        DbExtractor extractor = new DbExtractor(OUTPUT_PATH + "DbExtractorTest_target.txt.ccbf", false);
        extractor.saveMergedDataInMemory();
        deleteFile("DbExtractorTest_target.txt.ccbf");
        extractStuff(extractor);
        extractor.writeMergedDataToColumnarFile();
        List<MithraParsedData> compressedData = new BinaryCompressor().decompress(OUTPUT_PATH + "DbExtractorTest_target.txt.ccbf");
        List<MithraParsedData> uncompressedData = new MithraTestDataParser(COMPARE_PATH + "DbExtractorTest_source.txt").getResults();
        TestMithraTestDataParser.compareData(uncompressedData, compressedData);
        deleteFile("DbExtractorTest_target.txt.ccbf");
    }

    public void deleteFile(String fname)
    {
        File extracted = new File(COMPARE_PATH + fname);
        extracted.delete();
    }

    protected void extractStuff(DbExtractor extractor) throws IOException
    {
        extractor.addClassToFile(ParaDeskFinder.getFinderInstance(), ParaDeskFinder.all());

        extractor.addClassToFile(TestBinaryArrayFinder.getFinderInstance(), TestBinaryArrayFinder.all());

        List<DeepRelationshipAttribute> deepFetchAttributes = new ArrayList<DeepRelationshipAttribute>();
        deepFetchAttributes.add(OrderFinder.items());
        deepFetchAttributes.add(OrderFinder.orderStatus());
        deepFetchAttributes.add(OrderFinder.items().orderItemStatus());
        extractor.addClassAndRelatedToFile(OrderFinder.getFinderInstance(), OrderFinder.all(), deepFetchAttributes);
    }

    public void testFitnesseExtractor() throws Exception
	{
        DbExtractor extractor = new DbExtractor(OUTPUT_PATH + "DbExtractorTest_targetFitnesse.txt", new FitnesseRowFormatter(), new FitnesseHeaderFormatter(), "|", true);
        extractor.setEndPointsInclusive(true);
        this.executeTest(extractor, "DbExtractorTest_targetFitnesse.txt", "DbExtractorTest_expectedFitnesse.txt");
    }

    private void executeTest(DbExtractor extractor, String targetFile, String expectedFile) throws IOException
    {
        File extracted = new File(OUTPUT_PATH + targetFile);
        extracted.delete();

        extractStuff(extractor);

        diffFiles(new File(COMPARE_PATH + expectedFile), extracted);
    }

    static void diffFiles(File baseline, File extracted) throws IOException
    {
        BufferedReader inBaseline = null;
        BufferedReader inExtracted = null;
        try
        {
            inBaseline = new BufferedReader(new FileReader(baseline));
            inExtracted = new BufferedReader(new FileReader(extracted));

            skipHeader(inBaseline);

            boolean stop = false;

            String baselineLine = null;
            String extractedLine = null;
            while (!stop)
            {
                baselineLine = inBaseline.readLine();
                extractedLine = inExtracted.readLine();

                assertEquals(baselineLine, extractedLine);

                if (baselineLine == null || extractedLine == null)
                {
                    stop = true;
                }
            }
            assertNull(baselineLine);
            assertNull(extractedLine);
        }
        finally
        {
            if (inBaseline != null)
            {
                inBaseline.close();
            }
            if (inExtracted != null)
            {
                inExtracted.close();
            }
        }
    }

    static void skipHeader(BufferedReader in) throws IOException
    {
        boolean done = false;
        boolean inComment = false;
        while(!done)
        {
            in.mark(10000);
            String line = in.readLine().trim();
            if (inComment)
            {
                if (line.endsWith("*/"))
                {
                    inComment = false;
                }
            }
            else if (line.startsWith("/*"))
            {
                inComment = true;
            }
            else if (!line.isEmpty())
            {
                in.reset();
                done = true;
            }
        }
    }

    protected void tearDown() throws Exception
    {
        if (mithraTestResource != null)
        {
            mithraTestResource.tearDown();
        }
        super.tearDown();
        removeTmpFiles("DbExtractor");
    }

    public static void removeTmpFiles(String prefix)
    {
        File outDir = new File(OUTPUT_PATH);
        File[] files = outDir.listFiles();
        for(File f: files)
        {
            if (f.isFile() && f.getName().startsWith(prefix))
            {
                f.delete();
            }
        }
    }
}


text:
#include <algorithm>
#include "Cell.hh"
#include "kBestChart.hh"
#include "Each.hh"

namespace Permute {

  // Outputs the following information about a vertex:
  //
  //   ((b,e) ->/<- (s,t)) |D| |C|
  //
  // where (b,e) is the span of the permutation covered, the arrow indicates
  // keep or swap, (s,t) is the source and target states of the path, and D and
  // C  are the set of derivations and candidates, respectively.
  std::ostream & operator << (std::ostream & out, const Vertex & v) {
    out << "(("
	<< v.begin << ", " << v.end << ")"
	<< (v.swap ? " <- " : " -> ") << "("
	<< v.source << ", " << v.target << "))"
	<< " |D| = " << v.derivations.size ()
	<< " |C| = " << v.candidates.size ()
	<< (v.initialized ? " init" : " un");
    return out;
  }

  // If the derivation is a leaf node, simply outputs the source and target
  // states of the path:
  //
  //   Dbp: (s, t)
  //
  // Otherwise, outputs the three positions indicating the pair of spans the
  // derivation joins, the pair of indices indicating the ranks of the child
  // derivations, a type (KEEP or SWAP), and the source and target states of the
  // path:
  //
  //   Dbp: (i, j, k) [r_1, r_2] KEEP/SWAP (s, t)
  std::ostream & operator << (std::ostream & out, const Dbp & ej) {
    if (ej.t [0] == 0) {
      out << "Dbp: (" << ej.path -> getStart () << ", " << ej.path -> getEnd () << ")";
    } else {
      out << "Dbp: (";
      if (ej.swap) {
	out << ej.t [0] -> end << ", " << ej.t [0] -> begin << ", " << ej.t [1] -> begin;
      } else {
	out << ej.t [0] -> begin << ", " << ej.t [0] -> end << ", " << ej.t [1] -> end;
      }
      out << ") "
	  << "[" << ej.j [0] << ", " << ej.j [1] << "] "
	  << (ej.swap ? "SWAP " : "KEEP ")
	  << "(" << ej.path -> getStart () << ", " << ej.path -> getEnd () << ")";
    }
    return out;
  }

  // For each cell in the Chart, prints the coordinates of the cell and the
  // number of paths in the cell:
  //
  //   [i, j]: |P|
  std::ostream & operator << (std::ostream & out, ChartRef chart) {
    int N = chart -> getLength ();
    for (int i = 0; i < N; ++ i) {
      for (int j = i + 1; j <= N; ++ j) {
	ConstCellRef cell = chart -> getConstCell (i, j);
	out << "[" << i << ", " << j << "]: " << cell -> size () << std::endl;
      }
    }
    return out;
  }

  /**********************************************************************/

  kBestChart::kBestChart (ChartRef chart, ParseControllerRef controller, ScorerRef scorer) :
    chart_ (chart),
    controller_ (controller),
    scorer_ (scorer),
    vertices_ ()
  {}

  kBestChart::~kBestChart () {
    for (Vertices::const_iterator i = vertices_.begin (); i != vertices_.end (); ++ i) {
      Vertex * v = (* i);
      delete v;
    }
  }

  void kBestChart::permute () {
    Chart::permute (chart_, controller_, scorer_);
  }

  // Creates a vertex called top with (start, end) pair (0, N).  Iterates over
  // (source, target, type) tuples in the top cell of the chart.  For each such
  // path, calls getCandidates on the top vertex to add the best derivations for
  // that (source, target, type) tuple to the candidates queue.
  //
  // Next, calls lazyKthBest with i = k - 1 to compute the k best derivations
  // with any (source, target, type) tuple.
  //
  // Finally, iterates over the derivations and puts their paths in a vector to
  // return.
  kBestChart::Paths kBestChart::best (int k) {
    // Resets the vertex table.
    for (Vertices::const_iterator i = vertices_.begin (); i != vertices_.end (); ++ i) {
      Vertex * v = (* i);
      delete v;
    }
    vertices_.clear ();
    // The top cell requires special handling because there are multiple
    // possible final states, in general.  For now, simply calls getCandidates
    // multiple times with different target states.
    Vertex top (0, chart_ -> getLength ());
    ConstCellRef topCell = chart_ -> getConstCell (top.begin, top.end);
    for (Cell::PathIterator path = topCell -> begin (); path != topCell -> end (); ++ path) {
      top.source = (* path) -> getStart ();
      top.target = (* path) -> getEnd ();
      top.swap = ((* path) -> type () == Path::SWAP);
      getCandidates (top, k);
    }
    // Finds the best paths.
    lazyKthBest (top, k - 1, k);
    // Extracts the best paths.
    Paths paths;
    for (std::vector <Dbp>::const_iterator d = top.derivations.begin (); d != top.derivations.end (); ++ d) {
      paths.push_back (d -> path);
    }
    // Returns the best paths.
    return paths;
  }

  // Tries to extend the given vertex to contain an ith (counting from zero)
  // derivation, with a maximum of k.
  //
  // If the vertex has not been initialized with a candidates queue, calls
  // getCandidates with the vertex.
  //
  // If the vertex represents a leaf node---no expansion is possible---simply
  // returns whether the vertex has more than i possible derivations.
  //
  // Otherwise, calls lazyNext on the most recent derivation and pops the next
  // derivation off the candidates queue until the ith derivation has been
  // computed.
  //
  // Returns true if the vertex has an ith derivation, and false if not.
  bool kBestChart::lazyKthBest (const Vertex & v, int i, int k) {
    if (! v.initialized) {
      getCandidates (v, k);
    }
    // Leaf nodes cannot be expanded.
    if (v.end - v.begin == 1) {
      return v.derivations.size () > i;
    }
    while (v.derivations.size () <= i) {
      if (v.derivations.size () > 0) {
	lazyNext (v, v.derivations.back (), k);
      }
      if (! v.candidates.empty ()) {
	v.derivations.push_back (v.candidates.top ());
	v.candidates.pop ();
      } else {
	return false;
      }
    }
    return true;
  }

  // Extends the given derivation by extending each of its children and putting
  // both new derivations into the given vertex's candidates queue.
  //
  // For both the first and second child of the given derivation, calls
  // lazyKthBest to ensure that child has computed the necessary number of
  // items, then inserts the Dbp derived from the given one by adding one to the
  // appropriate index.
  void kBestChart::lazyNext (const Vertex & v, const Dbp & ej, int k) {
    for (int i = 0; i < 2; ++ i) {
      if (lazyKthBest (* (ej.t [i]), ej.j [i] + 1, k)) {
	v.candidates.insertOrRelax (Dbp (ej, i));
      }
    }
  }

  // Iterates over paths of a given type in the left cell with the given source
  // state.  Looks for paths in the right cell of a given type whose source
  // state matches the left path's target state and whose target state matches
  // the given target state.
  //
  // For each such right path, calls lazyKthBest on both the left and right
  // corresponding vertices with i = 0 to ensure that at least one derivation
  // exists, then adds the resulting derivation to the given list of Dbps.
  void kBestChart::getCandidatesHelper (std::vector <Dbp> & temp, int k,
					ConstCellRef left,
					ConstCellRef right,
					Fsa::StateId lsource,
					Fsa::StateId rtarget,
					Path::Type ltype,
					Path::Type rtype,
					size_t lbegin, size_t lend,
					size_t rbegin, size_t rend,
					double score,
					bool swap) {
    for (Cell::PathIterator lpath = left -> begin (lsource, ltype);
	 lpath != left -> end ();
	 lpath = left -> next (lpath, lsource, ltype)) {
      Fsa::StateId via = (* lpath) -> getEnd ();
      Cell::PathIterator rpath = right -> find (via, rtarget, rtype);
      if (rpath != right -> end ()) {
	// Get vertices (lbegin, lend, lsource, via) and (rbegin, rend, via, rtarget)
	const Vertex
	  * lv = getVertex (lbegin, lend, (* lpath) -> type () == Path::SWAP, lsource, via),
	  * rv = getVertex (rbegin, rend, (* rpath) -> type () == Path::SWAP, via, rtarget);
	assert (lazyKthBest (* lv, 0, k));
	assert (lazyKthBest (* rv, 0, k));
	temp.push_back (Dbp (lv, rv, score, swap));
      }
    }
  }

  // Initializes the given vertex's candidates queue.
  //
  // First, sets the vertex to initialized.
  //
  // If the vertex corresponds to a leaf node, simply extracts a set of
  // derivations from the chart's cell, initialized using
  // Dbp::Dbp(ConstPathRef).  Sorts the derivations to make them a k-best list.
  //
  // Otherwise, iterates over all split positions allowed by the ParseController
  // and populates a vector with all possible derivation types using
  // getCandidatesHelper.
  //
  // If the vertex swaps, then normal form requires that its right child (left in
  // the tree) is not a swap node, but allows either type for the left child.
  //
  // If the vertex keeps it children in order, then normal form requires that
  // its right child is not a keep node, but allows either type for the left
  // child.
  void kBestChart::getCandidates (const Vertex & v, int k) {
    v.initialized = true;
    // Base Case
    if (v.end - v.begin == 1) {
      ConstCellRef cell = chart_ -> getConstCell (v.begin, v.end);
      for (Cell::PathIterator path = cell -> begin (v.source, Path::NEITHER);
	   path != cell -> end ();
	   path = cell -> next (path, v.source, Path::NEITHER)) {
	v.derivations.push_back (Dbp (* path));
      }
      std::sort (v.derivations.begin (), v.derivations.end ());
      return;
    }
    // Recursive Case
    std::vector <Dbp> temp;
    for (ParseController::iterator middle = controller_ -> begin (v.begin, v.end);
	 middle != controller_ -> end (v.begin, v.end); ++ middle) {
      ConstCellRef
	left = chart_ -> getConstCell (v.begin, middle),
	right = chart_ -> getConstCell (middle, v.end);
      if (v.swap) {
	// Swap
	Path::Type rtype = (middle - v.begin == 1) ? Path::NEITHER : Path::KEEP;
	double score = scorer_ -> score (v.end, middle, v.begin);
	if (v.end - middle == 1) {
	  getCandidatesHelper (temp, k, right, left, v.source, v.target, Path::NEITHER, rtype,
			       middle, v.end, v.begin, middle, score, true);
	} else {
	  getCandidatesHelper (temp, k, right, left, v.source, v.target, Path::KEEP, rtype,
			       middle, v.end, v.begin, middle, score, true);
	  getCandidatesHelper (temp, k, right, left, v.source, v.target, Path::SWAP, rtype,
			       middle, v.end, v.begin, middle, score, true);
	}
      } else {
	// Keep
	Path::Type rtype = (v.end - middle == 1) ? Path::NEITHER : Path::SWAP;
	double score = scorer_ -> score (v.begin, middle, v.end);
	if (middle - v.begin == 1) {
	  getCandidatesHelper (temp, k, left, right, v.source, v.target, Path::NEITHER, rtype,
			       v.begin, middle, middle, v.end, score, false);
	} else {
	  getCandidatesHelper (temp, k, left, right, v.source, v.target, Path::KEEP, rtype,
			       v.begin, middle, middle, v.end, score, false);
	  getCandidatesHelper (temp, k, left, right, v.source, v.target, Path::SWAP, rtype,
			       v.begin, middle, middle, v.end, score, false);
	}
      }
    }
    // Quick select
    std::nth_element (temp.begin (), temp.begin () + k, temp.end ());
    std::for_each (temp.begin (), std::min (temp.begin () + k, temp.end ()),
		   each_fun (& v.candidates,
			     & Core::TracedPriorityQueue <Dbp, Dbp, DbpIdentity, DbpLess, DbpHash>::insert));
//     for (std::vector <Dbp>::const_iterator i = temp.begin ();
// 	 (i != temp.end ()) && (i < temp.begin () + k);
// 	 ++ i) {
//       v.candidates.insert (* i);
//     }
  }

  // Gets an existing vertex with the given 5-tuple from the hash table or
  // creates a new one if none exists.
  const Vertex * kBestChart::getVertex (int begin, int end, bool swap, Fsa::StateId source, Fsa::StateId target) {
    Vertex * v = new Vertex (begin, end, swap, source, target);
    InsertPair p = vertices_.insertExisting (v);
    assert (! p.second || vertices_ [p.first] -> initialized);
    if (p.second) {
      delete v;
    }
    return vertices_ [p.first];
  }

  /**********************************************************************/

  Dbp::Dbp () :
    constit (0.0),
    swap (false)
  {
    for (int i = 0; i < 2; ++ i) {
      t [i] = 0;
      j [i] = 0;
    }
  }

  // Constructs a first derivation (j[0] == j[1] == 0) from the given pair of
  // vertices with the given constituent score and swap value.  This
  // derivation's path connects the best paths of the two children.
  Dbp::Dbp (const Vertex * t1, const Vertex * t2, double constit, bool swap) :
    constit (constit),
    swap (swap)
  {
    t [0] = t1;
    t [1] = t2;
    j [0] = j [1] = 0;
    path = Path::connect (t1 -> derivations [0].path,
			  t2 -> derivations [0].path,
			  constit,
			  swap);
    assert (path -> normal ());
  }

  // Constructs a leaf derivation from a path.  The Vertex array consists of
  // null pointers.
  Dbp::Dbp (ConstPathRef path) :
    path (path),
    constit (0.0),
    swap (false)
  {
    t [0] = t [1] = 0;
    j [0] = j [1] = 0;
  }

  // Constructs a new derivation from a given one by taking the next derivation
  // from the child indicated by the given index.  This derivation's path
  // connects the appropriate paths from the children.
  Dbp::Dbp (const Dbp & dbp, int index) :
    constit (dbp.constit),
    swap (dbp.swap)
  {
    for (int i = 0; i < 2; ++ i) {
      t [i] = dbp.t [i];
      j [i] = dbp.j [i] + (i == index ? 1 : 0);
    }
    path = Path::connect (t [0] -> derivations [j [0]].path,
			  t [1] -> derivations [j [1]].path,
			  constit,
			  swap);
    assert (path -> normal ());
  }

  // One Dbp is better than another if its path has a higher score.  Because
  // sometimes paths may have identical scores, we must also compare the j
  // values of Dbps in this case.
  bool Dbp::operator < (const Dbp & other) const {
    if (path -> getScore () == other.path -> getScore ()) {
      if (j [0] == other.j [0]) {
	return j [1] < other.j [1];
      } else {
	return j [0] < other.j [0];
      }
    } else {
      return path -> getScore () > other.path -> getScore ();
    }
  }

  // Checks only those attributes not derived from the others.
  bool Dbp::operator == (const Dbp & other) const {
    return t [0] == other.t [0]
      && t [1] == other.t [1]
      && j [0] == other.j [0]
      && j [1] == other.j [1]
      && swap == other.swap;
  }
}


text:
<?php

namespace lasa\validator;

use ReflectionClass;

class ValidatorLoader {

	private $_base = null;
	private $_validatorClassName = Validator::class;

	/**
	 *
	 * @param string $directory
	 */
	function __construct($base_directory, $className = null) {
		$this->_base = $base_directory;
		if ($className) {
			$this->_validatorClassName = $className;
		}
	}

	/**
	 *
	 * @param string $name
	 * @param [] $values
	 * @throws \Exception
	 * @return \lasa\validator\Validator
	 */
	function check($name, $values) {
		$class = $this->_validatorClassName;
		$func = $this->_getFunc($name);

		$reflection = new \ReflectionFunction($func);
		$params = $reflection->getParameters();
		if (count($params) > 0) {
			/* @var $param \ReflectionParameter */
			$param = $params[0];
			$reflectionType = $param->getType() . "";
			if ($reflectionType) {
				$reflectionClass = new ReflectionClass($reflectionType);
				if ($reflectionClass->isInstantiable()) {
					$refClassName = $reflectionClass->getName();
					if ($refClassName != Validator::class) {
						$class = $refClassName;
					}
				}
			}
		}

		$v = new $class($values);
		if (is_callable($func)) {
			$func($v);
		}

		return $v;
	}

	function load(Validator $v, $name) {
		$func = $this->_getFunc($name);
		if (is_callable($func)) {
			$func($v);
		}

		return $v;
	}

	function _getFunc($name) {
		$path = $this->_base . DIRECTORY_SEPARATOR . $name . ".php";
		if (strpos($name, ".") !== false) {
			$path = null;
		}

		$func = null;
		if (!$path || !file_exists($path)) {
			throw new \Exception("unknown validation: ${name}");
		}

		$func = include($path);
		if (!($func instanceof \Closure)) {
			throw new \Exception("invalid validation: ${name}");
		}
		return $func;
	}
}


text:
package org.zstack.header.network.service;

import org.zstack.header.core.Completion;
import org.zstack.header.core.NoErrorCompletion;
import org.zstack.header.network.l3.L3NetworkInventory;
import org.zstack.header.vm.VmInstanceSpec;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: frank
 * Time: 1:45 PM
 * To change this template use File | Settings | File Templates.
 */
public interface NetworkServiceDnsBackend {
    NetworkServiceProviderType getProviderType();

    void addDns(L3NetworkInventory l3, List<String> dns, Completion completion);

    void removeDns(L3NetworkInventory l3, List<String> dns, Completion completion);

    void applyDnsService(List<DnsStruct> dnsStructList, VmInstanceSpec spec, Completion completion);

    void releaseDnsService(List<DnsStruct> dnsStructsList, VmInstanceSpec spec, NoErrorCompletion completion);
}


text:
module Lita
  # The root exception class that all Lita-specific exceptions inherit from.
  # @since 4.0.0
  class Error < StandardError; end

  # An exception raised when a custom validation is set on a configuration attribute that is
  # violated by the default value of the attribute.
  # @since 4.0.0
  class ValidationError < Error; end

  # An exception raised when Lita can't connect to Redis in test mode.
  # @since 4.0.3
  class RedisError < Error; end

  # An exception raised when attempting to resolve a template that doesn't exist.
  # @since 4.2.0
  class MissingTemplateError < Error; end

  # An exception raised when a handler attempts to render a template without having set its
  # template root.
  # @since 4.2.0
  class MissingTemplateRootError < Error; end
end


text:
*NOTICE: ZeroMQ support will no longer be available as of Log Courier version
2.0, where the 'tcp' and 'tls' transports will be able to connect to multiple
Logstash instances. This reduces the benefits of retaining ZeroMQ support
significantly, especially as the new 'tcp' and 'tls' implementation will recover
from instance failures significantly faster. Additionally, the library currently
in use has entered maintenance only support and as such would need replacing to
allow it to continue to take advantage of future ZeroMQ improvements.*

The ZeroMQ transports allow Log Courier to connect to multiple Logstash
instances simultaenously and load balance events between them in an efficient
and reliable manner.

<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
**Table of Contents**  *generated with [DocToc](https://github.com/thlorenz/doctoc)*

- [Packaged Versions of Log Courier](#packaged-versions-of-log-courier)
- [Building from Source](#building-from-source)
- [Generating Keys for the 'zmq' Transport](#generating-keys-for-the-zmq-transport)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

## Packaged Versions of Log Courier

All current packages are built with support for the cleartext 'plainzmq'
transport.

Because most distrbutions do not provide packaged versions of ZeroMQ >=4.0,
it is not possible to provide a packaged version of Log Courier that supports
the 'zmq' transport, as this transport requires ZeroMQ >=4.0.

## Building from Source

To build with support for the 'plainzmq' or 'zmq' transports, you will need to
install [ZeroMQ](http://zeromq.org/intro:get-the-software) (>=3.2 for
'plainzmq', >=4.0 for 'zmq' which supports encryption).

***Linux\Unix:*** *ZeroMQ >=3.2 is usually available via the package manager.
ZeroMQ >=4.0 may need to be built and installed manually.*
***OS X:*** *ZeroMQ can be installed via [Homebrew](http://brew.sh).*
***Windows:*** *ZeroMQ will need to be built and installed manually.*

Once the required version of ZeroMQ is installed, run the corresponding `make`
command to build Log Courier with the ZMQ transports.

    # ZeroMQ >=3.2 - cleartext 'plainzmq' transport
    make with=zmq3
    # ZeroMQ >=4.0 - both cleartext 'plainzmq' and encrypted 'zmq' transport
    make with=zmq4

*Note: If you receive errors whilst running `make`, try `gmake` instead.*

**Please ensure that the versions of ZeroMQ installed on the Logstash hosts and
the Log Courier hosts are of the same major version. A Log Courier host that has
ZeroMQ 4.0.5 will not work with a Logstash host using ZeroMQ 3.2.4 (but will
work with a Logstash host using ZeroMQ 4.0.4.)**

## Generating Keys for the 'zmq' Transport

Log Courier provides a command to help generate Curve keys: `lc-curvekey`.

Running `make curvekey` will automatically build and run the `lc-curvekey`
utility that will quickly and easily generate Curve key pairs, along with the
corresponding configuration snippets, for the 'zmq' shipping transport.


text:
#include "stdio_impl.h"
#include <fcntl.h>

/* The basic idea of this implementation is to open a new FILE,
 * hack the necessary parts of the new FILE into the old one, then
 * close the new FILE. */

/* Locking IS necessary because another thread may provably hold the
 * lock, via flockfile or otherwise, when freopen is called, and in that
 * case, freopen cannot act until the lock is released. */

int __dup3(int, int, int);

FILE *freopen(const char *restrict filename, const char *restrict mode, FILE *restrict f)
{
	int fl = __fmodeflags(mode);
	FILE *f2;

	FLOCK(f);

	fflush(f);

	if (!filename) {
		if (fl&O_CLOEXEC)
			__syscall(SYS_fcntl, f->fd, F_SETFD, FD_CLOEXEC);
		fl &= ~(O_CREAT|O_EXCL|O_CLOEXEC);
		if (syscall(SYS_fcntl, f->fd, F_SETFL, fl) < 0)
			goto fail;
	} else {
		f2 = fopen(filename, mode);
		if (!f2) goto fail;
		if (f2->fd == f->fd) f2->fd = -1; /* avoid closing in fclose */
		else if (__dup3(f2->fd, f->fd, fl&O_CLOEXEC)<0) goto fail2;

		f->flags = (f->flags & F_PERM) | f2->flags;
		f->read = f2->read;
		f->write = f2->write;
		f->seek = f2->seek;
		f->close = f2->close;

		fclose(f2);
	}

	FUNLOCK(f);
	return f;

fail2:
	fclose(f2);
fail:
	fclose(f);
	return NULL;
}

LFS64(freopen);


text:
Compiled from https://github.com/pulkkins/Optflow/commit/58261e14f04eb2a1c4cb77eaf86bb51e2b0e14d1

## requirements
In addition to requirements from `requirements.txt` pyoptflow requires `LD_LIBRARY_PATH` environment variable pointing to `pyoptflow` folder for `.so` files.
For example `LD_LIBRARY_PATH=${LD_LIBRARY_PATH}/path/to/libs:`.


text:
<!DOCTYPE html>

        <meta charset="utf8"/>
        <meta name="description" content="BPMN diagram builder powered by Rappid diagramming toolkit.">
        <meta name="keywords" content="BPMN, modeling, jointjs, rappid, diagram, flowchart">
        <meta name="author" content="client IO">
        <meta property="og:title" content="BPMN 2.0 online builder" />
        <meta property="og:description" content="BPMN diagram builder powered by Rappid diagramming toolkit." />
        <meta property="og:site_name" content="JointJS | client IO" />
        <meta property="og:image" content="http://jointjs.com/images/blog/bpmn-editor.png" />
        <title>Business Process Model And Notation</title>
        <link rel="stylesheet" type="text/css" href="../../build/rappid.css" />
        <link rel="stylesheet" type="text/css" href="./css/bpmn.css" />

          <input id="fileName" type="text" value="bpmn-example"/>

Business Process Model and Notation

What is it good for?

The main goal of the BPMN language is to erase the communication gap between the business process design and process implementation by providing a graphical notation that all the technical and business users can easily understand.

BPMN 2.0

From the version 2.0+ the language contains also the execution semantics for all BPMN elements and defines a mechanism for extending standard elements with custom attributes.

Copyright © 2014 client IO. License this technology


text:
<ion-view title="帮助中心" style="background-color: #f5f5f5;">

            返回

    <ion-content class="has-header" padding="false" >
        <ion-list>
            <ion-item class="stable-bg row">

                    {{content.title}}

                    {{content.lastUpdated}}

            </ion-item>

            <ion-item class="item-text-wrap stable-bg" style=" border-bottom-width: 0px;background-color:#f5f5f5 ;">

            </ion-item>

        </ion-list>
    </ion-content>
</ion-view>


text:
/*
Author: Tomas Rohr, rohr.tomas@gmail.com
Last change date: 2017-09-01
*/
SET VERIFY OFF

/*
Do not prompt for substitution variables values.
Use null as default value for substitution variable.
*/
COLUMN 1 NEW_VALUE 1
COLUMN 2 NEW_VALUE 2
SET FEEDBACK OFF
SELECT NULL "1", NULL "2" FROM DUAL WHERE 1=0;
SET FEEDBACK ON

COLUMN OWNER FORMAT A20
COLUMN TABLE_NAME FORMAT A30
COLUMN TABLESPACE_NAME FORMAT A30
COLUMN PRIVLIST FORMAT A50

SELECT
	OWNER, TABLE_NAME,
	LISTAGG(PRIVILEGE, ',') WITHIN GROUP (ORDER BY PRIVILEGE) AS PRIVLIST
FROM (
	SELECT DISTINCT
		OWNER, TABLE_NAME,
		DECODE(PRIVILEGE,'SELECT','S','UPDATE','U','INSERT','I','DELETE','D','ALTER','A','FLASHBACK','F',
		 'READ','R', 'QUERY REWRITE', 'QR', 'ON COMMIT REFRESH', 'OCOMR',
		 'DEBUG', 'DBG', 'EXECUTE', 'E', PRIVILEGE) AS PRIVILEGE
	FROM (
		SELECT TABLE_SCHEMA AS OWNER, TABLE_NAME, PRIVILEGE
		FROM
			ALL_TAB_PRIVS
		WHERE
        -- if both &1 and &2 are not null then (owner like '&1' and table_name like '&2')
            (('&1' IS NULL OR '&2' IS NULL) OR (TABLE_SCHEMA LIKE '&1' AND TABLE_NAME LIKE '&2'))
	)
)
GROUP BY OWNER, TABLE_NAME
ORDER BY OWNER, TABLE_NAME
/

UNDEF 1
UNDEF 2


text:
@interface EXRCustomDismissTransition : NSObject <UIViewControllerAnimatedTransitioning>

@end


text:
<?php
namespace Login\Controller;

use Zend\Mvc\Controller\AbstractActionController;

class LoginController extends AbstractActionController
{

}


text:
package org.sagebionetworks.repo.model.query.jdo;

import static org.junit.Assert.assertEquals;

import org.junit.Test;

/**
 * Test the mapping of NodeFields.
 * @author jmhill
 *
 */
public class NodeFieldTest {

	@Test
	public void testID(){
		assertEquals("id", NodeField.ID.getFieldName());
		assertEquals(SqlConstants.COL_NODE_ID, NodeField.ID.getColumnName());
		assertEquals(SqlConstants.TABLE_NODE, NodeField.ID.getTableName());
		assertEquals(SqlConstants.NODE_ALIAS, NodeField.ID.getTableAlias());
	}

	@Test
	public void testName(){
		assertEquals("name", NodeField.NAME.getFieldName());
		assertEquals(SqlConstants.COL_NODE_NAME, NodeField.NAME.getColumnName());
		assertEquals(SqlConstants.TABLE_NODE, NodeField.NAME.getTableName());
		assertEquals(SqlConstants.NODE_ALIAS, NodeField.NAME.getTableAlias());
	}

	@Test
	public void testParentId(){
		assertEquals("parentId", NodeField.PARENT_ID.getFieldName());
		assertEquals(SqlConstants.COL_NODE_PARENT_ID, NodeField.PARENT_ID.getColumnName());
		assertEquals(SqlConstants.TABLE_NODE, NodeField.PARENT_ID.getTableName());
		assertEquals(SqlConstants.NODE_ALIAS, NodeField.PARENT_ID.getTableAlias());
	}

	@Test
	public void testCreatedBy(){
		assertEquals("createdByPrincipalId", NodeField.CREATED_BY.getFieldName());
		assertEquals(SqlConstants.COL_NODE_CREATED_BY, NodeField.CREATED_BY.getColumnName());
		assertEquals(SqlConstants.TABLE_NODE, NodeField.CREATED_BY.getTableName());
		assertEquals(SqlConstants.NODE_ALIAS, NodeField.CREATED_BY.getTableAlias());
	}

	@Test
	public void testCreatedOn(){
		assertEquals("createdOn", NodeField.CREATED_ON.getFieldName());
		assertEquals(SqlConstants.COL_NODE_CREATED_ON, NodeField.CREATED_ON.getColumnName());
		assertEquals(SqlConstants.TABLE_NODE, NodeField.CREATED_ON.getTableName());
		assertEquals(SqlConstants.NODE_ALIAS, NodeField.CREATED_ON.getTableAlias());
	}

	@Test
	public void testModifedBy(){
		assertEquals("modifiedByPrincipalId", NodeField.MODIFIED_BY.getFieldName());
		assertEquals(SqlConstants.COL_REVISION_MODIFIED_BY, NodeField.MODIFIED_BY.getColumnName());
		assertEquals(SqlConstants.TABLE_REVISION, NodeField.MODIFIED_BY.getTableName());
		assertEquals(SqlConstants.REVISION_ALIAS, NodeField.MODIFIED_BY.getTableAlias());
	}

	@Test
	public void testModifedOn(){
		assertEquals("modifiedOn", NodeField.MODIFIED_ON.getFieldName());
		assertEquals(SqlConstants.COL_REVISION_MODIFIED_ON, NodeField.MODIFIED_ON.getColumnName());
		assertEquals(SqlConstants.TABLE_REVISION, NodeField.MODIFIED_ON.getTableName());
		assertEquals(SqlConstants.REVISION_ALIAS, NodeField.MODIFIED_ON.getTableAlias());
	}

	@Test
	public void testNodeType(){
		assertEquals("nodeType", NodeField.NODE_TYPE.getFieldName());
		assertEquals(SqlConstants.COL_NODE_TYPE, NodeField.NODE_TYPE.getColumnName());
		assertEquals(SqlConstants.TABLE_NODE, NodeField.NODE_TYPE.getTableName());
		assertEquals(SqlConstants.NODE_ALIAS, NodeField.NODE_TYPE.getTableAlias());
	}

	@Test
	public void testETag(){
		assertEquals("eTag", NodeField.E_TAG.getFieldName());
		assertEquals(SqlConstants.COL_NODE_ETAG, NodeField.E_TAG.getColumnName());
		assertEquals(SqlConstants.TABLE_NODE, NodeField.E_TAG.getTableName());
		assertEquals(SqlConstants.NODE_ALIAS, NodeField.E_TAG.getTableAlias());
	}

	@Test
	public void testVersionNumber(){
		assertEquals("versionNumber", NodeField.VERSION_NUMBER.getFieldName());
		assertEquals(SqlConstants.COL_REVISION_NUMBER, NodeField.VERSION_NUMBER.getColumnName());
		assertEquals(SqlConstants.TABLE_REVISION, NodeField.VERSION_NUMBER.getTableName());
		assertEquals(SqlConstants.REVISION_ALIAS, NodeField.VERSION_NUMBER.getTableAlias());
	}

	@Test
	public void testVersionComment(){
		assertEquals("versionComment", NodeField.VERSION_COMMENT.getFieldName());
		assertEquals(SqlConstants.COL_REVISION_COMMENT, NodeField.VERSION_COMMENT.getColumnName());
		assertEquals(SqlConstants.TABLE_REVISION, NodeField.VERSION_COMMENT.getTableName());
		assertEquals(SqlConstants.REVISION_ALIAS, NodeField.VERSION_COMMENT.getTableAlias());
	}

	@Test
	public void testVersionLabel(){
		assertEquals("versionLabel", NodeField.VERSION_LABEL.getFieldName());
		assertEquals(SqlConstants.COL_REVISION_LABEL, NodeField.VERSION_LABEL.getColumnName());
		assertEquals(SqlConstants.TABLE_REVISION, NodeField.VERSION_LABEL.getTableName());
		assertEquals(SqlConstants.REVISION_ALIAS, NodeField.VERSION_LABEL.getTableAlias());
	}

	@Test
	public void testBenefacrorId(){
		assertEquals("benefactorId", NodeField.BENEFACTOR_ID.getFieldName());
		assertEquals(null, NodeField.BENEFACTOR_ID.getColumnName());
		assertEquals(SqlConstants.TABLE_NODE, NodeField.BENEFACTOR_ID.getTableName());
		assertEquals(SqlConstants.NODE_ALIAS, NodeField.BENEFACTOR_ID.getTableAlias());
	}

}


text:
using System;
using System.Linq;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
using System.Data.Entity;
using Movies.Models;
using Movies.Models.Migrations;

namespace Movies
{
    // Note: For instructions on enabling IIS7 classic mode,
    // visit http://go.microsoft.com/fwlink/?LinkId=301868
    public class MvcApplication : System.Web.HttpApplication
    {
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
            Database.SetInitializer(
                new MigrateDatabaseToLatestVersion<ApplicationDbContext, Configuration>()
            );
        }
    }
}


text:
class Context < ApplicationRecord
  has_many :context_datasets, dependent: :destroy
  has_many :datasets, through: :context_datasets
  has_many :context_owners, -> { owner }, class_name: 'ContextUser', dependent: :destroy
  has_many :owners, source: :user, through: :context_owners
  has_many :context_writers, -> { writer }, class_name: 'ContextUser', dependent: :destroy
  has_many :writers, source: :user, through: :context_writers
  has_many :context_users
  has_many :users, through: :context_users
  has_many :context_sites, dependent: :destroy
  has_many :sites, through: :context_sites

  validate :steps_validation

  accepts_nested_attributes_for :writers

  cattr_accessor :form_steps do
    {pages: %w[title sites owners writers datasets],
     names: %w[Title Sites Owners Writers Datasets]}
  end

  attr_accessor :form_step

  def site_default_context?
    context_sites.each do |context_site|
      return true if context_site.is_site_default_context
    end

    false
  end

  def dataset_default_context?
    context_datasets.each do |context_dataset|
      return true if context_dataset.is_dataset_default_context
    end

    false
  end

  private

  def steps_validation
    step_index = form_steps[:pages].index(form_step)

    # To make sure all the validations run when the context isn't created through text
    step_index ||= form_steps[:pages].length

    if form_steps[:pages].index('title') <= step_index
      if name.blank? || name.strip.blank?
        errors['name'] << 'You must enter a name for the context'
      end
    end

    if form_steps[:pages].index('sites') <= step_index
      if sites.length <= 0
        errors['sites'] << 'You must select at least one site'
      end
    end

    # No validations for now
    if form_steps[:pages].index('owners') <= step_index
    end

    # No validations for now
    if form_steps[:pages].index('writers') <= step_index
    end

    # Not validations for now
    if form_steps[:pages].index('datasets') <= step_index
    end

    # General validations

    # List of owners and writers can't overlap

  end
end


text:
<?php

namespace WireMock\Serde\TestClasses;

class DefaultedField
{
    /** @var string */
    private $defaulted = 'default';
}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Lecanora dispersa f. testacea Vain.

### Remarks
null


text:
'use strict';

module.exports = function(app) {
	var businesses = require('../controllers/businesses.server.controller');
	var businessesPolicy = require('../policies/businesses.server.policy');

	// Businesses Routes
	app.route('/api/businesses').all()
		.get(businesses.list).all(businessesPolicy.isAllowed)
		.post(businesses.create);

	app.route('/api/businesses/:businessId').all(businessesPolicy.isAllowed)
		.get(businesses.read)
		.put(businesses.update)
		.delete(businesses.delete);

	// Finish by binding the Business middleware
	app.param('businessId', businesses.businessByID);
};


text:
require 'spec_helper'

describe Locomotive::Page do

  before(:each) do
    Locomotive::Site.any_instance.stubs(:create_default_pages!).returns(true)
    Locomotive::Page.any_instance.stubs(:set_default_raw_template).returns(true)
  end

  it 'has a valid factory' do
    expect(FactoryGirl.build(:page)).to be_valid
  end

  describe 'validation' do

    %w{site title}.each do |field|
      it "requires the presence of the #{field}" do
        page = FactoryGirl.build(:page, field.to_sym => nil)
        expect(page).to_not be_valid
        expect(page.errors[field.to_sym]).to eq(["can't be blank"])
      end
    end

    it 'requires the presence of the slug' do
      page = FactoryGirl.build(:page, title: nil, slug: nil)
      expect(page).to_not be_valid
      expect(page.errors[:slug]).to eq(["can't be blank"])
    end

    it 'requires the uniqueness of the slug' do
      page = FactoryGirl.create(:page)
      another_page = FactoryGirl.build(:page, site: page.site)
      expect(another_page).to_not be_valid
      expect(another_page.errors[:slug]).to eq(["is already taken"])
    end

    it 'requires the uniqueness of the handle' do
      page = FactoryGirl.create(:page, handle: 'foo')
      another_page = FactoryGirl.build(:page, handle: 'foo', site: page.site)
      expect(another_page).to_not be_valid
      expect(another_page.errors[:handle]).to eq(["is already taken"])
    end

    it 'requires the uniqueness of the slug within a "folder"' do
      site = FactoryGirl.create(:site)
      root = FactoryGirl.create(:page, slug: 'index', site: site)
      child_1 = FactoryGirl.create(:page, slug: 'first_child', parent: root, site: site)
      page = FactoryGirl.build(:page, slug: 'first_child', parent: root, site: site)
      expect(page).to_not be_valid
      expect(page.errors[:slug]).to eq(["is already taken"])

      page.slug = 'index'
      expect(page.valid?).to eq(true)
    end

    %w{admin locomotive stylesheets images javascripts}.each do |slug|
      it "considers '#{slug}' as an invalid slug" do
        page = FactoryGirl.build(:page, slug: slug)
        page.stubs(:depth).returns(1)
        expect(page).to_not be_valid
        expect(page.errors[:slug]).to eq(["is reserved"])
      end
    end

    context '#i18n' do

      before(:each) do
        ::Mongoid::Fields::I18n.locale = 'en'
        @page = FactoryGirl.build(:page, title: 'Hello world')
        ::Mongoid::Fields::I18n.locale = 'fr'
      end

      after(:all) do
        ::Mongoid::Fields::I18n.locale = 'en'
      end

      it 'requires the presence of the title' do
        @page.title = ''
        expect(@page.valid?).to eq(false)
        expect(@page.errors[:title]).to eq(["can't be blank"])
      end

      it 'tells if a page has been translated or not' do
        expect(@page.translated?).to eq(false)
        @page.title = 'Hello world'
        expect(@page.translated?).to eq(true)
      end

    end

  end

  # Named scopes ##

  # Associations ##

  # Methods ##

  describe 'once created' do

    it 'tells if the page is the index one' do
      expect(FactoryGirl.build(:page, slug: 'index', site: nil).index?).to eq(true)
      page = FactoryGirl.build(:page, slug: 'index', site: nil)
      page.stubs(:depth).returns(1)
      expect(page.index?).to eq(false)
    end

    it 'has normalized slug' do
      page = FactoryGirl.build(:page, slug: ' Valid  ité.html ')
      page.valid?
      expect(page.slug).to eq('valid-ite-dot-html')

      page = FactoryGirl.build(:page, title: ' Valid  ité.html ', slug: nil, site: page.site)
      expect(page).to be_valid
      expect(page.slug).to eq('valid-ite-dot-html')

      page = FactoryGirl.build(:page, slug: ' convention_Valid  ité.html ')
      page.valid?
      expect(page.slug).to eq('convention_valid_ite_dot_html')
    end

    it 'has no cache strategy' do
      page = FactoryGirl.build(:page, site: nil)
      expect(page.with_cache?).to eq(false)
    end

  end

  describe '#deleting' do

    before(:each) do
      @page = FactoryGirl.build(:page)
    end

    it 'does not delete the index page' do
      @page.stubs(:index?).returns(true)
      expect {
        expect(@page.destroy).to eq(false)
        @page.errors.first == 'You can not remove index or 404 pages'
      }.to_not change(Locomotive::Page, :count)
    end

    it 'does not delete the 404 page' do
      @page.stubs(:not_found?).returns(true)
      expect {
        expect(@page.destroy).to eq(false)
        @page.errors.first == 'You can not remove index or 404 pages'
      }.to_not change(Locomotive::Page, :count)
    end

  end

  describe 'tree organization' do

    before(:each) do
      @home     = FactoryGirl.create(:page)
      @child_1  = FactoryGirl.create(:page, title: 'Subpage 1', slug: 'foo', parent_id: @home._id, site: @home.site)
    end

    it 'adds root elements' do
      page_404 = FactoryGirl.create(:page, title: 'Page not found', slug: '404', site: @home.site)
      expect(Locomotive::Page.roots.count).to eq(2)
      expect(Locomotive::Page.roots).to eq([@home, page_404])
    end

    it 'adds sub pages' do
      child_2 = FactoryGirl.create(:page, title: 'Subpage 2', slug: 'bar', parent: @home, site: @home.site)
      @home = Locomotive::Page.find(@home.id)
      expect(@home.children.count).to eq(2)
      expect(@home.children).to eq([@child_1, child_2])
    end

    it 'moves its children accordingly' do
      sub_child_1 = FactoryGirl.create(:page, title: 'Sub Subpage 1', slug: 'bar', parent: @child_1, site: @home.site)
      archives    = FactoryGirl.create(:page, title: 'archives', slug: 'archives', parent: @home, site: @home.site)
      posts       = FactoryGirl.create(:page, title: 'posts', slug: 'posts', parent: archives, site: @home.site)

      @child_1.parent = archives
      @child_1.save

      expect(@home.reload.children.count).to eq(1)

      expect(archives.reload.children.count).to eq(2)
      expect(archives.children.last.depth).to eq(2)
      expect(archives.children.last.children.first.depth).to eq(3)

    end

    it 'builds children fullpaths' do
      sub_child_1 = FactoryGirl.create(:page, title: 'Sub Subpage 1', slug: 'bar', parent: @child_1, site: @home.site)
      expect(sub_child_1.fullpath).to eq("foo/bar")
      @child_1.slug = "milky"
      @child_1.save
      expect(sub_child_1.reload.fullpath).to eq("milky/bar")
    end

    it 'destroys descendants as well' do
      FactoryGirl.create(:page, title: 'Sub Subpage 1', slug: 'bar', parent_id: @child_1._id, site: @home.site)
      @child_1.destroy
      expect(Locomotive::Page.where(slug: 'bar').first).to eq(nil)
    end

    it 'is scoped by the site' do
      another_home = FactoryGirl.create(:page, site: FactoryGirl.create('another site'))
      expect(another_home.position).to eq(0)
    end

  end

  describe 'acts as list' do

    before(:each) do
      @home = FactoryGirl.create(:page)
      @child_1 = FactoryGirl.create(:page, title: 'Subpage 1', slug: 'foo', parent: @home, site: @home.site)
      @child_2 = FactoryGirl.create(:page, title: 'Subpage 2', slug: 'bar', parent: @home, site: @home.site)
      @child_3 = FactoryGirl.create(:page, title: 'Subpage 3', slug: 'acme', parent: @home, site: @home.site)
    end

    it 'is at the bottom of the folder once created' do
      [@child_1, @child_2, @child_3].each_with_index { |c, i| expect(c.position).to eq(i) }
    end

    it 'has its position updated if a sibling is removed' do
      @child_2.destroy
      [@child_1, @child_3.reload].each_with_index { |c, i| expect(c.position).to eq(i) }
    end

    it 'uses the position passed in attributes when creating a new one' do
      page = FactoryGirl.create(:page, title: 'Contact', slug: 'contact', position: 42, parent: @home, site: @home.site)
      expect(page.position).to eq(42)
    end

  end

  describe 'templatized extension' do

    before(:each) do
      @page = FactoryGirl.build(:page, parent: FactoryGirl.build(:page, templatized: false), templatized: true, target_klass_name: 'Foo')
    end

    it 'is considered as a templatized page' do
      expect(@page.templatized?).to eq(true)
    end

    it 'fills in the slug field' do
      @page.valid?
      expect(@page.slug).to eq('content_type_template')
    end

    it 'returns the target klass' do
      expect(@page.target_klass).to eq(Foo)
    end

    it 'has a name for the target entry' do
      expect(@page.target_entry_name).to eq('foo')
    end

    it 'uses the find_by_permalink method when fetching the entry' do
      Foo.expects(:find_by_permalink)
      @page.fetch_target_entry('foo')
    end

    it 'does not accept 2 templatized pages in the same folder' do
      @home = FactoryGirl.create(:page)
      @page.attributes = { parent_id: @home._id, site: @home.site }; @page.save!

      another_page = FactoryGirl.build(:page, title: 'Lorem ipsum', parent: @home, site: @home.site, templatized: true, target_klass_name: 'Foo')
      expect(another_page.valid?).to eq(false)
      expect(another_page.errors['slug']).to eq(['is already taken'])
    end

    context '#descendants' do

      before(:each) do
        @home = FactoryGirl.create(:page)
        @page.attributes = { parent_id: @home._id, site: @home.site }; @page.save!
        @sub_page = FactoryGirl.build(:page, title: 'Subpage', slug: 'foo', parent: @page, site: @home.site, templatized: false)
      end

      it 'inherits the templatized property from its parent' do
        @sub_page.valid?
        expect(@sub_page.templatized?).to eq(true)
        expect(@sub_page.templatized_from_parent?).to eq(true)
        expect(@sub_page.target_klass_name).to eq('Foo')
      end

      it 'gets templatized if its parent is' do
        @page.attributes = { templatized: false, target_klass_name: nil }; @page.save!
        expect(@sub_page.save).to eq(true)
        expect(@sub_page.templatized?).to eq(false)

        @page.attributes = { templatized: true, target_klass_name: 'Foo' }; @page.save!
        @sub_page.reload
        expect(@sub_page.templatized?).to eq(true)
        expect(@sub_page.templatized_from_parent?).to eq(true)
        expect(@sub_page.target_klass_name).to eq('Foo')
      end

      it 'is not templatized if its parent is no more a templatized page' do
        expect(@sub_page.save).to eq(true)
        @page.templatized = false; @page.save!
        @sub_page.reload
        expect(@sub_page.templatized).to eq(false)
        expect(@sub_page.templatized_from_parent).to eq(false)
        expect(@sub_page.target_klass_name).to be_nil
      end

    end

    context 'using a content type' do

      before(:each) do
        @site = FactoryGirl.build(:site)
        @content_type = FactoryGirl.build(:content_type, slug: 'posts', site: @site)
        @page.site = @site
        @page.target_klass_name = 'Locomotive::ContentEntry5151e25587f643c2cf000001'
      end

      it 'returns nil if the content type does not exit' do
        expect(@page.content_type).to be_nil
      end

      it 'has a name for the target entry' do
        @site.stubs(:content_types).returns(mock(find: @content_type))
        expect(@page.target_entry_name).to eq('post')
      end

      it 'returns the slug of the target klass' do
        @site.stubs(:content_types).returns(mock(find: @content_type))
        expect(@page.target_klass_slug).to eq('posts')
      end

      it 'returns the target klass in a multi-thread env (mimic it)' do
        @page.target_klass_name = 'Locomotive::ContentEntry5151e25587f643c2cf000042'
        Locomotive.send(:remove_const, :'ContentEntry5151e25587f643c2cf000042')
        Locomotive::ContentType.expects(:find).with('5151e25587f643c2cf000042').returns(Foo)
        Foo.expects(:klass_with_custom_fields).returns(Foo)
        expect(@page.target_klass).to eq(Foo)
      end

      context '#security' do

        before(:each) do
          Locomotive::ContentType.stubs(:find).returns(@content_type)
        end

        it 'is valid if the content type belongs to the site' do
          @page.send(:ensure_target_klass_name_security)
          expect(@page.errors).to be_empty
        end

        it 'does not valid the page if the content type does not belong to the site' do
          @content_type.site = FactoryGirl.build(:site)
          @page.send(:ensure_target_klass_name_security)
          expect(@page.errors[:target_klass_name]).to eq(['presents a security problem'])
        end

      end

    end

  end

  describe 'listed extension' do

    it 'is considered as a visible page' do
      @page = FactoryGirl.build(:page, site: nil)
      expect(@page.listed?).to eq(true)
    end

    it 'is not considered as a visible page' do
      @page = FactoryGirl.build(:page, site: nil, listed: false)
      expect(@page.listed?).to eq(false)
    end

  end

  describe 'redirect extension' do

    before(:each) do
      @page = FactoryGirl.build(:page, site: nil, redirect: true, redirect_url: 'http://www.google.com/')
    end

    it 'is considered as a redirect page' do
      expect(@page.redirect?).to eq(true)
    end

    it 'validates the redirect_url if redirect is set' do
      @page.redirect_url = nil
      expect(@page).to_not be_valid
      expect(@page.errors[:redirect_url]).to eq(["can't be blank"])
    end

    it 'should validate format of redirect_url' do
      @page.redirect_url = "invalid url with spaces"
      expect(@page).to_not be_valid
      expect(@page.errors[:redirect_url]).to eq(["is invalid"])
    end
  end

  describe 'response type' do

    before(:each) do
      @page = FactoryGirl.build(:page, site: nil)
    end

    it 'is a HTML document by default' do
      expect(@page.response_type).to eq('text/html')
      expect(@page.default_response_type?).to eq(true)
    end

    it 'can also be a JSON document' do
      @page.response_type = 'application/json'
      expect(@page.default_response_type?).to eq(false)
    end

  end

  class Foo
  end

  class Locomotive::ContentEntry5151e25587f643c2cf000001
  end

  class Locomotive::ContentEntry5151e25587f643c2cf000042
  end

  def fake_bson_id(id)
    BSON::ObjectId.from_string(id.to_s.rjust(24, '0'))
  end

end


text:
@extends('admin.layouts.app')

@section('content')

            Registration

       @include('adminlte-templates::common.errors')

                   {!! Form::model($registration, ['route' => ['admin.registrations.update', $registration->id], 'method' => 'patch']) !!}

                        @include('admin.registrations.fields')

                   {!! Form::close() !!}

@endsection


text:
<!DOCTYPE html>

<title>Error</title>

An error occurred.

Sorry, the page you are looking for is currently unavailable.

Please try again later.

If you are the system administrator of this resource then you should check
the error log for details.

Faithfully yours, nginx.


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

package com.azure.core.experimental.util;

import com.azure.core.util.logging.ClientLogger;
import com.azure.core.util.serializer.JsonSerializer;
import com.azure.core.util.serializer.ObjectSerializer;
import com.azure.core.util.serializer.TypeReference;
import com.fasterxml.jackson.annotation.JsonGetter;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.type.TypeFactory;
import reactor.core.Disposable;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.UncheckedIOException;
import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.util.concurrent.TimeUnit;

/**
 * Codesnippets for {@link BinaryData}.
 */
public class BinaryDateJavaDocCodeSnippet {

    /**
     * Codesnippets for {@link BinaryData#fromBytes(byte[])}.
     */
    public void createFromBytes() {
        // BEGIN: com.azure.core.experimental.util.BinaryDocument.from#bytes
        final byte[] data = "Some Data".getBytes(StandardCharsets.UTF_8);
        BinaryData binaryData = BinaryData.fromBytes(data);
        System.out.println(new String(binaryData.toBytes(), StandardCharsets.UTF_8));
        // END: com.azure.core.experimental.util.BinaryDocument.from#bytes
    }

    /**
     * Codesnippets for {@link BinaryData#fromString(String)}.
     */
    public void createFromString() {
        // BEGIN: com.azure.core.experimental.util.BinaryDocument.from#String
        final String data = "Some Data";
        // Following will use default character set as StandardCharsets.UTF_8
        BinaryData binaryData = BinaryData.fromString(data);
        System.out.println(binaryData.toString());
        // END: com.azure.core.experimental.util.BinaryDocument.from#String
    }

    /**
     * Codesnippets for {@link BinaryData#fromStream(InputStream)}.
     */
    public void createFromStream() {
        // BEGIN: com.azure.core.experimental.util.BinaryDocument.from#Stream
        final byte[] data = "Some Data".getBytes(StandardCharsets.UTF_8);
        BinaryData binaryData = BinaryData.fromStream(new ByteArrayInputStream(data));
        System.out.println(binaryData.toString());
        // END: com.azure.core.experimental.util.BinaryDocument.from#Stream
    }

    /**
     * Codesnippets for {@link BinaryData#fromStream(InputStream)}.
     */
    public void createFromFlux() throws InterruptedException {
        // BEGIN: com.azure.core.experimental.util.BinaryDocument.from#Flux
        final byte[] data = "Some Data".getBytes(StandardCharsets.UTF_8);
        final Flux<ByteBuffer> dataFlux = Flux.just(ByteBuffer.wrap(data));

        Mono<BinaryData> binaryDataMono = BinaryData.fromFlux(dataFlux);

        // Lets print the value of BinaryData
        Disposable subscriber = binaryDataMono
            .map(binaryData -> {
                System.out.println(binaryData.toString());
                return true;
            })
            .subscribe();

        // So that your program wait for above subscribe to complete.
        TimeUnit.SECONDS.sleep(5);
        subscriber.dispose();
        // END: com.azure.core.experimental.util.BinaryDocument.from#Flux
    }

    /**
     * Codesnippets for {@link BinaryData#toStream()}.
     */
    public void toStream() throws IOException {
        // BEGIN: com.azure.core.experimental.util.BinaryDocument.to#Stream
        final byte[] data = "Some Data".getBytes(StandardCharsets.UTF_8);
        BinaryData binaryData = BinaryData.fromStream(new ByteArrayInputStream(data));
        final byte[] bytes = new byte[data.length];
        (binaryData.toStream()).read(bytes, 0, data.length);
        System.out.println(new String(bytes));
        // END: com.azure.core.experimental.util.BinaryDocument.to#Stream
    }

    /**
     * Codesnippets for {@link BinaryData#toObjectAsync(Class, ObjectSerializer)}.
     */
    public void createToObjectAsync() throws InterruptedException {
        // BEGIN: com.azure.core.experimental.util.BinaryDocument.to#ObjectAsync
        // Lets say we have Person object which could be serialized into json.
        class Person {
            @JsonProperty
            private String name;

            @JsonSetter
            public Person setName(String name) {
                this.name = name;
                return this;
            }

            @JsonGetter
            public String getName() {
                return name;
            }
        }
        final Person data = new Person().setName("John");

        // Ensure your classpath have the Serializer to use to serialize object. For example you can use one of
        // following library.
        // https://mvnrepository.com/artifact/com.azure/azure-core-serializer-json-jackson or
        // https://mvnrepository.com/artifact/com.azure/azure-core-serializer-json-gson

        final ObjectSerializer serializer =
            new MyJsonSerializer(); // Replace this with your Serializer
        BinaryData binaryData = BinaryData.fromObject(data, serializer);

        // Lets print the value of BinaryData
        Disposable subscriber = binaryData
            .toObjectAsync(Person.class, serializer)
            .map(person -> {
                System.out.println(person.getName());
                return true;
            })
            .subscribe();

        // So that your program wait for above subscribe to complete.
        TimeUnit.SECONDS.sleep(5);
        subscriber.dispose();
        // END: com.azure.core.experimental.util.BinaryDocument.to#ObjectAsync
    }

    public static class MyJsonSerializer implements JsonSerializer {
        private final ClientLogger logger = new ClientLogger(BinaryDataTest.MyJsonSerializer.class);
        private final ObjectMapper mapper;
        private final TypeFactory typeFactory;

        public MyJsonSerializer() {
            this.mapper = new ObjectMapper();
            this.typeFactory = mapper.getTypeFactory();
        }

        @Override
        public <T> T deserialize(InputStream stream, TypeReference<T> typeReference) {
            if (stream == null) {
                return null;
            }

            try {
                return mapper.readValue(stream, typeFactory.constructType(typeReference.getJavaType()));
            } catch (IOException ex) {
                throw logger.logExceptionAsError(new UncheckedIOException(ex));
            }
        }

        @Override
        public <T> Mono<T> deserializeAsync(InputStream stream, TypeReference<T> typeReference) {
            return Mono.fromCallable(() -> deserialize(stream, typeReference));
        }

        @Override
        public void serialize(OutputStream stream, Object value) {
            try {
                mapper.writeValue(stream, value);
            } catch (IOException ex) {
                throw logger.logExceptionAsError(new UncheckedIOException(ex));
            }
        }

        @Override
        public Mono<Void> serializeAsync(OutputStream stream, Object value) {
            return Mono.fromRunnable(() -> serialize(stream, value));
        }
    }
}


text:
jQuery(document).ready(function(){

						// Body font

				var bodyfontStatus = readCookie('bodyfontStatus');
				if(bodyfontStatus){
					jQuery('p,body,html').css("fontFamily", bodyfontStatus);
					jQuery('#bodyfont').val(bodyfontStatus);
				}
				else{
					jQuery('p,body,html').css("fontFamily", "Arial");
					jQuery('#bodyfont').val("Arial");
				}
				jQuery("#bodyfont").change(function () {
							var selectedbodyfont = jQuery('#bodyfont option:selected').val();
							createCookie('bodyfontStatus', selectedbodyfont,365);
							jQuery('p,body,html').css("fontFamily", selectedbodyfont);
					});

			// Titlefont

				var titlefontStatus = readCookie('titlefontStatus');
				if(titlefontStatus){
					jQuery('h1,h2,h3,h4,.slide-info .inner').css("fontFamily", titlefontStatus);
					jQuery('#titlefont').val(titlefontStatus);
				}
				else{
					jQuery('h1,h2,h3, h4, .slide-info').css("fontFamily", "YanoneKaffeesatz, Arial,Helvetica,  sans serif");
					jQuery('#titlefont').val("YanoneKaffeesatz, Arial,Helvetica,  sans serif");
				}
				jQuery("#titlefont").change(function () {
							var selectedfont = jQuery('#titlefont option:selected').val();
							createCookie('titlefontStatus', selectedfont,365);
							jQuery('h1,h2,h3,h4,.slide-info .inner').css("fontFamily", selectedfont);
					});

			// Menu font

				var menufontStatus = readCookie('menufontStatus');
				if(menufontStatus){
					jQuery('#tabnav li,  #primary-menu li a, .quote, a.buttonlarge').css("fontFamily", menufontStatus);
					jQuery('#menufont').val(menufontStatus);
				}
				else{
					jQuery('#tabnav li,  #primary-menu li a, .quote, a.buttonlarge').css("fontFamily", "YanoneKaffeesatz, Arial,Helvetica,  sans serif");
					jQuery('#menufont').val("YanoneKaffeesatz, Arial,Helvetica,  sans serif");
				}
				jQuery("#menufont").change(function () {
							var selectedmenufont = jQuery('#menufont option:selected').val();
							createCookie('menufontStatus', selectedmenufont,365);
							jQuery('#tabnav li,  #primary-menu li a, .quote, a.buttonlarge').css("fontFamily", selectedmenufont);
					});

			var panel = readCookie('panelOpen');

			if (panel) {
			jQuery("#options_panel").stop().css({left: "0"});

			}

			jQuery("#openPanel").hover(function(){
					jQuery("#options_panel").stop().animate({left: "0"},200,'easeOutQuad');
					var panelStatus = 'open';
					createCookie('panelOpen', panelStatus,365);
					});

			jQuery("#close").click(function(){
					eraseCookie('panelOpen');
					jQuery("#options_panel").stop().animate({left: "-188"},200,'easeOutQuad');

					});

				if(window.location == 'http://itworx.no/itworx/'){
									jQuery("#slideshow_0").attr('checked',true);
							};

				if(window.location == 'http://itworx.no/itworx/home-accordion/'){
									jQuery("#slideshow_1").attr('checked',true);
							};
				if(window.location == 'http://itworx.no/itworx/home-nivo/'){
									jQuery("#slideshow_2").attr('checked',true);
							};

				jQuery("#slideshow_0").click(function() {
                	window.location = 'http://itworx.no/itworx/';
            		});

				jQuery("#slideshow_1").click(function() {
						window.location = 'http://itworx.no/itworx/home-accordion/';
						});

				jQuery("#slideshow_2").click(function() {
							window.location = 'http://itworx.no/itworx/home-nivo/';
						});

				// Tabpanel on/off
				//jQuery("#showtabpanel").attr('checked',false);

				var tabStatus = readCookie('tabStatus');

				if(tabStatus){
					jQuery("#hometabs").hide();
					jQuery("#showtabpanel").attr('checked',false);
				}
				else{
					jQuery("#hometabs").show();
					jQuery("#showtabpanel").attr('checked',true);
				}

				jQuery("#showtabpanel").change(function () {

					if (jQuery("#showtabpanel").attr('checked')) {
						  jQuery("#hometabs").fadeIn();
						  eraseCookie('tabStatus');
					}
					else{
						jQuery("#hometabs").fadeOut();
						var tabDisplay = 'showing';
						  createCookie('tabStatus', tabDisplay,365);

					}
				});

				// Secondary on/off

				//jQuery("#showsecondary").attr('checked',false);

				var menuStatus = readCookie('menuStatus');

				if(menuStatus){
					jQuery("#header_top").show();
					jQuery("#showsecondary").attr('checked',true);
				}
				else{
					jQuery("#header_top").hide();
					jQuery("#showsecondary").attr('checked',false);
				}

				jQuery("#showsecondary").change(function () {

					if (jQuery("#showsecondary").attr('checked')) {
						  jQuery("#header_top").fadeIn('fast');
						  var menuDisplay = 'showing';
						  createCookie('menuStatus', menuDisplay,365);
					}
					else{
						jQuery("#header_top").fadeOut('fast');
						eraseCookie('menuStatus');
					}
				});

				// Articles on/off (Default ON)

				var articlesStatus = readCookie('articlesStatus');

					if(articlesStatus){
						jQuery("#phi_home_article").hide();
						jQuery("#showarticles").attr('checked',false);
					}
					else{
						jQuery("#phi_home_article").show();
						jQuery("#showarticles").attr('checked',true);
					}

				jQuery('#showarticles').change(function () {

					if (jQuery("#showarticles").attr('checked')) {
						  jQuery("#phi_home_article").fadeIn('fast');
						  eraseCookie('articlesStatus');

					}
					else{
						jQuery("#phi_home_article").fadeOut('fast');
						 var articleDisplay = 'showing';
						 createCookie('articlesStatus', articleDisplay,365);

					}
				});

				// FEATURED PAGES ON/OFF

				var featuredStatus = readCookie('featuredStatus');

				if(featuredStatus){
					jQuery("#featuredpages").hide();
					jQuery("#showfeatured").attr('checked',false);
				}
				else{
					jQuery("#featuredpages").show();
					jQuery("#showfeatured").attr('checked',true);
				}

				jQuery("#showfeatured").change(function () {

					if (jQuery("#showfeatured").attr('checked')) {
						  jQuery("#featuredpages").fadeIn();
						 eraseCookie('featuredStatus');
					}
					else{
						jQuery("#featuredpages").fadeOut();
						 var featuredDisplay = 'showing';
						  createCookie('featuredStatus', featuredDisplay,365);
					}
				});

				// Blog posts  on/off
				var blogStatus = readCookie('blogStatus');

				if(blogStatus){
					jQuery("#home_blog").show();
					jQuery("#showblog").attr('checked',true);
				}
				else{
					jQuery("#home_blog").hide();
					jQuery("#showblog").attr('checked',false);
				}

				jQuery("#showblog").change(function () {

					if (jQuery("#showblog").attr('checked')) {
						  jQuery("#home_blog").fadeIn();
						    var blogDisplay = 'showing';
						  createCookie('blogStatus', blogDisplay,365);
					}
					else{
						jQuery("#home_blog").fadeOut();
						eraseCookie('blogStatus');
					}
				});

				// Widgets posts  on/off

				var w1Status = readCookie('w1Status');

				if(w1Status){
					jQuery("#homewidget1").hide();
					jQuery("#showwidget1").attr('checked',false);
				}
				else{
					jQuery("#homewidget1").show();
					jQuery("#showwidget1").attr('checked',true);
				}

				jQuery('#showwidget1').change(function () {

					if (jQuery("#showwidget1").attr('checked')) {
						  jQuery("#homewidget1").fadeIn();
						  eraseCookie('w1Status');
					}
					else {
						jQuery("#homewidget1").fadeOut()
						 var w1Display = 'showing';
						  createCookie('w1Status', w1Display,365);
					};
				});

				// Widget 2

				var widget2Status = readCookie('w2Status');

				if(widget2Status){
					jQuery("#homewidget2").show();
					jQuery("#showwidget2").attr('checked',true);
				}
				else{
					jQuery("#homewidget2").hide();
					jQuery("#showwidget2").attr('checked',false);
				}

				jQuery("#showwidget2").change(function () {

					if (jQuery("#showwidget2").attr('checked')) {
						  jQuery("#homewidget2").fadeIn();
						  var w2Display = 'showing';
						  createCookie('w2Status', w2Display,365);
					}
					else{
						jQuery("#homewidget2").fadeOut();
						eraseCookie('w2Status');
					}
				});

				// Widget 3

				var widget3Status = readCookie('w3Status');

				if(widget3Status){
					jQuery("#homewidget3").show();
					jQuery("#showwidget3").attr('checked',true);
				}
				else{
					jQuery("#homewidget3").hide();
					jQuery("#showwidget3").attr('checked',false);
				}

				jQuery("#showwidget3").change(function () {

					if (jQuery("#showwidget3").attr('checked')) {
						  jQuery("#homewidget3").fadeIn();
						  var w3Display = 'showing';
						  createCookie('w3Status', w3Display,365);
					}
					else{
						jQuery("#homewidget3").fadeOut();
						eraseCookie('w3Status');
					}
				});

				// Widget 4

				var widget4Status = readCookie('w4Status');

				if(widget4Status){
					jQuery("#homewidget4").show();
					jQuery("#showwidget4").attr('checked',true);
				}
				else{
					jQuery("#homewidget4").hide();
					jQuery("#showwidget4").attr('checked',false);
				}

				jQuery("#showwidget4").change(function () {

					if (jQuery("#showwidget4").attr('checked')) {
						  jQuery("#homewidget4").fadeIn();
						  var w4Display = 'showing';
						  createCookie('w4Status', w4Display,365);
					}
					else{
						jQuery("#homewidget4").fadeOut();
						eraseCookie('w4Status');
					}
				});

			// Toggle on off cookie

			// Background color

			var bc = readCookie('bCol');

			if (bc) {
			jQuery('#colorSelector div').css('backgroundColor', bc);
			jQuery('body, html').css('backgroundColor',  bc);
			}

			jQuery('#colorSelector').ColorPicker({
				color: '#555',
				onShow: function (colpkr) {
					jQuery(colpkr).fadeIn(500);
					return false;
				},
				onHide: function (colpkr) {
					var bgc = jQuery('body').css('backgroundColor');
					//	alert(bgc);
					jQuery(colpkr).fadeOut(500);

					createCookie('bCol', bgc,365);

					return false;
				},
				onChange: function (hsb, hex, rgb) {

					jQuery('#colorSelector div').css('backgroundColor', '#' + hex);
					jQuery('body, html').css('backgroundColor', '#' + hex);

				}

			 });

			// Link color

			var lc = readCookie('lCol');

			if (lc) {
			jQuery('#colorSelector2 div').css('backgroundColor', lc);

			jQuery('#content a').not("#tabnav li a, .tabcontent .inner a, #pager ul li.current a, a.button, a.lightbtn, a.darkbtn, #kwicks a, a.buttonlarge, a.buttonmedium").css('color', lc);
			jQuery('a.button, input[type=submit], input[type=reset],a.buttonlarge, a.buttonmedium').not("a.lightbtn, a.darkbtn").css('backgroundColor', lc);
			};

			jQuery('#colorSelector2').ColorPicker({
				color: '#555',
				onShow: function (colpkr) {
					jQuery(colpkr).fadeIn(500);
					return false;
				},
				onHide: function (colpkr) {
					var lc = jQuery('#content a').css('color');

					//	alert(bgc);
					jQuery(colpkr).fadeOut(500);

					createCookie('lCol', lc,365);

					return false;
				},
				onChange: function (hsb, hex, rgb) {

					jQuery('#colorSelector2 div').css('backgroundColor', '#' + hex);
					jQuery('#content a').not("#tabnav li a, .tabcontent .inner a, #pager ul li.current a, a.button, a.lightbtn, a.darkbtn, #kwicks a,a.buttonlarge, a.buttonmedium").css('color', '#' + hex);
					jQuery('a.button,input[type=submit], input[type=reset], a.buttonlarge, a.buttonmedium').not("a.lightbtn, a.darkbtn").css('backgroundColor', '#' + hex);
					}
 				});

			// Menu color

			var mc = readCookie('mCol');

			if (mc) {
			jQuery('#colorSelector3 div').css('backgroundColor', mc);
			jQuery('#primary').css('backgroundColor', mc);
			}

			jQuery('#colorSelector3').ColorPicker({
				color: '#555',
				onShow: function (colpkr) {
					jQuery(colpkr).fadeIn(500);
					return false;
				},
				onHide: function (colpkr) {
					var mc = jQuery('#primary').css('backgroundColor');
					//	alert(bgc);
					jQuery(colpkr).fadeOut(500);

					createCookie('mCol', mc,365);

					return false;
				},
				onChange: function (hsb, hex, rgb) {

					jQuery('#colorSelector3 div').css('backgroundColor', '#' + hex);
					jQuery('#primary').css('backgroundColor', '#' + hex);

					}
 				});

				// Reset cookies
				jQuery('#resetColor').click(function(){

						eraseCookie('bCol');
						eraseCookie('lCol');
						eraseCookie('mCol');
						eraseCookie('menuStatus');
						eraseCookie('tabStatus');
						eraseCookie('articlesStatus');
						eraseCookie('featuredStatus');
						eraseCookie('blogStatus');
						eraseCookie('w1Status');
						eraseCookie('w2Status');
						eraseCookie('w3Status');
						eraseCookie('w4Status');
						eraseCookie('menufontStatus');
						eraseCookie('bodyfontStatus');
						eraseCookie('titlefontStatus');
				});
});

function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}


text:
var Animal = (function () {
    function Animal(name, age) {
        this.name = name;
        this.age = age;
    }
    Animal.prototype.toString = function () {
        return this.name + ' ' + this.age;
    };
    return Animal;
}());

var Cat = (function (parent) {
    function Cat(name, age, sleep) {
        parent.call(this, name, age);
        this.sleep = sleep;
        //return this;
    }
        Cat.prototype = new Animal();

        Cat.prototype.toString = function () {
            var baseResult = parent.prototype.toString.call(this);
            return baseResult + ' ' + this.sleep;

        };

    return Cat;
}(Animal));

var blackCat = new Cat('Fee', 2, true);

console.log(blackCat);
//var mf = blackCat.toString();
console.log(blackCat.toString());
//console.log(blackCat.toList());
//console.log(mf);


text:
mapCliente
==========

Mapa de Clientes da DRZ


text:
export default /* glsl */`
float getShadowMask() {

	float shadow = 1.0;

	#ifdef USE_SHADOWMAP

	#if NUM_DIR_LIGHT_SHADOWS > 0

	DirectionalLight directionalLight;

	#pragma unroll_loop
	for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {

		directionalLight = directionalLights[ i ];
		shadow *= all( bvec2( directionalLight.shadow, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;

	}

	#endif

	#if NUM_SPOT_LIGHT_SHADOWS > 0

	SpotLight spotLight;

	#pragma unroll_loop
	for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {

		spotLight = spotLights[ i ];
		shadow *= all( bvec2( spotLight.shadow, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;

	}

	#endif

	#if NUM_POINT_LIGHT_SHADOWS > 0

	PointLight pointLight;

	#pragma unroll_loop
	for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {

		pointLight = pointLights[ i ];
		shadow *= all( bvec2( pointLight.shadow, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;

	}

	#endif

	/*
	#if NUM_RECT_AREA_LIGHTS > 0

		// TODO (abelnation): update shadow for Area light

	#endif
	*/

	#endif

	return shadow;

}
`;


text:
import { DewPoint24 } from "../../";

export = DewPoint24;


text:
hubba-hubba
===========

My own little directory of the greatest repos.