text:
package com.skynav.ttpe.fonts;

import java.io.File;
import java.io.FileFilter;
import java.util.BitSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

import com.skynav.ttpe.geometry.Axis;
import com.skynav.ttpe.geometry.Extent;
import com.skynav.ttv.util.Reporter;

public class FontCache {

    private File fontSpecificationDirectory;
    private List<File> fontSpecificationFiles;
    private boolean loaded;
    private List<FontSpecification> fontSpecifications;
    private Map<FontKey,Font> instances;
    private Map<String,FontState> loadedState;
    private Reporter reporter;

    public FontCache(File fontSpecificationDirectory, List<File> fontSpecificationFiles, Reporter reporter) {
        this.fontSpecificationDirectory = fontSpecificationDirectory;
        if (fontSpecificationFiles != null)
            this.fontSpecificationFiles = new java.util.ArrayList<File>(fontSpecificationFiles);
        this.instances = new java.util.HashMap<FontKey,Font>();
        this.loadedState = new java.util.HashMap<String,FontState>();
        this.reporter = reporter;
    }

    public Font getDefaultFont(Axis axis, Extent size, String language) {
        return get(new FontKey((axis == Axis.VERTICAL) ? FontKey.DEFAULT_VERTICAL : FontKey.DEFAULT_HORIZONTAL, size, language));
    }

    public Font getLastResortFont(Axis axis, Extent size) {
        return get(new FontKey((axis == Axis.VERTICAL) ? FontKey.LAST_RESORT_VERTICAL : FontKey.LAST_RESORT_HORIZONTAL, size));
    }

    public Font mapFont(List<String> families, FontStyle style, FontWeight weight, String language, Axis axis, Extent size, Set<FontFeature> features) {
        FontSpecification fs;
        if ((fs = findExactMatch(families, style, weight, language)) == null)
            fs = findBestMatch(families, style, weight, language, axis, size);
        if (fs != null)
            return get(new FontKey(fs.family, fs.style, fs.weight, fs.language, axis, size, features));
        return null;
    }

    public Font get(FontKey key) {
        Font f = instances.get(key);
        if (f == null) {
            f = create(key);
            if (f != null)
                put(f);
        }
        return f;
    }

    public Font getScaledFont(Font font, double scale) {
        return get(font.getKey().getScaled(scale));
    }

    public void put(Font f) {
        instances.put(f.getKey(), f);
    }

    public FontCache maybeLoad() {
        if (!loaded)
            load();
        return this;
    }

    public void clear() {
        instances.clear();
        loadedState.clear();
    }

    public FontState getLoadedState(String source, BitSet forcePath, Reporter reporter) {
        FontState fs;
        if ((fs = loadedState.get(source)) == null)
            fs = createLoadedState(source, forcePath, reporter);
        return fs;
    }

    private FontSpecification findExactMatch(List<String> families, FontStyle style, FontWeight weight, String language) {
        for (String family : families) {
            if (fontSpecifications != null) {
                for (FontSpecification  fs : fontSpecifications) {
                    if (fs.family.compareToIgnoreCase(family) == 0) {
                        if (fs.style != style)
                            continue;
                        if (fs.weight != weight)
                            continue;
                        if ((language != null) && (fs.language != null) && !fs.language.equals(language))
                            continue;
                        return fs;
                    }
                }
            }
        }
        return null;
    }

    private FontSpecification findBestMatch(List<String> families, FontStyle style, FontWeight weight, String language, Axis axis, Extent size) {
        if (fontSpecifications != null) {
            List<FontSpecification> matchesFamily = new java.util.ArrayList<FontSpecification>();
            for (FontSpecification  fs : fontSpecifications) {
                for (String family : families) {
                    if (fs.family.compareToIgnoreCase(family) == 0)
                        matchesFamily.add(fs);
                }
            }
            List<FontSpecification> matchesLanguage = new java.util.ArrayList<FontSpecification>();
            for (FontSpecification  fs : matchesFamily) {
                if ((language == null) || language.isEmpty())
                    matchesLanguage.add(fs);
                else if (fs.language.compareToIgnoreCase(language) == 0)
                    matchesLanguage.add(fs);
            }
            List<FontSpecification> matchesStyle = new java.util.ArrayList<FontSpecification>();
            for (FontSpecification  fs : matchesLanguage) {
                if (style == null)
                    matchesStyle.add(fs);
                else if (fs.style == style)
                    matchesStyle.add(fs);
            }
            List<FontSpecification> matchesWeight = new java.util.ArrayList<FontSpecification>();
            for (FontSpecification  fs : matchesStyle) {
                if (weight == null)
                    matchesWeight.add(fs);
                else if (fs.weight == weight)
                    matchesWeight.add(fs);
            }
            if (!matchesWeight.isEmpty())
                return matchesWeight.get(0);
            if (!matchesStyle.isEmpty())
                return matchesStyle.get(0);
            if (!matchesLanguage.isEmpty())
                return matchesLanguage.get(0);
            if (!matchesFamily.isEmpty())
                return matchesFamily.get(0);
        }
        Font f = getDefaultFont(axis, size, language);
        return (f != null) ? f.getSpecification() : null;
    }

    private Font create(FontKey key) {
        FontSpecification fs = findSpecification(key);
        if (fs != null)
            return new Font(this, key, fs.source, fs.forcePath, reporter);
        else
            return null;
    }

    private FontSpecification findSpecification(FontKey key) {
        if (fontSpecifications != null) {
            for (FontSpecification fs : fontSpecifications) {
                if (fs.matches(key))
                    return fs;
            }
        }
        return null;
    }

    private void load() {
        if (fontSpecificationDirectory != null) {
            assert fontSpecificationDirectory.exists();
            assert fontSpecificationDirectory.isDirectory();
            FileFilter filter = new FileFilter() {
                public boolean accept(File f) {
                    return maybeFontSpecificationFile(f);
                }
            };
            File[] files = fontSpecificationDirectory.listFiles(filter);
            if (files != null) {
                for (File f : files) {
                    if (fontSpecificationFiles == null)
                        fontSpecificationFiles = new java.util.ArrayList<File>();
                    fontSpecificationFiles.add(f);
                }
            }
        }
        if (fontSpecificationFiles != null) {
            fontSpecifications = FontLoader.load(fontSpecificationFiles, reporter);
        }
        if ((fontSpecifications == null) || fontSpecifications.isEmpty())
            reporter.logWarning(reporter.message("*KEY*", "No font specifications! No text will be rendered."));
        loaded = true;
    }

    private static boolean maybeFontSpecificationFile(File f) {
        assert f != null;
        String n = f.getName();
        assert n != null;
        return n.endsWith(".xml");
    }

    public FontState createLoadedState(String source, BitSet forcePath, Reporter reporter) {
        FontState fs = new FontState(source, forcePath, reporter);
        assert loadedState != null;
        assert !loadedState.containsKey(source);
        loadedState.put(source, fs);
        return fs;
    }

}


text:
using System;
using System.Collections.Generic;
using System.Text;
using Imagination.Model;

namespace Imagination.Service
{
	public interface ILWM2MServerService
	{
        void CancelObserveObject(Guid clientID, Guid objectDefinitionID, string instanceID, bool useReset);

        void CancelObserveObjectProperty(Guid clientID, Guid objectDefinitionID, string instanceID, Guid propertyDefinitionID, bool useReset);

        void CancelObserveObjects(Guid clientID, Guid objectDefinitionID, bool useReset);

        bool ExecuteResource(Guid clientID, Guid objectDefinitionID, string instanceID, Guid propertyDefinitionID);

        List<Client> GetClients();

        void DeleteClient(Guid clientID);

        DeviceConnectedStatus GetDeviceConnectedStatus(Guid clientID);

        Model.Object GetObject(Guid clientID, Guid objectDefinitionID, string instanceID);

        Property GetObjectProperty(Guid clientID, Guid objectDefinitionID, string instanceID, Guid propertyDefinitionID);

		List<Model.Object> GetObjects(Guid clientID, Guid objectDefinitionID);

        void ObserveObject(Guid clientID, Guid objectDefinitionID, string instanceID);

        void ObserveObjectProperty(Guid clientID, Guid objectDefinitionID, string instanceID, Guid propertyDefinitionID);

        void ObserveObjects(Guid clientID, Guid objectDefinitionID);

        string SaveObject(Guid clientID, Model.Object item, TObjectState state);

		void SaveObjectProperty(Guid clientID, Guid objectDefinitionID, string instanceID, Property property, Model.TObjectState state);

        void SetDataFormat(TDataFormat dataFormat);

        bool SetNotificationParameters(Guid clientID, Guid objectDefinitionID, string instanceID, Guid propertyDefinitionID, NotificationParameters notificationParameters);
	}
}

redpajama_set_name: RedPajamaGithub


text:
/**
 * @fileoverview Tests for no-unexpected-multiline rule.
 * @author Glen Mailer
 */

"use strict";

//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------

var rule = require("../../../lib/rules/no-unexpected-multiline"),
    RuleTester = require("../../../lib/testers/rule-tester");

var ruleTester = new RuleTester();
ruleTester.run("no-unexpected-multiline", rule, {
    valid: [
        "(x || y).aFunction()",
        "[a, b, c].forEach(doSomething)",
        "var a = b;\n(x || y).doSomething()",
        "var a = b\n;(x || y).doSomething()",
        "var a = b\nvoid (x || y).doSomething()",
        "var a = b;\n[1, 2, 3].forEach(console.log)",
        "var a = b\nvoid [1, 2, 3].forEach(console.log)",
        "\"abc\\\n(123)\"",
        "var a = (\n(123)\n)",
        "f(\n(x)\n)",
        {
            code: "let x = function() {};\n   `hello`",
            parserOptions: { ecmaVersion: 6 }
        },
        {
            code: "let x = function() {}\nx `hello`",
            parserOptions: { ecmaVersion: 6 }
        },
        {
            code: "String.raw `Hi\n${2+3}!`;",
            parserOptions: { ecmaVersion: 6 }
        },
        {
            code: "x\n.y\nz `Valid Test Case`",
            parserOptions: { ecmaVersion: 6 }
        }
    ],
    invalid: [
        {
            code: "var a = b\n(x || y).doSomething()",
            line: 2,
            column: 1,
            errors: [{ message: "Unexpected newline between function and ( of function call." }]
        },
        {
            code: "var a = (a || b)\n(x || y).doSomething()",
            line: 2,
            column: 1,
            errors: [{ message: "Unexpected newline between function and ( of function call." }]
        },
        {
            code: "var a = (a || b)\n(x).doSomething()",
            line: 2,
            column: 1,
            errors: [{ message: "Unexpected newline between function and ( of function call." }]
        },
        {
            code: "var a = b\n[a, b, c].forEach(doSomething)",
            line: 2,
            column: 1,
            errors: [{ message: "Unexpected newline between object and [ of property access." }]
        },
        {
            code: "var a = b\n    (x || y).doSomething()",
            line: 2,
            column: 5,
            errors: [{ message: "Unexpected newline between function and ( of function call." }]
        },
        {
            code: "var a = b\n  [a, b, c].forEach(doSomething)",
            line: 2,
            column: 3,
            errors: [{ message: "Unexpected newline between object and [ of property access." }]
        },
        {
            code: "let x = function() {}\n `hello`",
            parserOptions: { ecmaVersion: 6 },
            line: 1,
            column: 9,
            errors: [{ message: "Unexpected newline between template tag and template literal." }]
        },
        {
            code: "let x = function() {}\nx\n`hello`",
            parserOptions: { ecmaVersion: 6 },
            line: 2,
            column: 1,
            errors: [{ message: "Unexpected newline between template tag and template literal." }]
        },
        {
            code: "x\n.y\nz\n`Invalid Test Case`",
            parserOptions: { ecmaVersion: 6 },
            line: 3,
            column: 1,
            errors: [{ message: "Unexpected newline between template tag and template literal." }]
        }
    ]
});


