text:
using System;
using System.Diagnostics.Contracts;
using System.Runtime.CompilerServices;
using System.Threading;
using System.Threading.Tasks;
using LanguageExt.Common;
using LanguageExt.Effects.Traits;
using LanguageExt.Thunks;

namespace LanguageExt
{
    public static partial class Prelude
    {
        /// <summary>
        /// Keeps retrying the computation
        /// </summary>
        /// <param name="ma">Computation to retry</param>
        /// <typeparam name="RT">Runtime</typeparam>
        /// <typeparam name="A">Computation bound value type</typeparam>
        /// <returns>The result of the last invocation of ma</returns>
        public static Aff<RT, A> retry<RT, A>(Aff<RT, A> ma) where RT : struct, HasCancel<RT> =>
            ScheduleAff<RT, A>.Retry(ma, Schedule.Forever);

        /// <summary>
        /// Keeps retrying the computation
        /// </summary>
        /// <param name="ma">Computation to retry</param>
        /// <typeparam name="RT">Runtime</typeparam>
        /// <typeparam name="A">Computation bound value type</typeparam>
        /// <returns>The result of the last invocation of ma</returns>
        public static Aff<A> retry<A>(Aff<A> ma) =>
            ScheduleAff<A>.Retry(ma, Schedule.Forever);

        /// <summary>
        /// Keeps retrying the computation, until the scheduler expires
        /// </summary>
        /// <param name="ma">Computation to retry</param>
        /// <param name="schedule">Scheduler strategy for retrying</param>
        /// <typeparam name="RT">Runtime</typeparam>
        /// <typeparam name="A">Computation bound value type</typeparam>
        /// <returns>The result of the last invocation of ma</returns>
        public static Aff<RT, A> retry<RT, A>(Schedule schedule, Aff<RT, A> ma) where RT : struct, HasCancel<RT> =>
            ScheduleAff<RT, A>.Retry(ma, schedule);

        /// <summary>
        /// Keeps retrying the computation, until the scheduler expires
        /// </summary>
        /// <param name="ma">Computation to retry</param>
        /// <param name="schedule">Scheduler strategy for retrying</param>
        /// <typeparam name="RT">Runtime</typeparam>
        /// <typeparam name="A">Computation bound value type</typeparam>
        /// <returns>The result of the last invocation of ma</returns>
        public static Aff<A> retry<A>(Schedule schedule, Aff<A> ma) =>
            ScheduleAff<A>.Retry(ma, schedule);

        /// <summary>
        /// Keeps retrying the computation until the predicate returns false
        /// </summary>
        /// <param name="ma">Computation to retry</param>
        /// <typeparam name="RT">Runtime</typeparam>
        /// <typeparam name="A">Computation bound value type</typeparam>
        /// <returns>The result of the last invocation of ma</returns>
        public static Aff<RT, A> retryWhile<RT, A>(Aff<RT, A> ma, Func<Error, bool> predicate) where RT : struct, HasCancel<RT> =>
            ScheduleAff<RT, A>.RetryWhile(ma, Schedule.Forever, predicate);

        /// <summary>
        /// Keeps retrying the computation until the predicate returns false
        /// </summary>
        /// <param name="ma">Computation to retry</param>
        /// <typeparam name="RT">Runtime</typeparam>
        /// <typeparam name="A">Computation bound value type</typeparam>
        /// <returns>The result of the last invocation of ma</returns>
        public static Aff<A> retryWhile<A>(Aff<A> ma, Func<Error, bool> predicate) =>
            ScheduleAff<A>.RetryWhile(ma, Schedule.Forever, predicate);

        /// <summary>
        /// Keeps retrying the computation, until the scheduler expires, or the predicate returns false
        /// </summary>
        /// <param name="ma">Computation to retry</param>
        /// <param name="schedule">Scheduler strategy for retrying</param>
        /// <typeparam name="RT">Runtime</typeparam>
        /// <typeparam name="A">Computation bound value type</typeparam>
        /// <returns>The result of the last invocation of ma</returns>
        public static Aff<RT, A> retryWhile<RT, A>(Schedule schedule, Aff<RT, A> ma, Func<Error, bool> predicate) where RT : struct, HasCancel<RT> =>
            ScheduleAff<RT, A>.RetryWhile(ma, schedule, predicate);

        /// <summary>
        /// Keeps retrying the computation, until the scheduler expires, or the predicate returns false
        /// </summary>
        /// <param name="ma">Computation to retry</param>
        /// <param name="schedule">Scheduler strategy for retrying</param>
        /// <typeparam name="RT">Runtime</typeparam>
        /// <typeparam name="A">Computation bound value type</typeparam>
        /// <returns>The result of the last invocation of ma</returns>
        public static Aff<A> retryWhile<A>(Schedule schedule, Aff<A> ma, Func<Error, bool> predicate) =>
            ScheduleAff<A>.RetryWhile(ma, schedule, predicate);

        /// <summary>
        /// Keeps retrying the computation until the predicate returns true
        /// </summary>
        /// <param name="ma">Computation to retry</param>
        /// <typeparam name="RT">Runtime</typeparam>
        /// <typeparam name="A">Computation bound value type</typeparam>
        /// <returns>The result of the last invocation of ma</returns>
        public static Aff<RT, A> retryUntil<RT, A>(Aff<RT, A> ma, Func<Error, bool> predicate) where RT : struct, HasCancel<RT> =>
            ScheduleAff<RT, A>.RetryUntil(ma, Schedule.Forever, predicate);

        /// <summary>
        /// Keeps retrying the computation until the predicate returns true
        /// </summary>
        /// <param name="ma">Computation to retry</param>
        /// <typeparam name="RT">Runtime</typeparam>
        /// <typeparam name="A">Computation bound value type</typeparam>
        /// <returns>The result of the last invocation of ma</returns>
        public static Aff<A> retryUntil<A>(Aff<A> ma, Func<Error, bool> predicate) =>
            ScheduleAff<A>.RetryUntil(ma, Schedule.Forever, predicate);

        /// <summary>
        /// Keeps retrying the computation, until the scheduler expires, or the predicate returns true
        /// </summary>
        /// <param name="ma">Computation to retry</param>
        /// <param name="schedule">Scheduler strategy for retrying</param>
        /// <typeparam name="RT">Runtime</typeparam>
        /// <typeparam name="A">Computation bound value type</typeparam>
        /// <returns>The result of the last invocation of ma</returns>
        public static Aff<RT, A> retryUntil<RT, A>(Schedule schedule, Aff<RT, A> ma, Func<Error, bool> predicate) where RT : struct, HasCancel<RT> =>
            ScheduleAff<RT, A>.RetryUntil(ma, schedule, predicate);

        /// <summary>
        /// Keeps retrying the computation, until the scheduler expires, or the predicate returns true
        /// </summary>
        /// <param name="ma">Computation to retry</param>
        /// <param name="schedule">Scheduler strategy for retrying</param>
        /// <typeparam name="RT">Runtime</typeparam>
        /// <typeparam name="A">Computation bound value type</typeparam>
        /// <returns>The result of the last invocation of ma</returns>
        public static Aff<A> retryUntil<A>(Schedule schedule, Aff<A> ma, Func<Error, bool> predicate) =>
            ScheduleAff<A>.RetryUntil(ma, schedule, predicate);
    }
}


text:
require 'test_helper'

class Admin::UtilsControllerTest < ActionController::TestCase
  fixtures :users

  def setup
  	@user = users(:users0)
  	sign_in @user
  end

  test "should get generate_cert" do
  	get :generate_cert
    assert_response :success
  end

end

redpajama_set_name: RedPajamaGithub


text:
<?xml version="1.0" encoding="UTF-8"?>
<profiles>
	<!-- Profiles go here. A sample MySQL profile configuration is provided. See the documentation
	on profiles for more detailed information about this file. -->
	<!--
	<profile id="profileName">
		<type>mysql</type>
		<database>db_name</database>
		<host>localhost</host>
		<port>3306</port>
		<username>root</username>
		<password>hunter2</password>
	</profile>
	-->
</profiles>


text:
package com.perforce.api;

import java.io.*;
import java.util.*;

/**
 * An interface that indicates the implementing class can be cached for some
 * period of time. Implementing classes will be stored in a
 * HashDecay instance. Each instantiating class must create its
 * own HashDecay instance and return a reference to it through
 * the getCache method.
 *
 * The update time is what is used by the HasDecay to determine
 * when an object will decay and be discarded.
 *
 * @see HashDecay
 * @author David Markley
 * @version $Date: 2002/01/15 $ $Revision: #2 $
 */
public interface Cacheable {

	/** Returns the time, in milliseconds, for this object's last update. */
	public long getUpdateTime();

	/** Sets the update time for this object to the current time. */
	public void refreshUpdateTime();

	/** Returns the time, in milliseconds, that this object was synchronized. */
	public long getSyncTime();

	/**
	 * Tests this object to see if it is out of sync. Checks to see if the
	 * expiration time is within the specified number of milliseconds.
	 *
	 * @param threshold
	 *            Number of milliseconds.
	 * @return True if the object will be out of sync within the threshold.
	 */
	public boolean outOfSync(long threshold);

	/** Invalidates this object. */
	public void invalidate();

	/** Marks this object as being in in sync or valid. */
	public void inSync();

	/** Removes any cached objects. */
	public void clearCache();

	/** Returns the HashDecay instance for this class */
	public HashDecay getCache();

	/**
	 * Stores this object back into Perforce, creating it if it didn't already
	 * exist.
	 */
	public void commit() throws CommitException;

	/**
	 * Brings this object back into sync with Perforce. This also sets the sets
	 * the update and sync time for this object.
	 */
	public void sync() throws PerforceException;
}


text:
package machine

import (
	"github.com/coreos/fleet/log"
)

type Machine interface {
	State() MachineState
}

// HasMetadata determine if the Metadata of a given MachineState
// matches the indicated values.
func HasMetadata(state *MachineState, metadata map[string][]string) bool {
	for key, values := range metadata {
		local, ok := state.Metadata[key]
		if !ok {
			log.V(1).Infof("No local values found for Metadata(%s)", key)
			return false
		}

		log.V(1).Infof("Asserting local Metadata(%s) meets requirements", key)

		var localMatch bool
		for _, val := range values {
			if local == val {
				log.V(1).Infof("Local Metadata(%s) meets requirement", key)
				localMatch = true
			}
		}

		if !localMatch {
			log.V(1).Infof("Local Metadata(%s) does not match requirement", key)
			return false
		}
	}

	return true
}


text:
namespace AddNew.Models
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel.DataAnnotations;
    using System.ComponentModel.DataAnnotations.Schema;
    using System.Data.Entity.Spatial;

    [Table("InvoiceLine")]
    public partial class InvoiceLine
    {
        public int InvoiceLineId { get; set; }

        public int InvoiceId { get; set; }

        public int TrackId { get; set; }

        [Column(TypeName = "numeric")]
        public decimal UnitPrice { get; set; }

        public int Quantity { get; set; }

        public virtual Invoice Invoice { get; set; }

        public virtual Track Track { get; set; }
    }
}


