text:
package org.frameworkset.spi.assemble;

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

import org.apache.log4j.Logger;
import org.frameworkset.soa.SerialFactory;
import org.frameworkset.soa.SerialFactory.MagicClass;
import org.frameworkset.spi.BaseApplicationContext;
import org.frameworkset.spi.SPIException;
import org.xml.sax.Attributes;
import org.xml.sax.helpers.DefaultHandler;

/**
 *
 *
 *

 * Title: ProviderParser.java
 *

 *
 *

 * Description: 管理服务配置文件解析器,bean定义
 * 针对soa的优化节点和属性对照表
properties转换为ps
property转换为p
name转换为n
value转换为v
class转换为cs
list转换为l
array转换为a
map转换为m
set转换为s
soa:type_null_value转换为s:nvl
soa:type转换为s:t
componentType转换为cmt
 *

 *
 *

 * Copyright: Copyright (c) 2007
 *

 *
 *

 * bboss workgroup
 *

 *
 * @Date Sep 8, 2008 10:02:46 AM
 * @author biaoping.yin,尹标平
 * @version 1.0
 */
public class ProviderParser extends DefaultHandler
{
    private Stack traceStack;

    private StringBuffer currentValue;

    private Map managers;

    private List mangerimports;

    private boolean serial = false;

    public void setSerial(boolean serial) {
		this.serial = serial;
	}

	private Map<String,Pro> properties = new HashMap<String,Pro>();

    private BaseApplicationContext applicationContext;

    public Map getProperties()
    {
        return properties;
    }

    LinkConfigFile parent;

    private String file;

    private static Logger log = Logger.getLogger(ProviderParser.class);

    public ProviderParser(BaseApplicationContext applicationContext,String file, LinkConfigFile parent)
    {
        traceStack = new Stack();
        managers = new HashMap();
        mangerimports = new ArrayList();
//        currentValue = new StringBuffer();
        this.file = file;
        this.parent = parent;
        this.applicationContext = applicationContext;
//        isSOAApplicationContext = applicationContext instanceof SOAApplicationContext;
    }

    public ProviderParser(BaseApplicationContext applicationContext)
    {

        if(applicationContext.isfile())
        {
	        managers = new HashMap();
	        mangerimports = new ArrayList();
//	        this.file = applicationContext.getConfigfile();
//	        this.parent = applicationContext.getp;
        }
//        currentValue = new StringBuffer();
        this.applicationContext = applicationContext;
//        isSOAApplicationContext = applicationContext instanceof SOAApplicationContext;
        traceStack = new Stack();
    }

    public void characters(char[] ch, int start, int length)
    {
    	if(currentValue == null)
    		currentValue = new StringBuffer();
        currentValue.append(ch, start, length);
    }
    /**
     * 判断组件是否是bean组件,如果是返回true
     * 如果是普通属性,或者是引用那么返回false
     * @param p
     * @return
     */
    private boolean isbean(Pro p)
    {

		boolean isbean = p.getValue() == null && p.getClazz() != null && !p.getClazz().equals("") && (p.getRefid() == null || p.getRefid().equals("")) ;
    	if(isbean)
    		return true;
    	if(p.getMagicclass() != null)
    		return true;
    	if(p.getValue() != null)
    	{
    		isbean = p.getValue() instanceof ProList || p.getValue() instanceof ProMap || p.getValue() instanceof ProSet || p.getValue() instanceof ProArray;
    	}
    	if(isbean)
    		return true;
    	String factory_bean = p.getFactory_bean();

    	if(factory_bean != null && !factory_bean.equals(""))
    		return true;
    	String factory_class = p.getFactory_class();
    	if(factory_class != null && !factory_class.equals(""))
    		return true;
    	String iocplugin = p.getIocplugin();
		if(iocplugin != null && !iocplugin.equals(""))
    		return true;
    	return false;

    }
    private void endProperty(Pro p,String s1, String s2, String name)
    {
//    	Pro p = (Pro) traceStack.pop();
    	boolean isinterceptor = (p instanceof InterceptorInfo);
    	if(!isinterceptor)
    	{
	        if ( p.getValue() == null)
	        {
	        	String _value = null;
//	        	if(this.serial)
//	        		_value = currentValue.toString();
//	        	else
//	        		_value = currentValue.toString().trim();
	        	if(this.currentValue != null)
	        	{
	        		if(this.serial)
	        		{

	        			_value = this.currentValue.toString();

	    	            {
	    	        		p.setValue(_value);
//	    	            	currentValue.delete(0, currentValue.length());
	    	        		this.currentValue = null;
	    	            }
	        		}
	        		else
	        		{
	        			_value = this.currentValue.toString().trim();
	        			if(_value.length() > 0)
	    	            {
	    	        		p.setValue(_value);
//	    	            	currentValue.delete(0, currentValue.length());
	    	        		this.currentValue = null;
	    	            }
	        		}
	        	}

	//            else if(p.getClazz() != null && !p.getClazz().equals("")
	//                    && (p.getRefid() == null || p.getRefid().equals("")))
//	            else if(isbean(p))@setBean 注释开始
//	            {
//	                p.setBean(true);
//
//	            }@setBean 注释结束
	        }
    	}

		if(isbean(p))
        {
            p.setBean(true);

        }

        if(traceStack.size() > 0)
        {
            Object value = this.traceStack.peek();
            if(value instanceof Pro)
            {
            	if(!isinterceptor )
            	{

	            	Pro pro = (Pro)value;
	            	pro.addReferenceParam(p);
            	}
            	else
            	{
	            	BaseTXManager providerManagerInfo = (BaseTXManager)value;
                	providerManagerInfo.addInterceptor((InterceptorInfo)p);
            	}

            }
            else if (value instanceof List)
            {
                ProList<Pro> list = (ProList<Pro>) value;
//                list.add(p.getValue());
                list.add(p);
            }
            else if (value instanceof Map)
            {
            	ProMap<String,Pro> map = (ProMap<String,Pro>)value;
//                map.put(p.getName(), p.value);
                map.put(p.getName(), p);

            }
            else if (value instanceof ProArray)
            {
            	ProArray set = (ProArray)value;
//                set.add(p.value);
                set.addPro(p);
            }

            else if(value instanceof Construction)
            {
            	Construction construction = (Construction)value;
            	construction.addParam(p);
            }
            else if (value instanceof Set)
            {
            	ProSet<Pro> set = (ProSet<Pro>)value;
//                set.add(p.value);
                set.add(p);
            }

            else if(value instanceof ProviderManagerInfo)
            {
            	ProviderManagerInfo providerManagerInfo = (ProviderManagerInfo) value;
            	if(!isinterceptor )
            	{
            		providerManagerInfo.addReference(p);
            	}
            	else
            	{
            		providerManagerInfo.addInterceptor((InterceptorInfo)p);
            	}
//            	if(p.getName() != null)
//            		p.setUuid(providerManagerInfo.getId() + Pro.id_mask + p.getName());
//            	else
//            	{
//            		p.setUuid(providerManagerInfo.getId());
//            	}
            }
            else
            {
                this.properties.put(p.getName(), p);
            }
        }
        else
        {
            this.properties.put(p.getName(), p);
        }
//        /**
//         * 初始化事务信息
//         */
//        p.initTransactions();
        p.freeze();
        p = null;

    }
    @SuppressWarnings("unchecked")
	public void endElement(String s1, String s2, String name)
    {
    	if (name.equals("p") || name.equals("property"))
        {
    		Pro p = (Pro) traceStack.pop();
    		if(p.getIocplugin()!= null)
    			System.out.println();
    		endProperty(p, s1, s2, name);

        }
    	 else if (name.equals("l")||name.equals("list"))
         {
             ProList list = (ProList) this.traceStack.pop();
             Pro pro = (Pro) this.traceStack.peek();
//             List l = java.util.Collections.unmodifiableList(list);
             list.freeze();
             pro.setValue(list);
             pro.setList(true);

         }
    	 else if (name.equals("m") || name.equals("map"))
         {
             ProMap map = (ProMap) this.traceStack.pop();
             Pro pro = (Pro) this.traceStack.peek();
//             Map t = java.util.Collections.unmodifiableMap(map);
             map.freeze();
             pro.setValue(map);
             pro.setMap(true);

         }
    	 else if (name.equals("construction"))
         {
             Construction construction = (Construction) this.traceStack.pop();

         }
         else if (name.equals("a") || name.equals("array"))
         {
             ProArray array = (ProArray) this.traceStack.pop();

             Pro pro = (Pro) this.traceStack.peek();
//             List l = java.util.Collections.unmodifiableList(list);
             array.freeze();
             pro.setValue(array);
             pro.setArray(true);

         }

         else if (name.equals("s") || name.equals("set"))
         {
             ProSet set = (ProSet) this.traceStack.pop();
             Pro pro = (Pro) this.traceStack.peek();
//             Set t = java.util.Collections.unmodifiableSet(set);
             set.freeze();
             pro.setValue(set);
             pro.setSet(true);

         }
    	else if (name.equals("manager"))
        {
            ProviderManagerInfo providerManger = (ProviderManagerInfo)traceStack.pop();
            providerManger.unmodify();
        }
        else if (name.equals("provider"))
        {
            traceStack.pop();
        }
        else if (name.equals("synchronize"))
        {

            // do nothing

        }
        else if (name.equals("managerimport"))
        {

            // do nothing;
        }
        else if (name.equals("transactions"))
        {
            Transactions txs = (Transactions)traceStack.pop();
            txs.unmodify();

        }
        else if (name.equals("reference"))
        {
            // do nothing

        }

        else if (name.equals("method"))
        {

            SynchronizedMethod synchronizedMethod = (SynchronizedMethod) this.traceStack.pop();
            Object parent = this.traceStack.peek();
            if (parent instanceof ProviderManagerInfo)
            {
                ProviderManagerInfo providerManagerInfo = (ProviderManagerInfo) this.traceStack.peek();

                providerManagerInfo.addSynchronizedMethod(synchronizedMethod);
            }
            else if(parent instanceof InterceptorInfo)
            {
            	InterceptorInfo txs = (InterceptorInfo) this.traceStack.peek();
                txs.addInterceptMethod(synchronizedMethod);
            }
            else
            {
                Transactions txs = (Transactions) this.traceStack.peek();
                txs.addTransactionMethod(synchronizedMethod);
            }
        }
        else if (name.equals("rollbackexceptions"))
        {
            // do nothing
        }
        else if (name.equals("exception"))
        {
            // do nothing

        }

        else if (name.equals("param")) // 添加方法参数信息
        {
            // do nothing
        }

        else if (name.equals("description"))
        {
            if(this.traceStack.size() <= 0)
            {

//                System.out.println(currentValue);
//                currentValue.delete(0, currentValue.length());
            	this.currentValue = null;
                return ;
            }
            Object p = this.traceStack.peek();
            if(p instanceof Pro)
            {
                Pro pro = (Pro)p;
                pro.setDescription(this.currentValue.toString());
            }
        }

        else if(name.equals("editor"))
        {

        }
        else if (name.equals("interceptor"))
        {
        	InterceptorInfo interceptor = (InterceptorInfo)this.traceStack.pop();
        	this.endProperty(interceptor,s1, s2, name);

//        	Object obj = this.traceStack.peek();
//
//        	BaseTXManager providerManagerInfo = (BaseTXManager) obj;
//            InterceptorInfo interceptor = new InterceptorInfo();
//            String clazz = attributes.getValue("class");
//            interceptor.setClazz(clazz);
//
//            providerManagerInfo.addInterceptor(interceptor);

        }

//       currentValue.delete(0, currentValue.length());
       this.currentValue = null;

    }