text:
package it.rest.utility;

import it.rest.webservice.InfoPersonaggio;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.apache.log4j.Logger;
import org.apache.log4j.xml.DOMConfigurator;
import org.json.JSONArray;
import org.json.JSONObject;

public class GetValues {
   public String ServerTomcat = "http://inthefootsteps.solr.netseven.it/rest";
   public String infoPersonaggio = "/InfoPersonaggio/";
   public String endpoint = "http://data.fusepool.info:8181/sparql/select";

   private static Logger logger = Logger.getLogger(GetValues.class);
   private final String log4jProp="/var/lib/openshift/5528e950fcf93381de00012a/app-root/data/propLog.xml";

   public GetValues(){
       DOMConfigurator.configure(log4jProp);
       logger.debug("Creazione oggeto GetValues");
   }

            String queryPersonaggiStorici = "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n" +
                "PREFIX schema: <http://schema.org/>\n" +
                "PREFIX dbo: <http://www.dbpedia.org/ontology/>\n" +
                "PREFIX fam: <http://vocab.fusepool.info/fam#>\n" +
                "\n" +
                "SELECT DISTINCT ?person ?name ?job \n"+
                "FROM <http://data.fusepool.info:8181/ldp/historical-characters/personaggi_storici_trentino-refine-csv-csv-transformed>" +
                "\n WHERE {\n" +
                "  ?person a schema:Person ;\n" +
                "             schema:name ?name ;\n" +
                "              schema:jobTitle ?job ; \n" +
                "             fam:entity-reference ?ref . \n"+
                "} \n ORDER BY ?name";

   public String getPersonaggiStoriciJSON(){
       logger.info("ListaPersonaggi JSON");

       String res ="";

       Sparql sp = new Sparql(queryPersonaggiStorici, endpoint);
       JSONObject result = new JSONObject(sp.returnJSON());
       JSONArray jarray = result.getJSONObject("results").getJSONArray("bindings");
       JSONArray arrayRisultati = new JSONArray(); //riscrivamo i risultati in maniera piu bella
       for(int i=0; i < jarray.length(); i++)
       {
           JSONObject row = new JSONObject();
           String uri = jarray.getJSONObject(i).getJSONObject("person").getString("value");
           String name = jarray.getJSONObject(i).getJSONObject("name").getString("value");
           String job = "";
           if(jarray.getJSONObject(i).has("job"))
                   job = jarray.getJSONObject(i).getJSONObject("job").getString("value");
           row.accumulate("URI", uri);
           row.accumulate("name", name);
           row.accumulate("icona", Place.returnJobIcona(job));
           row.accumulate("detailEndpoint",ServerTomcat+infoPersonaggio+uri.replace("http://www.trentinocultura.net/asp_cat/main.asp?", ""));
           arrayRisultati.put(row);
       }
       logger.info("Restituiti "+arrayRisultati.length()+" personaggi storici");

   // return sp.returnJSON();
       return arrayRisultati.toString();
   }

   public String getPersonaggiStoriciHTML(){
       logger.info("ListaPersonaggi HTML");
       String res ="";
       Sparql sp = new Sparql(queryPersonaggiStorici, endpoint);
       return sp.returnHTML();
   }

   public String getInfoPersonaggioHTML(String URI){
       logger.info("InfoPersonaggioHTML" +"richiesto:"+URI);

       String queryPersonaggio = "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n" +
        "PREFIX schema: <http://schema.org/>\n" +
        "PREFIX dbo: <http://www.dbpedia.org/ontology/>\n" +
        "PREFIX fam: <http://vocab.fusepool.info/fam#>\n" +
        "\n" +
        "SELECT ?name ?title ?birthPlace ?deathPlace ?sameAs ?description ?reference \n" +
        "FROM <http://data.fusepool.info:8181/ldp/historical-characters/personaggi_storici_trentino-refine-csv-csv-transformed>\n" +
        "WHERE {\n" +
        "<"+URI+"> schema:name ?name."+
        "OPTIONAL { <"+URI+"> schema:jobTitle ?title }"+
        "OPTIONAL { <"+URI+"> schema:birthPlace ?birthPlace }"+
        "OPTIONAL { <"+URI+"> schema:deathPlace ?deathPlace }"+
        "OPTIONAL { <"+URI+"> schema:sameAs ?sameAs }"+
        "OPTIONAL { <"+URI+"> schema:description ?description }"+
        "OPTIONAL { <"+URI+"> fam:entity-reference ?reference }"+
                "}";
              Sparql sp = new Sparql(queryPersonaggio,endpoint);

              logger.info("Restituito InfoPersonaggio HTML");
              return sp.returnHTML();
   }

   public String getInfoPersonaggioJSON(String URI){
        logger.info("InfoPersonaggioJSON " +"richiesto:"+URI);

         String queryPersonaggio = "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n" +
        "PREFIX schema: <http://schema.org/>\n" +
        "PREFIX dbo: <http://www.dbpedia.org/ontology/>\n" +
        "PREFIX fam: <http://vocab.fusepool.info/fam#>\n" +
        "\n" +
        "SELECT ?name ?title ?birthPlace ?deathPlace ?sameAs ?description \n" +
        "FROM <http://data.fusepool.info:8181/ldp/historical-characters/personaggi_storici_trentino-refine-csv-csv-transformed>\n" +
        "WHERE {\n" +
        "<"+URI+"> schema:name ?name."+
        "OPTIONAL { <"+URI+"> schema:jobTitle ?title }"+
        "OPTIONAL { <"+URI+"> schema:birthPlace ?birthPlace }"+
        "OPTIONAL { <"+URI+"> schema:deathPlace ?deathPlace }"+
        "OPTIONAL { <"+URI+"> schema:sameAs ?sameAs }"+
        "OPTIONAL { <"+URI+"> schema:description ?description }"+
                "}";

       Sparql sp = new Sparql(queryPersonaggio,endpoint);
       JSONObject result = new JSONObject(sp.returnJSON());
       JSONArray jarray = result.getJSONObject("results").getJSONArray("bindings");

       String queryReference ="PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n" +
            "PREFIX schema: <http://schema.org/>\n" +
            "PREFIX dbo: <http://www.dbpedia.org/ontology/>\n" +
            "PREFIX fam: <http://vocab.fusepool.info/fam#>\n" +
            "\n" +
            "SELECT ?ref\n" +
            "FROM <http://data.fusepool.info:8181/ldp/historical-characters/personaggi_storici_trentino-refine-csv-csv-transformed>\n" +
            "WHERE {\n" +
            "  <"+URI+"> a schema:Person ;\n" +
            "            fam:entity-reference ?ref .\n" +
            "}";

       sp = new Sparql(queryReference,endpoint);
       JSONObject resultReference = new JSONObject(sp.returnJSON());
       JSONArray jarrayReference = resultReference.getJSONObject("results").getJSONArray("bindings");
       JSONArray reference =new JSONArray(); // il jsonArray dei Reference
         // analizziamo se ci sono reference
       Set<String> listaReference =new HashSet<String>();
       if(jarrayReference.length() > 0){
       int contaRef = 0;
           for(int i = 0; i < jarrayReference.length(); i++)
           {
               String ref = Place.converterWikiToDBpedia(jarrayReference.getJSONObject(i).getJSONObject("ref").getString("value"));
               listaReference.add(ref);
               reference.put(contaRef++, ref);
           }
       }
       JSONObject json = jarray.getJSONObject(0);
       JSONObject res = new JSONObject();

       String[] head = {"title","name","birthPlace","deathPlace","sameAs","description"};
       for(int i=0; i< head.length; i++)
       {
           if(i == 2){
               if(json.has("birthPlace")){
                  listaReference.add((json.getJSONObject("birthPlace").getString("value")));
                  res.put("birthPlace", Place.removeDBpedia(json.getJSONObject("birthPlace").getString("value")));
                  reference.put(reference.length(),json.getJSONObject("birthPlace").getString("value"));
               }
           }
           else if(i == 3){
               if(json.has("deathPlace")){
                   listaReference.add((json.getJSONObject(head[i]).getString("value")));
                   res.accumulate("deathPlace", Place.removeDBpedia(json.getJSONObject("deathPlace").getString("value")));
                   reference.put(reference.length(),json.getJSONObject("deathPlace").getString("value"));
               }
           }
           else{
            if(json.has(head[i]))
               res.accumulate(head[i], json.getJSONObject(head[i]).getString("value"));
           }
       }

       if(jarrayReference.length() > 0)
         res.put("reference", reference);

         // res.put("controllo",listaReference.toString());

       JSONArray placeArray = new JSONArray(); // qui andranno i reference solo in Trentino
       // recuperiamo i posti del trentino
       List<String> placeTrentino = (new Place()).getTrentinoPlace();
       //controlliamo se i reference del personaggio sono in Trentino
       int contaRef = 0;
       if(listaReference.size() > 0){
       Place pl = new Place();

       for(String s : listaReference)
         {
             if(placeTrentino.contains(s))
                   placeArray.put(contaRef++, pl.getGeo(s));
         }
       }
      if(placeArray.length() > 0)
          // res.accumulate("place", placeArray);
           res.put("place", placeArray);
      logger.info("Restituito InfoPersonaggio JSON "+json.has("name"));
      return res.toString();
   } // fine getInfoPersonaggioJSON()

   public JSONArray getLuoghiInteresse(double latitudine, double longitudine, double prec)
    {
        logger.info("RicercaLuoghi JSON "+"richiesta per lat:"+latitudine+" long:"+longitudine+ " precisione: "+prec);
        String query = "PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>\n" +
                        "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\n" +
                        "PREFIX schema: <http://schema.org/>\n" +
                        "PREFIX dct: <http://purl.org/dc/terms/>\n" +
                        "\n" +
                        "SELECT DISTINCT ?label ?lat ?long ?description\n" +
                        "FROM <http://data.fusepool.info:8181/ldp/trentino-architectural-cultural-heritage-enriched-ttl>\n" +
                        "WHERE {\n" +
                        "  ?building a schema:TouristAttraction ;\n" +
                        "              rdfs:label ?label;\n" +
                        "              dct:description ?description; \n"+
                        "              geo:lat ?lat ;\n" +
                        "              geo:long ?long .\n" +
                        "              \n" +
                        "  FILTER (?lat >= \""+(latitudine-prec)+"\"^^xsd:double && ?lat <= \""+(latitudine+prec)+"\"^^xsd:double && ?long >= \""+(longitudine-prec)+"\"^^xsd:double && ?long <= \""+(longitudine+prec)+"\"^^xsd:double)\n" +
                        "  FILTER (!sameTerm(\"CASA\", ?description))"+
                        "}";
        Sparql sp = new Sparql(query, endpoint);
        JSONArray res = new JSONArray();
        JSONArray jarrayRes = (new JSONObject(sp.returnJSON())).getJSONObject("results").getJSONArray("bindings");

        for(int i=0; i < jarrayRes.length(); i++)
        {
            JSONObject json = new JSONObject();
            json.accumulate("description", jarrayRes.getJSONObject(i).getJSONObject("description").getString("value"));
            json.accumulate("label",jarrayRes.getJSONObject(i).getJSONObject("label").getString("value"));
            json.accumulate("long",jarrayRes.getJSONObject(i).getJSONObject("long").getDouble("value"));
            json.accumulate("lat",jarrayRes.getJSONObject(i).getJSONObject("lat").getDouble("value"));
            res.put(json);
        }
        logger.info("RicercaLuoghi JSON "+"richiesta per lat:"+latitudine+" long:"+longitudine+ " precisione: "+prec + " restituiti: "+jarrayRes.length()+" luoghi");
        return res;
    }

