text:
Change log
==========

v4.6.0
------
* Improve support for alternative settings in SpaceGroup.
* Fix respect for user_incar_settings in MPNonSCFSet and MPSOCSet
* Support for argcomplete in pmg script.
* Speed ups to Ewald summation.
* Add functionality to parse frequency dependent dielectric function.
* Improvements to Bolztrap support.

v4.5.7
------
* PMG settings are now prefixed with PMG_ to ensure proper namespacing.
* Improve error output in command line bader caller.
* Add Py3.6 classifier.
* Misc bug fixes.

v4.5.6
------
* Minor bug fix.
* Fixed elastic energy density

v4.5.5
------
* Fix bad reading of pmgrc.
* Gaussian opt section added allowing for torsion constraints
* Update spglib.

v4.5.4
------
* BSDOSPlotter (Anubhav Jain)
* Fixes to defect analysis (Bharat)
* intrans as an input to BoltztrapAnalyzer. Allows for scissor operation.
* Pmg is now continuously tested on win-64/py35 using Appveyor!

v4.5.3
------
* Added an alternative interstitial finder that works with a grid-based structure-motif search. (Nils Zimmermann)
* Optionnal possibility to specify that the saddle_point in the NEB should have a zero slope. (David Waroquiers)
* Read intensity and normal modes for Gaussian. (Germain Salvato Vallverdu)
* Minor bug fixes.

v4.5.2
------
* Minor bug fix for POTCAR settings.

v4.5.1
------
* You can now specify a different default functional choice for pymatgen by
  setting PMG_DEFAULT_FUNCTIONAL in .pmgrc.yaml. For use with newer
  functional sets, you need to specify PBE_52 or PBE_54 for example.
* Swtich to ISYM 3 by default for HSE.
* Updates to FEFF>
* Misc bug fixes and startup speed improvements.

v4.5.0
------
* Major speed up of initial load.
* Collection of misc changes.

v4.4.12
-------
* Fix for dynamic numpy import.

v4.4.11
-------
* Update to new version of spglib.

v4.4.10
-------
* Minor fixes for proper gzipped structure file support and MVLSlabSet.

v4.4.9
------
* Dependency cleanup. Now, basic pymatgen requires on much fewer
  packages.
* Fixed reading of POSCAR files when more than 20 types of atoms.
* Misc bug fixes.

v4.4.8
------
* Cleanup of entry points and dependencies.

v4.4.7
------
* Update to spglib 1.9.7.1
* Proper use of dependency markers for enum34.

v4.4.6
------
* Update to spglib 1.9.6, which fixes some bugs and is Windows compatible.

v4.4.5
------
* Bug fix for SubstitutionProb.

v4.4.4
------
* Bug fix for electronic structure plotter.

v4.4.3
------
* Bug fix for Diffusion Analyzer.

v4.4.2
------
* Bug fix for BS serialization.
* Cleanup dependencies.

v4.4.1
------
* Massive updates to FEFF support (Kiran Mathews).
* Bug fixes in band structure plotting.

v4.4.0
------
* Much more Pythonic API for modifying Structure/Molecule species. Now,
  strings, slices, and sequences should magically work, in addition to the
  previous API of simple int indices. Examples::

    s[0] = "Fe"
    s[0] = "Fe", [0.5, 0.5, 0.5]  # Replaces site and fractional coordinates.
    s[0] = "Fe", [0.5, 0.5, 0.5], {"spin": 2}  # Replaces site and fractional coordinates and properties.
    s[(0, 2, 3)] = "Fe"  # Replaces sites 0, 2 and 3 with Fe.
    s[0::2] = "Fe"  # Replaces all even index sites with Fe.
    s["Mn"] = "Fe"  # Replaces all Mn in the structure with Fe.
    s["Mn"] = "Fe0.5Co0.5"  # Replaces all Mn in the structure with Fe: 0.5, Co: 0.5, i.e.,creates a disordered structure!

* Massive update to internal representation of Bandstructure objects for
  memory and computational efficiency.
* Bug fixes to CIF parsing in some edge cases. (Will Richards).

v4.3.2
------
* Massive speedup of Bandstructure, especially projected band structures,
  parsing.
* Massive update to pmg cli script, with new query functions as well as a
  more rational command structure.
* Updates to ChemEnv.
* Misc bug fixes.

v4.3.1
------
* Upgrade monty and spglib requirements for bug fixes.
* Updates to feff support (Kiran).

v4.3.0
------
* Massive update to elastic module. (Joey Montaya)
* Pathfinder algorithm for NEB calculations. (Ziqing Rong)
* Wheels for Windows and Mac Py27 and Py35.

v4.2.5
------
* Bug fix for BSPlotter.

v4.2.4
------
* Bug fix for kpoint weight calculation for Monkhorst meshes.

v4.2.3
------
* Minor cleanup.
* Simplified installation. enumlib and bader can now be installed using pmg setup --install.

v4.2.2
------
* Global configuration variables such as VASP\_PSP\_DIR and MAPI\_KEY are now
  stored in "~/.pmgrc.yaml". If you are setting these as environmental
  variables right now, you can easily transition to the new system using::

      pmg config --add VASP_PSP_DIR $VASP_PSP_DIR MAPI_KEY $MAPI_KEY

  This new scheme will provide greater flexibility for user-defined
  global behavior in pymatgen, e.g., tolerances, default input sets for
  transmuters, etc., in future.
* Beta of k-point weight calculator.
* Use default MSONable as and from_dict for all transformations.

v4.2.1
------
* New DopingTransformation that implements an automated doping strategy.
* Updated MIC algorithm that is a lot more robust (Will Richards).
* Major update to chemenv package (David Waroquiers)

v4.2.0
------
* Fix important bug in minimum image distance computation for very skewed cells.
* Major refactoring of WulffShape code.
* Misc bug fixes for elastic tensor and other codes.

v4.1.1
------
* Major refactoring of WulffShape and lammps support.

v4.1.0
------
* Wulff shape generator and analysis.
* Minor bug fixes.

v4.0.2
--------
* Fix kpoint reciprocal density.

v4.0.1
------
* Minor bug fix release.

v4.0.0
------
* Massive update with many deprecated methods removed. Note that this
  may break backwards incompatibility!
* Support for ABINIT 8.
* Improved sulfide compatibility.

v3.7.1
------
* Fix deprecation bug.

v3.7.0
------
* Last version before pymatgen 4.0, where deprecated modules will be removed!
* Massive update to LAMMPS (Kiran Matthews).
* New input sets with a different interface that replaces old input sets.
* Massive update to elastic properties.

v3.6.1
------
* Massive cleanup to Boltztrap interface (Anubhav Jain)
* Refactor of piezoelectric analysis to use tensor base class (Joey)
* More robust CIF parsing.

v3.6.0
------
* Pymatgen now uses spglib directly from Togo's website. Spglib is no longer
  bundled as a dependency.
* Improved support for velocities in Poscar (Germaine Vallverdu)
* Backwards incompatible change in Born charge format in Outcar.
* Fixes for Lammps input serialization

v3.5.3
------
* Misc refactorings and bug fixes, especially for Outcar and Boltztrap classes.

v3.5.2
------
* Minor update to DerivedInputSet interface.

v3.5.1
------
* New derived input sets for generating inputs that depende on previuos
  calculations. Old input sets deprecated.

v3.5.0
------
* Chemical environment analysis package (David Waroquiers).
* Piezoelectric property analysis (Shayam).
* Cythonize certain expensive core functions. 5-10x speedup in large structure matching (Will Richards).
* New NMR parsing functionality for Outcar (Xiaohui Qu).
* Improved io.lammps (Kiran Mathews).
* Update to spglib 1.9.2.
* Element properties now return unitized float where possible.
* Bug fix for get_primitive_standard affecting rhombohedral cells (important for band structures).
* Vasprun.final_energy now returns corrected energy with warning if it is different from final electronic step.

v3.4.0
------
* 10-100x speed up to Structure copying and Site init, which means many
  functionality has seen signifcant speed improvement (e.g., structure
  matching).
* Convenience method Structure.matches now perform similarity matching
  for Structures.
* Bugfix for band gap determination.

v3.3.6
------
* Update to use enum.x instead of multienum.x.
* Minor robustness fixes to VaspInputSet serialization.
* Add a reciprocal density parameter to vasp sets.
* Minor bug fixes to Vasprun parsing.

v3.3.5
------
* StructureMatcher can now work with ignored species.
* Added interpolation failure warnings and smooth tolerance for
  scipy.interpolate.splrep in bandstructures (Tess).
* Added DiffusionAnalyzer.get_framework_rms_plot.
* Complete rewrite of Procar class to use ND array access and zero-based
  indexing.
* OrderParameters class for analysis of local structural features
  (Nils Zimmermann).
* Bug fixes for Procar, MPRester and SpaceGroup 64.
* Added Github templates for contributing to pymatgen.

v3.3.4
------
* Procar now supports parsing of phase factors.
* Miscellaneous bug fixes.

v3.3.3
------
* Bug fixes for Poscar.
* Fix Kpoints pickling.

v3.3.2
------
* Bug fixes for pymatgen.io.abinit
* Other minor big fixes.

v3.3.1
------
* Minor bug fix release for pickle and elastic constants.

v3.3.0
------
* Updated and checked for Python 3.5.* compatibility.
* Element, Spin, Orbital and various other Enum-like classes are now actually
  implemented using Enum (with enum34 dependency for Python < 3.4).
* Speed up Site creation by 20% for ordered sites, with cost in terms of
  slightly slower non-ordered Sites. Since ordered Sites is the far more common
  case, this gives significant boost for large scale manipulations of
  structures.
* Alternative, more pythonic syntax for creating supercells via simply
  Structure * 3 or Structure * (3, 1, 1).
* zeo++ fixes.
* More stable incar settings for MITMDVaspInputSet.

v3.2.10
-------
* Fix missing scripts
* Improvements to units module.
* Speed up EwaldSummation.

v3.2.9
------
* Major PD stability improvements, especially for very high dim hulls with lots
  of entries.
* Improvements to Ewald summation to be close to GULP implementation.
* Deprecate physical constants module in favor of scipy's version.
* Remove many pyhull references to use scipy's ConvexHull implementation.
* Bug fix for sulfide correction.

v3.2.8
------

* Make pyhull optional.
* Sulfur correction added to MaterialsProjectCompatibility for more accurate
  sulfide formation energies.
* ADF io support. (Xin Chen)
* Bug fixes for spacegroup subgroup testing.

v3.2.7
------
* Add warning for limited subgroup testing functionality in Spacegroup.

v3.2.6
------
* Extensive support for elasticity tensor analysis (Joseph Montoya).
* Misc bug fixes and performance improvements.
* Add support for QChem4.3 new format of Batch jobs

v3.2.5
------
* Improved potcar setup via "pmg setup", with MAPI setup.
* Support for new POTCARs issued by VASP.
* Improvements to ABINIT support.
* Improvement to Boltztrap support, e.g., scissor band gap, etc.
* Vasprun now issues warning when unconverged run is detected.

v3.2.4
------

* GaussianOutput can now parse frequencies, normal modes and cartesian forces
  (Xin Chen).
* Support for Aiida<->pymatgen conversion by the Aiida development team (Andrius
  Merkys).
* Specialized BSVasprun parser that is ~2-3x faster than Vasprun.
* Refactor the boltztrap package (merge a few methods together) and add several
  new methods (power factor, seebeck...)
