text:
package com.taobao.tddl.optimizer.config.table;

import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.text.MessageFormat;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.builder.ToStringBuilder;

import com.taobao.tddl.common.exception.TddlException;
import com.taobao.tddl.common.exception.TddlRuntimeException;
import com.taobao.tddl.common.model.lifecycle.AbstractLifecycle;
import com.taobao.tddl.common.utils.TddlToStringStyle;
import com.taobao.tddl.config.ConfigDataHandler;
import com.taobao.tddl.config.ConfigDataHandlerFactory;
import com.taobao.tddl.config.ConfigDataListener;
import com.taobao.tddl.config.impl.ConfigDataHandlerCity;
import com.taobao.tddl.optimizer.config.table.parse.TableMetaParser;

import com.taobao.tddl.common.utils.logger.Logger;
import com.taobao.tddl.common.utils.logger.LoggerFactory;

/**
 * 有schema文件的schemamanager实现
 *
 * @since 5.1.0
 */
public class StaticSchemaManager extends AbstractLifecycle implements SchemaManager {

    private final static Logger       logger          = LoggerFactory.getLogger(StaticSchemaManager.class);
    public final static MessageFormat schemaNullError = new MessageFormat("get schema null, appName is:{0}, unitName is:{1}, filePath is: {2}, dataId is: {3}");
    public final static MessageFormat SCHEMA_DATA_ID  = new MessageFormat("com.taobao.and_orV0.{0}_SCHEMA_DATAID");

    private ConfigDataHandler         schemaCdh;
    private String                    schemaFilePath  = null;
    private String                    appName         = null;
    private String                    unitName        = null;

    public StaticSchemaManager(String schemaFilePath, String appName, String unitName){
        super();
        this.schemaFilePath = schemaFilePath;
        this.appName = appName;
        this.unitName = unitName;
    }

    public StaticSchemaManager(){
    }

    protected Map<String, TableMeta> ss;

    protected void doInit() throws TddlException {
        super.doInit();
        ss = new ConcurrentHashMap<String, TableMeta>();

        if (this.appName == null) {
            logger.warn("schema appname is not assigned");
        }

        if (this.schemaFilePath == null) {
            logger.warn("schema file is not assigned");
        }

        if (appName == null && schemaFilePath == null) {
            return;
        }

        ConfigDataHandlerFactory factory = null;
        String dataId = null;

        // 优先从文件获取
        if (schemaFilePath == null) {
            dataId = SCHEMA_DATA_ID.format(new Object[] { appName });
            factory = ConfigDataHandlerCity.getFactory(appName, unitName);
        } else {
            factory = ConfigDataHandlerCity.getFileFactory(appName);
            dataId = schemaFilePath;
        }

        schemaCdh = factory.getConfigDataHandler(dataId, new SchemaConfigDataListener(this));

        String data = schemaCdh.getData(ConfigDataHandler.GET_DATA_TIMEOUT,
            ConfigDataHandler.FIRST_CACHE_THEN_SERVER_STRATEGY);

        if (data == null) {
            logger.warn(schemaNullError.format(new Object[] { appName, unitName, schemaFilePath, dataId }));
            return;
        }

        InputStream sis = null;
        try {
            sis = new ByteArrayInputStream(data.getBytes());
            List<TableMeta> schemaList = TableMetaParser.parse(sis);

            this.ss.clear();

            for (TableMeta table : schemaList) {
                this.putTable(table.getTableName(), table);
            }

            logger.warn("table fetched:");
            logger.warn(this.ss.keySet().toString());

        } catch (Exception e) {
            logger.error("table parser error, schema file is:\n" + data, e);
            throw new TddlRuntimeException(e);
        } finally {
            IOUtils.closeQuietly(sis);
        }

    }

    public static class SchemaConfigDataListener implements ConfigDataListener {

        private StaticSchemaManager schemaManager;

        public SchemaConfigDataListener(StaticSchemaManager schemaManager){
            this.schemaManager = schemaManager;
        }

        @Override
        public void onDataRecieved(String dataId, String data) {
            if (data == null || data.isEmpty()) {
                logger.warn("schema is null, dataId is " + dataId);
                return;
            }

            InputStream sis = null;
            try {
                sis = new ByteArrayInputStream(data.getBytes());
                List<TableMeta> schemaList = TableMetaParser.parse(sis);

                schemaManager.ss.clear();

                for (TableMeta table : schemaList) {
                    schemaManager.putTable(table.getTableName(), table);
                }

                logger.warn("table fetched:");
                logger.warn(schemaManager.ss.keySet().toString());
            } catch (Exception e) {
                logger.error("table parser error, schema file is:" + data, e);
                throw new TddlRuntimeException(e);
            } finally {
                IOUtils.closeQuietly(sis);
            }

        }

    }

    protected void doDestory() throws TddlException {
        super.doDestory();
        ss.clear();
    }

    public TableMeta getTable(String tableName) {
        return ss.get((tableName));
    }

    public void putTable(String tableName, TableMeta tableMeta) {
        ss.put(tableName.toUpperCase(), tableMeta);
    }

    public Collection<TableMeta> getAllTables() {
        return ss.values();
    }

    public static StaticSchemaManager parseSchema(String data) throws TddlException {
        if (data == null || data.isEmpty()) {
            throw new IllegalArgumentException("schema is null");
        }

        InputStream sis = null;
        try {
            sis = new ByteArrayInputStream(data.getBytes());
            return parseSchema(sis);
        } finally {
            IOUtils.closeQuietly(sis);
        }
    }

    public static StaticSchemaManager parseSchema(InputStream in) throws TddlException {
        if (in == null) {
            throw new IllegalArgumentException("in is null");
        }

        try {
            StaticSchemaManager schemaManager = new StaticSchemaManager();
            schemaManager.init();
            List<TableMeta> schemaList = TableMetaParser.parse(in);
            for (TableMeta t : schemaList) {
                schemaManager.putTable(t.getTableName(), t);
            }
            return schemaManager;
        } finally {
            IOUtils.closeQuietly(in);
        }

    }

    public String toString() {
        return ToStringBuilder.reflectionToString(this, TddlToStringStyle.DEFAULT_STYLE);
    }
}


text:
require "googleauth"

module Google
  module Ads
    module GoogleAds
      module V10
        module Services
          module CustomerUserAccessInvitationService
            # Credentials for the CustomerUserAccessInvitationService API.
            class Credentials < ::Google::Auth::Credentials
              self.scope = [
                "https://www.googleapis.com/auth/adwords"
              ]
            end
          end
        end
      end
    end
  end
end

redpajama_set_name: RedPajamaGithub


text:
using System;

namespace Anotar.Serilog
{
    /// <summary>
    /// If an <see cref="Exception"/> occurs in the applied method then log it to <c>Information</c>.
    /// </summary>
    [AttributeUsage(AttributeTargets.Method | AttributeTargets.Constructor, Inherited = false)]
    public class LogToInformationOnExceptionAttribute : Attribute
    {
    }
}


text:
/*
  Port to mount node server on in development
 */

const port = 8080;

export default {
  port
};


text:
var _ = require("lodash");

var ajax_manager = require('../../src/utils/ajax_manager')

const checkCalls = require("@djforth/morse-jasmine/check_calls")
  , getMod     = require("@djforth/morse-jasmine/get_module")(ajax_manager)
  , mockClass = require("@djforth/morse-jasmine/mock_class")
  , spyManager = require("@djforth/morse-jasmine/spy_manager")()
  , stubs      = require("@djforth/morse-jasmine/stub_inner")(ajax_manager)

xdescribe('ajax_manager', function() {
  let promise, ajax, ajaxClass, resolve, reject;
  beforeEach(function() {
    promise = new Promise(function(res, rej){
      resolve = res
      reject  =rej
    })
    spyManager.addSpy(["progress"]);
    stubs.addSpy({title:"ajaxManager", opts:["addUrl", "fetch"]})

    stubs.getSpy("ajaxManager").fetch.and.returnValue(promise);
    // stubs.getSpy("ajaxManager").and.returnValue(spyManager.getSpy("ajaxManager"));
    ajax = ajax_manager("my/api/call")
  });

  afterEach(function () {
    stubs.revertAll();
    spyManager.removeAll();
  });

  checkCalls(()=>{
    return stubs.getSpy("ajaxManager").addUrl
  }, "ajaxManager.addUrl", ()=>["my/api/call"]);

  it('should return obj', function() {
    expect(_.isPlainObject(ajax)).toBeTruthy();
  });

  describe('with progress', function() {
    let prom;
    beforeEach(function() {
      ajax.addProgress(spyManager.getSpy('progress'));
      prom = ajax.fetch()
    });

    checkCalls(()=>{
    return stubs.getSpy("ajaxManager").fetch
  }, "progress", ()=>[spyManager.getSpy('progress')]);

    it('should return success if promise resolved', function(done) {
      prom.then(function(data){
        expect(data).toEqual("data");
      });

      resolve("data");

      setTimeout(function() {
        done();
      }, 100);
    });

    it('should throw an error if rejected', function(done) {
      prom.catch(function(err){
        expect(err).toThrowError("error");
      });
      reject("error");

      setTimeout(function() {
        done();
      }, 100);
    });
  });

  describe('without progress', function() {
    let prom;
    beforeEach(function() {
      prom = ajax.fetch()
    });

    checkCalls(()=>{
    return stubs.getSpy("ajaxManager").fetch
  }, "progress", ()=>[undefined]);
  })

});


text:
package it.redhat.bankit;

import java.io.IOException;
import java.util.logging.Logger;

public class Main {

    public static void main(String[] args) throws IOException {

        JDGNode node = null;

        if (args.length > 0) {
            node = new JDGNode(args[0]);
        } else {
            System.out.println("usage: node");
            System.exit(-1);
        }

        banner();
        log.info("Connecting to Node: " + node);
        new JDG().connect(node).attachUI(new TextUI(System.in, System.out)).processCommands();

    }

    private static void banner() {

        System.out.println("---------------------------------------");
        System.out.println("         Bankit JDG Testing CLI");
        System.out.println("            written by uL");
        System.out.println("---------------------------------------");
        System.out.println();

    }

    private static Logger log = Logger.getLogger(Main.class.getName());

}


text:
@interface NIMContactSelectViewController ()<UITableViewDataSource, UITableViewDelegate, NIMContactPickedViewDelegate>{
    NSMutableArray *_selectecContacts;
}
@property (strong, nonatomic) UITableView *tableView;

@property (strong, nonatomic) NIMContactSelectTabView *selectIndicatorView;

@property (nonatomic, assign) NSInteger maxSelectCount;

@property (nonatomic, assign) NIMContactSelectType selectType;

@property (nonatomic, strong) NIMGroupedDataCollection *data;

@property(nonatomic, strong) NIMGroupedDataCollection *robotData;

@property(nonatomic, strong) NSMutableArray<NSString *> *sectionTitles;

@property(nonatomic, strong) NSMutableDictionary *contentDic;

@end

@implementation NIMContactSelectViewController

- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if(self) {
        _maxSelectCount = NSIntegerMax;
    }
    return self;
}

- (instancetype)initWithConfig:(id<NIMContactSelectConfig>) config{
    self = [self initWithNibName:nil bundle:nil];
    if (self) {
        self.config = config;
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    self.tableView = [[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStylePlain];
    self.tableView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
    [self.view addSubview:self.tableView];

    [self.view addSubview:self.selectIndicatorView];

    self.tableView.dataSource = self;
    self.tableView.delegate = self;

    [self setUpNav];

    self.selectIndicatorView.pickedView.delegate = self;
    [self.selectIndicatorView.doneButton addTarget:self action:@selector(onDoneBtnClick:) forControlEvents:UIControlEventTouchUpInside];
}

- (void)setUpNav
{
    self.navigationItem.title = [self.config respondsToSelector:@selector(title)] ? [self.config title] : @"选择联系人";
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(onCancelBtnClick:)];
    if ([self.config respondsToSelector:@selector(showSelectDetail)] && self.config.showSelectDetail) {
        UILabel *label = [[UILabel alloc] initWithFrame:CGRectZero];
        self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:label];
        [label setText:self.detailTitle];
        [label sizeToFit];
    }
}

- (void)refreshDetailTitle
{
    UILabel *label = (UILabel *)self.navigationItem.rightBarButtonItem.customView;
    [label setText:self.detailTitle];
    [label sizeToFit];
}

