text:
<!DOCTYPE html>

    <title>Chapter 30: In Which Phileas Fogg Simply Does His Duty | Around the World in 80 Days | Jules Verne | Lit2Go ETC</title>
    <link rel="stylesheet" href="http://etc.usf.edu/lit2go/css/screenless.css" type="text/css" media="screen" title="no title" charset="utf-8">
    <link rel="stylesheet" href="http://etc.usf.edu/lit2go/css/printless.css" type="text/css" media="print" title="no title" charset="utf-8">

          Lit2Go

<form action="http://etc.usf.edu/lit2go/search/"><input type="text" name="q" placeholder="Search" value=""></form>

Authors

Books

Genres

Collections

Readability

      Around the World in 80 Days

      by Jules Verne

      Chapter 30: In Which Phileas Fogg Simply Does His Duty

        Additional Information

            Year Published:
            1873

            Language:
            English

            Country of Origin:
            France

            Source:
            Verne, J. (1873)  Around the World in 80 Days  Paris, France: Routledge

            Readability:

                Flesch–Kincaid Level:
                8.0

            Word Count:
            2,258

            Genre:
            Adventure

            Keywords:
            19th century literature, adventure, french literature

            ✎ Cite This

  Share
  |

Downloads

          Audio

            APA

            MLA

            Chicago

            Verne, J. (1873). Chapter 30: In Which Phileas Fogg Simply Does His Duty. Around the World in 80 Days (Lit2Go Edition). Retrieved February 15, 2016, from http://etc.usf.edu/lit2go/55/around-the-world-in-80-days/1075/chapter-30-in-which-phileas-fogg-simply-does-his-duty/

            Verne, Jules. "Chapter 30: In Which Phileas Fogg Simply Does His Duty." Around the World in 80 Days. Lit2Go Edition. 1873. Web. <http://etc.usf.edu/lit2go/55/around-the-world-in-80-days/1075/chapter-30-in-which-phileas-fogg-simply-does-his-duty/>. February 15, 2016.

            Jules Verne, "Chapter 30: In Which Phileas Fogg Simply Does His Duty," Around the World in 80 Days, Lit2Go Edition, (1873), accessed February 15, 2016, http://etc.usf.edu/lit2go/55/around-the-world-in-80-days/1075/chapter-30-in-which-phileas-fogg-simply-does-his-duty/.

Back

Next

                  <audio controls style="width:99%;">
            <source src="http://etc.usf.edu/lit2go/audio/mp3/around-the-world-in-80-days-030-chapter-30-in-which-phileas-fogg-simply-does-his-duty.1075.mp3" type="audio/mpeg" />
                          <source src="http://etc.usf.edu/lit2go/audio/ogg/around-the-world-in-80-days-030-chapter-30-in-which-phileas-fogg-simply-does-his-duty.1075.ogg" type="audio/ogg" />
                        The embedded audio player requires a modern internet browser. You should visit Browse Happy and update your internet browser today!
          </audio>

	Three passengers including Passepartout had disappeared. Had they been killed in the struggle? Were they taken prisoners by the Sioux? It was impossible to tell.

	There were many wounded, but none mortally. Colonel Proctor was one of the most seriously hurt; he had fought bravely, and a ball had entered his groin. He was carried into the station with the other wounded passengers, to receive such attention as could be of avail.

	Aouda was safe; and Phileas Fogg, who had been in the thickest of the fight, had not received a scratch. Fix was slightly wounded in the arm. But Passepartout was not to be found, and tears coursed down Aouda's cheeks.

	All the passengers had got out of the train, the wheels of which were stained with blood. From the tyres and spokes hung ragged pieces of flesh. As far as the eye could reach on the white plain behind, red trails were visible. The last Sioux were disappearing in the south, along the banks of Republican River.

	Mr. Fogg, with folded arms, remained motionless. He had a serious decision to make. Aouda, standing near him, looked at him without speaking, and he understood her look. If his servant was a prisoner, ought he not to risk everything to rescue him from the Indians? "I will find him, living or dead," said he quietly to Aouda.

	"Ah, Mr.—Mr. Fogg!" cried she, clasping his hands and covering them with tears.

	"Living," added Mr. Fogg, "if we do not lose a moment."

	Phileas Fogg, by this resolution, inevitably sacrificed himself; he pronounced his own doom. The delay of a single day would make him lose the steamer at New York, and his bet would be certainly lost. But as he thought, "It is my duty," he did not hesitate.

	The commanding officer of Fort Kearney was there. A hundred of his soldiers had placed themselves in a position to defend the station, should the Sioux attack it.

	"Sir," said Mr. Fogg to the captain, "three passengers have disappeared."

	"Dead?" asked the captain.

	"Dead or prisoners; that is the uncertainty which must be solved. Do you propose to pursue the Sioux?"

	"That's a serious thing to do, sir," returned the captain. "These Indians may retreat beyond the Arkansas, and I cannot leave the fort unprotected."

	"The lives of three men are in question, sir," said Phileas Fogg.

	"Doubtless; but can I risk the lives of fifty men to save three?"

	"I don't know whether you can, sir; but you ought to do so."

	"Nobody here," returned the other, "has a right to teach me my duty."

	"Very well," said Mr. Fogg, coldly. "I will go alone."

	"You, sir!" cried Fix, coming up; "you go alone in pursuit of the Indians?"

	"Would you have me leave this poor fellow to perish—him to whom every one present owes his life? I shall go."

	"No, sir, you shall not go alone," cried the captain, touched in spite of himself. "No! you are a brave man. Thirty volunteers!" he added, turning to the soldiers.

	The whole company started forward at once. The captain had only to pick his men. Thirty were chosen, and an old sergeant placed at their head.

	"Thanks, captain," said Mr. Fogg.

	"Will you let me go with you?" asked Fix.

	"Do as you please, sir. But if you wish to do me a favour, you will remain with Aouda. In case anything should happen to me—"

	A sudden pallor overspread the detective's face. Separate himself from the man whom he had so persistently followed step by step! Leave him to wander about in this desert! Fix gazed attentively at Mr. Fogg, and, despite his suspicions and of the struggle which was going on within him, he lowered his eyes before that calm and frank look.

	"I will stay," said he.

	A few moments after, Mr. Fogg pressed the young woman's hand, and, having confided to her his precious carpet–bag, went off with the sergeant and his little squad. But, before going, he had said to the soldiers, "My friends, I will divide five thousand dollars among you, if we save the prisoners."

	It was then a little past noon.

	Aouda retired to a waiting–room, and there she waited alone, thinking of the simple and noble generosity, the tranquil courage of Phileas Fogg. He had sacrificed his fortune, and was now risking his life, all without hesitation, from duty, in silence.

	Fix did not have the same thoughts, and could scarcely conceal his agitation. He walked feverishly up and down the platform, but soon resumed his outward composure. He now saw the folly of which he had been guilty in letting Fogg go alone. What! This man, whom he had just followed around the world, was permitted now to separate himself from him! He began to accuse and abuse himself, and, as if he were director of police, administered to himself a sound lecture for his greenness.

	"I have been an idiot!" he thought, "and this man will see it. He has gone, and won't come back! But how is it that I, Fix, who have in my pocket a warrant for his arrest, have been so fascinated by him? Decidedly, I am nothing but an ass!"

	So reasoned the detective, while the hours crept by all too slowly. He did not know what to do. Sometimes he was tempted to tell Aouda all; but he could not doubt how the young woman would receive his confidences. What course should he take? He thought of pursuing Fogg across the vast white plains; it did not seem impossible that he might overtake him. Footsteps were easily printed on the snow! But soon, under a new sheet, every imprint would be effaced.

	Fix became discouraged. He felt a sort of insurmountable longing to abandon the game altogether. He could now leave Fort Kearney station, and pursue his journey homeward in peace.

	Towards two o'clock in the afternoon, while it was snowing hard, long whistles were heard approaching from the east. A great shadow, preceded by a wild light, slowly advanced, appearing still larger through the mist, which gave it a fantastic aspect. No train was expected from the east, neither had there been time for the succour asked for by telegraph to arrive; the train from Omaha to San Francisco was not due till the next day. The mystery was soon explained.

	The locomotive, which was slowly approaching with deafening whistles, was that which, having been detached from the train, had continued its route with such terrific rapidity, carrying off the unconscious engineer and stoker. It had run several miles, when, the fire becoming low for want of fuel, the steam had slackened; and it had finally stopped an hour after, some twenty miles beyond Fort Kearney. Neither the engineer nor the stoker was dead, and, after remaining for some time in their swoon, had come to themselves. The train had then stopped. The engineer, when he found himself in the desert, and the locomotive without cars, understood what had happened. He could not imagine how the locomotive had become separated from the train; but he did not doubt that the train left behind was in distress.

	He did not hesitate what to do. It would be prudent to continue on to Omaha, for it would be dangerous to return to the train, which the Indians might still be engaged in pillaging. Nevertheless, he began to rebuild the fire in the furnace; the pressure again mounted, and the locomotive returned, running backwards to Fort Kearney. This it was which was whistling in the mist.

	The travellers were glad to see the locomotive resume its place at the head of the train. They could now continue the journey so terribly interrupted.

	Aouda, on seeing the locomotive come up, hurried out of the station, and asked the conductor, "Are you going to start?"

	"At once, madam."

	"But the prisoners, our unfortunate fellow–travellers—"

	"I cannot interrupt the trip," replied the conductor. "We are already three hours behind time."

	"And when will another train pass here from San Francisco?"

	"To–morrow evening, madam."

	"To–morrow evening! But then it will be too late! We must wait—"

	"It is impossible," responded the conductor. "If you wish to go, please get in."

	"I will not go," said Aouda.

	Fix had heard this conversation. A little while before, when there was no prospect of proceeding on the journey, he had made up his mind to leave Fort Kearney; but now that the train was there, ready to start, and he had only to take his seat in the car, an irresistible influence held him back. The station platform burned his feet, and he could not stir. The conflict in his mind again began; anger and failure stifled him. He wished to struggle on to the end.

	Meanwhile the passengers and some of the wounded, among them Colonel Proctor, whose injuries were serious, had taken their places in the train. The buzzing of the over–heated boiler was heard, and the steam was escaping from the valves. The engineer whistled, the train started, and soon disappeared, mingling its white smoke with the eddies of the densely falling snow.

	The detective had remained behind.

	Several hours passed. The weather was dismal, and it was very cold. Fix sat motionless on a bench in the station; he might have been thought asleep. Aouda, despite the storm, kept coming out of the waiting–room, going to the end of the platform, and peering through the tempest of snow, as if to pierce the mist which narrowed the horizon around her, and to hear, if possible, some welcome sound. She heard and saw nothing. Then she would return, chilled through, to issue out again after the lapse of a few moments, but always in vain.

	Evening came, and the little band had not returned. Where could they be? Had they found the Indians, and were they having a conflict with them, or were they still wandering amid the mist? The commander of the fort was anxious, though he tried to conceal his apprehensions. As night approached, the snow fell less plentifully, but it became intensely cold. Absolute silence rested on the plains. Neither flight of bird nor passing of beast troubled the perfect calm.

	Throughout the night Aouda, full of sad forebodings, her heart stifled with anguish, wandered about on the verge of the plains. Her imagination carried her far off, and showed her innumerable dangers. What she suffered through the long hours it would be impossible to describe.

	Fix remained stationary in the same place, but did not sleep. Once a man approached and spoke to him, and the detective merely replied by shaking his head.

	Thus the night passed. At dawn, the half–extinguished disc of the sun rose above a misty horizon; but it was now possible to recognise objects two miles off. Phileas Fogg and the squad had gone southward; in the south all was still vacancy. It was then seven o'clock.

	The captain, who was really alarmed, did not know what course to take.

	Should he send another detachment to the rescue of the first? Should he sacrifice more men, with so few chances of saving those already sacrificed? His hesitation did not last long, however. Calling one of his lieutenants, he was on the point of ordering a reconnaissance, when gunshots were heard. Was it a signal? The soldiers rushed out of the fort, and half a mile off they perceived a little band returning in good order.

	Mr. Fogg was marching at their head, and just behind him were Passepartout and the other two travellers, rescued from the Sioux.

	They had met and fought the Indians ten miles south of Fort Kearney. Shortly before the detachment arrived, Passepartout and his companions had begun to struggle with their captors, three of whom the Frenchman had felled with his fists, when his master and the soldiers hastened up to their relief.

	All were welcomed with joyful cries. Phileas Fogg distributed the reward he had promised to the soldiers, while Passepartout, not without reason, muttered to himself, "It must certainly be confessed that I cost my master dear!"

	Fix, without saying a word, looked at Mr. Fogg, and it would have been difficult to analyse the thoughts which struggled within him. As for Aouda, she took her protector's hand and pressed it in her own, too much moved to speak.

	Meanwhile, Passepartout was looking about for the train; he thought he should find it there, ready to start for Omaha, and he hoped that the time lost might be regained.

	"The train! the train!" cried he.

	"Gone," replied Fix.

	"And when does the next train pass here?" said Phileas Fogg.

	"Not till this evening."

	"Ah!" returned the impassible gentleman quietly.