* Support of the new PCM format in QChem 4.3
* Local environment analysis to pmg script.
* Deprecate prettytable in favor of tabulate package.
* Improvements to MITNEBVaspInputSet.
* Misc bug fixes.

v3.2.3
------
* Massive update to abinit support. Note that pymatgen.io.abinitio has
  been refactored to pymatgen.io.abinit. (Matteo, Setten)
* NwOutput now supports parsing of Hessian matrices (contributed by Xin
  Chen)
* Gaussian support now has the ability to read potential energy surface
  and electronic transitions computed with TD-DFT (Germain Salvato
  Vallverdu)
* Bug fixes for CifWriter with symmetry.
* Bug fixes for surface generation and reactions.
* Monty requirement increased.

v3.2.1
------
* Fix wrong U value for Ce and Eu.
* Properly handle empty multiline strings in Cif
* Add ability to get specific data in MPRester.get_entries. Make all get_entry
  methods consistent  in kwargs.

v3.2.0
------
* Force conversion to an actual list in selective dynamics and velocities in
  Poscar.
* fix small bug in BSPlotter (wrong ylim)
* Elastic tensor parsing in Outcar

v3.1.9
------
* Fix scripts.

v3.1.7
------
* Bug fixes for MPRester.
* Ensure correct monty version requirement in setup.py.

v3.1.6
------
* Rudimentary PWSCF output reading.
* Fix ASE support.
* Support for WAVEDERF and reading multiple dielectricfunctions in vasprun.xml.
  (Miguel Dias Costa)

v3.1.5
------
* Move vasp.vasp*put to vasp.*puts. Also, maintain backwards compatibility with
  vaspio.vasp_*put

v3.1.4
------
* Fix missing yaml files that have been moved.

v3.1.3
------
* Major refactoring of pymatgen.io. Now, the io suffix is dropped from all io
  classes. i.e., it is just pymatgen.io.vasp, not pymatgen.io.vaspio. Also, all
  input sets have been moved within the relevant package, e.g.,
  pymatgen.io.vasp.sets. All changes are backwards compatible for now. But
  deprecation messages have been included which states that the stubs will be
  removed in pymatgen 4.0. Pls migrate code when you see the deprecation
  messages.
* Make Composition.anonymized_formula truly chemistry independent (No A2B2
  for peroxides or A2 for diatomic gasses)
* Allowing CIF data_* header to be prefixed with spaces and tabulations.

v3.1.2
------
* HHI Resource Analysis (by Anubhav Jain).
* Bug fixes for surfaces normalizatino.
* Bug fix for Vasprun parsing of response function keys.
* Dockerfile for generation of an image for pymatgen.
* Updated requirements.txt for latest requests, scipy, numpy.

v3.1.1
------
* Bug fixes for SpacegroupAnalyzer and SlabGenerator.
* Much faster normal vec search.

v3.1.0
------
* Much improved surface generation algorithm that provides for
  orthogonality constraints.
* Transition state analysis tools! (beta)
* Massive improvements in Outcar parsing which provides a powerful grepping
  syntax.
* PWSCFInput generation (beta).
* Reduce default SIGMA to 0.05 for MP input sets.
* Update spglib to 1.7.3 as per recommendation of Togo.
* Many bug fixes and efficiency improvements.

v3.0.13
-------

* Bug fix for parsing certain types of CIFs.
* MPRester now has get_materials_id_references helper method.
* Minor fix for Vasprun.final_energy.
* Added mp_decode option to MPRester.query to allow option to not decode into
  pymatgen objects.
* New POTCAR hash scheme to more robustly identify unique POTCARs.
* Link to http://bit.ly/materialsapi for information on Materials API
  document schema for use with MPRester.query method.

v3.0.11
-------
* Lots of abinitio improvements (Matteo).
* Added mp_decode option to MPRester.query to allow option to not decode into pymatgen objects.

v3.0.10
------

* Fix cartesian coord parsing in Poscar class.
* Vasprun now works with non-GGA PBE runs
* Misc bug fixes

v3.0.9
------
* Major bug fixes for CIF parsing (Will Richards).
* Support for {Li,Na} syntax in parse_criteria for MPRester.
* Additional example notebook for ordering and enumeration.
* More robust checking for oxidation states in EnumerateStructureTRansformation.
* Improvements to Slab polarity checking.

v3.0.8
------
* Massive update to abinitio (Matteo).
* Improvements to OUTCAR parsing (Ioannis Petousis).

v3.0.7
------
* Powerful Slab generation algorithms (beta!).
* Improvements to DiffusionAnalyzer with constant smoothing option.
* Significantly improve look of DOS plots using prettyplotlib.

v3.0.6
------
* Cost analysis module (Anubhav Jain)
* More Py3k fixes.
* Extensive abinitio updates (Matteo).

v3.0.5
------
* Completely revamped symmetry package. The finder.SymmetryFinder and
  pointgroup and spacegroup modules are now deprecated. Instead,
  all symmetry analysis is in the :module:`pymatgen.symmetry.analyzer`_
  module. There is also a completely rewritten support for symmetry groups in
  :module:`pymatgen.symmetry.groups`_. Structure now supports a static
  constructor to generate a structure from a spacegroup (see examples).
* BatteryAnalyzer class (Anubhav Jain) to provide for some common analysis of
  intercalation electrodes.
* Minor bug fixes for structure_matcher, lattice, abinitio.
* MOAB qadapter for abinit. (Liam Damewood)

v3.0.4
------
* Fix missing structures json data.

v3.0.3
------
* Updates to DiffusionAnalyzer for more fine-grained statistics.
* Bug fixes and tweaks to linear assignment
* Improved PymatgenTest class which provides a suite of test structures.
* Speedups to Phase Diagram
* Lots of improvements to Gaussian support (Nicolas Dardenne) and Abinit IO
  (Matteo).
* Lots of Py3k minor updates.
* Updated doc for Diffusion anaylzer. Invert sq_disp_ions for more intuitive handling.

v3.0.2
------
1. Consistent use of unicode throughout pymatgen.
2. Minor bug fixes.

v3.0.1
------
1. Minor bug fixes for cifio.
2. Py3k updates for abinitio.

v3.0.0
------
* Pymatgen is now completely Python 2.7 and Python 3.x compatible!
* Spglib and pyhull have been updated to support Python 3.x.
* Completely rewritten pure python cifio module (courtesy of William Davidson
  Richards) removed dependency on PyCIFRW, which has been causing many issues
  with installation.
* Structure and Molecule now supports a very convenient to() and from_str and
  from_file functionality. Instead of trying to load the appropriate parser,
  you can output and read from the appropriate formats directly. See example
  usage.
* ~50% speedup to LinearAssignment code.
* Continuous integration and contribution guidelines now include Python 3.
* **Backwards incompatible changes**
* matgenie.py has now been renamed simply "pmg" for brevity.
* All deprecated methods in pymatgen 2.x have been removed. E.g.,
  pymatgen.core.structure_modifier is no longer available.
* Pymatgen classes now uses the as_dict() method protocol implemented in the
  Monty package. The to_dict property is now deprecated and will be removed
  in pymatgen v3.1.
* Update main docs page examples with the new Structure to, from formats.

v2.10.6
-------
* Bug fix for np1.9 incompatibility. Now works.
* Use wheel for pymatgen deployments.
* matgenie.py is now renamed to pmg for faster CLI usage.
* Improvements to KPOINTS automatic generation.
* Simpler and faster Structure.get_all_neighbors

v2.10.5
-------
* DiffusionAnalyzer now has non-smoothed option.
* Kpoints generation algorithm now guarantees minimum # of points.
* Compatibility now has a proper explanation dict.
* Vaspruns with NSW == 1 now checked properly for electronic conv.
* make_movie now supports kwargs.

v2.10.3
-------
* MPRester.query now supports a simple but powerful string criteria syntax
  with support for wild cards.
* Improvements to Composition - support for negative compositions, sorting etc.
* Speed ups to StructureMatcher.

v2.10.2
-------
* Bug fix for Projected DOS parsing in new Vasprun.
* Compatibility now has a *explain* method which provides a detailed outline
  of the changes that a Compatibility makes to an Entry.

v2.10.1
-------
* Minor fix for monty requirements in setup.py.

v2.10.0
-------
* Major update: MPRester now uses Materials API v2! Also major refactoring
  of MPRester.
* Vastly improved Vasprun parser using cElementTree. Twice as fast,
  half as much code and easier to maintain.
* Vast improvements to Qchem functionality (Xiaohui Qu).
* Improved handling of Structure manipulations for extremely large
  structures (particularly in terms of memory consumption).
* Bug fix for XYZ parsing for scientific notation.
* Improve monty.serialization for transparent handling of JSON vs YAML.
  Requirements updated to monty>=0.3.3.
* Update numpy requirements to 1.8+. Fixes memory leak.
* Other minor bug fixes.

v2.9.14
-------
* Implements Structure.sort method. Both Structure.sort and the
  get_sorted_structure methods now supports all arguments supported by list
  .sort().
* VaspInputSets configs, as well as several other configs now uses yaml. Note
  the new dependency on pyyaml. It is highly recommended that you install
  pyyaml with the libyaml C bindings.
* Fix missing spglib dependency.
* Use monty.serialization for transparent handling of JSON vs YAML.
  Requirements updated to monty>=0.3.1.

v2.9.13
-------
* Urgent bug fix for missing compatibility yamls.

v2.9.12
-------
* Defect transformations (Bharat).
* Support for optical properties (Geoffroy Hautier and David Waroquiers).
* Improved support for some VASP output files (XDATCAR and OSZICAR).
* Refactored compatibilities now uses YAML for ease of reading.

v2.9.11
-------
* Bug fix for get_xrd_plot.
* Speed up XRD calculator by allowing specification of two theta ranges.
* Minor improvements to Gulp caller.

v2.9.10
-------
* Bug fix for unequal coefficients sizes in XRD.
* Support for Ag radiation in XRD calculator.
* Improved Procar class for extraction of information. (Germain Salvato
  Vallverdu)
* Bug fix for extraction of GGA data from Materials API.

v2.9.9
------
* XRDCalculator now supports disordered structures.
* Minor speed ups and improvements.

v2.9.8
------
* Initial beta version of XRD pattern calculator.
* Pymatgen now uses spglib 1.6.0.
* Update to Vasprun to compute static deilectric constants with DFPT in VASP.
  (Geoffroy Hautier)

v2.9.7
------
* Quick bug-fix release that provides a better solution to Structure handling
  of properties instead of sanitizing MPRester structures.

v2.9.6
------
* Patch to allow 1D phase diagrams (essentially finding the lowest energy
  phase).
* Better error checking for Bandstructure KPOINTs.
* Patch to sanitize structures obtained from MPRester.

v2.9.5
------
* Bug fix for linear assignment, which may sometimes affect Structure
  Matcher results.
* Minor improvement to the way grand canonical PDs work.

v2.9.4
------
* Bug fix for Pourbaix Maker (Sai).
* Streamline use of scratch directories for various calls. Require monty >=
  0.1.2.
* High accuracy mode for Zeo++ (Bharat Medasani).

v2.9.3
------
* Bug fix release for printing TransformedStructures from Substitutor (Will
  Richards).