    public String getLuoghiInteresseHTML(double latitudine, double longitudine, double prec)
    {
        logger.info("RicercaLuoghi HTML "+"richiesta per lat:"+latitudine+" long:"+longitudine+ " precisione: "+prec);
        String query = "PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>\n" +
                        "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\n" +
                        "PREFIX schema: <http://schema.org/>\n" +
                        "PREFIX dct: <http://purl.org/dc/terms/>\n" +
                        "\n" +
                        "SELECT DISTINCT ?label ?lat ?long ?description\n" +
                        "FROM <http://data.fusepool.info:8181/ldp/trentino-architectural-cultural-heritage-enriched-ttl>\n" +
                        "WHERE {\n" +
                        "  ?building a schema:TouristAttraction ;\n" +
                        "              rdfs:label ?label;\n" +
                        "              dct:description ?description; \n"+
                        "              geo:lat ?lat ;\n" +
                        "              geo:long ?long .\n" +
                        "              \n" +
                        "  FILTER (?lat >= \""+(latitudine-prec)+"\"^^xsd:double && ?lat <= \""+(latitudine+prec)+"\"^^xsd:double && ?long >= \""+(longitudine-prec)+"\"^^xsd:double && ?long <= \""+(longitudine+prec)+"\"^^xsd:double)\n" +
                        "  FILTER (!sameTerm(\"CASA\", ?description))"+
                        "}";
        Sparql sp = new Sparql(query, endpoint);
        logger.info("RicercaLuoghi HTML "+"richiesta per lat:"+latitudine+" long:"+longitudine+ " precisione: "+prec + "RISPOSTO");
        return sp.returnHTML();
    }

    public JSONArray getRistorantiJSON(double latitudine, double longitudine, double prec)
    {
        logger.info("RicercaRistoranti JSON "+"richiesta per lat:"+latitudine+" long:"+longitudine+ " precisione: "+prec);

        //credenziali YELP
            String CONSUMER_KEY = "Q87CAjXrI_s3k1LbbIEe9Q";
            String CONSUMER_SECRET = "9TflxKNwqGLNZ9IW_qJbd3SPc_4";
            String TOKEN = "nHwsQ0V0eok71taAjSZ_f4sE7DPe28Te";
            String TOKEN_SECRET = "8HwHjAYPqdGN-6dPW8OsPx7D3g0";
        //oggetto yelpApi
        YelpAPI yelpApi = new YelpAPI(CONSUMER_KEY, CONSUMER_SECRET, TOKEN, TOKEN_SECRET);

        String query = "PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>\n" +
                        "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n" +
                        "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\n" +
                        "PREFIX schema: <http://schema.org/>\n" +
                        "\n" +
                        "SELECT ?name ?locality ?street ?locality ?lat ?long \n" +
                        "FROM <http://data.fusepool.info:8181/ldp/trentino-restaurants-1/osterie-csv-csv-transformed-1>\n" +
                        "{\n" +
                        "  ?restaurant a schema:Restaurant ;  \n" +
                        "         schema:name ?name ;\n" +
                        "         schema:address ?address ;\n" +
                        "         schema:geo ?geo .\n" +
                        " \n" +
                        "  ?geo a schema:GeoCoordinates ;\n" +
                        "         schema:latitude ?lat ;\n" +
                        "         schema:longitude ?long .\n" +
                        " \n" +
                        "  ?address a schema:PostalAddress ;\n" +
                        "         schema:streetAddress ?street ;\n" +
                        "         schema:addressLocality ?locality .\n" +
                        " \n" +
                        "FILTER (?lat >= \""+(latitudine-prec)+"\"^^xsd:double && ?lat <= \""+(latitudine+prec)+"\"^^xsd:double && ?long >= \""+(longitudine-prec)+"\"^^xsd:double && ?long <= \""+(longitudine+prec)+"\"^^xsd:double)\n" +
                        "} ORDER BY ?lat";

        Sparql sp = new Sparql(query, endpoint);

        JSONArray res = new JSONArray();
        JSONArray jarrayRes = (new JSONObject(sp.returnJSON())).getJSONObject("results").getJSONArray("bindings");

        //dati da recuperare da yelp
        String[] datiYelp = {"rating","snippet_text","image_url","phone"};

        for(int i=0; i < jarrayRes.length(); i++)
        {
            JSONObject json = new JSONObject();
            json.accumulate("name", jarrayRes.getJSONObject(i).getJSONObject("name").getString("value"));
            json.accumulate("street",jarrayRes.getJSONObject(i).getJSONObject("street").getString("value"));
            json.accumulate("citta",jarrayRes.getJSONObject(i).getJSONObject("locality").getString("value"));
            json.accumulate("lat",jarrayRes.getJSONObject(i).getJSONObject("lat").getDouble("value"));
            json.accumulate("long",jarrayRes.getJSONObject(i).getJSONObject("long").getDouble("value"));
            JSONObject ristor = yelpApi.searchRistorante(yelpApi, jarrayRes.getJSONObject(i).getJSONObject("name").getString("value"),
                    jarrayRes.getJSONObject(i).getJSONObject("lat").getString("value")+","+
                    jarrayRes.getJSONObject(i).getJSONObject("long").getString("value"));
            for(String d : datiYelp)
            {
                if(ristor.has(d))
                    json.put(d, String.valueOf(ristor.get(d)));
            }
            res.put(json);
        }
        logger.info("RicercaRistoranti JSON "+"richiesta per lat:"+latitudine+" long:"+longitudine+ " precisione: "+prec + " restituiti: "+jarrayRes.length()+ " ristoranti");
        return res;
    }  //fine getRistorantiJSON

    public String getRistorantiHTML(double latitudine, double longitudine, double prec)
    {
        logger.info("RicercaRistoranti HTML "+"richiesta per lat:"+latitudine+" long:"+longitudine+ " precisione: "+prec);

        String query = "PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>\n" +
                        "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n" +
                        "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\n" +
                        "PREFIX schema: <http://schema.org/>\n" +
                        "\n" +
                        "SELECT ?name ?locality ?street ?locality ?lat ?long \n" +
                        "FROM <http://data.fusepool.info:8181/ldp/trentino-restaurants-1/osterie-csv-csv-transformed-1>\n" +
                        "{\n" +
                        "  ?restaurant a schema:Restaurant ;  \n" +
                        "         schema:name ?name ;\n" +
                        "         schema:address ?address ;\n" +
                        "         schema:geo ?geo .\n" +
                        " \n" +
                        "  ?geo a schema:GeoCoordinates ;\n" +
                        "         schema:latitude ?lat ;\n" +
                        "         schema:longitude ?long .\n" +
                        " \n" +
                        "  ?address a schema:PostalAddress ;\n" +
                        "         schema:streetAddress ?street ;\n" +
                        "         schema:addressLocality ?locality .\n" +
                        " \n" +
                        "FILTER (?lat >= \""+(latitudine-prec)+"\"^^xsd:double && ?lat <= \""+(latitudine+prec)+"\"^^xsd:double && ?long >= \""+(longitudine-prec)+"\"^^xsd:double && ?long <= \""+(longitudine+prec)+"\"^^xsd:double)\n" +
                        "} ORDER BY ?lat";

        Sparql sp = new Sparql(query, endpoint);
        logger.info("RicercaRistoranti HTML "+"richiesta per lat:"+latitudine+" long:"+longitudine+ " precisione: "+prec+" FINITO");
        return sp.returnHTML();
    }  // fine getRistorantiHTML

    public String getHotelHTML(double latitudine, double longitudine, double prec)
    {
        logger.info("RicercaHotel HTML "+"richiesta per lat:"+latitudine+" long:"+longitudine+ " precisione: "+prec);

        String query =  "PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>\n" +
                        "PREFIX schema: <http://schema.org/>\n" +
                        "PREFIX foaf: <http://xmlns.com/foaf/0.1/>\n" +
                        "\n" +
                        "SELECT DISTINCT ?h ?name ?category ?lat ?long ?comment ?phone ?loc ?via ?sito ?mail\n" +
                        "FROM <http://data.fusepool.info:8181/ldp/trentino-point-of-interest-ttl>\n" +
                        "WHERE {\n" +
                        "  VALUES ?category{\n" +
                        "    \"Bed & Breakfast\"\n" +
                        " 	\"Hotel\"\n" +
                        "        }\n" +
                        "  ?h schema:category ?category;\n" +
                        " 		rdfs:label  ?name;\n" +
                        " 		geo:lat ?lat;\n" +
                        " 		geo:long ?long.\n" +
                        "	OPTIONAL{ ?h rdfs:comment ?comment.\n" +
                        "               FILTER LANGMATCHES(LANG(?comment),  \"IT\")}\n" +
                        "  OPTIONAL { ?h  foaf:homepage ?sito. }\n" +
                        "  OPTIONAL { ?h  foaf:mbox ?mail. }\n" +
                        "  OPTIONAL { ?h foaf:phone ?phone. }\n" +
                        "  OPTIONAL { ?h  schema:streetAddress ?address .\n" +
                        "             ?address  schema:addressLocality ?loc;\n" +
                        "                       schema:streetAddress ?via.\n" +
                        "           }\n" +
                        "FILTER (?lat >= \""+(latitudine-prec)
                        +"\"^^xsd:double && ?lat <= \""+(latitudine+prec)
                        +"\"^^xsd:double && ?long >= \""+(longitudine-prec)
                        +"\"^^xsd:double && ?long <= \""+(longitudine+prec)+"\"^^xsd:double)\n" +
                        "  }";

        Sparql sp = new Sparql(query, endpoint);
        logger.info("RicercaHotel HTML "+"richiesta per lat:"+latitudine+" long:"+longitudine+ " precisione: "+prec+ "FINITO");
        return sp.returnHTML();
    } // fine getHotelHTML()

    public JSONArray getHotelJSON(double latitudine, double longitudine, double prec)
    {
        logger.info("RicercaHotel JSON "+"richiesta per lat:"+latitudine+" long:"+longitudine+ " precisione: "+prec);
        String query =  "PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>\n" +
                        "PREFIX schema: <http://schema.org/>\n" +
                        "PREFIX foaf: <http://xmlns.com/foaf/0.1/>\n" +
                        "\n" +
                        "SELECT DISTINCT ?h ?name ?category ?lat ?long ?comment ?phone ?loc ?via ?sito ?mail\n" +
                        "FROM <http://data.fusepool.info:8181/ldp/trentino-point-of-interest-ttl>\n" +
                        "WHERE {\n" +
                        "  VALUES ?category{\n" +
                        "    \"Bed & Breakfast\"\n" +
                        " 	\"Hotel\"\n" +
                        "        }\n" +
                        "  ?h schema:category ?category;\n" +
                        " 		rdfs:label  ?name;\n" +
                        " 		geo:lat ?lat;\n" +
                        " 		geo:long ?long.\n" +
                        "	OPTIONAL{ ?h rdfs:comment ?comment.\n" +
                        "               FILTER LANGMATCHES(LANG(?comment),  \"IT\")}\n" +
                        "  OPTIONAL { ?h  foaf:homepage ?sito. }\n" +
                        "  OPTIONAL { ?h  foaf:mbox ?mail. }\n" +
                        "  OPTIONAL { ?h foaf:phone ?phone. }\n" +
                        "  OPTIONAL { ?h  schema:streetAddress ?address .\n" +
                        "             ?address  schema:addressLocality ?loc;\n" +
                        "                       schema:streetAddress ?via.\n" +
                        "           }\n" +
                        "FILTER (?lat >= \""+(latitudine-prec)
                        +"\"^^xsd:double && ?lat <= \""+(latitudine+prec)
                        +"\"^^xsd:double && ?long >= \""+(longitudine-prec)
                        +"\"^^xsd:double && ?long <= \""+(longitudine+prec)+"\"^^xsd:double)\n" +
                        "  }";

        Sparql sp = new Sparql(query, endpoint);
        // array dei risultati finali
        JSONArray res = new JSONArray();
        // mettiamo tutti i risultati in questo JSONArray
        JSONArray jarrayRes = (new JSONObject(sp.returnJSON())).getJSONObject("results").getJSONArray("bindings");
        String[] campiHotel = { "name", "category", "lat", "long", "comment", "phone", "loc","via", "sito",  "mail"};
        for(int i=0; i < jarrayRes.length(); i++)
        {
            JSONObject hotel =  jarrayRes.getJSONObject(i);
            JSONObject json = new JSONObject();
            for(String c : campiHotel)
            {
                if(hotel.has(c)){
                    if(c.equals("name")){
                        if(Place.extractStar(hotel.getJSONObject(c).getString("value")) > 0)  //se ha almeno 1 stella senno che cazz d hotel è aaaaaaa forse è un B&B
                            json.put("stelle", Place.extractStar(hotel.getJSONObject(c).getString("value")));
                        json.put(c,Place.removeStar(hotel.getJSONObject(c).getString("value")));
                    }
                    else{
                        if(c.equals("lat") || c.equals("long")){
                            json.put(c, (hotel.getJSONObject(c).getDouble("value"))); }

                        else{
                            json.put(c, String.valueOf(hotel.getJSONObject(c).get("value")));}
                    }
                }
            }
            res.put(json);
        }
        logger.info("RicercaHotel JSON "+"richiesta per lat:"+latitudine+" long:"+longitudine+ " precisione: "+prec+" restituiti: "+jarrayRes.length()+" hotel");
        return res;
    }
    // fine getHotelJSON()
}