Back

Next

            This collection of children's literature is a part of the Educational Technology Clearinghouse and is funded by various grants.

            Copyright © 2006—2016 by the Florida Center for Instructional Technology, College of Education, University of South Florida.

License

Credits

FAQ

Giving

This document was downloaded from Lit2Go, a free online collection of stories and poems in Mp3 (audiobook) format published by the Florida Center for Instructional Technology. For more information, including classroom activities, readability data, and original sources, please visit http://etc.usf.edu/lit2go/55/around-the-world-in-80-days/1075/chapter-30-in-which-phileas-fogg-simply-does-his-duty/.

Lit2Go: Around the World in 80 Days

Chapter 30: In Which Phileas Fogg Simply Does His Duty


text:
define(['knockout.extenders', 'knockout'], function (extenders, ko) {

    describe('knockout.extenders', function () {

        it('defines a knockout extender called trackDirtyWithInitialStateOf', function () {
            expect(ko.extenders.trackDirtyWithInitialStateOf).toBeDefined();
        });

        describe('trackDirtyWithInitialStateOf', function () {
            it('adds a isDirty-Function to a given observable', function () {
                var obs = ko.observable().extend({ trackDirtyWithInitialStateOf: false });
                expect(obs.isDirty).toBeDefined();
            });
            it('adds a markClean-Function to a given observable', function () {
                var obs = ko.observable().extend({ trackDirtyWithInitialStateOf: false });
                expect(obs.markClean).toBeDefined();
            });
            it('adds a markDirty-Function to a given observable', function () {
                var obs = ko.observable().extend({ trackDirtyWithInitialStateOf: false });
                expect(obs.markDirty).toBeDefined();
            });

            describe('isDirty-Function', function () {
                it('returns true when the initial state was true', function () {
                    var obs = ko.observable().extend({ trackDirtyWithInitialStateOf: true });
                    expect(obs.isDirty()).toBe(true);
                });
                it('returns false when the initial state was false', function () {
                    var obs = ko.observable().extend({ trackDirtyWithInitialStateOf: false });
                    expect(obs.isDirty()).toBe(false);
                });
                it('returns true after the observable has been changed', function () {
                    var obs = ko.observable(false).extend({ trackDirtyWithInitialStateOf: false });
                    obs(true);
                    expect(obs.isDirty()).toBe(true);
                });
                it('returns true after a nested observable property ob the observable has been changed', function () {
                    var vm = {
                        test1: ko.observable({ test2: ko.observable(2) })
                    };
                    var obs = ko.observable(vm).extend({ trackDirtyWithInitialStateOf: false });
                    var dirty1 = obs.isDirty();
                    obs().test1().test2(3);
                    var dirty2 = obs.isDirty();
                    expect(dirty1).toBe(false);
                    expect(dirty2).toBe(true);
                });
                it('returns false after markClean has been called', function () {
                    var obs = ko.observable().extend({ trackDirtyWithInitialStateOf: true });
                    obs.markClean();
                    expect(obs.isDirty()).toBe(false);
                });
                it('returns true after markDirty has been called', function () {
                    var obs = ko.observable().extend({ trackDirtyWithInitialStateOf: false });
                    obs.markDirty();
                    expect(obs.isDirty()).toBe(true);
                });
            });
        });

    });

});

redpajama_set_name: RedPajamaGithub


text:
package factors.discrete;

import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import factors.Factor;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import primitives.EventStream;

import java.util.Arrays;
import java.util.List;
import java.util.stream.IntStream;

class JointProbabilityDistributionTest {
  private final double threshold = 10e-8;
  List<String> variables = Lists.newArrayList("I", "D", "G");
  List<Integer> cardinality = Lists.newArrayList(2, 2, 3);
  double[] values =  new double[]{
      0.126, 0.168, 0.126,
      0.009, 0.045, 0.126,
      0.252, 0.0224, 0.0056,
      0.06, 0.036, 0.024
  };

  JointProbabilityDistribution jpd = null;

  @BeforeEach void setUp() {
    jpd = new JointProbabilityDistribution(variables, cardinality, values);
  }

  @Test void testThrowsWhenValuesDontSumToOne() {
    Assertions.assertNotEquals(null, jpd);
    Assertions.assertThrows(RuntimeException.class, () -> {
      new JointProbabilityDistribution(variables, cardinality, new double[12]);
    });
    Assertions.assertThrows(RuntimeException.class, () -> {
      new JointProbabilityDistribution(variables, cardinality,
          IntStream.range(0, 12).mapToDouble(Double::new).toArray());
    });
  }

  @Test void testCopy() {
    JointProbabilityDistribution result = (JointProbabilityDistribution) jpd.copy();

    Assertions.assertTrue(Iterables.elementsEqual(result.getScope(), jpd.getScope()));
    Assertions.assertTrue(Iterables.elementsEqual(result.getCardinality(), jpd.getCardinality()));
    Assertions.assertArrayEquals(result.getValues(), jpd.getValues(), threshold);
  }

  @Test void testNormalize() {
    jpd.normalize(true);

    double actualValueSum = Arrays.stream(jpd.getValues()).sum();

    Assertions.assertEquals(1.0, actualValueSum, threshold);
  }

  @Test void testReduce() {
    double[] iReduction = new double[]{0.252, 0.0224, 0.0056, 0.06, 0.036, 0.024};
    double iSum = Arrays.stream(iReduction).sum();
    double[] expectedValues = Arrays.stream(iReduction)
        .map(v -> v / iSum)
        .toArray();
    EventStream reudction = new EventStream("I=1");

    Factor factor = jpd.reduce(reudction.getEvents(), false);

    // Check new factor is reduced version
    Assertions.assertTrue(Iterables.elementsEqual(Lists.newArrayList( "D", "G"), factor.getScope()));
    Assertions.assertTrue(Iterables.elementsEqual(Lists.newArrayList( 2, 3), ((JointProbabilityDistribution)factor).getCardinality()));
    Assertions.assertArrayEquals(expectedValues, ((JointProbabilityDistribution)factor).getValues(), threshold);
    Assertions.assertEquals(1.0, Arrays.stream(((JointProbabilityDistribution) factor).getValues()).sum(), threshold);
    // Check existing factor has not changed
    Assertions.assertTrue(Iterables.elementsEqual(variables, jpd.getScope()));
    Assertions.assertTrue(Iterables.elementsEqual(cardinality, jpd.getCardinality()));
    Assertions.assertArrayEquals(values, jpd.getValues(), threshold);

    jpd.reduce(reudction.getEvents(), true);

    Assertions.assertTrue(Iterables.elementsEqual(Lists.newArrayList( "D", "G"), jpd.getScope()));
    Assertions.assertTrue(Iterables.elementsEqual(Lists.newArrayList( 2, 3), jpd.getCardinality()));
    Assertions.assertArrayEquals(expectedValues, jpd.getValues(), threshold);
    Assertions.assertEquals(1.0, Arrays.stream(jpd.getValues()).sum(), threshold);
  }
}


text:
<?xml version="1.0"?>
<project xmlns="https://maven.apache.org/POM/4.0.0"
         xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="https://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>org.sonatype.oss</groupId>
    <artifactId>oss-parent</artifactId>
    <version>7</version>
  </parent>

  <groupId>com.twitter.hdfsdu</groupId>
  <artifactId>hdfsdu</artifactId>
  <version>0.1.0</version>
  <packaging>pom</packaging>

  <name>hdfsdu</name>
  <url>https://github.com/twitter/hdfs-du</url>
  <description>Visualize your HDFS cluster.</description>

  <licenses>
    <license>
      <name>Apache License</name>
      <url>http://www.apache.org/licenses/LICENSE-2.0</url>
    </license>
  </licenses>

  <developers>
    <developer>
      <id>@tc</id>
      <name>Travis Crawford</name>
      <email>travis@twitter.com</email>
      <organization>Twitter, Inc.</organization>
      <organizationUrl>http://www.twitter.com</organizationUrl>
      <roles>
        <role>architect</role>
        <role>developer</role>
      </roles>
    </developer>
    <developer>
      <id>@philogb</id>
      <name>Nicolas Belmonte</name>
      <email>nbelmonte@twitter.com</email>
      <organization>Twitter, Inc.</organization>
      <organizationUrl>http://www.twitter.com</organizationUrl>
      <roles>
        <role>architect</role>
        <role>developer</role>
      </roles>
    </developer>
    <developer>
      <id>@trebor</id>
      <name>Robert Harris</name>
      <email>trebor@twitter.com</email>
      <organization>Twitter, Inc.</organization>
      <organizationUrl>http://www.twitter.com</organizationUrl>
      <roles>
        <role>architect</role>
        <role>developer</role>
      </roles>
    </developer>
  </developers>

  <repositories>
    <repository>
      <id>twitter</id>
      <url>https://maven.twttr.com</url>
    </repository>
  </repositories>
  <pluginRepositories>
    <pluginRepository>
      <id>twitter</id>
      <url>https://maven.twttr.com</url>
    </pluginRepository>
  </pluginRepositories>

  <modules>
    <module>pig</module>
    <module>service</module>
  </modules>

</project>