* Misc improvements in BVAnalyzer, coord_utils and defects (Will Richards,
  David Waroquiers and Bharat Medasani).

v2.9.2
------
* Bug fix release for DummySpecie, which failed when deserializing from
  json and had bad hash function.

v2.9.1
------
* Structure/Molecule now supports Pythonic list-like API for replacing and
  removing sites. See :ref:`quick_start` for examples.

v2.9.0
------
* Updates to support ABINIT 7.6.1 (by Matteo Giantomassi).
* Vastly improved docs.
* Refactoring to move commonly used Python utility functions to `Monty
  package <https://pypi.python.org/pypi/monty>`_, which is now a dependency
  for pymatgen.
* Minor fixes and improvements to DiffusionAnalyzer.
* Many bug fixes and improvements.

v2.8.10
-------
* Refactoring of qchemio module (by Xiaohui Qu).

v2.8.9
------
* qchemio module (by Xiaohui Qu).

v2.8.8
------
* Minor bug fix release for Structure species substitution methods.

v2.8.7
------
* Massive update to pymatgen.io.abinitio package (by Matteo Giantomassi).
* Bug fixes for StructureMatcher's group_structure.
* Misc bug fixes and cleanup.

v2.8.6
------
* Bug fix for VASP io set introduced by the default to sorting of structure
  sites when generating VASP input.

v2.8.4
------
* Completely revamped Compatibility/Correction system which improves
  readability (Shyue Ping Ong/Anubhav Jain/Sai Jayaraman). This change is
  backwards compatible for the most part.

v2.8.3
------
* Big fix release for json dumping for unitized floats.

v2.8.2
------
* Bug fix release to improve CIF parsing for more non-standard CIF files.
  In particular, non-ascii characters are removed and _cgraph* fields are
  removed prior to parsing for better support in PyCiFRW.

v2.8.1
------
* Bug fix release. Incorrect units assigned for ionic radii.
* Improved nwchemio supports COSMO and ESP calculations (Nav Rajput).

v2.8.0
------
* **Units**. Pymatgen now has a new system of managing units,
  defined in pymatgen.core.units. Typical energy, length, time,
  temperature and charge units are supported. Units subclass float,
  which makes the usage transparent in all functions. The value that they
  being are in terms of conversions between different units and addition and
  subtraction of different units of the same type. Some basic quantities
  like ionic radii and atomic masses are now returned in unitized forms for
  easy conversion. Please see :mod:`pymatgen.core.units` and the
  :doc:`examples </examples>` for a demonstration of house to use units in
  pymatgen.
* **Minor backwards-incompatible change**. Structures are now sorted by
  default when generating VASP input files using vaspio_set. Old behavior can
  be obtained by setting sort_structure=False in the constructor. This is
  typically the desired behavior and prevents the generation of large
  POTCARs when atomic species are not grouped together.
* Bug fix for Molecule.substitute. Earlier algorithm was not detecting
  terminal atoms properly.
* Additional conversion tools for ABINIT (by Matteo Giantomassi).

v2.7.9
------
* Minor bug fix release to fix pyhull dependencies to be more friendly.
* Improved structure matcher that allows for more flexible matching. New
  matching between ordered and disordered comparator.