    @SuppressWarnings("unchecked")
    private void setFAttr(Pro property,Attributes attributes)
    {
    	if(attributes == null || attributes.getLength() == 0)
    		return;
    	int length = attributes.getLength();

    	Map<String,Object> extendsAttributes = new HashMap<String,Object>();
    	Map<String,String> pathAttributes = new HashMap<String,String>();
    	Map<String,String> WSAttributes = new HashMap<String,String>();
    	Map<String,String> SOAAttributes = new HashMap<String,String>();
    	Map<String,String> RMIAttributes = new HashMap<String,String>();
    	for(int i = 0; i < length; i ++)
    	{
    		String name = attributes.getQName(i);
    		if(name.equals("n") || name.equals("name"))
    		{
    			continue;
    		}

    		else if(name.startsWith("s:"))//soa:
    		{

    			SOAAttributes.put(name, attributes.getValue(i));
    		}
    		else if( name.equals("cs") || name.equals("v") || name.equals("class") || name.equals("value"))
    		{
    			continue;
    		}

    		else if(name.startsWith("f:"))//通过property的属性来制定对象中field的值
    		{
    			Pro f = new Pro(applicationContext);

    			f.setName(name.substring(2));

    			String value = attributes.getValue(i);
    			if(value.startsWith(ServiceProviderManager.SERVICE_PREFIX)
    					|| value.startsWith(ServiceProviderManager.ATTRIBUTE_PREFIX))
    			{
    				f.setRefid(value);
    			}
    			else
    			{
    				f.setValue(value);
    			}
    			//增加xpath信息
    			f.setXpath(property.getXpath() + Pro.REF_TOKEN + f.getName());
    			property.addReferenceParam(f);
    		}
    		else if(name.startsWith("path:"))
    		{
    			pathAttributes.put(name,attributes.getValue(i));
    		}
    		else if(name.startsWith("ws:"))
    		{
    			WSAttributes.put(name, attributes.getValue(i));
    		}

    		else if(name.startsWith("rmi:"))
    		{

    			RMIAttributes.put(name, attributes.getValue(i));
    		}

    		else if(!Pro.isFixAttribute(name))
    		{
    		    extendsAttributes.put(name, attributes.getValue(i));
    		}

    	}
    	if(pathAttributes .size() > 0)
    	{
    		property.setMvcpaths(pathAttributes);
    	}
    	if(WSAttributes.size() > 0)
    		property.setWSAttributes(WSAttributes);
    	if(SOAAttributes.size() > 0)
    	{
    		property.setSOAAttributes(SOAAttributes);
    	}
    	if(RMIAttributes.size() > 0)
    	{
    		property.setRMIAttributes(RMIAttributes);
    	}
    	property.setExtendsAttributes(extendsAttributes);
//    	return null;
    }

    /**
     * 构建元素的xpath值
     * @param p
     * @return
     */
    private void buildXpath(Pro p)
    {
    	String xpath = null;
    	if(traceStack.size() > 0)
        {
            Object value = this.traceStack.peek();
            if(value instanceof Pro)
            {
            	Pro pro = (Pro)value;
            	xpath = pro.getXpath() + Pro.REF_TOKEN + p.getName();
            	p.setXpath(xpath);
            }
            else if (value instanceof List)
            {
                ProList<Pro> list = (ProList<Pro>) value;
                Pro pp = (Pro)traceStack.get(traceStack.size() - 2);
//                list.add(p.getValue());
                if(list.size() > 0)
                	xpath = pp.getXpath() + "[" + (list.size() - 1) + "]";
                else
                	xpath = pp.getXpath() + "[0]";
//                list.add(p);
                p.setXpath(xpath);
            }
            else if (value instanceof Map)
            {
//            	ProMap<String,Pro> map = (ProMap<String,Pro>)value;
//                map.put(p.getName(), p.value);
//                map.put(p.getName(), p);
                Pro pp = (Pro)traceStack.get(traceStack.size() - 2);
//              list.add(p.getValue());
//              if(list.size() > 0)
              	xpath = pp.getXpath() + "[" + p.getName() + "]";
//              else
//              	xpath = pp.getXpath() + "[0]";
//              list.add(p);
              	p.setXpath(xpath);

            }
            else if (value instanceof ProArray)
            {
            	ProArray set = (ProArray)value;
//                set.add(p.value);
//                set.addPro(p);
                Pro pp = (Pro)traceStack.get(traceStack.size() - 2);
//              list.add(p.getValue());
              if(set.size() > 0)
              	xpath = pp.getXpath() + "[" + (set.size() - 1) + "]";
              else
              	xpath = pp.getXpath() + "[0]";
//              list.add(p);
              p.setXpath(xpath);
            }
            else if(value instanceof Construction)
            {
            	Construction construction = (Construction)value;
//            	construction.addParam(p);
            	Pro pp = (Pro)traceStack.get(traceStack.size() - 2);
//              list.add(p.getValue());
              if(construction.getParams() != null && construction.getParams().size() > 0)
              	xpath = pp.getXpath() + "{" + (construction.getParams().size() - 1) + "}";
              else
              	xpath = pp.getXpath() + "{0}";
//              list.add(p);
              p.setXpath(xpath);
            }
            else if (value instanceof Set)
            {
            	ProSet<Pro> set = (ProSet<Pro>)value;
            	 Pro pp = (Pro)traceStack.get(traceStack.size() - 2);
//               list.add(p.getValue());
               if(set.size() > 0)
               	xpath = pp.getXpath() + "[" + (set.size() - 1) + "]";
               else
               	xpath = pp.getXpath() + "[0]";
//               list.add(p);
               p.setXpath(xpath);
            }

            else if(value instanceof ProviderManagerInfo)
            {
//            	ProviderManagerInfo providerManagerInfo = (ProviderManagerInfo) value;
//
//
//
//            	xpath = providerManagerInfo.getXpath() + Pro.REF_TOKEN + p.getName();
//            	p.setXpath(xpath);
            	xpath = p.getName();
           	 	p.setXpath(xpath);
//            	if(p.getName() != null)
//            		p.setUuid(providerManagerInfo.getId() + Pro.id_mask + p.getName());
//            	else
//            	{
//            		p.setUuid(providerManagerInfo.getId());
//            	}
            }
            else
            {
            	xpath = p.getName();
            	 p.setXpath(xpath);
            }
        }
        else
        {
        	xpath = p.getName();
        	 p.setXpath(xpath);
        }
//    	return xpath;
    }