- (NSString *)detailTitle
{
    NSString *detail = @"";
    if ([self.config respondsToSelector:@selector(maxSelectedNum)])
    {
        detail = [NSString stringWithFormat:@"%zd/%zd",_selectecContacts.count,_maxSelectCount];
    }
    else
    {
        detail = [NSString stringWithFormat:@"已选%zd人",_selectecContacts.count];
    }
    return detail;
}

- (void)viewDidLayoutSubviews{
    [super viewDidLayoutSubviews];
    self.selectIndicatorView.nim_width = self.view.nim_width;
    self.tableView.nim_height = self.view.nim_height - self.selectIndicatorView.nim_height;
    self.selectIndicatorView.nim_bottom = self.view.nim_height;
}

- (void)show{
    UIViewController *vc = [UIApplication sharedApplication].keyWindow.rootViewController;
    [vc presentViewController:[[UINavigationController alloc] initWithRootViewController:self] animated:YES completion:nil];
}

- (void)setConfig:(id<NIMContactSelectConfig>)config{
    _config = config;
    if ([config respondsToSelector:@selector(maxSelectedNum)]) {
        _maxSelectCount = [config maxSelectedNum];
    }
    [self makeData];
}

- (void)onCancelBtnClick:(id)sender {
    [self dismissViewControllerAnimated:YES completion:^() {
        if (self.cancelBlock) {
            self.cancelBlock();
            self.cancelBlock = nil;
        }
        if([_delegate respondsToSelector:@selector(didCancelledSelect)]) {
            [_delegate didCancelledSelect];
        }
    }];
}

- (IBAction)onDoneBtnClick:(id)sender {
    [self dismissViewControllerAnimated:YES completion:nil];
    if (_selectecContacts.count) {
        if ([self.delegate respondsToSelector:@selector(didFinishedSelect:)]) {
            [self.delegate didFinishedSelect:_selectecContacts];
        }
        if (self.finshBlock) {
            self.finshBlock(_selectecContacts);
            self.finshBlock = nil;
        }
    }
    else {
        if([_delegate respondsToSelector:@selector(didCancelledSelect)]) {
            [_delegate didCancelledSelect];
        }
        if (self.cancelBlock) {
            self.cancelBlock();
            self.cancelBlock = nil;
        }
    }
}

- (void)makeData{
    self.selectType = NIMContactSelectTypeFriend;
    if ([self.config respondsToSelector:@selector(selectType)]) {
        self.selectType = [self.config selectType];
    }
    if ([self.config respondsToSelector:@selector(enableRobot)] && self.config.enableRobot)
    {
        //FIX ME:选择的contact添加robot数据,以及初始化
        self.robotData = [self makeRobotInfoData];
    }

    switch (self.selectType) {
        case NIMContactSelectTypeFriend:{
            NSMutableArray *data = [[NIMSDK sharedSDK].userManager.myFriends mutableCopy];
            NSMutableArray *myFriendArray = [[NSMutableArray alloc] init];
            for (NIMUser *user in data) {
                [myFriendArray addObject:user.userId];
            }
            NSArray *uids = [self filterData:myFriendArray];
            self.data = [self makeUserInfoData:uids];
            [self getContactList];
            [self.tableView reloadData];
            break;
        }
        case NIMContactSelectTypeRobot:{
            NSMutableArray *data = [[NIMSDK sharedSDK].robotManager.allRobots mutableCopy];
            NSMutableArray *robotsArray = [[NSMutableArray alloc] init];
            for (NIMRobot *robot in data) {
                [robotsArray addObject:robot.userId];
            }
            NSArray *uids = [self filterData:robotsArray];
            self.data = [self makeUserInfoData:uids];
            [self getContactList];
            [self.tableView reloadData];
            break;
        }
        case NIMContactSelectTypeTeamMember:{
            if ([self.config respondsToSelector:@selector(teamId)]) {
                NSString *teamId = [self.config teamId];
                __weak typeof(self) wself = self;
                [[NIMSDK sharedSDK].teamManager fetchTeamMembers:teamId completion:^(NSError *error, NSArray *members) {
                    if (!error) {
                        NSMutableArray *data = [[NSMutableArray alloc] init];
                        for (NIMTeamMember *member in members) {
                            [data addObject:member.userId];
                        }
                        NSArray *uids = [wself filterData:data];
                        wself.data = [wself makeTeamMemberInfoData:uids teamId:teamId];
                        [self getContactList];
                        [wself.tableView reloadData];
                    }
                }];
            }
            break;
        }
        case NIMContactSelectTypeTeam:{
            NSMutableArray *teams = [[NSMutableArray alloc] init];
            NSMutableArray *data = [[NIMSDK sharedSDK].teamManager.allMyTeams mutableCopy];
            for (NIMTeam *team in data) {
                [teams addObject:team.teamId];
            }
            NSArray *uids = [self filterData:teams];
            self.data = [self makeTeamInfoData:uids];
            [self getContactList];
            [self.tableView reloadData];
            break;
        }
        default:
            break;
    }
    if ([self.config respondsToSelector:@selector(alreadySelectedMemberId)])
    {
        _selectecContacts = [[self.config alreadySelectedMemberId] mutableCopy];
    }

    _selectecContacts = _selectecContacts.count ? _selectecContacts : [NSMutableArray array];
    for (NSString *selectId in _selectecContacts) {
        NIMKitInfo *info;
        if (self.selectType == NIMContactSelectTypeTeam) {
            info = [[NIMKit sharedKit] infoByTeam:selectId option:nil];
        }else{
            info = [[NIMKit sharedKit] infoByUser:selectId option:nil];
        }
        [self.selectIndicatorView.pickedView addMemberInfo:info];
    }

}

- (NSArray *)filterData:(NSMutableArray *)data{
    if (data) {
        if ([self.config respondsToSelector:@selector(filterIds)]) {
            NSArray *ids = [self.config filterIds];
            [data removeObjectsInArray:ids];
        }
        return data;
    }
    return nil;
}

- (NIMGroupedDataCollection *)makeUserInfoData:(NSArray *)uids{
    NIMGroupedDataCollection *collection = [[NIMGroupedDataCollection alloc] init];
    NSMutableArray *members = [[NSMutableArray alloc] init];
    for (NSString *uid in uids) {
        NIMGroupUser *user = [[NIMGroupUser alloc] initWithUserId:uid];
        [members addObject:user];
    }
    collection.members = members;
    return collection;
}

- (NIMGroupedDataCollection *)makeTeamMemberInfoData:(NSArray *)uids teamId:(NSString *)teamId{
    NIMGroupedDataCollection *collection = [[NIMGroupedDataCollection alloc] init];
    NSMutableArray *members = [[NSMutableArray alloc] init];
    for (NSString *uid in uids) {
        NIMGroupTeamMember *user = [[NIMGroupTeamMember alloc] initWithUserId:uid teamId:teamId];
        [members addObject:user];
    }
    collection.members = members;
    return collection;
}

- (NIMGroupedDataCollection *)makeTeamInfoData:(NSArray *)teamIds{
    NIMGroupedDataCollection *collection = [[NIMGroupedDataCollection alloc] init];
    NSMutableArray *members = [[NSMutableArray alloc] init];
    for (NSString *teamId in teamIds) {
        NIMGroupTeam *team = [[NIMGroupTeam alloc] initWithTeam:teamId];
        [members addObject:team];
    }
    collection.members = members;
    return collection;
}

- (NIMGroupedDataCollection *)makeRobotInfoData {

    NSArray *robots = [NIMSDK sharedSDK].robotManager.allRobots;
    NSMutableArray *members = [[NSMutableArray alloc] init];
    for (NIMRobot *robot in robots)
    {
        NIMGroupUser *user = [[NIMGroupUser alloc] initWithUserId:robot.userId];
        [members addObject:user];
    }
    if (members.count)
    {
        NIMGroupedDataCollection *collection = [[NIMGroupedDataCollection alloc] init];
        collection.members = members;
        return collection;
    }
    return nil;
}

#pragma mark - UITableViewDataSource

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return self.sectionTitles.count;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    NSArray *arr = [self.contentDic valueForKey:self.sectionTitles[section]];
    return arr.count;
}

- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
{
    if (self.robotData && section == 0) {
        return @"机器人";
    }else {
        return self.sectionTitles[section];
    }
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSString *title = self.sectionTitles[indexPath.section];
    NSMutableArray *arr = [self.contentDic valueForKey:title];
    id<NIMGroupMemberProtocol> contactItem = arr[indexPath.row];

    NIMContactDataCell *cell = [tableView dequeueReusableCellWithIdentifier:@"SelectContactCellID"];
    if (cell == nil) {
        cell = [[NIMContactDataCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"SelectContactCellID"];
    }
    cell.accessoryBtn.hidden = NO;
    cell.accessoryBtn.selected = [_selectecContacts containsObject:[contactItem memberId]];
    if (self.selectType == NIMContactSelectTypeTeam) {
        [cell refreshTeam:contactItem];
    }else{
        [cell refreshUser:contactItem];
    }
    return cell;
}

- (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView {
    return self.sectionTitles;
}

#pragma mark - UITableViewDelegate

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 50;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{

    NSString *title = self.sectionTitles[indexPath.section];
    NSMutableArray *arr = [self.contentDic valueForKey:title];
    id<NIMGroupMemberProtocol> member = arr[indexPath.row];

    NSString *memberId = [(id<NIMGroupMemberProtocol>)member memberId];
    NIMContactDataCell *cell = (NIMContactDataCell *)[tableView cellForRowAtIndexPath:indexPath];
    NIMKitInfo *info;
    if (self.selectType == NIMContactSelectTypeTeam) {
        info = [[NIMKit sharedKit] infoByTeam:memberId option:nil];
    }else{
        info = [[NIMKit sharedKit] infoByUser:memberId option:nil];
    }
    if([_selectecContacts containsObject:memberId]) {
        [_selectecContacts removeObject:memberId];
        cell.accessoryBtn.selected = NO;
        [self.selectIndicatorView.pickedView removeMemberInfo:info];
    } else if(_selectecContacts.count >= _maxSelectCount) {
        if ([self.config respondsToSelector:@selector(selectedOverFlowTip)]) {
            NSString *tip = [self.config selectedOverFlowTip];
            [self.view makeToast:tip duration:2.0 position:CSToastPositionCenter];
        }
        cell.accessoryBtn.selected = NO;
    } else {
        [_selectecContacts addObject:memberId];
        cell.accessoryBtn.selected = YES;
        [self.selectIndicatorView.pickedView addMemberInfo:info];
    }
    [tableView deselectRowAtIndexPath:indexPath animated:NO];
    [self refreshDetailTitle];
}

#pragma mark - ContactPickedViewDelegate

- (void)removeUser:(NSString *)userId {
    [_selectecContacts removeObject:userId];
    [_tableView reloadData];
    [self refreshDetailTitle];
}

#pragma mark - Private

- (NIMContactSelectTabView *)selectIndicatorView{
    if (_selectIndicatorView) {
        return _selectIndicatorView;
    }
    CGFloat tabHeight = 50.f;
    CGFloat tabWidth  = 320.f;
    _selectIndicatorView = [[NIMContactSelectTabView alloc] initWithFrame:CGRectMake(0, 0, tabWidth, tabHeight)];
    return _selectIndicatorView;
}

- (void)getContactList {
    _sectionTitles = @[].mutableCopy;
    _contentDic = @{}.mutableCopy;

    if (self.robotData) {
        [_sectionTitles addObject:@"$"];
        for (int i = 0; i < self.robotData.groupCount; i++) {
            NSArray *tempArr = [self.robotData membersOfGroup:i];
            [tempArr enumerateObjectsUsingBlock:^(id<NIMGroupMemberProtocol>member, NSUInteger idx, BOOL * _Nonnull stop) {
                //存放member的数组
                NSMutableArray *arr = [self.contentDic valueForKey:@"$"];
                if (!arr) {
                    arr = @[].mutableCopy;
                    [self.contentDic setObject:arr forKey:@"$"];
                }
                [arr addObject:member];
            }];
        }
    }

    for (int i = 0; i < self.data.groupCount; ++i) {
        NSString *title = [self.data titleOfGroup:i];
        [_sectionTitles addObject:title];
        NSArray *tempArr = [self.data membersOfGroup:i];
        [tempArr enumerateObjectsUsingBlock:^(id<NIMGroupMemberProtocol>member, NSUInteger idx, BOOL * _Nonnull stop) {
            //存放member的数组
            NSMutableArray *arr = [self.contentDic valueForKey:title];
            if (!arr) {
                arr = @[].mutableCopy;
                [self.contentDic setObject:arr forKey:title];
            }
            [arr addObject:member];
        }];
    }
}

@end


text:
package create

import (
	"context"
	"fmt"

	"github.com/spf13/cobra"

	corev1 "k8s.io/api/core/v1"
	"k8s.io/apimachinery/pkg/api/meta"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/apimachinery/pkg/runtime"
	"k8s.io/cli-runtime/pkg/genericclioptions"
	"k8s.io/cli-runtime/pkg/resource"
	coreclient "k8s.io/client-go/kubernetes/typed/core/v1"
	cmdutil "k8s.io/kubectl/pkg/cmd/util"
	"k8s.io/kubectl/pkg/scheme"
	"k8s.io/kubectl/pkg/util"
	"k8s.io/kubectl/pkg/util/i18n"
	"k8s.io/kubectl/pkg/util/templates"
)

var (
	serviceAccountLong = templates.LongDesc(i18n.T(`
		Create a service account with the specified name.`))

	serviceAccountExample = templates.Examples(i18n.T(`
	  # Create a new service account named my-service-account
	  kubectl create serviceaccount my-service-account`))
)

// ServiceAccountOpts holds the options for 'create serviceaccount' sub command
type ServiceAccountOpts struct {
	// PrintFlags holds options necessary for obtaining a printer
	PrintFlags *genericclioptions.PrintFlags
	PrintObj   func(obj runtime.Object) error
	// Name of resource being created
	Name             string
	DryRunStrategy   cmdutil.DryRunStrategy
	DryRunVerifier   *resource.DryRunVerifier
	CreateAnnotation bool
	FieldManager     string

	Namespace        string
	EnforceNamespace bool

	Mapper meta.RESTMapper
	Client *coreclient.CoreV1Client

	genericclioptions.IOStreams
}

// NewServiceAccountOpts creates a new *ServiceAccountOpts with sane defaults
func NewServiceAccountOpts(ioStreams genericclioptions.IOStreams) *ServiceAccountOpts {
	return &ServiceAccountOpts{
		PrintFlags: genericclioptions.NewPrintFlags("created").WithTypeSetter(scheme.Scheme),
		IOStreams:  ioStreams,
	}
}

// NewCmdCreateServiceAccount is a macro command to create a new service account
func NewCmdCreateServiceAccount(f cmdutil.Factory, ioStreams genericclioptions.IOStreams) *cobra.Command {
	o := NewServiceAccountOpts(ioStreams)

	cmd := &cobra.Command{
		Use:                   "serviceaccount NAME [--dry-run=server|client|none]",
		DisableFlagsInUseLine: true,
		Aliases:               []string{"sa"},
		Short:                 i18n.T("Create a service account with the specified name"),
		Long:                  serviceAccountLong,
		Example:               serviceAccountExample,
		Run: func(cmd *cobra.Command, args []string) {
			cmdutil.CheckErr(o.Complete(f, cmd, args))
			cmdutil.CheckErr(o.Validate())
			cmdutil.CheckErr(o.Run())
		},
	}

	o.PrintFlags.AddFlags(cmd)

	cmdutil.AddApplyAnnotationFlags(cmd)
	cmdutil.AddValidateFlags(cmd)
	cmdutil.AddDryRunFlag(cmd)
	cmdutil.AddFieldManagerFlagVar(cmd, &o.FieldManager, "kubectl-create")
	return cmd
}

// Complete completes all the required options
func (o *ServiceAccountOpts) Complete(f cmdutil.Factory, cmd *cobra.Command, args []string) error {
	var err error
	o.Name, err = NameFromCommandArgs(cmd, args)
	if err != nil {
		return err
	}

	restConfig, err := f.ToRESTConfig()
	if err != nil {
		return err
	}
	o.Client, err = coreclient.NewForConfig(restConfig)
	if err != nil {
		return err
	}

	o.CreateAnnotation = cmdutil.GetFlagBool(cmd, cmdutil.ApplyAnnotationsFlag)

	o.DryRunStrategy, err = cmdutil.GetDryRunStrategy(cmd)
	if err != nil {
		return err
	}
	dynamicClient, err := f.DynamicClient()
	if err != nil {
		return err
	}
	o.DryRunVerifier = resource.NewDryRunVerifier(dynamicClient, f.OpenAPIGetter())

	o.Namespace, o.EnforceNamespace, err = f.ToRawKubeConfigLoader().Namespace()
	if err != nil {
		return err
	}

	cmdutil.PrintFlagsWithDryRunStrategy(o.PrintFlags, o.DryRunStrategy)

	printer, err := o.PrintFlags.ToPrinter()
	if err != nil {
		return err
	}

	o.PrintObj = func(obj runtime.Object) error {
		return printer.PrintObj(obj, o.Out)
	}

	return nil
}

// Validate checks ServiceAccountOpts to see if there is sufficient information run the command.
func (o *ServiceAccountOpts) Validate() error {
	if len(o.Name) == 0 {
		return fmt.Errorf("name must be specified")
	}
	return nil
}

// Run makes the api call to the server
func (o *ServiceAccountOpts) Run() error {
	serviceAccount, err := o.createServiceAccount()
	if err != nil {
		return err
	}

	if err := util.CreateOrUpdateAnnotation(o.CreateAnnotation, serviceAccount, scheme.DefaultJSONEncoder()); err != nil {
		return err
	}

	if o.DryRunStrategy != cmdutil.DryRunClient {
		createOptions := metav1.CreateOptions{}
		if o.FieldManager != "" {
			createOptions.FieldManager = o.FieldManager
		}
		if o.DryRunStrategy == cmdutil.DryRunServer {
			if err := o.DryRunVerifier.HasSupport(serviceAccount.GroupVersionKind()); err != nil {
				return err
			}
			createOptions.DryRun = []string{metav1.DryRunAll}
		}
		serviceAccount, err = o.Client.ServiceAccounts(o.Namespace).Create(context.TODO(), serviceAccount, createOptions)
		if err != nil {
			return fmt.Errorf("failed to create serviceaccount: %v", err)
		}
	}
	return o.PrintObj(serviceAccount)
}

func (o *ServiceAccountOpts) createServiceAccount() (*corev1.ServiceAccount, error) {
	namespace := ""
	if o.EnforceNamespace {
		namespace = o.Namespace
	}
	serviceAccount := &corev1.ServiceAccount{
		TypeMeta: metav1.TypeMeta{APIVersion: corev1.SchemeGroupVersion.String(), Kind: "ServiceAccount"},
		ObjectMeta: metav1.ObjectMeta{
			Name:      o.Name,
			Namespace: namespace,
		},
	}
	serviceAccount.Name = o.Name
	return serviceAccount, nil
}


text:
package com.github.jobson.resources;

import com.github.jobson.Constants;
import com.github.jobson.api.APIRootResponse;
import com.github.jobson.api.v1.APIRestLink;
import io.swagger.v3.oas.annotations.OpenAPIDefinition;
import io.swagger.v3.oas.annotations.info.Info;

import javax.annotation.security.PermitAll;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.SecurityContext;
import java.net.URI;
import java.util.HashMap;
import java.util.Map;

import static com.github.jobson.Constants.HTTP_ROOT;

@OpenAPIDefinition(
    info = @Info(description = "Top-level resource, which lists sub-resources"))
@Path(HTTP_ROOT)
@Produces("application/json")
public final class RootResource {

    @GET
    @PermitAll
    public APIRootResponse get(@Context SecurityContext context) {
        final Map<String, APIRestLink> links = new HashMap<>();
        links.put("v1", new APIRestLink(URI.create(Constants.HTTP_V1_ROOT)));
        return new APIRootResponse(links);
    }
}


text:
///* tslint:disable:no-unused-variable */
//
//import { TestBed, async, inject } from '@angular/core/testing';
//import { NotificationsConfigService } from './notifications-config.service';
//
//describe('Service: NotificationsConfig', () => {
//  beforeEach(() => {
//    TestBed.configureTestingModule({
//      providers: [NotificationsConfigService]
//    });
//  });
//
//  it('should ...', inject([NotificationsConfigService], (service: NotificationsConfigService) => {
//    expect(service).toBeTruthy();
//  }));
//});


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

namespace RS.Sql.Comparer
{
    class Program
    {
        static void Main(string[] args)
        {
            new Engine().CompareDatabases();
        }
    }
}


text:
package org.ojalgo.function;

import java.math.BigDecimal;

import org.ojalgo.function.aggregator.AggregatorSet;
import org.ojalgo.function.aggregator.BigAggregator;
import org.ojalgo.function.constant.BigMath;
import org.ojalgo.type.context.NumberContext;

/**
 * Only the reference type parameter (BigDecimal) methods are actually implemented. The methods with the
 * primitive parameters (double) should create a BigDecimal and then delegate to the primitive methods (and do
 * nothing else). If possible the implementations should be pure BigDecimal arithmatic without rounding. If
 * rounding is necessary MathContext.DECIMAL128 should be used. If BigDecimal arithmatic is not possible at
 * all the implementation should delegate to PrimitiveFunction.
 *
 * @author apete
 */
public final class BigFunction extends FunctionSet<BigDecimal> {

    @FunctionalInterface
    public interface Binary extends BinaryFunction<BigDecimal> {

        default double invoke(final double arg1, final double arg2) {
            return this.invoke(BigDecimal.valueOf(arg1), BigDecimal.valueOf(arg2)).doubleValue();
        }

        default float invoke(final float arg1, final float arg2) {
            return this.invoke(BigDecimal.valueOf(arg1), BigDecimal.valueOf(arg2)).floatValue();
        }

    }

    @FunctionalInterface
    public interface Consumer extends VoidFunction<BigDecimal> {

        default void invoke(final double arg) {
            this.invoke(BigDecimal.valueOf(arg));
        }

        default void invoke(final float arg) {
            this.invoke(BigDecimal.valueOf(arg));
        }

    }

    @FunctionalInterface
    public interface Parameter extends ParameterFunction<BigDecimal> {

        default double invoke(final double arg, final int param) {
            return this.invoke(BigDecimal.valueOf(arg), param).doubleValue();
        }

        default float invoke(final float arg, final int param) {
            return this.invoke(BigDecimal.valueOf(arg), param).floatValue();
        }

    }

    @FunctionalInterface
    public interface Predicate extends PredicateFunction<BigDecimal> {

        default boolean invoke(final double arg) {
            return this.invoke(BigDecimal.valueOf(arg));
        }

        default boolean invoke(final float arg) {
            return this.invoke(BigDecimal.valueOf(arg));
        }

    }

    @FunctionalInterface
    public interface Unary extends UnaryFunction<BigDecimal> {

        default double invoke(final double arg) {
            return this.invoke(BigDecimal.valueOf(arg)).doubleValue();
        }

        default float invoke(final float arg) {
            return this.invoke(BigDecimal.valueOf(arg)).floatValue();
        }

    }

    private static final BigFunction SET = new BigFunction();

    public static BigFunction getSet() {
        return SET;
    }

    private BigFunction() {
        super();
    }

    @Override
    public UnaryFunction<BigDecimal> abs() {
        return BigMath.ABS;
    }

    @Override
    public UnaryFunction<BigDecimal> acos() {
        return BigMath.ACOS;
    }

    @Override
    public UnaryFunction<BigDecimal> acosh() {
        return BigMath.ACOSH;
    }

    @Override
    public BinaryFunction<BigDecimal> add() {
        return BigMath.ADD;
    }

    @Override
    public AggregatorSet<BigDecimal> aggregator() {
        return BigAggregator.getSet();
    }

    @Override
    public UnaryFunction<BigDecimal> asin() {
        return BigMath.ASIN;
    }

    @Override
    public UnaryFunction<BigDecimal> asinh() {
        return BigMath.ASINH;
    }

    @Override
    public UnaryFunction<BigDecimal> atan() {
        return BigMath.ATAN;
    }

    @Override
    public BinaryFunction<BigDecimal> atan2() {
        return BigMath.ATAN2;
    }

    @Override
    public UnaryFunction<BigDecimal> atanh() {
        return BigMath.ATANH;
    }

    @Override
    public UnaryFunction<BigDecimal> cardinality() {
        return BigMath.CARDINALITY;
    }

    @Override
    public UnaryFunction<BigDecimal> cbrt() {
        return BigMath.CBRT;
    }

    @Override
    public UnaryFunction<BigDecimal> ceil() {
        return BigMath.CEIL;
    }

    @Override
    public UnaryFunction<BigDecimal> conjugate() {
        return BigMath.CONJUGATE;
    }

    @Override
    public UnaryFunction<BigDecimal> cos() {
        return BigMath.COS;
    }

    @Override
    public UnaryFunction<BigDecimal> cosh() {
        return BigMath.COSH;
    }

    @Override
    public BinaryFunction<BigDecimal> divide() {
        return BigMath.DIVIDE;
    }

    @Override
    public Unary enforce(final NumberContext context) {
        return arg -> context.enforce(arg);
    }

    @Override
    public UnaryFunction<BigDecimal> exp() {
        return BigMath.EXP;
    }

    @Override
    public UnaryFunction<BigDecimal> expm1() {
        return BigMath.EXPM1;
    }

    @Override
    public UnaryFunction<BigDecimal> floor() {
        return BigMath.FLOOR;
    }

    @Override
    public BinaryFunction<BigDecimal> hypot() {
        return BigMath.HYPOT;
    }

    @Override
    public UnaryFunction<BigDecimal> invert() {
        return BigMath.INVERT;
    }

    @Override
    public UnaryFunction<BigDecimal> log() {
        return BigMath.LOG;
    }

    @Override
    public UnaryFunction<BigDecimal> log10() {
        return BigMath.LOG10;
    }

    @Override
    public UnaryFunction<BigDecimal> log1p() {
        return BigMath.LOG1P;
    }

    @Override
    public UnaryFunction<BigDecimal> logistic() {
        return BigMath.LOGISTIC;
    }

    @Override
    public UnaryFunction<BigDecimal> logit() {
        return BigMath.LOGIT;
    }

    @Override
    public BinaryFunction<BigDecimal> max() {
        return BigMath.MAX;
    }

    @Override
    public BinaryFunction<BigDecimal> min() {
        return BigMath.MIN;
    }

    @Override
    public BinaryFunction<BigDecimal> multiply() {
        return BigMath.MULTIPLY;
    }

    @Override
    public UnaryFunction<BigDecimal> negate() {
        return BigMath.NEGATE;
    }

    @Override
    public BinaryFunction<BigDecimal> pow() {
        return BigMath.POW;
    }

    @Override
    public ParameterFunction<BigDecimal> power() {
        return BigMath.POWER;
    }

    @Override
    public UnaryFunction<BigDecimal> rint() {
        return BigMath.RINT;
    }

    @Override
    public ParameterFunction<BigDecimal> root() {
        return BigMath.ROOT;
    }

    @Override
    public ParameterFunction<BigDecimal> scale() {
        return BigMath.SCALE;
    }

    @Override
    public UnaryFunction<BigDecimal> signum() {
        return BigMath.SIGNUM;
    }

    @Override
    public UnaryFunction<BigDecimal> sin() {
        return BigMath.SIN;
    }

    @Override
    public UnaryFunction<BigDecimal> sinh() {
        return BigMath.SINH;
    }

    @Override
    public UnaryFunction<BigDecimal> sqrt() {
        return BigMath.SQRT;
    }

    @Override
    public UnaryFunction<BigDecimal> sqrt1px2() {
        return BigMath.SQRT1PX2;
    }

    @Override
    public BinaryFunction<BigDecimal> subtract() {
        return BigMath.SUBTRACT;
    }

    @Override
    public UnaryFunction<BigDecimal> tan() {
        return BigMath.TAN;
    }

    @Override
    public UnaryFunction<BigDecimal> tanh() {
        return BigMath.TANH;
    }

    @Override
    public UnaryFunction<BigDecimal> value() {
        return BigMath.VALUE;
    }

}


text:
<?php

// Namespace

namespace fbenard\Material\Classes;

/**
 *
 */

abstract class AbstractQueryTransformer
{
	/**
	 *
	 */

	abstract public function transform($query, $connection);

	/**
	 *
	 */

	protected function buildResult($result, $separator = ' ')
	{
		// Ensure result is an array

		if (is_array($result) === false)
		{
			$result = [];
		}

		// Remove empty items from the result

		foreach ($result as $key => &$value)
		{
			if (is_null($value) === true)
			{
				unset($result[$key]);
			}
		}

		// Convert result into a string

		$result = implode($separator, $result);

		return $result;
	}
}

?>


text:
package io.jooby.internal.pac4j;

import static java.util.regex.Pattern.CASE_INSENSITIVE;
import static java.util.regex.Pattern.compile;

import java.util.regex.Pattern;

import org.pac4j.core.context.WebContext;
import org.pac4j.core.http.url.UrlResolver;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import io.jooby.pac4j.Pac4jContext;

public class UrlResolverImpl implements UrlResolver {

  private static final Pattern HTTP_URL = compile("^https?:.*", CASE_INSENSITIVE);

  private final Logger log = LoggerFactory.getLogger(getClass());

  @Override
  public String compute(String path, WebContext context) {
    if (context == null) {
      if (!HTTP_URL.matcher(path).matches()) {
        log.warn(
            "Unable to resolve URL from path '{}' since no web context was provided. This may"
                + " prevent some authentication clients to work properly. Consider explicitly"
                + " specifying an absolute callback URL or using a custom url resolver.",
            path);
      }

      return path;
    }

    String requestURL = ((Pac4jContext) context).getContext().getRequestURL(path);
    // no query String
    int i = requestURL.indexOf('?');
    return i > 0 ? requestURL.substring(0, i) : requestURL;
  }
}


text:
In diesem Teil des Robotik Tutorials geht es um Sensoren. Ein Roboter ohne Sensoren ist quasi blind und taub. Er kann seine Umgebung nicht wahrnehmen und würde gegen jedes Hindernis fahren, das sich in seinem Weg befindet.

![Intro](../images/slide3.png)

Es gibt Sensoren für verschiedene Aufgaben, z.B. um Hindernisse zu erkennen oder Linien- Sensoren um den Roboter einer dunklen Linie auf  hellem Grund folgen zu lassen.

## Tutorials

* [Licht-Sensor](exercises/ldr)
* [Ultraschall-Sensor](exercises/ultrasonic)
* [Linien-Sensor](exercises/line-sensor)

## Weiterführende Themen

Leider ist der Roboter Kopf noch etwas starr. es wäre schön, wenn er auch seinen Kopf auch bewegen könnte. Damit kann der Kopf des Roboters vorprogrammierte Bewegungen durchführen. Servos lernen wir im Tutorial über [Roboter Antriebe](/actors) kennen.

Weiterhin wäre es schön, wenn der Roboter Anzeigen hätte, mit denen er . Näheres dazu lernt man im Kapitel über [Roboter Anzeigen](/displays).

Alles zusammen ergibt erst einen kompletten Roborer. Im Kapitel [komplette Roboter](/robots) werden einige Beispiele vorgestellt.


text:
bool CheckCbTx(const CTransaction& tx, const CBlockIndex* pindexPrev, CValidationState& state)
{
    if (tx.nType != TRANSACTION_COINBASE) {
        return state.DoS(100, false, REJECT_INVALID, "bad-cbtx-type");
    }

    if (!tx.IsCoinBase()) {
        return state.DoS(100, false, REJECT_INVALID, "bad-cbtx-invalid");
    }

    CCbTx cbTx;
    if (!GetTxPayload(tx, cbTx)) {
        return state.DoS(100, false, REJECT_INVALID, "bad-cbtx-payload");
    }

    if (cbTx.nVersion == 0 || cbTx.nVersion > CCbTx::CURRENT_VERSION) {
        return state.DoS(100, false, REJECT_INVALID, "bad-cbtx-version");
    }

    if (pindexPrev && pindexPrev->nHeight + 1 != cbTx.nHeight) {
        return state.DoS(100, false, REJECT_INVALID, "bad-cbtx-height");
    }

    if (pindexPrev) {
        bool fDIP0008Active = pindexPrev->nHeight + 1 >= Params().GetConsensus().DIP0008Height;
        if (fDIP0008Active && cbTx.nVersion < 2) {
            return state.DoS(100, false, REJECT_INVALID, "bad-cbtx-version");
        }
    }

    return true;
}

// This can only be done after the block has been fully processed, as otherwise we won't have the finished MN list
bool CheckCbTxMerkleRoots(const CBlock& block, const CBlockIndex* pindex, CValidationState& state)
{
    if (block.vtx[0]->nType != TRANSACTION_COINBASE) {
        return true;
    }

    static int64_t nTimePayload = 0;
    static int64_t nTimeMerkleMNL = 0;
    static int64_t nTimeMerkleQuorum = 0;

    int64_t nTime1 = GetTimeMicros();

    CCbTx cbTx;
    if (!GetTxPayload(*block.vtx[0], cbTx)) {
        return state.DoS(100, false, REJECT_INVALID, "bad-cbtx-payload");
    }

    int64_t nTime2 = GetTimeMicros(); nTimePayload += nTime2 - nTime1;
    LogPrint(BCLog::BENCHMARK, "          - GetTxPayload: %.2fms [%.2fs]\n", 0.001 * (nTime2 - nTime1), nTimePayload * 0.000001);

    if (pindex) {
        uint256 calculatedMerkleRoot;
        if (!CalcCbTxMerkleRootMNList(block, pindex->pprev, calculatedMerkleRoot, state)) {
            return state.DoS(100, false, REJECT_INVALID, "bad-cbtx-mnmerkleroot");
        }
        if (calculatedMerkleRoot != cbTx.merkleRootMNList) {
            return state.DoS(100, false, REJECT_INVALID, "bad-cbtx-mnmerkleroot");
        }

        int64_t nTime3 = GetTimeMicros(); nTimeMerkleMNL += nTime3 - nTime2;
        LogPrint(BCLog::BENCHMARK, "          - CalcCbTxMerkleRootMNList: %.2fms [%.2fs]\n", 0.001 * (nTime3 - nTime2), nTimeMerkleMNL * 0.000001);

        if (cbTx.nVersion >= 2) {
            if (!CalcCbTxMerkleRootQuorums(block, pindex->pprev, calculatedMerkleRoot, state)) {
                return state.DoS(100, false, REJECT_INVALID, "bad-cbtx-quorummerkleroot");
            }
            if (calculatedMerkleRoot != cbTx.merkleRootQuorums) {
                return state.DoS(100, false, REJECT_INVALID, "bad-cbtx-quorummerkleroot");
            }
        }

        int64_t nTime4 = GetTimeMicros(); nTimeMerkleQuorum += nTime4 - nTime3;
        LogPrint(BCLog::BENCHMARK, "          - CalcCbTxMerkleRootQuorums: %.2fms [%.2fs]\n", 0.001 * (nTime4 - nTime3), nTimeMerkleQuorum * 0.000001);

    }

    return true;
}

bool CalcCbTxMerkleRootMNList(const CBlock& block, const CBlockIndex* pindexPrev, uint256& merkleRootRet, CValidationState& state)
{
    LOCK(deterministicMNManager->cs);

    static int64_t nTimeDMN = 0;
    static int64_t nTimeSMNL = 0;
    static int64_t nTimeMerkle = 0;

    int64_t nTime1 = GetTimeMicros();

    CDeterministicMNList tmpMNList;
    if (!deterministicMNManager->BuildNewListFromBlock(block, pindexPrev, state, tmpMNList, false)) {
        return false;
    }

    int64_t nTime2 = GetTimeMicros(); nTimeDMN += nTime2 - nTime1;
    LogPrint(BCLog::BENCHMARK, "            - BuildNewListFromBlock: %.2fms [%.2fs]\n", 0.001 * (nTime2 - nTime1), nTimeDMN * 0.000001);

    CSimplifiedMNList sml(tmpMNList);

    int64_t nTime3 = GetTimeMicros(); nTimeSMNL += nTime3 - nTime2;
    LogPrint(BCLog::BENCHMARK, "            - CSimplifiedMNList: %.2fms [%.2fs]\n", 0.001 * (nTime3 - nTime2), nTimeSMNL * 0.000001);

    static CSimplifiedMNList smlCached;
    static uint256 merkleRootCached;
    static bool mutatedCached{false};

    if (sml.mnList == smlCached.mnList) {
        merkleRootRet = merkleRootCached;
        return !mutatedCached;
    }

    bool mutated = false;
    merkleRootRet = sml.CalcMerkleRoot(&mutated);

    int64_t nTime4 = GetTimeMicros(); nTimeMerkle += nTime4 - nTime3;
    LogPrint(BCLog::BENCHMARK, "            - CalcMerkleRoot: %.2fms [%.2fs]\n", 0.001 * (nTime4 - nTime3), nTimeMerkle * 0.000001);

    smlCached = std::move(sml);
    merkleRootCached = merkleRootRet;
    mutatedCached = mutated;

    return !mutated;
}

bool CalcCbTxMerkleRootQuorums(const CBlock& block, const CBlockIndex* pindexPrev, uint256& merkleRootRet, CValidationState& state)
{
    static int64_t nTimeMinedAndActive = 0;
    static int64_t nTimeMined = 0;
    static int64_t nTimeLoop = 0;
    static int64_t nTimeMerkle = 0;

    int64_t nTime1 = GetTimeMicros();

    static std::map<Consensus::LLMQType, std::vector<const CBlockIndex*>> quorumsCached;
    static std::map<Consensus::LLMQType, std::vector<uint256>> qcHashesCached;

    // The returned quorums are in reversed order, so the most recent one is at index 0
    auto quorums = llmq::quorumBlockProcessor->GetMinedAndActiveCommitmentsUntilBlock(pindexPrev);
    std::map<Consensus::LLMQType, std::vector<uint256>> qcHashes;
    size_t hashCount = 0;

    int64_t nTime2 = GetTimeMicros(); nTimeMinedAndActive += nTime2 - nTime1;
    LogPrint(BCLog::BENCHMARK, "            - GetMinedAndActiveCommitmentsUntilBlock: %.2fms [%.2fs]\n", 0.001 * (nTime2 - nTime1), nTimeMinedAndActive * 0.000001);

    if (quorums == quorumsCached) {
        qcHashes = qcHashesCached;
    } else {
        for (const auto& p : quorums) {
            auto& v = qcHashes[p.first];
            v.reserve(p.second.size());
            for (const auto& p2 : p.second) {
                llmq::CFinalCommitment qc;
                uint256 minedBlockHash;
                bool found = llmq::quorumBlockProcessor->GetMinedCommitment(p.first, p2->GetBlockHash(), qc, minedBlockHash);
                assert(found);
                v.emplace_back(::SerializeHash(qc));
                hashCount++;
            }
        }
        quorumsCached = quorums;
        qcHashesCached = qcHashes;
    }

    int64_t nTime3 = GetTimeMicros(); nTimeMined += nTime3 - nTime2;
    LogPrint(BCLog::BENCHMARK, "            - GetMinedCommitment: %.2fms [%.2fs]\n", 0.001 * (nTime3 - nTime2), nTimeMined * 0.000001);

    // now add the commitments from the current block, which are not returned by GetMinedAndActiveCommitmentsUntilBlock
    // due to the use of pindexPrev (we don't have the tip index here)
    for (size_t i = 1; i < block.vtx.size(); i++) {
        auto& tx = block.vtx[i];

        if (tx->nVersion == 3 && tx->nType == TRANSACTION_QUORUM_COMMITMENT) {
            llmq::CFinalCommitmentTxPayload qc;
            if (!GetTxPayload(*tx, qc)) {
                assert(false);
            }
            if (qc.commitment.IsNull()) {
                continue;
            }
            auto qcHash = ::SerializeHash(qc.commitment);
            const auto& params = Params().GetConsensus().llmqs.at((Consensus::LLMQType)qc.commitment.llmqType);
            auto& v = qcHashes[params.type];
            if (v.size() == params.signingActiveQuorumCount) {
                // we pop the last entry, which is actually the oldest quorum as GetMinedAndActiveCommitmentsUntilBlock
                // returned quorums in reversed order. This pop and later push can only work ONCE, but we rely on the
                // fact that a block can only contain a single commitment for one LLMQ type
                v.pop_back();
            }
            v.emplace_back(qcHash);
            hashCount++;
            assert(v.size() <= params.signingActiveQuorumCount);
        }
    }

    std::vector<uint256> qcHashesVec;
    qcHashesVec.reserve(hashCount);

    for (const auto& p : qcHashes) {
        for (const auto& h : p.second) {
            qcHashesVec.emplace_back(h);
        }
    }
    std::sort(qcHashesVec.begin(), qcHashesVec.end());

    int64_t nTime4 = GetTimeMicros(); nTimeLoop += nTime4 - nTime3;
    LogPrint(BCLog::BENCHMARK, "            - Loop: %.2fms [%.2fs]\n", 0.001 * (nTime4 - nTime3), nTimeLoop * 0.000001);

    bool mutated = false;
    merkleRootRet = ComputeMerkleRoot(qcHashesVec, &mutated);

    int64_t nTime5 = GetTimeMicros(); nTimeMerkle += nTime5 - nTime4;
    LogPrint(BCLog::BENCHMARK, "            - ComputeMerkleRoot: %.2fms [%.2fs]\n", 0.001 * (nTime5 - nTime4), nTimeMerkle * 0.000001);

    return !mutated;
}

std::string CCbTx::ToString() const
{
    return strprintf("CCbTx(nHeight=%d, nVersion=%d, merkleRootMNList=%s, merkleRootQuorums=%s)",
        nVersion, nHeight, merkleRootMNList.ToString(), merkleRootQuorums.ToString());
}


text:
<?php

/**
 * Zend_Config_Ini
 */
require_once 'Zend/Config/Ini.php';

/**
 * @category   Zend
 * @package    Zend_Config
 * @subpackage UnitTests
 * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 * @group      Zend_Config
 */
class Zend_Config_IniTest extends PHPUnit_Framework_TestCase
{
    protected $_iniFileConfig;
    protected $_iniFileAllSectionsConfig;
    protected $_iniFileCircularConfig;

    public function setUp()
    {
        $this->_iniFileConfig = dirname(__FILE__) . '/_files/config.ini';
        $this->_iniFileAllSectionsConfig = dirname(__FILE__) . '/_files/allsections.ini';
        $this->_iniFileCircularConfig = dirname(__FILE__) . '/_files/circular.ini';
        $this->_iniFileMultipleInheritanceConfig = dirname(__FILE__) . '/_files/multipleinheritance.ini';
        $this->_iniFileSeparatorConfig = dirname(__FILE__) . '/_files/separator.ini';
        $this->_nonReadableConfig = dirname(__FILE__) . '/_files/nonreadable.ini';
        $this->_iniFileNoSectionsConfig = dirname(__FILE__) . '/_files/nosections.ini';
        $this->_iniFileInvalid = dirname(__FILE__) . '/_files/invalid.ini';
    }

    public function testLoadSingleSection()
    {
        $config = new Zend_Config_Ini($this->_iniFileConfig, 'all');

        $this->assertEquals('all', $config->hostname);
        $this->assertEquals('live', $config->db->name);
        $this->assertEquals('multi', $config->one->two->three);
        $this->assertNull(@$config->nonexistent); // property doesn't exist
    }

    public function testSectionInclude()
    {
        $config = new Zend_Config_Ini($this->_iniFileConfig, 'staging');

        $this->assertEquals('', $config->debug); // only in staging
        $this->assertEquals('thisname', $config->name); // only in all
        $this->assertEquals('username', $config->db->user); // only in all (nested version)
        $this->assertEquals('staging', $config->hostname); // inherited and overridden
        $this->assertEquals('dbstaging', $config->db->name); // inherited and overridden
    }

    public function testTrueValues()
    {
        $config = new Zend_Config_Ini($this->_iniFileConfig, 'debug');

        $this->assertType('string', $config->debug);
        $this->assertEquals('1', $config->debug);
        $this->assertType('string', $config->values->changed);
        $this->assertEquals('1', $config->values->changed);
    }

    public function testEmptyValues()
    {
        $config = new Zend_Config_Ini($this->_iniFileConfig, 'debug');

        $this->assertType('string', $config->special->no);
        $this->assertEquals('', $config->special->no);
        $this->assertType('string', $config->special->null);
        $this->assertEquals('', $config->special->null);
        $this->assertType('string', $config->special->false);
        $this->assertEquals('', $config->special->false);
    }

    public function testMultiDepthExtends()
    {
        $config = new Zend_Config_Ini($this->_iniFileConfig, 'other_staging');

        $this->assertEquals('otherStaging', $config->only_in); // only in other_staging
        $this->assertEquals('', $config->debug); // 1 level down: only in staging
        $this->assertEquals('thisname', $config->name); // 2 levels down: only in all
        $this->assertEquals('username', $config->db->user); // 2 levels down: only in all (nested version)
        $this->assertEquals('staging', $config->hostname); // inherited from two to one and overridden
        $this->assertEquals('dbstaging', $config->db->name); // inherited from two to one and overridden
        $this->assertEquals('anotherpwd', $config->db->pass); // inherited from two to other_staging and overridden
    }

    public function testErrorNoExtendsSection()
    {
        try {
            $config = new Zend_Config_Ini($this->_iniFileConfig, 'extendserror');
            $this->fail('An expected Zend_Config_Exception has not been raised');
        } catch (Zend_Config_Exception $expected) {
            $this->assertContains('cannot be found', $expected->getMessage());
        }
    }

    public function testInvalidKeys()
    {
        $sections = array('leadingdot', 'onedot', 'twodots', 'threedots', 'trailingdot');
        foreach ($sections as $section) {
            try {
                $config = new Zend_Config_Ini($this->_iniFileConfig, $section);
                $this->fail('An expected Zend_Config_Exception has not been raised');
            } catch (Zend_Config_Exception $expected) {
                $this->assertContains('Invalid key', $expected->getMessage());
            }
        }
    }

    public function testZF426()
    {
        try {
            $config = new Zend_Config_Ini($this->_iniFileConfig, 'zf426');
            $this->fail('An expected Zend_Config_Exception has not been raised');
        } catch (Zend_Config_Exception $expected) {
            $this->assertContains('Cannot create sub-key for', $expected->getMessage());
        }
    }

    public function testZF413_MultiSections()
    {
        $config = new Zend_Config_Ini($this->_iniFileAllSectionsConfig, array('staging','other_staging'));

        $this->assertEquals('otherStaging', $config->only_in);
        $this->assertEquals('staging', $config->hostname);

    }

    public function testZF413_AllSections()
    {
        $config = new Zend_Config_Ini($this->_iniFileAllSectionsConfig, null);
        $this->assertEquals('otherStaging', $config->other_staging->only_in);
        $this->assertEquals('staging', $config->staging->hostname);
    }

    public function testZF414()
    {
        $config = new Zend_Config_Ini($this->_iniFileAllSectionsConfig, null);
        $this->assertEquals(null, $config->getSectionName());
        $this->assertEquals(true, $config->areAllSectionsLoaded());

        $config = new Zend_Config_Ini($this->_iniFileAllSectionsConfig, 'all');
        $this->assertEquals('all', $config->getSectionName());
        $this->assertEquals(false, $config->areAllSectionsLoaded());

        $config = new Zend_Config_Ini($this->_iniFileAllSectionsConfig, array('staging','other_staging'));
        $this->assertEquals(array('staging','other_staging'), $config->getSectionName());
        $this->assertEquals(false, $config->areAllSectionsLoaded());
    }

    public function testZF415()
    {
        try {
            $config = new Zend_Config_Ini($this->_iniFileCircularConfig, null);
            $this->fail('An expected Zend_Config_Exception has not been raised');
        } catch (Zend_Config_Exception $expected) {
            $this->assertContains('circular inheritance', $expected->getMessage());
        }
    }

    public function testErrorNoFile()
    {
        try {
            $config = new Zend_Config_Ini('','');
            $this->fail('An expected Zend_Config_Exception has not been raised');
        } catch (Zend_Config_Exception $expected) {
            $this->assertContains('Filename is not set', $expected->getMessage());
        }
    }

    public function testErrorMultipleExensions()
    {
        try {
            $config = new Zend_Config_Ini($this->_iniFileMultipleInheritanceConfig, 'three');
            zend::dump($config);
            $this->fail('An expected Zend_Config_Exception has not been raised');
        } catch (Zend_Config_Exception $expected) {
            $this->assertContains('may not extend multiple sections', $expected->getMessage());
        }
    }

    public function testErrorNoSectionFound()
    {
        try {
            $config = new Zend_Config_Ini($this->_iniFileConfig,array('all', 'notthere'));
            $this->fail('An expected Zend_Config_Exception has not been raised');
        } catch (Zend_Config_Exception $expected) {
            $this->assertContains('cannot be found', $expected->getMessage());
        }

        try {
            $config = new Zend_Config_Ini($this->_iniFileConfig,'notthere');
            $this->fail('An expected Zend_Config_Exception has not been raised');
        } catch (Zend_Config_Exception $expected) {
            $this->assertContains('cannot be found', $expected->getMessage());
        }

    }

    public function testZF739()
    {
        if (version_compare('5.3.0', PHP_VERSION) < 1) {
            $this->markTestSkipped('PHP >= 5.3.0 does not allow : as a nest separator');
            return;
        }

        $config = new Zend_Config_Ini($this->_iniFileSeparatorConfig, 'all', array('nestSeparator'=>':'));

        $this->assertEquals('all', $config->hostname);
        $this->assertEquals('live', $config->db->name);
        $this->assertEquals('multi', $config->one->two->three);
    }

    public function testZF2508NoSections()
    {
        $config = new Zend_Config_Ini($this->_iniFileNoSectionsConfig);

        $this->assertEquals('all', $config->hostname);
        $this->assertEquals('two', $config->one->two);
        $this->assertEquals('4', $config->one->three->four);
        $this->assertEquals('5', $config->one->three->five);
    }

    public function testZF2843NoSectionNoTree()
    {
        $filename = dirname(__FILE__) . '/_files/zf2843.ini';
        $config = new Zend_Config_Ini($filename, null, array('nestSeparator' => '.'));

        $this->assertEquals('123', $config->abc);
        $this->assertEquals('jkl', $config->ghi);
    }

    public function testZF3196_InvalidIniFile()
    {
        try {
            $config = new Zend_Config_Ini($this->_iniFileInvalid);
            $this->fail('An expected Zend_Config_Exception has not been raised');
        } catch (Zend_Config_Exception $expected) {
            $this->assertRegexp('/(Error parsing|syntax error, unexpected)/', $expected->getMessage());
        }

    }

    /**
     * @group ZF-8159
     */
    public function testZF8159()
    {
        $config = new Zend_Config_Ini(
            dirname(__FILE__) . '/_files/zf8159.ini',
            array('first', 'second')
        );

        $this->assertTrue(isset(
           $config->user->login->elements->password
        ));

        $this->assertEquals(
            'password',
            $config->user->login->elements->password->type
        );
    }

    /*
     * @group ZF-5800
     *
     */
    public function testArraysOfKeysCreatedUsingAttributesAndKeys()
    {
        $filename = dirname(__FILE__) . '/_files/zf5800.ini';
        $config = new Zend_Config_Ini($filename, 'dev');
        $this->assertEquals('nice.guy@company.com', $config->receiver->{0}->mail);
        $this->assertEquals('1', $config->receiver->{0}->html);
        $this->assertNull($config->receiver->mail);
    }

    /*
     * @group ZF-6508
     */
    public function testPreservationOfIntegerKeys()
    {
        $filename = dirname(__FILE__) . '/_files/zf6508.ini';
        $config = new Zend_Config_Ini($filename, 'all');
        $this->assertEquals(true, isset($config->{1002}));

    }

}


text:
#if defined(MBED_CONF_RTOS_PRESENT)

#include <inttypes.h>
#include "mbed.h"
#include "mbed_stats.h"
#include "greentea-client/test_env.h"
#include "unity.h"
#include "utest.h"

#include "NetworkInterface.h"
#include "EMAC.h"
#include "EMACMemoryManager.h"
#include "emac_TestMemoryManager.h"
#include "emac_TestNetworkStack.h"
#include "emac_initialize.h"
#include "emac_tests.h"
#include "emac_util.h"

using namespace utest::v1;

static unsigned char eth_mac_addr[ETH_MAC_ADDR_LEN];
EMAC *emac_handle = NULL;

void test_emac_initialize()
{
    worker_loop_init();

    static NetworkInterface *network_interface = NetworkInterface::get_default_instance();

#define WIFI 2
#if MBED_CONF_TARGET_NETWORK_DEFAULT_INTERFACE_TYPE == WIFI
#if MBED_CONF_APP_WIFI_SCAN
    WiFiAccessPoint ap[30];

    int size = network_interface->wifiInterface()->scan(ap, 30);

    for (int i = 0; i < size; i++) {
        const char *ssid = ap[i].get_ssid();
        nsapi_security_t security = ap[i].get_security();
        int8_t rssi = ap[i].get_rssi();
        char ch = ap[i].get_channel();

        printf("BS %i\r\n", i);
        printf("ssid %s\r\n", ssid);
        printf("security %i\r\n", security);
        printf("rssi %i\r\n", rssi);
        printf("ch %i\r\n\r\n", ch);
    }
#endif
#endif

    // Power up the interface and emac driver
    TEST_ASSERT_EQUAL_INT(NSAPI_ERROR_OK, network_interface->connect());

    worker_loop_link_up_wait();
}

unsigned char *emac_if_get_hw_addr(void)
{
    return &eth_mac_addr[0];
}

EMAC *emac_if_get(void)
{
    return emac_handle;
}

EmacTestMemoryManager *emac_m_mngr_get(void)
{
    return &EmacTestMemoryManager::get_instance();
}

bool emac_if_init(EMAC *emac)
{
    emac_handle = emac;

    emac->set_link_input_cb(emac_if_link_input_cb);
    emac->set_link_state_cb(emac_if_link_state_change_cb);

    if (!emac->power_up()) {
        TEST_ASSERT_MESSAGE(0, "emac power up failed!");
    }

    int hwaddr_len = emac->get_hwaddr_size();
    printf("emac hwaddr length %i\r\n\r\n", hwaddr_len);

    TEST_ASSERT_MESSAGE(hwaddr_len == 6, "invalid emac hwaddr length!");

    // If driver updates this, write it back, otherwise write default from mbed_mac_address
    mbed_mac_address(reinterpret_cast<char *>(&eth_mac_addr[0]));
    emac->get_hwaddr(eth_mac_addr);
    emac->set_hwaddr(eth_mac_addr);
    printf("emac hwaddr %x:%x:%x:%x:%x:%x\r\n\r\n", eth_mac_addr[0], eth_mac_addr[1], eth_mac_addr[2], eth_mac_addr[3], eth_mac_addr[4], eth_mac_addr[5]);

    int mtu_size = emac->get_mtu_size();
    printf("emac mtu %i\r\n\r\n", mtu_size);
    emac_if_set_mtu_size(mtu_size);

    char hw_name[11];
    emac->get_ifname(hw_name, 10);
    printf("emac if name %s\r\n\r\n", hw_name);

    return true;
}
#endif // defined(MBED_CONF_RTOS_PRESENT)


text:
package models;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Lob;

import play.data.validation.Constraints;

import java.io.File;
import java.io.InputStream;
import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.IOException;

/**
 * Image holds the image associated with a magician, routine, or material.
 * Images are not required.
 * cited source: https://github.com/DirtyDan88/play-framework-blob
 */
@Entity
public class Image extends play.db.ebean.Model {
  private static final long serialVersionUID = 1L;

  /** The image id. */
  @Id
  public long id;

  /** The image name. */
  @Constraints.Required
  public String name;

  /** The image data. */
  @Lob
  public byte[] data;

  /**
   * The EBean ORM finder method for database queries.
   *
   * @return The finder method.
   */
  public static Finder<Long, Image> find() {
    return new Finder<Long, Image>(Long.class, Image.class);
  }

  /**
   * Creates a new image entity.
   * @param name The name of the image.
   * @param image The byte array with the image data.
   */
  public Image(String name, File image) {
    this.name = name;
    this.data = new byte[(int) image.length()];

    /* write the image data into the byte array */
    InputStream inStream = null;
    try {
      inStream = new BufferedInputStream(new FileInputStream(image));
      inStream.read(this.data);
    }
    catch (IOException e) {
      e.printStackTrace();
    }
    finally {
      if (inStream != null) {
        try {
          inStream.close();
        }
        catch (IOException e) {
          e.printStackTrace();
        }
      }
    }

    this.save();
  }
}


text:
Gráficas Mensuales

 0'	class="table table-striped table-bordered" style="display: none;">

			Plagas
			Organismos Beneficos

 0'	class="table table-striped table-bordered" style="display: none;">

			Fecha del registro
			Promedio de Población de Plagas
			Promedio de Población de Organismos Benéficos

<link rel="stylesheet" href="../../content/css/jchartfx.css" />


text:
'use strict'

const _ = require('lodash')
const db = require('../util/db')

module.exports = [{
  method: 'get',
  path: '/api/messages',
  * handler() {
    this.body = yield getBy(this.query)
  }
}]

_.assign(module.exports, {
  insert,
  getBy
})

function insert(o, returning = '*') {
  return db('message').insert(o).returning(returning)
}

function getBy(query = {}, fields = '*') {
  const q = db('message')
    .select(fields)
    .where('id', '>', 0)
  if (+query.earliest) {
    q.andWhere('id', '<', +query.earliest)
  }
  return q
    .orderBy('id', 'desc')
    .limit(20)
}


text:
package io.xlate.edi.stream;

/**
 * This interface is used to report non-fatal errors detected in an EDI input.
 *
 * @since 1.9
 */
public interface EDIInputErrorReporter {
    /**
     * Report the desired message in an application specific format. Only
     * warnings and non-fatal errors should be reported through this interface.
     *
     * Fatal errors will be thrown as EDIStreamException.
     *
     * @param errorType
     *            the type of error detected
     * @param reader
     *            the EDIStreamReader that encountered the error
     * @throws EDIStreamException
     *             when errors occur calling the reader
     */
    void report(EDIStreamValidationError errorType, EDIStreamReader reader) throws EDIStreamException;
}


text:
Conrtol de Acceso por IP

En esta página puede controlar qué direcciones IP tienen permiso para
acceder a su servidor Jabber. Si se introduce alguna dirección en la
sección IP de cliente permitidas, entonces sólo se concederá permiso
a esas direcciones - el resto de direcciones no tendrán permiso para
conectar. Sin embargo, cualquier dirección IP listada en la sección IP
de cliente denegadas será bloqueada, tanto si aparece en la lista de
direcciones permitidas como si no.

Ambos campos aceptan direcciones IP (como 1.2.3.4) o parejas de IP/máscara
(como 1.2.3.0/255.255.255.0) para especificar redes enteras.


text:
(function($){

Link = function(openshift, name, data)
{
	this.openshift = openshift;
	this.name = name;
	this.data = data;
};

Link.prototype.call = function(success, options)
{
	var _cb = null;

	if (typeof options === 'object' && typeof options.auth_error === 'function') {
		_cb = options.auth_error;
	} else if (typeof this.openshift.auth_error === 'function') {
		_cb = this.openshift.auth_error;
	}

	var auth_error_cb = _cb ? function(link) {
		return function(data, status, xhr) {
			_cb(link, data, status, xhr);
		}
	} : undefined;

	var success_cb = success ? function(link) {
		return function(data, status, xhr) {
			success(link, data, status, xhr);
		}
	} : undefined;

	var settings = {};

	$.extend(settings, options);
	settings.success    = success_cb(this);
	settings.type       = this.data.method;
	settings.statusCode = { 401: auth_error_cb(this) }
	settings.beforeSend = function (xhr) {
		if (this.openshift.auth_token) {
			xhr.setRequestHeader('Authorization', 'Bearer ' + this.openshift.auth_token);
		}
	}.bind(this);

	var xhr = $.ajax(this.data.href, settings);
	xhr.openshift = this.openshift;

	return xhr;
};

Endpoint = function(openshift, data, link_extractor)
{
	this.openshift = openshift;
	this.data  = data;

	var le = typeof link_extractor === 'function' ? link_extractor : generic_link_extractor;
	this.links = le(this);
};

var generic_link_extractor = function(endpoint)
{
	var _links = null;
	if (endpoint.data.type == 'links') {
		_links = endpoint.data.data;
	} else {
		return object_list_link_extractor(endpoint);
	}

	var links = {};
	for (var name in _links) {
		links[name] = new Link(endpoint.openshift, name, _links[name]);
	}
	return links;
};

var object_list_link_extractor = function(endpoint)
{
	var data = endpoint.data.data;
	var links = {};
	for (var i in data) {
		links[data[i].id] = data[i].links;
	}
	return links;
};

String.prototype.stripRight = function(ch)
{
	var str = this.substr(0);
	while (str.length && str.substr(-1)==='/') {
		str = str.substr(0, str.length - 1);
	}
	return str;
}

OpenShift = function(options) {
	this.cache = {
		//domains: $.cookie('domains')
	};

	var opts = options ? options : {};
	this.auth_token = opts.auth_token;
	this.broker_url = opts.broker_url.stripRight('/');
	this.auth_error = opts.auth_error || function(openshift) {
		console.log('Unauthorized', openshift);
	};
	this.ready = opts.ready || function(openshift){};

	// standard endpoints
	this.api            = null;
	this.authorizations = null;
	this.applications   = null;

	$.getJSON(this.url('api'))
		.success(function(data, status, xhr) {
			console.log('api:', data);
			this.api = new Endpoint(this, data);
			this.ready(this);
		}.bind(this));
};

OpenShift.prototype.url = function(suffix)
{
	return this.broker_url + '/' + suffix + '.json';
};

OpenShift.prototype.list_authorizations = function(options)
{
	console.log("list_authorizations", options);

	var success = function(link, data, status, xhr) {
		this.authorizations = new Endpoint(link.openshift, data);
		if (options && typeof options.success === 'function') {
			options.success(link, data, status, xhr);
		}
	}.bind(this);

	this.api.links.LIST_AUTHORIZATIONS.call(success, options);
};

OpenShift.prototype.get_or_add_authorization = function(options) {
	var tokens = this.authorizations.data.data.filter(
		function (token) {
			return token.note.trim().toLowerCase() === 'getupcloud console' ? token : false;
		});

	if (tokens.length) {
		options.success(tokens[0].token);
	} else {
		this.set_auth_token(null);
		var auth_options = $.extend({}, options);
		auth_options.success = options.success;
		auth_options.data    = {
				scope: 'session',
				reuse: true,
			}
		this.add_authorization(auth_options);
		//TODO: criar token
	}
};

OpenShift.prototype.add_authorization = function(options)
{
	console.log("add_authorization", options);

	var success = function(link, data, status, xhr) {
		if (options && typeof options.success === 'function') {
			options.success(link, data, status, xhr);
		}
	}.bind(this);

	this.api.links.ADD_AUTHORIZATION.call(success, options);
};

OpenShift.prototype.set_auth_token = function(token)
{
	this.auth_token = token;
};

OpenShift.prototype.list_applications = function(options)
{
	console.log("list_applications", options);

	var success = function(link, data, status, xhr) {
		this.applications = new Endpoint(link.openshift, data);
		if (options && typeof options.success === 'function') {
			options.success(link, data, status, xhr);
		}
	}.bind(this);

	this.api.links.LIST_APPLICATIONS.call(success, options);
};

OpenShift.prototype.list_domains = function(options)
{
	console.log("list_domains", options);

	var success = function(link, data, status, xhr) {
		this.domains = new Endpoint(link.openshift, data);
		if (options && typeof options.success === 'function') {
			options.success(link, data, status, xhr);
		}
	}.bind(this);

	this.api.links.LIST_DOMAINS.call(success, options);
};

OpenShift.prototype.list_cartridges = function(options)
{
	console.log("list_cartridges", options);

	var success = function(link, data, status, xhr) {
		this.cartridges = new Endpoint(link.openshift, data);
		if (options && typeof options.success === 'function') {
			options.success(link, data, status, xhr);
		}
	}.bind(this);

	this.api.links.LIST_CARTRIDGES.call(success, options);
};

})(jQuery);


text:
from __future__ import unicode_literals

from django.db import migrations, models

def raise_error(apps, schema_editor):
    # Test atomic operation in non-atomic migration is wrapped in transaction
    Editor = apps.get_model('migrations', 'Editor')
    Editor.objects.create(name='Test Editor')
    raise RuntimeError('Abort migration')

class Migration(migrations.Migration):
    atomic = False

    operations = [
        migrations.CreateModel(
            "Editor",
            [
                ("name", models.CharField(primary_key=True, max_length=255)),
            ],
        ),
        migrations.RunPython(raise_error, atomic=True),
    ]


text:
<?php

namespace Symfony\Component\CssSelector\Node;

/**
 * Represents a node specificity.
 *
 * This component is a port of the Python cssselect library,
 * which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
 *
 * @see http://www.w3.org/TR/selectors/#specificity
 *
 * @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
 */
class Specificity
{
    const A_FACTOR = 100;
    const B_FACTOR = 10;
    const C_FACTOR = 1;

    /**
     * @var int
     */
    private $a;

    /**
     * @var int
     */
    private $b;

    /**
     * @var int
     */
    private $c;

    /**
     * Constructor.
     *
     * @param int $a
     * @param int $b
     * @param int $c
     */
    public function __construct($a, $b, $c)
    {
        $this->a = $a;
        $this->b = $b;
        $this->c = $c;
    }

    /**
     * @param Specificity $specificity
     *
     * @return Specificity
     */
    public function plus(Specificity $specificity)
    {
        return new self($this->a + $specificity->a, $this->b + $specificity->b, $this->c + $specificity->c);
    }

    /**
     * Returns global specificity value.
     *
     * @return int
     */
    public function getValue()
    {
        return $this->a * self::A_FACTOR + $this->b * self::B_FACTOR + $this->c * self::C_FACTOR;
    }
}


text:
<!DOCTYPE html>

    <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
    <link rel="stylesheet" href="styles.css">

Curzory Carousel Example

Example headline.

Note: If you're viewing this page via a file:// URL, the "next" and "previous" Glyphicon buttons on the left and right might not load/display properly due to web browser security rules.

Sign up today

Another example headline.

Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.

Learn more

One more for good measure.

Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.

Browse gallery

            Previous

            Next


text:
declare namespace Chai {
    interface Assertion {
        count: (count: number) => void;
        focus: () => void;
        text: (expected: string|number|RegExp) => void;
        there: () => void;
        value: (expected: string|number|RegExp) => void;
        visible: () => void;
        immediately: Assertion;
    }
}

declare module 'chai-webdriverio' {
    function chaiWebdriverIO(client: WebdriverIO.Client<void>, options?: any): (chai: any, utils: any) => void;
    export = chaiWebdriverIO;
}


text:
@echo off
title Doing clean build to all the Project
set BASEDIR=%~sdp0
call %BASEDIR%\setEnv.bat >NUL

pushd %PROJECT_HOME%\apms
    call mvn clean package
popd

call beep.bat
timeout /t 1 >NUL
call beep.bat
timeout /t 1 >NUL
call beep.bat
timeout /t 1 >NUL
call beep.bat
timeout /t 1 >NUL
call beep.bat
timeout /t 1 >NUL

timeout /t 10 >NUL


text:
package org.apache.logging.log4j.core.config.builder;

import java.util.concurrent.TimeUnit;

import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.core.Filter;
import org.apache.logging.log4j.core.appender.ConsoleAppender;
import org.apache.logging.log4j.core.config.builder.api.AppenderComponentBuilder;
import org.apache.logging.log4j.core.config.builder.api.ConfigurationBuilder;
import org.apache.logging.log4j.core.config.builder.api.ConfigurationBuilderFactory;
import org.apache.logging.log4j.core.config.builder.impl.BuiltConfiguration;
import org.junit.Test;

import static org.junit.Assert.*;
import static org.junit.Assume.assumeTrue;

public class ConfigurationBuilderTest {

    private static final String INDENT = "  ";
    private static final String EOL = System.lineSeparator();

    private void addTestFixtures(final String name, final ConfigurationBuilder<BuiltConfiguration> builder) {
        builder.setConfigurationName(name);
        builder.setStatusLevel(Level.ERROR);
        builder.setShutdownTimeout(5000, TimeUnit.MILLISECONDS);
        builder.add(builder.newScriptFile("target/test-classes/scripts/filter.groovy").addIsWatched(true));
        builder.add(builder.newFilter("ThresholdFilter", Filter.Result.ACCEPT, Filter.Result.NEUTRAL)
                .addAttribute("level", Level.DEBUG));

        final AppenderComponentBuilder appenderBuilder = builder.newAppender("Stdout", "CONSOLE").addAttribute("target", ConsoleAppender.Target.SYSTEM_OUT);
        appenderBuilder.add(builder.newLayout("PatternLayout").
                addAttribute("pattern", "%d [%t] %-5level: %msg%n%throwable"));
        appenderBuilder.add(builder.newFilter("MarkerFilter", Filter.Result.DENY,
                Filter.Result.NEUTRAL).addAttribute("marker", "FLOW"));
        builder.add(appenderBuilder);

        final AppenderComponentBuilder appenderBuilder2 = builder.newAppender("Kafka", "Kafka").addAttribute("topic", "my-topic");
        appenderBuilder2.addComponent(builder.newProperty("bootstrap.servers", "localhost:9092"));
        appenderBuilder2.add(builder.newLayout("GelfLayout").
            addAttribute("host", "my-host").
            addComponent(builder.newKeyValuePair("extraField", "extraValue")));
        builder.add(appenderBuilder2);

        builder.add(builder.newLogger("org.apache.logging.log4j", Level.DEBUG, true).
                    add(builder.newAppenderRef("Stdout")).
                    addAttribute("additivity", false));
        builder.add(builder.newRootLogger(Level.ERROR).add(builder.newAppenderRef("Stdout")));

        builder.addProperty("MyKey", "MyValue");
        builder.add(builder.newCustomLevel("Panic", 17));
        builder.setPackages("foo,bar");
    }

    private final static String expectedXml =
            "<?xml version='1.0' encoding='UTF-8'?>" + EOL +
            "<Configuration name=\"config name\" status=\"ERROR\" packages=\"foo,bar\" shutdownTimeout=\"5000\">" + EOL +
                INDENT + "<Properties>" + EOL +
                INDENT + INDENT + "<Property name=\"MyKey\">MyValue</Property>" + EOL +
                INDENT + "</Properties>" + EOL +
                INDENT + "<Scripts>" + EOL +
                INDENT + INDENT + "<ScriptFile name=\"target/test-classes/scripts/filter.groovy\" path=\"target/test-classes/scripts/filter.groovy\" isWatched=\"true\"/>" + EOL +
                INDENT + "</Scripts>" + EOL +
                INDENT + "<CustomLevels>" + EOL +
                INDENT + INDENT + "<CustomLevel name=\"Panic\" intLevel=\"17\"/>" + EOL +
                INDENT + "</CustomLevels>" + EOL +
                INDENT + "<ThresholdFilter onMatch=\"ACCEPT\" onMisMatch=\"NEUTRAL\" level=\"DEBUG\"/>" + EOL +
                INDENT + "<Appenders>" + EOL +
                INDENT + INDENT + "<CONSOLE name=\"Stdout\" target=\"SYSTEM_OUT\">" + EOL +
                INDENT + INDENT + INDENT + "<PatternLayout pattern=\"%d [%t] %-5level: %msg%n%throwable\"/>" + EOL +
                INDENT + INDENT + INDENT + "<MarkerFilter onMatch=\"DENY\" onMisMatch=\"NEUTRAL\" marker=\"FLOW\"/>" + EOL +
                INDENT + INDENT + "</CONSOLE>" + EOL +
                INDENT + INDENT + "<Kafka name=\"Kafka\" topic=\"my-topic\">" + EOL +
                INDENT + INDENT + INDENT + "<Property name=\"bootstrap.servers\">localhost:9092</Property>" + EOL +
                INDENT + INDENT + INDENT + "<GelfLayout host=\"my-host\">" + EOL +
                INDENT + INDENT + INDENT + INDENT + "<KeyValuePair key=\"extraField\" value=\"extraValue\"/>" + EOL +
                INDENT + INDENT + INDENT + "</GelfLayout>" + EOL +
                INDENT + INDENT + "</Kafka>" + EOL +
                INDENT + "</Appenders>" + EOL +
                INDENT + "<Loggers>" + EOL +
                INDENT + INDENT + "<Logger name=\"org.apache.logging.log4j\" level=\"DEBUG\" includeLocation=\"true\" additivity=\"false\">" + EOL +
                INDENT + INDENT + INDENT + "<AppenderRef ref=\"Stdout\"/>" + EOL +
                INDENT + INDENT + "</Logger>" + EOL +
                INDENT + INDENT + "<Root level=\"ERROR\">" + EOL +
                INDENT + INDENT + INDENT + "<AppenderRef ref=\"Stdout\"/>" + EOL +
                INDENT + INDENT + "</Root>" + EOL +
                INDENT + "</Loggers>" + EOL +
            "</Configuration>" + EOL;

    // TODO make test run properly on Windows
    @Test
    public void testXmlConstructing() throws Exception {
        assumeTrue(System.lineSeparator().length() == 1); // Only run test on platforms with single character line endings (such as Linux), not on Windows
        final ConfigurationBuilder<BuiltConfiguration> builder = ConfigurationBuilderFactory.newConfigurationBuilder();
        addTestFixtures("config name", builder);
        final String xmlConfiguration = builder.toXmlConfiguration();
        assertEquals(expectedXml, xmlConfiguration);
    }

}


text:
package net.runelite.client.menus;

import net.runelite.api.widgets.WidgetInfo;

import java.awt.Color;
import net.runelite.client.util.ColorUtil;

public final class WidgetMenuOption
{
	/**
	 * The left hand text to be displayed on the menu option. Ex. the menuOption of "Drop Bones" is "Drop"
	 */
	private String menuOption;
	/**
	 * The right hand text to be displayed on the menu option Ex. the menuTarget of "Drop Bones" is "Bones"
	 */
	private String menuTarget;
	/**
	 * The color that the menuTarget should be. Defaults to the brownish color that most menu options have.
	 */
	private Color color = Color.decode("#ff9040");

	/**
	 * The widget to add the option to
	 */
	private final WidgetInfo widget;

	/**
	 * Creates a menu to be added to right click menus. The menu will only be added if match is found within the menu options
	 *
	 * @param menuOption Option text of this right click option
	 * @param menuTarget Target text of this right click option
	 * @param widget     The widget to attach this option to
	 */
	public WidgetMenuOption(String menuOption, String menuTarget, WidgetInfo widget)
	{
		this.menuOption = menuOption;
		setMenuTarget(menuTarget);
		this.widget = widget;
	}

	public void setMenuOption(String option)
	{
		menuOption = option;
	}

	/**
	 * Sets the target of the menu option. Color code will be added on to target
	 *
	 * @param target The target text without color code.
	 */
	public void setMenuTarget(String target)
	{
		menuTarget = ColorUtil.wrapWithColorTag(target, color);
	}

	public String getMenuOption()
	{
		return menuOption;
	}

	public String getMenuTarget()
	{
		return menuTarget;
	}

	public WidgetInfo getWidget()
	{
		return widget;
	}

	public Color getColor()
	{
		return color;
	}

	public void setColor(Color col)
	{
		color = col;
	}
}


text:
import createFactoryFunction from '../../../../../angular/utilities/create-factory-function.js';
import CardElementController from '../controllers/element.card.js';
import {CardTemplates} from '../../card.js';

class Card {
    constructor($compile, $timeout) {
        this.template = this.templateHTML;
        this.transclude = true;
        this.restrict = 'E';
        this.require = "^ivxjsFormInput";
        this.scope = {
            settings: '=settings'
        }
        this.controller = CardElementController;
        this.controllerAs = 'vm';
        this.replace = true;
        this.link = ($scope, iElm, iAttrs, controller) => {
            let { settings = {} } = $scope;
            let {cardType,classes = ""} = settings;
            let html = new CardTemplates($scope.settings)[cardType + "CardHTML"];

            $scope.classes = classes;

            iElm.html(html);
            $compile(iElm.contents())($scope);
            $timeout(() => {
                $('.special.cards .image').dimmer({
                    on: 'hover'
                });
            }, 0)
        }
    }

    get templateHTML() {
        return `<div class="{{classes}}"></div>`;
    };
}

Card.$inject = ['$compile', '$timeout'];

export default createFactoryFunction(Card);


text:
FileSaver.js
============

FileSaver.js implements the HTML5 W3C `saveAs()` FileSaver interface in browsers that do
not natively support it. There is a [FileSaver.js demo][1] that demonstrates saving
various media types.

FileSaver.js is the solution to saving files on the client-side, and is perfect for
webapps that need to generate files, or for saving sensitive information that shouldn't be
sent to an external server.

Bower Installation
------------------

```bash
bower install FileSaver.js --save-dev
```

Looking for `canvas.toBlob()` for saving canvases? Check out
[canvas-toBlob.js][2] for a cross-browser implementation.

Supported browsers
------------------

| Browser        | Constructs as | Filenames    | Max Blob Size | Dependencies |
| -------------- | ------------- | ------------ | ------------- | ------------ |
| Firefox 20+    | Blob          | Yes          | 800 MiB       | None         |
| Firefox < 20   | data: URI     | No           | n/a           | [Blob.js][5] |
| Chrome         | Blob          | Yes          | [500 MiB][3]  | None         |
| Chrome for Android | Blob      | Yes          | [500 MiB][3]  | None         |
| IE 10+         | Blob          | Yes          | 600 MiB       | None         |
| Opera 15+      | Blob          | Yes          | 500 MiB       | None         |
| Opera < 15     | data: URI     | No           | n/a           | [Blob.js][5] |
| Safari 6.1+*   | Blob          | No           | ?             | None         |
| Safari < 6     | data: URI     | No           | n/a           | [Blob.js][5] |

Feature detection is possible:

```js
try {
    var isFileSaverSupported = !!new Blob;
} catch (e) {}
```

### IE < 10

It is possible to save text files in IE < 10 without Flash-based polyfills.
See [ChenWenBrian and koffsyrup's `saveTextAs()`](https://github.com/koffsyrup/FileSaver.js#examples) for more details.

### Safari 6.1+

Blobs may be opened instead of saved sometimes—you may have to direct your Safari users to manually
press ⌘+S to save the file after it is opened. Using the `application/octet-stream` MIME type
to force downloads [can cause issues in Safari](https://github.com/eligrey/FileSaver.js/issues/12#issuecomment-47247096).

### iOS

saveAs must be run within a user interaction event such as onTouchDown or onClick; setTimeout will prevent saveAs from triggering.
Due to restrictions in iOS saveAs opens in a new window instead of downloading, if you want this fixed please
[tell Apple](https://bugs.webkit.org/show_bug.cgi?id=102914) how this bug is affecting you.

Syntax
------

```js
FileSaver saveAs(in Blob data, in DOMString filename)
```

Examples
--------

### Saving text

```js
var blob = new Blob(["Hello, world!"], {type: "text/plain;charset=utf-8"});
saveAs(blob, "hello world.txt");
```

The standard W3C File API [`Blob`][4] interface is not available in all browsers.
[Blob.js][5] is a cross-browser `Blob` implementation that solves this.

### Saving a canvas

```js
var canvas = document.getElementById("my-canvas"), ctx = canvas.getContext("2d");
// draw to canvas...
canvas.toBlob(function(blob) {
    saveAs(blob, "pretty image.png");
});
```

Note: The standard HTML5 `canvas.toBlob()` method is not available in all browsers.
[canvas-toBlob.js][6] is a cross-browser `canvas.toBlob()` that polyfills this.

![Tracking image](https://in.getclicky.com/100863755ns.gif)

Contributing
------------

The `FileSaver.js` is the development code, and are not minified.
The `FileSaver.min.js` is the production code, and are minified using uglifyjs.

You need to install [NodeJs][7] and [Grunt][8].

Installing Dependencies:
```bash
npm install
```

Please make sure you run `grunt build` before submitting a pull request.

[1]: http://eligrey.com/demos/FileSaver.js/
[2]: https://github.com/eligrey/canvas-toBlob.js
[3]: https://code.google.com/p/chromium/issues/detail?id=375297
[4]: https://developer.mozilla.org/en-US/docs/DOM/Blob
[5]: https://github.com/eligrey/Blob.js
[6]: https://github.com/eligrey/canvas-toBlob.js
[7]: https://nodejs.org/download/
[8]: http://gruntjs.com/getting-started


text:
<!doctype html>

    <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Search tabs page — Google Earth Enterprise 5.3.2 documentation</title>
    <link rel="stylesheet" href="../../static/bizstyle.css" type="text/css" />
    <link rel="stylesheet" href="../../static/pygments.css" type="text/css" />

    <link rel="index" title="Index" href="../../genindex.html" />
    <link rel="search" title="Search" href="../../search.html" />
    <link rel="next" title="Settings page" href="settingsPage.html" />
    <link rel="prev" title="Snippet profiles page" href="snippetProfilesPage.html" />
    <meta name="viewport" content="width=device-width,initial-scale=1.0">

Navigation

          index

          next |

          previous |

Google Earth Enterprise 5.3.2 documentation »

GEE Server administration »

Previous topic

Snippet profiles page

Next topic

Settings page

Quick search

    <form class="search" action="../../search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>

Search tabs page¶

The Search tabs page of the GEE Server Admin
console is where you can customize
search services. From this page you can:

View the default search tabs:

POISearch: Search from select vector and map layer
fields.

GeocodingFederated: Search for places or coordinates.

Places: Search for places using the built-in locations
database.

Coordinate: Search for latitude, longitude pairs. The
following formats are supported:

Decimal Degrees (e.g. 39.507618° -84.168556°)

Degrees, Minutes, Seconds (e.g. 20°40′01.51″S 131°53′51.39″E)

Degrees, Decimal Minutes (e.g. 49°32.876′N 110°9.193′E)

Universal Transverse Mercator (e.g. 43 R 637072.95 m E
2825582.86 m N)

Military Grid Reference System (e.g. 36NTL8040632621)

Create new search tabs: Click Create New and provide a
search name, label, and parameters.

Edit search tabs: Check the box next to a search tab and click
Edit. Editing a default search tab creates a new search tab
with your changes.

Delete custom search tabs: Check the box next to a custom
search tab and click Delete.

Learn more

Create Search tabs

Specifying search fields for individual
layers

Configuring a searchable database

Navigation

          index

          next |

          previous |

Google Earth Enterprise 5.3.2 documentation »

GEE Server administration »

        © Copyright 2019, Open GEE Contributors.
      Created using Sphinx 1.7.5.


text:
void MainWindow::initEventLoop(){
    //Initializing the timer
    timer = new QTimer(this);
    QObject::connect(timer,SIGNAL(timeout()),this,SLOT(doEvent()));
    timer->start(1);
    //Every thing is in milli-seconds
    sec_count = 0;
    time_out=5000;
    idle_time=1000;
    read_card=attendRequest=attendResponse=-1;
    //Initializing the rfid
    RFID::init();
}
void MainWindow::doEvent(){
    if(ui->stackedWidget->currentIndex()==INITIALIZE){
        init();
    }
    sec_count = (sec_count+ 1)%60000;
    idle_time++;
    ui->label_time->setText(QTime::currentTime().toString("hh:mm:ss"));
    ui->label_developed->setText(QDate::currentDate().toString("dd/MM/yy"));
    checkAlterUi();
    if(sec_count==0){
        checkWelcomeUi();
    }
    if(idle_time>=time_out){
        emit TIMEOUT();
        idle_time=0;
    }
    Network::response.lock();
    if(Network::response.isset){
        processResponse(Network::response.resp,Network::response.type);
        Network::response.unset();
    }
    Network::response.unlock();

    if(read_card !=-1 || ui->stackedWidget->currentIndex()==0){
        string rfid = RFID::readCard();
        if(rfid!=""){
            doReadCard(rfid);
         if(ui->stackedWidget->currentIndex()==0){
                if(attendRequest==-1){
                AuthRequest r;
                r.init(device.mac,"19");
                Network::sendRequest(&r);
                attendRequest=-1;
                attendResponse=AUTH;
                }
            }
        }
    }
}
void MainWindow::doReadCard(string rfid){
    QString _id = QString::fromStdString(to_string(rfid));
    switch (read_card){
    case DELETE_CARD:{
        ui->stackedWidget_admin->setCurrentIndex(DELETE);
        ui->label_admin_status->setText("Your card number:"+_id);
        if(attendRequest==DELETE_CARD){
            DeleteCardRequest r;
            r.init(device.mac,device.pin,rfid);
            Network::sendRequest(&r);
            read_card=-1;
            attendResponse = DELETE_CARD;
            attendRequest = -1;
        }
        break;
    }
    case CREATE_NEW_CARD:{
        ui->stackedWidget_admin->setCurrentIndex(OPTION);
        ui->label_card_num->setText(_id);
        if(attendRequest==CREATE_NEW_CARD){
            CreateCardRequest r;
            r.init(device.mac,device.pin,rfid,false);
            Network::sendRequest(&r);
            read_card=-1;
            attendResponse = CREATE_NEW_CARD;
            attendRequest = -1;
        }
        break;
    }
    case CREATE_MASTER_CARD:{
        ui->stackedWidget_admin->setCurrentIndex(DELETE);
        ui->label_admin_status->setText("Your card number:"+_id);
        if(attendRequest==CREATE_MASTER_CARD){
            CreateCardRequest r;
            r.init(device.mac,device.pin,rfid,true);
            Network::sendRequest(&r);
            read_card=-1;
            attendResponse = CREATE_MASTER_CARD;
            attendRequest = -1;
        }
        break;
    }
    default:
        break;
    }
}