v2.7.7
-------
* Beta new Gulp Caller and Zeo++ interface classes (Bharat . Zeo++ is an open
  source software for performing high-throughput geometry-based analysis of
  porous materials and their voids. Please see
  http://www.maciejharanczyk.info/Zeopp/about.html.
* Specify version of distribute to 0.6.34 for better compatibility.

v2.7.6
------
* Support for VTK 6.x in structure visualization.
* Updated install instructions for openbabel.
* Preliminary pourbaix analysis (Sai Jayaratnam).

v2.7.5
------
* Vastly improved Nwchem IO (by Shyue Ping Ong).
* Much improved ABINIT support (by Matteo Giantomassi).

v2.7.4
------
* Added basic Nwchem (http://www.nwchem-sw.org/) IO support. (by: Shyue Ping
  Ong).
* New MoleculeMatcher class for comparing molecules by RMS. Requires
  openbabel with python bindings. (by: Xiaohui Qu)
* New functional group substitution capability for molecules (by: Lei Cheng
  and Shyue Ping Ong).

v2.7.2
------
* Minor bug fix release to fix some rare errors in very high dimensional
  phase diagrams. **Requires new pyhull version (1.3.8).**

v2.7.1
------
* **Major backwards-incompatible change.** With effect from v2.7.1,
  the default Structure and Molecule classes are now *mutable* objects. All
  functionality in the :mod:`pymatgen.core.structure_modifier` has been
  ported over to the new mutable classes. This change was implemented
  because the immutability of Structure and Molecule has resulted in very
  awkward code to make changes to them. The main cost of this change is that
  Structure and Molecule can no longer be used as dict keys (__hash__ has
  been set to None). However, we believe this is a minor cost given that we
  have rarely seen the use of Structure or Molecule as dict keys in any case.
  For the rare instances where such functionality is needed,
  we have provided the IStructure and IMolecule classes (where I indicates
  immutability) which will perform exactly the same way as the previous
  classes. With this change, the :mod:`pymatgen.core.structure_modifier`
  module is now deprecated and will be removed in a future version.
* read_structure and write_structure now supports pymatgen's json serialized
  structures.
* read_mol and write_mol functions now available (analogues of
  read_structure and write_structure for molecules)

v2.7.0
------
* Beta support for ABINIT input and output via pymatgen.io.abinitio
  (courtesy of the excellent work of Matteo Giantomassi).
* Properties are now checked when comparing two Species for equality.
* MaterialsProjectVaspInputSet is now renamed to MPVaspInputSet for easier
  typing. The old input sets have been deprecated.
* New VaspInputSets for MPStatic, MPNonSCF, MITMD which supports uniform
  grid, bandstructure and molecular dynamics calculations. The MD input set
  uses MIT parameters for speed.
* A beta DiffusionAnalysis class in the apps package.
* A revised KPOINT grid algorithm that generates more reasonable meshes.
* A guided install script is now provided for Mac and Linux users.

v2.6.6
------
* Updates to feffio (credit: Alan Dozier)
* Added detailed installation instructions for various platforms.
* Support for charge and spin multiplicity in Molecule. Expanded methods
  available in Molecule.
* Added supercell matching capabilities to StructureMatcher.
* More robust creation of PhaseDiagrams to take into account potential qhull
  precision errors.

v2.6.5
------
* Added a command_line caller to do Bader charge analysis using Henkelmann
  et al.'s algorithm.
* Bug fix for POSCAR parsing when title line is an empty string.
* Added __rmul__ operator for Composition.
* Vastly expanded available aliases.

v2.6.4
------
* Bug fixes for selective dynamics in Poscar.
* Improved Procar parsing to support both simple and detailed PROCARs.

v2.6.3
------
* Added new MaterialsProject REST interfaces for submit/query/delete_snl
  (currently open in beta for collaborators only).
* Added support for new MaterialsProject REST method get_stability.
* Added aliases for PhaseDiagram, GrandPotentialPhaseDiagram,
  PDAnalyzer and PDPlotter in pymatgen.phasediagrams.
* Improvements to StructureMatcher: stol (site - tolerance) redefined as
  a fraction of the average length per atom. Structures matched in fractional
  space are now also matched in cartesian space and a rms displacement
  normalized by length per atom can be returned using the rms_dist method.

v2.6.2
------

* Site and PeriodicSite now uses a Composition mapping type to represent
  the species and occupancy, instead of a standard dict.
* Bug fix for reading and re-writing out of Potcars.
* VaspInputSet now supports MSONable framework.
* Strain cell option in StructureEditor.
* Miscellaneous bug fixes and speedups.

v2.6.1
------
* Use requests.Session in MPRester for connection pooling and code simplicity.
* Support for "with" context manager in MPRester.
* Updated periodic table data to correct errors in Ru, Tc and other elements.
* New methods in Lattice to obtain Wigner-Seitz cell and Brillouin Zone.
* Miscellaneous bug fixes and speedups.

v2.5.5
------

* Bug fix release for cifio for rhombohedral structures.
* Miscellaneous bug fixes and speedups.

v2.5.4
------
* Vastly improved Gaussian input file parsing that supports more varieties
  of input specifications.
* StructureNL now supports molecules as well as structures.
* Updated atomic and vdw radius for Elements.
* Miscellaneous bug fixes and speedups.

v2.5.3
------
* Bug fix for StructureNotationalLanguage.
* Support for LDA US potential. matgenie.py script option to generate POTCARs.
* Beta version of StructureNotationLanguage, a markup format for Structure
  data with metadata such as authors and references. (Anubhav Jain)
* Vasprun parsing now parses dielectric constant where available. (Geoffroy
  Hautier)
* New custom ipython shell script for pymatgen.
* Miscellaneous bug fixes and speedups.

v2.5.1
------
* Bug fixes for primitive cell finder.
* Remove deprecated use_external_qhull option in PhaseDiagram classes.
* Miscellaneous bug fixes and speedups.

v2.5.0
------
* Added optimization package with linear assignment class.
* Improved robustness of StructureMatcher using linear assignment.
* Improved primitive cell search (faster and more robust).
* Cleanup of deprecated methods, including
  pymatgen.alchemy.materials.TransformedMaterial.undo/redo_last_transformation,
  pymatgen.core.site.Site.distance_and_image_old, Poscar.struct,
  StructureFitter and tests.
* Miscellaneous bug fixes and speedups.

v2.4.3
------
* Bug fix for StructureMatcher.
* Miscellaneous speedups.

v2.4.0
------
* New StructureMatcher that effectively replaces StructureFitter. Orders of
  magnitude faster and more robust. StructureFitter is now deprecated.
* Vastly improved PrimitiveCellTransformation.
* A lot of core methods have been rewritten to take advantage of vectorization
  in numpy, resulting in orders of magnitude improvement in speed.
* Miscellaneous bug fixes and speedups.

v2.3.2
------
* More utilities for working with Periodic Boundary Conditions.
* Improved MPRester that supports more data and a new method of specifying
  the API key for heavy users via a MAPI_KEY environment variable. Please
  refer to the :doc:`usage pages </usage>` for more information.
* Vastly improved POTCAR setup script in scripts directly that is now
  installed as part of a default pymatgen installation.
* Miscellaneous bug fixes and speedups.

v2.3.1
------
* Significant improvements to the high-level interface to the Materials API.
  New interface provides more options to make it easier to get structures and
  entries, better warnings and error handling. It uses the *requests*
  library for a cleaner API.
* Bug fix for VolumetricData parsing and methods such as CHGCAR and LOCPOT.
  Previously, the parsing was done incorrectly because VASP actually provides
  data by running through the x-axis first, followed by y, then z.
* Bug fix for reverse_readline so that it works for gzipped and bzipped
  strucutures (courtesy of Anubhav Jain).
* Fix "lossy" composition to_dict method.  Now composition.to_dict properly
  returns a correct species string as a key for compositions using species,
  instead of just the element symbols.
* Miscellaneous bug fixes.

v2.3.0
------
* Remove usage of scipy and external qhull callers. Now uses pyhull package.
  Please note that this change implies that the pyhull package is now a
  required dependency. If you install pymatgen through the usual
  easy_install or pip install methods, this should be taken care of
  automatically for you. Otherwise, please look for the pyhull package on
  PyPI to download and install it.
* Miscellaneous bug fixes.

v2.2.6
------
* Brand new *beta* bond valence analyzer based on a Maximum A Posteriori
  algo using data-mined ICSD data.
* Speed up and improvements to core classes.
* Improved structure fitter (credits to Geoffroy Hautier).
* Brand new entry_tools module (pymatgen.entries.entry_tools).
* Vastly improved Outcar parser based on reverse parsing that speeds up
  reading of OUTCAR files by orders of magnitude.
* Miscellaneous bug fixes.

v2.2.4
------
* Fixed bug in hexagonal cell KPOINTS file generation.
* New RelaxationAnalyzer to compare structures.
* New *beta* bond valence analyzer.
* Miscellaneous bug fixes.

v2.2.3
------
* New filter framework for filtering structures in pymatgen.alchemy.
* Updated feff io classes to support FEFF 9.6 and other code improvements.
* Miscellaneous bug fixes.

v2.2.2
------
* Bug fix release for REST interface.
* Improvements to unittests.

v2.2.1
------
* Improvements to feffio.
* Master matgenie.py script which replaces many analysis scripts.
* More memory efficient parsing of VolumetricData.
* Beta version of structure prediction classes.
* Changes to MPRester to work with v1 release of the Materials API.
* Miscellaneous bug fixes and speed improvements.

v2.2.0
------
* Beta modules (pymatgen.io.feffio) for io for FEFF, courtesy of Alan Dozier.
* New smartio module that intelligently reads structure input files based on
  file extension.
* Spglib_adaptor module has been renamed to finder for brevity.
* Upgraded spglib to version 1.2.2. Improved handling of spglib install on
  Mac OS X and Solaris.
* Major cleanup of code for PEP8 compliance.
* Cssr module now supports reading of input files.
* Miscellaneous bug fixes and speed improvements.

v2.1.2
------
* Brand new CompoundPD class that allows the plotting of phase diagrams that
  do not have elements as their terminal points.
* Spglib is now completely integrated as part of the setup.py installation.
* Major (but completely backwards compatible) refactoring of sites and vaspio.
* Added a EnumerateStructureTransformation with optional dependency on the enum
  library by Gus Hart. This provides a robust way to enumerate derivative
  structures,
* Implemented LLL lattice reduction algorithm. Also added option to sanitize
  a Structure on copy.
* Bug fix for missing Compatibility file in release distribution.
* Vastly improved StructureFitter which performs cell reduction where necessary
  to speed up fitting.
* Miscellaneous bug fixes and speed improvements.

v2.0.0
------
* Brand new module (pymatgen.matproj.rest) for interfacing with the
  MaterialsProject REST interface.
* Useful aliases for commonly used Objects, similar in style to numpy.
  Supported objects include Element, Composition, Structure, Molecule, Spin
  and Orbital. For example, the following will now work::

      import pymatgen as mg
      # Elemental Si
      fe = mg.Element("Si")
      # Composition of Fe2O3
      comp = mg.Composition("Fe2O3")
      # CsCl structure
      structure = mg.Structure(mg.Lattice.cubic(4.2), ["Cs", "Cl"],
                               [[0, 0, 0], [0.5, 0.5, 0.5]])

* New PDAnalyzer method to generate chemical potential maps.
* Enhanced POSCAR class to support parsing of velocities and more formatting
  options.
* Reorganization of Bandstructure module. Beta support for projected
  bandstructure and eigenvalues in vaspio and electronic_structure.
* Miscellaneous bug fixes and speed improvements.

v1.9.0
------
* Completely new json encoder and decoder that support serialization of almost
  all pymatgen objects.
* Simplification to Borg API utilizing the new json API.
* Bandstructure classes now support spin-polarized runs.
* Beta classes for battery (insertion and conversion) analysis.

v1.8.3
------
* spglib_adaptor now supports disordered structures.
* Update to support new spglib with angle_tolerance.
* Changes to Borg API to support both file and directory style paths.
* Speed up for COMPLETE_ORDERING algo for PartialRemoveSpecieTransformation.

v1.8.1
------
* Revamped transmuter classes for better readability and long term support.
* Much improved speed for PartialRemoveSpecieTransformations.
* Misc bug fixes.

v1.8.0
------
* Support for additional properties on Specie (Spin) and Site (magmom, charge).
* Molecule class to support molecules without periodicity.
* Beta io class for XYZ and GaussianInput.

v1.7.2
------
* Bug fixes for vaspio_set and compatibility classes.

v1.7.0
------
* Complete reorganization of modules for electronic structure.
* Beta of band structure classes.
* Misc improvements to vaspio classes.
* Bug fixes.

v1.6.0
------
* Beta of pymatgen.borg package implemented for high-throughput data assimilation.
* Added ComputedEntry classes for handling calculated data.
* New method of specifying VASP pseudopotential location using a VASP_PSP_DIR
  environment variable.
* Bug fix for pymatgen.symmetry
* Ewald sum speed up by factor of 2 or more.


text:
<?php

use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Doctrine\ORM\Tools\SchemaTool;

use MyBundle\Entity\Document;
use MyBundle\Entity\Tramite;
use AppBundle\Entity\Comision;

class Tramites extends WebTestCase
{
    protected $em;

    public function setUp() {
        parent::setUp();

        $kernel = static::createKernel();
        $kernel->boot();

        $this->em = $kernel->getContainer()->get('doctrine')->getManager();
    }

    public function testPersistTramite()
    {
        $this->em->getConnection()->beginTransaction();

        $tramite = new Tramite();
        $this->em->persist($tramite);
        $this->em->flush($tramite);
    }

    public function testPersistComision()
    {
        $this->em->getConnection()->beginTransaction();

        $comision = new Comision();
        $comision->removeAllRecaudos();

        for ($i = 1; $i <= 4; $i++) {
            touch(__DIR__ . "/../../web/uploads/oficios/doc{$i}.pdf");
            $comision->addRecaudo(new Document("document{$i}", "/doc{$i}.pdf"));
        }

        $this->em->persist($comision);
        $this->em->flush($comision);
    }
}

redpajama_set_name: RedPajamaGithub


text:
describe Kontena::Workers::Volumes::VolumeManager, :celluloid => true do
  include RpcClientMocks

  let(:subject) { described_class.new(false) }
  let(:node) do
    Node.new(
      'id' => 'aaaa',
      'instance_number' => 2,
      'grid' => {}
    )
  end

  before(:each) do
    mock_rpc_client
    allow(subject.wrapped_object).to receive(:node).and_return(node)
  end

  describe '#initialize' do
    it 'starts to listen volume:update events' do
      expect(subject.wrapped_object).to receive(:on_update_notify).once
      Celluloid::Notifications.publish('volume:update', 'foo')
      sleep 0.1
    end
  end

  describe '#populate_volumes_from_master' do
    it 'fails with a warning if no proper response from master' do
      expect(rpc_client).to receive(:request).with('/node_volumes/list', [node.id]).and_return(
        {
          'volumes' => 'foo'
        }
      )
      expect(subject.wrapped_object).to receive(:error).with(/Invalid response from master/)
      expect{subject.populate_volumes_from_master}.not_to raise_error
    end

    it 'calls terminate and ensure with volumes from master' do
      expect(subject.wrapped_object).to receive(:terminate_volumes).with(['123', '456'])
      expect(rpc_client).to receive(:request).with('/node_volumes/list', [node.id]).and_return(
        {
          'volumes' => [
            {'name' => 'foo', 'volume_instance_id' => '123'},
            {'name' => 'bar', 'volume_instance_id' => '456'}
          ]
        }
      )
      expect(subject.wrapped_object).to receive(:ensure_volume).twice
      subject.populate_volumes_from_master
    end
  end

  describe '#populate_volumes_from_docker' do
    it 'sends volume info to master' do
      expect(Docker::Volume).to receive(:all).and_return(['foo', 'bar'])
      expect(subject.wrapped_object).to receive(:sync_volume_to_master).twice
      subject.populate_volumes_from_docker
    end
  end

  describe '#ensure_volume' do
    let(:volume) do
      Kontena::Models::Volume.new(
        {
          'name' => 'foo',
          'driver' => 'local',
          'driver_opts' => {},
          'labels' => {}
        }
      )
    end

    it 'does not create a volume if it already exists' do
      expect(subject.wrapped_object).to receive(:volume_exist?).with('foo', 'local').and_return(true)
      expect(Docker::Volume).not_to receive(:create)
      subject.ensure_volume(volume)
    end

    it 'does not create a volume if it already exists' do
      expect(Docker::Volume).to receive(:get).with('foo').and_raise(Docker::Error::NotFoundError)
      expect(Docker::Volume).to receive(:create).with('foo', {
        'Driver' => volume.driver,
        'DriverOpts' => volume.driver_opts,
        'Labels' => volume.labels
      }).and_return(double)
      expect(subject.wrapped_object).to receive(:sync_volume_to_master)
      subject.ensure_volume(volume)
    end

    it 'does not crash actor if random failure from docker' do
      expect(subject.wrapped_object).to receive(:volume_exist?).with('foo', 'local').and_return(false)
      expect(Docker::Volume).to receive(:create).and_raise(StandardError)
      expect(subject.wrapped_object).not_to receive(:sync_volume_to_master)
      subject.ensure_volume(volume)
      # The actor should be still alive
      expect(subject.alive?).to eq(true)
    end

    it 'does not crash actor from possible abort in volume_exists?' do
      # This will cause the Celluloid::abort to happen
      expect(Docker::Volume).to receive(:get).and_raise(StandardError)
      expect(subject.wrapped_object).not_to receive(:sync_volume_to_master)
      subject.ensure_volume(volume)
      # The actor should be still alive
      expect(subject.alive?).to eq(true)
    end

  end

  describe '#sync_volume_to_master' do
    it 'sends volume data to master' do
      expect(rpc_client).to receive(:request).with(
        '/node_volumes/set_state',
        [node.id, hash_including('name' => 'foo', 'volume_id' => '123', 'volume_instance_id' => '456')]
      )
      docker_volume = double(:volume, 'id' => 'foo', 'info' => {
        'Name' => 'foo',
        'Labels' => { 'io.kontena.volume.id' => '123', 'io.kontena.volume_instance.id' => '456'}
      })
      subject.sync_volume_to_master(docker_volume)
    end

    it 'does not send volume data to master for un-managed volume' do
      expect(rpc_client).not_to receive(:request)
      docker_volume = double(:volume, 'id' => 'foo', 'info' => {
        'Name' => 'foo',
        'Labels' => { }
      })
      subject.sync_volume_to_master(docker_volume)
    end
  end

  describe '#volume_exist?' do
    it 'return true if volume exists' do
      expect(Docker::Volume).to receive(:get).with('foo').and_return(double(:volume, :info => {'Driver' => 'local'}))
      expect(subject.volume_exist?('foo', 'local')).to be_truthy
    end

    it 'return false if volume not exists' do
      expect(Docker::Volume).to receive(:get).with('foo').and_raise(Docker::Error::NotFoundError)
      expect(subject.volume_exist?('foo', 'local')).to be_falsey
    end

    it 'raises if volume drivers do not match' do
      expect(Docker::Volume).to receive(:get).with('foo').and_return(double(:volume, :info => {'Driver' => 'foo'}))
      expect {
        subject.volume_exist?('foo', 'local')
      }.to raise_error(Kontena::Workers::Volumes::VolumeManager::DriverMismatchError)
    end

  end

  describe '#terminate_volumes' do
    it 'removes docker volumes that are not supposed to exist' do
      volumes = [
        double(:volume, 'id' => 'foo', 'info' => {
          'Name' => 'foo',
          'Labels' => { 'io.kontena.volume_instance.id' => '123'}
        }),
        double(:volume, 'id' => 'bar', 'info' => {
          'Name' => 'bar',
          'Labels' => { 'io.kontena.volume_instance.id' => '456'}
        })
      ]
      expect(Docker::Volume).to receive(:all).and_return(volumes)
      expect(volumes[0]).to receive(:remove)
      subject.terminate_volumes(['456'])
    end

    it 'handles error from volume remove' do
      volumes = [
        double(:volume, 'id' => 'foo', 'info' => {
          'Name' => 'foo',
          'Labels' => { 'io.kontena.volume_instance.id' => '123'}
        })
      ]
      expect(Docker::Volume).to receive(:all).and_return(volumes)
      expect(volumes[0]).to receive(:remove).and_raise("BoomBoom")
      subject.terminate_volumes(['456'])
      # The actor should be still alive
      expect(subject).to be_alive
    end
  end

end


text:
import sys
import unittest

import pygments
from pygments import console

from tests.utils import list_all_py_files
from tests.utils import CustomTestCase

from yapf.yapflib.yapf_api import FormatCode

def _read_utf_8_file(filename):
    if sys.version_info.major == 2:  ## Python 2 specific
        with open(filename, 'rb') as f:
            return unicode(f.read(), 'utf-8')
    else:
        with open(filename, encoding='utf-8') as f:
            return f.read()

def print_color(msg, color):
    print(pygments.console.colorize(color, msg))

class YAPF_Style_Test(unittest.TestCase):

    @classmethod
    def setUpClass(cls):

        cls.badly_formatted_files = list()
        cls.files_2_test = list_all_py_files()

    def test_files_format(self):

        total_analyzed_files = 0
        for file in list_all_py_files():

            total_analyzed_files += 1

            try:

                print(f"Testing: {file:100s}", end="")
                code = _read_utf_8_file(file)

                # https://pypi.python.org/pypi/yapf/0.20.2#example-as-a-module
                diff, changed = FormatCode(
                    code,
                    filename=file,
                    style_config='.style.yapf',
                    print_diff=True
                )

                if changed:
                    print_color("FAILURE", "red")
                    self.badly_formatted_files.append(file)
                else:
                    print_color("SUCCESS", "green")

            except Exception as e:
                print_color("FAILURE", "red")("FAILURE")
                print(
                    "Error while processing file: `%s`\n"
                    "Error: %s" % (file, str(e))
                )

        str_err = ""

        if self.badly_formatted_files:
            for filename in self.badly_formatted_files:
                str_err += f"yapf -i --style=.style.yapf {filename}\n"

            str_err = "\n======================================================================================\n" \
                        f"Bad Coding Style: {len(self.badly_formatted_files)} file(s) need to be formatted, run the following commands to fix: \n" \
                        f"{str_err}" \
                        "======================================================================================"

        passing_files = total_analyzed_files - len(self.badly_formatted_files)
        print_color(
            f"\nPASSING: {passing_files} / {total_analyzed_files}",
            "green" if str_err == "" else "red"
        )

        if str_err != "":
            print_color(str_err, "red")

        self.assertEqual(str_err, "")

if __name__ == '__main__':
    unittest.main()


text:
<?php

$installer = $this;
/* @var $installer Mage_Sales_Model_Mysql4_Setup */

$installer->startSetup();

$installer->addAttribute('quote_address_rate', 'method_title', array('type' => 'text'));

$installer->endSetup();


text:
module Fog
  module Compute
    class  XenServer

      class Real

        #
        # Puts the host into a state in which no new VMs can be started.
        # Currently active VMs on the host continue to execute.
        #
        # @see http://docs.vmd.citrix.com/XenServer/6.0.0/1.0/en_gb/api/?c=host
        #
        def disable_host( ref )
          @connection.request({:parser => Fog::Parsers::XenServer::Base.new, :method => "host.disable"}, ref)
        end

      end

      class Mock

        def disable_host( ref )
          Fog::Mock.not_implemented
        end

      end

    end
  end
end


text:
<?php

require_once __DIR__ . '/../bootstrap.php';

try {
    $client->handleCallback();
} catch (On2Media\OAuth2SSO\Exception $e) {
    echo 'Exception: ' . $e->getMessage();
    exit;
}

// here we'd check if we have a linked account amongst our users

$returnUrl = 'index.php';
if (isset($_SESSION['return_url'])) {
    $returnUrl = $_SESSION['return_url'];
    unset($_SESSION['return_url']);
}

header($_SERVER['SERVER_PROTOCOL'] . ' 302 Found');
header('Location: ' . $returnUrl);
exit;


text:
<?xml version="1.0" ?>
<tei>
	<teiHeader>
		<fileDesc xml:id="55007401"/>
	</teiHeader>
	<text xml:lang="en">
		<front>
<lb/>
	<note type="other">E-mu Emulator II+ (supersized<lb/> picture, frontpanel decals can be read).<lb/></note>

	<docTitle>
	<titlePart>E-mu Emulator<lb/></titlePart>
	</docTitle>

	<note type="other">From Wikipedia, the free encyclopedia<lb/></note>

	<note type="other">This is an old revision of this page, as edited by GoingBatty (talk | contribs) at 03:32, 4 August 2010. It may differ significantly from the current revision<lb/></note>

	<ptr type="web">(http://en.wikipedia.org/wiki/E-mu_Emulator) .<lb/></ptr>

	<note type="other">(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)<lb/></note>

		</front>
	</text>
</tei>


text:
(function () {
	'use strict';
	stControllers.controller('ProfileCtrl', ['$scope', '$log', 'Person',
		function ($scope, $log, Person) {
			$scope.profile = {
				ui: {
					tab: {
						active: 'general'
					},
					datepicker: {
						opened: false,
						dateOptions: {
							'year-format': "'yy'",
							'starting-day': 1
						},
						open: function ($event) {
							$event.preventDefault();
							$event.stopPropagation();

							$scope.profile.ui.datepicker.opened = !$scope.profile.ui.datepicker.opened;
						}
					}
				},
				person: {
					minHeartRate: {
						unit: '1/min'
					},
					maxHeartRate: {
						unit: '1/min'
					}
				}
			};

			$scope.$watch("profile.person.maxHeartRateMethod", function (newValue, oldValue) {
				computeMaxHeartRateIfNeeded();
			});

			$scope.$watch("profile.person.birthday", function (newValue, oldValue) {
				computeMaxHeartRateIfNeeded();
			});

			$scope.save = function() {
				Person.save($scope.profile.person);
			};

			var person = Person.get();
			person.$promise.then(function() {
				var personObject = person.object;

				if (personObject !== null) {
					personObject.birthday = new Date(personObject.birthday);

					$scope.profile.person = personObject;
				}
			});

			function computeMaxHeartRateIfNeeded() {
				if ($scope.profile.person && $scope.profile.person.maxHeartRateMethod == 'AUTO') {
					$scope.profile.person.maxHeartRate.value = 220 - Math.floor((new Date() - $scope.profile.person.birthday) / (1000 * 60 * 60 * 24 * 365));
				}
			}

		}
	]);
})();


text:
<?xml version="1.0"?>
<!--

-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="admin-1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceContainer name="after.body.start">
            <block class="Magento\Ui\Block\Logger" name="logger" template="Magento_Ui::logger.phtml"/>
        </referenceContainer>
    </body>
</page>


text:
import os
import unittest
import openid.urinorm

class UrinormTest(unittest.TestCase):
    def __init__(self, desc, case, expected):
        unittest.TestCase.__init__(self)
        self.desc = desc
        self.case = case
        self.expected = expected

    def shortDescription(self):
        return self.desc

    def runTest(self):
        try:
            actual = openid.urinorm.urinorm(self.case)
        except ValueError as why:
            self.assertEqual(self.expected, 'fail', why)
        else:
            self.assertEqual(actual, self.expected)

    def parse(cls, full_case):
        desc, case, expected = full_case.split('\n')
        case = str(case, 'utf-8') if isinstance(case, bytes) else case

        return cls(desc, case, expected)

    parse = classmethod(parse)

def parseTests(test_data):
    result = []

    cases = test_data.split('\n\n')
    for case in cases:
        case = case.strip()

        if case:
            result.append(UrinormTest.parse(case))

    return result

def pyUnitTests():
    here = os.path.dirname(os.path.abspath(__file__))
    test_data_file_name = os.path.join(here, 'urinorm.txt')
    test_data_file = open(test_data_file_name)
    test_data = test_data_file.read()
    test_data_file.close()

    tests = parseTests(test_data)
    return unittest.TestSuite(tests)

if __name__ == '__main__':
    runner = unittest.TextTestRunner()
    runner.run(pyUnitTests())


text:
<?php
namespace Valiknet\BlogBundle\Form\Type;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;

class AddCommentType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('text', 'textarea', [
                'max_length' => 255
            ]);
    }

    public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        $resolver->setDefaults(array(
            'data_class' => 'Valiknet\BlogBundle\Document\Comment',
        ));
    }

    public function getName()
    {
        return 'AddComment';
    }
}