text:
describe('svhn', function()
  describe('All test should pass', function()
    it('should check normalization parameters', function()
      assert.truthy('Yup.')
    end)

    it('should check model layer parameters', function()
      -- deep check comparisons!
      assert.same({ table = 'great'}, { table = 'great' })

      -- or check by reference!
      assert.is_not.equals({ table = 'great'}, { table = 'great'})

      assert.falsy(nil)
      assert.error(function() error('Wat') end)
    end)

    it('should provide loss function', function()
      assert.unique({{ thing = 1 }, { thing = 2 }, { thing = 3 }})
    end)

  end)
end)


text:
var express = require('express');
var bodyParser = require('body-parser');
var db = require('./db.js');
process.env.PWD = process.cwd();

// Initialize db
db.init();

// Initialize server
var app = express();
app.set('view engine', 'pug');
app.set('views', './src');
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({extended: true}));

// Serve all static content in the public folder
app.use(express.static(process.env.PWD + '/public'));

// Serve rendered pug templates for pages
app.get('/', function(req, res) {
  res.render('pages/home');
});
app.get('/new', function(req, res) {
  res.render('pages/add_review');
});
app.get('/browse', function(req, res) {
  db.selectReviews(function(reviewResults) {
    var sortedReviews = reviewResults.sort(function(a, b) {
      return new Date(a.date_added) - new Date(b.date_added);
    });
    res.render('pages/browse', {reviews: sortedReviews});
  });
});
app.get('/review/:id', function(req, res) {
  db.selectReviewById(req.params.id, function(result) {
    res.render('pages/review', result);
  });
});
app.get('/item/:id', function(req, res) {
  db.selectItemById(req.params.id, function(itemResult) {
    db.selectReviews(function(reviewResults) {
      var filteredReviews = reviewResults.filter(function(reviewResult) {
        return reviewResult.item_id == itemResult.id;
      });
      itemResult.reviews = filteredReviews;
      res.render('pages/item', itemResult);
    });
  });
});
app.get('/company/:id', function(req, res) {
  db.selectCompanyById(req.params.id, function(companyResult) {
    db.selectReviews(function(reviewResults) {
      var filteredReviews = reviewResults.filter(function(reviewResult) {
        return reviewResult.company_id == companyResult.id;
      });
      companyResult.reviews = filteredReviews;
      res.render('pages/company', companyResult);
    });
  });
});
app.get('/README.md', function(req, res) {
  res.sendFile(process.env.PWD + '/README.md');
});

// Serve API endpoints
app.get('/api/companies', function(req, res) {
  db.selectCompanies(function(results) {
    res.send(results);
  });
});
app.get('/api/items', function(req, res) {
  db.selectItems(function(results) {
    res.send(results);
  });
});
app.get('/api/reviews', function(req, res) {
  db.selectReviews(function(results) {
    res.send(results);
  });
});
app.get('/api/companies/search', function(req, res) {
  const query = req.query.q;
  db.searchCompanies(query, res);
});
app.get('/api/items/search', function(req, res) {
  const query = req.query.q;
  db.searchItems(query, res);
});
app.get('/api/categories/search', function(req, res) {
  const query = req.query.q;
  db.searchCategories(query, res);
});
app.post('/api/reviews', function(req, res) {
  db.postReview(req.body, res);
});

const port = (process.env.PORT) || 8080;
app.listen(port, function () {
  console.log('Listening on port ' + port);
});


text: module.exports = require('./lib/emitter');


text:
package ${package}.sample.dataobjects;

/**
 * This is a simple POJO (Plain Old Java Object) that represents the information that is stored
 * in the yaml files located @ src/test/resources/testdata/.
 */
public class AreaCode {

    private String areaCode;

    public AreaCode() {
    }

    public AreaCode(String areaCode) {
        this.setAreaCode(areaCode);
    }

    public String getAreaCode() {
        return areaCode;
    }

    public void setAreaCode(String areaCode) {
        this.areaCode = areaCode;
    }

    @Override
    public String toString () {
        final StringBuilder sb = new StringBuilder("AreaCode{");
        sb.append("areaCode='").append(areaCode).append('\'');
        sb.append('}');
        return sb.toString();
    }

}


text:
template <class T>
using StdVec = std::vector<T>;