text:
/* -*- mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
#include <string>
#ifdef _OPENMP
#include <omp.h>
#else
#define omp_get_max_threads() (1)
#define omp_get_num_threads() (1)
#define omp_get_thread_num()  (0)
#endif

#include "base/CommandLineParser.h"
#include "analysis/DNAVector.h"
#include "analysis/NonRedKmerTable.h"

//#include "analysis/CompMgr.h"
#include <queue>
#include <map>
#include <algorithm>

#define MAX_OPEN_FILES 1000

extern "C"
{
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>
#include <errno.h>
}

class Assignment
{
public:
    Assignment() {
        m_comp = -1;
        m_read = -1;
    }

    void SetComp(int c) {
        m_comp = c;
    }
    void SetRead(int r) {
        m_read = r;
    }

    int Read() const {return m_read;}
    int Comp() const {return m_comp;}

    bool operator < (const Assignment & a) const {
        return (m_comp < a.m_comp);
    }

private:
    int m_comp;
    int m_read;
};

int main(int argc,char** argv)
{

    commandArg<string> aStringCmmd("-i","reads fasta");
    commandArg<string> fStringCmmd("-f","fasta input file (concatenated flat components)");
    commandArg<string> bStringCmmd("-o","output file");
    commandArg<long> mmrCmmd("-max_mem_reads","Maximum number of reads to load into memory", -1);
    commandArg<bool> strandCmmd("-strand","strand specific data", false);
    commandArg<int> pctReadMapCmmd("-p", "percent of read kmers require mapping to component", 0);
    commandArg<bool> verboseCmmd("-verbose", "prints more status info", false);
    commandArg<int> numThreadsCmmd("-t", "number of threads (default: env OMP_NUM_THREADS)", 0);

    commandLineParser P(argc,argv);
    P.SetDescription("Assigns reads to graph components.");
    P.registerArg(aStringCmmd);
    P.registerArg(fStringCmmd);
    P.registerArg(bStringCmmd);
    P.registerArg(mmrCmmd);
    P.registerArg(strandCmmd);
    P.registerArg(pctReadMapCmmd);
    P.registerArg(verboseCmmd);
    P.registerArg(numThreadsCmmd);

    P.parse();

    cerr << "-------------------------------------------" << endl
         << "---- Chrysalis: ReadsToTranscripts --------" << endl
         << "-- (Place reads on Inchworm Bundles) ------" << endl
         << "-------------------------------------------" << endl << endl;

    string aString = P.GetStringValueFor(aStringCmmd); // reads.fa
    string readsToTranscriptsOutputFile = P.GetStringValueFor(bStringCmmd); // out directory
    string fString = P.GetStringValueFor(fStringCmmd); // inchworm bundled.fasta
    long max_mem_reads = P.GetLongValueFor(mmrCmmd);
    bool bStrand = P.GetBoolValueFor(strandCmmd);  // strand-specific data
    int pctReadMapRequired = P.GetIntValueFor(pctReadMapCmmd);
    int num_threads = P.GetIntValueFor(numThreadsCmmd);

    bool VERBOSE = P.GetBoolValueFor(verboseCmmd);

    vecDNAVector dna;

    if(max_mem_reads > 0){
        cerr << "Setting maximum number of reads to load in memory to " << max_mem_reads << endl;
    } else {
        max_mem_reads = 2147483647; // max int
    }

    if (num_threads > 0) {
        cerr << "-setting num threads to: " << num_threads << endl;
        omp_set_num_threads(num_threads);
    }

    cerr << "Reading bundled inchworm contigs... " << endl;
    //ML: use 1M as read buffer size
    dna.Read(fString, false, false, true, 1000000);
    cerr << "done!" << endl;
    //test.ReverseComplement();

    int k = 25;

    //ComponentFileMgr compMgr(bString);
    multimap<int,int> componentReadMap;

    unsigned long readCount = 0;
    string readCountFile = readsToTranscriptsOutputFile + ".rcts.out";

    //-------------------------------------------------//
    //---- Build kmer index for Iworm Bundles ---------//
    //-------------------------------------------------//

    NonRedKmerTable kt(k);
    kt.SetUp(dna, true);
    kt.SetAllCounts(-1);

    map<int,int> component_number_mapping;

    cerr << "Assigning kmers to Iworm bundles ... ";
    #pragma omp parallel for schedule(guided,100)
    for (size_t i=0; i< dna.size(); i++) {
        const DNAVector & d = dna[i];
        string bundle_acc = dna.Name(i);
        string component_no_string = bundle_acc.substr(3); // remove >s_ prefix
        int component_no = atoi(component_no_string.c_str());

        #pragma omp critical
        {
            component_number_mapping[i] = component_no;

            //cerr << "\rBundle name: [" << i << "] = " << bundle_acc << ", so component_no = " << component_no << "    ";
        }

        for (int j=0; j<=d.isize()-k; j++) {
            kt.SetCount(d, j, i);  // not really counting kmers here, but instead labeling kmers according to the iworm bundles they correspond to.
        }
    }
    cerr << "done!" << endl;

    // ------------------------------------------------//
    // ------- Assign reads to Iworm Bundles ----------//
    // ------------------------------------------------//

    //ML: this implementation does not make use of class DNAVector for the reads

    map<int,bool> seen_component; // open files on first write, append on later writes.

    vector<int> read_pct_mapping_info;
    read_pct_mapping_info.resize(100000, 0);

    DNAStringStreamFast fastaReader;
    fastaReader.ReadStream(aString);

    //string readsToTranscriptsOutputFile = bString + "/readsToComponents.out"; // really mapping reads to components rather than transcripts, using spectral alignment
    int outFile = open(readsToTranscriptsOutputFile.c_str(), O_WRONLY | O_CREAT | O_TRUNC , 0666);

    cerr << "Processing reads:" << endl;
    unsigned long total_reads_read = 0;
    int reads_read = 0;
    do {
        vector<string> readSeqVector;
        vector<string> readNameVector;

        cerr << " reading another " << max_mem_reads << "... ";
        for(int i=0;i<max_mem_reads;i++)
        {
            if(!fastaReader.NextToVector(readSeqVector, readNameVector)) break;
        }

        reads_read = readSeqVector.size();
        if (reads_read > 0) {
            cerr << "done.  Read " << reads_read << " reads." << endl;
        } else {
            // reached EOF
            cerr << "finished reading reads" << endl;
            //MW: If nothing was read leave do loop right away
            break;
        }

        componentReadMap.clear();

        #pragma omp parallel for schedule(guided,100)
        for (int i=0; i < (int)readSeqVector.size(); i++) {

            string d = readSeqVector[i];
            // ensure upper case
            transform(d.begin(), d.end(), d.begin(), ::toupper);

            // map kmers of read to Iworm bundles
            svec<int> comp;
            comp.reserve(4000);
            int num_kmer_pos = d.size()-k + 1;
            for (int j=0; j<=(int)d.size()-k; j++) {
                int c = kt.GetCountReal(d, j); // the iworm bundle containing read kmer
                if (c >= 0)
                    comp.push_back(c);
            }
            if (!bStrand) {
                string dd = d;
                DNAVector::ReverseComplement(dd);
                for (int j=0; j<=(int)dd.size()-k; j++) {
                    int c = kt.GetCountReal(dd, j);
                    if (c >= 0)
                        comp.push_back(c);
                }
            }

            // find the iworm bundle with the most kmer hits
            Sort(comp);
            int best = -1;
            int max = 0;
            int run = 0;
            for (int j=1; j<comp.isize(); j++) {
                if (comp[j] != comp[j-1] || j+1 == comp.isize()) {
                    if (run > max) {
                        max = run;
                        best = comp[j-1];
                    }
                    run = 0;
                } else {
                    run++;
                }
            }

            //cout << "Read " << i << " maps to " << best << " with " << max << " k-mers" << endl;
            int pct_read_mapped = (int) ((float)max/num_kmer_pos*100 + 0.5);
            //ML: the following calculates the same, but without floating point precision issues:
            //int pct_read_mapped = ( 100*max + num_kmer_pos/2 ) / num_kmer_pos;
            if(best != -1 && pct_read_mapped >= pctReadMapRequired) {
                // Note: multiple threads shouldn't try to reorder the tree
                // at the same time (which can happen during an insert)
                #pragma omp critical
                {
                    readCount++;
                    componentReadMap.insert(pair<int,int>(best,i));  // i = read_index, best = best_iworm_bundle

                    // store pct read mapping info for later reporting
                    if (i > (int) read_pct_mapping_info.size()-1) {
                        read_pct_mapping_info.resize(i+100000);
                        // cerr << "resizing vec to " << i << " + 100000 " << endl;
                    }
                    read_pct_mapping_info[i] = pct_read_mapped;

                }
            }
            else {
                // no mapping for read
                if (VERBOSE)
                    cerr << "WARNING: No component mapping for read: " << readNameVector[i] << " : " << readSeqVector[i] << endl;
            }

        } // end of read assignment to components for this round of streaming

        if (reads_read > 0) {
            total_reads_read += reads_read;
            cerr << "[" << total_reads_read << "] reads analyzed for mapping." << endl;
        }

        //-------------------------------------------------------
        // Write reads to files based on components mapped to.

        //cerr << "\nWriting to files... ";
        // convert sorted map to vectors for threaded processing
        vector<int> mapComponents; // list of component_ids
        vector<vector<int> > componentReads; // list of read-vectors that correspond to the component_ids above (synched by index)
        multimap<int,int>::iterator it;
        int lastComponent = -1;
        vector<int> tmpReadIDs; // temporary hold for the reads corresponding to the last component
        for(it = componentReadMap.begin(); it != componentReadMap.end(); it++){
            if(it->first != lastComponent){  // start new component, first store previous component info.
                if(tmpReadIDs.size() > 0){
                    mapComponents.push_back(lastComponent);
                    componentReads.push_back(tmpReadIDs);
                }
                lastComponent = it->first;
                tmpReadIDs.clear();
            }
            tmpReadIDs.push_back(it->second);
        }
        if(tmpReadIDs.size() > 0){ // get the last component info stored.
            mapComponents.push_back(lastComponent);
            componentReads.push_back(tmpReadIDs);
        }

        // write out to files in map order

        #pragma omp parallel for schedule(static,1)
        for(unsigned int i = 0; i < mapComponents.size(); i++){

            // each thread accesses a unique component number, so no competition between threads in writing to component-based files.

            int iworm_bundle_index = mapComponents[i];
            int iworm_component_no = component_number_mapping[iworm_bundle_index];

            /*  changed to write to a single file - bhaas  July 3, 2013

            string name = compMgr.GetFileName(iworm_component_no, ".raw.fasta", false);
            int outFile;

            //ML: use systm calls open/write/close, buffer explicitly (faster than C++ buffered I/O)
            if(seen_component.find(iworm_component_no) == seen_component.end()) {
                // first write
                if (VERBOSE)
                    cerr << "First write to component: " << iworm_component_no << endl;
                outFile = open(name.c_str(), O_WRONLY | O_CREAT | O_TRUNC , 0666);
                #pragma omp critical
                seen_component[iworm_component_no] = true;
            }
            else {
                // subsequent write as append
                if (VERBOSE)
                    cerr << "Second write as append to component: " << iworm_component_no << endl;
                outFile = open(name.c_str(), O_WRONLY | O_APPEND );
            }
            if(outFile<0) cerr << "cannot open " << name << endl;

            */

            //ML: put everthing to write into buf
            string tmpName;
            char component_id_string[8];
            sprintf(component_id_string, "%d", iworm_component_no);
            string buf;
            for(unsigned int j = 0; j < componentReads[i].size(); j++){
                buf += component_id_string;
                buf += "\t";
                int read_index = componentReads[i][j];
                DNAStringStreamFast::formatReadNameString(readNameVector[read_index], tmpName);
                buf += tmpName;
                char foo[8];
                sprintf(foo, "%d%%\t", read_pct_mapping_info[read_index]);
                buf += "\t";
                buf += foo;
                buf += readSeqVector[read_index];
                buf += "\n";
            }

            // write mapping to file, avoid thread collisions
            #pragma omp critical
            if(write(outFile,buf.c_str(),buf.size())<0)
            {
                cerr <<  "error writing file "  << readsToTranscriptsOutputFile  << ": " <<  strerror(errno)  << endl;
                exit(0);
            }
            //close(outFile);
        }

        if(mapComponents.size()>0)
          cerr << "[" << mapComponents.size() << "] components written." << endl;

        //cerr << "done\n";
        //clear out read component mappings
    } while (reads_read > 0);

    close(outFile);

    cerr << "Done" << endl;

    FILE * pReadCount = fopen(readCountFile.c_str(), "w");
    fprintf(pReadCount, "%lu\n", readCount/2);
    fclose(pReadCount);

    return 0;
}