text:
'use strict';
describe('Testing Test Filter', function () {

	var reverser;

	beforeEach(module('ngResponsiveApp'));
	beforeEach(inject(function ($filter) {
		reverser = $filter('reverser');
	}));

	it('should reverse the input value', function () {
		expect(reverser('hello')).toEqual('olleh');
		expect(reverser({test : 'hello'})).toEqual(']tcejbO tcejbo[');
	});

});


text:
package tanukkii.akkahttp.aws.dynamodb

import akka.actor.ActorSystem
import akka.stream.ActorMaterializer
import akka.testkit.TestKit
import com.amazonaws.auth.BasicAWSCredentials
import com.amazonaws.internal.StaticCredentialsProvider
import com.amazonaws.services.dynamodbv2.model._
import org.scalatest.concurrent.ScalaFutures
import org.scalatest.time.{Millis, Span}
import org.scalatest.{Matchers, DiagrammedAssertions, WordSpecLike, BeforeAndAfterAll}
import tanukkii.akkahttp.aws.{ConnectionSettings, HttpConnectionFlow}
import scala.concurrent.Future
import scala.concurrent.duration._
import scala.collection.JavaConverters._

class DynamoDBClientTest extends TestKit(ActorSystem("DynamoDBClientTest"))
with WordSpecLike
with DiagrammedAssertions
with Matchers
with BeforeAndAfterAll
with ScalaFutures {

  override implicit def patienceConfig: PatienceConfig = PatienceConfig(Span(3000, Millis), Span(500, Millis))

  implicit val materializer = ActorMaterializer()

  implicit var connectionFlow: HttpConnectionFlow = _

  override def beforeAll() = {
    connectionFlow = HttpConnectionFlow(
      ConnectionSettings(
        scheme = "http",
        host = "localhost",
        port = 8000,
        credentialsProvider = new StaticCredentialsProvider(new BasicAWSCredentials("aws_access_key_id", "aws_secret_access_key"))
      ),
      DynamoDBService()
    )
  }

  override def afterAll() = {

  }

  "DynamoDBClient" must {

    val tableName = "test-table"

    "createTable" in {
      val keySchema: List[KeySchemaElement] = List(
        new KeySchemaElement().withAttributeName("Id").withKeyType(KeyType.HASH)
      )
      val attributes = List(
        new AttributeDefinition().withAttributeName("Id").withAttributeType("N")
      )
      val result = DynamoDBClient.createTable(
        new CreateTableRequest(tableName, keySchema.asJava)
          .withAttributeDefinitions(attributes.asJava)
          .withProvisionedThroughput(new ProvisionedThroughput()
            .withReadCapacityUnits(5L)
            .withWriteCapacityUnits(6L))
      ).futureValue
      val desc = result.getTableDescription
      desc.getKeySchema should be(keySchema.asJava)
      desc.getAttributeDefinitions should be(attributes.asJava)
    }

    "listTables" in {
      DynamoDBClient.listTables(new ListTablesRequest()).futureValue.getTableNames.asScala should be(List(tableName))
    }

    "scan" in {
      import system.dispatcher

      val requests = 1 to 10 map { i =>
        DynamoDBClient.putItem(new PutItemRequest(tableName, Map("Id" -> new AttributeValue().withN(i.toString)).asJava))
      }
      Future.sequence(requests).futureValue

      val scanResult = DynamoDBClient.scan(new ScanRequest(tableName)).futureValue
      scanResult.getCount should be(10)
      scanResult.getItems.asScala.map(_.get("Id").getN).toSet should be(1 to 10 map (_.toString) toSet)
    }
  }
}