template <class T, class A=typename std::allocator<T>> class vec
  : public std::vector<T,A>
{
    typedef std::vector<T,A> BaseT;
 public:
    typedef typename BaseT::size_type size_type;

// ===========================================================================
//
// CONSTRUCTORS
//
// ===========================================================================

  explicit vec( A const& a=A() ) : BaseT(a) {}
  vec( const std::initializer_list<T>& x, A const& a=A() ) : BaseT(x,a) {}
  explicit vec( size_type n ) : BaseT(n) {}
  vec( size_type n, const T& value, A const& a=A() )
  : BaseT(ValidatedSize(n),value,a) {}

  enum ConstructorBehavior { IDENTITY };
  vec( size_type n, ConstructorBehavior constructor_type, A const& a=A() )
  : BaseT(ValidatedSize(n))
  { for ( size_type i = 0; i < n; i++ ) (*this)[i] = i;    }

  template <class A1>
  vec( const std::vector<T,A1>& v, A const&a=A() )
  : BaseT(v.begin(),v.end(),a) {}

  vec( vec const& v ) : BaseT(v.begin(),v.end(),A()) {}
  vec( vec const& v, A const& a ) : BaseT(v.begin(),v.end(),a) {}

  template<class Itr>
  vec( Itr const& first, Itr const& last, A const& a=A() )
  : BaseT(first,last,a) {}

  template <class A1>
  vec& operator=( std::vector<T,A1> const& v )
  { BaseT::assign(v.begin(),v.end()); return *this; }

  vec& operator=( vec const& v ) = default;

  ///Asserts index within bounds.
  typename BaseT::reference operator[]( size_type i ) {
    AssertLt( i,  BaseT::size() ); // Asserts index within bounds
    return BaseT::operator[](i);   // ... and returns the element
  }

  ///Asserts index within bounds.
  typename BaseT::const_reference operator[](size_type i) const {
    AssertLt( i, BaseT::size() );  // Asserts index within bounds
    return BaseT::operator[](i);   // ... and returns the element
  }

  void resize( size_type i, T const& c = T() )
  {  BaseT::resize( ValidatedSize(i), c ); }

  void reserve( size_type i ) { BaseT::reserve(ValidatedSize(i)); }

  typename BaseT::reference front( ) {
    AssertGt( BaseT::size( ), 0u ); // Asserts index within bounds
    return BaseT::front( );   // ... and returns the element
  }

  typename BaseT::const_reference front( ) const {
    AssertGt( BaseT::size( ), 0u ); // Asserts index within bounds
    return BaseT::front( );   // ... and returns the element
  }

  typename BaseT::reference back( ) {
    AssertGt( BaseT::size( ), 0u ); // Asserts index within bounds
    return BaseT::back( );   // ... and returns the element
  }

  typename BaseT::const_reference back( ) const {
    AssertGt( BaseT::size( ), 0u ); // Asserts index within bounds
    return BaseT::back( );   // ... and returns the element
  }

// ===========================================================================
//
// FUNCTIONS TO PUSH ELEMENTS ONTO VECTORS
//
// ===========================================================================

  /// push_front (insert item before first element of vector)

  vec& push_front( const T& t1 )
  {    BaseT::insert( BaseT::begin( ), t1 ); return *this;   }

  /// Generalized push_back, allowing up to 12 items pushed back at a time.

  vec& push_back( const T& t1 )
  {    BaseT::push_back(t1); return *this;   }
  vec& push_back( const T& t1, const T& t2 )
  {    return push_back(t1).push_back(t2);    }
  vec& push_back( const T& t1, const T& t2, const T& t3 )
  {    return push_back(t1).push_back(t2).push_back(t3);    }
  vec& push_back( const T& t1, const T& t2, const T& t3, const T& t4 )
  {    return push_back(t1).push_back(t2).push_back(t3).push_back(t4);    }
  vec& push_back( const T& t1, const T& t2, const T& t3, const T& t4, const T& t5 )
  {    return push_back(t1).push_back(t2).push_back(t3).push_back(t4).push_back(t5); }
  vec& push_back( const T& t1, const T& t2, const T& t3, const T& t4, const T& t5,
       const T& t6 )
  {    return push_back( t1, t2, t3, t4, t5 ).push_back( t6 );     }
  vec& push_back( const T& t1, const T& t2, const T& t3, const T& t4, const T& t5,
       const T& t6, const T& t7 )
  {    return push_back( t1, t2, t3, t4, t5 ).push_back( t6, t7 );     }
  vec& push_back( const T& t1, const T& t2, const T& t3, const T& t4, const T& t5,
       const T& t6, const T& t7, const T& t8 )
  {    return push_back( t1, t2, t3, t4, t5 ).push_back( t6, t7, t8 );     }
  vec& push_back( const T& t1, const T& t2, const T& t3, const T& t4, const T& t5,
       const T& t6, const T& t7, const T& t8, const T& t9 )
  {    return push_back( t1, t2, t3, t4, t5 ).push_back( t6, t7, t8, t9 );     }
  vec& push_back( const T& t1, const T& t2, const T& t3, const T& t4, const T& t5,
       const T& t6, const T& t7, const T& t8, const T& t9, const T& t10 )
  {    return push_back( t1, t2, t3, t4, t5 ).push_back( t6, t7, t8, t9, t10 ); }
  vec& push_back( const T& t1, const T& t2, const T& t3, const T& t4, const T& t5,
       const T& t6, const T& t7, const T& t8, const T& t9, const T& t10,
       const T& t11 )
  {    return push_back( t1, t2, t3, t4, t5 ).push_back( t6, t7, t8, t9, t10, t11 );     }
  vec& push_back( const T& t1, const T& t2, const T& t3, const T& t4, const T& t5,
       const T& t6, const T& t7, const T& t8, const T& t9, const T& t10,
       const T& t11, const T& t12 )
  {    return push_back( t1, t2, t3, t4, t5 ).push_back( t6, t7, t8, t9, t10, t11, t12 );     }

  // push: construct object from up to ten arbitrary arguments, then push it back.
  template <class... Args>
  vec& push( Args&&... args )
  { BaseT::emplace_back(std::forward<Args>(args)...); return *this; }

  void push_back_copies( const T& t, const size_type n )
  { BaseT::resize(BaseT::size()+n,t); }

  template <class U>
  void append( const vec<U>& y )
  {    this->insert( this->end( ), y.begin( ), y.end( ) );    }

  template <class U>
  void append( const SerfVec<U>& y )
  {    this->insert( this->end( ), y.begin( ), y.end( ) );    }

  void append( const vec<T>& y, size_type i, size_type j ) {
    if ( j == y.size( ) ) this->insert( this->end( ), y.begin( ) + i, y.end( ) );
    else this->insert( this->end( ), y.begin( ) + i, y.begin( ) + j );
  }

  // appends values in y, but only those whose indices are in entries
  // IDX should be either (unsigned) int or longlong depending on the size of y
  template<typename IDX>
  void append( const vec<T>& y, const vec<IDX>& entries ) {
    AssertLe(y.size(), std::numeric_limits<IDX>::max());
    const size_type n = this->size( );
    resize( n + entries.size( ) );
    for ( size_type j = 0; j < entries.size( ); j++ )
      (*this)[ n + j ] = y[ entries[j] ];
  }

  void appendFromBinaryFile( String const& filename )
  { BinaryIteratingReader< vec<T> > rdr(filename.c_str());
    reserve(this->size()+rdr.remaining());
    T tmp;
    while ( rdr.next(&tmp) ) push_back(tmp); }

// ===========================================================================
//
// FUNCTIONS TO TEST IF VECTOR HAS AN ATTRIBUTE
//
// ===========================================================================

  bool nonempty( ) const { return ! this->empty( ); }
  bool solo( ) const { return this->size( ) == 1; }

  bool Ordered( ) const
  {    for ( size_type i = 1; i < this->size( ); i++ )
            if ( (*this)[i] < (*this)[i-1] ) return False;
       return True;    }

  bool UniqueOrdered( ) const
  {    for ( size_type i = 1; i < this->size( ); i++ )
            if ( (*this)[i] <= (*this)[i-1] ) return False;
       return True;    }

// ===========================================================================
//
// FUNCTIONS TO EXTRACT PART OF A VECTOR
//
// ===========================================================================

  /// SetToSubOf: Set *this to the len entries of that, starting at pos.
  /// It is OK for that to be the same as this.
  void SetToSubOf( vec const& that, size_type pos, size_type len )
  { AssertLe(pos,that.size());
    AssertLe(len,that.size()-pos);
    if ( this != &that )
    { this->assign(that.begin()+pos,that.begin()+pos+len); }
    else
    { this->resize(pos+len);
      this->erase(this->begin(),this->begin()+pos); } }
  // Implementation note:  the STL carefully accounts for self-assignment, so
  // a simpler implementation would be simply
  // this->assign(that.begin()+pos,that.begin()+pos+len);
  // regardless of whether we are slicing ourselves or someone else.
  // However, the STL implementation appears to assume that the elements of the
  // vector also handle self-assignment correctly, which in the case of our
  // stuff hardly seems like a good assumption.  The resize/erase technique
  // implemented above is almost as efficient, and only assumes that element
  // copying to non-self works correctly.

  inline friend vec SubOf( const vec& x, size_type start, size_type n )  {
    vec<T> s(n);
    copy(x.begin() + start, x.begin() + start + n, s.begin());
    return s;
  }

  // SetToSubOf: Set *this to the entries in x pointed to by indices.
  // IDX should be either (unsigned) int or longlong depending on the size of x
  template<typename IDX>
  void SetToSubOf( const vec<T>& x, const vec<IDX>& indices ) {
    AssertLe(x.size(), std::numeric_limits<IDX>::max());
    const size_type n = indices.size( );
    resize(n);
    for ( size_type i = 0; i < n; i++ )
      (*this)[i] = x[ indices[i] ];
  }

  // IDX should be either (unsigned) int or longlong depending on the size of x
  template<typename IDX>
  inline friend vec SubOf( const vec& x, const vec<IDX>& indices ) {
    AssertLe(x.size(), std::numeric_limits<IDX>::max());
    const size_type n = indices.size( );
    vec<T> s(n);
    for ( size_type i = 0; i < n; i++ )
      s[i] = x[ indices[i] ];
    return s;
  }

  void SetToRangeOf( const vec<T>& v, size_type i, size_type j ) {
    AssertLe( i, j );
    this->assign(v.begin() + i, v.begin() + j);
  }

  inline friend vec RangeOf( const vec& v, size_type i, size_type j ) {
    AssertLe( i, j );
    vec<T> r(v.begin() + i, v.begin() + j);
    return r;
  }

  int isize( ) const { return this->size( ); }
  int64_t jsize( ) const { return this->size( ); }

  void SetCat( const vec<T>& v1, const vec<T>& v2 ) {
    *this = v1;
    append(v2);
  }

  void clear_and_resize( size_type n ) {
    this->clear( );
    resize(n);
  }

  void resize_and_set( size_type n, const T& x ) {
    this->clear();
    resize(n, x);
  }

  void SetToReverseOf( const vec<T>& v ) {
    resize(v.size());
    reverse_copy(v.begin(), v.end(), this->begin());
  }

  void ReverseMe( ) {
    reverse(this->begin(), this->end());
  }

  bool Contains( const vec<T>& v ) const {
    return (search(this->begin(), this->end(), v.begin(), v.end()) != this->end());
  }

  bool Contains( const vec<T>& v, size_type pos ) const {
    if ( v.size( ) + pos > this->size( ) )
      return False;
    size_type j;
    for ( j = 0; j < v.size( ); j++ )
      if ( (*this)[pos+j] != v[j] )
	break;
    return j == v.size( );
  }

  /// CountValue: count all entries having the given value.
  size_type CountValue( const T& x ) const {
    return count(this->begin(), this->end(), x);
  }

// ===========================================================================
//
// FUNCTIONS TO ERASE ELEMENTS FROM VECTORS - PART 1 (MEMBER FUNCTIONS)
//
// ===========================================================================

  /// Erase: erase range of elements, where range is given by half-open interval.

  void Erase( size_type start, size_type stop ) {
    this->erase( this->begin( ) + start, this->begin( ) + stop );
  }

  /// EraseValue: erase all entries having the given value.
  void EraseValue( const T& x ) {
    this->erase(remove(this->begin(), this->end(), x), this->end());
  }

  /// print values to std::ostream, separated by sep.
  void Print(std::ostream & os, const char * sep = " ") const {
    copy(this->begin(), this->end(), std::ostream_iterator<T>(os, sep));
  }

  /// print values to ostream, separated by sep, with newline at end.
  void Println(std::ostream & os, const char * sep = " ") const {
    Print(os, sep); os << std::endl;
  }

  ///Set myself from text stream containing list of values of unknown length.
  void ReadFromTextStream(std::istream & is) {
    this->clear();
    T t;
    while (true) {
      is >> t;
      if (!is) break;
      push_back(t);
    }
  }

  /// ReadSubset: read selected entries from file written with BinaryWrite.
  /// The type T must have a fixed external size.
  void ReadSubset( String const& filename, vec<int> const& ids,
                          bool append = false )
  { BinaryReader br(filename.c_str());
    size_t nnn;
    br.read(&nnn);
    size_t sz = br.externalSizeof( static_cast<T*>(0) );
    if ( !sz )
    { FatalErr("Can't randomly access the binary file " << filename
                << " which contains variable-sized elements."); }
    if ( !append ) this->clear();
    reserve(this->size()+ids.size());
    T tmp;
    typedef vec<int>::const_iterator Itr;
    for ( Itr itr(ids.begin()), end(ids.end()); itr != end; ++itr )
    { br.seekAndFill( *itr*sz + br.tell(), sz );
      br.read(&tmp);
      push_back(tmp); }  }

  /// ReadRange: read selected entries from file written with BinaryWrite.
  /// The type T must have a fixed external size.
  void ReadRange( String const& filename, size_t from, size_t to )
  { BinaryReader br(filename.c_str());
    size_t nnn;
    br.read(&nnn);
    ForceAssertLe(to,nnn);
    ForceAssertLe(from,to);
    size_t sz = br.externalSizeof( static_cast<T*>(0) );
    if ( !sz )
    { FatalErr("Can't randomly access the binary file " << filename
                << " which contains variable-sized elements."); }
    br.seek( from*sz + br.tell() );
    this->clear();
    reserve(to-from);
    T tmp;
    for ( size_t idx = from; idx != to; ++idx )
    { br.read(&tmp);
      push_back(tmp); }  }

// ===========================================================================
//
// MEMBER FUNCTIONS TO DO ARITHMETIC ON VECTORS.
//
// ===========================================================================

  /// Multiply a vector by a constant of type X.

  template<class X>
  vec & operator*=(const X & x) {
    const size_type S = this->size();
    for (size_type i = 0; i != S; ++i) {
      (*this)[i] = static_cast<T>( x * (*this)[i]);
    }
    return *this;
  }

  /// Divide a vector by a constant of type X.

  template<class X>
  vec & operator/=(const X & x) {
    return this->operator*=(1.0/x);
  }

  /// Add two vectors together.
  /// If vx is longer, add up to this vector's size.
  /// if vx is shorter, add up to vx's size only.

  template<class X> vec & operator+=(const vec<X> & vx) {
    const size_type S = min(this->size(), vx.size());
    for (size_type i = 0; i != S; ++i) {
      (*this)[i] += static_cast<T>(vx[i]);
    }
    return *this;
  }

  //stand-alone operators are implemented in terms of op=
  //See meyers, more effective C++, item 22 for reasons.

  /// Multiply a vector by a constant of type X.

  template<class X> friend vec operator*(const vec & v, const X & x) {
    return vec(v) *= x;
  }

  /// Multiply a vector by a constant of type X.

  template<class X> friend vec operator*(const X & x, const vec & v) {
    return vec(v) *= x;
  }
  /// Divide a vector by a constant of type X.

  template<class X> friend vec operator/(const vec & v, const X & x) {
    return vec(v) /= x;
  }

  /// Add two vectors together.
  /// If vx is longer, add up to this vector's size.
  /// if vx is shorter, add up to vx's size only.

  template<class X> friend vec operator+(const vec & v, const vec<X> & vx) {
    return vec(v) += vx;
  }

  /// NextDiff(i): return index of next element after i that is different from
  /// the ith element.

  inline size_type NextDiff( size_type i ) const
  {    size_type j;
       for ( j = i + 1; j < this->size( ); j++ )
            if ( (*this)[j] != (*this)[i] ) break;
       return j;    }

  friend int compare( vec const& v1, vec const& v2 )
  {   auto itr1 = v1.begin();
      auto itr2 = v2.begin();
      using std::min;
      auto end = itr1 + min(v1.size(),v2.size());
      int result = 0;
      while ( !result && itr1 != end )
      { result = compare(*itr1,*itr2); ++itr1; ++itr2; }
      if ( !result ) result = compare(v1.size(),v2.size());
      return result;
  }

  friend void swap( vec& v1, vec& v2 )
  { v1.swap(v2); }

 private:
  static size_t ValidatedSize( size_t nnn )
  {
#ifndef NDEBUG
      if ( nnn > 1000ul*1000ul*1000ul*1000ul/sizeof(T) )
          FatalErr( "Vector too big: Attempt to resize vec<T> object to " << nnn
                      << ", where sizeof(T) = " << sizeof(T) << ".");
#endif
      return nnn;
  }
};

template <class T>
struct Serializability< vec<T> >
{ typedef ExternallySerializable type; };

//
//  End of vec Class Declaration and Template Definitions
//
/////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////
//
// Mutating Functions
//

template<class V>
V Reverse( V const& v )
{ return V( v.rbegin( ), v.rend( ) ); }

template<class T,class A>
void ReverseThis( vec<T,A>& v )
{ v.ReverseMe(); }

template<class T,class A>
void RandomShuffle( vec<T,A>& v )
{ random_shuffle( v.begin( ), v.end( ) ); }

//
// OverlapAppend - Given a sequence like A B C D C D and C D C D E F
// find the largest possible overlap and append the non-overlapping
// portion of the first sequence to the second:
//
//    v1:  A B C D C D
//    v2:      C D C D E F
//
// -> v1: A B C D C D E F
//
// returns the number of overlapping entries.  Note that the sequences
// must be vec-like things of the same thing (e.g. vec<int> and SerfVec<int>)
//
//