text:
@interface GDPostViewController ()

@property (weak, nonatomic) IBOutlet UIWebView *contentWebView;

@end

@implementation GDPostViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    [self.contentWebView loadRequest:
     [NSURLRequest requestWithURL:
      [NSURL URLWithString:
       [NSString stringWithFormat:@"http://www.sdgundam.cn/pages/app/post-view.aspx?id=%d&page=0", self.postId]]]];
}

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];

    [MobClick beginLogPageView:@"新闻详细"];
}

- (void)viewWillDisappear:(BOOL)animated {
    [super viewWillDisappear:animated];

    [MobClick endLogPageView:@"新闻详细"];
}

- (void)showLoading {
    // [MBProgressHUD showHUDAddedTo:self.view animated:NO];
    [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES];
}

- (void)hideLoading {
    // [MBProgressHUD hideHUDForView:self.view animated:NO];
    [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];
}

- (void)webViewDidStartLoad:(UIWebView *)webView {
    [self showLoading];
}

- (void)webViewDidFinishLoad:(UIWebView *)webView {
    [self hideLoading];
}

- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error {
    [self hideLoading];
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle: @"网络连接"
                                                    message: [error localizedDescription]
                                                   delegate: nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
    [alert show];
}

- (BOOL)webView:(UIWebView *)webView
        shouldStartLoadWithRequest:(NSURLRequest *)request
        navigationType:(UIWebViewNavigationType)navigationType {

    NSLog(@"%@ %@ %@ %@ %@", request.URL.scheme, request.URL.host, request.URL.path, request.URL.query, request.URL.fragment);
    static NSString *gdAppScheme = @"gdapp2";
    if ([request.URL.scheme isEqualToString:gdAppScheme]) {
        NSString *action = request.URL.host;
        NSString *objectId = [request.URL.path stringByReplacingOccurrencesOfString:@"/" withString:@""];
        if (objectId) {
            if ([action isEqualToString:@"unit"]) {
                [self presentUnitView:objectId];
                return NO;
            } else if ([action isEqualToString:@"video"]) {
                [self presentVideoViewController:[objectId intValue]];
                return NO;
            }
        }
        return YES;
    }
    else if ([request.URL.absoluteString isEqualToString:@"about:blank"]) {
        return YES;
    }
    else if ([request.URL.scheme isEqualToString:@"file"]) {
        return YES;
    }

    return YES;
}

- (void)presentUnitView:(NSString *)unitId {
    UnitViewController *uvc = [self.storyboard instantiateViewControllerWithIdentifier:@"UnitViewController"];
    uvc.unitId = unitId;

    [self.navigationController pushViewController:uvc animated:YES];
}

- (void)presentVideoViewController:(int)postId {
    GDVideoViewController *gdvvc = [self.storyboard instantiateViewControllerWithIdentifier:@"VideoViewController"];
    gdvvc.postId = postId;

    [self.navigationController pushViewController:gdvvc animated:YES];
}

@end


text:
#pragma once

#include "il2cpp-config.h"

#ifndef _MSC_VER
# include <alloca.h>
#else
# include <malloc.h>
#endif

#include <stdint.h>
#include <assert.h>
#include <exception>

// System.Text.RegularExpressions.FactoryCache/Key
struct Key_t447833941;
// System.String
struct String_t;
// System.Object
struct Il2CppObject;

#include "codegen/il2cpp-codegen.h"
#include "mscorlib_System_String7231557.h"
#include "System_System_Text_RegularExpressions_RegexOptions3066443743.h"
#include "mscorlib_System_Object4170816371.h"

// System.Void System.Text.RegularExpressions.FactoryCache/Key::.ctor(System.String,System.Text.RegularExpressions.RegexOptions)
extern "C"  void Key__ctor_m422488661 (Key_t447833941 * __this, String_t* ___pattern0, int32_t ___options1, const MethodInfo* method) IL2CPP_METHOD_ATTR;
// System.Int32 System.Text.RegularExpressions.FactoryCache/Key::GetHashCode()
extern "C"  int32_t Key_GetHashCode_m3621609140 (Key_t447833941 * __this, const MethodInfo* method) IL2CPP_METHOD_ATTR;
// System.Boolean System.Text.RegularExpressions.FactoryCache/Key::Equals(System.Object)
extern "C"  bool Key_Equals_m3415530204 (Key_t447833941 * __this, Il2CppObject * ___o0, const MethodInfo* method) IL2CPP_METHOD_ATTR;
// System.String System.Text.RegularExpressions.FactoryCache/Key::ToString()
extern "C"  String_t* Key_ToString_m2241865016 (Key_t447833941 * __this, const MethodInfo* method) IL2CPP_METHOD_ATTR;


text:
<?php

use Zizaco\Confide\ConfideUser;
use Zizaco\Confide\Confide;
use Zizaco\Confide\ConfideEloquentRepository;
use Zizaco\Entrust\HasRole;
use Carbon\Carbon;
use Illuminate\Auth\UserInterface;
use Illuminate\Auth\Reminders\RemindableInterface;

// class User extends ConfideUser implements UserInterface, RemindableInterface{
// class User extends Eloquent implements UserInterface, RemindableInterface {
// class User extends Eloquent implements ConfideUserInterface {

class User extends Eloquent implements UserInterface, RemindableInterface{
	// use UserTrait, RemindableTrait;
	use ConfideUser;
	use HasRole; // Add this trait to your user model

	/**
	 * The database table used by the model.
	 *
	 * @var string
	 */
	protected $table = 'users';

	/**
	 * The attributes excluded from the model's JSON form.
	 *
	 * @var array
	 */
	protected $hidden = array('password', 'remember_token');

	/**
   * Get user by username
   * @param $username
   * @return mixed
   */
  public function getUserByUsername( $username )
  {
      return $this->where('username', '=', $username)->first();
  }

  /**
   * Get the date the user was created.
   *
   * @return string
   */
  public function joined()
  {
      return String::date(Carbon::createFromFormat('Y-n-j G:i:s', $this->created_at));
  }

  /**
   * Save roles inputted from multiselect
   * @param $inputRoles
   */
  public function saveRoles($inputRoles)
  {
      if(! empty($inputRoles)) {
          $this->roles()->sync($inputRoles);
      } else {
          $this->roles()->detach();
      }
  }

  /**
   * Returns user's current role ids only.
   * @return array|bool
   */
  public function currentRoleIds()
  {
      $roles = $this->roles;
      $roleIds = false;
      if( !empty( $roles ) ) {
          $roleIds = array();
          foreach( $roles as &$role )
          {
              $roleIds[] = $role->id;
          }
      }
      return $roleIds;
  }

  /**
   * Redirect after auth.
   * If ifValid is set to true it will redirect a logged in user.
   * @param $redirect
   * @param bool $ifValid
   * @return mixed
   */
  public static function checkAuthAndRedirect($redirect, $ifValid=false)
  {
      // Get the user information
      $user = Auth::user();
      $redirectTo = false;

      if(empty($user->id) && ! $ifValid) // Not logged in redirect, set session.
      {
          Session::put('loginRedirect', $redirect);
          $redirectTo = Redirect::to('user/login')
              ->with( 'notice', Lang::get('user/user.login_first') );
      }
      elseif(!empty($user->id) && $ifValid) // Valid user, we want to redirect.
      {
          $redirectTo = Redirect::to($redirect);
      }

      return array($user, $redirectTo);
  }

  public function currentUser()
  {
      return (new Confide(new ConfideEloquentRepository()))->user();
  }

  /**
   * Get the e-mail address where password reminders are sent.
   *
   * @return string
   */
  public function getReminderEmail()
  {
      return $this->email;
  }

}


text:
package radl.core.documentation;

import org.jsoup.nodes.Document;
import org.junit.Assert;

public class AssertEquals implements Assertion {

  private final String message;
  private final Value expectation;
  private final Value actualization;

  public AssertEquals(String message, Value expected, Value actual) {
    this.message = message;
    this.expectation = expected;
    this.actualization = actual;
  }

  @Override
  public void verify(Document document) {
    String expected = expectation.get(document);
    String actual = actualization.get(document);
    Assert.assertEquals(message,  expected, actual);
  }

  @Override
  public String toString() {
    return message + ": " + expectation + " == " + actualization;
  }

}


text:
import axios from 'axios';

const ROOT_URL = '/search';

export const FETCH_APP = 'FETCH_APP';

export function fetchApp(data) {
  const url = `${ROOT_URL}?${data}`;
  const request = axios.get(url);

  return {
    type: FETCH_APP,
    payload: request
  };
}


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/white"
    android:overScrollMode="never"
    android:orientation="vertical"
    tools:context="net.xxtime.activity.RecruitActivity">

    <include layout="@layout/header"/>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal">

        <FrameLayout
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1">
        <TextView
            android:id="@+id/tvWelfare"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:padding="10dp"
            android:textSize="@dimen/txt_12"
            android:textColor="@color/txt_666"
            android:text="公益组织(0)"
            android:gravity="center"/>

            <View
                android:layout_width="@dimen/line"
                android:layout_height="30dp"
                android:background="@color/line_color"
                android:layout_gravity="center_vertical|right"/>

        </FrameLayout>

        <FrameLayout
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:visibility="gone"
            android:layout_weight="1">
        <TextView
            android:id="@+id/tvSchool"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:padding="10dp"
            android:textSize="@dimen/txt_12"
            android:textColor="@color/txt_666"
            android:text="实习专区(0)"
            android:gravity="center"/>
            <View
                android:layout_width="@dimen/line"
                android:layout_height="30dp"
                android:background="@color/line_color"
                android:layout_gravity="center_vertical|right"/>
        </FrameLayout>

        <TextView
            android:id="@+id/tvSocial"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:padding="10dp"
            android:textSize="@dimen/txt_12"
            android:textColor="@color/txt_666"
            android:text="社会兼职(0)"
            android:gravity="center"/>

    </LinearLayout>

    <View
        android:layout_width="match_parent"
        android:layout_height="@dimen/line"
        android:background="@color/line_color"/>

    <com.handmark.pulltorefresh.library.PullToRefreshListView
        android:id="@+id/plJobs"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:divider="@null"
        android:overScrollMode="never"
        ></com.handmark.pulltorefresh.library.PullToRefreshListView>
    <RelativeLayout
        android:id="@+id/rlEmpty"
        android:layout_width="match_parent"
        android:layout_height="350dp">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textSize="@dimen/content"
            android:textColor="@color/txt_999"
            android:text="很遗憾,没有找到查询结果"
            android:drawableTop="@mipmap/ico_empty"
            android:gravity="center"
            android:layout_centerInParent="true"/>
    </RelativeLayout>