text:
namespace syncer {

class MockNudgeHandler : public NudgeHandler {
 public:
  MockNudgeHandler();
  virtual ~MockNudgeHandler();

  virtual void NudgeForInitialDownload(syncer::ModelType type) OVERRIDE;
  virtual void NudgeForCommit(syncer::ModelType type) OVERRIDE;
  virtual void NudgeForRefresh(syncer::ModelType type) OVERRIDE;

  int GetNumInitialDownloadNudges() const;
  int GetNumCommitNudges() const;
  int GetNumRefreshNudges() const;

  void ClearCounters();

 private:
  int num_initial_nudges_;
  int num_commit_nudges_;
  int num_refresh_nudges_;

  DISALLOW_COPY_AND_ASSIGN(MockNudgeHandler);
};

}  // namespace syncer

#endif  // SYNC_TEST_ENGINE_MOCK_NUDGE_HANDLER_H_


text:
namespace Envoy {
namespace Extensions {
namespace HttpFilters {
namespace GrpcJsonTranscoder {

class TranscoderInputStreamImpl : public Buffer::ZeroCopyInputStreamImpl,
                                  public google::grpc::transcoding::TranscoderInputStream {
public:
  // TranscoderInputStream
  virtual int64_t BytesAvailable() const override;
  virtual bool Finished() const override;
};

} // namespace GrpcJsonTranscoder
} // namespace HttpFilters
} // namespace Extensions
} // namespace Envoy


text:
Reports any calls to Throwable.initCause() where the exception constructor also takes a Throwable cause argument.
In this case the initCause() call can be removed and its argument added to the call to the exception's constructor.

New in 16


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

        <title>Change Log for ET_Redux Development</title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

ChangeLog for ET_Redux Development

Contact: Jim Bowring

Please contribute your ideas and bugs here: CIRDLES

v.  2.7.50 1 October 2012

            Release notes are located here.

v.  2.56.84 19 August 2010

                New menu for creating ID-TIMS samples: use menu ''U-Pb Sample File / New Sample Analysis for ID-TIMS''.
                All ID-TIMS Analysis samples now managed with Workflow Manager that supports Live Workflow for Tripoli 4.6+
                and complete portability of ".redux" files.  Details (refer to actual dialog screen):

                        Introduction:

A sample in ET_Redux is composed of aliquots, or physical pieces of the sample
                                (e.g. a zircon separate), which in turn are composed of fractions, or individual U/Pb analyses.
                                For more information about each, see their entries here, or ET_Redux Help.

                                To create a new aliquot, type its name in the Aliquot Name dialog box, increment the counter
                                below to the number of fractions it contains (you can add more at any time), and then select
                                ''Add Name''.  Add any number of aliquots in this way, and order them in the data table with the arrows to the left.
                                After entering the requisite information for each fraction, press ''SaveAs Sample With Data Structure''.
                                Navigate to the desired location, then create a new folder for your sample before saving the .redux file inside.
                                ET_Redux will create a sub-folder for each aliquot, populated with empty data files for each Pb and U measurement.

                        Samples:

A sample is a single collection of a geologic material from one location.  This name is shared by each
                                of the sample's fractions, or U/Pb analyses.  You don't have to give the .redux file or the folder that
                                contains it the exact same name as the sample.  However, when you export an analysis from Tripoli for ET_Redux,
                                you must provide the sample name correctly, or ET_Redux won't recognize it.  A sample name may not contain
                                spaces --- use hyphens or underscores instead.

                                To upload your sample to the GeoChron database, you may request an IGSN, or International Geologic Sample Number,
                                through SESAR ( www.geosamples.org ).  ET_Redux will guide you through this process when you publish from the Aliquot page.

                        Aliquots:

Aliquots are physical pieces of a sample whose dates you wish to interpret separately.  For instance,
                                zircon and titanite mineral separates could be two aliquots.  Pieces of a sample sent to two different labs,
                                or whose mineral separation was performed with two different techniques, would also be two aliquots.

                                New aliquots may be added at any time to an existing sample.  In this window, type a new name (over an existing name)
                                in the Aliquot Name dialog box, increment the counter below to number of fractions it contains (you can add more
                                fractions at any time), and then select ''Add Name''.

                        Fractions:

                                A fraction is a paired U+Pb analysis.  For instance, a zircon analyzed by TIMS or a spot zapped by LA-ICPMS
                                would be separate fractions, even if both analyzed the same grain.

                                To add fractions to this sample, choose an aliquot at left, increment the ''insert fractions'' counter
                                to the desired number of fractions, then click ''Add Fractions''.  Fractions may be removed by clicking
                                the red X on the left side of its row in the table.  If you have already made U/Pb measurements and
                                exported them from Tripoli (as .xml files), you can import them from this window.  Click the ''Import Fraction Files''
                                button, then navigate to and select the analyses you want to import.
                                You can hold control or shift to select multiple .xml files.  If these are the first fractions created for
                                this sample, your sample will automatically be given the name from the imported file.

                        Live Workflow:

                                The Live Workflow mode establishes a direct link between Tripoli and ET_Redux. Clicking the ''START Live Workflow''
                                button at the bottom of ET_Redux's main screen immediately imports data from Tripoli and prompts ET_Redux to
                                update its calculations.

                                To enable Live Workflow, you must create a folder called ''SampleMetaData'' and then click the ''Set SampleMetaData Folder'' button.

                                Tripoli must also be told the location of this SampleMetaData folder.  In Tripoli, point to this SampleMetaData
                                folder with the ''Set Live Workflow Data Folder'' item from the Control Panel menu.

                        Manual Update:

                                Redux can also read in new data files or refresh data from overwritten data files, as long as they are organized
                                into aliquot sub-folders in your sample's folder.  After saving or changing xml files, press the ''Update Data''
                                button at the bottom of the Redux main window.

                                While you can import new fractions this way, you must create new
                                aliquots from this window, using the interface at left.

                Oxide correction can now be performed on the corrections tab of an individual fraction.  You are also able to reverse the
                correction (if any) applied by Tripoli.

                Fraction Notes: the ''N'' button beside each fraction name (main screen, top) allows the analyst to keep notes on each fraction.
                The notes can be viewed together on the ''Fraction Notes'' tab of the aliquot editor.

                Report table shows an entry of '-' when no value exists.  Report table now supports dates in Ma, Ka, and auto-detect modes.

                Report Settings Models can be saved and imported to customize your experience.

                Publication of aliquots:  ET_Redux supports the publication of aliquots in a standard '.xml' format to a local drive or
                to the Geochron database.  See the aliquot window accessed by clicking on the gray aliquot button on the left of the fractions
                listed on the top of the main ET_Redux window.

                Compilation of aliquots:  ET_Redux supports the compilation of aliquots from many sources into a ''Super-Sample'' that
                can be explored using the sample date features including Concordia and weighted means across the compiled sample.   This
                feature is not fully developed, but users are pushing us to do so, so stay tuned. Steps:

                        Choose menu ''U-Pb Sample File / New Compilation of Aliquots into a ''"Super-Sample'' File.''

                        Choose either the ''Single Local Aliquot'' or the ''Import one or more Aliquots from Geochron database'' option.
                        ET_Redux does not yet support importing from a local folder option.
                        However, you can import multiple local aliquots one-at-a-time by using the menu ''U-Pb Sample File / Manage Sample Model.''

                        Once you have compiled two or more aliquots, you can use the Sample tab on the sample dates window
                        to explore Concordia and weighted means.

                LA-ICP MS legacy data can now be imported in bulk using .csv files, in a manner similar to that for ID-TIMS data.
                Please note that development continues to incorporate LA-ICP MS - centered interpretative tools into ET_Redux.

                Instructions to generate CSV data format for LA-ICP MS:

                        Click menu Tools / Open CSV File of LA-ICP MS Legacy Data Sample Field Names  .

                        Your default program for opening CSV files (Often Excel) will open a file called
                        LegacySampleFieldNamesTemplate.csv, ready for you to populate the columns
                        with the appropriate data.

                Once you have populated and saved the CSV file, you can import it into ET_Redux.

                Follow these steps:

                        Click menu U-Pb Sample File / New Sample File from Legacy Analysis / LA-ICP MS Legacy Analysis .

                        Click Bulk Mode from CSV File radio button on manager window that pops up.
                        Edit the sample and aliquot names to fit your data and click OK.

                        Navigate to your CSV file using the file finder window and click Open.

                        Save your sample (.redux) file in the folder of your choice and click Save.
                        Your reduced data appears in the data table in the bottom half of ET_Redux.
                        To view / edit your data, click on one of the grey Aliquot buttons in the top
                        frame of ET_Redux.  Note that the table at top displays blanks for any
                        missing ratio data.