template <
     template <typename , typename... > class V1,     // e.g. vec<T,A1>
     template <typename , typename... > class V2,     // e.g. SerfVec<T,A2,A3>
     typename T,
     typename... Args1,
     typename... Args2>
size_t BrokenOverlapAppend( V1<T,Args1...>& v1, V2<T,Args2...> const& v2 ) {
     size_t best = 0;
     size_t size1 = v1.size();
     size_t size2 = v2.size();
     size_t overl = std::min(size1, size2);     // possible overlap sizes
     // for each possible overlap, from shortest to longest...
     for ( size_t i = 1; i <= overl; ++i ) {
          // test all of the bases for that length overlap
          for ( size_t j = 0; j < i; ++j ) {
               // any misses and we abort this attempt
               // if we get its all the way until i-1, then
               // this is the largest overlap so far
               if ( v1[size1-1-j] != v2[j] ) break;
               else if ( j == i-1 ) best = i;
          }
     }

     std::copy( v2.begin()+best, v2.end(), std::back_inserter(v1));

     return best;
}

template <
     template <typename , typename... > class V1,     // e.g. vec<T,A1>
     template <typename , typename... > class V2,     // e.g. SerfVec<T,A2,A3>
     typename T,
     typename... Args1,
     typename... Args2>
size_t OverlapAppend( V1<T,Args1...>& v1, V2<T,Args2...> const& v2 ) {
     size_t best = 0;
     size_t v1_size = v1.size(), v2_size = v2.size();
     size_t max_overl = std::min(v1_size, v2_size);     // max possible overlap
     // for each possible overlap, from longest to shortest...
     for ( size_t  overl = max_overl;  overl; --overl ) {
          if ( std::equal(v1.end()-overl, v1.end(), v2.begin() ) ) {
               best = overl;
               break;
          }
     }

     std::copy( v2.begin()+best, v2.end(), std::back_inserter(v1));

     return best;
}

/////////////////////////////////////////////////////////////////////////////
//
// Search Functions
//

template<class T,class A>
typename vec<T,A>::size_type LowerBound( const vec<T,A>& v, const T& x )
{ return std::lower_bound( v.begin( ), v.end( ), x ) - v.begin( ); }

template<class T,class A>
typename vec<T,A>::size_type UpperBound( const vec<T,A>& v, const T& x )
{ return std::upper_bound( v.begin( ), v.end( ), x ) - v.begin( ); }

template<class T,class A>
inline bool Member( vec<T,A> const& v, const T& x )
{ return (std::find(v.begin(), v.end(), x) != v.end()); }

/// Return the position of an element in a vector, else -1.
template<class T,class A>
inline long Position( vec<T,A> const& v, const T& x )
{
  using std::distance;
  auto pos = std::find(v.begin(), v.end(), x);
  if (pos != v.end())
    return distance(v.begin(),pos);
  else
    return -1L;
}

// Position( v, w ): return first position of w in v, else -1.

template<class T,class A>
inline int64_t Position( const vec<T,A>& v, const vec<T,A>& w )
{    int64_t pos = std::search(v.begin(),v.end(),w.begin(),w.end()) - v.begin();
     int64_t end = v.jsize( );
     if ( pos == end ) return -1;
     else return pos;    }

/// BinPosition.  Return the position of an element in a sorted vector, else -1.
/// If the element appears more than once, the position of one of its instances
/// is returned.
template<class V,class U>
inline long BinPosition( V const& v, const U& x1 )
{    if ( v.size( ) == 0 ) return -1;
     typename V::const_reference& x(x1);
     typename V::size_type first = 0, last = v.size( ) - 1, next;
     while (1)
     {    if (first == last) return ( !(x < v[last]) && !(v[last] < x) ) ? last : -1;
          next = first + (last - first) / 2;
          if ( x < v[next] ) last = next;
          else if ( v[next] < x ) first = next + 1;
          else return next;    }    }

template<class V,class U>
inline bool BinMember( V const& v, const U& x )
{ return std::binary_search(v.begin(),v.end(),x); }

/// BinSubset: determine if v is a subset of w; assumes w only is sorted and that there
/// is no repetition.
template<class V>
inline bool BinSubset( V const& v, V const& w )
{    for ( typename V::const_reference e : v )
          if ( !BinMember(w,e) ) return False;
     return True;    }

/// Determine if v is a subset of w; assumes that there is no repetition.
template<class T,class A,class A1>
inline bool Subset( const vec<T,A>& v, const vec<T,A1>& w )
{    for ( T const& e : v )
          if ( !Member(w,e) ) return False;
     return True;    }

/////////////////////////////////////////////////////////////////////////////
//
// Numerical Functions
//

template<class T,class A>
size_t SizeSum( vec<T,A> const& v, typename T::value_type* = 0 )
{ size_t sum = 0;
  for ( T const& e : v ) sum += e.size();
  return sum; }

template<class A>
inline bool Nonnegative( const vec<int,A>& v )
{ for ( int e : v ) if ( e < 0 ) return false;
  return true;    }

/////////////////////////////////////////////////////////////////////////////
//
// Destroy - returns the memory used by a vector, more or less
//

// Method given in Stroustrup's book, The C++ Programming Language, Special
// Edition (2000), p. 457.

template<class T,class A>
inline void Destroy( vec<T,A>& v )
{ vec<T,A> empty; swap(v,empty); }

/////////////////////////////////////////////////////////////////////////////
//
// Sort Functions
//

template<class T,class A>
inline void Sort( vec<T,A>& v )
{
  TRACEVAL_STOP_TRACING_COPIES;
  using std::sort; sort( v.begin( ), v.end( ) );
  TRACEVAL_START_TRACING_COPIES;
}

template<class T,class A,class StrictWeakOrdering>
inline void Sort( vec<T,A>& v, StrictWeakOrdering comp )
{
  TRACEVAL_STOP_TRACING_COPIES;
  using std::sort; sort( v.begin( ), v.end( ), comp );
  TRACEVAL_START_TRACING_COPIES;
}

template<class T,class A>
inline void ReverseSort( vec<T,A>& v )
{
  TRACEVAL_STOP_TRACING_COPIES;
  using std::sort; sort( v.rbegin( ), v.rend( ) );
  TRACEVAL_START_TRACING_COPIES;
}

template<class T,class A,class StrictWeakOrdering>
inline void ReverseSort( vec<T,A>& v, StrictWeakOrdering comp )
{
  TRACEVAL_STOP_TRACING_COPIES;
  using std::sort; sort( v.rbegin( ), v.rend( ), comp );
  TRACEVAL_START_TRACING_COPIES;
}

template <class T,class A,class Comp=std::equal_to<T>>
void Unique( vec<T,A>& v, Comp isEqual=Comp() )
{
    if ( v.size() <= 1 )
        return;

    TRACEVAL_STOP_TRACING_COPIES;

    using std::iter_swap;
    auto dest(v.begin());
    auto end(v.end());
    for ( auto itr(dest+1); itr != end; ++itr )
        if ( !isEqual(*itr,*dest) )
            iter_swap(itr, ++dest);
    v.erase(dest+1,end);

    TRACEVAL_START_TRACING_COPIES;
}

/// Leaves only unique elements in a vector \c v; these elements
/// will be also sorted.
template <class T,class A,class StrictWeakOrdering,class EqualPredicate>
inline void UniqueSort(vec<T,A>& v,StrictWeakOrdering comp,EqualPredicate equal)
{
    if ( v.size() <= 1 )
        return;
    Sort(v, comp);
    Unique(v, equal);
}

/// Leaves only unique elements in a vector \c v; these elements
/// will be also sorted.
template <class T,class A>
inline void UniqueSort(vec<T,A> & v)
{
  UniqueSort(v,std::less<T>(),std::equal_to<T>());
}

/////////////////////////////////////////////////////////////////////////////
//
// Erasing Functions
//

/// EraseIf: wrapper around erase-remove_if idiom.
template<class T,class A>
void EraseIf( vec<T,A>& v, bool (T::*f)( ) const )
{
  TRACEVAL_STOP_TRACING_COPIES;
  v.erase( remove_if( v.begin( ), v.end( ), std::mem_fun_ref(f) ), v.end( ) );
  TRACEVAL_START_TRACING_COPIES;
}

/// Another version of EraseIf: erase v[x] if erase[x] = True.
template<class T,class A,class A1>
void EraseIf( vec<T,A>& v, const vec<Bool,A1>& erase )
{
  TRACEVAL_STOP_TRACING_COPIES;
  typename vec<T,A>::size_type count = 0;
  for ( typename vec<T,A>::size_type i = 0; i < v.size( ); i++ ) {
    if ( ! erase[i] ) {
      if ( count != i )
        v[count] = v[i];
      ++count;
    }
  }
  v.resize(count);
  TRACEVAL_START_TRACING_COPIES;
}

/// Another version of EraseIf: erase v[x] if erase[x] = True.
template<class T,class A,class A1>
void EraseUnless( vec<T,A>& v, const vec<Bool,A1>& keep )
{
  TRACEVAL_STOP_TRACING_COPIES;
  typename vec<T,A>::size_type count = 0;
  for ( typename vec<T,A>::size_type i = 0; i < v.size( ); i++ ) {
    if ( keep[i] ) {
      if ( count != i )
        v[count] = v[i];
      ++count;
    }
  }
  v.resize(count);
  TRACEVAL_START_TRACING_COPIES;
}

/// EraseTheseIndices: Erase some elements of a vector, as determined by a sorted
/// list of indices.  Not efficiently implemented.
template<class T,class A,class IDX,class A1>
void EraseTheseIndices( vec<T,A>& v, const vec<IDX,A1>& these )
{
  AssertLe(v.size(), static_cast<size_t>(std::numeric_limits<IDX>::max()));
  TRACEVAL_STOP_TRACING_COPIES;
  typename vec<T,A>::size_type count = 0;
  for ( typename vec<T,A>::size_type i = 0; i < v.size( ); i++ )
    {    if ( !BinMember( these, i ) )
      {    if ( count != i ) v[count] = v[i];
      ++count;    }    }
  v.resize(count);
  TRACEVAL_START_TRACING_COPIES;
}

/////////////////////////////////////////////////////////////////////////////
//
// Input and Output Functions
//

/// IsAsciiVec() returns whether or not filename is a saved vec.  It
/// does this by checking whether the first line of the file is an
/// ASCII representation of a number.  If it encounters a non-digit,
/// non-whitespace character before it finds a newline, it returns
/// false.  Otherwise, it returns true.
bool IsAsciiVec( const String &filename );

/// Get the number of elements in saved ASCII vec.
longlong AsciiVecSize( const String& filename );

inline void AsciiBoolVecReadSubset( const String& filename,
                                         const vec<int>& ids,
                                         vec<Bool>& v )
{    String ns;
     {    Ifstream( in, filename );
          in >> ns;    }
     ForceAssert( ns.IsInt() );
     longlong n = ns.Int();
     int k = ns.size()+1;
     FileReader fr(filename.c_str());
     v.resize( ids.size( ) );
     for ( int i = 0; i < ids.isize( ); i++ )
     {    ForceAssertGe( ids[i], 0 );
          ForceAssertLt( ids[i], n );
          fr.seek( k + ids[i] );
          fr.read( &v[i], 1 );    }    }

