text:
package api_test

import (
	"net/http"
	"net/http/httptest"
	"time"

	testapi "github.com/nttlabs/cli/cf/api/fakes"
	"github.com/nttlabs/cli/cf/errors"
	"github.com/nttlabs/cli/cf/models"
	"github.com/nttlabs/cli/cf/net"
	testconfig "github.com/nttlabs/cli/testhelpers/configuration"
	testnet "github.com/nttlabs/cli/testhelpers/net"
	testterm "github.com/nttlabs/cli/testhelpers/terminal"

	. "github.com/nttlabs/cli/cf/api"
	. "github.com/nttlabs/cli/testhelpers/matchers"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("ZonesRepository", func() {
	Describe("listing zones", func() {
		It("lists the zones from the the /v2/zones endpoint", func() {
			firstPageZonesRequest := testapi.NewCloudControllerTestRequest(testnet.TestRequest{
				Method: "GET",
				Path:   "/v2/zones",
				Response: testnet.TestResponse{Status: http.StatusOK, Body: `{
	"next_url": "/v2/zones?page=2",
	"resources": [
		{
		  "metadata": { "guid": "zone1-guid" },
		  "entity": { "name": "Zone1", "is_public": true }
		},
		{
		  "metadata": { "guid": "zone2-guid" },
		  "entity": { "name": "Zone2", "is_public": false, "organization_guid": "org1-guid" }
		},
		{
		  "metadata": { "guid": "zone3-guid" },
		  "entity": { "name": "Zone3", "is_public": false, "organization_guid": "org2-guid" }
		}
	]}`},
			})

			secondPageZonesRequest := testapi.NewCloudControllerTestRequest(testnet.TestRequest{
				Method: "GET",
				Path:   "/v2/zones?page=2",
				Response: testnet.TestResponse{Status: http.StatusOK, Body: `{"resources": [
		{
		  "metadata": { "guid": "zone4-guid" },
		  "entity": { "name": "Zone4", "is_public": true }
		}
	]}`},
			})

			testserver, handler, repo := createZoneRepo(firstPageZonesRequest, secondPageZonesRequest)
			defer testserver.Close()

			zones := []models.Zone{}
			apiErr := repo.ListZones(func(o models.Zone) bool {
				zones = append(zones, o)
				return true
			}, "org1-guid")

			Expect(len(zones)).To(Equal(3))
			Expect(zones[0].Guid).To(Equal("zone1-guid"))
			Expect(zones[1].Guid).To(Equal("zone2-guid"))
			Expect(zones[2].Guid).To(Equal("zone4-guid"))
			Expect(apiErr).NotTo(HaveOccurred())
			Expect(handler).To(HaveAllRequestsCalled())
		})

		It("does not call the provided function when there are no zones found", func() {
			emptyZonesRequest := testapi.NewCloudControllerTestRequest(testnet.TestRequest{
				Method:   "GET",
				Path:     "/v2/zones",
				Response: testnet.TestResponse{Status: http.StatusOK, Body: `{"resources": []}`},
			})

			testserver, handler, repo := createZoneRepo(emptyZonesRequest)
			defer testserver.Close()

			wasCalled := false
			apiErr := repo.ListZones(func(o models.Zone) bool {
				wasCalled = true
				return false
			}, "")

			Expect(wasCalled).To(BeFalse())
			Expect(apiErr).NotTo(HaveOccurred())
			Expect(handler).To(HaveAllRequestsCalled())
		})
	})

	Describe("finding zones by name", func() {
		It("returns the zone with that name", func() {
			req := testapi.NewCloudControllerTestRequest(testnet.TestRequest{
				Method: "GET",
				Path:   "/v2/zones?q=name%3AZone1&inline-relations-depth=1",
				Response: testnet.TestResponse{Status: http.StatusOK, Body: `{"resources": [{
	  "metadata": { "guid": "zone1-guid" },
	  "entity": {
		"name": "Zone1",
		"priority": 60,
		"description": "my-cool-description",
		"is_public": false,
		"organization_guid": "org1-guid",
		"organization": {
			"entity": {
				"name": "Org1"
			}
		}
	  }
	}]}`},
			})

			testserver, handler, repo := createZoneRepo(req)
			defer testserver.Close()

			zone, apiErr := repo.FindByName("Zone1", "org1-guid")
			Expect(handler).To(HaveAllRequestsCalled())
			Expect(apiErr).NotTo(HaveOccurred())

			Expect(zone.Name).To(Equal("Zone1"))
			Expect(zone.Guid).To(Equal("zone1-guid"))
			Expect(zone.Priority).To(Equal(60))
			Expect(zone.Description).To(Equal("my-cool-description"))
			Expect(zone.IsPublic).To(Equal(false))
			Expect(zone.OrgGuid).To(Equal("org1-guid"))
			Expect(zone.OrgName).To(Equal("Org1"))
		})

		It("returns a ModelNotFoundError when the zone cannot be found because it is bounded to another org", func() {
			req := testapi.NewCloudControllerTestRequest(testnet.TestRequest{
				Method: "GET",
				Path:   "/v2/zones?q=name%3AZone1&inline-relations-depth=1",
				Response: testnet.TestResponse{Status: http.StatusOK, Body: `{"resources": [{
	  "metadata": { "guid": "zone1-guid" },
	  "entity": {
		"name": "Zone1",
		"priority": 60,
		"description": "my-cool-description",
		"is_public": false,
		"organization_guid": "org2-guid",
		"organization": {
			"entity": {
				"name": "Org2"
			}
		}
	  }
	}]}`},
			})

			testserver, handler, repo := createZoneRepo(req)
			defer testserver.Close()

			_, apiErr := repo.FindByName("Zone1", "org1-guid")
			Expect(handler).To(HaveAllRequestsCalled())
			Expect(apiErr.(*errors.ModelNotFoundError)).NotTo(BeNil())
		})

		It("returns a ModelNotFoundError when the zone cannot be found", func() {
			req := testapi.NewCloudControllerTestRequest(testnet.TestRequest{
				Method:   "GET",
				Path:     "/v2/zones?q=name%3Azone1&inline-relations-depth=1",
				Response: testnet.TestResponse{Status: http.StatusOK, Body: `{"resources": []}`},
			})

			testserver, handler, repo := createZoneRepo(req)
			defer testserver.Close()

			_, apiErr := repo.FindByName("zone1", "")
			Expect(handler).To(HaveAllRequestsCalled())
			Expect(apiErr.(*errors.ModelNotFoundError)).NotTo(BeNil())
		})

		It("returns an api error when the response is not successful", func() {
			requestHandler := testapi.NewCloudControllerTestRequest(testnet.TestRequest{
				Method:   "GET",
				Path:     "/v2/zones?q=name%3Azone1&inline-relations-depth=1",
				Response: testnet.TestResponse{Status: http.StatusBadGateway, Body: `{"resources": []}`},
			})

			testserver, handler, repo := createZoneRepo(requestHandler)
			defer testserver.Close()

			_, apiErr := repo.FindByName("zone1", "")
			_, ok := apiErr.(*errors.ModelNotFoundError)
			Expect(ok).To(BeFalse())
			Expect(handler).To(HaveAllRequestsCalled())
		})
	})

	Describe("creating zones", func() {
		It("creates the zone with the given guid", func() {
			req := testapi.NewCloudControllerTestRequest(testnet.TestRequest{
				Method: "POST",
				Path:   "/v2/zones",
				Matcher: testnet.RequestBodyMatcher(`{
						"name":"my-cool-zone",
						"priority":60,
						"description": "my-cool-description",
						"is_public":false,
						"organization_guid":"my-cool-zone-guid"}`),
				Response: testnet.TestResponse{Status: http.StatusCreated},
			})

			testserver, handler, repo := createZoneRepo(req)
			defer testserver.Close()

			params := defaultZoneParams()
			apiErr := repo.Create(params)
			Expect(handler).To(HaveAllRequestsCalled())
			Expect(apiErr).NotTo(HaveOccurred())
		})

		It("returns an api error when the zone already exists", func() {
			requestHandler := testapi.NewCloudControllerTestRequest(testnet.TestRequest{
				Method: "POST",
				Path:   "/v2/zones",
				Response: testnet.TestResponse{Status: http.StatusBadRequest, Body: `{
					"code":10004,
					"description":"The request is invalid",
					"error_code":"CF-InvalidRequest"}`},
			})

			testserver, handler, repo := createZoneRepo(requestHandler)
			defer testserver.Close()

			params := defaultZoneParams()
			apiErr := repo.Create(params)
			Expect(handler).To(HaveAllRequestsCalled())
			Expect(apiErr).NotTo(BeNil())
		})
	})

	Describe("updating zones", func() {
		It("updates the zone with the given guid", func() {
			req := testapi.NewCloudControllerTestRequest(testnet.TestRequest{
				Method: "PUT",
				Path:   "/v2/zones/my-zone-guid",
				Matcher: testnet.RequestBodyMatcher(`{
						"name":"my-new-zone",
						"priority":70,
						"description": "my-new-description"}`),
				Response: testnet.TestResponse{Status: http.StatusCreated},
			})

			testserver, handler, repo := createZoneRepo(req)
			defer testserver.Close()

			params := defaultUpdateParams()
			apiErr := repo.Update("my-zone-guid", params)
			Expect(handler).To(HaveAllRequestsCalled())
			Expect(apiErr).NotTo(HaveOccurred())
		})

		It("returns an api error when the zone not found", func() {
			req := testapi.NewCloudControllerTestRequest(testnet.TestRequest{
				Method:   "PUT",
				Path:     "/v2/zones/notfound-zone-guid",
				Response: testnet.TestResponse{Status: http.StatusNotFound},
			})

			testserver, handler, repo := createZoneRepo(req)
			defer testserver.Close()

			params := defaultUpdateParams()
			apiErr := repo.Update("notfound-zone-guid", params)
			Expect(handler).To(HaveAllRequestsCalled())
			Expect(apiErr).NotTo(BeNil())
		})
	})

	Describe("deleting zones", func() {
		It("deletes the zone with the given guid", func() {
			req := testapi.NewCloudControllerTestRequest(testnet.TestRequest{
				Method:   "DELETE",
				Path:     "/v2/zones/my-zone-guid?recursive=true",
				Response: testnet.TestResponse{Status: http.StatusOK},
			})

			testserver, handler, repo := createZoneRepo(req)
			defer testserver.Close()

			apiErr := repo.Delete("my-zone-guid")
			Expect(handler).To(HaveAllRequestsCalled())
			Expect(apiErr).NotTo(HaveOccurred())
		})

		It("returns an api error when the zone not found", func() {
			req := testapi.NewCloudControllerTestRequest(testnet.TestRequest{
				Method:   "DELETE",
				Path:     "/v2/zones/notfound-zone-guid?recursive=true",
				Response: testnet.TestResponse{Status: http.StatusNotFound},
			})

			testserver, handler, repo := createZoneRepo(req)
			defer testserver.Close()

			apiErr := repo.Delete("notfound-zone-guid")
			Expect(handler).To(HaveAllRequestsCalled())
			Expect(apiErr).NotTo(BeNil())
		})
	})
})

func defaultZoneParams() models.ZoneParams {
	name := "my-cool-zone"
	priority := 60
	description := "my-cool-description"
	isPublic := false
	orgGuid := "my-cool-zone-guid"

	return models.ZoneParams{
		Name:        &name,
		Priority:    &priority,
		Description: &description,
		IsPublic:    &isPublic,
		OrgGuid:     &orgGuid,
	}
}

func defaultUpdateParams() models.ZoneParams {
	name := "my-new-zone"
	priority := 70
	description := "my-new-description"

	return models.ZoneParams{
		Name:        &name,
		Priority:    &priority,
		Description: &description,
	}
}

func createZoneRepo(reqs ...testnet.TestRequest) (testserver *httptest.Server, handler *testnet.TestHandler, repo ZoneRepository) {
	testserver, handler = testnet.NewServer(reqs)

	configRepo := testconfig.NewRepositoryWithDefaults()
	configRepo.SetApiEndpoint(testserver.URL)
	gateway := net.NewCloudControllerGateway(configRepo, time.Now, &testterm.FakeUI{})
	repo = NewCloudControllerZoneRepository(configRepo, gateway)
	return
}


text:
package com.springmvc.servlet;

import com.springmvc.ClassTools;
import com.springmvc.annotation.MyAutowrited;
import com.springmvc.annotation.MyController;
import com.springmvc.annotation.MyRequestMapping;
import com.springmvc.annotation.MyService;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Properties;
import java.util.Set;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @author
 * @Description 请求几种处理类
 * @date 2017年8月30日下午5:23:54
 */
public class DispatcherServlet extends HttpServlet {

    private static final long serialVersionUID = 1378531571714153483L;

    private static final String CONTROLLER_KEY = "controller";

    private static final String METHOD_KEY = "method";

    private Properties properties = new Properties();

    /**
     * 存放Controller中url和方法的对应关系,格式:{url:{controller:实例化后的对象,method:实例化的方法}}
     */
    private static Map<String, Map<String, Object>> urlMethodMapping = new HashMap<>();
    // 存放Controller和Service的Map,格式:{beanName:实例化后的对象}
    private Map<String, Object> instanceMap = new HashMap<String, Object>();
    // 存放Service接口类型与接口实例对象的Map,格式:{Service.instance.class:实现类实例化后的对象}
    private Map<Class<?>, Object> instanceTypeMap = new HashMap<Class<?>, Object>();
    private Set<Class<?>> classes;

    public DispatcherServlet() {
        super();
    }

    /**
     * 初始化方法,用于实例化扫描到的对象,并做注入和url映射(注:该方法逻辑上已经判断了,只执行一次)
     */
    @Override
    public void init(ServletConfig config) throws ServletException {
        // 只处理一次
        if (urlMethodMapping.size() > 0) {
            return;
        }
        // 加载配置
        doLoadConfig(config.getInitParameter("contextConfigLocation"));
        String PACKAGE = properties.getProperty("scanPackage");
        // 开始扫描包下全部class文件
        classes = ClassTools.getClasses(PACKAGE);

        // 组装instanceMap
        buildInstanceMap(classes);

        // 开始注入
        doIoc();

        // 注入完之后开始映射url和method
        buildUrlMethodMapping();

        System.out.println(urlMethodMapping);
        System.out.println(instanceMap);
        System.out.println(instanceTypeMap);
        System.out.println(classes);
        System.out.println();
    }

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        this.doPost(req, resp);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        // 完整路径
        String url = req.getRequestURI();
        // 跟路径
        String path = req.getContextPath();
        // 计算出method上配置的路径
        String finallyUrl = url.replace(path, "");

        // 取出这个url对应的Controller和method
        Map<String, Object> map = urlMethodMapping.get(finallyUrl);
        if (map == null) {
            resp.getWriter().write("url not found 404");
            return;
        }
        Method method = (Method) map.get(METHOD_KEY);

        //获取方法的参数列表
        Class<?>[] parameterTypes = method.getParameterTypes();

        //获取请求的参数
        Map<String, String[]> parameterMap = req.getParameterMap();

        //保存参数值
        Object[] paramValues = new Object[parameterTypes.length];

        //方法的参数列表
        for (int i = 0; i < parameterTypes.length; i++) {
            //根据参数名称,做某些处理
            String requestParam = parameterTypes[i].getSimpleName();

            if ("HttpServletRequest".equals(requestParam)) {
                //参数类型已明确,这边强转类型
                paramValues[i] = req;
                continue;
            }
            if ("HttpServletResponse".equals(requestParam)) {
                paramValues[i] = resp;
                continue;
            }
            if ("String".equals(requestParam)) {
                for (Entry<String, String[]> param : parameterMap.entrySet()) {
                    String value = Arrays
                        .toString(param.getValue()).replaceAll("\\[|\\]", "").replaceAll(",\\s", ",");
                    paramValues[i] = value;
                }
            }
        }
        //利用反射机制来调用
        try {
            method.invoke(map.get(CONTROLLER_KEY), paramValues);//第一个参数是method所对应的实例 在ioc容器中
        } catch (Exception e) {
            e.printStackTrace();
        }

    }

    private void doLoadConfig(String location) {

        try (InputStream is = this.getClass().getClassLoader().getResourceAsStream(location)) {
            properties.load(is);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    /**
     * 组装instanceMap
     */
    private void buildInstanceMap(Set<Class<?>> classes) {
        // 开始循环全部class
        for (Class<?> clasz : classes) {

            // 组装instanceMap
            // 判断是否是是加了Controller注解的java对象
            if (clasz.isAnnotationPresent(MyController.class)) {
                try {
                    // 实例化对象
                    Object obj = clasz.newInstance();
                    MyController controller = clasz.getAnnotation(MyController.class);

                    // 如果没有设置别名,那么用类名首字母小写做key
                    if (controller.value().isEmpty()) {
                        instanceMap.put(firstLowerName(clasz.getSimpleName()), obj);
                    } else {
                        // 如果设置了别名那么用别名做key
                        instanceMap.put(controller.value(), obj);
                    }
                } catch (Exception e) {
                    throw new RuntimeException("初始化instanceMap时在处理Controller注解时出现了异常");
                }
            } else if (clasz.isAnnotationPresent(MyService.class)) {
                // 实例化对象
                Object obj = null;
                try {
                    // 实例化对象
                    obj = clasz.newInstance();
                    MyService service = clasz.getAnnotation(MyService.class);

                    // 如果没有设置别名,那么用类名首字母小写做key
                    if (service.value().isEmpty()) {
                        instanceMap.put(firstLowerName(clasz.getSimpleName()), obj);
                    } else {
                        // 如果设置了别名那么用别名做key
                        instanceMap.put(service.value(), obj);
                    }
                } catch (Exception e) {
                    throw new RuntimeException("初始化instanceMap时在处理Service注解时出现了异常");
                }
                // 实现的接口数组
                Class<?>[] interfaces = clasz.getInterfaces();
                for (Class<?> class1 : interfaces) {
                    if (instanceTypeMap.get(class1) != null) {
                        throw new RuntimeException(class1.getName() + "接口不能被多个类实现!");
                    }
                    instanceTypeMap.put(class1, obj);
                }
            } else {
                continue;
            }
        }
    }

    /**
     * 根据实例Map开始注入
     */
    private void doIoc() {
        // 开始注入,我们只对加了@Controller和@Service标签中的,属性加了@autowired的进行注入操作
        for (Entry<String, Object> entry : instanceMap.entrySet()) {

            // 取出全部的属性
            Field[] fields = entry.getValue().getClass().getDeclaredFields();

            // 循环属性校验哪些是加了@autowired注解的
            for (Field field : fields) {
                field.setAccessible(true);// 可访问私有属性

                // 有注解的时候
                if (field.isAnnotationPresent(MyAutowrited.class)) {

                    // 没有配别名注入的时候
                    if (field.getAnnotation(MyAutowrited.class).value().isEmpty()) {
                        // 直接获取
                        try {
                            // 根据类型来获取他的实现类
                            Object object = instanceTypeMap.get(field.getType());
                            field.set(entry.getValue(), object);
                            System.out.println("auto by type: " + field.getType() + ", " + entry.getValue());
                        } catch (IllegalArgumentException | IllegalAccessException e) {
                            e.printStackTrace();
                        }
                    } else {
                        try {
                            // 将被注入的对象
                            Object object = instanceMap.get(field.getAnnotation(MyAutowrited.class).value());
                            System.out.println(
                                "auto by name: " + field.getAnnotation(MyAutowrited.class).value() + ", " + entry
                                    .getValue());
                            field.set(entry.getValue(), object);
                        } catch (Exception e) {
                            throw new RuntimeException("开始注入时出现了异常");
                        }
                    }
                }
            }
        }
    }

    /**
     * 注入完之后开始映射url和method
     */
    private void buildUrlMethodMapping() {
        // 注入完之后开始映射url和method
        // 组装urlMethodMapping
        for (Entry<String, Object> entry : instanceMap.entrySet()) {

            // 迭代出所有的url
            String parenturl = "";

            // 判断Controller上是否加了requestMapping
            if (entry.getValue().getClass().isAnnotationPresent(MyRequestMapping.class)) {
                parenturl = entry.getValue().getClass().getAnnotation(MyRequestMapping.class).value();
            }

            // 取出全部的method
            Method[] methods = entry.getValue().getClass().getMethods();

            // 迭代全部的方法,检查哪些方法上加了requestMaping注解
            for (Method method : methods) {
                if (method.isAnnotationPresent(MyRequestMapping.class)) {
                    // 得到一个完整的url请求
                    String url = parenturl + method.getAnnotation(MyRequestMapping.class).value();
                    Map<String, Object> value = new HashMap<>();
                    value.put(CONTROLLER_KEY, entry.getValue());
                    value.put(METHOD_KEY, method);
                    urlMethodMapping.put(url, value);
                }
            }
        }
    }

    /**
     * 首字母小写
     *
     * @return
     */
    private String firstLowerName(String name) {
        name = name.substring(0, 1).toLowerCase() + name.substring(1);
        return name;
    }
}

redpajama_set_name: RedPajamaGithub


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

using Foundation;
using UIKit;

namespace AQTapDemo
{
	[Register ("AppDelegate")]
	public partial class AppDelegate : UIApplicationDelegate
	{
		// class-level declarations
		UIWindow window;
		AQTapDemoViewController viewController;

		public override bool FinishedLaunching (UIApplication app, NSDictionary options)
		{
			window = new UIWindow (UIScreen.MainScreen.Bounds);

			viewController = new AQTapDemoViewController ();
			window.RootViewController = viewController;
			window.MakeKeyAndVisible ();

			return true;
		}

		static void Main (string[] args)
		{
			UIApplication.Main (args, null, "AppDelegate");
		}
	}
}


text:
{% extends "base.html" %}

{% block content %}

Latest

    {% for article in article_list %}

            {{ article.title }} {{ article.description }}

                {{ article.published_on|date:"D, j M Y" }}

    {% endfor %}

        {% if page_obj.has_previous %}
            Previous |
        {% else %}
            Previous |
        {% endif %}

            Page {{ page_obj.number }} of {{ page_obj.paginator.num_pages }}

        {% if page_obj.has_next %}
            | Next
        {% else %}
            | Next
        {% endif %}

{% endblock %}


text:
<?php

namespace Banckle\Helpdesk\Models;

class DepartmentShortDto {

  static $swaggerTypes = array(
      'Id' => 'string',
      'Name' => 'string'

    );

  public $Id; // string
  public $Name; // string
  }


text:
package de.plushnikov;

import com.intellij.openapi.application.ApplicationInfo;
import com.intellij.openapi.util.BuildNumber;
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase;

/**
 * Simple extension of {@link LightCodeInsightFixtureTestCase} that allows skipping test cases
 * based on required Platform API version.
 *
 * @author Alexej Kubarev
 */
public abstract class ApiVersionAwareLightCodeInsightFixureTestCase extends LightCodeInsightFixtureTestCase {

  private String getMinVersion() {
    RequiredApiVersion requiredVersionAnnotation = getClass().getAnnotation(RequiredApiVersion.class);
    if (requiredVersionAnnotation != null) {
      return requiredVersionAnnotation.value();
    }
    return getCurrentVersion().asStringWithoutProductCode();
  }

  @Override
  protected void runTest() throws Throwable {

    // Minimal API Version for these tests to pass
    BuildNumber required = BuildNumber.fromString(getMinVersion());
    if (getCurrentVersion().compareTo(required) >= 0) {
      super.runTest();
    }
  }

  private BuildNumber getCurrentVersion() {
    return ApplicationInfo.getInstance().getBuild();
  }
}


text:
<?xml version="1.0"?>
<manuscript>
  <url/>
  <title>Ordo ad recipiendum novicias in monasterio</title>
  <shelfmark>MS 485/8</shelfmark>
  <quire n="1">
    <leaf n="1" mode="original" single="false" folio_number="1" conjoin="8" position="1" opposite="8"/>
    <leaf n="2" mode="original" single="false" folio_number="2" conjoin="7" position="2" opposite="7"/>
    <leaf n="3" mode="original" single="false" folio_number="3" conjoin="6" position="3" opposite="6"/>
    <leaf n="4" mode="original" single="false" folio_number="4" conjoin="5" position="4" opposite="5"/>
    <leaf n="5" mode="original" single="false" folio_number="5" conjoin="4" position="5" opposite="4"/>
    <leaf n="6" mode="original" single="false" folio_number="6" conjoin="3" position="6" opposite="3"/>
    <leaf n="7" mode="original" single="false" folio_number="7" conjoin="2" position="7" opposite="2"/>
    <leaf n="8" mode="original" single="false" folio_number="8" conjoin="1" position="8" opposite="1"/>
  </quire>
  <quire n="2">
    <leaf n="1" mode="original" single="false" folio_number="9" conjoin="8" position="1" opposite="8"/>
    <leaf n="2" mode="original" single="false" folio_number="10" conjoin="7" position="2" opposite="7"/>
    <leaf n="3" mode="original" single="false" folio_number="11" conjoin="6" position="3" opposite="6"/>
    <leaf n="4" mode="original" single="false" folio_number="12" conjoin="5" position="4" opposite="5"/>
    <leaf n="5" mode="original" single="false" folio_number="13" conjoin="4" position="5" opposite="4"/>
    <leaf n="6" mode="original" single="false" folio_number="14" conjoin="3" position="6" opposite="3"/>
    <leaf n="7" mode="original" single="false" folio_number="15" conjoin="2" position="7" opposite="2"/>
    <leaf n="8" mode="original" single="false" folio_number="16" conjoin="1" position="8" opposite="1"/>
  </quire>
  <quire n="3">
    <leaf n="1" mode="original" single="false" folio_number="17" conjoin="8" position="1" opposite="8"/>
    <leaf n="2" mode="original" single="false" folio_number="18" conjoin="7" position="2" opposite="7"/>
    <leaf n="3" mode="original" single="false" folio_number="19" conjoin="6" position="3" opposite="6"/>
    <leaf n="4" mode="original" single="false" folio_number="20" conjoin="5" position="4" opposite="5"/>
    <leaf n="5" mode="original" single="false" folio_number="21" conjoin="4" position="5" opposite="4"/>
    <leaf n="6" mode="original" single="false" folio_number="22" conjoin="3" position="6" opposite="3"/>
    <leaf n="7" mode="original" single="false" folio_number="23" conjoin="2" position="7" opposite="2"/>
    <leaf n="8" mode="original" single="false" folio_number="24" conjoin="1" position="8" opposite="1"/>
  </quire>
  <quire n="4">
    <leaf n="1" mode="original" single="false" folio_number="25" conjoin="4" position="1" opposite="4"/>
    <leaf n="2" mode="original" single="false" folio_number="26" conjoin="3" position="2" opposite="3"/>
    <leaf n="3" mode="original" single="false" folio_number="27" conjoin="2" position="3" opposite="2"/>
    <leaf n="4" mode="original" single="false" folio_number="28" conjoin="1" position="4" opposite="1"/>
  </quire>
</manuscript>


text: `To be released in april 2021`


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>decode method - MessagePort class - hetimatorrent library - Dart API</title>

    <base href="../..">

    <link href='https://fonts.googleapis.com/css?family=Source+Code+Pro|Roboto:500,400italic,300,400' rel='stylesheet' type='text/css'>
    <link rel="stylesheet" href="static-assets/prettify.css">
    <link rel="stylesheet" href="static-assets/css/bootstrap.min.css">
    <link rel="stylesheet" href="static-assets/styles.css">

    <meta name="description" content="API docs for the decode method from the MessagePort class, for the Dart programming language.">
    <link rel="icon" href="static-assets/favicon.png">

            <button id="sidenav-left-toggle" type="button"> </button>

hetimatorrent

hetimatorrent

MessagePort

decode

decode

hetimatorrent

hetimatorrent

MessagePort

decode

method
 decode

Source

hetimatorrent

hetimatorrent

MessagePort

Constants

PORT_LENGTH

Static methods

decode

Properties

id

port

Constructors

MessagePort

Methods

encode

toString

            Future<MessagePort>
            decode(

                EasyParser parser

            )

Not documented.

Source

static Future<MessagePort> decode(EasyParser parser) {
  Completer c = new Completer();
  MessagePort message = new MessagePort._empty();
  parser.push();
  parser.readInt(ByteOrder.BYTEORDER_BIG_ENDIAN).then((int size) {
    if(size != PORT_LENGTH) {
      throw {};
    }
    return parser.readByte();
  }).then((int v) {
    if(v != TorrentMessage.SIGN_PORT) {
      throw {};
    }
    return parser.readShort(ByteOrder.BYTEORDER_BIG_ENDIAN);
  }).then((int index) {
    message._mPort = index;
    parser.pop();
    c.complete(message);
  }).catchError((e) {
    parser.back();
    parser.pop();
    c.completeError(e);
  });
  return c.future;
}

                  hetimatorrent 0.0.1 api docs

                •

                •

                  cc license


text:
from __future__ import absolute_import

import argparse

__version__ = '0.0.3'

import os
import sys
import random
import difflib
import subprocess

import pkgtools.pypi as pp
import emoji

from travispy import TravisPy
from withlog import Info, Message

import withlog

from time import sleep
# from cookiecutter.main import generate_context, generate_files

import logging

from .github import setup_github_credentials, setup_github_repository
from .flit import python_requires

def yffoo():
    yield from range(10)

heart = """

                L       OOO    V   V  EEEEE
                L      O   O   V   V  E
                L      O   O   V   V  EEE
                L      O   O    V V   E
    oo          LLLLL   OOO      V    EEEEE
       oo
          oo     OOOOOOOO:       OOOOOOOO!
             oOOOO!!!!;;;;O    OO.......:;!O
            'OOO!!!;;;;;;;;O  O.......:   ;!O
            OOO!!!!;;::::::.OO........:    ;!O
            OO!!!!;;:::::..............:   ;!O
            OOO!!!;::::::..............:   ;!O
             OO!!;;::::::.............:   ;!O           Made With Love
              OO!;;::::::......oo.....::::!O
                O!!;::::::........oo..:::O                  - M -
                  !!!;:::::..........ooO
                     !!;:::::.......O   oo              version : {version}
                       ;;::::.....O        oo  ,o
                          :::..O              ooo
                            ::.              oooo
                             :
""".format(version=__version__)

from colored import fg, attr, bg

cheart = '\n'.join(map(
        lambda l : "%s%s%s" %(fg('deep_pink_3b'),l, attr(0)),
        heart.split('\n')
        ))

class WLove(Message):
   def __init__(self, title):
        super().__init__(title,1, fg('white') + bg('deep_pink_3b') )

try:
    import curses
except ImportError:
    curses = None

def _stderr_supports_color():
    color = False
    if curses and hasattr(sys.stderr, 'isatty') and sys.stderr.isatty():
        try:
            curses.setupterm()
            if curses.tigetnum("colors") > 0:
                color = True
        except Exception:
            pass
    return color

emoji_level = {
        10:emoji.emojize(":broken_heart:"),
        20:emoji.emojize(":growing_heart:"),
        30:emoji.emojize(":heart_with_arrow:")
}

class LogFormatter(logging.Formatter):
    """Log formatter with colour support
    """
    DEFAULT_COLORS = {
        logging.INFO: 2, # Green
        logging.WARNING: 3, # Yellow
        logging.ERROR: 1, # Red
        logging.CRITICAL: 1,
    }

    def __init__(self, color=True, datefmt=None):
        r"""
        :arg bool color: Enables color support.
        :arg string fmt: Log message format.
        It will be applied to the attributes dict of log records. The
        text between ``%(color)s`` and ``%(end_color)s`` will be colored
        depending on the level if color support is on.
        :arg dict colors: color mappings from logging level to terminal color
        code
        :arg string datefmt: Datetime format.
        Used for formatting ``(asctime)`` placeholder in ``prefix_fmt``.
        .. versionchanged:: 3.2
        Added ``fmt`` and ``datefmt`` arguments.
        """
        logging.Formatter.__init__(self, datefmt=datefmt)
        self._colors = {}
        if color and _stderr_supports_color():
            fg_color = (curses.tigetstr("setaf") or
                        curses.tigetstr("setf") or "")
            if (3, 0) < sys.version_info < (3, 2, 3):
                fg_color = str(fg_color, "ascii")

            for levelno, code in self.DEFAULT_COLORS.items():
                self._colors[levelno] = str(curses.tparm(fg_color, code), "ascii")
            self._normal = str(curses.tigetstr("sgr0"), "ascii")

            scr = curses.initscr()
            self.termwidth = scr.getmaxyx()[1]
            curses.endwin()
        else:
            self._normal = ''
            # Default width is usually 80, but too wide is worse than too narrow
            self.termwidth = 70

    def formatMessage(self, record):
        right_text = '{initial}-{name}'.format(initial=record.levelname[0],
                                               name=record.name)
        if record.levelno in self._colors:
            start_color = self._colors[record.levelno]
            end_color = self._normal
        else:
            start_color = end_color = ''
        emo = emoji_level[record.levelno]

        return emo +' '+start_color + '[' +right_text + '] ' +  record.message + end_color + ' '+emo

def main():
    with WLove('Love') as p:
        submain(p)

def submain(p):
    """
    completly set-up a package in the target dir (using cookie cutter)

    """
    parser = argparse.ArgumentParser(description='Bootstrap a Python Package with Love.')
    parser.add_argument('name', metavar='name', type=str, nargs='?',
                       help='a potential package name')
    parser.add_argument('target_dir', type=str, nargs='?',
                       help='target directory in which to create the package')
    parser.add_argument('--version', help='print version, logo and exist', action='store_true')
    parser.add_argument('--no-banner',  help='do not print banner', action='store_false')

    parser.add_argument('--no-travis', help='prevent Travis from being set-up', action='store_true')
    parser.add_argument('--no-flit', help='prevent usage of Flit to set-up-package', action='store_true')
    parser.add_argument('--no-similar', help='prevent search of similar project on PyPI', action='store_true')
    parser.add_argument('--python', help='set-up the minimal required python', action='store_true')

    args = parser.parse_args()
    proposal = args.name
    target_dir = args.target_dir

    LOGLEVEL = 50
    log = logging.getLogger(__name__)
    handler = logging.StreamHandler()
    handler.setFormatter(LogFormatter())
    logging.root.addHandler(handler)
    logging.root.setLevel(LOGLEVEL)
    log.setLevel(LOGLEVEL)

    log.info = withlog.glog

    if args.no_banner:
        p(cheart)
    if args.version :
       p('Version : '+ __version__)
       sys.exit(0)

    if args.python :
        python_requires()
        sys.exit(0)

    if not target_dir:
        with Info('Target directory'):
            target_dir = os.getcwd()
            log.info('Will use target dir : %s', target_dir)

    # generate a python package name

    adjectives = ['red','green','blue','purple','fluffy','soft','hard','golden','silver', 'pathetic', 'intrepid', 'jovial' , 'long']
    nouns = ['moon', 'frog', 'lake','orchid','sapphire','gem','sun','lily','ocean','lampshade','fish', 'koala', 'shark', 'kangaroo']
    if proposal and not proposal.isidentifier() and len(proposal)>3:
        log.info('package names should be valid python identifiers, and at least 3 letters long : %s', proposal)
        sys.exit(-1)

    if not proposal:
        proposal = random.choice(adjectives).capitalize()+random.choice(nouns).capitalize()
    plist = None

    #  compare name with existing package name, warn if too close
    if not args.no_similar:
        with Info('Similar projects'):
            log.info('Comparing "%s" to other existing package names...' % proposal)
            pypi = pp.PyPIXmlRpc()
            # cache that on a weekly basis ?
            if plist is None:
                plist = pypi.list_packages()
            closest = difflib.get_close_matches(proposal.lower(), map(str.lower, plist), cutoff=0.8)
            if closest:
                if proposal in closest:
                    log.info(proposal + ' already exists, maybe you would prefer to contribute to this package?')
                else:
                    log.info('%s name is close to the following package name: %s', proposal,  closest)
                response = input('Do you still want to continue ? [Y/n]')
                if not response:
                    response = 'y'
                if not response.lower() == 'y':
                    sys.exit('Aborting')
            else:
                log.info('"%s" seems like a great name !', proposal)

    #  Actually authenticate with github
    #  Create (if do not exist) the named repo, and  clone URL.
    with Info('Github'):
        token, user = setup_github_credentials(log=log)
        slug = setup_github_repository(user, proposal, log)

    os.chdir(proposal)
    log.debug('I am now in %s', os.getcwd())

    if not args.no_travis:
        with Info('Continuous Integration: Configuring Travis-CI'):
            enable_travis(token, slug, log)

    with Info('Setting up Layout'):
        project_layout(proposal, None, None, log)

    if not args.no_flit:
        with Info('Setting up Package with Flit.') as p, withlog.print_statement(p), withlog.input():
            packaging_init(log)
            with Info('Python Minimal version') as p, withlog.print_statement(p):
                python_requires('>=3.4')
                p('Package marked as requiring python >= 3.4')

def enable_travis(token, slug, log):
    """
    Enable Travis automatically for the given repo.

    this need to have access to the GitHub token.
    """

    # Done with github directly. Login to travis

    travis = TravisPy.github_auth(token, uri='https://api.travis-ci.org')
    user = travis.user()
    log.info('Travis user: %s', user.name)

    # Ask travis to sync with github, try to fetch created repo with exponentially decaying time.

    last_sync = user.synced_at
    log.info('syncing Travis with Github, this can take a while...')
    repo = travis._session.post(travis._session.uri+'/users/sync')
    for i in range(10):
        try:
            sleep((1.5)**i)
            repo = travis.repo(slug)
            if travis.user().synced_at == last_sync:
                raise ValueError('synced not really done, travis.repo() can be a duplicate')
            log.info('\nsyncing done')
            break
        # TODO: find the right exception here
        except Exception:
            pass
    ## todo , warn if not found

    #  Enable travis hook for this repository

    log.info('Enabling Travis-CI hook for this repository')
    resp = travis._session.put(travis._session.uri+"/hooks/",
                        json={
                            "hook": {
                                "id": repo.id ,
                                "active": True
                            }
                        },
                      )
    if resp.json()['result'] is True:
        log.info('Travis hook for this repository is now enabled.')
        log.info('Continuous integration test should be triggered every time you push code to github')
    else:
        log.info("I was not able to set up Travis hooks... something went wrong.")

    return user

def codecov():
    pass

def travis_yml():
    with open('.travis.yml', 'w') as f:
        f.write(
"""
language: python
python:
    - 3.5
    - 3.4
before_install:
    - pip install flit pytest
install:
    - flit install --symlink
script:
    - py.test
"""
        )

def project_layout(proposal, user=None, repo=None, log=None):
    """
    generate the project template

    proposal is the name of the project,
    user is an object containing some information about the user.
        - full name,
        - github username
        - email

    """

    proposal = proposal.lower()

    #context_file = os.path.expanduser('~/.cookiecutters/cookiecutter-pypackage/cookiecutter.json')
    #context = generate_context(context_file)

    # os.chdir('..')
    # context['cookiecutter']['full_name'] = user.name
    # context['cookiecutter']['email'] = user.email
    # context['cookiecutter']['github_username'] = user.login
    # context['cookiecutter']['project_name'] = proposal
    # context['cookiecutter']['repo_name'] = proposal.lower()

    try:
        os.mkdir(proposal)
    except FileExistsError:
        log.info('Skip directory structure, as project seem to already exists')

    with open('.gitignore', 'w') as f:
        f.write('''
*.pyc
__pycache__
/build/
/dist/
''')

    with open( '/'.join([proposal, '__init__.py']), 'w') as f:
        f.write('''
"""
a simple package
"""

__version__ = '0.0.1'

        ''')

    travis_yml()

    #generate_files(
    #        repo_dir=os.path.expanduser('~/.cookiecutters/cookiecutter-pypackage/'),
    #        context=context
    #    )

    log.info('Workig in %s', os.getcwd())
    os.listdir('.')

    subprocess.call(['git','add','.'], )

    subprocess.call(['git','commit',"-am'initial commit of %s'" % proposal])

    subprocess.call(['git', "push", "origin", "master:master"])

    #webbrowser.open('https://travis-ci.org/{slug}'.format(slug=repo.slug))

def packaging_init(log):
    log.info('Please answer the following questions: ')
    from flit.init import TerminalIniter
    TerminalIniter().initialise()


text:
from Metrics import *
from SqlGraphite import SqlMonitorGraphiteRunner
from SqlMonitor import SqlServerMonitor
from GraphiteFormulaBuilder import GraphiteSqlPersist, GraphiteMetricName, GraphiteFormulaBuilder as Formula
from DefaultGraphiteSettings import logging_settings

from System import Console, ConsoleKey

srvr_services1 = SqlServerMonitor('services1.mydomain', graphite_root='msdb', **logging_settings)

srvr_services1.db = 'dba'
# srvr_services1.add_metric(blocks_waits).add_metric(wait_stats).add_metric(async_network_waits).add_metric(
# 	sql_server_statistics).add_metric(database_statistics).add_metric(connections).add_metric(
# 	clr_execution).add_metric(lock_stats).add_metric(latch_wait_stats).add_metric(memory).add_metric(
# 	buffers).add_metric(buffer_nodes).add_metric(scheduler_waits).add_metric(session_requests).add_metric(io)
srvr_services1.add_metric(
		database_statistics
	).add_metric(
		wait_stats
	).add_metric(
		io
	)

graphite = SqlMonitorGraphiteRunner(logpath=logging_settings['logpath'])

graphite.add_server(srvr_services1)

graphite_to_sql = GraphiteSqlPersist(
	'Test persistance & formula builder'
	, 'services1.mydomain'
	, 'dba2'
	, duration_seconds=150
	, export_interval_seconds=30
	# , logger_name='GraphitePersistance'
	, logpath=r'e:\templogs\GraphitePersistance.log'
	, event_source_name='GraphiteMonitor'
	# , suppress_event_logging=True
	)

CorvisaReportingLogFlushes = GraphiteMetricName(
	'services1.mydomain'
	, 'database_statistics'
	, 'log_flush_perSec'
	, database_name='CorvisaReporting'
	)

Services1SosWaitTime = GraphiteMetricName(
	'services1.mydomain'
	, 'wait_stats'
	, 'sos_scheduler_yield_wait_time_ms'
	)

Services1_SDriveRW_Stall = GraphiteMetricName(
	'services1.mydomain'
	, 'io'
	, 'io_stall'
	, database_name='all', database_file_type='by_drive', physical_drive_letter='S'
	)

Services1_SDriveRW = GraphiteMetricName(
	'services1.mydomain'
	, 'io'
	, 'reads_writes'
	, database_name='all', database_file_type='by_drive', physical_drive_letter='S'
	)

# AvgLogFlush_perSec = Formula('Reporting Avg Log Flushes per second')
# AvgLogFlush_perSec.add_series(ReportingLogFlushes, apply_formula='granular_diff_formula')
AvgLogFlush_perSec = (Formula('Reporting Avg Log Flushes per second')).add_series(ReportingLogFlushes, apply_formula='granular_diff_formula')

SosWait = Formula('services1 sos scheduler wait time')
SosWait.add_series(Services1SosWaitTime, apply_formula='granular_diff_formula')

DataRWLatency = Formula('Data file read/write latency (ms)')
DataRWLatency.add_series(
		Services1_SDriveRW_Stall, apply_formula='granular_diff_formula'
	).divide_series(
		Services1_SDriveRW, apply_formula='granular_diff_formula'
	)

graphite_to_sql.add_formula(
		AvgLogFlush_perSec
	).add_formula(
		SosWait
	).add_formula(
		DataRWLatency
	)

# graphite.echo = False
graphite.silent = True
graphite.start('graphite.mydomain', 2003)
graphite_to_sql.start(graphite)

while graphite_to_sql.is_running:
	c = Console.ReadKey(True)
	if c.Key in [ConsoleKey.Escape, ConsoleKey.Q]:
		graphite_to_sql.quit()
		break

print('\n\n\tOUT')

graphite.quit()

print('\nKthnxbai')


text:
<?php

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

namespace Mozu\Api\Clients\Commerce\Catalog\Admin\Products;

use Mozu\Api\MozuClient;
use Mozu\Api\Urls\Commerce\Catalog\Admin\Products\LocationInventoryUrl;

use Mozu\Api\Headers;

/**
* Use the Product Location Inventory resource to manage the levels of active product inventory to maintain across defined locations at the product level.
*/
class LocationInventoryClient {

	/**
	* Retrieves all locations for which a product has inventory defined and displays the inventory definition properties of each location.
	*
	* @param string $filter A set of expressions that consist of a field, operator, and value and represent search parameter syntax when filtering results of a query. Valid operators include equals (eq), does not equal (ne), greater than (gt), less than (lt), greater than or equal to (ge), less than or equal to (le), starts with (sw), or contains (cont). For example - "filter=IsDisplayed+eq+true"
	* @param int $pageSize The number of results to display on each page when creating paged results from a query. The maximum value is 200.
	* @param string $productCode Merchant-created code that uniquely identifies the product such as a SKU or item number. Once created, the product code is read-only.
	* @param string $responseFields Use this field to include those fields which are not included by default.
	* @param string $sortBy The property by which to sort results and whether the results appear in ascending (a-z) order, represented by ASC or in descending (z-a) order, represented by DESC. The sortBy parameter follows an available property. For example: "sortBy=productCode+asc"
	* @param int $startIndex When creating paged results from a query, this value indicates the zero-based offset in the complete result set where the returned entities begin. For example, with a PageSize of 25, to get the 51st through the 75th items, use startIndex=3.
	* @return MozuClient
	*/
	public static function getLocationInventoriesClient($dataViewMode, $productCode, $startIndex =  null, $pageSize =  null, $sortBy =  null, $filter =  null, $responseFields =  null)
	{
		$url = LocationInventoryUrl::getLocationInventoriesUrl($filter, $pageSize, $productCode, $responseFields, $sortBy, $startIndex);
		$mozuClient = new MozuClient();
		$mozuClient->withResourceUrl($url)->withHeader(Headers::X_VOL_DATAVIEW_MODE ,$dataViewMode);
		return $mozuClient;

	}

	/**
	* Retrieves the details of the inventory of the product in the location specified in the request.
	*
	* @param string $locationCode The unique, user-defined code that identifies a location.
	* @param string $productCode Merchant-created code that uniquely identifies the product such as a SKU or item number. Once created, the product code is read-only.
	* @param string $responseFields Use this field to include those fields which are not included by default.
	* @return MozuClient
	*/
	public static function getLocationInventoryClient($dataViewMode, $productCode, $locationCode, $responseFields =  null)
	{
		$url = LocationInventoryUrl::getLocationInventoryUrl($locationCode, $productCode, $responseFields);
		$mozuClient = new MozuClient();
		$mozuClient->withResourceUrl($url)->withHeader(Headers::X_VOL_DATAVIEW_MODE ,$dataViewMode);
		return $mozuClient;

	}

	/**
	* Creates a new location inventory definition for the product code specified in the request.
	*
	* @param bool $performUpserts Query string parameter lets the service perform an update for a new or existing record. When run, the update occurs without throwing a conflict exception that the record exists. If true, the updates completes regardless of the record currently existing. By default, if no value is specified, the service assumes this value is false.
	* @param string $productCode Merchant-created code that uniquely identifies the product such as a SKU or item number. Once created, the product code is read-only.
	* @param array|LocationInventory $locationInventoryList Properties of an inventory definition that defines the level of inventory for a specific product at a given location.
	* @return MozuClient
	*/
	public static function addLocationInventoryClient($dataViewMode, $locationInventoryList, $productCode, $performUpserts =  null)
	{
		$url = LocationInventoryUrl::addLocationInventoryUrl($performUpserts, $productCode);
		$mozuClient = new MozuClient();
		$mozuClient->withResourceUrl($url)->withBody($locationInventoryList)->withHeader(Headers::X_VOL_DATAVIEW_MODE ,$dataViewMode);
		return $mozuClient;

	}

	/**
	* Updates the current level of stock at each location associated with the product code specified in the request.
	*
	* @param string $productCode The unique, user-defined product code of a product, used throughout  to reference and associate to a product.
	* @param array|LocationInventoryAdjustment $locationInventoryAdjustments Properties of an adjustment to the active product inventory of a specific location.
	* @return MozuClient
	*/
	public static function updateLocationInventoryClient($dataViewMode, $locationInventoryAdjustments, $productCode)
	{
		$url = LocationInventoryUrl::updateLocationInventoryUrl($productCode);
		$mozuClient = new MozuClient();
		$mozuClient->withResourceUrl($url)->withBody($locationInventoryAdjustments)->withHeader(Headers::X_VOL_DATAVIEW_MODE ,$dataViewMode);
		return $mozuClient;

	}

	/**
	* Deletes the location inventory definition for the product code specified in the request.
	*
	* @param string $locationCode The unique, user-defined code that identifies a location.
	* @param string $productCode The unique, user-defined product code of a product, used throughout  to reference and associate to a product.
	*/
	public static function deleteLocationInventoryClient($dataViewMode, $productCode, $locationCode)
	{
		$url = LocationInventoryUrl::deleteLocationInventoryUrl($locationCode, $productCode);
		$mozuClient = new MozuClient();
		$mozuClient->withResourceUrl($url)->withHeader(Headers::X_VOL_DATAVIEW_MODE ,$dataViewMode);
		return $mozuClient;

	}

}

?>


text:
/**
 * Functions for dynamically setting Select2-enabled select elements
 * that are populated with AJAX calls.
 */

(function($) {
/**
 * Filter a place's parent selection element based on the place's geolevel
 *
 * Filters the results to only places that are at the place's geolevel's
 * parent
 */
  storybase.admin.selectFilters = {
    geoLevelFilters: function(filters) {
      var geoLevel = $('#id_geolevel').val();
      var newFilters = {};
      if (geoLevel !== "") {
        $.ajax({
          async: false,
          url: "/api/0.1/geolevels/",
          dataType: 'json',
          data: {
            'id': geoLevel
          },
          success: function(data) {
            // If the place's geolevel doesn't have a parent, set the
            // filter id to 0 which should always return an empty list
            var parentId = data.objects[0].parent_id !== null ? data.objects[0].parent_id : 0;
            newFilters['geolevel__id'] = parentId;
          }
        });
      }
      else {
        // No geoLevel has been selected.  Set the filter ID to 0 which
        // should always return an empty list
        newFilters['geolevel__id'] = 0;
      }

      $.extend(filters, newFilters);
    }
  };

  storybase.admin.callSelectFilter = function(name, filters) {
    storybase.admin.selectFilters[name](filters);
  };
})(django.jQuery);


text: export{default}from"./Popover";


text:
'use strict';

var StringMask = require('string-mask');

var maskFactory = require('../../helpers/mask-factory');

var phoneMask8D = {
		countryCode : new StringMask('+00 (00) 0000-0000'),   //with country code
		areaCode    : new StringMask('(00) 0000-0000'),       //with area code
		simple      : new StringMask('0000-0000')             //without area code
	}, phoneMask9D = {
		countryCode : new StringMask('+00 (00) 00000-0000'), //with country code
		areaCode    : new StringMask('(00) 00000-0000'),     //with area code
		simple      : new StringMask('00000-0000')           //without area code
	}, phoneMask0800 = {
		countryCode : null,                                   //N/A
		areaCode    : null,                                   //N/A
		simple      : new StringMask('0000-000-0000')         //N/A, so it's "simple"
	};

var brPhoneMaskOptions = {
	'countryCode': {sliceSize: 13, min: 12, max: 13},
	'areaCode': {sliceSize: 11, min: 10, max: 11},
	'simple': {sliceSize: 9, min: 8, max: 9},
	'all': {sliceSize: 13, min: 8, max: 13}
};

function findOption(attrs) {
	var brPhoneMaskOption = brPhoneMaskOptions.all;

	if (attrs && attrs.uiBrPhoneNumberMask) {
		var maskOption = attrs.uiBrPhoneNumberMask;
		angular.forEach(brPhoneMaskOptions, function(value, key) {
			if (key === maskOption) {
				brPhoneMaskOption = value;
				return;
			}
		});
	}

	return brPhoneMaskOption;
}

module.exports = maskFactory({
	clearValue: function(rawValue, attrs) {
		var brPhoneMaskOption = findOption(attrs);
		return rawValue.toString().replace(/[^0-9]/g, '').slice(0, brPhoneMaskOption.sliceSize);
	},
	format: function(cleanValue) {
		var formattedValue;

		if (cleanValue.indexOf('0800') === 0) {
			formattedValue = phoneMask0800.simple.apply(cleanValue);
		} else if (cleanValue.length < 9) {
			formattedValue = phoneMask8D.simple.apply(cleanValue) || '';
		} else if (cleanValue.length < 10) {
			formattedValue = phoneMask9D.simple.apply(cleanValue);
		} else if (cleanValue.length < 11) {
			formattedValue = phoneMask8D.areaCode.apply(cleanValue);
		} else if (cleanValue.length < 12) {
			formattedValue = phoneMask9D.areaCode.apply(cleanValue);
		} else if (cleanValue.length < 13) {
			formattedValue = phoneMask8D.countryCode.apply(cleanValue);
		} else {
			formattedValue = phoneMask9D.countryCode.apply(cleanValue);
		}

		return formattedValue.trim().replace(/[^0-9]$/, '');
	},
	getModelValue: function(formattedValue, originalModelType) {
		var cleanValue = this.clearValue(formattedValue);
		return originalModelType === 'number' ? parseInt(cleanValue) : cleanValue;
	},
	validations: {
		brPhoneNumber: function(value, view, attrs) {
			var brPhoneMaskOption = findOption(attrs);
			var valueLength = value && value.toString().length;

			//8- 8D without AC
			//9- 9D without AC
			//10- 8D with AC
			//11- 9D with AC and 0800
			//12- 8D with AC plus CC
			//13- 9D with AC plus CC
			return valueLength >= brPhoneMaskOption.min && valueLength <= brPhoneMaskOption.max;
		}
	}
});


text:
API used by runners to receive and update builds.

>**Note:**
This API is intended to be used only by Runners as their own
communication channel. For the consumer API see the
[Jobs API](../jobs.md).

## Authentication

This API uses two types of authentication:

1. Unique Runner's token which is the token assigned to the Runner after it
   has been registered.

2. Using the build authorization token.
   This is project's CI token that can be found under the **Builds** section of
   a project's settings. The build authorization token can be passed as a
   parameter or a value of `BUILD-TOKEN` header.

These two methods of authentication are interchangeable.

## Builds

### Runs oldest pending build by runner

```
POST /ci/api/v1/builds/register
```

| Attribute | Type    | Required | Description         |
|-----------|---------|----------|---------------------|
| `token`   | string  | yes      | Unique runner token |

```
curl --request POST "https://gitlab.example.com/ci/api/v1/builds/register" --form "token=t0k3n"
```

**Responses:**

| Status | Data |Description                                                                |
|--------|------|---------------------------------------------------------------------------|
| `201`  | yes  | When a build is scheduled for a runner                                    |
| `204`  | no   | When no builds are scheduled for a runner (for GitLab Runner >= `v1.3.0`) |
| `403`  | no   | When invalid token is used or no token is sent                            |
| `404`  | no   | When no builds are scheduled for a runner (for GitLab Runner < `v1.3.0`) **or** when the runner is set to `paused` in GitLab runner's configuration page |

### Update details of an existing build

```
PUT /ci/api/v1/builds/:id
```

| Attribute | Type    | Required | Description          |
|-----------|---------|----------|----------------------|
| `id`      | integer | yes      | The ID of a project  |
| `token`   | string  | yes      | Unique runner token  |
| `state`   | string  | no       | The state of a build |
| `trace`   | string  | no       | The trace of a build |

```
curl --request PUT "https://gitlab.example.com/ci/api/v1/builds/1234" --form "token=t0k3n" --form "state=running" --form "trace=Running git clone...\n"
```

### Incremental build trace update

Using this method you need to send trace content as a request body. You also need to provide the `Content-Range` header
with a range of sent trace part. Note that you need to send parts in the proper order, so the begining of the part
must start just after the end of the previous part. If you provide the wrong part, then GitLab CI API will return `416
Range Not Satisfiable` response with a header `Range: 0-X`, where `X` is the current trace length.

For example, if you receive `Range: 0-11` in the response, then your next part must contain a `Content-Range: 11-...`
header and a trace part covered by this range.

For a valid update API will return `202` response with:
* `Build-Status: {status}` header containing current status of the build,
* `Range: 0-{length}` header with the current trace length.

```
PATCH /ci/api/v1/builds/:id/trace.txt
```

Parameters:

| Attribute | Type    | Required | Description          |
|-----------|---------|----------|----------------------|
| `id`      | integer | yes      | The ID of a build    |

Headers:

| Attribute       | Type    | Required | Description                       |
|-----------------|---------|----------|-----------------------------------|
| `BUILD-TOKEN`   | string  | yes      | The build authorization token     |
| `Content-Range` | string  | yes      | Bytes range of trace that is sent |

```
curl --request PATCH "https://gitlab.example.com/ci/api/v1/builds/1234/trace.txt" --header "BUILD-TOKEN=build_t0k3n" --header "Content-Range=0-21" --data "Running git clone...\n"
```

### Upload artifacts to build

```
POST /ci/api/v1/builds/:id/artifacts
```

| Attribute | Type    | Required | Description                   |
|-----------|---------|----------|-------------------------------|
| `id`      | integer | yes      | The ID of a build             |
| `token`   | string  | yes      | The build authorization token |
| `file`    | mixed   | yes      | Artifacts file                |

```
curl --request POST "https://gitlab.example.com/ci/api/v1/builds/1234/artifacts" --form "token=build_t0k3n" --form "file=@/path/to/file"
```

### Download the artifacts file from build

```
GET /ci/api/v1/builds/:id/artifacts
```

| Attribute | Type    | Required | Description                   |
|-----------|---------|----------|-------------------------------|
| `id`      | integer | yes      | The ID of a build             |
| `token`   | string  | yes      | The build authorization token |

```
curl "https://gitlab.example.com/ci/api/v1/builds/1234/artifacts" --form "token=build_t0k3n"
```

### Remove the artifacts file from build

```
DELETE /ci/api/v1/builds/:id/artifacts
```

| Attribute | Type    | Required | Description                   |
|-----------|---------|----------|-------------------------------|
| ` id`     | integer | yes      | The ID of a build             |
| `token`   | string  | yes      | The build authorization token |

```
curl --request DELETE "https://gitlab.example.com/ci/api/v1/builds/1234/artifacts" --form "token=build_t0k3n"
```


text:
===Ingredients===

===Instructions===

[[category:recipes]] [[category:vegetarian]]


text:
''' Cardinal - An Open Source Cisco Wireless Access Point Controller

MIT License

Copyright © 2019 Cardinal Contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

'''

# THIS IS ONLY A TEST FILE

import MySQLdb
from configparser import ConfigParser

# MySQL authentication

mysqlConfig = ConfigParser()
mysqlConfig.read("ci/cardinal.ini")
mysqlHost = mysqlConfig.get('cardinal', 'dbserver')
mysqlUser = mysqlConfig.get('cardinal', 'username')
mysqlPass = mysqlConfig.get('cardinal', 'password')
mysqlDb = mysqlConfig.get('cardinal', 'dbname')

def cardinalSql():
    conn = MySQLdb.connect(host = mysqlHost, user = mysqlUser, passwd = mysqlPass, db = mysqlDb)
    return conn

try:
    conn = cardinalSql()
    testCursor = conn.cursor()
    testCursor.execute("SELECT VERSION()")
    version = testCursor.fetchone()[0]
    if version:
        print("CONNECTION TEST PASSED: {}".format(version))
    else:
        print("CONNECTION TEST FAILED: {}".format(MySQLdb.Error))
except MySQLdb.Error as e:
    print("Cardinal detected a MySQL error: {}".format(e))


text:
package malictus.gh.dtb;

import malictus.gh.*;

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

/**
 * DTBFile
 *
 * An object that represents a single DTB file.
 *
 * by Jim Halliday
 * malictus@malictus.net
 *
 */
public class DTBFile {

	private File DTBFile;
	private File DTAFile;
	private int key;
	//Vector of DTB entries (which store DTBValue objects) for this file
	private Vector DTBNodes;
	//used to keep track of new node id numbers to use
	private int nodeIDCounter = -1;

	public DTBFile(String theFileName, String theDirName) throws Exception {
		DTBNodes = new Vector();
		//create DTB file from ARK
		DTBFile = GHUtils.putInTemp(theFileName, theDirName);
		//create a fresh file for the DTA file
		String dtaName = DTBFile.getName().substring(0, DTBFile.getName().length() - 4);
		dtaName = dtaName + ".dta";
		DTAFile = new File(DTBFile.getParent() + File.separator + dtaName);
		if (DTAFile.exists()) {
			DTAFile.delete();
		}
		DTAFile.createNewFile();
		RandomAccessFile rafin = new RandomAccessFile(DTBFile, "r");
		key = (int)GHUtils.readNumber(rafin.readInt());
		rafin.close();
		FileInputStream fis = new FileInputStream(DTBFile);
		FileOutputStream fos = new FileOutputStream(DTAFile);
		DecryptionTable dt = new DecryptionTable(key);
		try {
			byte[] buf = new byte[(int)DTBFile.length() - 4];
			fis.skip(4);
			int x = fis.read(buf);
			if (x != buf.length) {
				throw new Exception("Error decrypting DTB file");
			}
			dt.decrypt(buf);
			fos.write(buf);
		} catch (Exception err) {
			fis.close();
			fos.close();
			throw err;
		}
		fis.close();
		fos.close();
		createLookupTable();
	}

	/*************************** GENERAL PUBLIC METHODS **********************/

	public void encrypt() throws Exception {
		if (!DTAFile.exists()) {
			throw new Exception("DTA file does not exist");
		}
		if (DTBFile.exists()) {
			DTBFile.delete();
		}
		DTBFile.createNewFile();

		FileInputStream fis = new FileInputStream(DTAFile);
		FileOutputStream fos = new FileOutputStream(DTBFile);
		DecryptionTable dt = new DecryptionTable(key);
		try {
			byte[] buf = new byte[(int)DTAFile.length()];
			//write key
			fos.write(GHUtils.writeNumber(key));
			//read DTA file into memory
			int x = fis.read(buf);
			if (x != buf.length) {
				throw new Exception("Error encrytping DTB file");
			}
			//encrypt
			dt.encrypt(buf);
			//write encrypted data
			fos.write(buf);
		} catch (Exception err) {
			fis.close();
			fos.close();
			throw err;
		}
		fis.close();
		fos.close();
	}

	public File getDTBFile() {
		return DTBFile;
	}

	public boolean nodeExists(String node) throws Exception {
		int counter = 0;
		while (counter < DTBNodes.size()) {
			DTBNode x = (DTBNode)DTBNodes.get(counter);
			if (x.path.equals(node)) {
				return true;
			}
			counter = counter + 1;
		}
		return false;
	}

	/**
	 * Return a string vector with the node names of all direct child nodes of this node, stripping
	 * out the parent node portion
	 */
	public Vector getChildNodesFor(String nodeLabel) throws Exception {
		int counter = 0;
		Vector vec = new Vector();
		while (counter < DTBNodes.size()) {
			DTBNode x = (DTBNode)DTBNodes.get(counter);
			String node = x.path;
			if (node.startsWith(nodeLabel) && (!node.equals(nodeLabel))) {
				if (node.indexOf("/") != -1) {
					node = node.substring(node.indexOf("/") + 1);
					if (node.indexOf("/") == -1) {
						vec.add(node);
					}
				}
			}
			counter = counter + 1;
		}
		return vec;
	}

	public int getNodePosition(String nodeLabel) throws Exception {
		int counter = 0;
		int realfilepos = -1;
		while (counter < DTBNodes.size()) {
			DTBNode x = (DTBNode)DTBNodes.get(counter);
			String node = x.path;
			if (node.equals(nodeLabel)) {
				realfilepos = x.filepos;
			}
			counter = counter + 1;
		}
		if (realfilepos == -1) {
			throw new Exception("Node not found");
		}

		//find parent node
		counter = 0;
		String keyFolder = "";
		String keyFile = "";
		if (nodeLabel.lastIndexOf("/") == -1) {
			keyFolder = "";
			keyFile = nodeLabel;
		} else {
			keyFolder = nodeLabel.substring(0, nodeLabel.lastIndexOf("/"));
			keyFile = nodeLabel.substring(nodeLabel.lastIndexOf("/") + 1);
		}

		int filepos = 0;
		if (keyFolder.equals("")) {
			filepos = -3;
		} else {
			boolean foundit = false;
			while (counter < DTBNodes.size() && (foundit == false) ) {
				DTBNode x = (DTBNode)DTBNodes.get(counter);
				String node = x.path;
				if (node.equals(keyFolder)) {
					foundit = true;
					filepos = x.filepos;
				}
				counter = counter + 1;
			}
			if (!foundit) {
				throw new Exception("DTB node not found");
			}
		}

		RandomAccessFile raf = new RandomAccessFile(DTAFile, "r");
		//skip node number
		raf.seek(filepos + 4);
		int originalchildren = GHUtils.read16BitNumber(raf.readShort());
		//skip this node's id
		raf.skipBytes(4);
		if (filepos != -3) {
			//skip first child (should be node name)
			int numb = (int)GHUtils.readNumber(raf.readInt());
			if (numb != 5) {
				//wasn't keyword
				raf.close();
				throw new Exception("Not keyword");
			}
			int skipper = (int)GHUtils.readNumber(raf.readInt());
			int innercounter = 0;
			while (innercounter < skipper) {
				raf.read();
				innercounter = innercounter + 1;
			}
		}
		int returnval = 1;
		//now should be at start of first non-name node, position 1
		while (raf.getFilePointer() != realfilepos) {
			skipNode(raf);
			returnval = returnval + 1;
			if (raf.getFilePointer() >= (raf.length() + 1)) {
				raf.close();
				throw new Exception("node note found");
			}
		}
		raf.close();
		return returnval;
	}

	/*************************** PUBLIC VALUE READING METHODS **********************/

	public Float readFloat(String floatLabel) throws Exception {
		int counter = 0;
		while (counter < DTBNodes.size()) {
			DTBNode x = (DTBNode)DTBNodes.get(counter);
			String node = x.path;
			if (node.equals(floatLabel)) {
				Object obj = x.theValue;
				if (! (obj instanceof DTBValue)) {
					throw new Exception("DTBValue object not found.");
				}
				DTBValue dtbval = (DTBValue)obj;
				if (! (dtbval.value instanceof Float)) {
					throw new Exception("DTBValue is not float.");
				}
				return (Float)dtbval.value;
			}
			counter = counter + 1;
		}
		throw new Exception("Float not found");
	}

	public Integer readInt(String intLabel) throws Exception {
		int counter = 0;
		while (counter < DTBNodes.size()) {
			DTBNode x = (DTBNode)DTBNodes.get(counter);
			String node = x.path;
			if (node.equals(intLabel)) {
				Object obj = x.theValue;
				if (! (obj instanceof DTBValue)) {
					throw new Exception("DTBValue object not found.");
				}
				DTBValue dtbval = (DTBValue)obj;
				if (! (dtbval.value instanceof Integer)) {
					throw new Exception("DTBValue is not integer.");
				}
				return (Integer)dtbval.value;
			}
			counter = counter + 1;
		}
		throw new Exception("Integer not found");
	}

	public String readString(String stringLabel) throws Exception {
		int counter = 0;
		while (counter < DTBNodes.size()) {
			DTBNode x = (DTBNode)DTBNodes.get(counter);
			String node = x.path;
			if (node.equals(stringLabel)) {
				Object obj = x.theValue;
				DTBValue dtbval;
				if (! (obj instanceof DTBValue)) {
					//exception ONLY for Trogdor loading tip!
					if (stringLabel.startsWith("loading_tip")) {
						Vector nodes = (Vector)obj;
						dtbval =(DTBValue)(nodes.get(0));
					} else {
						throw new Exception("DTBValue object not found.");
					}
				} else {
					dtbval = (DTBValue)obj;
				}
				if (! (dtbval.value instanceof String)) {
					throw new Exception("DTBValue is not string.");
				}
				return (String)dtbval.value;
			}
			counter = counter + 1;
		}
		throw new Exception("String not found");
	}

	public Vector readVector(String vectorLabel) throws Exception {
		int counter = 0;
		while (counter < DTBNodes.size()) {
			DTBNode x = (DTBNode)DTBNodes.get(counter);
			String node = x.path;
			if (node.equals(vectorLabel)) {
				Object obj = x.theValue;
				if (! (obj instanceof Vector)) {
					throw new Exception("Vector object not found.");
				}
				return (Vector)obj;
			}
			counter = counter + 1;
		}
		throw new Exception("Vector not found");
	}

	/*************************** PUBLIC NODE CREATION/DELETION METHODS **********************/

	/*
	 * Position refers to the position to insert the node at, starting at 1 and not counting
	 * the parent node name itself
	 */
	public void createStringNode(String key, String value, int position, int nodeType) throws Exception {
		int counter = 0;
		if (position < 1) {
			throw new Exception("Incorrect position specification");
		}
		if ( (nodeType != 2) && (nodeType != 5) && (nodeType != 7) && (nodeType != 18)
				&& (nodeType != 32) && (nodeType != 33) && (nodeType != 34) ) {
			throw new Exception("Incorrect noteType");
		}
		//make sure node doesn't exist
		while (counter < DTBNodes.size()) {
			DTBNode x = (DTBNode)DTBNodes.get(counter);
			String node = x.path;
			if (node.equals(key)) {
				throw new Exception("Node exists");
			}
			counter = counter + 1;
		}
		//now, find parent node
		counter = 0;
		String keyFolder = "";
		String keyFile = "";
		if (key.lastIndexOf("/") == -1) {
			keyFolder = "";
			keyFile = key;
		} else {
			keyFolder = key.substring(0, key.lastIndexOf("/"));
			keyFile = key.substring(key.lastIndexOf("/") + 1);
		}
		int filepos = 0;
		if (keyFolder.equals("")) {
			filepos = -3;
		} else {
			boolean foundit = false;
			while (counter < DTBNodes.size() && (foundit == false) ) {
				DTBNode x = (DTBNode)DTBNodes.get(counter);
				String node = x.path;
				if (node.equals(keyFolder)) {
					foundit = true;
					filepos = x.filepos;
				}
				counter = counter + 1;
			}
			if (!foundit) {
				throw new Exception("DTB node not found");
			}
		}
		RandomAccessFile raf = new RandomAccessFile(DTAFile, "rw");
		//skip node number
		raf.seek(filepos + 4);
		//number of children nodes
		int originalchildren = GHUtils.read16BitNumber(raf.readShort());
		if (originalchildren < position) {
			raf.close();
			throw new Exception("Not enough child nodes");
		}
		//add one to node count
		originalchildren = originalchildren + 1;
		raf.seek(filepos + 4);
		raf.write(GHUtils.write16BitNumber(originalchildren));
		//skip this node's id
		raf.skipBytes(4);
		if (filepos != -3) {
			//skip first child (should be node name)
			int numb = (int)GHUtils.readNumber(raf.readInt());
			if (numb != 5) {
				//wasn't keyword
				raf.close();
				throw new Exception("Not keyword");
			}
			int skipper = (int)GHUtils.readNumber(raf.readInt());
			int innercounter = 0;
			while (innercounter < skipper) {
				raf.read();
				innercounter = innercounter + 1;
			}
		}
		//now should be at start of first non-name node, position 1
		while (position > 1) {
			skipNode(raf);
			position = position - 1;
		}
		//read in byte array for the rest of the file
		long prevpos = raf.getFilePointer();
		byte[] rest = new byte[(int)(raf.length() - raf.getFilePointer())];
		raf.readFully(rest);
		//delete rest of file
		raf.seek(prevpos);
		raf.setLength(prevpos);
		//now, write in new node value
		raf.write(GHUtils.writeNumber(16));
		//now, number of children
		raf.write(GHUtils.write16BitNumber(2));
		//now node ID
		raf.write(GHUtils.writeNumber(getNewNodeID()));
		//now keyword child
		raf.write(GHUtils.writeNumber(5));
		raf.write(GHUtils.writeNumber(keyFile.length()));
		byte[] newvalue = keyFile.getBytes("ISO-8859-1");
		if (newvalue.length != keyFile.length()) {
			throw new Exception("Error converting " + keyFile + " to bytes.");
		}
		raf.write(newvalue);
		//now string child
		raf.write(GHUtils.writeNumber(nodeType));
		raf.write(GHUtils.writeNumber(value.length()));
		newvalue = value.getBytes("ISO-8859-1");
		if (newvalue.length != value.length()) {
			throw new Exception("Error converting " + value + " to bytes.");
		}
		raf.write(newvalue);
		//now, the rest of the file
		raf.write(rest);
		raf.close();
		//now, clear out all current values, and recreate entire DTBNodes structure
		createLookupTable();
	}

	/*
	 * Position refers to the position to insert the node at, starting at 1 and not counting
	 * the parent node name itself
	 */
	public void createStringVectorNode(String key, Vector stringvalues, int position) throws Exception {
		int counter = 0;
		if (position < 1) {
			throw new Exception("Incorrect position specification");
		}
		//make sure node doesn't exist
		while (counter < DTBNodes.size()) {
			DTBNode x = (DTBNode)DTBNodes.get(counter);
			String node = x.path;
			if (node.equals(key)) {
				throw new Exception("Node exists");
			}
			counter = counter + 1;
		}
		//now, find parent node
		counter = 0;
		String keyFolder = "";
		String keyFile = "";
		if (key.lastIndexOf("/") == -1) {
			keyFolder = "";
			keyFile = key;
		} else {
			keyFolder = key.substring(0, key.lastIndexOf("/"));
			keyFile = key.substring(key.lastIndexOf("/") + 1);
		}

		int filepos = 0;
		if (keyFolder.equals("")) {
			filepos = -3;
		} else {
			boolean foundit = false;
			while (counter < DTBNodes.size() && (foundit == false) ) {
				DTBNode x = (DTBNode)DTBNodes.get(counter);
				String node = x.path;
				if (node.equals(keyFolder)) {
					foundit = true;
					filepos = x.filepos;
				}
				counter = counter + 1;
			}
			if (!foundit) {
				throw new Exception("DTB node not found");
			}
		}
		RandomAccessFile raf = new RandomAccessFile(DTAFile, "rw");
		//skip node number
		raf.seek(filepos + 4);
		//number of children nodes
		int originalchildren = GHUtils.read16BitNumber(raf.readShort());
		if (originalchildren < position) {
			raf.close();
			throw new Exception("Not enough child nodes");
		}
		//add one to node count
		originalchildren = originalchildren + 1;
		raf.seek(filepos + 4);
		raf.write(GHUtils.write16BitNumber(originalchildren));
		//skip this node's id
		raf.skipBytes(4);
		if (filepos != -3) {
			//skip first child (should be node name)
			int numb = (int)GHUtils.readNumber(raf.readInt());
			if (numb != 5) {
				//wasn't keyword
				raf.close();
				throw new Exception("Not keyword");
			}
			int skipper = (int)GHUtils.readNumber(raf.readInt());
			int innercounter = 0;
			while (innercounter < skipper) {
				raf.read();
				innercounter = innercounter + 1;
			}
		}
		//now should be at start of first non-name node, position 1
		while (position > 1) {
			skipNode(raf);
			position = position - 1;
		}
		//read in byte array for the rest of the file
		long prevpos = raf.getFilePointer();
		byte[] rest = new byte[(int)(raf.length() - raf.getFilePointer())];
		raf.readFully(rest);
		//delete rest of file
		raf.seek(prevpos);
		raf.setLength(prevpos);
		//now, write in new node value
		raf.write(GHUtils.writeNumber(16));
		//now, number of children
		raf.write(GHUtils.write16BitNumber(stringvalues.size() + 1));
		//now node ID
		raf.write(GHUtils.writeNumber(getNewNodeID()));
		//now keyword child
		raf.write(GHUtils.writeNumber(5));
		raf.write(GHUtils.writeNumber(keyFile.length()));
		byte[] newvalue = keyFile.getBytes("ISO-8859-1");
		if (newvalue.length != keyFile.length()) {
			throw new Exception("Error converting " + keyFile + " to bytes.");
		}
		raf.write(newvalue);
		//now string children
		int innercounter = 0;
		while (innercounter < stringvalues.size()) {
			String a = (String)stringvalues.get(innercounter);
			raf.write(GHUtils.writeNumber(18));
			raf.write(GHUtils.writeNumber(a.length()));
			newvalue = a.getBytes("ISO-8859-1");
			if (newvalue.length != a.length()) {
				throw new Exception("Error converting " + a + " to bytes.");
			}
			raf.write(newvalue);
			innercounter = innercounter + 1;
		}
		//now, the rest of the file
		raf.write(rest);
		raf.close();

		//now, clear out all current values, and recreate entire DTBNodes structure
		createLookupTable();
	}

	/*
	 * Position refers to the position to insert the node at, starting at 1 and not counting
	 * the parent node name itself
	 */
	public void createIntegerVectorNode(String key, Vector intvalues, int position) throws Exception {
		int counter = 0;
		if (position < 1) {
			throw new Exception("Incorrect position specification");
		}
		//make sure node doesn't exist
		while (counter < DTBNodes.size()) {
			DTBNode x = (DTBNode)DTBNodes.get(counter);
			String node = x.path;
			if (node.equals(key)) {
				throw new Exception("Node exists");
			}
			counter = counter + 1;
		}
		//now, find parent node
		counter = 0;
		String keyFolder = "";
		String keyFile = "";
		if (key.lastIndexOf("/") == -1) {
			keyFolder = "";
			keyFile = key;
		} else {
			keyFolder = key.substring(0, key.lastIndexOf("/"));
			keyFile = key.substring(key.lastIndexOf("/") + 1);
		}

		int filepos = 0;
		if (keyFolder.equals("")) {
			filepos = -3;
		} else {
			boolean foundit = false;
			while (counter < DTBNodes.size() && (foundit == false) ) {
				DTBNode x = (DTBNode)DTBNodes.get(counter);
				String node = x.path;
				if (node.equals(keyFolder)) {
					foundit = true;
					filepos = x.filepos;
				}
				counter = counter + 1;
			}
			if (!foundit) {
				throw new Exception("DTB node not found");
			}
		}
		RandomAccessFile raf = new RandomAccessFile(DTAFile, "rw");
		//skip node number
		raf.seek(filepos + 4);
		//number of children nodes
		int originalchildren = GHUtils.read16BitNumber(raf.readShort());
		if (originalchildren < position) {
			raf.close();
			throw new Exception("Not enough child nodes");
		}
		//add one to node count
		originalchildren = originalchildren + 1;
		raf.seek(filepos + 4);
		raf.write(GHUtils.write16BitNumber(originalchildren));
		//skip this node's id
		raf.skipBytes(4);
		if (filepos != -3) {
			//skip first child (should be node name)
			int numb = (int)GHUtils.readNumber(raf.readInt());
			if (numb != 5) {
				//wasn't keyword
				raf.close();
				throw new Exception("Not keyword");
			}
			int skipper = (int)GHUtils.readNumber(raf.readInt());
			int innercounter = 0;
			while (innercounter < skipper) {
				raf.read();
				innercounter = innercounter + 1;
			}
		}
		//now should be at start of first non-name node, position 1
		while (position > 1) {
			skipNode(raf);
			position = position - 1;
		}
		//read in byte array for the rest of the file
		long prevpos = raf.getFilePointer();
		byte[] rest = new byte[(int)(raf.length() - raf.getFilePointer())];
		raf.readFully(rest);
		//delete rest of file
		raf.seek(prevpos);
		raf.setLength(prevpos);
		//now, write in new node value
		raf.write(GHUtils.writeNumber(16));
		//now, number of children
		raf.write(GHUtils.write16BitNumber(intvalues.size() + 1));
		//now node ID
		raf.write(GHUtils.writeNumber(getNewNodeID()));
		//now keyword child
		raf.write(GHUtils.writeNumber(5));
		raf.write(GHUtils.writeNumber(keyFile.length()));
		byte[] newvalue = keyFile.getBytes("ISO-8859-1");
		if (newvalue.length != keyFile.length()) {
			throw new Exception("Error converting " + keyFile + " to bytes.");
		}
		raf.write(newvalue);
		//now int children
		int innercounter = 0;
		while (innercounter < intvalues.size()) {
			Integer a = (Integer)intvalues.get(innercounter);
			raf.write(GHUtils.writeNumber(0));
			raf.write(GHUtils.writeNumber(a.intValue()));
			innercounter = innercounter + 1;
		}
		//now, the rest of the file
		raf.write(rest);
		raf.close();

		//now, clear out all current values, and recreate entire DTBNodes structure
		createLookupTable();
	}

	public void deleteNode(String key) throws Exception {
		int counter = 0;
		int filepos = -1;
		//make sure node exists and find its filepos
		boolean foundit = false;
		while (counter < DTBNodes.size() && (foundit == false) ) {
			DTBNode x = (DTBNode)DTBNodes.get(counter);
			String node = x.path;
			if (node.equals(key)) {
				filepos = x.filepos;
				foundit = true;
			}
			counter = counter + 1;
		}
		if (!foundit) {
			throw new Exception("node not found");
		}
		//now, find parent node
		counter = 0;
		String keyFolder = "";
		if (key.lastIndexOf("/") == -1) {
			keyFolder = "";
		} else {
			keyFolder = key.substring(0, key.lastIndexOf("/"));
		}
		int fileposs = 0;
		if (keyFolder.equals("")) {
			fileposs = -3;
		} else {
			boolean founditt = false;
			while (counter < DTBNodes.size() && (founditt == false) ) {
				DTBNode x = (DTBNode)DTBNodes.get(counter);
				String node = x.path;
				if (node.equals(keyFolder)) {
					founditt = true;
					fileposs = x.filepos;
				}
				counter = counter + 1;
			}
			if (!founditt) {
				throw new Exception("DTB node not found");
			}
		}
		RandomAccessFile raf = new RandomAccessFile(DTAFile, "rw");
		//skip node number
		raf.seek(fileposs + 4);
		//number of children nodes
		int originalchildren = GHUtils.read16BitNumber(raf.readShort());
		//subtract one from parent node count
		originalchildren = originalchildren - 1;
		raf.seek(fileposs + 4);
		raf.write(GHUtils.write16BitNumber(originalchildren));

		//now skip to beginning of node to delete
		raf.seek(filepos);
		//find end of node position
		skipNode(raf);
		//read in byte array for the rest of the file
		byte[] rest = new byte[(int)(raf.length() - raf.getFilePointer())];
		raf.readFully(rest);
		//delete rest of file
		raf.seek(filepos);
		raf.setLength(filepos);
		//now, the rest of the file without deleted node
		raf.write(rest);
		raf.close();
		//now, clear out all current values, and recreate entire DTBNodes structure
		createLookupTable();
	}

	/*************************** PUBLIC VALUE WRITING METHODS **********************/

	public void write1Float(String key, Float value) throws Exception {
		int counter = 0;
		boolean foundit = false;
		while (counter < DTBNodes.size() && (foundit == false) ) {
			DTBNode x = (DTBNode)DTBNodes.get(counter);
			String node = x.path;
			if (node.equals(key)) {
				Object obj = x.theValue;
				if (! (obj instanceof DTBValue)) {
					throw new Exception("DTBValue object not found.");
				}
				DTBValue dtbval = (DTBValue)obj;
				if (! (dtbval.value instanceof Float)) {
					throw new Exception("DTBValue is not float.");
				}
				//just replace with new val, since we're not rebuilding (same size)
				dtbval.value = value;
				RandomAccessFile raf = new RandomAccessFile(DTAFile, "rw");
				int filepos = x.filepos;
				raf.seek(filepos + 14);
				int skipper = (int)GHUtils.readNumber(raf.readInt());
				raf.skipBytes(skipper);
				int numb = (int)GHUtils.readNumber(raf.readInt());
				if (numb != 1) {
					raf.close();
					throw new Exception("Incorrect DTB Value");
				}
				int intversion = Float.floatToIntBits(value.floatValue());
				raf.write(GHUtils.writeNumber(intversion));

				raf.close();
				foundit = true;
			}

			counter = counter + 1;
		}
		if (!foundit) {
			throw new Exception("Float not found");
		}
	}

	public void write0Int(String key, Integer value) throws Exception {
		int counter = 0;
		boolean foundit = false;
		while (counter < DTBNodes.size() && (foundit == false) ) {
			DTBNode x = (DTBNode)DTBNodes.get(counter);
			String node = x.path;
			if (node.equals(key)) {
				Object obj = x.theValue;
				if (! (obj instanceof DTBValue)) {
					throw new Exception("DTBValue object not found.");
				}
				DTBValue dtbval = (DTBValue)obj;
				if (! (dtbval.value instanceof Integer)) {
					throw new Exception("DTBValue is not integer.");
				}
				//just replace with new val, since we're not rebuilding (same size)
				dtbval.value = value;
				RandomAccessFile raf = new RandomAccessFile(DTAFile, "rw");
				int filepos = x.filepos;
				raf.seek(filepos);
				raf.seek(filepos + 14);
				int skipper = (int)GHUtils.readNumber(raf.readInt());
				raf.skipBytes(skipper);
				int numb = (int)GHUtils.readNumber(raf.readInt());
				if (numb != 0) {
					raf.close();
					throw new Exception("Incorrect DTB Value");
				}
				int intversion = value.intValue();
				raf.write(GHUtils.writeNumber(intversion));
				raf.close();
				foundit = true;
			}

			counter = counter + 1;
		}
		if (!foundit) {
			throw new Exception("Integer not found");
		}
	}

	public void writeString(String key, String value, int nodeType) throws Exception {
		int counter = 0;
		if ( (nodeType != 2) && (nodeType != 5) && (nodeType != 7) && (nodeType != 18)
				&& (nodeType != 32) && (nodeType != 33) && (nodeType != 34) ) {
			throw new Exception("Incorrect noteType");
		}
		boolean foundit = false;
		while (counter < DTBNodes.size() && (foundit == false) ) {
			DTBNode x = (DTBNode)DTBNodes.get(counter);
			String node = x.path;
			if (node.equals(key)) {
				Object obj = x.theValue;
				if (! (obj instanceof DTBValue)) {
					throw new Exception("DTBValue object not found.");
				}
				DTBValue dtbval = (DTBValue)obj;
				if (! (dtbval.value instanceof String)) {
					throw new Exception("DTBValue is not string.");
				}
				//rebuild DBA file first, then recalculate everything, since filepos's change
				RandomAccessFile raf = new RandomAccessFile(DTAFile, "rw");
				int filepos = x.filepos;
				raf.seek(filepos);
				raf.seek(filepos + 14);
				int skipper = (int)GHUtils.readNumber(raf.readInt());
				raf.skipBytes(skipper);
				int numb = (int)GHUtils.readNumber(raf.readInt());
				if (numb != nodeType) {
					raf.close();
					throw new Exception("Incorrect DTB Value" + numb);
				}
				skipper = (int)GHUtils.readNumber(raf.readInt());
				//overwrite with new value
				raf.seek(raf.getFilePointer() - 4);
				raf.write(GHUtils.writeNumber(value.length()));
				long prevpos = raf.getFilePointer();
				//read in byte array for the rest of the file, starting at the the right point in the file
				raf.skipBytes(skipper);
				byte[] rest = new byte[(int)(raf.length() - raf.getFilePointer())];
				raf.readFully(rest);
				//delete rest of file
				raf.seek(prevpos);
				raf.setLength(prevpos);
				//write new value
				byte[] newvalue = value.getBytes("ISO-8859-1");
				//confirm that nothing strange happened in the text transfer
				if (newvalue.length != value.length()) {
					throw new Exception("Error converting " + value + " to bytes.");
				}
				raf.write(newvalue);
				//now rewrite rest of file back from array
				raf.write(rest);
				raf.close();
				//rewrite nodes from file
				createLookupTable();
				foundit = true;
			}
			counter = counter + 1;
		}
		if (!foundit) {
			throw new Exception("String not found");
		}
	}

	/*************************** PRIVATE METHODS **********************/
	/*
	 * Re-read the current DTA file, and repopulate all local vars
	 */
	private void createLookupTable() throws Exception {
		RandomAccessFile raf = new RandomAccessFile(DTAFile, "r");
		DTBNodes.clear();
		nodeIDCounter = -1;
		//read number of top-level nodes
		raf.skipBytes(1);
		int topNodes = GHUtils.read16BitNumber(raf.readShort());
		raf.skipBytes(4);
		try {
			int counter = 0;
			while (counter < topNodes) {
				String nodeString = "";
				processNode(raf, nodeString);
				counter = counter + 1;
			}
		} catch (Exception err) {
			err.printStackTrace();
			raf.close();
			throw err;
		}
		raf.close();
	}

	/**
	 * Read through the nodes, creating the DTBNodes vector as we go
	 */
	private void processNode(RandomAccessFile raf, String nodeString) throws Exception {
		//always assume we started at a node, so read in the node
		int filepos = (int)raf.getFilePointer();		//for storing later
		int numb = (int)GHUtils.readNumber(raf.readInt());
		if ( (numb != 16) && (numb != 17) && (numb != 19) ) {
			//happens sometimes
			raf.seek(raf.getFilePointer() - 4);
			Object x = readValue(raf);		//oddball node
			nodeString = nodeString + " ";
			DTBValue val = new DTBValue(x, numb);
			DTBNode oddNode = new DTBNode(val, 0, filepos, nodeString, -1);
			DTBNodes.add(oddNode);
			return;
		}
		//number of children
		int originalchildren = GHUtils.read16BitNumber(raf.readShort());
		//node ID
		int nodeID = (int)GHUtils.readNumber(raf.readInt());     //can cast to int here, these won't get big
		if (originalchildren < 1) {
			throw new Exception("No children for node");
		}
		String keyword = "";
		//read first child (which is node name, usually)
		numb = (int)GHUtils.readNumber(raf.readInt());
		int children = originalchildren;
		if (numb != 5) {
			//wasn't keyword
			keyword = " ";
			raf.seek(raf.getFilePointer() - 4);
			children = children + 1;
		} else {
			//was keyword
			int skipper = (int)GHUtils.readNumber(raf.readInt());
			int counter = 0;
			while (counter < skipper) {
				keyword = keyword + (char)raf.read();
				counter = counter + 1;
			}
		}
		if (!nodeString.equals("")) {
			nodeString = nodeString + "/";
		}
		nodeString = nodeString + keyword;
		//now, figure out if other children are nodes or data
		//assumes all nodes are one or the other only
		if (children == 1) {
			DTBNode oddNode = new DTBNode(null, 0, filepos, nodeString, nodeID);
			DTBNodes.add(oddNode);
			return;
		}
		int counter = 0;
		numb = (int)GHUtils.readNumber(raf.readInt());
		raf.seek(raf.getFilePointer() - 4);	//back up since we'll re-read this value below
		if ( (numb != 16) && (numb != 17) && (numb != 19) ) {
			//DATA FOUND
			if (children == 2) {
				//single value
				Object singleValue = readValue(raf);
				DTBValue val = new DTBValue(singleValue, numb);
				DTBNode node = new DTBNode(val, 0, filepos, nodeString, nodeID);
				DTBNodes.add(node);
			} else {
				//more than one object here
				Vector v = new Vector();
				counter = 1;
				while (counter < children) {
					Object singleValue = readValue(raf);
					DTBValue val = new DTBValue(singleValue, numb);
					v.add(val);
					counter = counter + 1;
				}
				DTBNode node = new DTBNode(v, 0, filepos, nodeString, nodeID);
				DTBNodes.add(node);
			}
		} else {
			//MORE NODES
			DTBNode node = new DTBNode(null, originalchildren, filepos, nodeString, nodeID);
			DTBNodes.add(node);
			counter = 0;
			while (counter < (children - 1) ) {
				//recurse
				processNode(raf, nodeString);
				counter = counter + 1;
			}
		}
	}

	/**
	 * Like process node, but just skips a node in the file rather than writing anything
	 */
	private void skipNode(RandomAccessFile raf) throws Exception {
		//always assume we started at a node, so read in the node
		int numb = (int)GHUtils.readNumber(raf.readInt());
		if ( (numb != 16) && (numb != 17) && (numb != 19) ) {
			//happens sometimes
			raf.seek(raf.getFilePointer() - 4);
			readValue(raf);		//oddball node
			return;
		}
		//number of children
		int originalchildren = GHUtils.read16BitNumber(raf.readShort());
		if (originalchildren < 1) {
			throw new Exception("No children for node");
		}
		//node id
		raf.skipBytes(4);
		//read first child (which is node name, usually)
		numb = (int)GHUtils.readNumber(raf.readInt());
		int children = originalchildren;
		if (numb != 5) {
			raf.seek(raf.getFilePointer() - 4);
			children = children + 1;
		} else {
			//was keyword
			int skipper = (int)GHUtils.readNumber(raf.readInt());
			int counter = 0;
			while (counter < skipper) {
				raf.read();
				counter = counter + 1;
			}
		}
		//now, figure out if other children are nodes or data
		//assumes all nodes are one or the other only
		if (children == 1) {
			return;
		}
		int counter = 0;
		numb = (int)GHUtils.readNumber(raf.readInt());
		raf.seek(raf.getFilePointer() - 4);	//back up since we'll re-read this value below
		if ( (numb != 16) && (numb != 17) && (numb != 19) ) {
			//DATA FOUND
			if (children == 2) {
				//single value
				readValue(raf);
			} else {
				//more than one object here
				counter = 1;
				while (counter < children) {
					readValue(raf);
					counter = counter + 1;
				}
			}
		} else {
			//MORE NODES
			counter = 0;
			while (counter < (children - 1) ) {
				//recurse
				skipNode(raf);
				counter = counter + 1;
			}
		}
	}

	/**
	 * Read and return a single (non-tree node) value
	 */
	private Object readValue(RandomAccessFile raf) throws Exception {
		int numb = (int)GHUtils.readNumber(raf.readInt());
		int skipper;
		if (numb == 0) {
			//32 bit int
			int val = (int)GHUtils.readNumber(raf.readInt());		//i think casting is safe here
			Integer intVal = new Integer(val);
			return intVal;
		} else if (numb == 1) {
			//32 bit float
			int val = (int)GHUtils.readNumber(raf.readInt());
			Float floatVal = new Float(Float.intBitsToFloat(val));
			return floatVal;
		} else if (numb == 2) {
			//function name
			skipper = (int)GHUtils.readNumber(raf.readInt());
			raf.skipBytes(skipper);
			return null;
		} else if (numb == 5) {
			//keyword (sometimes shows up here); treat as a string
			skipper = (int)GHUtils.readNumber(raf.readInt());
			int innercounter = 0;
			String stringVal = "";
			while (innercounter < skipper) {
				stringVal = stringVal + (char)raf.read();
				innercounter = innercounter + 1;
			}
			return stringVal;
		} else if (numb == 6) {
			//unknown
			raf.skipBytes(4);
			return null;
		} else if (numb == 7) {
			//unknown
			skipper = (int)GHUtils.readNumber(raf.readInt());
			raf.skipBytes(skipper);
			return null;
		} else if (numb == 8) {
			//unknown
			raf.skipBytes(4);
			return null;
		} else if (numb == 9) {
			//unknown
			raf.skipBytes(4);
			return null;
		} else if (numb == 18) {
			//STRING VALUE
			skipper = (int)GHUtils.readNumber(raf.readInt());
			int innercounter = 0;
			String stringVal = "";
			while (innercounter < skipper) {
				stringVal = stringVal + (char)raf.read();
				innercounter = innercounter + 1;
			}
			return stringVal;
		} else if (numb == 32) {
			//string
			skipper = (int)GHUtils.readNumber(raf.readInt());
			raf.skipBytes(skipper);
			return null;
		} else if (numb == 33) {
			//file ref
			skipper = (int)GHUtils.readNumber(raf.readInt());
			raf.skipBytes(skipper);
			return null;
		} else if (numb == 34) {
			//file ref
			skipper = (int)GHUtils.readNumber(raf.readInt());
			raf.skipBytes(skipper);
			return null;
		} else if (numb == 35) {
			//string
			skipper = (int)GHUtils.readNumber(raf.readInt());
			raf.skipBytes(skipper);
			return null;
		} else {
			throw new Exception("Incorrect DTB reference: " + numb);
		}
	}

	private int getNewNodeID() {
		if (nodeIDCounter != -1) {
			return nodeIDCounter + 1;
		}
		int counter = 0;
		while (counter < DTBNodes.size()) {
			DTBNode x = (DTBNode)DTBNodes.get(counter);
			if (x.nodeID > nodeIDCounter) {
				nodeIDCounter = x.nodeID;
			}
			counter = counter + 1;
		}
		return nodeIDCounter + 1;
	}
}


text:
#ifndef DECL_CC_MSVC_H_
#define DECL_CC_MSVC_H_

#include <decl/c.h>
DECL_BEGIN_C
#include <decl/config.h>

#if ! DECL_CC_MSVC
#   error "don't include this file manually: it's for Microsoft Visual C compiler only"
#endif

#define DECL_EXPORT_T __declspec(dllexport)
#define DECL_IMPORT_T __declspec(dllimport)
#define DECL_EXPORT_FN __declspec(dllexport)
#define DECL_IMPORT_FN __declspec(dllimport)
#define DECL_EXPORT_VAR __declspec(dllexport)
#define DECL_IMPORT_VAR __declspec(dllimport)

#define DECL_FUNCSIG    __FUNCSIG__
#define DECL_ALIGN(newtype, type, size) typedef __declspec(align(size)) type newtype;
#define DECL_DEPRECATED __declspec(deprecated)
#define DECL_MALLOC __declspec(restrict)
#define DECL_NORETURN __declspec(noreturn)
#define DECL_NEVER_INLINE __declspec(noinline)
#define DECL_FORCE_INLINE __forceinline
#define DECL_INLINE __inline

DECL_END_C
#endif