Release of v. 2.53.00 November 03 2009  (text updated 3 May 2010)

                Added this changelog and a link to open it under the Help menu.

                Changed icon to new icon designed by Noah McLean of MIT (the mad scientist behind the scenes!)

                Added uncertainty calculations for isotopic ratios corrected by
                Th, Pa and ThPa.

                Added associated (rho) correlation coefficients for isotopic ratios
                corrected by Th, Pa and ThPa.

                Updated Report Settings module that drives the data tables:

                        Added Th, Pa and ThPa corrected isotopic ratios.

                        Added Pb* = total radiogenic Pb in picograms.

                        Added Correlation Coefficient to Isotopic Ratios category,
                        so it now appears there and in Dates category.
                        Defined as rhoR206_238r__r207_235r.

                        Corrected the significant digit mode of display so that it is
                        always driven by the significant digits of the absolute 1-sigma
                        uncertainty, even when uncertainty is displayed as a percentage.

                Added functionality at fraction window reports tab: Clicking
                buttons for reports will automatically open the report in a
                text editor.

                Repaired links to SESAR, which now has a domain: geosamples.org.

                Added persistance to usernames and passwords for Aliquot details publish tab.

                Added bulk import of legacy ID-TIMS data.  Drew Coleman suggested this feature in May 2009.
                To keep the architecture as open
                as possible, ET_Redux will import CSV (comma separated values) files.  These
                CSV files are easily opened and exported by all versions of Excel, Google Spreadsheets,
                OpenOffice.org, etc.  To begin, ET_Redux automatically writes
                and opens a CSV file with the appropriate column headings  NOTE: the
                headings are for your information only and are not parsed (so you can change them)
                -- the only requirement is that the order of the data fields remain the same.

 These are: Fraction, 206/238, 2-sig%, 207/235, 2-sig%, 207/206, 2-sig%, rho 6/38-7/35,
                206/204, 208/206, Pb*/Pbc, Pb* pg, Pbc pg, conc U, conc Pb, Th/U samp, frac mass, age206/238,
                2-sig, age207/235, 2-sig, age207/206, 2-sig, age206/238xTh, 2-sig, age207/235xPa, 2-sig,
                age207/206xTh, 2-sig, 207/206xPa, 2-sig

                Instructions to generate CSV data format:

                        Click menu Tools / Open CSV File of ID-TIMS Legacy Data Sample Field Names  .

                        Your default program for opening CSV files (Often Excel) will open a file called
                        LegacySampleFieldNamesTemplate.csv, ready for you to populate the columns
                        with the appropriate data.

                Once you have populated and saved the CSV file, you can import it into ET_Redux.

                Follow these steps:

                        Click menu U-Pb Sample File / New Sample File from Legacy Analysis / ID-TIMS Legacy Analysis .

                        Click Bulk Mode from CSV File radio button on manager window that pops up.
                        Edit the sample and aliquot names to fit your data and click OK.

                        Navigate to your CSV file using the file finder window and click Open.

                        Save your sample (.redux) file in the folder of your choice and click Save.
                        Your reduced data appears in the data table in the bottom half of ET_Redux.
                        To view / edit your data, click on one of the grey Aliquot buttons in the top
                        frame of ET_Redux.  Note that the table at top displays blanks for any
                        missing ratio data.

                Updated Aliquot tab to show Estimated Date (was age) as ''###0.0''.

                Improved the U-Pb Sample File menu so that up to 10 files show in menu item Recent Sample Files ....

                Added persistent state for the folder containing the current Sample file (.redux) so that menu item
                U-Pb Sample File / Open Sample File will access this folder automatically.

                Changed Fraction ratio data table (upper half of ET_Redux main view) to use
                a check box to toggle the selection of fractions used in the analysis.  Previously,
                the user clicked on fraction rows to do the same thing, but it was generally regarded as clunky.

                Changed WeightMeansChooser window in sample date interpretations to size itself
                to contain all the aliquots.

                Refined button architecture at bottom of main window.

                Report Table (bottom window main ET_Redux window)

                        Corrected tabulated data table (bottom of ET_Redux main window) response to scroll-wheels:
                        eliminated ''crawling''.

                        Revised report table to use three rows of column headings.

                        Added new category of Correlation Coefficients to Report Settings.

                        Refined column headings and footnotes.

                        Repaired Excel reports built from Report Settings.

                        Made report table sensitive to whether all included fractions have the same value for
                        initial fraction activity ratio [231Pa]/[235U] and for Th/U[magma].  If not, then the
                        cooresponding column appears in the Composition category listing the values by fraction
                        and the corresponding footnote is modified to alert the reader.
                        If the values are all the same, the column disappears and the standard footnote appears.

                        Added units choosers for mass and concentrations.  For dates, the units are
                        automatically ''Ma'' if any included fraction's 206/238 date > 1,000,000.

                        Set default report settings that you can modify and save through the reports menu item.

                        REMINDER: Using the report settings menu, you can customize the report layout and number formatting.

                        Added a customizable second Fraction name column.

                Added funding info to About box.

End of document.  Document started 20 September 2009.


text:
<?php

namespace PatternBuilder\Schema;

use PatternBuilder\Property\Component\Component;

/**
 * Interface to load a schema object.
 */
interface SchemaInterface
{
    /**
     * Returns a list of json files available.
     *
     * @return array Associative array of shortname => path to file
     */
    public function getSchemaFiles();

    /**
     * Returns the object from system cache.
     *
     * @param string $cid Cache ID.
     *
     * @return mixed Returns the object or FALSE if not found in cache.
     */
    public function loadCache($cid);

    /**
     * Returns the object from system cache.
     *
     * @param string    $cid           Cache ID.
     * @param Component $component_obj Component Object
     */
    public function saveCache($cid, Component $component_obj);

    /**
     * Clear the cached objects for the given cid.
     *
     * @param string $cid Cache ID.
     */
    public function clearCache($cid);

    /**
     * Clear all the cached objects.
     */
    public function clearAllCache();
}


text:
//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace Lecturer_Evaluation_System {

    public partial class Default {

        /// <summary>
        /// TextBox1 control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.TextBox TextBox1;

        /// <summary>
        /// TextBox2 control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.TextBox TextBox2;

        /// <summary>
        /// RequiredFieldValidator1 control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator1;

        /// <summary>
        /// RequiredFieldValidator2 control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator2;

        /// <summary>
        /// Label1 control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.Label Label1;

        /// <summary>
        /// Button1 control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.Button Button1;
    }
}


text:
let commentController = (function () {

	function addComment(ctx) {
		let isLoggedIn = userController.isLoggedIn();
		ctx.isLoggedIn = isLoggedIn;
		if (!isLoggedIn) {
			ctx.redirect('#/home');
		}
		let postId = ctx.params.id;
		let content = ctx.params.content;
		let author = userController.getUsername();
		let data = {
				postId,
				content,
				author,
			}
		requestService.post('appdata', 'comments', 'Kinvey', data)
		.then(function(res) {
			ctx.redirect('#/details/' + postId);
			infoService.showInfo('Comment added successfully!');
		}).catch(function(err) {
			infoService.handleAjaxError(err);
		});
	}

	function deleteComment(ctx) {
		let isLoggedIn = userController.isLoggedIn();
		ctx.isLoggedIn = isLoggedIn;
		if (!isLoggedIn) {
			ctx.redirect('#/home');
		}
		let id = ctx.params.id;
		requestService.remove('appdata', 'comments/' + id, 'Kinvey')
		.then(function(res) {
			ctx.redirect('#/posts');
			infoService.showInfo('Comment deleted successfully!');
		}).catch(function(err) {
			infoService.handleAjaxError(err);
		});
	}

	return {
		addComment,
		deleteComment
	}

})()


text:
// Copyright 2009 the Sputnik authors.  All rights reserved.
/**
 * The toString property of Array can't be used as constructor
 *
 * @path ch15/15.4/15.4.4/15.4.4.2/S15.4.4.2_A4.7.js
 * @description If property does not implement the internal [[Construct]] method, throw a TypeError exception
 */

//CHECK#1

try {
  new Array.prototype.toString();
  $ERROR('#1.1: new Array.prototype.toString() throw TypeError. Actual: ' + (new Array.prototype.toString()));
} catch (e) {
  if ((e instanceof TypeError) !== true) {
    $ERROR('#1.2: new Array.prototype.toString() throw TypeError. Actual: ' + (e));
  }
}


text:
struct brine_queue_s {
  size_t capacity;
  size_t growth_increment;
  size_t start;
  size_t end;
  size_t size;
  bool shutdown;
  void **data;
  ErlNifCond *cond;
  ErlNifMutex *lock;
};

#define BQ_BOTTOM(queue) queue->data[queue->start]
#define BQ_TOP(queue) queue->data[queue->end]
#define is_queue_full(queue) (queue->size == queue->capacity)
#define wrap_index(queue, index) (index == queue->capacity - 1) ? 0 : index + 1

static const size_t queue_entry_size = sizeof(void *);

brine_queue_errors grow_queue(brine_queue_s *queue);

brine_queue_s* brine_queue_new(size_t initial_capacity, size_t growth_increment) {
  brine_queue_s *retval = enif_alloc(sizeof(brine_queue_s));
  if (!retval) {
    goto ERROR;
  }
  if ((retval->data = enif_alloc(queue_entry_size * initial_capacity)) == NULL) {
      goto ERROR;
  }
  if ((retval->cond = enif_cond_create("brine_queue_cond")) == NULL) {
      goto ERROR;
  }
  if ((retval->lock = enif_mutex_create("brine_queue_lock")) == NULL) {
    goto ERROR;
  }
  retval->growth_increment = growth_increment;
  retval->start = 0;
  retval->end = 0;
  retval->size = 0;
  retval->capacity = initial_capacity;
  retval->shutdown = false;
  return retval;

ERROR:
  if (retval) {
    if (retval->data) {
      enif_free(retval->data);
    }
    if (retval->cond) {
      enif_cond_destroy(retval->cond);
    }
    if (retval->lock) {
      enif_mutex_destroy(retval->lock);
    }
    enif_free(retval);
    retval = NULL;
  }
  return retval;
}

void brine_queue_destroy(brine_queue_s **ref) {
  brine_queue_s *queue = *ref;
  enif_free(queue->data);
  enif_cond_destroy(queue->cond);
  enif_mutex_destroy(queue->lock);
  enif_free(queue);
  *ref = NULL;
}

void* brine_queue_dequeue(brine_queue_s *queue){

  void *retval;
  if (!queue) {
    return NULL;
  }
  enif_mutex_lock(queue->lock);
  if (queue->size == 0) {
    while(queue->size == 0) {
      enif_cond_wait(queue->cond, queue->lock);
    }
  }
  retval = BQ_BOTTOM(queue);
  BQ_BOTTOM(queue) = NULL;
  queue->size--;
  if (queue->size == 0) {
    queue->start = 0;
    queue->end = 0;
  }
  else {
    queue->start = wrap_index(queue, queue->start);
  }
  enif_mutex_unlock(queue->lock);
  return retval;
}

brine_queue_errors brine_queue_enqueue(brine_queue_s *queue, void* entry) {

  int retval;
  if (!queue) {
    return BQ_NULL_QUEUE;
  }
  if (!entry) {
    return BQ_NULL_DATA;
  }
  enif_mutex_lock(queue->lock);
  if (is_queue_full(queue)) {
    if ((retval = grow_queue(queue)) != BQ_SUCCESS) {
      return retval;
    }
  }
  BQ_TOP(queue) = entry;
  queue->size++;
  queue->end = wrap_index(queue, queue->end);
  enif_cond_signal(queue->cond);
  enif_mutex_unlock(queue->lock);
  return BQ_SUCCESS;
}

brine_queue_errors grow_queue(brine_queue_s *queue) {
  size_t index = 0;
  size_t count = 0;
  size_t capacity = queue->capacity + (queue_entry_size * queue->growth_increment);
  void ** data = enif_alloc(capacity);
  if(data == NULL) {
    return BQ_NO_MEMORY;
  }
  for(index = queue->start, count = 0; count < queue->size;
      index = (index + 1) % queue->size, count++) {
    data[count] = queue->data[index];
  }
  //delete old queue and fix meta data.
  enif_free(queue->data);
  queue->data = data;
  queue->capacity *= 2;
  queue->start = 0;
  queue->end = queue->size;

  return BQ_SUCCESS;;
}