/// Return number of elements in binary file of a vec<T> of some sort.
inline size_t BinaryVecNumElements( const String & filename )
{   BinaryReader br(filename.c_str());
    size_t nnn;
    br.read(&nnn);
    return nnn; }

inline size_t BinaryVecElementSize( String const& filename )
{    BinaryReader br(filename.c_str());
     size_t nnn;
     br.read(&nnn);
     size_t dataLen = br.getFilesize() - br.tell();
     ForceAssertEq(dataLen%nnn,0ul);
     return dataLen / nnn; }

#define BREAD2( FILE, TYPE, DATA ) \
    TYPE DATA; BinaryReader::readFile( FILE, &DATA )

// ============================================================================
// ========================================================================

void PrettyPrint( std::ostream& o, const vec<int>& v, int max_items = 0,
     String terminator = "\n" );

void PrettyPrint( std::ostream& o, const vec<longlong>& v, int max_items = 0,
     String terminator = "\n" );

void PrettyPrint( std::ostream& o, const vec<double>& v, int max_items = 0,
     String terminator = "\n" );

void PrettyPrint( std::ostream& o, const vec<TraceInt>& v, int max_items = 0,
     String terminator = "\n" );

// CompactPrint: print a vector of objects, separated by blanks (default) or
// a user-specified separator.

template<class T> void CompactPrint( std::ostream& out, const vec<T>& v,
    String separator = " " )
{    for ( typename vec<T>::size_type i = 0; i < v.size( ); i++ )
     {    if ( i > 0 ) out << separator;
          out << v[i];    }    }

/// WriteAppend has an implementation for T = alignment_plus in Alignment.{h,cc}.

template<class T> void WriteAppend( const String& f, const vec<T>& v )
{    ForceAssert( !IsRegularFile( f + ".gz" ) );
     if ( !IsRegularFile(f) )
     {    std::ofstream out(f.c_str());
          out << std::setfill('0') << std::setw(15) << v.size() << std::setfill(' ') << '\n';
          for ( typename vec<T>::size_type i = 0; i <  v.size( ); i++ )
               out << v[i];
          out.close();   }
     else
     {    std::fstream out(f.c_str(),std::ios_base::in|std::ios_base::out);
          size_t n;
          out >> n;
          size_t const max_size_bound = 10000000ul * 100000000ul;
          ForceAssertLt( n+v.size(), max_size_bound );
          out.seekp( 0, std::ios_base::beg );
          out << std::setfill('0') << std::setw(15) << n+v.size( ) << std::setfill(' ') << '\n';
          out.seekp( 0, std::ios_base::end );
          for ( typename vec<T>::size_type i = 0; i <  v.size( ); i++ )
               out << v[i];
          out.close(); }    }

/// a specialized version of WriteAppend for String

template <>
void WriteAppend( const String& f, const vec<String>& v );

template<class T> std::ostream& operator<<(std::ostream& s, const vec<T>& v)
{    s << v.size( ) << "\n";
     for ( typename vec<T>::size_type i = 0; i < v.size( ); i++ )
          s << v[i];
     return s;    }

std::ostream& operator<<(std::ostream& s, const vec<unsigned short>& v);
std::ostream& operator<<(std::ostream& s, const vec<int>& v);
std::ostream& operator<<(std::ostream& s, const vec<longlong>& v);
std::ostream& operator<<(std::ostream& s, const vec<float>& v);
std::ostream& operator<<(std::ostream& s, const vec<double>& v);
std::ostream& operator<<(std::ostream& s, const vec<String>& v);

template<class T> std::istream& operator>>(std::istream& s, vec<T>& v)
{    typename vec<T>::size_type n;
     s >> n;
     v.resize(n);
     char c;
     s.get(c);
     for ( typename vec<T>::size_type i = 0; i < v.size( ); i++ )
       s >> v[i];   // Breaks cxx
     return s;    }

std::istream& operator>>(std::istream& s, vec<String>& v);

/// Print out a matrix, with left-justified entries, and given separation between
/// columns.  (Justification may be changed by supplying an optional argument
/// consisting of a string of l's and r's.)

void PrintTabular( std::ostream& out, const vec< vec<String> >& rows, int sep,
     String justify = String( ) );

void PrintCSV(std::ostream& out, const vec< vec<String> >& rows);

#define For_(T,x,v) for( vec< T >::const_iterator x = v.begin(); x != v.end(); ++x )
#define ForMut_(T,x,v) for( vec< T >::iterator x = v.begin(); x != v.end(); ++x )

#endif


text:
<?php
class LtConfigExpression
{
	private $_expression;
	public $autoRetrived;

	public function __construct($string, $autoRetrived = true)
	{
		$this->_expression = (string) $string;
		$this->autoRetrived = $autoRetrived;
	}

	public function __toString()
	{
		return $this->_expression;
	}
}


text:
<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class DetailsCalendar extends Model
{
    protected $table = 'calendar_detail';
}


text:
package org.gluu.oxtrust.ldap.service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.gluu.oxtrust.model.GluuOrganization;
import org.gluu.oxtrust.util.OxTrustConstants;
import org.jboss.seam.Component;
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.AutoCreate;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Observer;
import org.jboss.seam.annotations.Scope;
import org.xdi.config.oxtrust.ApplicationConfiguration;
import org.xdi.ldap.model.GluuBoolean;
import org.xdi.ldap.model.GluuStatus;
import org.xdi.model.ProgrammingLanguage;
import org.xdi.oxauth.model.uma.persistence.InternalExternal;
import org.xdi.service.CacheService;
import org.xdi.util.ArrayHelper;
import org.xdi.util.StringHelper;

/**
 * Provides operations with organization
 *
 * @author Yuriy Movchan Date: 11.02.2010
 */
@Scope(ScopeType.STATELESS)
@Name("organizationService")
@AutoCreate
public class OrganizationService extends org.xdi.service.OrganizationService{

	private static final long serialVersionUID = -1959146007518514678L;

	@In
	private CacheService cacheService;

	@In(value = "#{oxTrustConfiguration.applicationConfiguration}")
	private ApplicationConfiguration applicationConfiguration;

	/**
	 * Update organization entry
	 *
	 * @param organization
	 *            Organization
	 */
	public void updateOrganization(GluuOrganization organization) {
		ldapEntryManager.merge(organization);

	}

	/**
	 * Get organizationService instance
	 *
	 * @return OrganizationService instance
	 */
	public static OrganizationService instance() {
		return (OrganizationService) Component.getInstance(OrganizationService.class);
	}

	/**
	 * Check if LDAP server contains organization with specified attributes
	 *
	 * @return True if organization with specified attributes exist
	 */
	public boolean containsOrganization(GluuOrganization organization) {
		return ldapEntryManager.contains(organization);
	}

	/**
	 * Get organization
	 *
	 * @return Organization entry
	 */
	public GluuOrganization getOrganization() {
		return getOrganizationByInum(getInumForOrganization());
	}

	/**
	 * Get organization by DN
	 *
	 * @param inum
	 *            inum
	 * @return Organization
	 */
	public GluuOrganization getOrganizationByInum(String inum) {
		String key = OxTrustConstants.CACHE_ORGANIZATION_KEY + "_" + inum;
		GluuOrganization organization = (GluuOrganization) cacheService.get(OxTrustConstants.CACHE_APPLICATION_NAME, key);
		if (organization == null) {
			organization = ldapEntryManager.find(GluuOrganization.class, getDnForOrganization(inum));
			cacheService.put(OxTrustConstants.CACHE_APPLICATION_NAME, key, organization);
		}

		return organization;
	}

	public String getDnForOrganization(String inum) {
		return getDnForOrganization(inum, applicationConfiguration.getBaseDN());
	}

	/**
	 * Returns custom message defined for the organization
	 *
	 * @param customMessageId
	 *            message id
	 * @return custom message
	 */
	public String getOrganizationCustomMessage(String customMessageId) {
		GluuOrganization organization = getOrganization();

		String key = OxTrustConstants.CACHE_ORGANIZATION_CUSTOM_MESSAGE_KEY + "_" + organization.getInum();
		@SuppressWarnings("unchecked")
		Map<String, String> organizationCustomMessage = (Map<String, String>) cacheService.get(OxTrustConstants.CACHE_APPLICATION_NAME, key);
		if (organizationCustomMessage == null) {
			organizationCustomMessage = new HashMap<String, String>();

			String[] customMessages = organization.getCustomMessages();
			if (ArrayHelper.isNotEmpty(customMessages)) {
				for (String customMessage : customMessages) {
					int idx = customMessage.indexOf(':');
					if ((idx > 0) && (idx + 1 < customMessage.length())) {
						String msgKey = customMessage.substring(0, idx).trim();
						String msgValue = customMessage.substring(idx + 1).trim();

						if (StringHelper.isNotEmpty(msgKey) && StringHelper.isNotEmpty(msgValue)) {
							organizationCustomMessage.put(msgKey, msgValue);
						}
					}
				}
			}
			cacheService.put(OxTrustConstants.CACHE_APPLICATION_NAME, key, organizationCustomMessage);
		}

		return organizationCustomMessage.get(customMessageId);
	}

	public String[] buildOrganizationCustomMessages(String[][] customMessages) {
		List<String> result = new ArrayList<String>();

		for (String[] customMessage : customMessages) {
			if (ArrayHelper.isEmpty(customMessage) || customMessage.length != 2) {
				continue;
			}
			String msgKey = customMessage[0];
			String msgValue = customMessage[1];

			if (StringHelper.isNotEmpty(msgKey) && StringHelper.isNotEmpty(msgValue)) {
				result.add(msgKey + ": " + msgValue);
			}
		}

		return result.toArray(new String[0]);
	}

	/**
	 * Remove organization from cache after receiving event that organization
	 * were changed
	 */
	@Observer(OxTrustConstants.EVENT_CLEAR_ORGANIZATION)
	public void clearOrganizationCache() throws Exception {
		log.debug("Removing organization from cache");
		cacheService.removeAll(OxTrustConstants.CACHE_APPLICATION_NAME);
	}

	/**
	 * Build DN string for organization
	 *
	 * @return DN string for organization
	 */
	public String getDnForOrganization() {
		return getDnForOrganization(getOrganizationInum());
	}

	/**
	 * Build DN string for organization
	 *
	 * @return DN string for organization
	 */
	public String getBaseDn() {
		return applicationConfiguration.getBaseDN();
	}

	/**
	 * Get Inum for organization
	 *
	 * @return Inum for organization
	 */
	public String getInumForOrganization() {
		return applicationConfiguration.getOrgInum();
	}

	public boolean isAllowPersonModification() {
		return applicationConfiguration.isAllowPersonModification(); // todo &&
																		// ApplianceService.instance().getAppliance().getManageIdentityPermission()
																		// !=
																		// null
																		// &&
																		// ApplianceService.instance().getAppliance().getProfileManagment().isBooleanValue();
	}

	public String getOrganizationInum() {
		return applicationConfiguration.getOrgInum();
	}