    private void startProperty(Pro p,String s1, String s2, String name, Attributes attributes)
    {

        String name_ = null;
        String value = null;
        String clazz = null;
        if(this.serial)
        {
        	 name_ = attributes.getValue("n");
        	 if(name_ == null)
        	 {
        		 name_ = attributes.getValue("name");
        		 if(name_ == null || name_.equals(""))
                 {
                 	 String id = attributes.getValue("id");
                 	 name_ = id;
                 }
        	 }
        	value = attributes.getValue("v");
        	if(value == null)
        		value = attributes.getValue("value");
        	 clazz = attributes.getValue("cs");
//	          if(clazz == null) //@setBean 注释开始
//	          {
//	        	  clazz = attributes.getValue(Pro.soa_type_attribute);
//	          }//@setBean 注释结束
	          if(clazz == null)
	            clazz = attributes.getValue("class");

        }
        else
        {
        	 name_ = attributes.getValue("name");
             if(name_ == null || name_.equals(""))
             {
             	 String id = attributes.getValue("id");
             	name_ = id;
             }
        	 value = attributes.getValue("value");
        	 clazz = attributes.getValue("class");

        }

        if (name_ != null && !name_.equals(""))
        {
            p.setName(name_.trim());
        }

        if (value != null)
        {
            p.setValue(value);
        }
        if (clazz != null && !clazz.equals(""))
        {
            p.setClazz(clazz);
        }
        String refid = attributes.getValue("refid");

        String label = attributes.getValue("label");
        String factory_bean = attributes.getValue("factory-bean");
        String factory_class = attributes.getValue("factory-class");
        String factory_method = attributes.getValue("factory-method");
        String iocplugin = attributes.getValue("iocplugin");
        boolean singlable = getBoolean(attributes.getValue("singlable"), true);
        if(iocplugin != null)
        {
        	  p.setIocplugin(iocplugin);
        }
        String enablerpc = attributes.getValue("enablerpc");
        if(enablerpc != null && enablerpc.equals("true"))
        {
        	p.setEnablerpc(true);
        }

        p.setConfigFile(this.file);
        p.setSinglable(singlable);
        p.setFactory_bean(factory_bean);
        p.setFactory_class(factory_class);
        p.setFactory_method(factory_method);
        String destroyMethod = attributes.getValue("destroy-method");
        p.setDestroyMethod(destroyMethod);
        String initMethod = attributes.getValue("init-method");
        p.setInitMethod(initMethod);
        //callorder_sequence标识组件配置的拦截器以顺序方式执行还是以堆栈方式执行,
        //true:顺序方式执行,拦截器中的每个方法都是按照配置顺序执行,before、after、afterthrow、afterfinally都是按照先后顺序执行
        //false:链式方式执行,拦截器中的每个方法都是按照配置堆栈方式执行执行,
        //先按先后顺序执行所有拦截器的before方法,然后按逆序执行所有拦截器的after、afterthrow、afterfinally三个方法
        //默认值为false
        p
        .setCallorder_sequence(getBoolean(attributes.getValue("callorder_sequence"), false));
        this.buildXpath(p);
//        if(this.serial)
        {
	        String mg = attributes.getValue("mg");
	        if(mg != null)
	        {
		        p.setMagicNumber(mg);
//		        String serial = attributes.getValue("serial");
//		        String preserial = attributes.getValue("preserial");
//		        if(serial == null && preserial == null)
		        {
		        	MagicClass mgc = SerialFactory.getSerialFactory().getMagicClassByMagicNumber(mg);
		        	if(mgc == null)
		        		throw new java.lang.IllegalArgumentException("magic="+mg + "对应的MagicClass不存在,请检查org/frameworkset/soa/serialconf.xml文件中是否定义了magic='"+mg+"'的序列化插件.");
		        	if(mgc.getMagicclass() != null && p.getClazz() == null)
		        	{
		        		 p.setClazz(mgc.getMagicclass());
		        	}
		        	p.setMagicclass(mgc);
		        }
	        }
        }
        setFAttr(p, attributes);
        if(label != null && !label.equals(""))
            p.setLabel(label);

        if (refid != null && !refid.equals(""))
        {
            p.setRefid(refid);
        }

    }
    public void startElement(String s1, String s2, String name, Attributes attributes)
    {

//        currentValue.delete(0, currentValue.length());
    	currentValue = null;
        if (name.equals("p") || name.equals("property"))
        {

        	Pro p = new Pro(applicationContext);
        	startProperty(p,s1, s2, name, attributes);
        	this.traceStack.push(p);

        }
        else if (name.equals("l")||name.equals("list"))
        {
        	ProList list = new ProList();
        	String componentType = null;
//        	if(this.serial)
        	{
        		componentType = attributes.getValue("cmt");
        		if(componentType == null)
        			componentType = attributes.getValue("componentType");
        	}
//        	else
//        	{
//        		componentType = attributes.getValue("componentType");
//        	}
        	 list.setComponentType(componentType);
            this.traceStack.push(list);

        }
        else if (name.equals("m") || name.equals("map"))
        {
        	ProMap map = new ProMap<String,Pro>();
        	String componentType = null;
//        	if(this.serial)
        	{
        		componentType = attributes.getValue("cmt");
        		if(componentType == null)
        			componentType = attributes.getValue("componentType");
        	}
//        	else
//        	{
//        		componentType = attributes.getValue("componentType");
//        	}
            map.setComponentType(componentType);

            this.traceStack.push(map);

        }
        else if (name.equals("a") || name.equals("array"))
        {
        	ProArray array = new ProArray();
        	String componentType = null;
//        	if(this.serial)
        	{
        		componentType = attributes.getValue("cmt");
        		if(componentType == null)
        			componentType = attributes.getValue("componentType");
        	}
//        	else
//        	{
//        		componentType = attributes.getValue("componentType");
//        	}
        	 array.setComponentType(componentType);
            this.traceStack.push(array);

        }
        else if (name.equals("construction"))
        {
            Construction construction = new Construction();
            Object parent = this.traceStack.peek();
            if(parent instanceof ProviderManagerInfo)
            {
	            ProviderManagerInfo providerManagerInfo = (ProviderManagerInfo) parent;
	            providerManagerInfo.setConstruction(construction);

            }
            else if(parent instanceof Pro)
            {
            	Pro p = (Pro)parent;
            	p.addConstructor(construction);
            }
            this.traceStack.push(construction);

        }

        else if (name.equals("s") || name.equals("set"))
        {
        	ProSet set = new ProSet();
        	String componentType = null;
//        	if(this.serial)
        	{
        		componentType = attributes.getValue("cmt");
        		if(componentType == null)
        			componentType = attributes.getValue("componentType");
        	}
//        	else
//        	{
//        		componentType = attributes.getValue("componentType");
//        	}
            set.setComponentType(componentType);
            this.traceStack.push(set);

        }

        else if (name.equals("manager"))
        {

            String id = attributes.getValue("id");
            ProviderManagerInfo providerManger = new ProviderManagerInfo();
            providerManger.setId(id);
            String enablerpc = attributes.getValue("enablerpc");
            if(enablerpc != null && enablerpc.equals("true"))
            {
            	providerManger.setEnablerpc(true);
            }
            providerManger.setJndiName(attributes.getValue("jndiname"));

            // providerManger.setTransactionInterceptorClass(attributes
            // .getValue("interceptor"));
            providerManger.setSinglable(getBoolean(attributes.getValue("singlable"), true));
            providerManger.setDefaultable(getBoolean(attributes.getValue("default"), false));
            providerManger
                    .setCallorder_sequence(getBoolean(attributes.getValue("callorder_sequence"), false));
            managers.put(id, providerManger);
            traceStack.push(providerManger);
        }
        else if (name.equals("managerimport"))
        {

            ManagerImport mi = new ManagerImport();
            mi.setFile(attributes.getValue("file"));
            mangerimports.add(mi);
        }
        else if (name.equals("provider"))
        {
            ProviderManagerInfo providerManager = (ProviderManagerInfo) traceStack.peek();

            SecurityProviderInfo provider = new SecurityProviderInfo();
            provider.setConfigFile(this.file);
            boolean isdefault = getBoolean(attributes.getValue("default"), false);
            provider.setIsdefault(isdefault);
            provider.setProviderClass(attributes.getValue("class"));
            provider.setType(attributes.getValue("type"));

            provider.setUsed(getBoolean(attributes.getValue("used"), false));
            String destroyMethod = attributes.getValue("destroy-method");
            provider.setDestroyMethod(destroyMethod);
            String initMethod = attributes.getValue("init-method");
            provider.setInitMethod(initMethod);
            provider.setApplicationContext(applicationContext);
            if (isdefault)
                providerManager.setDefaulProviderInfo(provider);
            providerManager.addSecurityProviderInfo(provider);

            traceStack.push(provider);
        }
        else if (name.equals("synchronize"))
        {

            ProviderManagerInfo providerManagerInfo = (ProviderManagerInfo) this.traceStack.peek();
            providerManagerInfo.setSynchronizedEnabled(getBoolean(attributes.getValue("enabled"), false));

        }
        else if (name.equals("transactions"))
        {
        	Object tobj = this.traceStack.peek();
        	if(tobj instanceof ProviderManagerInfo)
        	{
	            ProviderManagerInfo providerManagerInfo = (ProviderManagerInfo) tobj;
	            Transactions txs = new Transactions();
	            providerManagerInfo.setTransactions(txs);
	            traceStack.push(txs);
        	}
        	else
        	{
        		Pro pro = (Pro) tobj;
	            Transactions txs = new Transactions();
	            pro.setTransactions(txs);
	            traceStack.push(txs);
        	}

        }
        else if (name.equals("reference"))
        {
            ProviderManagerInfo providerManagerInfo = (ProviderManagerInfo) this.traceStack.peek();
            Pro ref = new Pro(applicationContext);
            String fieldname = attributes.getValue("fieldname");
            if(fieldname == null)
                fieldname = attributes.getValue("name");;

            String refid = attributes.getValue("refid");
            String reftype = attributes.getValue("reftype");
            String value = attributes.getValue("value");

            String clazz = attributes.getValue("class");
            if(value == null && refid == null )
            {
                if(clazz != null && !clazz.equals(""))
                {
                    ref.setBean(true);
                }
                else
                {
                    throw new SPIException("reference元素必须带class,value,refid三个属性中的任何一个。");
                }
            }
            ref.setName(fieldname);
            ref.setRefid(refid);
            ref.setReftype(reftype);
            ref.setValue(value);
            ref.setClazz(clazz);
            providerManagerInfo.addReference(ref);

        }

        else if (name.equals("interceptor"))
        {
        	InterceptorInfo interceptor = new InterceptorInfo(this.applicationContext);
        	this.startProperty(interceptor, s1, s2, name, attributes);
        	this.traceStack.push(interceptor);
//        	Object obj = this.traceStack.peek();
//
//        	BaseTXManager providerManagerInfo = (BaseTXManager) obj;
//            InterceptorInfo interceptor = new InterceptorInfo();
//            String clazz = attributes.getValue("class");
//            interceptor.setClazz(clazz);
//
//            providerManagerInfo.addInterceptor(interceptor);

        }

        else if (name.equals("method"))
        {

            SynchronizedMethod synchronizedMethod = new SynchronizedMethod();
            synchronizedMethod.setMethodName(attributes.getValue("name"));
            synchronizedMethod.setPattern(attributes.getValue("pattern"));
            synchronizedMethod.setTxtype(attributes.getValue("txtype"));
            traceStack.push(synchronizedMethod);
        }
        else if (name.equals("rollbackexceptions"))
        {
            // do nothing
        }
        else if (name.equals("exception"))
        {
            RollbackException e = new RollbackException();
            String exceptionName = attributes.getValue("class");
            String exceptionType = attributes.getValue("type");
            e.setExceptionName(exceptionName);
            e.setExceptionType(exceptionType);
            SynchronizedMethod method = (SynchronizedMethod) traceStack.peek();
            method.addRollbackException(e);

        }

        else if (name.equals("param")) // 添加方法参数信息
        {
            String paramType = attributes.getValue("type");
            if(paramType == null)
            	paramType = attributes.getValue("class");
            String value = attributes.getValue("value");
            String refid = attributes.getValue("refid");
            Param param = new Param(applicationContext);
            param.setClazz(paramType);
            param.setRefid(refid);
            param.setValue(value);
            Object o = traceStack.peek();
            if (o instanceof SynchronizedMethod)
            {
                SynchronizedMethod method = (SynchronizedMethod) o;
                method.addParam(param);
            }
            else if (o instanceof Construction)
            {
                Construction construction = (Construction) o;
                construction.addParam(param);
            }
        }

        else if (name.equals("description"))
        {
//            this.currentValue.delete(0, this.currentValue.length());
        	this.currentValue = null;
//            Object p = this.traceStack.peek();
//            if(p instanceof Pro)
//            {
//                Pro pro = (Pro)p;
//                pro.setDescription(description)
//            }
        }

        else if(name.equals("editor"))
        {
            Editor editor = new Editor();
            String clazz = attributes.getValue("class");
            if(clazz == null || clazz.equals(""))
                throwable("editor 节点没有指定class属性。");
            editor.setEditor(clazz);
            Pro currentElement = (Pro)this.traceStack.peek();
            currentElement.setEditor(editor);
        }
        else
        {
//        	if(this.applicationContext.isfile())
//        		log.info("解析文件时[" + this.parent + "]遇到元素[" + name + "],忽略处理。");
//        	else
//        		log.info("解析报文时遇到元素[" + name + "],忽略处理。");
        }
    }

    public Map getManagers()
    {
        return managers;
    }

    public List getMangerimports()
    {
        return this.mangerimports;
    }

    public void throwable(String message)
    {
        if(parent == null)
            throw new IllegalArgumentException("editor 节点没有指定class属性。对应的配置文件为:" + this.file);
        else
        {
            throw new IllegalArgumentException("editor 节点没有指定class属性。对应的配置文件为:" + this.parent.toString(this.file) );
        }
    }

    public static boolean getBoolean(String value, boolean nullReplace) {
		boolean ret = false;
		if (value == null)
			ret = nullReplace;
		else if (value.trim().equalsIgnoreCase("true"))
			ret = true;
		else
			ret = false;
		return ret;

	}

}