text:
namespace xwalk {

class XWalkBrowserContext;

namespace application {

// The application service manages launch and termination of the applications.
class ApplicationService : public Application::Observer {
 public:
  // Client code may use this class (and register with AddObserver below) to
  // keep track of applications life cycle.
  class Observer {
   public:
    virtual void DidLaunchApplication(Application* app) {}
    virtual void WillDestroyApplication(Application* app) {}
   protected:
    virtual ~Observer() {}
  };

  virtual ~ApplicationService();

  static scoped_ptr<ApplicationService> Create(
    XWalkBrowserContext* browser_context);

  // Launch an unpacked application using path to the manifest file
  // of an unpacked application.
  Application* LaunchFromManifestPath(
      const base::FilePath& path, Manifest::Type manifest_type,
      const Application::LaunchParams& params = Application::LaunchParams());

  // Launch an application using path to its package file.
  // Note: the given package is unpacked to a temporary folder,
  // which is deleted after the application terminates.
  Application* LaunchFromPackagePath(
      const base::FilePath& path,
      const Application::LaunchParams& params = Application::LaunchParams());

  // Launch an application from an arbitrary URL.
  // Creates a "dummy" application.
  Application* LaunchHostedURL(
      const GURL& url,
      const Application::LaunchParams& params = Application::LaunchParams());

  Application* GetApplicationByRenderHostID(int id) const;
  Application* GetApplicationByID(const std::string& app_id) const;

  const ScopedVector<Application>& active_applications() const {
      return applications_; }

  void AddObserver(Observer* observer);
  void RemoveObserver(Observer* observer);

  // Check whether application has permission to access API of extension.
  void CheckAPIAccessControl(const std::string& app_id,
      const std::string& extension_name,
      const std::string& api_name, const PermissionCallback& callback);
  // Register APIs implemented by extension. This method will be called
  // when application register extensions.
  // Parameter perm_table is a string which is a map between extension
  // and it includes APIs. For example perm_table is like '{"bluetooth":
  // ["read", "write", "management"]}'.
  bool RegisterPermissions(const std::string& app_id,
      const std::string& extension_name,
      const std::string& perm_table);

 protected:
  explicit ApplicationService(XWalkBrowserContext* browser_context);

  Application* Launch(scoped_refptr<ApplicationData> application_data,
                      const Application::LaunchParams& launch_params);

 private:
  // Implementation of Application::Observer.
  void OnApplicationTerminated(Application* app) override;

  XWalkBrowserContext* browser_context_;
  ScopedVector<Application> applications_;
  ObserverList<Observer> observers_;

  DISALLOW_COPY_AND_ASSIGN(ApplicationService);
};

}  // namespace application
}  // namespace xwalk

#endif  // XWALK_APPLICATION_BROWSER_APPLICATION_SERVICE_H_


text:
import { h } from 'preact'
import PreactCSSTransitionGroup from 'preact-css-transition-group'

import Loading from './LoadingSpinner'
import Failure from './Failure'
import App from './App'

const AppWrapper = ({
  isAsync,
  isFailure,
  isLoadingImage,
  tries,
  children
}) => {
  let component

  if (isFailure) {
    component = <Failure key="failure-key" tries={tries} />
  }

  const appComponent = (
    <App key="app-key">{!component ? children : component}</App>
  )

  if (isAsync) {
    return appComponent
  } else {
    if (isLoadingImage) {
      component = <Loading key="loading-key" />
    }
    if (!component) {
      component = appComponent
    }

    return (
      <PreactCSSTransitionGroup
        transitionName="fade"
        transitionEnterTimeout={1000}
        transitionLeaveTimeout={500}
      >
        {component}
      </PreactCSSTransitionGroup>
    )
  }
}

export default AppWrapper


text:
/**
 * @file rm3100.cpp
 *
 * Driver for the RM3100 magnetometer connected via I2C or SPI.
 *
 * Based on the lis3mdl driver.
 */

#include "rm3100.h"

RM3100::RM3100(device::Device *interface, enum Rotation rotation, I2CSPIBusOption bus_option, int bus) :
	I2CSPIDriver(MODULE_NAME, px4::device_bus_to_wq(interface->get_device_id()), bus_option, bus),
	_px4_mag(interface->get_device_id(), rotation),
	_interface(interface),
	_comms_errors(perf_alloc(PC_COUNT, MODULE_NAME": comms_errors")),
	_conf_errors(perf_alloc(PC_COUNT, MODULE_NAME": conf_errors")),
	_range_errors(perf_alloc(PC_COUNT, MODULE_NAME": range_errors")),
	_sample_perf(perf_alloc(PC_ELAPSED, MODULE_NAME": read")),
	_continuous_mode_set(false),
	_mode(SINGLE),
	_measure_interval(0),
	_check_state_cnt(0)
{
	_px4_mag.set_external(_interface->external());

	_px4_mag.set_scale(1.f / (RM3100_SENSITIVITY * UTESLA_TO_GAUSS));
}

RM3100::~RM3100()
{
	// free perf counters
	perf_free(_sample_perf);
	perf_free(_comms_errors);
	perf_free(_range_errors);
	perf_free(_conf_errors);

	delete _interface;
}

int RM3100::self_test()
{
	/* Chances are that a poll event was triggered, so wait for conversion and read registers in order to clear DRDY bit */
	usleep(RM3100_CONVERSION_INTERVAL);
	collect();

	/* Fail if calibration is not good */
	int ret = 0;
	uint8_t cmd = 0;

	/* Configure mag into self test mode */
	cmd = BIST_SELFTEST;
	ret = _interface->write(ADDR_BIST, &cmd, 1);

	if (ret != PX4_OK) {
		return ret;
	}

	/* Now we need to write to POLL to launch self test */
	cmd = POLL_XYZ;
	ret = _interface->write(ADDR_POLL, &cmd, 1);

	if (ret != PX4_OK) {
		return ret;
	}

	/* Now wait for status register */
	usleep(RM3100_CONVERSION_INTERVAL);

	if (check_measurement() != PX4_OK) {
		return -1;;
	}

	/* Now check BIST register to see whether self test is ok or not*/
	ret = _interface->read(ADDR_BIST, &cmd, 1);

	if (ret != PX4_OK) {
		return ret;
	}

	ret = !((cmd & BIST_XYZ_OK) == BIST_XYZ_OK);

	return ret;
}

int RM3100::check_measurement()
{
	uint8_t status = 0;
	int ret = _interface->read(ADDR_STATUS, &status, 1);

	if (ret != 0) {
		return ret;
	}

	return !((status & STATUS_DRDY) == STATUS_DRDY) ;
}

int RM3100::collect()
{
	/* Check whether a measurement is available or not, otherwise return immediately */
	if (check_measurement() != 0) {
		PX4_DEBUG("No measurement available");
		return 0;
	}

	struct {
		uint8_t x[3];
		uint8_t y[3];
		uint8_t z[3];
	} rm_report{};

	_px4_mag.set_error_count(perf_event_count(_comms_errors));

	perf_begin(_sample_perf);

	const hrt_abstime timestamp_sample = hrt_absolute_time();
	int ret = _interface->read(ADDR_MX, (uint8_t *)&rm_report, sizeof(rm_report));

	if (ret != OK) {
		perf_end(_sample_perf);
		perf_count(_comms_errors);
		return ret;
	}

	perf_end(_sample_perf);

	/* Rearrange mag data */
	int32_t xraw = ((rm_report.x[0] << 16) | (rm_report.x[1] << 8) | rm_report.x[2]);
	int32_t yraw = ((rm_report.y[0] << 16) | (rm_report.y[1] << 8) | rm_report.y[2]);
	int32_t zraw = ((rm_report.z[0] << 16) | (rm_report.z[1] << 8) | rm_report.z[2]);

	/* Convert 24 bit signed values to 32 bit signed values */
	convert_signed(&xraw);
	convert_signed(&yraw);
	convert_signed(&zraw);

	_px4_mag.update(timestamp_sample, xraw, yraw, zraw);

	ret = OK;

	return ret;
}

void RM3100::convert_signed(int32_t *n)
{
	/* Sensor returns values as 24 bit signed values, so we need to manually convert to 32 bit signed values */
	if ((*n & (1 << 23)) == (1 << 23)) {
		*n |= 0xFF000000;
	}
}

void RM3100::RunImpl()
{
	/* _measure_interval == 0  is used as _task_should_exit */
	if (_measure_interval == 0) {
		return;
	}

	/* Collect last measurement at the start of every cycle */
	if (collect() != OK) {
		PX4_DEBUG("collection error");
		/* restart the measurement state machine */
		start();
		return;
	}

	if (measure() != OK) {
		PX4_DEBUG("measure error");
	}

	if (_measure_interval > 0) {
		/* schedule a fresh cycle call when the measurement is done */
		ScheduleDelayed(_measure_interval);
	}
}

int RM3100::init()
{
	/* reset the device configuration */
	reset();

	int ret = self_test();

	if (ret != PX4_OK) {
		PX4_ERR("self test failed");
	}

	_measure_interval = RM3100_CONVERSION_INTERVAL;
	start();

	return ret;
}

int RM3100::measure()
{
	int ret = 0;
	uint8_t cmd = 0;

	/* Send the command to begin a measurement. */
	if ((_mode == CONTINUOUS) && !_continuous_mode_set) {
		cmd = (CMM_DEFAULT | CONTINUOUS_MODE);
		ret = _interface->write(ADDR_CMM, &cmd, 1);
		_continuous_mode_set = true;

	} else if (_mode == SINGLE) {
		if (_continuous_mode_set) {
			/* This is needed for polling mode */
			cmd = (CMM_DEFAULT | POLLING_MODE);
			ret = _interface->write(ADDR_CMM, &cmd, 1);

			if (ret != OK) {
				perf_count(_comms_errors);
				return ret;
			}

			_continuous_mode_set = false;
		}

		cmd = POLL_XYZ;
		ret = _interface->write(ADDR_POLL, &cmd, 1);
	}

	if (ret != OK) {
		perf_count(_comms_errors);
	}

	return ret;
}

void RM3100::print_status()
{
	I2CSPIDriverBase::print_status();
	perf_print_counter(_sample_perf);
	perf_print_counter(_comms_errors);
	PX4_INFO("poll interval:  %u", _measure_interval);
}

int RM3100::reset()
{
	int ret = set_default_register_values();

	if (ret != OK) {
		return PX4_ERROR;
	}

	return PX4_OK;
}

int RM3100::set_default_register_values()
{
	uint8_t cmd[2] = {0, 0};

	cmd[0] = CCX_DEFAULT_MSB;
	cmd[1] = CCX_DEFAULT_LSB;
	_interface->write(ADDR_CCX, cmd, 2);

	cmd[0] = CCY_DEFAULT_MSB;
	cmd[1] = CCY_DEFAULT_LSB;
	_interface->write(ADDR_CCY, cmd, 2);

	cmd[0] = CCZ_DEFAULT_MSB;
	cmd[1] = CCZ_DEFAULT_LSB;
	_interface->write(ADDR_CCZ, cmd, 2);

	cmd[0] = CMM_DEFAULT;
	_interface->write(ADDR_CMM, cmd, 1);

	cmd[0] = TMRC_DEFAULT;
	_interface->write(ADDR_TMRC, cmd, 1);

	cmd[0] = BIST_DEFAULT;
	_interface->write(ADDR_BIST, cmd, 1);

	return PX4_OK;
}

void RM3100::start()
{
	set_default_register_values();

	/* schedule a cycle to start things */
	ScheduleNow();
}