</LinearLayout>


text:
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">

    <item
        android:id="@+id/action_account"
        android:icon="@drawable/ic_account_box_black_24dp"
        android:title="@string/action_account"
        app:showAsAction="always" />

</menu>


text:
var searchData=
[
  ['jtzeroinstruction',['JtZeroInstruction',['../classMIPS_1_1JtZeroInstruction.html#a2968f65f63844b0f2afb5cea2bbcc910',1,'MIPS::JtZeroInstruction']]],
  ['jumpinstruction',['JumpInstruction',['../classMIPS_1_1JumpInstruction.html#a5688d5a7c2ded2c3b8a32cb395cb9db9',1,'MIPS::JumpInstruction']]]
];


text:
<?php
/**
 * @author alexandre@melard.fr
 *
 */
namespace Mylen\EventFlowAnalyser\GraphViz;

use Mylen\GraphViz\Factory\ClusterFactory as f;

class ClusterFactory
{

    public static function create($format, $id, $type=null)
    {
        return f::create($format, $id);
    }
}


text:
#include "tensorflow/core/tpu/tpu_api_dlsym_initializer.h"

#include <dlfcn.h>

#include "tensorflow/core/platform/errors.h"
#include "tensorflow/core/platform/status.h"
#include "tensorflow/core/tpu/tpu_api_dlsym_set_fn.h"
#if !defined(PLATFORM_GOOGLE)
#include "tensorflow/core/tpu/tpu_api.h"
#include "tensorflow/core/tpu/tpu_node_device.h"
#include "tensorflow/core/tpu/tpu_system_device.h"
#include "tensorflow/stream_executor/tpu/tpu_executor_c_api.h"
#include "tensorflow/stream_executor/tpu/tpu_platform.h"
#endif

// Reminder: Update tpu_library_loader_windows.cc if you are adding new publicly
// visible methods.

namespace tensorflow {
namespace tpu {

#if defined(PLATFORM_GOOGLE)
Status InitializeTpuLibrary(void* library_handle) {
  return errors::Unimplemented("You must statically link in a TPU library.");
}
#else  // PLATFORM_GOOGLE
#include "tensorflow/core/tpu/tpu_library_init_fns.inc"

Status InitializeTpuLibrary(void* library_handle) {
  Status s = InitializeTpuStructFns(library_handle);

  // TPU platform registration must only be performed after the library is
  // loaded. We do not want to register a TPU platform in XLA without the
  // supporting library providing the necessary APIs.
  if (s.ok()) {
    void (*initialize_fn)(bool init_library);
    initialize_fn = reinterpret_cast<decltype(initialize_fn)>(
        dlsym(library_handle, "TfTpu_Initialize"));
    (*initialize_fn)(/*init_library=*/true);

    RegisterTpuPlatform();
    RegisterTpuSystemDevice();
    RegisterTpuNodeDevice(
        /*tpu_autoclustering=*/false,
        /*tpu_xla_device_failure_closes_chips=*/true,
        /*tpu_use_substreams_for_cross_tpu_device_transfers=*/true);
  }

  return s;
}

bool FindAndLoadTpuLibrary() {
  void* library = dlopen("libtpu.so", RTLD_NOW);
  if (library) {
    InitializeTpuLibrary(library);
  }
  return true;
}

static bool tpu_library_finder = FindAndLoadTpuLibrary();
#endif  // PLATFORM_GOOGLE

}  // namespace tpu
}  // namespace tensorflow


text:
package org.ovirt.engine.core.dao;

import java.util.List;

import org.ovirt.engine.core.common.businessentities.storage.LUNStorageServerConnectionMap;
import org.ovirt.engine.core.common.businessentities.storage.LUNStorageServerConnectionMapId;

/**
 * StorageServerConnectionLunMapDao defines a type that performs CRUD operations on instances of
 * {@link org.ovirt.engine.core.common.businessentities.storage.LUNStorageServerConnectionMap}.
 *
 *
 */
public interface StorageServerConnectionLunMapDao extends GenericDao<LUNStorageServerConnectionMap, LUNStorageServerConnectionMapId> {
    /**
     * get all maps for a given LUN id.
     *
     * @param lunId
     *            LUN id.
     * @return
     */
    List<LUNStorageServerConnectionMap> getAll(final String lunId);
}


text:
#pragma once
#ifndef CORE_WEBHITTESTRESULT_HPP
#define CORE_WEBHITTESTRESULT_HPP

#include "SharedDefines.hpp"

#include <QUrl>
#include <QRect>
#include <QString>
#include <QVariantMap>

#include <QWebEngine/ContextMenuData.hpp>
#include <QWebEngine/WebPage.hpp>

namespace Sn {

class WebPage;

class SIELO_SHAREDLIB WebHitTestResult {
public:
	WebHitTestResult(const WebPage* page, const QPoint& pos);

	void updateWithContextMenuData(const Engine::ContextMenuData& data);

	QUrl baseUrl() const;
	QString alternateText() const;
	QRect boundingRect() const;
	QUrl imageUrl() const;
	bool isContentEditable() const;
	bool isContentSelected() const;
	bool isNull() const;
	QString linkTitle() const;
	QUrl linkUrl() const;
	QUrl mediaUrl() const;
	bool mediaPaused() const;
	bool mediaMuted() const;
	QPoint pos() const;
	QPointF viewportPos() const;
	QString tagName() const;

private:
	bool m_isNull{true};
	QUrl m_baseUrl{QUrl()};
	QString m_alternateText{QString()};
	QRect m_boundingRect{QRect()};
	QUrl m_imageUrl{QUrl()};
	bool m_isContentEditable{false};
	bool m_isContentSelected{false};
	QString m_linkTitle{QString()};
	QUrl m_linkUrl{QUrl()};
	QUrl m_mediaUrl{QUrl()};
	bool m_mediaPaused{false};
	bool m_mediaMuted{false};
	QPoint m_pos{QPoint()};
	QPointF m_viewportPos{QPointF()};
	QString m_tagName{QString()};
};

}

#endif // CORE_WEBHITTESTRESULT_HPP


text:
- Remove the mistakenly-left-in single sign out config options. (If you try to set them, devise_cas_authenticatable
  will now give a warning and do nothing.)