text:
* [
      BeauNouvelle
      /
      AspectFillFaceAware
](https://github.com/BeauNouvelle/AspectFillFaceAware):
      An extension that gives UIImageView the ability to focus on faces within an image when using AspectFill.

* [
      vsouza
      /
      awesome-ios
](https://github.com/vsouza/awesome-ios):
      A curated list of awesome iOS ecosystem, including Objective-C and Swift Projects

* [
      Yalantis
      /
      ColorMatchTabs
](https://github.com/Yalantis/ColorMatchTabs):
* [
      Nicejinux
      /
      NXDrawKit
](https://github.com/Nicejinux/NXDrawKit):
      NXDrawKit is a simple and easy but useful drawing kit for iPhone

* [
      dkhamsing
      /
      open-source-ios-apps
](https://github.com/dkhamsing/open-source-ios-apps):

📱 Collaborative List of Open-Source iOS Apps

* [
      PiXeL16
      /
      IBLocalizable
](https://github.com/PiXeL16/IBLocalizable):
      Localize your views directly in Interface Builder with IBLocalizable

* [
      postmates
      /
      PMHTTP
](https://github.com/postmates/PMHTTP):
      Swift/Obj-C HTTP framework with a focus on REST and JSON

* [
      ReactiveKit
      /
      ReactiveKit
](https://github.com/ReactiveKit/ReactiveKit):
      A Swift Reactive Programming Kit

* [
      Swiftification
      /
      Dispatch
](https://github.com/Swiftification/Dispatch):
      Just a tiny library to make using GCD easier and intuitive

* [
      SwiftyJSON
      /
      SwiftyJSON
](https://github.com/SwiftyJSON/SwiftyJSON):
      The better way to deal with JSON data in Swift

* [
      MosheBerman
      /
      Precalc
](https://github.com/MosheBerman/Precalc):
      This repo contains some code which can graph equations in a UIView.

* [
      Alamofire
      /
      Alamofire
](https://github.com/Alamofire/Alamofire):
      Elegant HTTP Networking in Swift

* [
      raywenderlich
      /
      swift-algorithm-club
](https://github.com/raywenderlich/swift-algorithm-club):
      Algorithms and data structures in Swift, with explanations!

* [
      pokeweak
      /
      pokemon-weakness-ios
](https://github.com/pokeweak/pokemon-weakness-ios):
      Source code for Pokemon Weakness iOS application 🚀

* [
      nakiostudio
      /
      EasyPeasy
](https://github.com/nakiostudio/EasyPeasy):
      Auto Layout made easy

* [
      IBM-Swift
      /
      Kitura
](https://github.com/IBM-Swift/Kitura):
      A Swift Web Framework and HTTP Server

* [
      matteocrippa
      /
      awesome-swift
](https://github.com/matteocrippa/awesome-swift):
      A collaborative list of awesome swift resources. Feel free to contribute!

* [
      vapor
      /
      vapor
](https://github.com/vapor/vapor):
      A web framework and server for Swift that works on macOS and Ubuntu.

* [
      mac-cain13
      /
      R.swift
](https://github.com/mac-cain13/R.swift):
      Get strong typed, autocompleted resources like images, fonts and segues in Swift projects

* [
      tristanhimmelman
      /
      AlamofireObjectMapper
](https://github.com/tristanhimmelman/AlamofireObjectMapper):
      An Alamofire extension which converts JSON response data into swift objects using ObjectMapper

* [
      SnapKit
      /
      SnapKit
](https://github.com/SnapKit/SnapKit):
      A Swift Autolayout DSL for iOS & OS X

* [
      arvindhsukumar
      /
      PredicateEditor
](https://github.com/arvindhsukumar/PredicateEditor):
      A visual editor for dynamically creating NSPredicates to query data in your iOS app.

* [
      ReactiveX
      /
      RxSwift
](https://github.com/ReactiveX/RxSwift):
      Reactive Programming in Swift

* [
      MengTo
      /
      Spring
](https://github.com/MengTo/Spring):
      A library to simplify iOS animations in Swift.

* [
      snipsco
      /
      Postal
](https://github.com/snipsco/Postal):
      A swift framework for working with emails

####objective-c
* [
      kasper
      /
      phoenix
](https://github.com/kasper/phoenix):
      A lightweight macOS/OS X window and app manager scriptable with JavaScript

* [
      d0ping
      /
      DBAttachmentPickerController
](https://github.com/d0ping/DBAttachmentPickerController):
      This powerful component allows to select different types of files from different sources on your device.

* [
      jobandtalent
      /
      AnimatedTextInput
](https://github.com/jobandtalent/AnimatedTextInput):
      Animated UITextField and UITextView replacement for iOS

* [
      anishathalye
      /
      lumen
](https://github.com/anishathalye/lumen):
      Magic auto brightness based on screen contents 💡

* [
      LaiFengiOS
      /
      LFLiveKit
](https://github.com/LaiFengiOS/LFLiveKit):
      LaiFeng IOS Live Kit,H264 and AAC Hard coding,support GPUImage Beauty, rtmp transmission,weak network lost frame,Dynamic switching rate

* [
      rs
      /
      SDWebImage
](https://github.com/rs/SDWebImage):
      Asynchronous image downloader with cache support as a UIImageView category

* [
      istornz
      /
      iPokeGo
](https://github.com/istornz/iPokeGo):
      A native iOS client to map the Pokemon around you!

* [
      KJCracks
      /
      Clutch
](https://github.com/KJCracks/Clutch):
      Fast iOS executable dumper

* [
      AFNetworking
      /
      AFNetworking
](https://github.com/AFNetworking/AFNetworking):
      A delightful networking framework for iOS, OS X, watchOS, and tvOS.

* [
      typcn
      /
      bilibili-mac-client
](https://github.com/typcn/bilibili-mac-client):
      An unofficial bilibili client for mac

* [
      liufengting
      /
      FTPopOverMenu
](https://github.com/liufengting/FTPopOverMenu):
      A pop over menu for iOS which is maybe the easiest one to use. Now supports both portrait and landscape.

* [
      jessesquires
      /
      JSQMessagesViewController
](https://github.com/jessesquires/JSQMessagesViewController):
      An elegant messages UI library for iOS

* [
      realm
      /
      realm-cocoa
](https://github.com/realm/realm-cocoa):
      Realm is a mobile database: a replacement for Core Data & SQLite

* [
      ibireme
      /
      YYKit
](https://github.com/ibireme/YYKit):
      A collection of iOS components.

* [
      SunLiner
      /
      MiaowShow
](https://github.com/SunLiner/MiaowShow):
      iOS视频直播项目

* [
      slackhq
      /
      SlackTextViewController
](https://github.com/slackhq/SlackTextViewController):
      A drop-in UIViewController subclass with a growing text input view and other useful messaging features

* [
      CoderMJLee
      /
      MJRefresh
](https://github.com/CoderMJLee/MJRefresh):
      An easy way to use pull-to-refresh.

* [
      KnuffApp
      /
      Knuff
](https://github.com/KnuffApp/Knuff):
      The debug application for Apple Push Notification Service (APNs).

* [
      noodlewerk
      /
      NWPusher
](https://github.com/noodlewerk/NWPusher):
      OS X and iOS application and framework to play with the Apple Push Notification service (APNs)

* [
      facebook
      /
      AsyncDisplayKit
](https://github.com/facebook/AsyncDisplayKit):
      Smooth asynchronous user interfaces for iOS apps.

* [
      hackiftekhar
      /
      IQKeyboardManager
](https://github.com/hackiftekhar/IQKeyboardManager):
      Codeless drop-in universal library allows to prevent issues of keyboard sliding up and cover UITextField/UITextView. Neither need to write any code nor any setup required and much more.

* [
      ivpusic
      /
      react-native-image-crop-picker
](https://github.com/ivpusic/react-native-image-crop-picker):
      iOS/Android image picker with support for multiple images and cropping

* [
      facebook
      /
      WebDriverAgent
](https://github.com/facebook/WebDriverAgent):
      A WebDriver server for iOS that runs inside the Simulator.

* [
      beardedspice
      /
      beardedspice
](https://github.com/beardedspice/beardedspice):
      Mac Media Keys for the Masses

* [
      scubers
      /
      JRDB
](https://github.com/scubers/JRDB):

####go
* [
      irfansharif
      /
      cfilter
](https://github.com/irfansharif/cfilter):
      Cuckoo Filter implementation in Go, better than Bloom Filters

* [
      sourcegraph
      /
      checkup
](https://github.com/sourcegraph/checkup):
      Distributed, lock-free, self-hosted health checks and status pages

* [
      attic-labs
      /
      noms
](https://github.com/attic-labs/noms):
      The versioned, forkable, syncable database

* [
      thewhitetulip
      /
      web-dev-golang-anti-textbook
](https://github.com/thewhitetulip/web-dev-golang-anti-textbook):
      Learn how to write webapps in Go.

* [
      mholt
      /
      caddy
](https://github.com/mholt/caddy):
      Fast, cross-platform HTTP/2 web server with automatic HTTPS

* [
      xtaci
      /
      kcptun
](https://github.com/xtaci/kcptun):
      an extremely simple & fast udp tunnel based on kcp protocol

* [
      github
      /
      gh-ost
](https://github.com/github/gh-ost):
      GitHub's Online Schema Change for MySQL

* [
      avelino
      /
      awesome-go
](https://github.com/avelino/awesome-go):
      A curated list of awesome Go frameworks, libraries and software

* [
      docker
      /
      docker
](https://github.com/docker/docker):
      Docker - the open-source application container engine

* [
      getlantern
      /
      lantern
](https://github.com/getlantern/lantern):

⚡ Open Internet for everyone. Lantern is a free application that delivers fast, reliable and secure access to the open Internet for users in censored regions. It uses a variety of techniques to stay unblocked, including domain fronting, p2p, and pluggable transports.

* [
      golang
      /
      go
](https://github.com/golang/go):
      The Go programming language

* [
      pressly
      /
      sup
](https://github.com/pressly/sup):
      Super simple deployment tool - just Unix - think of it like 'make' for a network of servers

* [
      mattn
      /
      qq
](https://github.com/mattn/qq):
* [
      spf13
      /
      hugo
](https://github.com/spf13/hugo):
      A Fast and Flexible Static Site Generator built with love in GoLang

* [
      coreos
      /
      dex
](https://github.com/coreos/dex):
      OpenID Connect Identity (OIDC) and OAuth 2.0 Provider with Pluggable Connectors

* [
      minio
      /
      minio
](https://github.com/minio/minio):
      Minio is an object storage server compatible with Amazon S3 and licensed under Apache 2.0 License

* [
      mehrdadrad
      /
      mylg
](https://github.com/mehrdadrad/mylg):
      Network Diagnostic Tool

* [
      six-ddc
      /
      v2ex-go
](https://github.com/six-ddc/v2ex-go):
      A simple V2EX client on terminal written in Go.

* [
      puma
      /
      puma-dev
](https://github.com/puma/puma-dev):
      A tool to manage rack apps in development with puma

* [
      gogits
      /
      gogs
](https://github.com/gogits/gogs):
      Gogs (Go Git Service) is a painless self-hosted Git service.

* [
      grafana
      /
      grafana
](https://github.com/grafana/grafana):
      Gorgeous metric viz, dashboards & editors for Graphite, InfluxDB & OpenTSDB

* [
      kubernetes
      /
      kubernetes
](https://github.com/kubernetes/kubernetes):
      Production-Grade Container Scheduling and Management

* [
      shazow
      /
      ssh-chat
](https://github.com/shazow/ssh-chat):
      Chat over SSH.

* [
      tomnomnom
      /
      gron
](https://github.com/tomnomnom/gron):
      Make JSON greppable!

* [
      fatedier
      /
      frp
](https://github.com/fatedier/frp):
      A fast reverse proxy to help you expose a local server behind a NAT or firewall to the internet.

####javascript
* [
      sachinchoolur
      /
      lightgallery.js
](https://github.com/sachinchoolur/lightgallery.js):
      Full featured JavaScript image & video gallery. No dependencies

* [
      egoist
      /
      vuepack
](https://github.com/egoist/vuepack):

📦 A modern starter which uses Vue 2, Vuex, Vue-router and Webpack 2

* [
      jumpsuit
      /
      jumpsuit
](https://github.com/jumpsuit/jumpsuit):
      Jump in. Zip up. Build great apps.

* [
      facebookincubator
      /
      create-react-app
](https://github.com/facebookincubator/create-react-app):
      Create React apps with no build configuration.

* [
      mxstbr
      /
      sharingbuttons.io
](https://github.com/mxstbr/sharingbuttons.io):
      Quickly generate social sharing buttons with a tiny performance footprint

* [
      camwiegert
      /
      baffle
](https://github.com/camwiegert/baffle):
      A tiny javascript library for obfuscating and revealing text in DOM elements.

* [
      facebook
      /
      react
](https://github.com/facebook/react):
      A declarative, efficient, and flexible JavaScript library for building user interfaces.

* [
      zeit
      /
      hyperterm
](https://github.com/zeit/hyperterm):
      HTML/JS/CSS Terminal

* [
      vuejs
      /
      vue
](https://github.com/vuejs/vue):
      Simple yet powerful library for building modern web interfaces.

* [
      getify
      /
      You-Dont-Know-JS
](https://github.com/getify/You-Dont-Know-JS):
      A book series on JavaScript. @YDKJS on twitter.

* [
      steos
      /
      reactcards
](https://github.com/steos/reactcards):
      devcards for react

* [
      nodejs
      /
      node
](https://github.com/nodejs/node):
      Node.js JavaScript runtime ✨🐢🚀✨

* [
      angular
      /
      angular.js
](https://github.com/angular/angular.js):
      HTML enhanced for web apps

* [
      reactjs
      /
      redux
](https://github.com/reactjs/redux):
      Predictable state container for JavaScript apps

* [
      huluoyang
      /
      freecodecamp.cn
](https://github.com/huluoyang/freecodecamp.cn):
      干货都在Wiki中,千万不要错过。

* [
      howdyai
      /
      botkit
](https://github.com/howdyai/botkit):
      Botkit is a toolkit for making bot applications

* [
      airbnb
      /
      javascript
](https://github.com/airbnb/javascript):
      JavaScript Style Guide

* [
      uber
      /
      image-diff
](https://github.com/uber/image-diff):
      Create image differential between two images

* [
      yoshuawuyts
      /
      nanomorph
](https://github.com/yoshuawuyts/nanomorph):
      Hyper fast diffing algorithm for real DOM nodes ⚡

* [
      d3
      /
      d3
](https://github.com/d3/d3):
      Bring data to life with SVG, Canvas and HTML. 📊📈🎉

* [
      jquery
      /
      jquery
](https://github.com/jquery/jquery):
      jQuery JavaScript Library

* [
      mikolalysenko
      /
      regl
](https://github.com/mikolalysenko/regl):

👑 Functional WebGL

* [
      harshjv
      /
      github-repo-size
](https://github.com/harshjv/github-repo-size):

🚀 Chrome extension to display repository size on GitHub

* [
      iam4x
      /
      pokemongo-webspoof
](https://github.com/iam4x/pokemongo-webspoof):

👾 Play Pokémon Go from your Mac

* [
      Armax
      /
      Pokemon-GO-node-api
](https://github.com/Armax/Pokemon-GO-node-api):
      Pokemon GO api node.js library

####ruby
* [
      jekyll
      /
      jekyll
](https://github.com/jekyll/jekyll):

🌐 Jekyll is a blog-aware, static site generator in Ruby

* [
      Homebrew
      /
      brew
](https://github.com/Homebrew/brew):

🍺 The missing package manager for OS X

* [
      jondot
      /
      awesome-react-native
](https://github.com/jondot/awesome-react-native):
      An "awesome" type curated list of React Native components, news, tools, and learning material

* [
      rails
      /
      rails
](https://github.com/rails/rails):
      Ruby on Rails

* [
      fastlane
      /
      fastlane
](https://github.com/fastlane/fastlane):
      The easiest way to automate building and releasing your iOS and Android apps

* [
      kilimchoi
      /
      engineering-blogs
](https://github.com/kilimchoi/engineering-blogs):
      A curated list of engineering blogs

* [
      mitchellh
      /
      vagrant
](https://github.com/mitchellh/vagrant):
      Vagrant is a tool for building and distributing development environments.

* [
      rafaelsales
      /
      ulid
](https://github.com/rafaelsales/ulid):
      Universally Unique Lexicographically Sortable Identifier implementation for Ruby

* [
      rapid7
      /
      metasploit-framework
](https://github.com/rapid7/metasploit-framework):
      Metasploit Framework

* [
      plum-umd
      /
      rdl
](https://github.com/plum-umd/rdl):
* [
      puma
      /
      puma
](https://github.com/puma/puma):
      A ruby web server built for concurrency

* [
      plataformatec
      /
      devise
](https://github.com/plataformatec/devise):
      Flexible authentication solution for Rails with Warden.

* [
      ruby-concurrency
      /
      concurrent-ruby
](https://github.com/ruby-concurrency/concurrent-ruby):
      Modern concurrency tools including agents, futures, promises, thread pools, supervisors, and more. Inspired by Erlang, Clojure, Scala, Go, Java, JavaScript, and classic concurrency patterns.

* [
      Thibaut
      /
      devdocs
](https://github.com/Thibaut/devdocs):
      API Documentation Browser

* [
      elastic
      /
      logstash
](https://github.com/elastic/logstash):
      logstash - transport and process your logs, events, or other data

* [
      discourse
      /
      discourse
](https://github.com/discourse/discourse):
      A platform for community discussion. Free, open, simple.

* [
      caskroom
      /
      homebrew-cask
](https://github.com/caskroom/homebrew-cask):
      A CLI workflow for the administration of Mac applications distributed as binaries

* [
      stympy
      /
      faker
](https://github.com/stympy/faker):
      A library for generating fake data such as names, addresses, and phone numbers.

* [
      deadlyvipers
      /
      dojo_rules
](https://github.com/deadlyvipers/dojo_rules):
* [
      openstreetmap
      /
      openstreetmap-website
](https://github.com/openstreetmap/openstreetmap-website):
      Mirror of the Rails application powering http://www.openstreetmap.org (hosted at git://git.openstreetmap.org/rails.git)

* [
      haml
      /
      haml
](https://github.com/haml/haml):
      HTML Abstraction Markup Language - A Markup Haiku

* [
      sickill
      /
      rainbow
](https://github.com/sickill/rainbow):
      Ruby gem for colorizing printed text on ANSI terminals

* [
      jhu-ep-coursera
      /
      fullstack-course1-module3
](https://github.com/jhu-ep-coursera/fullstack-course1-module3):
* [
      joker1007
      /
      rspec-power_assert
](https://github.com/joker1007/rspec-power_assert):
      Power Assert for RSpec

* [
      biblichor
      /
      middleman-blog-bootstrap-template
](https://github.com/biblichor/middleman-blog-bootstrap-template):
      A middleman-blog template that uses bootstrap, bootswatch, font-awesome with bower.

redpajama_set_name: RedPajamaGithub


text:
namespace Webs {

ContextProvider::ContextProvider(std::string &websiteContent)
                    : m_websiteContent( websiteContent )
{

}

ContextProvider::~ContextProvider()
{

}

std::string ContextProvider::getWordContext( std::string &word,
                                             std::size_t pos)
{
    std::size_t localBoundary = ( pos > 30 )? 30 : 15;
    std::string contextData = "";
    if( m_websiteContent.empty() || word.empty() ) {
        return contextData;
    }
    std::string contextString = m_websiteContent.substr( pos - localBoundary,
                                                  2 * localBoundary );
    std::stringstream contextStream;
    contextStream.str( contextString );
    std::vector< std::string > wordList;
    std::string item;
    while( std::getline( contextStream, item, ' ' ) ) {
        wordList.push_back( item );
    }
    std::size_t listSize = wordList.size();
    for( unsigned int i = 1; i < listSize - 1; ++i ) {
        std::string one = wordList.at( i );
        if( std::string::npos != one.find( '>' ) ) {
            contextData.clear();
        } else {
            contextData += one + " ";
        }
    }
    return contextData;
}

StringVec ContextProvider::getAllOccurrences(std::string &word)
{
    StringVec contextTextList;
    IndexManager* indexMgr = INDEX_MGR()->instance();
    std::vector< int > posList;
    if( nullptr != indexMgr ) {
        indexMgr->getWordIndices( word, posList );
    }
    if( posList.size() ) {
        for( auto it : posList ) {
            std::string contextInfo = getWordContext( word, (it) );
            if( !contextInfo.empty() ) {
                contextTextList.emplace_back( contextInfo );
            }
        }
    }
    return contextTextList;
}

}


text:
<?xml version="1.0" encoding="utf-8"?>
<resources>
  <string name="challenges">Utfordringer</string>
  <string name="challengeToPlay">Utfordre til et parti</string>
  <string name="challengeDeclined">Utfordring avslått</string>
  <string name="challengeAccepted">Utfordring godtatt!</string>
  <string name="challengeCanceled">Utfordring avbrutt.</string>
  <string name="registerToSendChallenges">Registrer deg for å utfordre andre.</string>
  <string name="youCannotChallengeX">Du kan ikke utfordre %s.</string>
  <string name="xDoesNotAcceptChallenges">%s godtar ikke utfordringer.</string>
  <string name="yourXRatingIsTooFarFromY">Ratingen din i %1$s er for langt unna %2$s.</string>
  <string name="cannotChallengeDueToProvisionalXRating">Kan ikke utfordre på grunn av provisorisk rating i %s.</string>
  <string name="xOnlyAcceptsChallengesFromFriends">%s godtar bare utfordringer fra venner.</string>
  <string name="declineGeneric">Jeg godtar ikke utfordringer for øyeblikket.</string>
  <string name="declineLater">Det passer ikke akkurat nå, spør senere.</string>
  <string name="declineTooFast">Denne tidskontrollen er for rask for meg, send en ny utfordring til et tregere parti.</string>
  <string name="declineTooSlow">Denne tidskontrollen er for treg for meg, send en ny utfordring til et raskere parti.</string>
  <string name="declineTimeControl">Jeg godtar ikke utfordringer med denne tidskontrollen.</string>
  <string name="declineRated">Send meg en utfordring til et ratet parti i stedet.</string>
  <string name="declineCasual">Send meg en utfordring til et uformelt parti i stedet.</string>
  <string name="declineStandard">Jeg godtar ikke utfordringer til varianter for øyeblikket.</string>
  <string name="declineVariant">Jeg ønsker ikke å spille denne varianten for øyeblikket.</string>
  <string name="declineNoBot">Jeg godtar ikke utfordringer fra boter.</string>
  <string name="declineOnlyBot">Jeg godtar bare utfordringer fra boter.</string>
</resources>


text:
/**
 * \file
 * This file contains the dynamic library module for Unbound.
 * This loads a dynamic library (.dll, .so) and calls that for the
 * module actions.
 */
#include "config.h"
#include "dynlibmod/dynlibmod.h"
#include "util/module.h"
#include "util/config_file.h"

#if HAVE_WINDOWS_H
#include <windows.h>
#define __DYNMOD HMODULE
#define __DYNSYM FARPROC
#define __LOADSYM GetProcAddress
static void log_dlerror() {
    DWORD dwLastError = GetLastError();
    LPSTR MessageBuffer;
    DWORD dwBufferLength;
    DWORD dwFormatFlags = FORMAT_MESSAGE_ALLOCATE_BUFFER |
        FORMAT_MESSAGE_IGNORE_INSERTS |
        FORMAT_MESSAGE_FROM_SYSTEM ;
    if((dwBufferLength = FormatMessageA(
        dwFormatFlags,
        NULL, // module to get message from (NULL == system)
        dwLastError,
        MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // default language
        (LPSTR) &MessageBuffer,
        0,
        NULL
        )))
    {
        log_err("dynlibmod: %s (%ld)", MessageBuffer, dwLastError);
        LocalFree(MessageBuffer);
    }

}

static HMODULE open_library(const char* fname) {
    return LoadLibrary(fname);
}

static void close_library(const char* fname, __DYNMOD handle) {
	(void)fname;
	(void)handle;
}
#else
#include <dlfcn.h>
#define __DYNMOD void*
#define __DYNSYM void*
#define __LOADSYM dlsym
static void log_dlerror() {
    log_err("dynlibmod: %s", dlerror());
}

static void* open_library(const char* fname) {
    return dlopen(fname, RTLD_LAZY | RTLD_GLOBAL);
}

static void close_library(const char* fname, __DYNMOD handle) {
	if(!handle) return;
	if(dlclose(handle) != 0) {
		log_err("dlclose %s: %s", fname, strerror(errno));
	}
}
#endif

/** module counter for multiple dynlib modules */
static int dynlib_mod_count = 0;

/** dynlib module init */
int dynlibmod_init(struct module_env* env, int id) {
    int dynlib_mod_idx = dynlib_mod_count++;
    struct config_strlist* cfg_item = env->cfg->dynlib_file;
    struct dynlibmod_env* de = (struct dynlibmod_env*)calloc(1, sizeof(struct dynlibmod_env));
    __DYNMOD dynamic_library;
    if (!de)
    {
        log_err("dynlibmod[%d]: malloc failure", dynlib_mod_idx);
        return 0;
    }

    env->modinfo[id] = (void*) de;

    de->fname = NULL;
    for(int i = dynlib_mod_idx;
        i != 0 && cfg_item != NULL;
        i--, cfg_item = cfg_item->next) {}

    if (cfg_item == NULL || cfg_item->str == NULL || cfg_item->str[0] == 0) {
        log_err("dynlibmod[%d]: no dynamic library given.", dynlib_mod_idx);
        return 0;
    } else {
        de->fname = cfg_item->str;
    }
    verbose(VERB_ALGO, "dynlibmod[%d]: Trying to load library %s", dynlib_mod_idx, de->fname);
    dynamic_library = open_library(de->fname);
    de->dynamic_library = (void*)dynamic_library;
    if (dynamic_library == NULL) {
        log_dlerror();
        log_err("dynlibmod[%d]: unable to load dynamic library \"%s\".", dynlib_mod_idx, de->fname);
        return 0;
    } else {
	__DYNSYM initializer;
	__DYNSYM deinitializer;
	__DYNSYM operate;
	__DYNSYM inform;
	__DYNSYM clear;
	__DYNSYM get_mem;
        initializer = __LOADSYM(dynamic_library,"init");
        if (initializer == NULL) {
            log_dlerror();
            log_err("dynlibmod[%d]: unable to load init procedure from dynamic library \"%s\".", dynlib_mod_idx, de->fname);
            return 0;
        } else {
            de->func_init = (func_init_t)(void*)initializer;
        }
        deinitializer = __LOADSYM(dynamic_library,"deinit");
        if (deinitializer == NULL) {
            log_dlerror();
            log_err("dynlibmod[%d]: unable to load deinit procedure from dynamic library \"%s\".", dynlib_mod_idx, de->fname);
            return 0;
        } else {
            de->func_deinit = (func_deinit_t)(void*)deinitializer;
        }
        operate = __LOADSYM(dynamic_library,"operate");
        if (operate == NULL) {
            log_dlerror();
            log_err("dynlibmod[%d]: unable to load operate procedure from dynamic library \"%s\".", dynlib_mod_idx, de->fname);
            return 0;
        } else {
            de->func_operate = (func_operate_t)(void*)operate;
        }
        inform = __LOADSYM(dynamic_library,"inform_super");
        if (inform == NULL) {
            log_dlerror();
            log_err("dynlibmod[%d]: unable to load inform_super procedure from dynamic library \"%s\".", dynlib_mod_idx, de->fname);
            return 0;
        } else {
            de->func_inform = (func_inform_t)(void*)inform;
        }
        clear = __LOADSYM(dynamic_library,"clear");
        if (clear == NULL) {
            log_dlerror();
            log_err("dynlibmod[%d]: unable to load clear procedure from dynamic library \"%s\".", dynlib_mod_idx, de->fname);
            return 0;
        } else {
            de->func_clear = (func_clear_t)(void*)clear;
        }
        get_mem = __LOADSYM(dynamic_library,"get_mem");
        if (get_mem == NULL) {
            log_dlerror();
            log_err("dynlibmod[%d]: unable to load get_mem procedure from dynamic library \"%s\".", dynlib_mod_idx, de->fname);
            return 0;
        } else {
            de->func_get_mem = (func_get_mem_t)(void*)get_mem;
        }
    }
    de->inplace_cb_delete_wrapped = &inplace_cb_delete_wrapped;
    de->inplace_cb_register_wrapped = &inplace_cb_register_wrapped;
    return de->func_init(env, id);
}

/** dynlib module deinit */
void dynlibmod_deinit(struct module_env* env, int id) {
    struct dynlibmod_env* de = env->modinfo[id];
    if(de == NULL)
        return;
    de->func_deinit(env, id);
    close_library(de->fname, (__DYNMOD)de->dynamic_library);
    dynlib_mod_count--;
    de->fname = NULL;
    free(de);
}

/** dynlib module operate on a query */
void dynlibmod_operate(struct module_qstate* qstate, enum module_ev event,
    int id, struct outbound_entry* outbound) {
    struct dynlibmod_env* de = qstate->env->modinfo[id];

    de->func_operate(qstate, event, id, outbound);
}

/** dynlib module  */
void dynlibmod_inform_super(struct module_qstate* qstate, int id,
    struct module_qstate* super) {
    struct dynlibmod_env* de = qstate->env->modinfo[id];

    de->func_inform(qstate, id, super);
}

/** dynlib module cleanup query state */
void dynlibmod_clear(struct module_qstate* qstate, int id) {
    struct dynlibmod_env* de = qstate->env->modinfo[id];

    de->func_clear(qstate, id);
}

/** dynlib module alloc size routine */
size_t dynlibmod_get_mem(struct module_env* env, int id) {
    struct dynlibmod_env* de = (struct dynlibmod_env*)env->modinfo[id];
    size_t size;
    verbose(VERB_ALGO, "dynlibmod: get_mem, id: %d, de:%p", id, de);
    if(!de)
        return 0;

    size = de->func_get_mem(env, id);
    return size + sizeof(*de);
}

int dynlib_inplace_cb_reply_generic(struct query_info* qinfo,
    struct module_qstate* qstate, struct reply_info* rep, int rcode,
    struct edns_data* edns, struct edns_option** opt_list_out,
    struct comm_reply* repinfo, struct regional* region,
    struct timeval* start_time, int id, void* callback) {
    struct cb_pair* cb_pair = (struct cb_pair*) callback;
    return ((inplace_cb_reply_func_type*) cb_pair->cb)(qinfo, qstate, rep, rcode, edns, opt_list_out, repinfo, region, start_time, id, cb_pair->cb_arg);
}

int dynlib_inplace_cb_query_generic(struct query_info* qinfo, uint16_t flags,
    struct module_qstate* qstate, struct sockaddr_storage* addr,
    socklen_t addrlen, uint8_t* zone, size_t zonelen, struct regional* region,
    int id, void* callback) {
    struct cb_pair* cb_pair = (struct cb_pair*) callback;
    return ((inplace_cb_query_func_type*) cb_pair->cb)(qinfo, flags, qstate, addr, addrlen, zone, zonelen, region, id, cb_pair->cb_arg);
}

int dynlib_inplace_cb_edns_back_parsed(struct module_qstate* qstate,
    int id, void* cb_args) {
    struct cb_pair* cb_pair = (struct cb_pair*) cb_args;
    return ((inplace_cb_edns_back_parsed_func_type*) cb_pair->cb)(qstate, id, cb_pair->cb_arg);
}

int dynlib_inplace_cb_query_response(struct module_qstate* qstate,
    struct dns_msg* response, int id, void* cb_args) {
    struct cb_pair* cb_pair = (struct cb_pair*) cb_args;
    return ((inplace_cb_query_response_func_type*) cb_pair->cb)(qstate, response, id, cb_pair->cb_arg);
}

int
inplace_cb_register_wrapped(void* cb, enum inplace_cb_list_type type, void* cbarg,
    struct module_env* env, int id) {
    struct cb_pair* cb_pair = malloc(sizeof(struct cb_pair));
    if(cb_pair == NULL) {
	log_err("dynlibmod[%d]: malloc failure", id);
        return 0;
    }
    cb_pair->cb = cb;
    cb_pair->cb_arg = cbarg;
    if(type >= inplace_cb_reply && type <= inplace_cb_reply_servfail) {
        return inplace_cb_register(&dynlib_inplace_cb_reply_generic, type, (void*) cb_pair, env, id);
    } else if(type == inplace_cb_query) {
        return inplace_cb_register(&dynlib_inplace_cb_query_generic, type, (void*) cb_pair, env, id);
    } else if(type == inplace_cb_query_response) {
        return inplace_cb_register(&dynlib_inplace_cb_query_response, type, (void*) cb_pair, env, id);
    } else if(type == inplace_cb_edns_back_parsed) {
        return inplace_cb_register(&dynlib_inplace_cb_edns_back_parsed, type, (void*) cb_pair, env, id);
    } else {
        free(cb_pair);
        return 0;
    }
}

void
inplace_cb_delete_wrapped(struct module_env* env, enum inplace_cb_list_type type,
    int id) {
    struct inplace_cb* temp = env->inplace_cb_lists[type];
    struct inplace_cb* prev = NULL;

    while(temp) {
        if(temp->id == id) {
            if(!prev) {
                env->inplace_cb_lists[type] = temp->next;
                free(temp->cb_arg);
                free(temp);
                temp = env->inplace_cb_lists[type];
            }
            else {
                prev->next = temp->next;
                free(temp->cb_arg);
                free(temp);
                temp = prev->next;
            }
        }
        else {
            prev = temp;
            temp = temp->next;
        }
    }
}

/**
 * The module function block
 */
static struct module_func_block dynlibmod_block = {
   "dynlib",
   &dynlibmod_init, &dynlibmod_deinit, &dynlibmod_operate, &dynlibmod_inform_super,
   &dynlibmod_clear, &dynlibmod_get_mem
};

struct module_func_block* dynlibmod_get_funcblock(void)
{
   return &dynlibmod_block;
}


text: This project has been moved to the [Pyterp Project](https://github.com/Deathnerd/pyterp)


text:
Before You Start

This documentation tells you how to write Chrome Apps.
All developers, however, should know that the new APIs
for Chrome Apps are being released as a developer preview.
This means that they are evolving daily,
and anything you read now might be different in the near future.
Please keep up to date with the API reference and documentation.

Note:
If you've written packaged apps before,
your legacy packaged apps
will still work the way they always have,
but they won't have access to the new APIs.

Common platform

Chrome Apps and extensions share a common platform.
They can access many of the same APIs and
they have the same manifest and permissions format.
If you're familiar with the
Chrome Extension docs,
then the Reference docs should seem familiar.
Many of the reference docs are shared;
we've filtered accessibility to docs that aren't.

Where to start

Read the
  Getting Started guide.

Follow the
  Todo App Codelab.

Check out the
  Chrome JavaScript APIs.

Fork any and all
  chrome-app-samples and make something of your own.

Watch the
Chrome Apps GDL sessions.

Send feedback!

For Chrome Apps to succeed,
we need and want your feedback.
You can enter feedback at the
chromium-apps group,
file a bug at the
official issue tracker,
or press "Send Feedback" at the bottom of every doc page.

Back to top


text:
@{
    "Validate-AzureRmCdnCustomDomain" = "Test-AzureRmCdnCustomDomain";
}.GetEnumerator() | Select @{Name='Name'; Expression={$_.Key}}, @{Name='Value'; Expression={$_.Value}} | Set-Alias -Description "AzureAlias"


text:
#ifndef SPINVCOV_H_
#define SPINVCOV_H_

#include <shogun/lib/config.h>

#include <shogun/base/SGObject.h>
#include <shogun/lib/SGMatrix.h>

namespace shogun
{

/** @brief used to estimate inverse covariance matrix using graphical lasso
 *
 * implementation is based on SLEP library's code
 */
class CSparseInverseCovariance : public CSGObject
{
public:

	/** constructor */
	CSparseInverseCovariance();

	/** destructor */
	virtual ~CSparseInverseCovariance();

	/** estimate inverse covariance matrix
	 *
	 * @param S empirical covariance matrix
	 * @param lambda_c regularization constant
	 */
	SGMatrix<float64_t> estimate(SGMatrix<float64_t> S, float64_t lambda_c);

	/** get name */
	const char* get_name() const { return "SparseInverseCovariance"; };

	/** get lasso max iter
	 * @return lasso max iter
	 */
	int32_t get_lasso_max_iter() const { return m_lasso_max_iter; }
	/** get max iter
	 * @return max iter
	 */
	int32_t get_max_iter() const { return m_max_iter; }
	/** get lasso max iter
	 * @return lasso max iter
	 */
	float64_t get_f_gap() const { return m_f_gap; }
	/** get lasso max iter
	 * @return lasso max iter
	 */
	float64_t get_x_gap() const { return m_x_gap; }
	/** get lasso max iter
	 * @return lasso max iter
	 */
	float64_t get_xtol() const { return m_xtol; }

	/** set lasso max iter
	 * @param lasso_max_iter lasso max iter
	 */
	void set_lasso_max_iter(int32_t lasso_max_iter)
	{
		m_lasso_max_iter = lasso_max_iter;
	}
	/** set max iter
	 * @param max_iter max iter
	 */
	void set_max_iter(int32_t max_iter)
	{
		m_max_iter = max_iter;
	}
	/** set f gap
	 * @param f_gap f gap
	 */
	void set_f_gap(int32_t f_gap)
	{
		m_f_gap = f_gap;
	}
	/** set x gap
	 * @param x_gap x gap
	 */
	void set_x_gap(int32_t x_gap)
	{
		m_x_gap = x_gap;
	}
	/** set xtol
	 * @param xtol xtol
	 */
	void set_xtol(int32_t xtol)
	{
		m_xtol = xtol;
	}

private:

	/** register parameters */
	void register_parameters();

protected:

	/** LASSO max iter */
	int32_t m_lasso_max_iter;

	/** max iter */
	int32_t m_max_iter;

	/** fGap */
	float64_t m_f_gap;

	/** xGap */
	float64_t m_x_gap;

	/** xtol */
	float64_t m_xtol;
};

}
#endif


text:
/**
 * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
 */
package net.sourceforge.pmd.lang.java.rule.typeresolution;

import net.sourceforge.pmd.testframework.SimpleAggregatorTst;

public class SignatureDeclareThrowsExceptionTest extends SimpleAggregatorTst {

    private static final String RULESET = "java-typeresolution";

    @Override
    public void setUp() {
        addRule(RULESET, "SignatureDeclareThrowsException");
    }
}


text:
import React from 'react';
import {
  AppRegistry,
  StyleSheet,
  View,
  Text,
  Dimensions,
  TouchableOpacity,
  Modal,
  Button,
  NetInfo,
} from 'react-native';

import MapView, { MAP_TYPES } from 'react-native-maps';
import _ from 'lodash';
import pick from 'lodash/pick';
import {GoogleSignin, GoogleSigninButton} from 'react-native-google-signin';

import SideMenu from 'react-native-side-menu';
import Hamburger from 'react-native-hamburger';
import Message from './Message';

// import './UserAgent';
// import io from 'socket.io-client';
// const socket = io('http://faharu.com:8000');

const { width, height } = Dimensions.get('window');
const ASPECT_RATIO = width / height;
const LATITUDE = 0;
const LONGITUDE = 0;
const LATITUDE_DELTA = 0.0122;
const LONGITUDE_DELTA = LATITUDE_DELTA * ASPECT_RATIO;
const DEFAULT_PADDING = { top: 40, right: 40, bottom: 40, left: 40 };

export default class Main extends React.Component {
  constructor(props) {
    super(props);

    this.state = {
      user: null,
      userList: [],
      isOpen: false,
      selectedItem: 'About',
      isRecording: false,
      serverConnection: false,
      pathCoordinates: [],
      latitude: null,
      longitude: null,
      followUser: true,
      ping: '- ',
      error: null,
      nodeNumber: 0,
      region: {
        latitude: LATITUDE,
        longitude: LONGITUDE,
        latitudeDelta: LATITUDE_DELTA,
        longitudeDelta: LONGITUDE_DELTA,
      }
    };

    this.socket = new WebSocket('ws://faharu.com:8888');

  }

  onAddNode(socket) {
    socket.onmessage = (event) => {
      let data = JSON.parse(event.data);

    }
  }

  requestUserList(user) {
    user = user ? user : this.state.user
    if (user !== null) {
      let request1 = {
        type: 'userUpdate',
        user: user,
      }
      console.log('conz requestUserList()::userUpdate', user.id)
      this.socket.send(JSON.stringify(request1));

      let request2 = {
        type: 'getUsers',
        fromClient: this.state.user.id,
        user: this.state.user.id,
      };
      // console.log('conz req::', request)
      this.socket.send(JSON.stringify(request2));
      console.log('conz :: user.id', JSON.stringify(this.state.user.id))

    }
  }

  pinger() {
    if (this.state.user)
      setInterval(() => this.ping(), 400);
  }
  async ping() {
    let date = new Date();
    let time = date.getTime();
    request = {
      type: 'ping',
      user: this.state.user,
      pingTime: time,
    }
    this.socket.send(JSON.stringify(request));
    // this.setState({ping: '-'});
  }

  componentDidMount() {
    // this.socket = new WebSocket('ws://faharu.com:8000');
    console.log('*******componentDidMount() here*****');

        //WebSocket listener
    this.setState({error: <Text>Connecting to Faharu...</Text>})
    this._setupGoogleSignin();
    this.socketStart();
    this.socket.onclose = () => {
      this.setState({error: <Text>Disconnected!</Text>});
      this.socketStart();
    }

    this.watchID = navigator.geolocation.watchPosition(
      (position) => {
        const { pathCoordinates } = this.state
        const latitude = position.coords.latitude
        const longitude = position.coords.longitude
        let d = new Date();
        let timestamp = d.getTime();

        if (this.state.isRecording == true) {
          const positionArray = null
          positionArray = pick(position.coords, ['latitude', 'longitude'])
/*          this.addNode(latitude, longitude, timestamp, (connectionStatus) => {
            this.setState({serverConnection: connectionStatus})
          });*/
          this.addNode(latitude, longitude, timestamp);
          this.setState({
            pathCoordinates: pathCoordinates.concat(positionArray),
            nodeNumber: this.state.nodeNumber + 1,
          })
        } else {
            this.setState({
              pathCoordinates: [],
              nodeNumber: 0,
            })
        }

        this.setState({
          latitude: latitude,
          longitude: longitude,
          region: {
            latitude: latitude,
            longitude: longitude,
            latitudeDelta: LATITUDE_DELTA,
            longitudeDelta: LONGITUDE_DELTA
          }
        });
      },
      (error) => this.setState({ error: error.message}),
      {enableHighAccuracy: true, timeout: 5000, maximumAge: 500, distanceFilter: 10}
      //distanceFilter sets location accuracy; 10 meters
    );

  }
  socketStart() {
    this.setState({error: null});
    this.socket.onopen = () => {
      console.log('conz::onopen/main:8888');

      const locationUpdate = setInterval(() => {
        let d = new Date();
        let t = d.getTime();
        console.log('conz this should be T :::' + t)
        let request = {
          type: 'isAlive',
          user: this.state.user,
          latitude: this.state.latitude,
          longitude: this.state.longitude,
          timestamp: t,
        };
        this.socket.send(JSON.stringify(request))
      }, 5000);

      this.socket.onmessage = (event) => {
        let data = JSON.parse(event.data);
        console.log('conz Received a message...', data)
        switch (data.type) {
          case 'onAddNode':
            this.setState({pathID: data.pathID})
            console.log('conz Received onAddNode :: ', data.pathID)
            break;

          case 'ping':
            let currentDate = new Date();
            let currentTime = currentDate.getTime();
            let latency = currentTime - data.ping;
            latency = Math.abs(latency);
            this.setState({ping: latency})
            console.log('conz pong::' + latency)
            break;
        }
      }
    }
  }

  componentWillUnmount() {
    navigator.geolocation.clearWatch(this.watchID);
    this.socket.close();
  }

  updateCurrent(pathCoordinates) {

  }

  onToggleFollow() {
    this.setState({ followUser: !this.state.followUser })
  }

  recordButton() {
    this.setState({ isRecording: !this.state.isRecording, nodeNumber: 0 });
  }

  addNode(latitude, longitude, timestamp) {
    let request = {
      type: 'addNode',
      pathID: typeof this.state.pathID !== undefined ? this.state.pathID : null,
      latitude: latitude,
      longitude: longitude,
      recording: this.state.isRecording,
      user: this.state.user,
      nodeNumber: this.state.nodeNumber,
      timestamp: timestamp,
      ping: this.state.ping,
     };

    this.socket.send(JSON.stringify(request));
  }

  regionNow() {
    const { region } = this.state;
    return {
      latitude: this.state.latitude,
      longitude: this.state.longitude,
      latitudeDelta: LATITUDE_DELTA,
      longitudeDelta: LONGITUDE_DELTA,
    };
  }

  async _setupGoogleSignin() {
    try {
      await GoogleSignin.hasPlayServices({ autoResolve: true });
      await GoogleSignin.configure({
        webClientId: '895298796941-qmolk65fab827dojmdbbgv24f7uuso40.apps.googleusercontent.com', //https://console.developers.google.com/apis/credentials/oauthclient/895298796941-qmolk65fab827dojmdbbgv24f7uuso40.apps.googleusercontent.com?project=odifaharu
        // webClientId: '895298796941-ascgnd7n2e5svuef5hmv28s5h7q2d7gh.apps.googleusercontent.com', //release
        offlineAccess: false
      });

      const user = await GoogleSignin.currentUserAsync();
      this.setState({user: user});
      if (typeof user !== 'undefined' & user !== null) {
        console.log('conz signed in ::', user.id);

        this.requestUserList(user);
      }
    }
    catch(err) {
      console.log("conz Play services error", err.code, err.message);
      // this.setState({error: <Text>Error: {JSON.stringify(err.message)}</Text>})
    }
  }

  _signIn() {
    GoogleSignin.signIn()
    .then((user) => {
      this.setState({user: user});
      if (typeof user !== 'undefined' & user !== null) {
        this.requestUserList(user);
      }
    })
    .catch((err) => {
      console.log('WRONG SIGNIN', err);
      this.setState({error: <Text>Something went wrong, please try again</Text>});
    })
    .done();
  }

  _signOut() {
    GoogleSignin.revokeAccess().then(() => GoogleSignin.signOut()).then(() => {
      this.setState({user: null});
    })
    .done();
  }

  toggleSidebar(isOpen) {
    this.setState({ isOpen })
  }

  render() {
    const messageBar = <Message user={this.state.user} userList={this.state.userList} />
    const recordingButton = {
      backgroundColor: this.state.isRecording ? 'rgba(209, 31, 80, 0.8)' : 'rgba(40, 45, 58, 0.5)',
    }

    if (!this.state.user) {
      return (
        <View style={styles.signin}>
          <GoogleSigninButton
            style={{width: 230, height: 48, margin: 50, }}
            size={GoogleSigninButton.Size.Standard}
            color={GoogleSigninButton.Color.Light}
            onPress={this._signIn.bind(this)}/>
          {this.state.error}
        </View>
      )
    }

    if (this.state.isRecording && this.state.pathCoordinates.length > 0) {
      recordPolyline = <MapView.Polyline coordinates= {this.state.pathCoordinates} strokeColor= {'#1985FE'} strokeWidth= {10}/>
    } else { recordPolyline = null }

    if(this.state.user) {
      return (
        <SideMenu
          menuPosition={'right'}
          menu={messageBar}
          isOpen={this.state.isOpen}
          onChange={isOpen => this.toggleSidebar(isOpen)}
          bounceBackOnOverdraw={true}
          autoClosing={false}
        >
          <View style={styles.container}>
            <TouchableOpacity
              onPress={ () => this.setState({isOpen: !this.state.isOpen}) }
              style={styles.openMessagingBtn}
            >
              <Text style={{textAlign: 'center', verticalAlign: 'center', color: 'rgba(55,55,55,0.4)', padding: 'auto',}}>⬤⬤⬤⬤⬤⬤⬤⬤⬤⬤⬤⬤</Text>
            </TouchableOpacity>
            <MapView
              provider={this.props.provider}
              ref={ref => { this.map = ref; }}
              // mapType={MAP_TYPES.TERRAIN}
              style={styles.map}
              initialRegion={this.state.region}
              // followUserLocation={this.state.followUser}//this DOES NOT work in any way
              region={this.state.followUser ? this.state.region : null}//this enables follow
              showsUserLocation={true}
              loadingEnabled={true}
            >
            {recordPolyline}
              <MapView.Marker
                pinColor={'green'}
                coordinate={{
                  latitude: (this.state.latitude) || -36.82339,
                  longitude: (this.state.longitude) || -73.03569,
                  heading: (this.state.heading),
                  speed: (this.state.speed),
                }}>
              </MapView.Marker>
            </MapView>
            <View style = {styles.panel}>
              <View style = {styles.buttonContainer}>
                <TouchableOpacity
                  onPress={ () => this.onToggleFollow() }
                  style={[styles.bubble, styles.button]}
                >
                  <Text style={{fontSize: 18, color: 'white', textAlign: 'center',}}>Follow:{"\n"}{this.state.followUser ? '✔' : '❌'}</Text>
                </TouchableOpacity>
                <TouchableOpacity
                  onPress={ () => this.recordButton() }
                  style={[styles.bubble, styles.button, recordingButton]}
                >
                  {this.state.isRecording ? <Text style={{padding: 4, textAlign: 'center', fontSize: 40, color: 'black'}}>■</Text> : <Text style={{padding: 4, textAlign: 'center', fontSize: 40, color: 'red'}}>◉</Text>}
                </TouchableOpacity>
              </View>
              <View style={[styles.statView, styles.latlng]}>
                <Text style={[styles.textStyle]}>
                  Latitude: {this.state.latitude}{"\n"}
                  Longitude: {this.state.longitude}{"\n"}
                  Ping: {this.state.ping}ms{"\n"}
                  {this.state.error == null ? 'Signed in as: ' + this.state.user.name : this.state.error}
                </Text>
              </View>
            </View>
           </View>
        </SideMenu>
  //Signal Strength: {this.state.isConnected ? 'Connected' : 'Offline'}{"\n"}
      );
    }
  }
}

Main.propTypes = {
  provider: MapView.ProviderPropType,
};

const styles = StyleSheet.create({
  panel: {
    flexDirection: 'column',
    alignItems: 'center',
    alignSelf: 'stretch',
  },
  textStyle:{
    textAlign: 'left',
    color: '#E6E6E6',
  },
  container: {
    ...StyleSheet.absoluteFillObject,
    justifyContent: 'flex-end',
    alignItems: 'center',
    // borderRightWidth: 2,
    // borderRightColor: 'red',
  },
  signin: {
    ...StyleSheet.absoluteFillObject,
    justifyContent: 'center',
    backgroundColor: '#3F8D89',
    alignItems: 'center',
  },
  map: {
    ...StyleSheet.absoluteFillObject,
    zIndex: -1,

  },
  statView: {
    paddingHorizontal: 12,
    paddingVertical: 12,
    alignSelf: 'stretch',
    backgroundColor: 'rgba(40, 45, 58, 0.8)',
    borderTopLeftRadius: 8,
    borderTopRightRadius: 8,
    alignSelf: 'stretch',
  },
  bubble: {
    backgroundColor: 'rgba(40, 45, 58, 0.5)',
    // paddingHorizontal: 18,
    // paddingVertical: 12,
    borderRadius: 20,
  },
  latlng: {
    alignSelf: 'stretch',
  },
  button: {
    width: 80,
    padding: 0,
    marginHorizontal: 10,
  },
  buttonContainer: {
    flexDirection: 'row',
    color: '#fff',
    marginVertical: 5,
    backgroundColor: 'transparent',
  },
  openMessagingBtn: {
    alignSelf: 'flex-end',
    marginVertical: 0,
    marginRight: 8,
    height: 105,
    width: 30,
    borderRadius: 8,
    backgroundColor: 'rgba(40, 45, 58, 0.5)',
  },
});

AppRegistry.registerComponent('Main', () => Main);


text:
test_description='git svn merge detection'
. ./lib-git-svn.sh

svn_ver="$(svn --version --quiet)"
case $svn_ver in
0.* | 1.[0-4].*)
	skip_all="skipping git-svn test - SVN too old ($svn_ver)"
	test_done
	;;
esac

test_expect_success 'initialize source svn repo' '
	svn_cmd mkdir -m x "$svnrepo"/trunk &&
	svn_cmd mkdir -m x "$svnrepo"/branches &&
	svn_cmd co "$svnrepo"/trunk "$SVN_TREE" &&
	(
		cd "$SVN_TREE" &&
		touch foo &&
		svn_cmd add foo &&
		svn_cmd commit -m "initial commit" &&
		svn_cmd cp -m branch "$svnrepo"/trunk "$svnrepo"/branches/branch1 &&
		svn_cmd switch "$svnrepo"/branches/branch1 &&
		touch bar &&
		svn_cmd add bar &&
		svn_cmd commit -m branch1 &&
		svn_cmd cp -m branch "$svnrepo"/branches/branch1 "$svnrepo"/branches/branch2 &&
		svn_cmd switch "$svnrepo"/branches/branch2 &&
		touch baz &&
		svn_cmd add baz &&
		svn_cmd commit -m branch2 &&
		svn_cmd switch "$svnrepo"/trunk &&
		touch bar2 &&
		svn_cmd add bar2 &&
		svn_cmd commit -m trunk &&
		svn_cmd switch "$svnrepo"/branches/branch2 &&
		svn_cmd merge "$svnrepo"/trunk &&
		svn_cmd commit -m "merge trunk"
		svn_cmd switch "$svnrepo"/trunk &&
		svn_cmd merge --reintegrate "$svnrepo"/branches/branch2 &&
		svn_cmd commit -m "merge branch2"
	) &&
	rm -rf "$SVN_TREE"
'

test_expect_success 'clone svn repo' '
	git svn init -s "$svnrepo" &&
	git svn fetch
'

test_expect_success 'verify merge commit' 'x=$(git rev-parse HEAD^2) &&
	y=$(git rev-parse branch2) &&
	test "x$x" = "x$y"
'

test_done


text:
/**
 *
Immutable POJOs which provide native object representation of the JSON
 * returned by remote API calls.

 */
package travel.izi.api.model.entity;


text:
namespace google {
namespace api {

}  // namespace google
}  // namespace api