text:
@class NSArray;

@interface CrittercismConfig : NSObject
{
    _Bool _monitorNSURLConnection;
    _Bool _monitorNSURLSession;
    _Bool _monitorUIWebView;
    _Bool _monitorWKWebView;
    _Bool _monitorWCSession;
    _Bool _enableServiceMonitoring;
    _Bool _delaySendingAppLoad;
    long long _loggingLevel;
    NSArray *_urlFilters;
    id <CrittercismDelegate> _delegate;
}

+ (id)defaultConfig;
@property(retain, nonatomic) id <CrittercismDelegate> delegate; // @synthesize delegate=_delegate;
@property(retain, nonatomic) NSArray *urlFilters; // @synthesize urlFilters=_urlFilters;
@property(nonatomic) long long loggingLevel; // @synthesize loggingLevel=_loggingLevel;
@property(nonatomic) _Bool delaySendingAppLoad; // @synthesize delaySendingAppLoad=_delaySendingAppLoad;
@property(nonatomic) _Bool enableServiceMonitoring; // @synthesize enableServiceMonitoring=_enableServiceMonitoring;
@property(nonatomic) _Bool monitorWCSession; // @synthesize monitorWCSession=_monitorWCSession;
@property(nonatomic) _Bool monitorWKWebView; // @synthesize monitorWKWebView=_monitorWKWebView;
@property(nonatomic) _Bool monitorUIWebView; // @synthesize monitorUIWebView=_monitorUIWebView;
@property(nonatomic) _Bool monitorNSURLSession; // @synthesize monitorNSURLSession=_monitorNSURLSession;
@property(nonatomic) _Bool monitorNSURLConnection; // @synthesize monitorNSURLConnection=_monitorNSURLConnection;
- (void).cxx_destruct;
- (id)description;
- (long long)internalLoggingLevel;
- (id)init;

@end


text:
import mock

from rally import exceptions
from rally.plugins.openstack.context import roles
from tests.unit import fakes
from tests.unit import test

class RoleGeneratorTestCase(test.TestCase):

    def create_default_roles_and_patch_add_remove_functions(self, fc):
        fc.keystone().roles.add_user_role = mock.MagicMock()
        fc.keystone().roles.remove_user_role = mock.MagicMock()
        fc.keystone().roles.create("r1", "test_role1")
        fc.keystone().roles.create("r2", "test_role2")
        self.assertEqual(2, len(fc.keystone().roles.list()))

    @property
    def context(self):
        return {
            "config": {
                "roles": [
                    "test_role1",
                    "test_role2"
                ]
            },
            "admin": {"endpoint": mock.MagicMock()},
            "task": mock.MagicMock()
        }

    @mock.patch("rally.plugins.openstack.context.roles.osclients")
    def test_add_role(self, mock_osclients):
        fc = fakes.FakeClients()
        mock_osclients.Clients.return_value = fc
        self.create_default_roles_and_patch_add_remove_functions(fc)

        ctx = roles.RoleGenerator(self.context)
        ctx.context["users"] = [{"id": "u1", "tenant_id": "t1"},
                                {"id": "u2", "tenant_id": "t2"}]
        result = ctx._add_role(mock.MagicMock(),
                               self.context["config"]["roles"][0])

        expected = {"id": "r1", "name": "test_role1"}
        self.assertEqual(expected, result)

    @mock.patch("rally.plugins.openstack.context.roles.osclients")
    def test_add_role_which_does_not_exist(self, mock_osclients):
        fc = fakes.FakeClients()
        mock_osclients.Clients.return_value = fc
        self.create_default_roles_and_patch_add_remove_functions(fc)

        ctx = roles.RoleGenerator(self.context)
        ctx.context["users"] = [{"id": "u1", "tenant_id": "t1"},
                                {"id": "u2", "tenant_id": "t2"}]
        ex = self.assertRaises(exceptions.NoSuchRole, ctx._add_role,
                               mock.MagicMock(), "unknown_role")

        expected = "There is no role with name `unknown_role`."
        self.assertEqual(expected, str(ex))

    @mock.patch("rally.plugins.openstack.context.roles.osclients")
    def test_remove_role(self, mock_osclients):
        role = mock.MagicMock()
        ctx = roles.RoleGenerator(self.context)
        ctx.context["users"] = [{"id": "u1", "tenant_id": "t1"},
                                {"id": "u2", "tenant_id": "t2"}]
        ctx._remove_role(mock.MagicMock(), role)
        calls = [
            mock.call("u1", role["id"], tenant="t1"),
            mock.call("u2", role["id"], tenant="t2"),
        ]
        mock_keystone = mock_osclients.Clients().keystone()
        mock_keystone.roles.remove_user_role.assert_has_calls(calls)

    @mock.patch("rally.plugins.openstack.context.roles.osclients")
    def test_setup_and_cleanup(self, mock_osclients):
        fc = fakes.FakeClients()
        mock_osclients.Clients.return_value = fc
        self.create_default_roles_and_patch_add_remove_functions(fc)

        with roles.RoleGenerator(self.context) as ctx:
            ctx.context["users"] = [{"id": "u1", "tenant_id": "t1"},
                                    {"id": "u2", "tenant_id": "t2"}]

            ctx.setup()
            calls = [
                mock.call("u1", "r1", tenant="t1"),
                mock.call("u2", "r1", tenant="t2"),
                mock.call("u1", "r2", tenant="t1"),
                mock.call("u2", "r2", tenant="t2")
            ]
            fc.keystone().roles.add_user_role.assert_has_calls(calls)
            self.assertEqual(
                4, fc.keystone().roles.add_user_role.call_count)
            self.assertEqual(
                0, fc.keystone().roles.remove_user_role.call_count)
            self.assertEqual(2, len(ctx.context["roles"]))
            self.assertEqual(2, len(fc.keystone().roles.list()))

        # Cleanup (called by content manager)
        self.assertEqual(2, len(fc.keystone().roles.list()))
        self.assertEqual(4, fc.keystone().roles.add_user_role.call_count)
        self.assertEqual(4, fc.keystone().roles.remove_user_role.call_count)
        calls = [
            mock.call("u1", "r1", tenant="t1"),
            mock.call("u2", "r1", tenant="t2"),
            mock.call("u1", "r2", tenant="t1"),
            mock.call("u2", "r2", tenant="t2")
        ]
        fc.keystone().roles.remove_user_role.assert_has_calls(calls)


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

    var password_help_title = 'Tips for Creating a Password';
    var password_help_content = 'Make sure your password is at least 8 characters long and includes UPPERCASE and lowercase letters and numbers.
\
    Consider using long, catchy-but-unique (thus relatively easy-to-remember) phrases since they are known to be effective passwords.

\
    For example, consider the passwords "thedogisnamedToady8" and "nq7TS%h". They both would take an estimated 100+ years for a hacker to crack. Choosing one over the other depends entirely on personal preference, but this is something to keep in mind as a possibility when creating passwords. It does not necessarily need to be difficult to remember.';
    $('#password_help').popover({container: 'body', trigger: 'hover focus', title: password_help_title, content: password_help_content, html: true});

    $('#password').keyup(function() {
        var password_value = $(this).val();
        var result = zxcvbn(password_value);
        var result_bar = $('#password_bar').children();

        if (result_bar.hasClass('bg-danger')) {
            result_bar.removeClass('bg-danger');
        } else if (result_bar.hasClass('bg-warning')) {
            result_bar.removeClass('bg-warning');
        } else if (result_bar.hasClass('bg-success')) {
            result_bar.removeClass('bg-success');
        }

        if (password_value.length > 0) {
            if (result.score <= 1) {
                result_bar.eq(0).addClass('bg-danger');
            } else if (result.score <= 2) {
                result_bar.eq(0).addClass('bg-danger');
                result_bar.eq(1).addClass('bg-danger');
            } else if (result.score <= 3) {
                result_bar.eq(0).addClass('bg-warning');
                result_bar.eq(1).addClass('bg-warning');
                result_bar.eq(2).addClass('bg-warning');
            } else {
                result_bar.eq(0).addClass('bg-success');
                result_bar.eq(1).addClass('bg-success');
                result_bar.eq(2).addClass('bg-success');
                result_bar.eq(3).addClass('bg-success');
            }
        }
    });

    /** Old password strength display using glyphicons.
    $('#password_result').tooltip({container: 'body', trigger: 'hover focus'});
    $('#password').keyup(function() {
        var password_value = $(this).val();
        var result = zxcvbn(password_value);
        var result_span = $('#password_result');

        // Reset #password_result to have no glyphicons
        if (result_span.hasClass('glyphicon-remove')) {
            result_span.removeClass('glyphicon-remove');
        } else if (result_span.hasClass('glyphicon-warning-sign')) {
            result_span.removeClass('glyphicon-warning-sign');
        } else if (result_span.hasClass('glyphicon-ok')) {
            result_span.removeClass('glyphicon-ok');
        }

        // Add appropriate glyphicon to #password_result if password_value.length != 0
        if (password_value.length > 0) {
            if (result.score < 2) {
                result_span.addClass('glyphicon-remove');
            } else if (result.score < 3) {
                result_span.addClass('glyphicon-warning-sign');
            } else {
                result_span.addClass('glyphicon-ok');
            }
        } else {
            result_span.attr('hidden', 'true');
        }

        // http://stackoverflow.com/questions/9501921/change-twitter-bootstrap-tooltip-content-on-click
        var password_result_content = 'Score: ' + result.score + '/4';
        result_span.attr('title', password_result_content);
        result_span.tooltip('fixTitle');
    });
    */
});


text:
var fs = require('fs'),
  p = require('path'),
  req = require('bagofrequest'),
  xml2js = require('xml2js'),
  url = require('url'),
  util = require('util'),
  validator = require('./validator');

/**
 * class Eggtart
 *
 * @param {String} username: Delicious account username
 * @param {String} password: Delicious account password
 * @param {Object} opts: optional
 *   - version: API version, default: v1
 */
function Eggtart(username, password, opts) {
  opts = opts || {};

  this.version = opts.version || 'v1';
  this.wait = opts.wait || 1000; // mandatory wait to avoid forced throttling
  this.url = util.format('https://%s:%s@api.delicious.com/%s/',
    username,
    password,
    this.version);

  this._init();
}