	public GluuBoolean[] getBooleanSelectionTypes() {
		return new GluuBoolean[] { GluuBoolean.DISABLED, GluuBoolean.ENABLED };
	}

	public GluuBoolean[] getJavaBooleanSelectionTypes() {
		return new GluuBoolean[] { GluuBoolean.TRUE, GluuBoolean.FALSE };
	}

	public GluuStatus[] getActiveInactiveStatuses() {
		return new GluuStatus[] { GluuStatus.ACTIVE, GluuStatus.INACTIVE };
	}

	public ProgrammingLanguage[] getProgrammingLanguageTypes() {
		return new ProgrammingLanguage[] { ProgrammingLanguage.PYTHON, ProgrammingLanguage.JAVA_SCRIPT };
	}

	public InternalExternal[] getInternalExternalTypes() {
		return new InternalExternal[] { InternalExternal.INTERNAL, InternalExternal.EXTERNAL };
	}

}


text:
angular.module('testApp', ['iOffice.pickadate'])
  .controller('TestController', function($scope) {
  	 // moment().add(1, 'd').toDate()
    $scope.selectedDates = {start: '2014-09-22'};
    // $scope.minDate = moment().subtract(1, 'd').format('YYYY-MM-DD');
    // $scope.maxDate = moment().add(20, 'd').format('YYYY-MM-DD');

    $scope.disabledDates = [
      moment('2014-09-27', 'YYYY-MM-DD').format('YYYY-MM-DD')
    ];

    // console.table([{
    //   minDate: $scope.minDate,
    //   maxDate: $scope.maxDate,
    //   disabledDates: $scope.disabledDates
    // }]);

    $scope.$watch('selectedDates', function(newVal, oldVal) {
    	console.log(newVal.start, newVal.end);
    })
  });


text:
package org.apache.asterix.lang.common.statement;

import java.util.Iterator;

import org.apache.asterix.common.exceptions.CompilationException;
import org.apache.asterix.common.metadata.DataverseName;
import org.apache.asterix.lang.common.base.AbstractStatement;
import org.apache.asterix.lang.common.expression.RecordConstructor;
import org.apache.asterix.lang.common.util.FullTextUtil;
import org.apache.asterix.lang.common.visitor.base.ILangVisitor;
import org.apache.asterix.object.base.AdmArrayNode;
import org.apache.asterix.object.base.AdmObjectNode;
import org.apache.asterix.object.base.AdmStringNode;
import org.apache.asterix.object.base.IAdmNode;
import org.apache.hyracks.api.exceptions.HyracksDataException;
import org.apache.hyracks.storage.am.lsm.invertedindex.fulltext.TokenizerCategory;

import com.google.common.collect.ImmutableList;

public class CreateFullTextConfigStatement extends AbstractStatement {

    private final DataverseName dataverseName;
    private final String configName;
    private final boolean ifNotExists;
    private final AdmObjectNode configNode;

    public static final String FIELD_NAME_TOKENIZER = "tokenizer";
    public static final String FIELD_NAME_FILTER_PIPELINE = "filterPipeline";

    public CreateFullTextConfigStatement(DataverseName dataverseName, String configName, boolean ifNotExists,
            RecordConstructor expr) throws CompilationException {
        this.dataverseName = dataverseName;
        this.configName = configName;
        this.ifNotExists = ifNotExists;
        this.configNode = FullTextUtil.validateAndGetConfigNode(expr);
    }

    public DataverseName getDataverseName() {
        return dataverseName;
    }

    public String getConfigName() {
        return configName;
    }

    public boolean getIfNotExists() {
        return ifNotExists;
    }

    @Override
    public Kind getKind() {
        return Kind.CREATE_FULL_TEXT_CONFIG;
    }

    @Override
    public <R, T> R accept(ILangVisitor<R, T> visitor, T arg) throws CompilationException {
        return visitor.visit(this, arg);
    }

    @Override
    public byte getCategory() {
        return Category.DDL;
    }

    public TokenizerCategory getTokenizerCategory() throws HyracksDataException {
        String tokenizerCategoryStr = configNode.getString(FIELD_NAME_TOKENIZER);
        TokenizerCategory tokenizerCategory = TokenizerCategory.getEnumIgnoreCase(tokenizerCategoryStr);

        return tokenizerCategory;
    }

    public ImmutableList<String> getFilterNames() {
        AdmArrayNode arrayNode = (AdmArrayNode) configNode.get(FIELD_NAME_FILTER_PIPELINE);
        ImmutableList.Builder<String> filterNamesBuilder = ImmutableList.builder();

        Iterator<IAdmNode> iterator = arrayNode.iterator();
        while (iterator.hasNext()) {
            filterNamesBuilder.add(((AdmStringNode) iterator.next()).get());
        }

        return filterNamesBuilder.build();
    }

}


text:
<?php
namespace PointingBreed\Reporting;

use Assert\Assertion;

class Severity
{
    /** @var int */
    private $severity;

    /** @var Trend|null */
    private $trend;

    public static function error(Trend $trend = null)
    {
        return new self(-3, $trend);
    }

    public static function warning(Trend $trend = null)
    {
        return new self(-2, $trend);
    }

    public static function notice(Trend $trend = null)
    {
        return new self(-1, $trend);
    }

    public static function progress($progress, Trend $trend = null)
    {
        Assertion::min($progress, 0);
        Assertion::max($progress, 5);
        return new self((int) $progress, $trend);
    }

    private function __construct($severity, Trend $trend = null)
    {
        $this->severity = $severity;
        $this->trend    = $trend;
    }

    public function isNotice()
    {
        return $this->severity === -1;
    }

    public function isWarning()
    {
        return $this->severity === -2;
    }

    public function isError()
    {
        return $this->severity === -3;
    }

    public function isProgress()
    {
        return $this->severity > -1
            && $this->severity <= 100;
    }

    public function toProgress()
    {
        return $this->isProgress()
             ? $this->severity
             : null;
    }

    public function isGettingWorse()
    {
        return $this->trend && $this->trend->isGettingWorse();
    }

    public function isGettingBetter()
    {
        return $this->trend && $this->trend->isGettingBetter();
    }
}


text:
Styles passed into the Modal via the `style` prop are merged with the defaults.
The default styles are defined in the `Modal.defaultStyles` object and are
shown below.

```jsx
<Modal
  ...
  style={{
    overlay: {
      position: 'fixed',
      top: 0,
      left: 0,
      right: 0,
      bottom: 0,
      backgroundColor: 'rgba(255, 255, 255, 0.75)'
    },
    content: {
      position: 'absolute',
      top: '40px',
      left: '40px',
      right: '40px',
      bottom: '40px',
      border: '1px solid #ccc',
      background: '#fff',
      overflow: 'auto',
      WebkitOverflowScrolling: 'touch',
      borderRadius: '4px',
      outline: 'none',
      padding: '20px'
    }
  }}
  ...
>
```

You can change the default styles by modifying `Modal.defaultStyles`.  Please
note that specifying a [CSS class](classes.md) for the overlay or the content
will disable the default styles for that component.


text:
#include "dcmtk/config/osconfig.h"

#include "dcmtk/ofstd/offile.h"

#ifdef HAVE_WINDOWS_H
#include "dcmtk/ofstd/ofchrenc.h"   /* for class OFCharacterEncoding */
#endif

OFFilename::OFFilename()
  : filename_(NULL)
#if (defined(WIDE_CHAR_FILE_IO_FUNCTIONS) || defined(WIDE_CHAR_MAIN_FUNCTION)) && defined(_WIN32)
  , wfilename_(NULL)
#endif
{
}

OFFilename::OFFilename(const char *filename,
                       const OFBool convert)
  : filename_(NULL)
#if (defined(WIDE_CHAR_FILE_IO_FUNCTIONS) || defined(WIDE_CHAR_MAIN_FUNCTION)) && defined(_WIN32)
  , wfilename_(NULL)
#endif
{
    set(filename, convert);
}

OFFilename::OFFilename(const OFString &filename,
                       const OFBool convert)
  : filename_(NULL)
#if (defined(WIDE_CHAR_FILE_IO_FUNCTIONS) || defined(WIDE_CHAR_MAIN_FUNCTION)) && defined(_WIN32)
  , wfilename_(NULL)
#endif
{
    set(filename, convert);
}

#if (defined(WIDE_CHAR_FILE_IO_FUNCTIONS) || defined(WIDE_CHAR_MAIN_FUNCTION)) && defined(_WIN32)
OFFilename::OFFilename(const wchar_t *filename,
                       const OFBool convert)
  : filename_(NULL),
    wfilename_(NULL)
{
    set(filename, convert);
}
#endif

OFFilename::OFFilename(const OFFilename &arg)
  : filename_(NULL)
#if (defined(WIDE_CHAR_FILE_IO_FUNCTIONS) || defined(WIDE_CHAR_MAIN_FUNCTION)) && defined(_WIN32)
  , wfilename_(NULL)
#endif
{
    if (arg.filename_ != NULL)
        filename_ = strdup(arg.filename_);
#if (defined(WIDE_CHAR_FILE_IO_FUNCTIONS) || defined(WIDE_CHAR_MAIN_FUNCTION)) && defined(_WIN32)
    if (arg.wfilename_ != NULL)
        wfilename_ = _wcsdup(arg.wfilename_);
#endif
}

OFFilename::~OFFilename()
{
    clear();
}

OFFilename &OFFilename::operator=(const OFFilename &arg)
{
    if (&arg != this)
    {
        free(filename_);
        filename_ = (arg.filename_ != NULL) ? strdup(arg.filename_) : NULL;
#if (defined(WIDE_CHAR_FILE_IO_FUNCTIONS) || defined(WIDE_CHAR_MAIN_FUNCTION)) && defined(_WIN32)
        free(wfilename_);
        wfilename_ = (arg.wfilename_ != NULL) ? _wcsdup(arg.wfilename_) : NULL;
#endif
    }
    return *this;
}

void OFFilename::clear()
{
    free(filename_);
    filename_ = NULL;
#if (defined(WIDE_CHAR_FILE_IO_FUNCTIONS) || defined(WIDE_CHAR_MAIN_FUNCTION)) && defined(_WIN32)
    free(wfilename_);
    wfilename_ = NULL;
#endif
}

void OFFilename::swap(OFFilename &arg)
{
    char *charPointer = filename_;
    filename_ = arg.filename_;
    arg.filename_ = charPointer;
#if (defined(WIDE_CHAR_FILE_IO_FUNCTIONS) || defined(WIDE_CHAR_MAIN_FUNCTION)) && defined(_WIN32)
    wchar_t *wideCharPointer = wfilename_;
    wfilename_ = arg.wfilename_;
    arg.wfilename_ = wideCharPointer;
#endif
}

OFBool OFFilename::isEmpty() const
{
    OFBool result = (filename_ == NULL) || (filename_[0] == '\0');
#if (defined(WIDE_CHAR_FILE_IO_FUNCTIONS) || defined(WIDE_CHAR_MAIN_FUNCTION)) && defined(_WIN32)
    if (result)
        result = (wfilename_ == NULL) || (wfilename_[0] == L'\0');
#endif
    return result;
}