- Remove the mistakenly-left-in single sign out handling code in the Warden strategy (fixes #160)

## Version 2.0.1 - January 3, 2022

- Rails 7 compatibility fixes (thanks @francesco-loreti!)

## Version 2.0.0 - January 3, 2022

- No changes from 2.0.0.alpha1. This version has been successfully tested by two developers in
  production apps. (If you do run into issues, please report them in this Github project!)

## Version 2.0.0.alpha1 - May 25, 2021

- Switch from RubyCAS-client, which is deprecated, to rack-cas
- Remove Devise.cas_client, Devise.cas_login_url, Devise.cas_logout_url, Devise.cas_validate_url, and cas_client_config_options as a result of this change
- Remove single sign out support (since rack-cas supports it natively)

## Version 1.10.4 - April 26, 2019

- Fixes for single sign out on Redis session store using newer Redis gems (thanks @ledestin!)

## Version 1.10.3 - July 28, 2017

- Rails 5.1 deprecation fix (thanks @jamgregory!)

## Version 1.10.2 - July 28, 2017

- Correct an issue where the single sign-out logs would incorrectly state the session was found (thanks @hugohernani!)
- Document how to change the SSO strategy (thanks again @hugohernani!)

## Version 1.10.1 - July 17, 2017

- Yet another Rails 5 compatibility fix with single sign-out (CacheStore's API for destroying sessions changed)

## Version 1.10.0 - February 6, 2017

- Support Redis as a single sign-out store (thanks @tubsandcans!)
- More Rails 5 compatibility fixes (thanks @debborafernandess and @drobny!)

## Version 1.9.2 - July 6, 2016

- Fix middleware syntax for Rails 5 compatibility (thanks @drobny!)

## Version 1.9.1 - May 11, 2016

- Remove Gemfile symlink from built gem; hopefully this will make installation easier on Windows

## Version 1.9.0 - May 10, 2016

- No longer requires net/telnet in order to work properly, so Ruby 2.3 can work out-of-the-box

## Version 1.8.0 - May 4, 2016

- May the 4th be with you!
- Prevent redirect loops when using memcached as a session store (thanks @fabioperrella!)

## Version 1.7.1 - February 2, 2016

- Work around weird `#try` behavior on older Rails versions

## Version 1.7.0 - December 18, 2015

- Support RedisSessionStore (thanks @dandyn!)
- Suppress warnings about `Devise.secret_key` not being set in production mode (thanks @joraff!)

## Version 1.6.1 - December 18, 2015

- Allow single sign-out code to find the app's session store when NewRelic is in the middleware stack (thanks @brendancarney!)

## Version 1.6.0 - October 21, 2015

- Add support for the Dalli session store (thanks @bonyiii!)

## Version 1.5.0 - July 27, 2015

- Generation of cas_action_url is now done by a customizable class, so you can use Rails routes to provide this (thanks to @eturino again!)

## Version 1.4.1 - July 23, 2015

- Internal refactor to avoid conflicting with common route names, specifically logout_url (thanks to @eturino!)

## Version 1.4.0 - May 8, 2015

- Allow changing the CAS response field used as the unique key for finding users (thanks once again to @gmoore!)

## Version 1.3.8 - April 24, 2015

- Remove a deprecated dependency (thanks to @gmoore)
- Fix a wrong variable name that could break debug logging (thanks again to @gmoore)

## Version 1.3.7 - July 17, 2014

- Be less verbose in the log during single sign-out (thanks to @liudangyi)

## Version 1.0.1 - July 6, 2014

- Backport the 1.1.x series' logout_url features to the 1.0.x series for super-old apps

## Version 1.3.6 - February 5, 2014

- Better single sign-out support for ActiveRecord session store users and README fixes (thanks to @fernandomantoan)

## Version 1.3.5 - January 30, 2014

- Don't redirect to the (probably useless) Devise login page when the user is unauthorized - this is the CAS server's responsibility. (thanks to @kylejginavan)

## Version 1.3.4 - January 10, 2014

- Redirect to CAS logout URL when Warden receives the :inactive status, which should allow using active_for_authentication? (thanks to @bentoncreation)

## Version 1.3.3 - December 13, 2013

- Bug fix for single sign out when using Rack >= 1.5 (thanks to @activars)

## Version 1.3.2 - August 16, 2013

- Rails 4 deprecation warning fix (thanks to @reidmix)

## Version 1.3.1 - July 29, 2013

- Rails 4 compatibility fix (thanks to @McRipper)

## Version 1.3.0 - May 12, 2013

- Drop support for Rails 2.3, Devise 1.0 and 1.1
- Custom failure class for optional redirecting to logout url upon timeout (thanks to @geoffroh and @kylejginavan)

## Version 1.2.1 - April 16, 2013

- Bug fix: use Devise.sign_out_via to configure the HTTP verb sign_out will accept.

## Version 1.2.0 - March 6, 2013

- Rewrite of the single sign-out module to improve compatibility with newer Devise versions, other ORMs, and be less complex overall (thanks [Jeremy Haile](https://github.com/jeremyhaile) and [Endel Dreyer](https://github.com/endel)!)

## Version 1.1.4 - January 23, 2013

- Bug fix: don't modify request.protocol when generating a logout_url (thanks [Tse-Ching Ho](https://github.com/tsechingho)!)

## Version 1.1.3 - January 15, 2013

- Rails 4 compatibility fixes (thanks [Aaron Patterson](https://github.com/tenderlove)!)
- Support the service_url parameter in rubycas-client on logout (thanks [Kyle Ginavan](https://github.com/kylejginavan)!)

## Version 1.1.2 - May 23, 2012

- Only do schema stuff if using Devise 2.0.x or below

## Version 1.1.1 - April 2, 2012

- Add cas_client_config_options so that users can add unsupported RubyCAS options such as encode_extra_attributes_as

## Version 1.1.0 - March 5, 2012

- Add configurable destination and follow URL support (thanks [Dyson Simmons](https://github.com/dyson)!)
- Allow applications deployed at sub-URIs to work (thanks [Tod Detre](https://github.com/tod)!)
- Only add trailing slash to base URI if it's not already present (thanks [joe81](https://github.com/joe81)!)
- Some documentation updates.


text:
#ifndef UserMediaController_h
#define UserMediaController_h

#include "core/frame/LocalFrame.h"
#include "modules/mediastream/UserMediaClient.h"
#include "wtf/PassOwnPtr.h"

namespace blink {

class MediaDevicesRequest;
class UserMediaRequest;

class UserMediaController final : public GarbageCollected<UserMediaController>, public Supplement<LocalFrame> {
    USING_GARBAGE_COLLECTED_MIXIN(UserMediaController);
public:
    static UserMediaController* create(UserMediaClient*);

    DECLARE_VIRTUAL_TRACE();

    UserMediaClient* client() const { return m_client; }

    void requestUserMedia(UserMediaRequest*);
    void cancelUserMediaRequest(UserMediaRequest*);

    void requestMediaDevices(MediaDevicesRequest*);
    void cancelMediaDevicesRequest(MediaDevicesRequest*);

    void requestSources(MediaStreamTrackSourcesRequest*);

    static const char* supplementName();
    static UserMediaController* from(LocalFrame* frame) { return static_cast<UserMediaController*>(Supplement<LocalFrame>::from(frame, supplementName())); }

private:
    explicit UserMediaController(UserMediaClient*);

    UserMediaClient* m_client;
};

inline void UserMediaController::requestUserMedia(UserMediaRequest* request)
{
    m_client->requestUserMedia(request);
}

inline void UserMediaController::cancelUserMediaRequest(UserMediaRequest* request)
{
    m_client->cancelUserMediaRequest(request);
}

inline void UserMediaController::requestMediaDevices(MediaDevicesRequest* request)
{
    m_client->requestMediaDevices(request);
}

inline void UserMediaController::cancelMediaDevicesRequest(MediaDevicesRequest* request)
{
    m_client->cancelMediaDevicesRequest(request);
}

inline void UserMediaController::requestSources(MediaStreamTrackSourcesRequest* request)
{
    m_client->requestSources(request);
}

} // namespace blink

#endif // UserMediaController_h


text:
package be.iminds.iot.things.dyamand.adapter;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Dictionary;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.List;
import java.util.Map;
import java.util.UUID;

import org.dyamand.event.Event;
import org.dyamand.event.EventListener;
import org.dyamand.event.ServicePOJOOfflineEvent;
import org.dyamand.event.ServicePOJOOnlineEvent;
import org.dyamand.event.StateChangedEvent;
import org.dyamand.service.ServicePOJO;
import org.osgi.framework.BundleContext;
import org.osgi.framework.Constants;
import org.osgi.framework.ServiceRegistration;
import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Deactivate;
import org.osgi.service.component.annotations.Reference;
import org.osgi.service.component.annotations.ReferenceCardinality;
import org.osgi.service.component.annotations.ReferencePolicy;
import org.osgi.service.event.EventAdmin;
import org.osgi.service.event.EventProperties;

import osgi.enroute.dto.api.DTOs;
import be.iminds.iot.things.api.Thing;
import be.iminds.iot.things.api.event.ChangeEvent;
import be.iminds.iot.things.api.event.OfflineEvent;
import be.iminds.iot.things.api.event.OnlineEvent;

/**
 *
 */
@Component(name = "be.iminds.iot.things.dyamand", immediate=true)
public class DyamandAdapter implements EventListener {

	// Hack to have bridge to Dyamand plugin system...
	static Object sync = new Object();
	static DyamandAdapter instance = null;

	private BundleContext context;
	private UUID gatewayId;
	private DTOs dtos;
	private EventAdmin ea;

    private final Map<Object, ServiceRegistration> services = new HashMap<>();
	private final List<ServiceAdapter> adapters = Collections.synchronizedList(new ArrayList<>());

	@Activate
	public void activate(BundleContext ctx){
		synchronized(sync){
			instance = this;
			sync.notifyAll();
		}
		context = ctx;
		gatewayId = UUID.fromString(context.getProperty(Constants.FRAMEWORK_UUID)); // get frameworkId
	}

	@Deactivate
	public void deactivate(){
		instance = null;
	}

    @Override
	public void onEvent(final Event event) {
		if (event instanceof ServicePOJOOnlineEvent) {
			final ServicePOJO servicePOJO = ((ServicePOJOOnlineEvent) event)
					.getServicePOJO();
			this.servicePojoOnline(servicePOJO);
		} else if (event instanceof ServicePOJOOfflineEvent) {
			final ServicePOJO servicePOJO = ((ServicePOJOOfflineEvent) event)
					.getServicePOJO();
			this.servicePojoOffline(servicePOJO);
		} else if (event instanceof StateChangedEvent) {
			final org.dyamand.service.StateChange stateChange = ((StateChangedEvent) event)
					.getStateChange();
			this.processStateChange(stateChange);
		}
	}

    private void servicePojoOnline(final ServicePOJO servicePOJO) {
    	if(this.services.get(servicePOJO)!=null){
    		System.err.println("ServicePOJO "+servicePOJO+" already online?!");
    		return;
    	}

    	// translate sensor to IoT types
    	synchronized(adapters){
			for(ServiceAdapter adapter : adapters){
				try {
				    // ADAPT!
				    final Object so = adapter.getServiceObject(servicePOJO);

					final String device = servicePOJO.getService().getOriginalDevice().getName().toString();
					final String service = servicePOJO.getService().getName().toString();
					final UUID thingId = UUID.nameUUIDFromBytes((device+service).getBytes());

					final Dictionary<String, Object> properties = new Hashtable<String, Object>();
					properties.put(Thing.ID, thingId.toString());
					properties.put(Thing.DEVICE, device);
					properties.put(Thing.SERVICE, service);
					properties.put(Thing.GATEWAY, gatewayId.toString());
					properties.put(Thing.TYPE, adapter.getType());

				    // Add some AIOLOS stuff
				    properties.put("aiolos.instance.id", thingId.toString());
				    properties.put("aiolos.combine", "*");

				    final ServiceRegistration registration = this.context
					    .registerService(adapter.getTargets(), so,
						    properties);
				    this.services.put(servicePOJO, registration);

				    this.notifyOnline(thingId, device, service, adapter.getType());
				} catch (final Exception e) {
				}
			}
    	}
    }

	private void servicePojoOffline(final ServicePOJO servicePOJO) {
		final ServiceRegistration registration = this.services
				.remove(servicePOJO);
		if (registration != null) {
			final String device = servicePOJO.getService().getOriginalDevice().getName().toString();
			final String service = servicePOJO.getService().getName().toString();

			final UUID thingId = UUID.nameUUIDFromBytes((device+service).getBytes());
		    this.notifyOffline(thingId);

			registration.unregister();
		}
	}

	private void processStateChange(
			final org.dyamand.service.StateChange stateChange) {

		final String device = stateChange.getService().getOriginalDevice().getName().toString();
		final String service = stateChange.getService().getName().toString();
		final UUID thingId = UUID.nameUUIDFromBytes((device+service).getBytes());

		final String stateVariable = stateChange.getStateVariable().toString();
		final Object value = stateChange.getValue();

		synchronized(adapters){
			for (final ServiceAdapter adapter : this.adapters) {
				try {
					final StateVariable translated = adapter
							.translateStateVariable(stateVariable, value);
					this.notifiyStateChange(thingId, translated.getName(), translated.getValue());

				} catch (final Exception e) {
				}
			}
		}
	}

	private void notifyOnline(
			final UUID thingId,
			final String device,
			final String service,
			final String type){
		try {
			OnlineEvent e = new OnlineEvent();
			e.thingId = thingId;
			e.gatewayId = gatewayId;
			e.service = service;
			e.device = device;
			e.type = type;
			e.timestamp = System.currentTimeMillis();

			final String topic = "be/iminds/iot/thing/online/"+thingId;
			ea.sendEvent(new org.osgi.service.event.Event(topic, dtos.asMap(e)));
		} catch(Exception e){
			System.err.println("Error sending online event "+e);
		}
	}

	private void notifyOffline(
			final UUID thingId){
		try {
			OfflineEvent e = new OfflineEvent();
			e.thingId = thingId;
			e.gatewayId = gatewayId;
			e.timestamp = System.currentTimeMillis();

		    final String topic = "be/iminds/iot/thing/offline/"+thingId;
			ea.sendEvent(new org.osgi.service.event.Event(topic, dtos.asMap(e)));
		} catch(Exception e){
			System.err.println("Error sending offline event "+e);
		}
	}

	private void notifiyStateChange(
			final UUID thingId,
			final String stateVariable,
			final Object stateValue){
		try {
			ChangeEvent e = new ChangeEvent();
			e.thingId = thingId;
			e.gatewayId = gatewayId;
			e.stateVariable = stateVariable;
			e.stateValue = stateValue;
			e.timestamp = System.currentTimeMillis();

			final String topic = "be/iminds/iot/thing/change/"+thingId;
			ea.postEvent(new org.osgi.service.event.Event(topic, dtos.asMap(e)));
		} catch(Exception e){
			System.err.println("Error sending change event "+e);
		}
	}

	@Reference
	void setDTOs(DTOs dtos){
		this.dtos = dtos;
	}

	@Reference
	void setEventAdmin(EventAdmin ea){
		this.ea = ea;
	}

	@Reference(cardinality=ReferenceCardinality.MULTIPLE,
			policy=ReferencePolicy.DYNAMIC)
	public void addServiceAdapter(ServiceAdapter sa){
		adapters.add(sa);
	}

	public void removeServiceAdapter(ServiceAdapter sa){
		adapters.remove(sa);
	}
}


text:
package com.dubaidrums.jems.domain;

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.Version;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import flexjson.JSONDeserializer;
import flexjson.JSONSerializer;

@Entity
public class JemsUser {

	@NotNull
	@Size(min = 3, max = 500)
	private String userName;

	@Size(min = 3, max = 500)
	private String password;

	@NotNull
	private Boolean enabled;

	@NotNull
	@Size(min = 3, max = 500)
	private String email;

	@NotNull
	@Size(min = 3, max = 500)
	private String mobile;

	@NotNull
	@Size(min = 3, max = 500)
	private String fullName;

	@ManyToMany
	private Set<JemsRole> roles = new HashSet<JemsRole>();

	@ManyToMany
	private Set<JemsOrganization> organizations = new HashSet<JemsOrganization>();

	public String toJson() {
		return new JSONSerializer().exclude("*.class").serialize(this);
	}

	public static JemsUser fromJsonToJemsUser(String json) {
		return new JSONDeserializer<JemsUser>().use(null, JemsUser.class)
				.deserialize(json);
	}

	public static String toJsonArray(Collection<JemsUser> collection) {
		return new JSONSerializer().exclude("*.class").serialize(collection);
	}

	public static Collection<JemsUser> fromJsonArrayToJemsUsers(String json) {
		return new JSONDeserializer<List<JemsUser>>()
				.use(null, ArrayList.class).use("values", JemsUser.class)
				.deserialize(json);
	}

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(name = "id")
	private Long id;

	@Version
	@Column(name = "version")
	private Integer version;

	public Long getId() {
		return this.id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Integer getVersion() {
		return this.version;
	}

	public void setVersion(Integer version) {
		this.version = version;
	}

	public String getUserName() {
		return this.userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getPassword() {
		return this.password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public Boolean getEnabled() {
		return this.enabled;
	}

	public void setEnabled(Boolean enabled) {
		this.enabled = enabled;
	}

	public String getEmail() {
		return this.email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getMobile() {
		return this.mobile;
	}

	public void setMobile(String mobile) {
		this.mobile = mobile;
	}

	public String getFullName() {
		return this.fullName;
	}

	public void setFullName(String fullName) {
		this.fullName = fullName;
	}

	public Set<JemsRole> getRoles() {
		return this.roles;
	}

	public void setRoles(Set<JemsRole> roles) {
		this.roles = roles;
	}

	public Set<JemsOrganization> getOrganizations() {
		Set<JemsOrganization> orgs = new HashSet<JemsOrganization>();
		for (JemsOrganization jo : organizations) {
			if (jo.getActive()) {
				orgs.add(jo);
			}
		}
		return orgs;
		// return this.organizations;
	}

	public void setOrganizations(Set<JemsOrganization> organizations) {
		this.organizations = organizations;
	}

	public String toString() {
		return ReflectionToStringBuilder.toString(this,
				ToStringStyle.SHORT_PREFIX_STYLE);
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		result = prime * result
				+ ((userName == null) ? 0 : userName.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		JemsUser other = (JemsUser) obj;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		if (userName == null) {
			if (other.userName != null)
				return false;
		} else if (!userName.equals(other.userName))
			return false;
		return true;
	}

}


text:
  <form name="myForm" class="flow">
    <md-content class="md-padding" layout="column" layout-gt-sm='column'>

          <md-card>
            <md-card-title>
              <md-card-title-text>
                Creating your account.
                Thanks for signing-up! Let's finalise a few things.
                Secure your account before you can go forth.
              </md-card-title-text>
            </md-card-title>
            <md-card-content>

                <md-progress-linear md-mode="query" ng-show='!data.cb4'></md-progress-linear>

We're busy creating your account...

                <md-checkbox ng-model="data.cb1" aria-label="Checkbox 1" ng-disabled='true'>
                  Creating location
                </md-checkbox>
                <md-checkbox ng-model="data.cb2" aria-label="Checkbox 2" ng-disabled='true'>
                  Updating user profile
                </md-checkbox>
                <md-checkbox ng-model="data.cb3" aria-label="Checkbox 3" ng-disabled='true'>
                  Validating settings
                </md-checkbox>
                <md-checkbox ng-model="data.cb4" aria-label="Checkbox 4" ng-disabled='true'>
                  Authorising new user
                </md-checkbox>

All done, sending you on your way!

                <md-input-container layout="row" flex class="md-block">

                    <translate>Username</translate>

                  <input autofocus type="text" placeholder="Your Name" name="username" ng-minlength="5" ng-model="holding.username" md-minlength=8 required>
                  <md-icon>face</md-icon>

A username is required.

Username should be less than 25 characters.

Username should be at least 8 characters.

                </md-input-container>
                <md-input-container layout="row" flex class="md-block">

                    <translate>Password</translate>

                  <input autofocus type="password" placeholder="Top secret password" name="password" ng-minlength="5" ng-model="holding.password" md-minlength=8 required temp-ng-pattern="/^(?=.*[A-Za-z])(?=.*\d)(?=.*[$@$!%*#?&])[A-Za-z\d$@$!%*#?&]{8,}$/">
                  <md-icon>lock</md-icon>

A password is required.

Password should be less than 25 characters.

Password should be at least 8 characters.

Must include one upper case letter, a special character and number.

                </md-input-container>
                <md-input-container layout="row" flex class="md-block">

                    <translate>Optional phone number</translate>

                  <input type="number" placeholder="In case you lose your details" name="phone" ng-minlength="5" ng-model="holding.phone" md-minlength=8>
                  <md-icon>phone</md-icon>
                </md-input-container>
                To finish your account creation, please confirm that you agree to our terms of service.
                <md-input-container layout="row" flex class="md-block">
                  <md-checkbox ng-model="holding.gdpr_consent" aria-label="gdpr" required>
                    I confirm that I have read and agree to the terms of service.
                  </md-checkbox>
                </md-input-container>
                We'd also like to occasionally send you newsletters about products & services, news & events.
                <md-input-container layout="row" flex class="md-block">
                  <md-checkbox ng-model="holding.newsletter_consent" aria-label="newsletter">
                    I'd like to receive newsletters via Email.
                  </md-checkbox>
                </md-input-container>

            </md-card-content>
            <md-divider ng-show="!finalised"></md-divider>
            <md-card-actions ng-show="!finalised" layout="row" layout-align="end center">
              <md-button ng-click="update('done')" type="submit" ng-disabled="myForm.$invalid" class="signup-complete md-raised md-primary complete-18020714">
                <translate>Create</translate>
              </md-button>
            </md-card-actions>
          </md-card>

    </md-content>
  </form>


text:
wwt.app.factory('SearchData', [
	'$http', '$q', '$timeout', 'Places','Util', function($http, $q, $timeout, places, util) {
		var api = {
			getData: getData,
			getIndex: getIndex,
			importWtml:importWtml
		};
		var data,
			searchIndex = {},
			initPromise,
		    constellations = [];

		function getData() {
			var deferred = $q.defer();
			initPromise.then(function () {
				deferred.resolve(data);
			});
			return deferred.promise;
		};
		function getIndex() {
			var deferred = $q.defer();
			initPromise.then(function () {
				deferred.resolve(searchIndex);
			});
			return deferred.promise;
		};

		var deferredInit = $q.defer();
		var isId = 100;
	var init = function () {
		if (wwt.searchData) {
			wwt.searchDataIndexed = [];
			data = wwt.searchData;
			var start = new Date();

			$.each(data.Constellations, function (i, item) {
				/*if (item.name === 'SolarSystem') {
					item.places = ssData;
					return;
				}*/
				constellations[i] = item.name;
				$.each(item.places, function(j, place) {
					var fgi = place.fgi,
						imgSet;
					if (fgi) {
						isId++;

						imgSet = wwtlib.Imageset.create(
							fgi.n,//name
							fgi.u,//url
							fgi.dt || 2,//datasettype -default to sky
							fgi.bp,//bandPass
							fgi.pr,//projection
							isId,//imagesetid
							fgi.bl,//baseLevel
							fgi.lv,//levels
							null,//tilesize
							fgi.bd,//baseTileDegrees
							'',//extension
							fgi.bu,//bottomsUp
							fgi.q,//quadTreeTileMap,
							fgi.cX,//centerX
							fgi.cY,//centerY
							fgi.r,//rotation
							true,//sparse
							fgi.tu,//thumbnailUrl,
							fgi.ds,//defaultSet,
							false,//elevationModel
							fgi.wf,//widthFactor,
							fgi.oX,//offsetX
							fgi.oY,//offsetY
							fgi.ct,//creditsText
							fgi.cu,//creditsUrl
							'', '',
							0,//meanRadius
							null);
					}
					var pl = wwtlib.Place.create(
						place.n,//name
						place.d,//dec
						place.r,//ra
						place.c,//classification
						item.name,//constellation
						fgi ? fgi.dt : 2,//type
						place.z//zoomfactor
						);
					if (imgSet) {
						pl.set_studyImageset(imgSet);
					}

					if (item.name === 'SolarSystem') {
						$.each(pl, function(k, member) {
							if (ss.canCast(member, wwtlib.CameraParameters)) {
								member.target = wwtlib.SolarSystemObjects.undefined;
							}
						});
					}

					pl.guid = i + "." + j;
					//re-place js data with place obj
					item.places[j] = pl;

					indexPlaceNames(pl);

				});
			});
			var end = new Date();
			util.log('parsed places in ' + (end.valueOf() - start.valueOf()) + 'ms', data);
		    importWtml('Wise.wtml').then(function() {
		        deferredInit.resolve(data);
		    });

		} else {
			setTimeout(init, 333);
		}
		return deferredInit.promise;
	};

	var indexPlaceNames = function(pl) {
		var addPlace = function(s, place) {
			var firstChar = s.charAt(0).toLowerCase();
			if (firstChar === "'") firstChar = s.charAt(1).toLowerCase();
			if (searchIndex[firstChar]) {
				if (searchIndex[firstChar][searchIndex[firstChar].length - 1] !== place) {
					searchIndex[firstChar].push(place);
					wwt.searchDataIndexed = searchIndex;
				}
			} else {
				wwt.searchDataIndexed[firstChar] = searchIndex[firstChar] = [place];
			}
		}

		$.each(pl.get_names(), function (n, name) {
			if (name.indexOf(' ') !== -1) {
				var words = name.split(' ');
				$.each(words, function(w, word) {
					addPlace(word, pl);
				});
			}
			else if (name.charAt(0)) {
				addPlace(name, pl);
			}
		});
	}

	function importWtml(wtmlPath) {
	    var deferred = $q.defer();

		$.ajax({
			url: wtmlPath
		}).done(function() {
			var wtml = $($.parseXML(arguments[0]));
			wtml.find('Place').each(function(i, place) {
				place = $(place);
				var constellation, ra = parseFloat(place.attr('RA')), dec = parseFloat(place.attr('Dec'));
				if (ra !== 0 || dec !== 0) {
					constellation = wwtlib.Constellations.containment.findConstellationForPoint(ra, dec);

					var fgi = place.find('ImageSet').length ? place.find('ImageSet') : null;
					var wwtPlace = wwtlib.Place.create(
						place.attr('Name'),
						dec,
						ra,
						place.attr('DataSetType'),
						constellation,
						fgi ? util.getImageSetType(fgi.attr('DataSetType')) : 2, //type
						parseFloat(place.find('ZoomLevel')) //zoomfactor
					);
					if (fgi != null) {
						isId++;
						wwtPlace.set_studyImageset(wwtlib.Imageset.create(
								fgi.attr('Name'),
								fgi.attr('Url'),
								util.getImageSetType(fgi.attr('DataSetType')),
								fgi.attr('BandPass'),
								wwtlib.ProjectionType[fgi.attr('Projection').toLowerCase()],
								isId, //imagesetid
								parseInt(fgi.attr('BaseTileLevel')),
								parseInt(fgi.attr('TileLevels')),
								null, //tilesize
								parseFloat(fgi.attr('BaseDegreesPerTile')),
								fgi.attr('FileType'),
								fgi.attr('BottomsUp') === 'True',
								'', //quadTreeTileMap (I need to find a wtml file that has this and check spelling of the attr)
								parseFloat(fgi.attr('CenterX')),
								parseFloat(fgi.attr('CenterY')),
								parseFloat(fgi.attr('Rotation')),
								true, //sparse
								fgi.find('ThumbnailUrl').text(), //thumbnailUrl,
								false, //defaultSet,
								false, //elevationModel
								parseFloat(fgi.attr('WidthFactor')), //widthFactor,
								parseFloat(fgi.attr('OffsetX')),
								parseFloat(fgi.attr('OffsetY')),
								fgi.find('Credits').text(),
								fgi.find('CreditsUrl').text(),
								'', '',
								0, //meanRadius
								null)
						);
					}

					indexPlaceNames(wwtPlace);
					var cIndex = constellations.indexOf(constellation);
					var constellationPlaces = wwt.searchData.Constellations[cIndex].places;
					wwtPlace.guid = cIndex + '.' +
						constellationPlaces.length;
					constellationPlaces.push(wwtPlace);
				}

			});
			deferred.resolve(true);
		});

	    return deferred.promise;
	}

	initPromise = init();
	//importWtml('Wise.wtml');
	return api;
}]);


text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<groupId>com.stellarcodes.websockets</groupId>
	<artifactId>SpringWebSocket</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<packaging>war</packaging>

	<properties>
		<spring.version>4.1.5.RELEASE</spring.version>
		<fasterxml.version>2.5.0</fasterxml.version>
	</properties>
	<dependencies>

		<!-- Spring web mvc -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-webmvc</artifactId>
			<version>${spring.version}</version>
		</dependency>

		<!-- Spring websockets -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-websocket</artifactId>
			<version>${spring.version}</version>
		</dependency>

		<!-- Spring messaging -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-messaging</artifactId>
			<version>${spring.version}</version>
		</dependency>

		<!-- xml json mapper -->
		<dependency>
			<groupId>com.fasterxml.jackson.core</groupId>
			<artifactId>jackson-core</artifactId>
			<version>${fasterxml.version}</version>
		</dependency>
		<dependency>
			<groupId>com.fasterxml.jackson.core</groupId>
			<artifactId>jackson-databind</artifactId>
			<version>${fasterxml.version}</version>
		</dependency>

	</dependencies>
</project>


text:
var loggers = require("@bit/bundler/loggers");
var verboseLogger = require("@bit/bundler/loggers/verbose");
var loaderFilter = require("@bit/bundler/loggers/loaderFilter");

module.exports = {
  log: loggers.sequence(loaderFilter(), verboseLogger()),
  src: "src/main.js",
  dest: "dist/main.js",

  loader: [
    "@bit/loader-babel"
  ]
};


text:
#pragma once

#include <platform/ConnectivityManager.h>
#include <platform/internal/GenericConnectivityManagerImpl.h>
#include <platform/internal/GenericConnectivityManagerImpl_UDP.h>
#if INET_CONFIG_ENABLE_TCP_ENDPOINT
#include <platform/internal/GenericConnectivityManagerImpl_TCP.h>
#endif
#include <platform/internal/GenericConnectivityManagerImpl_WiFi.h>
#if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE
#include <platform/internal/GenericConnectivityManagerImpl_BLE.h>
#else
#include <platform/internal/GenericConnectivityManagerImpl_NoBLE.h>
#endif
#include <platform/internal/GenericConnectivityManagerImpl_NoThread.h>

#include <cy_wcm.h>
#include <lib/support/BitFlags.h>

namespace Inet {
class IPAddress;
} // namespace Inet

namespace chip {
namespace DeviceLayer {

class PlatformManagerImpl;

/**
 * Concrete implementation of the ConnectivityManager singleton object for the PSoC6 platform.
 */
class ConnectivityManagerImpl final : public ConnectivityManager,
                                      public Internal::GenericConnectivityManagerImpl<ConnectivityManagerImpl>,
                                      public Internal::GenericConnectivityManagerImpl_UDP<ConnectivityManagerImpl>,
#if INET_CONFIG_ENABLE_TCP_ENDPOINT
                                      public Internal::GenericConnectivityManagerImpl_TCP<ConnectivityManagerImpl>,
#endif
                                      public Internal::GenericConnectivityManagerImpl_WiFi<ConnectivityManagerImpl>,
#if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE
                                      public Internal::GenericConnectivityManagerImpl_BLE<ConnectivityManagerImpl>,
#else
                                      public Internal::GenericConnectivityManagerImpl_NoBLE<ConnectivityManagerImpl>,
#endif
                                      public Internal::GenericConnectivityManagerImpl_NoThread<ConnectivityManagerImpl>
{

    // Allow the ConnectivityManager interface class to delegate method calls to
    // the implementation methods provided by this class.
    friend class ConnectivityManager;

public:
    CHIP_ERROR ping_thread(void);

private:
    using Flags = GenericConnectivityManagerImpl_WiFi::ConnectivityFlags;
    // ===== Members that implement the ConnectivityManager abstract interface.

    WiFiStationMode _GetWiFiStationMode(void);
    CHIP_ERROR _SetWiFiStationMode(WiFiStationMode val);
    bool _IsWiFiStationEnabled(void);
    bool _IsWiFiStationApplicationControlled(void);
    bool _IsWiFiStationConnected(void);
    System::Clock::Timeout _GetWiFiStationReconnectInterval(void);
    CHIP_ERROR _SetWiFiStationReconnectInterval(System::Clock::Timeout val);
    bool _IsWiFiStationProvisioned(void);
    void _ClearWiFiStationProvision(void);
    CHIP_ERROR _GetAndLogWiFiStatsCounters(void);
    void ChangeWiFiStationState(WiFiStationState newState);
    WiFiAPMode _GetWiFiAPMode(void);
    CHIP_ERROR _SetWiFiAPMode(WiFiAPMode val);
    bool _IsWiFiAPActive(void);
    bool _IsWiFiAPApplicationControlled(void);
    void _DemandStartWiFiAP(void);
    void _StopOnDemandWiFiAP(void);
    void _MaintainOnDemandWiFiAP(void);
    System::Clock::Timeout _GetWiFiAPIdleTimeout(void);
    void _SetWiFiAPIdleTimeout(System::Clock::Timeout val);

    // Service connectivity methods

    CHIP_ERROR _Init(void);
    void _OnPlatformEvent(const ChipDeviceEvent * event);
    bool _CanStartWiFiScan();
    void _OnWiFiScanDone();
    void _OnWiFiStationProvisionChange();

    // ===== Members for internal use by the following friends.

    friend ConnectivityManager & ConnectivityMgr(void);
    friend ConnectivityManagerImpl & ConnectivityMgrImpl(void);

    static ConnectivityManagerImpl sInstance;

    // ===== Private members reserved for use by this class only.
    System::Clock::Timestamp mLastStationConnectFailTime;
    System::Clock::Timestamp mLastAPDemandTime;
    WiFiStationMode mWiFiStationMode;
    WiFiStationState mWiFiStationState;
    WiFiAPMode mWiFiAPMode;
    WiFiAPState mWiFiAPState;
    System::Clock::Timeout mWiFiStationReconnectInterval;
    System::Clock::Timeout mWiFiAPIdleTimeout;
    BitFlags<Flags> mFlags;
    bool eventcallback;

    static void DriveStationState(::chip::System::Layer * aLayer, void * aAppState);
    static void DriveAPState(::chip::System::Layer * aLayer, void * aAppState);
    void DriveStationState(void);
    void DriveAPState(void);
    CHIP_ERROR ConfigureWiFiAP(void);
    void ChangeWiFiAPState(WiFiAPState newState);
    void UpdateInternetConnectivityState(void);
    static void wlan_event_cb(cy_wcm_event_t event, cy_wcm_event_data_t * event_data);
    CHIP_ERROR WiFi_init(void);
    CHIP_ERROR OnIPAddressAvailable(void);
};

inline bool ConnectivityManagerImpl::_IsWiFiStationApplicationControlled(void)
{
    return mWiFiStationMode == kWiFiStationMode_ApplicationControlled;
}

inline bool ConnectivityManagerImpl::_IsWiFiStationConnected(void)
{
    return mWiFiStationState == kWiFiStationState_Connected;
}

inline bool ConnectivityManagerImpl::_IsWiFiAPApplicationControlled(void)
{
    return mWiFiAPMode == kWiFiAPMode_ApplicationControlled;
}

inline System::Clock::Timeout ConnectivityManagerImpl::_GetWiFiStationReconnectInterval(void)
{
    return mWiFiStationReconnectInterval;
}

inline ConnectivityManager::WiFiAPMode ConnectivityManagerImpl::_GetWiFiAPMode(void)
{
    return mWiFiAPMode;
}

inline bool ConnectivityManagerImpl::_IsWiFiAPActive(void)
{
    return mWiFiAPState == kWiFiAPState_Active;
}

inline System::Clock::Timeout ConnectivityManagerImpl::_GetWiFiAPIdleTimeout(void)
{
    return mWiFiAPIdleTimeout;
}

inline bool ConnectivityManagerImpl::_CanStartWiFiScan()
{
    return mWiFiStationState != kWiFiStationState_Connecting;
}

/**
 * Returns the public interface of the ConnectivityManager singleton object.
 *
 * Chip applications should use this to access features of the ConnectivityManager object
 * that are common to all platforms.
 */
inline ConnectivityManager & ConnectivityMgr(void)
{
    return ConnectivityManagerImpl::sInstance;
}

/**
 * Returns the platform-specific implementation of the ConnectivityManager singleton object.
 *
 * Chip applications can use this to gain access to features of the ConnectivityManager
 * that are specific to the PSoC6 platform.
 */
inline ConnectivityManagerImpl & ConnectivityMgrImpl(void)
{
    return ConnectivityManagerImpl::sInstance;
}

} // namespace DeviceLayer
} // namespace chip


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Mycosystema 1: 222 (1988)

#### Original name
Ustilago ixiolirii L. Guo

### Remarks
null


text:
package org.citygml4j.xml.adapter.deprecated.tunnel;

import org.citygml4j.core.model.ade.generic.GenericADEOfTunnelPart;
import org.citygml4j.core.model.tunnel.ADEOfTunnelPart;
import org.citygml4j.core.model.tunnel.TunnelPart;
import org.citygml4j.core.util.CityGMLConstants;
import org.citygml4j.xml.adapter.CityGMLBuilderHelper;
import org.citygml4j.xml.adapter.CityGMLSerializerHelper;
import org.citygml4j.xml.adapter.ade.ADEBuilderHelper;
import org.citygml4j.xml.adapter.ade.ADESerializerHelper;
import org.xmlobjects.annotation.XMLElement;
import org.xmlobjects.builder.ObjectBuildException;
import org.xmlobjects.serializer.ObjectSerializeException;
import org.xmlobjects.stream.XMLReadException;
import org.xmlobjects.stream.XMLReader;
import org.xmlobjects.stream.XMLWriteException;
import org.xmlobjects.stream.XMLWriter;
import org.xmlobjects.xml.Attributes;
import org.xmlobjects.xml.Element;
import org.xmlobjects.xml.Namespaces;

import javax.xml.namespace.QName;

@XMLElement(name = "TunnelPart", namespaceURI = CityGMLConstants.CITYGML_2_0_TUNNEL_NAMESPACE)
public class TunnelPartAdapter extends AbstractTunnelAdapter<TunnelPart> {
    private final QName substitutionGroup = new QName(CityGMLConstants.CITYGML_2_0_TUNNEL_NAMESPACE, "_GenericApplicationPropertyOfTunnelPart");

    @Override
    public TunnelPart createObject(QName name, Object parent) throws ObjectBuildException {
        return new TunnelPart();
    }

    @Override
    public void buildChildObject(TunnelPart object, QName name, Attributes attributes, XMLReader reader) throws ObjectBuildException, XMLReadException {
        if (CityGMLBuilderHelper.isADENamespace(name.getNamespaceURI()))
            buildADEProperty(object, name, reader);
        else
            super.buildChildObject(object, name, attributes, reader);
    }

    @Override
    public void buildADEProperty(TunnelPart object, QName name, XMLReader reader) throws ObjectBuildException, XMLReadException {
        if (!ADEBuilderHelper.addADEProperty(object, name, GenericADEOfTunnelPart::of, reader, substitutionGroup))
            super.buildADEProperty(object, name, reader);
    }

    @Override
    public Element createElement(TunnelPart object, Namespaces namespaces) throws ObjectSerializeException {
        return Element.of(CityGMLSerializerHelper.getTunnelNamespace(namespaces), "TunnelPart");
    }

    @Override
    public void writeChildElements(TunnelPart object, Namespaces namespaces, XMLWriter writer) throws ObjectSerializeException, XMLWriteException {
        super.writeChildElements(object, namespaces, writer);

        for (ADEOfTunnelPart property : object.getADEProperties(ADEOfTunnelPart.class))
            ADESerializerHelper.writeADEProperty(property, namespaces, writer);
    }
}


text:
<!doctype html>
<html lang="es">

<head>
  <meta charset="utf-8">
  <base href="/managerbox">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>ManagerBox - Gestor de comercios</title>
  <link rel="icon" type="image/x-icon" href="assets/img/ManagerBox1.svg">
</head>

<body>
  <app-root></app-root>
  <script src="https://code.jquery.com/jquery-3.2.1.js" integrity="sha256-DZAnKJ/6XZ9si04Hgrsxu/8s717jcIzLy3oi35EouyE=" crossorigin="anonymous"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
  <!--<script src="https://checkout.stripe.com/checkout.js"></script>-->
  <script>
    /*document.onkeypress = function (event) {
      event = (event || window.event);
      if (event.keyCode == 116) {
        return false;
      }
    }*/
    document.onmousedown = function (event) {
      event = (event || window.event);
      if (event.keyCode == 116) {
        return false;
      }
    }
    document.onkeydown = function (event) {
      event = (event || window.event);
      if (event.keyCode == 116) {
        return false;
      }
    }

    /*document.onkeypress = function (event) {
      event = (event || window.event);
      if (event.keyCode == 117) {
        return false;
      }
    }
    document.onmousedown = function (event) {
      event = (event || window.event);
      if (event.keyCode == 117) {
        return false;
      }
    }
    document.onkeydown = function (event) {
      event = (event || window.event);
      if (event.keyCode == 117) {
        return false;
      }
    }*/
  </script>
</body>

</html>


text:
<!DOCTYPE html>

  <meta charset="utf-8" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />

  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>linter — The Logtalk Handbook v3.61.0-b01 documentation</title>
      <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
      <link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
      <link rel="stylesheet" href="../_static/css/custom.css" type="text/css" />

    <link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
    <link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />
    <link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png" />
    <link rel="manifest" href="/site.webmanifest" />
    <link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5" />
    <meta name="msapplication-TileColor" content="#355b95" />
    <meta name="theme-color" content="#ffffff" />

    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="next" title="make" href="make.html" />
    <link rel="prev" title="lgtunit" href="lgtunit.html" />

             The Logtalk Handbook

                3.61.0

  <form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>

Contents

User Manual

Reference Manual

Tutorial

FAQ

Developer Tools

Overview

asdf

assertions

code_metrics

dead_code_scanner

debug_messages

debugger

diagrams

doclet

help

issue_creator

lgtdoc

lgtunit

linter

Main linter checks

Help on linter warnings

Extending the linter

Linting Prolog modules

Linting plain Prolog files

make

packs

ports_profiler

profiler

tutor

wrapper

Libraries

Ports

Contributions

Glossary

Bibliography

Index

External Contents

APIs

Logtalk website

GitHub repo

          The Logtalk Handbook

 »

Developer Tools »

linter

               Edit on GitHub

linter

Logtalk provides a built-in linter tool that runs automatically when
compiling and loading source files. The lint warnings are controlled by
a set of flags.
The default values for these flags are defined in the backend Prolog
compiler adapter files and can be overriden from a settings file or from
a source file (e.g. a loader file). These flags can be set globally
using the
set_logtalk_flag/2
built-in predicate. For (source file or entity) local scope, use instead
the
set_logtalk_flag/2
directive. Some lint checks are turned off by default, specially when
computationally expensive.

Note that, in some cases, the linter may generate false warnings due to
source code analysis limitations or special cases that, while valid when
intended, usually result from programming issues. When a code rewrite is
not a sensible solution to avoid the warning, the workaround is to turn
off as locally as possible the flag that controls the warning.

Main linter checks

Lint checks include:

Missing directives (including scope, meta-predicate, dynamic,
discontiguous, and multifile directives)

Duplicated directives, clauses, and grammar rules

Missing predicates (unknown messages plus calls to non-declared and
non-defined predicates)

Calls to declared but not defined static predicates

Non-terminals called as predicates (instead of via the phrase/2-3
built-in methods)

Non-portable predicate calls, predicate options, arithmetic function
calls, directives, flags, and flag values

Suspicious calls (syntactically valid calls that are likely semantic
errors; e.g. float comparisons using the standard arithmetic
comparison operators)

Deprecated directives, predicates, control constructs, and flags

References to unknown entities (objects, protocols, categories, or
modules)

Top-level shortcuts used as directives

Unification goals that will succeed without binding any variables

Unification goals that will succeed creating a cyclic term

Goals that are always true or always false

Trivial goal fails (due to no matching predicate clause)

Redefined built-in predicates

Redefined standard operators

Lambda expression unclassified variables and mixed up variables

Lambda expression with parameter variables used elsewhere in a clause

Singleton variables

If-then-else and soft cut control constructs without an else part

If-then-else and soft cut control constructs where the test is a
unification between a variable and a ground term

Missing parenthesis around if-then-else and disjunction control
constructs in the presence of cuts in the first argument

Cuts in clauses for multifile predicates

Missing cut in repeat loops

Possible non-steadfast predicate definitions

Non-tail recursive predicate definitions

Redundant calls to control constructs and built-in predicates

Calls to all-solutions predicates with existentially qualified
variables not occurring in the qualified goal

Calls to all-solutions predicates with no shared variables between
template and goal

Calls to bagof/3 and setof/3 where the goal argument contains
singleton variables

Calls to findall/3 used to backtrack over all solutions of a goal
without collecting them

Calls to catch/3 that catch all exceptions

Calls to standard predicates that have more efficient alternatives

File, entity, predicate, and variable names not following official
coding guidelines

Variable names that differ only on case

Clauses whose body is a disjunction

Naked meta-variables in cut-transparent control constructs

Additional checks are provided by the lgtdoc, make, and
dead_code_scanner tools. For large projects, the data generated by
the code_metrics tool may also be relevant in accessing the quality
of your code.

Help on linter warnings

By loading the tutor tool, most lint warnings are expanded with
explanations and suggestions on how to fix the reported issues.

Extending the linter

Experimental support for extending the linter with user-defined warnings
is available using the
logtalk_linter_hook/7
multifile hook predicate.

Linting Prolog modules

This tool can also be applied to Prolog modules that Logtalk is able to
compile as objects. For example, if the Prolog module file is named
module.pl, try:

| ?- logtalk_load(module, [source_data(on)]).

Due to the lack of standardization of module systems and the abundance
of proprietary extensions, this solution is not expected to work for all
cases.

Linting plain Prolog files

This tool can also be applied to plain Prolog code. For example, if the
Prolog file is named code.pl, simply define an object including its
code:

:- object(code).
    :- include('code.pl').
:- end_object.

Save the object to an e.g. code.lgt file in the same directory as
the Prolog file and then load it:

| ?- logtalk_load(code, [source_data(on)]).

In alternative, use the object_wrapper_hook provided by the
hook_objects library:

| ?- logtalk_load([os(loader), hook_objects(object_wrapper_hook)]).
...

| ?- logtalk_load(code, [hook(object_wrapper_hook), source_data(on)]).

With either wrapping solution, pay special attention to any compilation
warnings that may signal issues that could prevent the plain Prolog from
being fully checked when wrapped by an object.

         Previous
        Next

© Copyright 1998-2022, Paulo Moura.

  Built with Sphinx using a
    theme
    provided by Read the Docs.


text:
package org.myrobotlab.service.data;

public class PinState {

	// type
	public static final int DIGITAL = 0x0;
	public static final int ANALOG = 0x1;
	public static final int ANALOGDIGITAL = 0x2;

	// mode
	public static final int OUTPUT = 0x1;
	public static final int INPUT = 0x0;

	public static final int UNKNOWN = 0xFF;

	/**
	 * type - represents the physical type of pin - on an Arduino they can be
	 * DIGTAL (read/write), ANALOG (read only), ANALOGDIGITAL (pwm read/write)
	 */
	public int type = UNKNOWN;
	public int mode = UNKNOWN;
	public int address = UNKNOWN;
	public int value = UNKNOWN;
}