// initialises methods and sub methods based on API configuration
Eggtart.prototype._init = function () {
  var file = p.join(__dirname, '..', 'conf', this.version + '.json'),
    config = JSON.parse(fs.readFileSync(file)),
    self = this;

  Object.keys(config).forEach(function (method) {
    var subMethods = {};

    Object.keys(config[method]).forEach(function (subMethod) {
      subMethods[subMethod] = function (args, cb) {
        if (!cb) {
          cb = args;
          args = {};
        }

        var endpoint = config[method][subMethod].endpoint,
          rules = config[method][subMethod].args;

        validator.validate(rules, args, function (err) {
          if (err) {
            cb(err);
          } else {
            self._request(endpoint, args, cb);
          }
        });
      };
    });

    Eggtart.prototype[method] = function () {
      return subMethods;
    };
  });
};

// send request to Delicious
Eggtart.prototype._request = function (endpoint, params, cb) {

  var parser = new xml2js.Parser(),
    self = this;

  function _success(result, cb) {
    parser.parseString(result.body, cb);
  }

  function _error(result, cb) {
    parser.parseString(result.body, function (err, result) {
      cb(new Error(result.result.$.code));
    });
  }

  var opts = {
    queryStrings: params,
    handlers: {
      200: _success,
      401: _error, // access denied
      500: _error, // throttled
      999: _error  // throttled
    }
  };

  // mandatory wait to avoid forced throttling
  setTimeout(function () {
    req.request('get', self.url + endpoint, opts, cb);
  }, this.wait);
};

module.exports = Eggtart;


text:
<link rel="import" href="packages://inspector/share/node-header.html">
<link rel="import" href="packages://inspector/share/mixins-section.html">
<link rel="import" href="display-object-section.html">

<dom-module id="runtime-movie-clip-wrapper-inspector">
    <link rel="import" type="css" href="packages://inspector/share/common.css">

    <template>
        <inspector-node-header
            name="{{target.name.value}}"
        >
        </inspector-node-header>

        <div class="props flex-1">
            <inspector-runtime-display-object-section target="{{target}}">
            </inspector-runtime-display-object-section>

            <editor-section text="BlendMode">
                <editor-prop prop="{{target.blendMode}}"></editor-prop>
            </editor-section>

            <editor-section text="SpriteSheet">
                <editor-prop prop="{{target.spriteSheet}}"></editor-prop>
                <editor-prop prop="{{target.prefix}}"></editor-prop>
                <editor-prop prop="{{target.subfix}}"></editor-prop>
                <editor-prop prop="{{target.range}}"></editor-prop>
            </editor-section>

            <editor-section text="MovieClip">
                <editor-prop prop="{{target.autoPlay}}"></editor-prop>
                <editor-prop prop="{{target.loop}}"></editor-prop>
                <editor-prop prop="{{target.animationSpeed}}"></editor-prop>
            </editor-section>

            <inspector-mixins-section target="{{target}}">
            </inspector-mixins-section>
        </div>
    </template>
</dom-module>

<script>
    Polymer({
        is: 'runtime-movie-clip-wrapper-inspector',

        properties: {
            target: {
                type: Object,
                value: null,
                notify: true,
            },
        },
    });
</script>


text:
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Mapsui.Layers;
using Mapsui.Providers;
using Mapsui.Samples.Common.Helpers;
using Mapsui.Styles;
using Mapsui.Tiling;
using Mapsui.UI;
using Mapsui.Utilities;

namespace Mapsui.Samples.Common.Maps
{
    public class SvgSample : ISample
    {
        public string Name => "Svg";
        public string Category => "Symbols";

        public Task<Map> CreateMapAsync()
        {
            var map = new Map();

            map.Layers.Add(OpenStreetMap.CreateTileLayer());
            map.Layers.Add(CreateSvgLayer(map.Extent));

            return Task.FromResult(map);
        }

        private static ILayer CreateSvgLayer(MRect? envelope)
        {
            return new MemoryLayer
            {
                Name = "Svg Layer",
                Features = CreateSvgFeatures(RandomPointGenerator.GenerateRandomPoints(envelope, 2000)),
                Style = null,
                IsMapInfoLayer = true
            };
        }

        private static IEnumerable<IFeature> CreateSvgFeatures(IEnumerable<MPoint> randomPoints)
        {
            var counter = 0;

            return randomPoints.Select(p =>
            {
                var feature = new PointFeature(p) { ["Label"] = counter.ToString() };
                feature.Styles.Add(CreateSvgStyle(@"Images.Pin.svg", 0.5));
                counter++;
                return feature;
            });
        }

        private static SymbolStyle CreateSvgStyle(string embeddedResourcePath, double scale)
        {
            var bitmapId = typeof(SvgSample).LoadSvgId(embeddedResourcePath);
            return new SymbolStyle { BitmapId = bitmapId, SymbolScale = scale, SymbolOffset = new Offset(0.0, 0.5, true) };
        }
    }
}


text:
These are python scripts and stock symbols that can be used for scraping stock finance data from Yahoo finance or others

# Usage
The instructions on the usage of tools are in the script files as annotated inline comments.

Simpily follow the instructions! :satisfied:


text:
package sk.fei.mobv.pivarci.api;

import sk.fei.mobv.pivarci.model.User;

public interface ServerApi {
    User userSignIn(final String username, final String password);

    int sendRandomNumber(String token);
}


text:
/* NOTE: This is an internal header file, included by other STL headers.
 *   You should not attempt to use it directly.
 */

#ifndef __SGI_STL_INTERNAL_HEAP_H
#define __SGI_STL_INTERNAL_HEAP_H

__STL_BEGIN_NAMESPACE

#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
#pragma set woff 1209
#endif

// Heap-manipulation functions: push_heap, pop_heap, make_heap, sort_heap.

template <class _RandomAccessIterator, class _Distance, class _Tp>
void
__push_heap(_RandomAccessIterator __first,
            _Distance __holeIndex, _Distance __topIndex, _Tp __value)
{
  _Distance __parent = (__holeIndex - 1) / 2;
  while (__holeIndex > __topIndex && *(__first + __parent) < __value) {
    *(__first + __holeIndex) = *(__first + __parent);
    __holeIndex = __parent;
    __parent = (__holeIndex - 1) / 2;
  }
  *(__first + __holeIndex) = __value;
}

template <class _RandomAccessIterator, class _Distance, class _Tp>
inline void
__push_heap_aux(_RandomAccessIterator __first,
                _RandomAccessIterator __last, _Distance*, _Tp*)
{
  __push_heap(__first, _Distance((__last - __first) - 1), _Distance(0),
              _Tp(*(__last - 1)));
}

template <class _RandomAccessIterator>
inline void
push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last)
{
  __push_heap_aux(__first, __last,
                  __DISTANCE_TYPE(__first), __VALUE_TYPE(__first));
}

template <class _RandomAccessIterator, class _Distance, class _Tp,
          class _Compare>
void
__push_heap(_RandomAccessIterator __first, _Distance __holeIndex,
            _Distance __topIndex, _Tp __value, _Compare __comp)
{
  _Distance __parent = (__holeIndex - 1) / 2;
  while (__holeIndex > __topIndex && __comp(*(__first + __parent), __value)) {
    *(__first + __holeIndex) = *(__first + __parent);
    __holeIndex = __parent;
    __parent = (__holeIndex - 1) / 2;
  }
  *(__first + __holeIndex) = __value;
}

template <class _RandomAccessIterator, class _Compare,
          class _Distance, class _Tp>
inline void
__push_heap_aux(_RandomAccessIterator __first,
                _RandomAccessIterator __last, _Compare __comp,
                _Distance*, _Tp*)
{
  __push_heap(__first, _Distance((__last - __first) - 1), _Distance(0),
              _Tp(*(__last - 1)), __comp);
}

template <class _RandomAccessIterator, class _Compare>
inline void
push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last,
          _Compare __comp)
{
  __push_heap_aux(__first, __last, __comp,
                  __DISTANCE_TYPE(__first), __VALUE_TYPE(__first));
}

template <class _RandomAccessIterator, class _Distance, class _Tp>
void
__adjust_heap(_RandomAccessIterator __first, _Distance __holeIndex,
              _Distance __len, _Tp __value)
{
  _Distance __topIndex = __holeIndex;
  _Distance __secondChild = 2 * __holeIndex + 2;
  while (__secondChild < __len) {
    if (*(__first + __secondChild) < *(__first + (__secondChild - 1)))
      __secondChild--;
    *(__first + __holeIndex) = *(__first + __secondChild);
    __holeIndex = __secondChild;
    __secondChild = 2 * (__secondChild + 1);
  }
  if (__secondChild == __len) {
    *(__first + __holeIndex) = *(__first + (__secondChild - 1));
    __holeIndex = __secondChild - 1;
  }
  __push_heap(__first, __holeIndex, __topIndex, __value);
}

template <class _RandomAccessIterator, class _Tp, class _Distance>
inline void
__pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last,
           _RandomAccessIterator __result, _Tp __value, _Distance*)
{
  *__result = *__first;
  __adjust_heap(__first, _Distance(0), _Distance(__last - __first), __value);
}

template <class _RandomAccessIterator, class _Tp>
inline void
__pop_heap_aux(_RandomAccessIterator __first, _RandomAccessIterator __last,
               _Tp*)
{
  __pop_heap(__first, __last - 1, __last - 1,
             _Tp(*(__last - 1)), __DISTANCE_TYPE(__first));
}

template <class _RandomAccessIterator>
inline void pop_heap(_RandomAccessIterator __first,
                     _RandomAccessIterator __last)
{
  __pop_heap_aux(__first, __last, __VALUE_TYPE(__first));
}

template <class _RandomAccessIterator, class _Distance,
          class _Tp, class _Compare>
void
__adjust_heap(_RandomAccessIterator __first, _Distance __holeIndex,
              _Distance __len, _Tp __value, _Compare __comp)
{
  _Distance __topIndex = __holeIndex;
  _Distance __secondChild = 2 * __holeIndex + 2;
  while (__secondChild < __len) {
    if (__comp(*(__first + __secondChild), *(__first + (__secondChild - 1))))
      __secondChild--;
    *(__first + __holeIndex) = *(__first + __secondChild);
    __holeIndex = __secondChild;
    __secondChild = 2 * (__secondChild + 1);
  }
  if (__secondChild == __len) {
    *(__first + __holeIndex) = *(__first + (__secondChild - 1));
    __holeIndex = __secondChild - 1;
  }
  __push_heap(__first, __holeIndex, __topIndex, __value, __comp);
}

template <class _RandomAccessIterator, class _Tp, class _Compare,
          class _Distance>
inline void
__pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last,
           _RandomAccessIterator __result, _Tp __value, _Compare __comp,
           _Distance*)
{
  *__result = *__first;
  __adjust_heap(__first, _Distance(0), _Distance(__last - __first),
                __value, __comp);
}

template <class _RandomAccessIterator, class _Tp, class _Compare>
inline void
__pop_heap_aux(_RandomAccessIterator __first,
               _RandomAccessIterator __last, _Tp*, _Compare __comp)
{
  __pop_heap(__first, __last - 1, __last - 1, _Tp(*(__last - 1)), __comp,
             __DISTANCE_TYPE(__first));
}

template <class _RandomAccessIterator, class _Compare>
inline void
pop_heap(_RandomAccessIterator __first,
         _RandomAccessIterator __last, _Compare __comp)
{
    __pop_heap_aux(__first, __last, __VALUE_TYPE(__first), __comp);
}

template <class _RandomAccessIterator, class _Tp, class _Distance>
void
__make_heap(_RandomAccessIterator __first,
            _RandomAccessIterator __last, _Tp*, _Distance*)
{
  if (__last - __first < 2) return;
  _Distance __len = __last - __first;
  _Distance __parent = (__len - 2)/2;

  while (true) {
    __adjust_heap(__first, __parent, __len, _Tp(*(__first + __parent)));
    if (__parent == 0) return;
    __parent--;
  }
}