void OFFilename::set(const char *filename,
                     const OFBool convert)
{
    clear();
    if (filename != NULL)
    {
        filename_ = strdup(filename);
#if (defined(WIDE_CHAR_FILE_IO_FUNCTIONS) || defined(WIDE_CHAR_MAIN_FUNCTION)) && defined(_WIN32)
#ifdef HAVE_WINDOWS_H
        if (convert)
        {
            wchar_t *tmpString = NULL;
            size_t strLen = 0;
            /* convert UTF-8 representaion to wide character encoding */
            OFCharacterEncoding::convertToWideCharString(filename, strlen(filename),
                tmpString, strLen, OFCharacterEncoding::CPC_UTF8);
            wfilename_ = _wcsdup(tmpString);
            delete[] tmpString;
        }
#endif
#endif
    }
}

void OFFilename::set(const OFString &filename,
                     const OFBool convert)
{
    set(filename.c_str(), convert);
}

#if (defined(WIDE_CHAR_FILE_IO_FUNCTIONS) || defined(WIDE_CHAR_MAIN_FUNCTION)) && defined(_WIN32)
void OFFilename::set(const wchar_t *filename,
           const OFBool convert)
{
    clear();
    if (filename != NULL)
    {
        wfilename_ = _wcsdup(filename);
#ifdef HAVE_WINDOWS_H
        if (convert)
        {
            OFString tmpString;
            /* convert wide character encoding to UTF-8 representation */
            OFCharacterEncoding::convertFromWideCharString(filename, wcslen(filename),
                tmpString, OFCharacterEncoding::CPC_UTF8);
            filename_ = strdup(tmpString.c_str());
        }
#endif
    }
}
#endif

STD_NAMESPACE ostream &operator<<(STD_NAMESPACE ostream &stream, const OFFilename &filename)
{
    stream << OFSTRING_GUARD(filename.getCharPointer());
    return stream;
}


text:
export class Note {
    _id: string;
    day: number;
    month: number;
    year: number;
    date: Date;
    title: string;
    amount: number;
    currency: string;
    comment: string;
    approved: boolean;
    files: string[];
}


text:
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.

defined('MOODLE_INTERNAL') || die();
require_once($CFG->dirroot.'/course/format/renderer.php');

/**
 * Basic renderer for topics format.
 *
 * @copyright 2012 Dan Poltawski
 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
class format_topics_renderer extends format_section_renderer_base {

    /**
     * Constructor method, calls the parent constructor
     *
     * @param moodle_page $page
     * @param string $target one of rendering target constants
     */
    public function __construct(moodle_page $page, $target) {
        parent::__construct($page, $target);

        // Since format_topics_renderer::section_edit_controls() only displays the 'Set current section' control when editing mode is on
        // we need to be sure that the link 'Turn editing mode on' is available for a user who does not have any other managing capability.
        $page->set_other_editing_capability('moodle/course:setcurrentsection');
    }

    /**
     * Generate the starting container html for a list of sections
     * @return string HTML to output.
     */
    protected function start_section_list() {
        return html_writer::start_tag('ul', array('class' => 'topics'));
    }

    /**
     * Generate the closing container html for a list of sections
     * @return string HTML to output.
     */
    protected function end_section_list() {
        return html_writer::end_tag('ul');
    }

    /**
     * Generate the title for this section page
     * @return string the page title
     */
    protected function page_title() {
        return get_string('topicoutline');
    }

    /**
     * Generate the section title, wraps it in a link to the section page if page is to be displayed on a separate page
     *
     * @param stdClass $section The course_section entry from DB
     * @param stdClass $course The course entry from DB
     * @return string HTML to output.
     */
    public function section_title($section, $course) {
        return $this->render(course_get_format($course)->inplace_editable_render_section_name($section));
    }

    /**
     * Generate the section title to be displayed on the section page, without a link
     *
     * @param stdClass $section The course_section entry from DB
     * @param stdClass $course The course entry from DB
     * @return string HTML to output.
     */
    public function section_title_without_link($section, $course) {
        return $this->render(course_get_format($course)->inplace_editable_render_section_name($section, false));
    }

    /**
     * Generate the edit control items of a section
     *
     * @param stdClass $course The course entry from DB
     * @param stdClass $section The course_section entry from DB
     * @param bool $onsectionpage true if being printed on a section page
     * @return array of edit control items
     */
    protected function section_edit_control_items($course, $section, $onsectionpage = false) {
        global $PAGE;

        if (!$PAGE->user_is_editing()) {
            return array();
        }

        $coursecontext = context_course::instance($course->id);

        if ($onsectionpage) {
            $url = course_get_url($course, $section->section);
        } else {
            $url = course_get_url($course);
        }
        $url->param('sesskey', sesskey());

        $isstealth = $section->section > $course->numsections;
        $controls = array();
        if (!$isstealth && $section->section && has_capability('moodle/course:setcurrentsection', $coursecontext)) {
            if ($course->marker == $section->section) {  // Show the "light globe" on/off.
                $url->param('marker', 0);
                $markedthistopic = get_string('markedthistopic');
                $highlightoff = get_string('highlightoff');
                $controls['highlight'] = array('url' => $url, "icon" => 'i/marked',
                                               'name' => $highlightoff,
                                               'pixattr' => array('class' => '', 'alt' => $markedthistopic),
                                               'attr' => array('class' => 'editing_highlight', 'title' => $markedthistopic));
            } else {
                $url->param('marker', $section->section);
                $markthistopic = get_string('markthistopic');
                $highlight = get_string('highlight');
                $controls['highlight'] = array('url' => $url, "icon" => 'i/marker',
                                               'name' => $highlight,
                                               'pixattr' => array('class' => '', 'alt' => $markthistopic),
                                               'attr' => array('class' => 'editing_highlight', 'title' => $markthistopic));
            }
        }

        $parentcontrols = parent::section_edit_control_items($course, $section, $onsectionpage);

        // If the edit key exists, we are going to insert our controls after it.
        if (array_key_exists("edit", $parentcontrols)) {
            $merged = array();
            // We can't use splice because we are using associative arrays.
            // Step through the array and merge the arrays.
            foreach ($parentcontrols as $key => $action) {
                $merged[$key] = $action;
                if ($key == "edit") {
                    // If we have come to the edit key, merge these controls here.
                    $merged = array_merge($merged, $controls);
                }
            }

            return $merged;
        } else {
            return array_merge($controls, $parentcontrols);
        }
    }
}


text:
set(target_libraries
  org_commontk_eventbus
  )


text:
title: Health effects of friendship
date: 2016-08-12
description: How does friendship play a role in your health?
categories:
  - friendship
  - health
image: https://source.unsplash.com/collection/375719/2000x1322?a=.png
author_staff_member: tom
---

Conventional wisdom suggests that good friendships enhance an individual's sense of happiness and overall well-being. Indeed, a number of studies have found that strong social supports improve a woman's prospects for good health and longevity. Conversely, loneliness and a lack of social supports have been linked to an increased risk of heart disease, viral infections, and cancer, as well as higher mortality rates overall. Two researchers have even termed friendship networks a "behavioral vaccine" that boosts both physical and mental health.

![Man](https://source.unsplash.com/random/1500x1000)

While there is an impressive body of research linking friendship and health, the precise reasons for the connection remain unclear. Most of the studies in this area are large prospective studies that follow people over a period of time, and while there may be a correlation between the two variables (friendship and health status), researchers still do not know if there is a cause and effect relationship, such as the notion that good friendships actually improve health.

![Thai](https://source.unsplash.com/random/1500x1001)

A number of theories have attempted to explain this link. These theories have included that good friends encourage their friends to lead more healthy lifestyles; that good friends encourage their friends to seek help and access services when needed; that good friends enhance their friends' coping skills in dealing with illness and other health problems; and that good friends actually affect physiological pathways that are protective of health.

![lavender flowers](https://source.unsplash.com/random/1500x1002)


text:
<?php
/*
 * @author Nicolas Clavaud <nicolas@lrqdo.fr>
 */

namespace Ogone\Tests\DirectLink;

use Ogone\Tests;
use Ogone\DirectLink\DirectLinkMaintenanceResponse;

class DirectLinkMaintenanceResponseTest extends \TestCase
{

    /**
     * @test
     * @expectedException InvalidArgumentException
     */
    public function CantExistWithoutXmlFile()
    {
        $maintenanceResponse = new DirectLinkMaintenanceResponse('');
    }

    /** @test */
    public function ParametersCanBeRetrieved()
    {
        $xml = $this->provideXML();

        $maintenanceResponse = new DirectLinkMaintenanceResponse($xml);
        $this->assertEquals('5', $maintenanceResponse->getParam('orderid'));
    }

    /**
     * @test
     * @expectedException InvalidArgumentException
     */
    public function RequestIsFilteredFromNonOgoneParameters()
    {
        $xml = $this->provideXML();

        $maintenanceResponse = new DirectLinkMaintenanceResponse($xml);
        $maintenanceResponse->getParam('unknown_param');
    }

    /**
     * @test
     * @expectedException InvalidArgumentException
     */
    public function ChecksInvalidXml()
    {
        $xml = $this->provideInvalidXML();

        $maintenanceResponse = new DirectLinkMaintenanceResponse($xml);
    }

    /** @test */
    public function ChecksStatus()
    {
        $xml = $this->provideXML();

        $maintenanceResponse = new DirectLinkMaintenanceResponse($xml);
        $this->assertTrue($maintenanceResponse->isSuccessful());
    }

    /** @test */
    public function AmountIsConvertedToCent()
    {
        $xml = $this->provideXML();

        $maintenanceResponse = new DirectLinkMaintenanceResponse($xml);
        $this->assertEquals(100, $maintenanceResponse->getParam('amount'));
    }

    public function provideFloats()
    {
        return [
            ['17.89', 1789],
            ['65.35', 6535],
            ['12.99', 1299],
        ];
    }

    /**
     * @test
     * @dataProvider provideFloats
     */
    public function CorrectlyConvertsFloatAmountsToInteger($string, $integer)
    {
        $xml = $this->provideXML($string);

        $maintenanceResponse = new DirectLinkMaintenanceResponse($xml);
        $this->assertEquals($integer, $maintenanceResponse->getParam('amount'));
    }

    /**
     * Helper method to setup an xml-string
     */
    private function provideXML($amount = null)
    {

        $xml = '<?xml version="1.0"?>
                <ncresponse
                orderID="5"
                PAYID="33146134"
                NCERROR="0"
                NCERRORPLUS="!"
                ACCEPTANCE=""
                STATUS="91"
                AMOUNT="' . (($amount) ? $amount : '1') . '"
                CURRENCY="GBP">
                </ncresponse>';

        return $xml;
    }

    /**
     * Helper method to setup an invalid xml-string
     */
    private function provideInvalidXML()
    {
        $xml = '<?xml version="1.0"?>
                <ncresponse
                </ncresponse>';

        return $xml;
    }
}


text:
<?php

namespace app\assets;

use yii\web\AssetBundle;

/**
 * @author Qiang Xue <qiang.xue@gmail.com>
 * @since 2.0
 */
class AceIeAsset extends AssetBundle
{
    public $basePath = '@webroot';
    public $baseUrl = '@web';
    public $cssOptions = ['condition' => 'lte IE 9'];
    public $css = [
        'css/ace-ie.min.css',
    ];
}