template <class _RandomAccessIterator>
inline void
make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last)
{
  __make_heap(__first, __last,
              __VALUE_TYPE(__first), __DISTANCE_TYPE(__first));
}

template <class _RandomAccessIterator, class _Compare,
          class _Tp, class _Distance>
void
__make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last,
            _Compare __comp, _Tp*, _Distance*)
{
  if (__last - __first < 2) return;
  _Distance __len = __last - __first;
  _Distance __parent = (__len - 2)/2;

  while (true) {
    __adjust_heap(__first, __parent, __len, _Tp(*(__first + __parent)),
                  __comp);
    if (__parent == 0) return;
    __parent--;
  }
}

template <class _RandomAccessIterator, class _Compare>
inline void
make_heap(_RandomAccessIterator __first,
          _RandomAccessIterator __last, _Compare __comp)
{
  __make_heap(__first, __last, __comp,
              __VALUE_TYPE(__first), __DISTANCE_TYPE(__first));
}

template <class _RandomAccessIterator>
void sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last)
{
  while (__last - __first > 1)
    pop_heap(__first, __last--);
}

template <class _RandomAccessIterator, class _Compare>
void
sort_heap(_RandomAccessIterator __first,
          _RandomAccessIterator __last, _Compare __comp)
{
  while (__last - __first > 1)
    pop_heap(__first, __last--, __comp);
}

#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
#pragma reset woff 1209
#endif

__STL_END_NAMESPACE

#endif /* __SGI_STL_INTERNAL_HEAP_H */

// Local Variables:
// mode:C++
// End:


text:
require_relative "api_model"

module Harborapp
  class Account
    include ApiModel
    attr_accessor :api_key, :email

    def self.login(email, password)
      params = {:basic_username => email, :basic_password => password}
      Harborapp::Api.request :post, "/login", params
    end

    def self.signup(email, password, password_confirmation)
      params = {:email => email, :password => password,
				:password_confirmation => password_confirmation}
      Harborapp::Api.request :post, "/signup", params
    end

		def write_creds
			File.open(File.expand_path("~/.harbor_auth"), "w") do |f|
				f.write({api_key: api_key, email: email}.to_json)
			end
		end

		def self.from_creds
			fn = File.expand_path("~/.harbor_auth")
			raise Exception.new("Please log in first") unless File.exist? fn
			File.open(fn, "r") do |f|
				hash = JSON.parse f.read
				self.new hash
			end
		end

		def self.logout
			fn = File.expand_path("~/.harbor_auth")
			File.unlink(fn) if File.exist? fn
		end
  end
end


text:
//
//  Employee.m
//  PHAM_CHI_CONG
//
//  Created by TTA-Brown-006 on 4/14/15.
//  Copyright (c) 2015 Pham Chi Cong. All rights reserved.
//

#import "Employee.h"
#import "SalaryController.h"

@implementation Employee
@synthesize employeeId;
@synthesize lastName;
@synthesize firstName;
@synthesize employeeInterface = _employeeInterface;

/**
 * Comment of this method in .h file
 */
- (int)calculateNetSalary {
    int netSalary = 0;
    if ([_employeeInterface conformsToProtocol:@protocol(EmployeeInterface)]) {
        @try {
            SalaryController *controller = [[SalaryController alloc] init];
            float grossSalary = [_employeeInterface calculateGrossSalary];
            float PN_rate = [controller getContributionRate:grossSalary];
            float salaryBeforeTax = (grossSalary - (PN_rate * grossSalary));
            float tax_rate = [controller getTaxRate:grossSalary];
            netSalary = (int)ceilf(salaryBeforeTax - (salaryBeforeTax * tax_rate));
        }
        @catch (NSException *exception) {
            DLog(@"Exception:%@",exception.description);
        }
    }
    return netSalary;
}
@end


text:
% PURPOSE: An example of using stvar to run a
%          smooth transition vector autoregression.
%
%---------------------------------------------------
% USAGE: stvar_d
%---------------------------------------------------

clear all;

load peru.data; % a test data set containing
                % data from the Peruvian Economy:
                % Discount Rate (level), Real Exchange Rate (Log Annual Dif.)
                % GDP (Log Annual Dif.), Price Index (Log Annual Dif.)

% monthly data covers 1994,1 to 2003,6

%Arranging Parameters for simulation
param=[2 1 1 0 1 1.5 100 24 1 1];

% estimate the model
results = stvar(peru,param);

vnames =  ['Discount Rate      ',
           'Real Exchange Rate ',
           'GDP                ',
           'Price Index        '];

subplot(4,1,1);
    xlabel('Periods');
    ylabel('Disc. Rate');

subplot(4,1,2);
    xlabel('Periods');
    ylabel('Ex. Rate');

subplot(4,1,3);
    xlabel('Periods');
    ylabel('GDP');

subplot(4,1,4);
    xlabel('Periods');
    ylabel('Prices');

%prt(results,vnames);
%cutoff = 0.1;
%pgranger(results,vnames,cutoff);
%plt(results,vnames);


text:
<?php

# This file is a part of MyBB RESTful API System plugin - version 0.2
# Released under the MIT Licence by medbenji (TheGarfield)
#
// Disallow direct access to this file for security reasons
if(!defined("IN_MYBB"))
{
	die("Direct initialization of this file is not allowed.

Please make sure IN_MYBB is defined.");
}

/**
This interface should be implemented by APIs, see VersionAPI for a simple example.
*/
class UserAPI extends RESTfulAPI {

	public function info() {
		return array(
			"name" => "User",
			"description" => "This API exposes user interface.",
			"default" => "activated"
		);
	}
	/**
	This is where you perform the action when the API is called, the parameter given is an instance of stdClass, this method should return an instance of stdClass.
	*/
	public function action() {
		global $mybb, $db, $cache;

		$api = APISystem::get_instance();

		if(isset($api->paths[1]) && is_string($api->paths[1])) {
			switch(strtolower($api->paths[1])) {
				case "list" :

				// Incoming sort field?
				if($mybb->input['sort'])
				{
					$mybb->input['sort'] = strtolower($mybb->input['sort']);
				}
				else
				{
					$mybb->input['sort'] = $mybb->settings['default_memberlist_sortby'];
				}

				switch($mybb->input['sort'])
				{
					case "regdate":
						$sort_field = "u.regdate";
						break;
					case "lastvisit":
						$sort_field = "u.lastactive";
						break;
					case "reputation":
						$sort_field = "u.reputation";
						break;
					case "postnum":
						$sort_field = "u.postnum";
						break;
					case "referrals":
						$sort_field = "u.referrals";
						break;
					default:
						$sort_field = "u.username";
						$mybb->input['sort'] = 'username';
						break;
				}

				// Incoming sort order?
				if($mybb->input['order'])
				{
					$mybb->input['order'] = strtolower($mybb->input['order']);
				}
				else
				{
					$mybb->input['order'] = strtolower($mybb->settings['default_memberlist_order']);
				}

				if($mybb->input['order'] == "ascending" || (!$mybb->input['order'] && $mybb->input['sort'] == 'username'))
				{
					$sort_order = "ASC";
					$mybb->input['order'] = "ascending";
				}
				else
				{
					$sort_order = "DESC";
					$mybb->input['order'] = "descending";
				}

				// Incoming results per page?
				$mybb->input['perpage'] = intval($mybb->input['perpage']);
				if($mybb->input['perpage'] > 0 && $mybb->input['perpage'] <= 500)
				{
					$per_page = $mybb->input['perpage'];
				}
				else if($mybb->settings['membersperpage'])
				{
					$per_page = $mybb->input['perpage'] = intval($mybb->settings['membersperpage']);
				}
				else
				{
					$per_page = $mybb->input['perpage'] = 20;
				}

				$search_query = '1=1';

				// Limiting results to a certain letter
				if($mybb->input['letter'])
				{
					$letter = chr(ord($mybb->input['letter']));
					if($mybb->input['letter'] == -1)
					{
						$search_query .= " AND u.username NOT REGEXP('[a-zA-Z]')";
					}
					else if(strlen($letter) == 1)
					{
						$search_query .= " AND u.username LIKE '".$db->escape_string_like($letter)."%'";
					}
				}

				// Searching for a matching username
				$search_username = htmlspecialchars_uni(trim($mybb->input['username']));
				if($search_username != '')
				{
					$username_like_query = $db->escape_string_like($search_username);

					// Name begins with
					if($mybb->input['username_match'] == "begins")
					{
						$search_query .= " AND u.username LIKE '".$username_like_query."%'";
					}
					// Just contains
					else
					{
						$search_query .= " AND u.username LIKE '%".$username_like_query."%'";
					}
				}

				// Website contains
				$search_website = htmlspecialchars_uni($mybb->input['website']);
				if(trim($mybb->input['website']))
				{
					$search_query .= " AND u.website LIKE '%".$db->escape_string_like($mybb->input['website'])."%'";
				}

				// AIM Identity
				if(trim($mybb->input['aim']))
				{
					$search_query .= " AND u.aim LIKE '%".$db->escape_string_like($mybb->input['aim'])."%'";
				}

				// ICQ Number
				if(trim($mybb->input['icq']))
				{
					$search_query .= " AND u.icq LIKE '%".$db->escape_string_like($mybb->input['icq'])."%'";
				}

				// MSN/Windows Live Messenger address
				if(trim($mybb->input['msn']))
				{
					$search_query .= " AND u.msn LIKE '%".$db->escape_string_like($mybb->input['msn'])."%'";
				}

				// Yahoo! Messenger address
				if(trim($mybb->input['yahoo']))
				{
					$search_query .= " AND u.yahoo LIKE '%".$db->escape_string_like($mybb->input['yahoo'])."%'";
				}

				$query = $db->simple_select("users u", "COUNT(*) AS users", "{$search_query}");
				$num_users = $db->fetch_field($query, "users");

				$page = intval($mybb->input['page']);
				if($page && $page > 0)
				{
					$start = ($page - 1) * $per_page;
				}
				else
				{
					$start = 0;
					$page = 1;
				}

				$query = $db->query("
					SELECT u.*, f.*
					FROM ".TABLE_PREFIX."users u
					LEFT JOIN ".TABLE_PREFIX."userfields f ON (f.ufid=u.uid)
					WHERE {$search_query}
					ORDER BY {$sort_field} {$sort_order}
					LIMIT {$start}, {$per_page}
				");

				$return_array = new stdClass();
				$return_array->list = array();
				while($user = $db->fetch_array($query)) {
					$return_array->list[] = $user;
				}

				$return_array->count = $num_users;
				return $return_array;

				break;
				case "group" :
				$usergroups = $cache->read("usergroups");
				return array_values($usergroups);
				break;
				default :

				break;
			}
		}
	}

	private function action_list() {

	}
}


text:
Hibernate ve Spring Framewrok ile Oracle DB üzerinde ekleme silme güncelleme ve listeleme işlemleri yapılmış proje örneğidir.

### Unutma
Projeyi indirdiğinizde **hibernate-config.xml** , **testcon.xml**  ve **hibernate.reveng.xml** dosyalarındaki oracle server connection bilgilerinizi güncelleyiniz

```markdown
Version Bilgileri

# Hibernate Version : 5.2.10.Final
# Spring Version    : 4.3.10.RELEASE
# Java Version      : 1.8
# Dynamic Web       : 3.1
# Oracle DB         : 11G

```
```
   Copyright 2017 Atakan Çoban

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
```


text:
package org.seasar.dao.impl;

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

import javax.sql.DataSource;

import org.seasar.dao.BeanMetaData;
import org.seasar.dao.IdentifierGenerator;
import org.seasar.dao.PrimaryKeyNotFoundRuntimeException;
import org.seasar.extension.jdbc.PropertyType;
import org.seasar.extension.jdbc.StatementFactory;
import org.seasar.framework.exception.SRuntimeException;

/**
 * @author higa
 * @author jflute
 */
public abstract class AbstractAutoStaticCommand extends AbstractStaticCommand {

    private PropertyType[] propertyTypes;

    private boolean checkSingleRowUpdate = true;

    public AbstractAutoStaticCommand(DataSource dataSource,
            StatementFactory statementFactory, BeanMetaData beanMetaData,
            String[] propertyNames) {

        super(dataSource, statementFactory, beanMetaData);
        setupPropertyTypes(propertyNames);
        setupSql();
    }

    public Object execute(Object[] args) {
        AbstractAutoHandler handler = createAutoHandler();
        handler.setSql(getSql());
        injectDaoClass(handler);
        int rows = handler.execute(args);
        return new Integer(rows);
    }

    public boolean isCheckSingleRowUpdate() {
        return checkSingleRowUpdate;
    }

    public void setCheckSingleRowUpdate(boolean checkSingleRowUpdate) {
        this.checkSingleRowUpdate = checkSingleRowUpdate;
    }

    protected PropertyType[] getPropertyTypes() {
        return propertyTypes;
    }

    protected void setPropertyTypes(PropertyType[] propertyTypes) {
        this.propertyTypes = propertyTypes;
    }

    protected abstract AbstractAutoHandler createAutoHandler();

    protected abstract void setupPropertyTypes(String[] propertyNames);

    protected void setupInsertPropertyTypes(String[] propertyNames) {
        List types = new ArrayList();
        for (int i = 0; i < propertyNames.length; ++i) {
            PropertyType pt = getBeanMetaData().getPropertyType(
                    propertyNames[i]);
            if (isInsertTarget(pt)) {
                types.add(pt);
            }
        }
        propertyTypes = (PropertyType[]) types.toArray(new PropertyType[types
                .size()]);
    }

    protected boolean isInsertTarget(PropertyType propertyType) {
        if (propertyType.isPrimaryKey()) {
            String name = propertyType.getPropertyName();
            IdentifierGenerator generator = getBeanMetaData()
                    .getIdentifierGenerator(name);
            return generator.isSelfGenerate();
        }
        return true;
    }

    protected void setupUpdatePropertyTypes(String[] propertyNames) {
        if (propertyNames.length == 0) {
            throw new SRuntimeException("EDAO0035");
        }
        List types = new ArrayList();
        for (int i = 0; i < propertyNames.length; ++i) {
            PropertyType pt = getBeanMetaData().getPropertyType(
                    propertyNames[i]);
            if (pt.isPrimaryKey()) {
                continue;
            }
            types.add(pt);
        }
        if (types.size() == 0) {
            throw new SRuntimeException("EDAO0020");
        }
        propertyTypes = (PropertyType[]) types.toArray(new PropertyType[types
                .size()]);
    }

    protected void setupDeletePropertyTypes(String[] propertyNames) {
    }

    protected abstract void setupSql();

    protected void setupInsertSql() {
        BeanMetaData bmd = getBeanMetaData();
        StringBuffer buf = new StringBuffer(100);
        buf.append("INSERT INTO ");
        buf.append(bmd.getTableName());
        buf.append(" (");
        for (int i = 0; i < propertyTypes.length; ++i) {
            PropertyType pt = propertyTypes[i];
            if (isInsertTarget(pt)) {
                buf.append(pt.getColumnName());
                buf.append(", ");
            }
        }
        buf.setLength(buf.length() - 2);
        buf.append(") VALUES (");
        for (int i = 0; i < propertyTypes.length; ++i) {
            PropertyType pt = propertyTypes[i];
            if (isInsertTarget(pt)) {
                buf.append("?, ");
            }
        }
        buf.setLength(buf.length() - 2);
        buf.append(")");
        setSql(buf.toString());
    }

    protected void setupUpdateSql() {
        checkPrimaryKey();
        StringBuffer buf = new StringBuffer(100);
        buf.append("UPDATE ");
        buf.append(getBeanMetaData().getTableName());
        buf.append(" SET ");
        for (int i = 0; i < propertyTypes.length; ++i) {
            PropertyType pt = propertyTypes[i];
            buf.append(pt.getColumnName());
            buf.append(" = ?, ");
        }
        buf.setLength(buf.length() - 2);
        setupUpdateWhere(buf);
        setSql(buf.toString());
    }

    protected void setupDeleteSql() {
        checkPrimaryKey();
        StringBuffer buf = new StringBuffer(100);
        buf.append("DELETE FROM ");
        buf.append(getBeanMetaData().getTableName());
        setupUpdateWhere(buf);
        setSql(buf.toString());
    }

    protected void checkPrimaryKey() {
        BeanMetaData bmd = getBeanMetaData();
        if (bmd.getPrimaryKeySize() == 0) {
            throw new PrimaryKeyNotFoundRuntimeException(bmd.getBeanClass());
        }
    }

    protected void setupUpdateWhere(StringBuffer buf) {
        BeanMetaData bmd = getBeanMetaData();
        buf.append(" WHERE ");
        for (int i = 0; i < bmd.getPrimaryKeySize(); ++i) {
            buf.append(bmd.getPrimaryKey(i));
            buf.append(" = ? AND ");
        }
        buf.setLength(buf.length() - 5);
        if (bmd.hasVersionNoPropertyType()) {
            PropertyType pt = bmd.getVersionNoPropertyType();
            buf.append(" AND ");
            buf.append(pt.getColumnName());
            buf.append(" = ?");
        }
        if (bmd.hasTimestampPropertyType()) {
            PropertyType pt = bmd.getTimestampPropertyType();
            buf.append(" AND ");
            buf.append(pt.getColumnName());
            buf.append(" = ?");
        }
    }
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace NRoles.Engine {

  class CompositeCodeVisitor : CompositeCodeVisitorBase {
    List<CodeVisitorBase> _visitors = new List<CodeVisitorBase>();

    public override void AddCodeVisitor(CodeVisitorBase visitor) {
      if (visitor == null) throw new ArgumentNullException("visitor");
      _visitors.Add(visitor);
    }

    internal override void Apply(Action<CodeVisitorBase> action) {
      _visitors.ForEach(action);
    }

    public int Count { get { return _visitors.Count; } }
  }

}


text:
* [Fixed] Dependency updates. See [#12653](https://github.com/DataDog/integrations-core/pull/12653).

## 4.7.0 / 2022-04-05 / Agent 7.36.0

* [Added] Add metric_patterns options to filter all metric submission by a list of regexes. See [#11695](https://github.com/DataDog/integrations-core/pull/11695).
* [Fixed] Support newer versions of `click`. See [#11746](https://github.com/DataDog/integrations-core/pull/11746).

## 4.6.0 / 2022-02-19 / Agent 7.35.0

* [Added] Add `pyproject.toml` file. See [#11338](https://github.com/DataDog/integrations-core/pull/11338).
* [Added] Upgrade psutil to 5.9.0. See [#11139](https://github.com/DataDog/integrations-core/pull/11139).
* [Fixed] Fix namespace packaging on Python 2. See [#11532](https://github.com/DataDog/integrations-core/pull/11532).

## 4.5.2 / 2022-01-08 / Agent 7.34.0

* [Fixed] Add comment to autogenerated model files. See [#10945](https://github.com/DataDog/integrations-core/pull/10945).

## 4.5.1 / 2021-11-16 / Agent 7.33.0

* [Fixed] Fix use_mount required field. See [#10657](https://github.com/DataDog/integrations-core/pull/10657).

## 4.5.0 / 2021-11-13

* [Added] Add runtime configuration validation. See [#8905](https://github.com/DataDog/integrations-core/pull/8905).
* [Fixed] Fix `tag_by_label` when used together with `use_mount`. See [#10418](https://github.com/DataDog/integrations-core/pull/10418).

## 4.4.0 / 2021-08-05 / Agent 7.31.0

* [Added] Add option to use `lsblk` command for labeling. See [#9827](https://github.com/DataDog/integrations-core/pull/9827).

## 4.3.0 / 2021-03-24 / Agent 7.28.0

* [Added] Log something if a disk is excluded. See [#8829](https://github.com/DataDog/integrations-core/pull/8829).

## 4.2.0 / 2021-03-07 / Agent 7.27.0

* [Added] Report read_time and write_time as a count of millis. See [#7323](https://github.com/DataDog/integrations-core/pull/7323).
* [Fixed] Rename config spec example consumer option `default` to `display_default`. See [#8593](https://github.com/DataDog/integrations-core/pull/8593).
* [Fixed] Bump minimum base package version. See [#8443](https://github.com/DataDog/integrations-core/pull/8443).

## 4.1.1 / 2021-01-28 / Agent 7.26.0

* [Fixed] Fix example config for `create_mounts`. See [#8480](https://github.com/DataDog/integrations-core/pull/8480).

## 4.1.0 / 2021-01-25

* [Added] Support network drives on Windows. See [#8273](https://github.com/DataDog/integrations-core/pull/8273).
* [Added] Add device_label tag in addition to label tag. See [#8306](https://github.com/DataDog/integrations-core/pull/8306).
* [Fixed] Correct default template usage. See [#8233](https://github.com/DataDog/integrations-core/pull/8233).

## 4.0.0 / 2020-10-31 / Agent 7.24.0

* [Changed] Rename whitelist/blacklist to include/exclude. See [#7627](https://github.com/DataDog/integrations-core/pull/7627).

## 3.0.0 / 2020-09-24 / Agent 7.23.0

* [Added] Add options for global exclusion patterns. See [#7648](https://github.com/DataDog/integrations-core/pull/7648).
* [Changed] Ignore `/proc/sys/fs/binfmt_misc` by default. See [#7650](https://github.com/DataDog/integrations-core/pull/7650).

## 2.11.0 / 2020-09-21

* [Added] [disk] Add `include_all_devices` option and improve error logs. See [#7378](https://github.com/DataDog/integrations-core/pull/7378).
* [Added] Upgrade psutil to 5.7.2. See [#7395](https://github.com/DataDog/integrations-core/pull/7395).
* [Fixed] Upgrade isort. See [#7539](https://github.com/DataDog/integrations-core/pull/7539).

## 2.10.1 / 2020-06-11 / Agent 7.21.0

* [Fixed] Rename disk check example config back to .default suffix. See [#6880](https://github.com/DataDog/integrations-core/pull/6880).

## 2.10.0 / 2020-06-09

* [Added] Add disk timeout configuration option. See [#6826](https://github.com/DataDog/integrations-core/pull/6826).

## 2.9.1 / 2020-06-11 / Agent 7.20.1

* [Fixed] Rename disk check example config back to .default suffix. See [#6880](https://github.com/DataDog/integrations-core/pull/6880).

## 2.9.0 / 2020-05-17 / Agent 7.20.0

* [Added] Allow optional dependency installation for all checks. See [#6589](https://github.com/DataDog/integrations-core/pull/6589).
* [Added] Add config spec. See [#6553](https://github.com/DataDog/integrations-core/pull/6553).
* [Added] Add device_name tag. See [#6332](https://github.com/DataDog/integrations-core/pull/6332).

## 2.8.0 / 2020-04-04 / Agent 7.19.0

* [Added] Upgrade psutil to 5.7.0. See [#6243](https://github.com/DataDog/integrations-core/pull/6243).

## 2.7.0 / 2020-02-22 / Agent 7.18.0

* [Added] Read udev disk labels from the blkid cache file. See [#5515](https://github.com/DataDog/integrations-core/pull/5515).

## 2.6.0 / 2020-01-13 / Agent 7.17.0

* [Added] Use lazy logging format. See [#5398](https://github.com/DataDog/integrations-core/pull/5398).
* [Added] Use lazy logging format. See [#5377](https://github.com/DataDog/integrations-core/pull/5377).

## 2.5.3 / 2019-12-13 / Agent 7.16.0

* [Fixed] Bump psutil to 5.6.7. See [#5210](https://github.com/DataDog/integrations-core/pull/5210).

## 2.5.2 / 2019-12-02

* [Fixed] Upgrade psutil dependency to 5.6.5. See [#5059](https://github.com/DataDog/integrations-core/pull/5059).

## 2.5.1 / 2019-10-11 / Agent 6.15.0

* [Fixed] Upgrade psutil dependency to 5.6.3. See [#4442](https://github.com/DataDog/integrations-core/pull/4442).

## 2.5.0 / 2019-08-24 / Agent 6.14.0

* [Added] Remove legacy collection method. See [#4417](https://github.com/DataDog/integrations-core/pull/4417).
* [Added] Add `min_disk_size` option. See [#4317](https://github.com/DataDog/integrations-core/pull/4317).

## 2.4.0 / 2019-07-12 / Agent 6.13.0

* [Added] Remove legacy code. See [#4103](https://github.com/DataDog/integrations-core/pull/4103).

## 2.3.0 / 2019-07-04

* [Added] Add disk label. See [#3953](https://github.com/DataDog/integrations-core/pull/3953).

## 2.2.0 / 2019-05-14 / Agent 6.12.0

* [Added] Upgrade psutil dependency to 5.6.2. See [#3684](https://github.com/DataDog/integrations-core/pull/3684).
* [Added] Adhere to code style. See [#3500](https://github.com/DataDog/integrations-core/pull/3500).

## 2.1.0 / 2019-02-18 / Agent 6.10.0

* [Added] Upgrade psutil. See [#3019](https://github.com/DataDog/integrations-core/pull/3019).
* [Fixed] Use `device` tag instead of the deprecated `device_name` parameter. See [#2946](https://github.com/DataDog/integrations-core/pull/2946). Thanks [aerostitch](https://github.com/aerostitch).

## 2.0.1 / 2019-01-04 / Agent 6.9.0

* [Fixed] Fix regression on agent 5 only. See [#2848](https://github.com/DataDog/integrations-core/pull/2848).

## 2.0.0 / 2018-11-30 / Agent 6.8.0

* [Added] Update psutil. See [#2576](https://github.com/DataDog/integrations-core/pull/2576).
* [Added] Add new filtering options, continue deprecations. See [#2483](https://github.com/DataDog/integrations-core/pull/2483).
* [Changed] Removed deprecated agentConfig option locations. See [#2488](https://github.com/DataDog/integrations-core/pull/2488).
* [Added] Support Python 3. See [#2468](https://github.com/DataDog/integrations-core/pull/2468).
* [Fixed] Use raw string literals when \ is present. See [#2465](https://github.com/DataDog/integrations-core/pull/2465).

## 1.4.0 / 2018-10-12 / Agent 6.6.0

* [Added] Upgrade psutil. See [#2190](https://github.com/DataDog/integrations-core/pull/2190).

## 1.3.0 / 2018-09-04 / Agent 6.5.0

* [Added] Adding optional service_check_rw parameter to check for read-only filesystem. See [#2086](https://github.com/DataDog/integrations-core/pull/2086). Thanks [bberezov](https://github.com/bberezov).
* [Fixed] Add data files to the wheel package. See [#1727](https://github.com/DataDog/integrations-core/pull/1727).

## 1.2.0 / 2018-03-23

* [FEATURE] Adds custom tag support

## 1.1.0 / 2018-02-13

* [FEATURE] Adds additional device/mount tagging based on regex
* [IMPROVEMENT] Allows disk latency metrics to be collected for non-Windows. See [#1018](https://github.com/DataDog/integrations-core/issues/1018).

## 1.0.2 / 2017-10-10

* [BUGFIX] Skip now works with NFS secure mounts too. See [#470](https://github.com/DataDog/integrations-core/issues/470).

## 1.0.1 / 2017-07-18

* [SANITY] Import `Platform` helper from `utils.platform` instead of deprecated `util`. See [#484](https://github.com/DataDog/integrations-core/issues/484)

## 1.0.0 / 2017-03-22

* [FEATURE] adds disk integration.


text:
#include "test/fake_texture_frame.h"

namespace webrtc {
namespace test {

VideoFrame FakeNativeBuffer::CreateFrame(int width,
                                         int height,
                                         uint32_t timestamp,
                                         int64_t render_time_ms,
                                         VideoRotation rotation) {
  return VideoFrame(new rtc::RefCountedObject<FakeNativeBuffer>(width, height),
                    timestamp, render_time_ms, rotation);
}

VideoFrameBuffer::Type FakeNativeBuffer::type() const {
  return Type::kNative;
}

int FakeNativeBuffer::width() const {
  return width_;
}

int FakeNativeBuffer::height() const {
  return height_;
}

rtc::scoped_refptr<I420BufferInterface> FakeNativeBuffer::ToI420() {
  rtc::scoped_refptr<I420Buffer> buffer = I420Buffer::Create(width_, height_);
  I420Buffer::SetBlack(buffer);
  return buffer;
}

}  // namespace test
}  // namespace webrtc


text:
"""
    Watch user likers stories!
    This script could be very useful to attract someone's
    audience to your account.

    If you will not specify the user_id, the script will use
    your likers as targets.

    Dependencies:
        pip install -U instabot

    Notes:
        You can change file and add there your comments.
"""

import os
import random
import sys
import time

# in case if you just downloaded zip with sources
sys.path.append(os.path.join(sys.path[0], "../../"))
from instabot import Bot  # noqa: E402

bot = Bot()
bot.login()

if len(sys.argv) >= 2:
    bot.logger.info(
        """
            Going to get '%s' likers and watch their stories
            (and stories of their likers too).
        """
        % (sys.argv[1])
    )
    user_to_get_likers_of = bot.convert_to_user_id(sys.argv[1])
else:
    bot.logger.info(
        """
            Going to get your likers and watch their stories (and stories
            of their likers too). You can specify username of another user
            to start (by default we use you as a starting point).
        """
    )
    user_to_get_likers_of = bot.user_id

current_user_id = user_to_get_likers_of
while True:
    try:
        # GET USER FEED
        if not bot.api.get_user_feed(current_user_id):
            print("Can't get feed of user_id=%s" % current_user_id)

        # GET MEDIA LIKERS
        user_media = random.choice(bot.api.last_json["items"])
        if not bot.api.get_media_likers(media_id=user_media["pk"]):
            bot.logger.info(
                "Can't get media likers of media_id='%s' by user_id='%s'"
                % (user_media["id"], current_user_id)
            )

        likers = bot.api.last_json["users"]
        liker_ids = [
            str(u["pk"])
            for u in likers
            if not u["is_private"] and "latest_reel_media" in u
        ][:20]

        # WATCH USERS STORIES
        if bot.watch_users_reels(liker_ids):
            bot.logger.info("Total stories viewed: %d" % bot.total["stories_viewed"])

        # CHOOSE RANDOM LIKER TO GRAB HIS LIKERS AND REPEAT
        current_user_id = random.choice(liker_ids)

        if random.random() < 0.05:
            current_user_id = user_to_get_likers_of
            bot.logger.info(
                "Sleeping and returning back to original user_id=%s" % current_user_id
            )
            time.sleep(90 * random.random() + 60)

    except Exception as e:
        # If something went wrong - sleep long and start again
        bot.logger.info(e)
        current_user_id = user_to_get_likers_of
        time.sleep(240 * random.random() + 60)


text:
"""
BuildtasksApi.py
Copyright 2015 SmartBear Software

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
"""

from __future__ import absolute_import

import sys
import os

# python 2 and python 3 compatibility library
from six import iteritems

from ..configuration import Configuration
from ..api_client import ApiClient

class BuildtasksApi(object):
    """
    NOTE: This class is auto generated by the swagger code generator program.
    Do not edit the class manually.
    Ref: https://github.com/swagger-api/swagger-codegen
    """

    def __init__(self, api_client=None):
        config = Configuration()
        if api_client:
            self.api_client = api_client
        else:
            if not config.api_client:
                config.api_client = ApiClient()
            self.api_client = config.api_client

    def build(self, build_execution_configuration, **kwargs):
        """
        Triggers the build execution for a given configuration.

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please define a `callback` function
        to be invoked when receiving the response.
        >>> def callback_function(response):
        >>>     pprint(response)
        >>>
        >>> thread = api.build(build_execution_configuration, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str build_execution_configuration: Build Execution Configuration. See org.jboss.pnc.spi.executor.BuildExecutionConfiguration. (required)
        :param str username_triggered: Username who triggered the build. If empty current user is used.
        :param str callback_url: Optional Callback URL
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """
        # verify the required parameter 'build_execution_configuration' is set
        if build_execution_configuration is None:
            raise ValueError("Missing the required parameter `build_execution_configuration` when calling `build`")

        all_params = ['build_execution_configuration', 'username_triggered', 'callback_url']
        all_params.append('callback')

        params = locals()
        for key, val in iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method build" % key
                )
            params[key] = val
        del params['kwargs']

        resource_path = '/build-tasks/execute-build'.replace('{format}', 'json')
        method = 'POST'

        path_params = {}

        query_params = {}

        header_params = {}

        form_params = {}
        files = {}
        if 'build_execution_configuration' in params:
            form_params['buildExecutionConfiguration'] = params['build_execution_configuration']
        if 'username_triggered' in params:
            form_params['usernameTriggered'] = params['username_triggered']
        if 'callback_url' in params:
            form_params['callbackUrl'] = params['callback_url']

        body_params = None

        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.\
            select_header_accept(['application/json'])
        if not header_params['Accept']:
            del header_params['Accept']

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.\
            select_header_content_type(['application/x-www-form-urlencoded'])

        # Authentication setting
        auth_settings = []

        response = self.api_client.call_api(resource_path, method,
                                            path_params,
                                            query_params,
                                            header_params,
                                            body=body_params,
                                            post_params=form_params,
                                            files=files,
                                            response_type=None,
                                            auth_settings=auth_settings,
                                            callback=params.get('callback'))
        return response

    def build_task_completed(self, task_id, build_result, **kwargs):
        """
        Notifies the completion of externally managed build task process.

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please define a `callback` function
        to be invoked when receiving the response.
        >>> def callback_function(response):
        >>>     pprint(response)
        >>>
        >>> thread = api.build_task_completed(task_id, build_result, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param int task_id: Build task id (required)
        :param str build_result: Build result (required)
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """
        # verify the required parameter 'task_id' is set
        if task_id is None:
            raise ValueError("Missing the required parameter `task_id` when calling `build_task_completed`")
        # verify the required parameter 'build_result' is set
        if build_result is None:
            raise ValueError("Missing the required parameter `build_result` when calling `build_task_completed`")

        all_params = ['task_id', 'build_result']
        all_params.append('callback')

        params = locals()
        for key, val in iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method build_task_completed" % key
                )
            params[key] = val
        del params['kwargs']

        resource_path = '/build-tasks/{taskId}/completed'.replace('{format}', 'json')
        method = 'POST'

        path_params = {}
        if 'task_id' in params:
            path_params['taskId'] = params['task_id']

        query_params = {}

        header_params = {}

        form_params = {}
        files = {}
        if 'build_result' in params:
            form_params['buildResult'] = params['build_result']

        body_params = None

        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.\
            select_header_accept(['application/json'])
        if not header_params['Accept']:
            del header_params['Accept']

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.\
            select_header_content_type(['application/x-www-form-urlencoded'])

        # Authentication setting
        auth_settings = []

        response = self.api_client.call_api(resource_path, method,
                                            path_params,
                                            query_params,
                                            header_params,
                                            body=body_params,
                                            post_params=form_params,
                                            files=files,
                                            response_type=None,
                                            auth_settings=auth_settings,
                                            callback=params.get('callback'))
        return response