text:
from pyspider.libs.base_handler import *
from pymongo import MongoClient
from bson.objectid import ObjectId
import math
import datetime

# check mongo: db.runCommand({"distinct":"vendor", "key":"speciesName"})
class Handler(BaseHandler):
    crawl_config = {
        'itag': 'v1.3'
    }

    def __init__(self):
        self.base_url = 'http://duorou.com/duorouzhiwu-1-b0-duorouzhiwu.html'
        self.pagination_url = 'http://duorou.com/duorouzhiwu-1-b0-min0-max0-attr0-{}-sort_orderASCgoods_id-DESC.html'
        self.page_no = 1
        self.page_size = 20
        self.image_path = '/Users/anmy/Downloads/tmp/vendor/'
        self.mongo_url = 'mongodb://127.0.0.1:27017/succulent'
        self.mongo_client = MongoClient(self.mongo_url)
        self.mongo_db = self.mongo_client['succulent']

    @every(minutes=60)
    def on_start(self):
        self.crawl(self.base_url, callback=self.index_page)

    @config(age=30 * 60)
    def index_page(self, response):
        total = int(response.doc('#pager b:first').text().strip())
        self.page_no = int(math.ceil(float(total) / self.page_size))
        for index in range(1, self.page_no + 1):
            self.crawl(self.pagination_url.format(index), callback=self.list_page)

    def list_page(self, response):
        for each in response.doc('.modContent li').items():
            a = each('.portfolio-title a')
            list_page_url = a.attr.href
            species_name = a.text().strip()
            image = each('.portfolio-img img').attr.src
            self.crawl(list_page_url, callback=self.detail_page,
                       save={'species_name': species_name, 'image': image})

    def detail_page(self, response):
        species_name = response.save['species_name']
        image = response.save['image']
        lis = response.doc('.ProductD li')
        for each in lis.items():
            size = each.text().strip()
            imageUrl = image
            if each.attr.image and lis.length > 1:
                imageUrl = 'http://duorou.com/' + each.attr.image

            result = self.mongo_db['vendor'].find_one({'speciesName': species_name, 'size': size})
            if result:
                self.mongo_db['vendor'].update_one({'_id': ObjectId(result['_id'])}, {'$set': {
                    'originalPrice': each.attr.price,
                    'promotionPrice': each.attr.promote,
                    'inventory': each.attr.num,
                    'updateTime': datetime.datetime.utcnow()
                }})
            else:
                self.mongo_db['vendor'].insert({
                    'speciesName': species_name,
                    'size': size,
                    'originalPrice': each.attr.price,
                    'promotionPrice': each.attr.promote,
                    'inventory': each.attr.num,
                    'imageUrl': imageUrl,
                    'detailUrl': response.url,
                    'vendor': 'wanxiang',
                    'updateTime': datetime.datetime.utcnow()
                })


text:
package org.apache.webbeans.test.unittests.inject;

import javax.enterprise.util.AnnotationLiteral;

import org.junit.Assert;

import org.apache.webbeans.test.AbstractUnitTest;
import org.apache.webbeans.test.annotation.binding.Binding1;
import org.apache.webbeans.test.annotation.binding.Binding2;
import org.apache.webbeans.test.component.service.ITyped2;
import org.apache.webbeans.test.component.service.Typed2;
import org.apache.webbeans.test.component.service.TypedInjection;
import org.apache.webbeans.test.component.service.TypedInjectionWithoutArguments;
import org.junit.Test;

public class TypedInjectedComponentTest extends AbstractUnitTest
{
    @Test
    public void testTypedComponent() throws Throwable
    {
        startContainer(Typed2.class, TypedInjection.class);
        TypedInjection i = getInstance(TypedInjection.class);
        Typed2 typed2 = (Typed2)i.getV();
        typed2.setValue(true);

        Assert.assertTrue(i.getV() instanceof ITyped2);

        Typed2 obj2 = getInstance(Typed2.class,
                new AnnotationLiteral<Binding1>() {}, new AnnotationLiteral<Binding2>() {});

        Assert.assertSame(typed2.isValue(), obj2.isValue());
    }

    @Test
    public void testTypedComponentWithoutArgument() throws Throwable
    {
        startContainer(Typed2.class, TypedInjectionWithoutArguments.class);
        TypedInjectionWithoutArguments i = getInstance(TypedInjectionWithoutArguments.class);

        Typed2 typed2 = (Typed2)i.getV();
        typed2.setValue(true);

        Assert.assertTrue(i.getV() instanceof ITyped2);

        Typed2 obj2 = getInstance(Typed2.class,
                new AnnotationLiteral<Binding1>() {}, new AnnotationLiteral<Binding2>() {});

        Assert.assertSame(typed2.isValue(), obj2.isValue());
    }

}

redpajama_set_name: RedPajamaGithub


text:
export const defaultState = {
    loading: false,
    initialCheck: false
};

export default (state = defaultState, action) => {
    switch (action.type) {
        case "USERS_IS_LOADING":
            return {
                ...state,
                loading: true
            };

        case "USERS_IS_NOT_LOADING":
            return {
                ...state,
                loading: false
            };

        case "USERS_INITIAL_CHECK":
            return {
                ...state,
                initialCheck: true
            };

        case "USERS_CLEAR":
        case "REGISTRATION_LOG_OUT":
        case "REGISTRATION_CLEAR_PRIVATE_DATA":
        case "REGISTRATION_CLEAR_USER_INFO":
            return {
                ...defaultState
            };
    }
    return state;
};


text:
require_relative 'base_api.rb'

class LinkApi < BaseApi

  # PATHS
  SHARES_PATH = "links/shares.json"

  def get_shares(encoded_url)
    get_get_response( build_url("#{SHARES_PATH}?url=#{encoded_url}", {}, false) )
  end
end


text: require 'inline'


text:
(function() {
	// Only run in iframe.
	if (top === self) {
		return;
	}

	// Cross browser support for listening on events from the parent.
	var eventMethod = window.addEventListener ? 'addEventListener' : 'attachEvent';
	var attachEvent = window[eventMethod];
	var messageEvent = eventMethod == 'attachEvent' ? 'onmessage' : 'message';
	attachEvent(messageEvent,function(e) {
		var data = JSON.parse(e.data);
		if (data.type === 'css') {
			var request = new XMLHttpRequest();
			request.open('GET', window.location.toString(), true);
			request.onreadystatechange = handleRequest(request);
			request.send(null);
		} else if (data.type === 'content') {
			window.location.reload(true);
		}

		// Acknowledge that we recieved the data.
		window.top.postMessage(JSON.stringify({'type': 'ack'}), '*');
	}, false);

	function handleRequest(request) {
		function addCacheBuster(currentHref, newHref) {
			// If they don't match at all the site is most likely using a hash to bust caches.
			if (!currentHref.match(new RegExp(newHref))) {
				currentHref = newHref;
			}

			// If the path stays the same we append/update a cache buster GET variable.
			if (currentHref.match(/cachebust/)) {
				return currentHref.replace(/cachebust=[0-9]+/, 'cachebust='+new Date().getTime());
			}
			if (currentHref.indexOf('?') === -1) {
				return currentHref+'?cachebust='+new Date().getTime();
			} else {
				return currentHref+'&cachebust='+new Date().getTime();
			}
		}

		return function() {
			if (request.readyState !== 4 || request.status !== 200) {
				return;
			}

			var newDom = document.createElement('div');
			newDom.innerHTML = request.responseText;

			var currentLinks = document.getElementsByTagName('link');
			var newLinks = newDom.getElementsByTagName('link');

			// If the css link count doesn't match they probably added something, to be safe we refresh.
			if (currentLinks.length !== newLinks.length) {
				window.location.reload(true);
			} else {
				for (var i=0; i < currentLinks.length; i++) {
					currentLinks[i].href = addCacheBuster(currentLinks[i].href, newLinks[i].href);
				}
			}
		};
	}

	// Announce what page we are on to the parent.
	window.top.postMessage(JSON.stringify({'type': 'url', 'url': window.location.toString()}), '*');
})();


text:
"""
Factory class for animations
"""

from .animation import Animation
from .attack import AttackHitAnimation
from .damage import DamageTriggeredAnimation
from .death import DeathAnimation
from .dig import DigAnimation
from .healing import HealAddedAnimation, HealTriggeredAnimation
from .inventory import DropAnimation, PickUpAnimation
from .metamorphosis import MetamorphosisAnimation
from .mitosis import MitosisAnimation
from .moving import MoveAnimation
from .perception import NoticeAnimation, LoseFocusAnimation
from .poison import PoisonAddedAnimation, PoisonTriggeredAnimation
from .trap import PlaceTrapAnimation
from pyherc.events import e_event_type

class AnimationFactory():
    """
    Class for creating animations for events

    .. versionadded:: 0.12
    """
    def __init__(self):
        """
        Default constructor
        """
        self.animations = {
            'attack hit': AttackHitAnimation,
            'damage triggered': DamageTriggeredAnimation,
            'death': DeathAnimation,
            'dig': DigAnimation,
            'drop': DropAnimation,
            'heal started': HealAddedAnimation,
            'heal triggered': HealTriggeredAnimation,
            'lose focus': LoseFocusAnimation,
            'metamorphosis': MetamorphosisAnimation,
            'mitosis': MitosisAnimation,
            'move': MoveAnimation,
            'notice': NoticeAnimation,
            'pick up': PickUpAnimation,
            'poisoned': PoisonAddedAnimation,
            'poison triggered': PoisonTriggeredAnimation,
            'trap placed': PlaceTrapAnimation
        }

    def create_animation(self, event):
        """
        Create an animation for event

        :param event: event to create animation for
        :type event: Event
        :returns: animation
        :rtype: Animation
        """
        if e_event_type(event) in self.animations:
            return self.animations[e_event_type(event)](event)
        else:
            return Animation(event)


text:
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2022 The Chromium Authors. All rights reserved.
     Use of this source code is governed by a BSD-style license that can be
     found in the LICENSE file. -->

<layer-list
    xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:drawable="@drawable/popup_bg" />
    <item>
        <org.chromium.components.browser_ui.widget.SurfaceColorDrawable
            xmlns:app="http://schemas.android.com/apk/res-auto"
            android:shape="rectangle"
            app:surfaceElevation="@dimen/menu_bg_color_elev">
            <corners android:radius="@dimen/popup_bg_corner_radius" />
        </org.chromium.components.browser_ui.widget.SurfaceColorDrawable>
    </item>
</layer-list>


text:
.. _db-format-document:

===============
Database Format
===============

When you write a formatter function (:ref:`format-function-document`),
the first argument to the function is a `pyloc.db.Results`
object. The `conn` member of this object is an `sqlite3.Connection`
object, or, in other words, a open connection to a sqlite
database. This database contains all of the compiled results from
pyloc's scan of the source files.

Using the Connection is relatively simple. For example, to get a list
of all of the file types encountered in the scan::

   def my_formatter(rslt):
     cur = rslt.conn.cursor()
     cur.execute('SELECT type FROM types')
     return str([row[0] for row in cur])

For in-depth information on how to use a Connection object or sqlite
in general, refer to the python standard library documentation.

Table Definitions
=================

There are four tables defined in the results database: types, files,
categories, and counts.

*(While this documentation will be kept up-to-date as much as possible,
it's possible that it will get out of sync with the code. For the
definitive view of the database's structure, look in the source
code...it should be easy to spot where the tables are being created)*

`types` Table
-------------

`types` contains a row for each file type (e.g. Python, C++, etc.)::

  id: integer
    The unique ID for this file type
  type: text
    The textual name of this type

`files` Tables
--------------

`files` contains a row for each file scanned by pyloc::

  id: integer
    The unique ID for this file
  name: text
    The name of the file, including its root
  root: text
    The root directory under which this file was found
  type_id: integer (FK types.id)
    The type of the file

`categories` Tables
-------------------

`categories` contains a row for each category that was counted
(e.g. comment, code, blank, etc.)::

  id: integer
    The unique ID for this category
  category: text
    The name of this category

.. topic:: Categories across types

  Not all file types will have the same categories. There are a few
  categories that should be nearly universal, e.g. blank, comment,
  code. However, there may be categories that are only appropriate for
  a particular language (e.g. docstrings in python). And when custom
  parser support is added, there may be all manner of categories that
  formatters will see. This is important to keep in mind when
  designing format functions.

`counts` Table
--------------

`counts` contains a row for each each category in each file::

  id: integer
    The unique ID of this count
  cat_id: integer (FK categories.id)
    The category for this count
  file_id: integer (FK files.id)
    The file for this count
  count: integer
    The count for the given category in the specified file


text:
use crate::error::msg::SemError;
use crate::mem;
use crate::sym::Sym::{SymClass, SymClassTypeParam, SymEnum, SymFctTypeParam, SymStruct, SymTrait};
use crate::ty::{BuiltinType, TypeList};
use crate::typeck;
use crate::vm::{FileId, NodeMap, VM};
use dora_parser::ast::Type::{TypeBasic, TypeLambda, TypeSelf, TypeTuple};
use dora_parser::ast::{Expr, ExprBlockType, Stmt, Type};

mod abstractck;
mod clsdefck;
mod constdefck;
mod enumck;
mod fctdefck;
mod flowck;
mod globaldef;
mod globaldefck;
mod implck;
mod impldefck;
mod nameck;
mod prelude;
mod returnck;
pub mod specialize;
mod structdefck;
mod superck;
mod traitdefck;
pub mod typeparamck;

macro_rules! return_on_error {
    ($vm: ident) => {{
        if $vm.diag.lock().has_errors() {
            return;
        }
    }};
}

pub fn check<'ast>(vm: &mut VM<'ast>) {
    let mut map_cls_defs = NodeMap::new(); // get ClassId from ast node
    let mut map_struct_defs = NodeMap::new(); // get StructId from ast node
    let mut map_trait_defs = NodeMap::new(); // get TraitId from ast node
    let mut map_impl_defs = NodeMap::new(); // get ImplId from ast node
    let mut map_global_defs = NodeMap::new(); // get GlobalId from ast node
    let mut map_const_defs = NodeMap::new(); // get ConstId from ast node
    let mut map_enum_defs = NodeMap::new(); // get EnumId from ast node

    // add user defined fcts and classes to vm
    // this check does not look into fct or class bodies
    globaldef::check(
        vm,
        &mut map_cls_defs,
        &mut map_struct_defs,
        &mut map_trait_defs,
        &mut map_impl_defs,
        &mut map_global_defs,
        &mut map_const_defs,
        &mut map_enum_defs,
    );
    return_on_error!(vm);

    // define internal classes
    prelude::internal_classes(vm);

    // checks class/struct/trait definitions/bodies
    clsdefck::check(vm, &vm.ast, &map_cls_defs);
    structdefck::check(vm, &vm.ast, &map_struct_defs);
    traitdefck::check(vm, &vm.ast, &map_trait_defs);
    impldefck::check(vm, &vm.ast, &map_impl_defs);
    globaldefck::check(vm, &vm.ast, &map_global_defs);
    constdefck::check(vm, &vm.ast, &map_const_defs);
    enumck::check(vm, &vm.ast, &map_enum_defs);
    return_on_error!(vm);

    // check names/identifiers of local variables
    // and their usage (variable def/use, function calls) in function bodies
    nameck::check(vm);
    return_on_error!(vm);

    // check type definitions of params,
    // return types and local variables in functions
    fctdefck::check(vm);
    return_on_error!(vm);

    superck::check_override(vm);
    return_on_error!(vm);

    // check impl methods against trait definition
    implck::check(vm);
    return_on_error!(vm);

    // define internal functions & methods
    prelude::internal_functions(vm);
    prelude::known_methods(vm);

    // check types of expressions in functions
    typeck::check(vm);
    return_on_error!(vm);

    // are break and continue used in the right places?
    flowck::check(vm);

    // checks if function has a return value
    returnck::check(vm);

    // add size of super classes to field offsets
    superck::check(vm);
    return_on_error!(vm);

    abstractck::check(vm);

    // check for internal functions or classes
    internalck(vm);
    return_on_error!(vm);

    // initialize addresses for global variables
    init_global_addresses(vm);
}

fn internalck<'ast>(vm: &VM<'ast>) {
    for fct in vm.fcts.iter() {
        let fct = fct.read();

        if fct.in_class() {
            continue;
        }

        if fct.internal && !fct.internal_resolved {
            vm.diag
                .lock()
                .report(fct.file, fct.pos, SemError::UnresolvedInternal);
        }

        if fct.kind.is_definition() && !fct.in_trait() {
            vm.diag
                .lock()
                .report(fct.file, fct.pos, SemError::MissingFctBody);
        }
    }

    for cls in vm.classes.iter() {
        let cls = cls.read();

        if cls.internal && !cls.internal_resolved {
            vm.diag
                .lock()
                .report(cls.file, cls.pos, SemError::UnresolvedInternal);
        }

        for method in &cls.methods {
            let method = vm.fcts.idx(*method);
            let method = method.read();

            if method.internal && !method.internal_resolved {
                vm.diag
                    .lock()
                    .report(method.file, method.pos, SemError::UnresolvedInternal);
            }

            if method.kind.is_definition() && !method.is_abstract {
                vm.diag
                    .lock()
                    .report(method.file, method.pos, SemError::MissingFctBody);
            }
        }
    }
}

fn init_global_addresses<'ast>(vm: &VM<'ast>) {
    let globals = vm.globals.lock();
    let mut size = 0;
    let mut offsets = Vec::with_capacity(globals.len());

    for glob in globals.iter() {
        let glob = glob.lock();

        let ty_size = glob.ty.size(vm);
        let ty_align = glob.ty.align(vm);

        let offset = mem::align_i32(size, ty_align);
        offsets.push(offset);
        size = offset + ty_size;
    }

    let ptr = vm.gc.alloc_perm(size as usize);

    for (ind, glob) in globals.iter().enumerate() {
        let mut glob = glob.lock();
        let offset = offsets[ind];

        glob.address_value = ptr.offset(offset as usize);
    }
}

pub fn read_type<'ast>(vm: &VM<'ast>, file: FileId, t: &'ast Type) -> Option<BuiltinType> {
    match *t {
        TypeSelf(_) => Some(BuiltinType::This),

        TypeBasic(ref basic) => {
            let sym = vm.sym.lock().get(basic.name);
            if let Some(sym) = sym {
                match sym {
                    SymClass(cls_id) => {
                        let ty = if basic.params.len() > 0 {
                            let mut type_params = Vec::new();

                            for param in &basic.params {
                                let param = read_type(vm, file, param);

                                if let Some(param) = param {
                                    type_params.push(param);
                                } else {
                                    return None;
                                }
                            }

                            let cls = vm.classes.idx(cls_id);
                            let cls = cls.read();

                            if cls.type_params.len() != type_params.len() {
                                let msg = SemError::WrongNumberTypeParams(
                                    cls.type_params.len(),
                                    type_params.len(),
                                );
                                vm.diag.lock().report(file, basic.pos, msg);
                                return None;
                            }

                            for (tp, ty) in cls.type_params.iter().zip(type_params.iter()) {
                                if let Some(cls_id) = tp.class_bound {
                                    let cls = vm.cls(cls_id);

                                    if !ty.subclass_from(vm, cls) {
                                        let name = ty.name(vm);
                                        let cls = cls.name(vm);

                                        let msg = SemError::ClassBoundNotSatisfied(name, cls);
                                        vm.diag.lock().report(file, basic.pos, msg);
                                    }
                                }

                                let cls_id = if let Some(cls_id) = ty.cls_id(vm) {
                                    cls_id
                                } else {
                                    continue;
                                };

                                let cls = vm.classes.idx(cls_id);
                                let cls = cls.read();

                                for &trait_bound in &tp.trait_bounds {
                                    if !cls.traits.contains(&trait_bound) {
                                        let bound = vm.traits[trait_bound].read();
                                        let name = ty.name(vm);
                                        let trait_name = vm.interner.str(bound.name).to_string();
                                        let msg =
                                            SemError::TraitBoundNotSatisfied(name, trait_name);
                                        vm.diag.lock().report(file, bound.pos, msg);
                                    }
                                }
                            }

                            let list = TypeList::with(type_params);
                            let list_id = vm.lists.lock().insert(list);
                            BuiltinType::Class(cls.id, list_id)
                        } else {
                            let cls = vm.classes.idx(cls_id);
                            let cls = cls.read();

                            cls.ty
                        };

                        return Some(ty);
                    }

                    SymTrait(trait_id) => {
                        if basic.params.len() > 0 {
                            let msg = SemError::NoTypeParamsExpected;
                            vm.diag.lock().report(file, basic.pos, msg);
                        }

                        return Some(BuiltinType::Trait(trait_id));
                    }

                    SymStruct(struct_id) => {
                        if basic.params.len() > 0 {
                            let msg = SemError::NoTypeParamsExpected;
                            vm.diag.lock().report(file, basic.pos, msg);
                        }

                        let list_id = vm.lists.lock().insert(TypeList::empty());
                        return Some(BuiltinType::Struct(struct_id, list_id));
                    }

                    SymEnum(enum_id) => {
                        if basic.params.len() > 0 {
                            let msg = SemError::NoTypeParamsExpected;
                            vm.diag.lock().report(file, basic.pos, msg);
                        }

                        return Some(BuiltinType::Enum(enum_id));
                    }

                    SymClassTypeParam(cls_id, type_param_id) => {
                        if basic.params.len() > 0 {
                            let msg = SemError::NoTypeParamsExpected;
                            vm.diag.lock().report(file, basic.pos, msg);
                        }

                        return Some(BuiltinType::ClassTypeParam(cls_id, type_param_id));
                    }

                    SymFctTypeParam(fct_id, type_param_id) => {
                        if basic.params.len() > 0 {
                            let msg = SemError::NoTypeParamsExpected;
                            vm.diag.lock().report(file, basic.pos, msg);
                        }

                        return Some(BuiltinType::FctTypeParam(fct_id, type_param_id));
                    }

                    _ => {
                        let name = vm.interner.str(basic.name).to_string();
                        let msg = SemError::ExpectedType(name);
                        vm.diag.lock().report(file, basic.pos, msg);
                    }
                }
            } else {
                let name = vm.interner.str(basic.name).to_string();
                let msg = SemError::UnknownType(name);
                vm.diag.lock().report(file, basic.pos, msg);
            }

            None
        }

        TypeTuple(ref tuple) => {
            if tuple.subtypes.len() == 0 {
                Some(BuiltinType::Unit)
            } else {
                let mut subtypes = Vec::new();

                for subtype in &tuple.subtypes {
                    if let Some(ty) = read_type(vm, file, subtype) {
                        subtypes.push(ty);
                    } else {
                        return None;
                    }
                }

                let list = TypeList::with(subtypes);
                let list_id = vm.lists.lock().insert(list);

                Some(BuiltinType::Tuple(list_id))
            }
        }

        TypeLambda(ref lambda) => {
            let mut params = vec![];

            for param in &lambda.params {
                if let Some(p) = read_type(vm, file, param) {
                    params.push(p);
                } else {
                    return None;
                }
            }

            let ret = if let Some(ret) = read_type(vm, file, &lambda.ret) {
                ret
            } else {
                return None;
            };

            let ty = vm.lambda_types.lock().insert(params, ret);
            let ty = BuiltinType::Lambda(ty);

            Some(ty)
        }
    }
}

pub fn always_returns(s: &Stmt) -> bool {
    returnck::returns_value(s).is_ok()
}

pub fn expr_always_returns(e: &Expr) -> bool {
    returnck::expr_returns_value(e).is_ok()
}

pub fn expr_block_always_returns(e: &ExprBlockType) -> bool {
    returnck::expr_block_returns_value(e).is_ok()
}

#[cfg(test)]
pub mod tests {
    use crate::error::msg::SemError;
    use crate::test;
    use crate::vm::VM;
    use dora_parser::lexer::position::Position;

    pub fn ok(code: &'static str) {
        test::parse_with_errors(code, |vm| {
            let diag = vm.diag.lock();
            let errors = diag.errors();

            println!("errors = {:?}", errors);

            for e in errors {
                println!("{}", e.message(vm));
            }

            assert!(!diag.has_errors());
        });
    }

    pub fn ok_with_test<F, R>(code: &'static str, f: F) -> R
    where
        F: FnOnce(&VM) -> R,
    {
        test::parse_with_errors(code, |vm| {
            let diag = vm.diag.lock();
            let errors = diag.errors();

            println!("errors = {:?}", errors);

            for e in errors {
                println!("{}", e.message(vm));
            }

            assert!(!diag.has_errors());

            f(vm)
        })
    }

    pub fn err(code: &'static str, pos: Position, msg: SemError) {
        test::parse_with_errors(code, |vm| {
            let diag = vm.diag.lock();
            let errors = diag.errors();

            println!("errors = {:?}", errors);

            assert_eq!(1, errors.len(), "found {} errors instead", errors.len());
            assert_eq!(pos, errors[0].pos);
            assert_eq!(msg, errors[0].msg);
        });
    }

    pub fn errors(code: &'static str, vec: &[(Position, SemError)]) {
        test::parse_with_errors(code, |vm| {
            let diag = vm.diag.lock();
            let errors = diag.errors();

            println!("errors = {:?}", errors);
            assert_eq!(vec.len(), errors.len());

            for (ind, error) in errors.iter().enumerate() {
                assert_eq!(vec[ind].0, error.pos);
                assert_eq!(vec[ind].1, error.msg);
            }
        });
    }

    pub fn pos(line: u32, col: u32) -> Position {
        Position::new(line, col)
    }
}


text:
package elaborator;

import java.util.LinkedList;

import ast.Ast.Dec;
import ast.Ast.Type;

public class MethodType {
    public Type.T retType;
    public LinkedList<Dec.T> argsType;

    public MethodType(Type.T retType, LinkedList<Dec.T> decs) {
        this.retType = retType;
        this.argsType = decs;
    }

    @Override
    public String toString() {
        String s = "";
        for (Dec.T dec : this.argsType) {
            Dec.DecSingle decc = (Dec.DecSingle) dec;
            s = decc.type.toString() + "*" + s;
        }
        s = s + " -> " + this.retType.toString();
        return s;
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<project name="wombat-petite" default="jar">
  <description>
    Bindings for Wombat and Petite.
  </description>

  <property name="src-dir" location="src" />
  <property name="bin-dir" location="bin" />
  <property name="jar-dir" location="dist" />
  <property name="lib-dir" location="lib" />
  <property name="sslib-dir" location="sslib" />

  <!-- ~~~~~ ~~~~~ ~~~~~ ~~~~~ ~~~~~ -->
  <target name="parent-version" description="get versions from main build file">
    <ant dir=".." target="version" />
    <property name="petite-jar-name" value="petite-${petite-bindings}.jar" />
  </target>

  <!-- ~~~~~ ~~~~~ ~~~~~ ~~~~~ ~~~~~ -->
  <target name="build" depends="parent-version" description="build the source ">
    <mkdir dir="${bin-dir}" />

    <javac srcdir="${src-dir}"
	   destdir="${bin-dir}"
	   includeantruntime="false"
	   debug="on"
	   debuglevel="lines,vars,source"
		 source="1.6"
		 target="1.6"
	   />

    <copy todir="${bin-dir}">
      <fileset dir="${src-dir}" />
    </copy>
  </target>

  <!-- ~~~~~ ~~~~~ ~~~~~ ~~~~~ ~~~~~ -->
  <target name="jar" depends="build" description="generate a jar file">
    <mkdir dir="${jar-dir}" />

    <jar destfile="${jar-dir}/${petite-jar-name}" basedir="${bin-dir}">
      <manifest>
	<attribute name="Main-Class" value="wombat.scheme.Petite" />
      </manifest>
    </jar>

    <zip destfile="${jar-dir}/c211-lib-${c211-lib-version}.zip"
	 basedir="${sslib-dir}" />

    <copy todir="${jar-dir}">
      <fileset dir="${lib-dir}">
	<include name="petite-${petite-version}-*.zip" />
      </fileset>
    </copy>
  </target>

  <!-- ~~~~~ ~~~~~ ~~~~~ ~~~~~ ~~~~~ -->
  <target name="clean" description="remove all of the extra files / directories">
    <delete dir="${bin-dir}" />
    <delete dir="${jar-dir}" />
  </target>

  <!-- ~~~~~ ~~~~~ ~~~~~ ~~~~~ ~~~~~ -->
  <target name="run" depends="jar" description="build and run">
    <java dir="${jar-dir}" jar="${jar-dir}/${petite-jar-name}" fork="true" failonerror="true">
      <jvmarg value="-Xss64m" />
    </java>
  </target>
</project>


text:
namespace fiber_bundle
{

  class binary_section_space_schema_poset;
  class sec_rep_descriptor;

///
/// A client handle for a poset member which has been
/// prepared for use as a schema for a section space.
/// See class binary_section_space_schema_poset for a
/// description of the schema represented by this class.
///
///
///
class SHEAF_DLL_SPEC binary_section_space_schema_member : public section_space_schema_member
{

  // ===========================================================
  /// @name HOAT FACTORY FACET
  // ===========================================================
  //@{

public:

  ///
  /// The type of host poset.
  ///
  typedef binary_section_space_schema_poset host_type;

  ///
  /// The path to the standard schema for this class.
  ///
  static const poset_path& standard_schema_path();

  ///
  /// Creates standard schema for this class in namespace xns.
  ///
  static void make_standard_schema(namespace_poset& xns);

  ///
  /// Creates a new host for members of this type in namespace xns with path xhost_path,
  /// schema specified by xschema_path, and table attributes base_space_path, fiber_space_path,
  /// and rep_path specified by xbase_path, xfiber_path, and xrep_path, respectively.
  ///
  static host_type& new_host(namespace_type& xns,
                              const poset_path& xhost_path,
                              const poset_path& xschema_path,
                              const poset_path& xbase_path,
                              const poset_path& xfiber_path,
                              const poset_path& xrep_path,
                              bool xauto_access);

  ///
  /// The standard path for the host of a schema for sections of type S with
  /// base space specified by xbase_path, fiber suffix xfiber_suffix, and
  /// representation specified by xrep_path.
  ///
  template <typename S>
  static poset_path standard_host_path(const poset_path& xbase_path,
                                       const poset_path& xrep_path,
                                       const std::string& xfiber_suffix);

  ///
  /// The standard path for a schema member for sections of type S with
  /// base space sepcified by xbase_path, fiber suffix xfiber_suffix, and
  /// representation specified by xrep_path.
  ///
  template <typename S>
  static poset_path standard_member_path(const poset_path& xbase_path,
                                         const poset_path& xrep_path,
                                         const std::string& xfiber_suffix);

  ///
  /// True if and only if the host specified by standard_host_path<S>(xbase_path, xrep_path, xfiber_suffix)
  /// does not exist, or it exists and conforms to host_type.
  ///
  template <typename S>
  static bool standard_host_is_available(namespace_poset& xns,
                                         const poset_path& xbase_path,
                                         const poset_path& xrep_path,
                                         const std::string& xfiber_suffix,
                                         bool xauto_access);

  ///
  /// The standard host of a schema for sections of type S with
  /// base space sepcified by xbase_path, fiber suffix xfiber_suffix, and
  /// representation specified by xrep_path.
  ///
  template <typename S>
  static host_type& standard_host(namespace_type& xns,
                                  const poset_path& xbase_path,
                                  const poset_path& xrep_path,
                                  const std::string& xfiber_suffix,
                                  bool xauto_access);

  ///
  /// The path for standard schema member for sections of type S with
  /// base space sepcified by xbase_path, fiber suffix xfiber_suffix, and
  /// representation specified by xrep_path.Creates the standard host and
  /// member if they do not already exist.
  ///
  template <typename S>
  static poset_path standard_member(namespace_type& xns,
                                    const poset_path& xbase_path,
                                    const poset_path& xrep_path,
                                    const std::string& xfiber_suffix,
                                    bool xauto_access);

protected:

private:

  //@}

  // ===========================================================
  /// @name BINARY_SECTION_SPACE_SCHEMA_MEMBER FACET
  // ===========================================================
  //@{

public:

  ///
  /// Default constructor; creates a new, unattached binary_section_space_schema_member handle.
  ///
  binary_section_space_schema_member();

  ///
  /// Copy constructor; creates a new binary_section_space_schema_member handle
  /// attached to the same state as xother.
  ///
  explicit binary_section_space_schema_member(const binary_section_space_schema_member& xother);

  ///
  /// Assignment operator; attaches this to the same state as xother
  ///
  virtual binary_section_space_schema_member& operator=(const abstract_poset_member& xother);

  ///
  /// Assignment operator
  ///
  binary_section_space_schema_member& operator=(const binary_section_space_schema_member& xother);

  ///
  /// Destructor; deletes a poset member and its attached state, if any.
  ///
  virtual ~binary_section_space_schema_member();

  ///
  /// Make a new handle instance of current.  Attach the new instance to
  /// a new state if xnew_state is true.  Otherwise, attach the new instance
  /// to the current state.
  ///
  inline binary_section_space_schema_member* clone(bool xnew_state,
      bool xauto_access = true) const
  {
    return static_cast<binary_section_space_schema_member*>
           (section_space_schema_member::clone(xnew_state, xauto_access));
  }

  // NEW HANDLE, NEW STATE CONSTRUCTORS

  // None - section_space_schema_poset is immutable.

  // NEW HANDLE, EXISTING STATE CONSTRUCTORS

  ///
  /// Creates a new binary_section_space_schema_member handle
  /// attached to the member state with hub id xhub_id in xhost
  ///
  binary_section_space_schema_member(const binary_section_space_schema_poset* xhost,
                                     pod_index_type xhub_id);

  ///
  /// Creates a new binary_section_space_schema_member handle
  /// attached to the member state with id xid in xhost
  ///
  binary_section_space_schema_member(const binary_section_space_schema_poset* xhost,
                                     const scoped_index& xid);

  ///
  /// Creates a new binary_section_space_schema_member handle
  /// attached to the member state with name xname in xhost
  ///
  binary_section_space_schema_member(const binary_section_space_schema_poset* xhost,
                                     const std::string& xname);

  ///
  /// Create a new handle attached to the state in xhost with
  /// component ids xbase_id and xfiber_schema_id.
  ///
  binary_section_space_schema_member(const binary_section_space_schema_poset* xhost,
                                     pod_index_type xbase_space_id,
                                     pod_index_type xfiber_schema_id);

  ///
  /// Create a new handle attached to the state in xhost with
  /// component ids xbase_id and xfiber_schema_id.
  ///
  binary_section_space_schema_member(const binary_section_space_schema_poset* xhost,
                                     const scoped_index& xbase_space_id,
                                     const scoped_index& xfiber_schema_id);

  ///
  /// Create a new handle attached to the state in xhost specified by
  /// paths xbase_path and xfiber_schema_path.
  ///
  binary_section_space_schema_member(const binary_section_space_schema_poset* xhost,
                                     const poset_path& xbase_path,
                                     const poset_path& xfiber_schema_path);

  ///
  /// Creates a new binary_section_space_schema_member handle
  /// attached to the member state specified by xpath in the namespace xns.
  ///
  binary_section_space_schema_member(const namespace_poset& xns,
                                     const poset_path& xpath,
                                     bool xauto_access = true);

  // EXISTING HANDLE, NEW STATE "CONSTRUCTORS"

  // None - section_space_schema_member is immutable

protected:

private:

  //@}

  // ===========================================================
  /// @name SECTION_SPACE_SCHEMA_MEMBER FACET
  // ===========================================================
  //@{

public:

  ///
  /// A postorder iterator over the components defined by this.
  ///
  virtual binary_section_component_iterator* component_iterator() const;

protected:

private:

  //@}

  // ===========================================================
  /// @name SCHEMA_POSET_MEMBER FACET
  // ===========================================================
  //@{

public:

  ///
  /// The type of table dofs (xis_table_dof == true) or
  /// row dofs (xis_table_dof == false) defined by this schema.
  /// Returns NOT_A_PRIMITIVE_TYPE if the dofs are
  /// not all the same type.
  ///
  virtual primitive_type dof_tuple_type(bool xis_table_dof) const;

  ///
  /// The dof_descriptors_array for the table dof tuple
  /// (xis_table_dof true) or row dof tuple defined by this schema.
  /// The offsets in the descriptors are defined by post-ordered,
  /// contiguous, properly aligned allocation of the dofs.
  /// Note: although returned by pointer,
  /// the client must not delete the dof offsets array.
  /// Not implemented for xis_table_dof false.
  ///
  ///
  virtual dof_descriptor_array* dof_descriptors(bool xis_table_dof) const;

  ///
  /// True if this is in the table dofs part (xin_table_dofs == true)
  /// or in the row dofs part (xin_table_dofs == false) of some schema.
  ///
  virtual bool is_dof(bool xin_table_dofs) const;

  using section_space_schema_member::size;

  ///
  /// The number of bytes in this dof
  ///
  virtual size_t size() const;

  using section_space_schema_member::alignment;

  ///
  /// The alignment for this dof
  ///
  virtual size_t alignment() const;

  using section_space_schema_member::type;

  ///
  /// The primitive type index of the dof defined by this.
  ///
  virtual sheaf::primitive_type type() const;

  ///
  /// A postorder iterator over the table (xis_table_dofs == true)
  /// or row (xis_table_dofs == false) dofs defined by this.
  ///
  virtual binary_section_dof_iterator* dof_iterator(bool xis_table_dofs,
						    int xversion = CURRENT_MEMBER_VERSION) const;

  ///
  /// A postorder iterator over the table dofs defined by this.
  /// Synonym for dof_iterator(true).
  ///
  inline binary_section_dof_iterator* table_dof_iterator(int xversion = CURRENT_MEMBER_VERSION) const
  {
    return dof_iterator(true, xversion);
  };

  ///
  /// A postorder iterator over the row dofs defined by this.
  ///
  inline binary_section_dof_iterator* row_dof_iterator(int xversion = CURRENT_MEMBER_VERSION) const
  {
    return dof_iterator(false, xversion);
  };

protected:

  ///
  /// Updates cached row properties.
  ///
  virtual void update_row_cache(bool xupdate_id_map = false) const;

private:

  //@}

  // ===========================================================
  /// @name I/O SUPPORT FACET
  // ===========================================================
  //@{

public:

  ///
  /// An iterator over the members of the decomposition identified by xindex.
  /// @hack the product subposet hack, version 2.
  /// This member exists only to encapsulate the hack.
  ///
  virtual index_iterator* get_decomposition(pod_index_type xindex) const;

  ///
  /// Gets the internal id corresponding to xext_id in the id space
  /// with name xid_space_name.
  /// @hack the product subposet hack, version 2.
  /// This member exists only to encapsulate the hack.
  ///
  virtual pod_index_type get_int_id(pod_index_type xext_id,
				    const std::string& xid_space_name) const;

  ///
  /// Gets the external ids of this in
  /// the id space with namexid_space_name
  /// @hack the product subposet hack, version 2.
  /// This member exists only to encapsulate the hack.
  ///
  virtual void get_ext_ids(const std::string& xid_space_name,
                           pod_index_type& xschema_poset_ext_id,
                           pod_index_type& xschema_member_ext_id,
                           pod_index_type& xbase_space_ext_id,
                           pod_index_type& xfiber_schema_ext_id,
                           pod_index_type& xlocal_schema_ext_id) const;

  ///
  /// The schema for the external data type associated with this schema.
  ///
  virtual schema_poset_member& ext_data_type_schema();

  ///
  /// The number of instances of the external data type needed to
  /// represent this schema.
  ///
  virtual size_t ext_data_type_ct(bool xis_table_schema) const;

protected:

private:

  //@}

  // ===========================================================
  /// @name DEGREE OF FREEDOM (DOF) TUPLE FACET
  // ===========================================================
  //@{

public:

  ///
  /// The map from schema member ids or client ids to
  /// dof values for this poset member (mutable version)
  ///
  virtual primitives_poset_dof_map& dof_map(bool xrequire_write_access = false);

  ///
  /// The map from schema member ids or client ids to
  /// dof values for this poset member (const version)
  ///
  virtual const primitives_poset_dof_map& dof_map(bool xrequire_write_access = false) const;

protected:

private:

  //@}

  // ===========================================================
  /// @name ORDERING RELATION FACET
  // ===========================================================
  //@{

public:

  ///
  /// The largest member which is join-equivalent to this
  ///
  inline binary_section_space_schema_member* greatest_jem() const
  {
    return static_cast<binary_section_space_schema_member*>(abstract_poset_member::greatest_jem());
  };

  ///
  /// The smallest member which is join-equivalent to this
  ///
  inline binary_section_space_schema_member* least_jem() const
  {
    return static_cast<binary_section_space_schema_member*>(abstract_poset_member::least_jem());
  };

protected:

private:

  //@}

  // ===========================================================
  /// @name POSET ALGEBRA FACET
  // ===========================================================
  //@{

public:

  ///
  /// poset join of this with other, auto-, pre-, and self-allocated versions
  /// the poset join is the least upper bound in the poset
  ///
  inline binary_section_space_schema_member* p_join(abstract_poset_member* other) const
  {
    return static_cast<binary_section_space_schema_member*>(abstract_poset_member::p_join(other));
  };

  ///
  /// poset meet of this with other, auto-, pre-, and self-allocated versions
  /// the poset meet is the greatest lower bound in the poset
  ///
  inline binary_section_space_schema_member* p_meet(abstract_poset_member* other)
  {
    return static_cast<binary_section_space_schema_member*>(abstract_poset_member::p_meet(other));
  };

protected:

private:

  //@}

  // ===========================================================
  /// @name LATTICE ALGEBRA FACET
  // ===========================================================
  //@{

public:

  ///
  /// lattice join of this with other, auto-, pre-, and self-allocated versions
  /// the lattice join is the least upper bound in the lattice generated by
  /// the jims in the poset
  ///
  inline binary_section_space_schema_member* l_join(abstract_poset_member* other, bool xnew_jem = true)
  {
    return static_cast<binary_section_space_schema_member*>(abstract_poset_member::l_join(other, xnew_jem));
  };

  ///
  /// lattice meet of this with other, auto-, pre-, and self-allocated versions
  /// the lattice meet is the greatest lower bound in the lattice generated by
  /// the jims in the poset
  ///
  inline binary_section_space_schema_member* l_meet(abstract_poset_member* other, bool xnew_jem = true)
  {
    return static_cast<binary_section_space_schema_member*>(abstract_poset_member::l_meet(other, xnew_jem));
  };

  ///
  /// lattice pseudo-complement of this, auto-, pre- and self allocated versions
  /// The lattice pseudo-complement is the largest lattice member m for which
  /// this.l_meet(m) = 0
  ///
  inline binary_section_space_schema_member* l_not(bool xnew_jem = true) const
  {
    return static_cast<binary_section_space_schema_member*>(abstract_poset_member::l_not(xnew_jem));
  };

protected:

private:

  //@}

  // ===========================================================
  /// @name STATE FACET
  // ===========================================================
  //@{

public:

  using section_space_schema_member::attach_to_state;

  ///
  /// Attach to the state in host() with
  /// component ids xbase_id and xfiber_schema_id.
  ///
  virtual void attach_to_state(pod_index_type xbase_space_id,
                               pod_index_type xfiber_schema_id);

  ///
  /// Attach to the state in xhost with
  /// component ids xbase_id and xfiber_schema_id.
  ///
  virtual void attach_to_state(const section_space_schema_poset* xhost,
                               pod_index_type xbase_space_id,
                               pod_index_type xfiber_schema_id);

  ///
  /// Attach to the state in xhost specified by
  /// paths xbase_path and xfiber_schema_path.
  ///
  virtual void attach_to_state(const section_space_schema_poset* xhost,
                               const poset_path& xbase_path,
                               const poset_path& xfiber_schema_path);

protected:

private:

  //@}

  // ===========================================================
  /// @name HOST POSET FACET
  // ===========================================================
  //@{

public:

  ///
  /// The poset which this is a handle to a component of.
  ///
  inline binary_section_space_schema_poset* host() const
  {
    return reinterpret_cast<binary_section_space_schema_poset*>(section_space_schema_member::host());
  }

  ///
  /// True if other conforms to host
  ///
  virtual bool host_is_ancestor_of(const poset_state_handle* other) const;

protected:

private:

  //@}

  // ===========================================================
  /// @name ANY FACET
  // ===========================================================
  //@{

public:

  ///
  /// True if other conforms to this
  ///
  virtual bool is_ancestor_of(const any* other) const;

  ///
  /// Make a new handle, no state instance of current
  ///
  virtual binary_section_space_schema_member* clone() const;

  ///
  /// Class invariant
  ///
  virtual bool invariant() const;

protected:

private:

  //@}
};

} // namespace fiber_bundle

#endif // BINARY_SECTION_SPACE_SCHEMA_MEMBER_H


text:
SYNONYM

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Miscell. Lich. 62 (1856)

#### Original name
Placidium compactum A. Massal.

### Remarks
null


text:
package org.ugeojson.parser.deserializer;

import java.lang.reflect.Type;

import org.ugeojson.model.PositionDto;
import org.ugeojson.model.geometry.PointDto;
import org.ugeojson.parser.util.BoundingBoxParser;

import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;

/**
 * Deserializer for Point
 *
 * @author moksuzer
 *
 */
public class PointDeserializer implements JsonDeserializer<PointDto> {

	@Override
	public PointDto deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) {

		PointDto point = new PointDto();

		JsonObject asJsonObject = json.getAsJsonObject();
		JsonElement jsonElement = asJsonObject.get("coordinates");
		PositionDto positionDto = context.deserialize(jsonElement, PositionDto.class);
		point.setPosition(positionDto);

		point.setBbox(BoundingBoxParser.parseBbox(asJsonObject, context));

		return point;
	}

}


text:
class AutofillField;

// A phone number in one of the following formats:
// - area code, prefix, suffix
// - area code, number
// - number
class PhoneField : public FormField {
 public:
  virtual ~PhoneField();

  static PhoneField* Parse(std::vector<AutofillField*>::const_iterator* iter,
                           bool is_ecml);
  static PhoneField* ParseECML(
      std::vector<AutofillField*>::const_iterator* iter);

  virtual bool GetFieldInfo(FieldTypeMap* field_type_map) const;

 private:
  PhoneField();

  enum PhoneType {
    PHONE_TYPE_FIRST = 0,
    HOME_PHONE = PHONE_TYPE_FIRST,
    FAX_PHONE,

    // Must be last.
    PHONE_TYPE_MAX,
  };

  // Some field names are different for phone and fax.
  string16 GetCountryRegex() const;
  // This string includes all area code separators, including NoText.
  string16 GetAreaRegex() const;
  // Separator of the area code in the case fields are formatted without
  // any text indicating what fields are (e.g. field1 "(" field2 ")" field3 "-"
  // field4 means Country Code, Area Code, Prefix, Suffix)
  string16 GetAreaNoTextRegex() const;
  string16 GetPhoneRegex() const;
  string16 GetPrefixSeparatorRegex() const;
  string16 GetPrefixRegex() const;
  string16 GetSuffixSeparatorRegex() const;
  string16 GetSuffixRegex() const;
  string16 GetExtensionRegex() const;

  // This is for easy description of the possible parsing paths of the phone
  // fields.
  enum RegexType {
    REGEX_COUNTRY,
    REGEX_AREA,
    REGEX_AREA_NOTEXT,
    REGEX_PHONE,
    REGEX_PREFIX_SEPARATOR,
    REGEX_PREFIX,
    REGEX_SUFFIX_SEPARATOR,
    REGEX_SUFFIX,
    REGEX_EXTENSION,

    // Separates regexps in grammar.
    REGEX_SEPARATOR,
  };

  string16 GetRegExp(RegexType regex_id) const;

  // |field| - field to fill up on successful parsing.
  // |iter| - in/out. Form field iterator, points to the first field that is
  //   attempted to be parsed. If parsing successful, points to the first field
  //   after parsed fields.
  // |regular_phone| - true if the parsed phone is a HOME phone, false
  //   otherwise.
  static bool ParseInternal(PhoneField* field,
                            std::vector<AutofillField*>::const_iterator* iter,
                            bool regular_phone);

  void SetPhoneType(PhoneType phone_type);

  // Field types are different as well, so we create a temporary phone number,
  // to get relevant field types.
  scoped_ptr<PhoneNumber> number_;
  PhoneType phone_type_;

  // Parsed fields.
  enum PhonePart {
    FIELD_NONE = -1,
    FIELD_COUNTRY_CODE,
    FIELD_AREA_CODE,
    FIELD_PHONE,
    FIELD_SUFFIX,
    FIELD_EXTENSION,

    FIELD_MAX,
  };

  // FIELD_PHONE is always present; holds suffix if prefix is present.
  // The rest could be NULL.
  AutofillField* parsed_phone_fields_[FIELD_MAX];

  static struct Parser {
    RegexType regex;       // Field matching reg-ex.
    PhonePart phone_part;  // Index of the field.
    int max_size;          // Max size of the field to match. 0 means any.
  } phone_field_grammars_[];

  DISALLOW_COPY_AND_ASSIGN(PhoneField);
};

#endif  // CHROME_BROWSER_AUTOFILL_PHONE_FIELD_H_


text:
use shared::minwindef::{ULONG, USHORT};
use um::winnt::{PSLIST_ENTRY, PSLIST_HEADER};
extern "system" {
    pub fn InitializeSListHead(
        ListHead: PSLIST_HEADER,
    );
    pub fn InterlockedPopEntrySList(
        ListHead: PSLIST_HEADER,
    ) -> PSLIST_ENTRY;
    pub fn InterlockedPushEntrySList(
        ListHead: PSLIST_HEADER,
        ListEntry: PSLIST_ENTRY,
    ) -> PSLIST_ENTRY;
    pub fn InterlockedPushListSListEx(
        ListHead: PSLIST_HEADER,
        List: PSLIST_ENTRY,
        ListEnd: PSLIST_ENTRY,
        Count: ULONG,
    ) -> PSLIST_ENTRY;
    pub fn InterlockedFlushSList(
        ListHead: PSLIST_HEADER,
    ) -> PSLIST_ENTRY;
    pub fn QueryDepthSList(
        ListHead: PSLIST_HEADER,
    ) -> USHORT;
}


text:
{% includeCssResource "webtexttool/css/wtt-core.css" %}
{% includeCssResource "webtexttool/css/angular-busy.min.css" %}
{% includeCssResource "webtexttool/css/flag.min.css" %}
{% includeCssResource "webtexttool/css/scrollable-table.min.css" %}
{% includeCssResource "webtexttool/css/ng-tags-input.css" %}
{% includeCssResource "webtexttool/css/angular-toastr.min.css" %}
{% includeCssResource "webtexttool/css/ladda-themeless.min.css" %}
{% includeCssResource "webtexttool/css/font-awesome.min.css" %}

{% set descriptionFieldJS %}
$(function($j) {
    $j('div[id="title-field"]').after(
    '
' +
        '
' +
            '' +
                'Page description' +
                '' +
            '<button type="button" class="wtt-btn-info-d" data-toggle="popover" data-trigger="focus" data-placement="top" data-content="This is the summary of your page that will be shown in the search results and what a potential visitor of your page will see. So it's important to create a catchy description of your page."></button>' +
            '
' +
        '<textarea id="wtt_description" placeholder="Page Description" name="wtt_description"></textarea>' +
        '
'
    );
});

{% endset %}

{% includeJs descriptionFieldJS %}

    {% include "webtexttool/header.html" %}
    {% include "webtexttool/warning.html" %}
    {% include "webtexttool/research.html" %}
    {% include "webtexttool/suggestions.html" %}

<input type="hidden" id="wtt-record-id" name="recordId" value="{{ record ? record.id : null }}"/>
<input type="hidden" id="wtt-language-code-field" name="wtt_language" value="{{ record ? record.wttLanguage : null }}"/>


text:
[hitchcock@pd.code.org](mailto:hitchcock@pd.code.org)

Ms. Hitchcock has been teaching for over a decade, teaching grades 3rd through 12th. Prior to teaching she worked in Finance and Engineering. She also has extensive music and theater experience and enjoys working with students and training them to be successful in both their academic and extracurricular careers.

**About Teri Sue**

"I was already excited and enthusiastic to bring coding to the students at my school, but this workshop helped bring many things into better focus as to how to present the many different steps of coding to many different age levels. Thank you so much for providing me the opportunity to attend and enhance my knowledge!" - Jeanette W. from Lake Elmo, MN

"Great workshop. Excellent materials! I'm loving the curriculum guide. We are prepared to make our elementary school a K-5 coding school! Thank you for the excellent resources!" - Megan Z. from Cottage Grove, MN


text:
package dev.mikoto2000.study.springboot.file.ajax;

import java.io.IOException;
import java.io.OutputStream;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
import java.util.List;

import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * FileUploadController
 */
@RestController
public class FileUploadController {

    @PostMapping("/upload")
    public FileUploadResult upload(
            @PathVariable List<MultipartFile> files
            ) {
        System.out.println(files);
        for (MultipartFile file : files) {
            System.out.println(file.getOriginalFilename());
        }
        return new FileUploadResult(200);
    }

    public class FileUploadResult {
        private int status;
        public FileUploadResult(int status) {
            this.status = status;
        }
        public int getStatus() {
            return status;
        }
        public void setStatus(int status) {
            this.status = status;
        }
    }
}


text:
require 'spec_helper'

module JiraReport
  describe JiraReport do
    let(:jrep) { Reporter.new('site', 'admin', '*****') }

    describe '#new' do
      it 'raises error if site is nil' do
        expect{ Reporter.new(nil, '1', '2') }.to raise_error RuntimeError
      end
      it 'raises error if usr is nil' do
        expect{ Reporter.new('mysite', nil, '2') }.to raise_error RuntimeError
      end
      it 'raises error if pas is nil' do
        expect{ Reporter.new('mysite', 'usr', nil) }.to raise_error RuntimeError
      end
    end

    describe '#query_issues' do
      it 'should throw exception' do
        begin
          jrep.query_issues('my_jql')
          fail Exception, 'exception expected'
        rescue => e
          expect(e.message).not_to be nil
        end
      end
    end

    describe '#jira_api_url' do
      def jira_api_url(site=nil, user=nil, pass=nil)
        jrep.send(:jira_api_url, site, user, pass)
      end

      it 'ends with jira rest api search url' do
        expect(jira_api_url 'url', 'usr', 'pas').
          to end_with Reporter::REST_API_SEARCH_URL
      end

      describe 'scheme' do
        ['http', 'https'].each do |s|
          it 'correctly detects scheme' do
            site = "jira.mycom.com"
            url = jira_api_url("#{s}://#{site}")
            expect(url).to start_with "#{s}://"
            expect(url).to include site
          end
        end

        it 'is ok when no scheme passed' do
          site = 'jira.mycom.com'
          expect(jira_api_url(site)).to include site
        end
      end

      context 'when we define all parameters' do
        let(:usr)    { 'admin_username' }
        let(:pas)    { 'password' }
        let(:host)   { 'localhost' }
        let(:port)   {  8000 }
        let(:path)   { 'myjira' }

        def expected_url(prefix)
          "#{prefix}#{usr}:#{pas}@#{host}:#{port}/#{path}/#{Reporter::REST_API_SEARCH_URL}"
        end

        ['http://', 'https://'].each do |prefix|
          it "correctly prepares #{prefix} url" do
            site = "#{prefix}#{host}:#{port}/#{path}"
            url = jira_api_url(site, usr, pas)
            expect(url).to eq ( expected_url prefix )
          end
        end

        it 'correctly prepares url without scheme' do
          site = "#{host}:#{port}/#{path}"
          url = jira_api_url(site, usr, pas)
          expect(url).to eq ( expected_url 'http://' )
        end
      end
    end
  end

  describe '#queries' do
    let(:usr) { 'JohnDoe' }
    let(:from) { '-3w' }
    let(:till) { '-1w' }

    mocked_rep = Reporter.new('url', 'usr', 'pas')

    before(:example) do
      allow(mocked_rep).to receive(:query_issues) do |arg|
        arg
      end
    end

    describe '#created' do
      it 'has from, till and reporter' do
        expect(mocked_rep.created(usr, from, till)).to eql(
          "jql=created>=#{from} AND created<=#{till} AND reporter=#{usr}"
        )
      end
      it 'has from and reporter' do
        expect(mocked_rep.created(usr, from)).to eql(
          "jql=created>=#{from} AND reporter=#{usr}"
        )
      end
      it 'has till and reporter' do
        expect(mocked_rep.created(usr, nil, till)).to eql(
          "jql=created<=#{till} AND reporter=#{usr}"
        )
      end
      it 'has only reporter' do
        expect(mocked_rep.created(usr)).to eql(
          "jql=reporter=#{usr}"
        )
      end
      it 'has not parameters' do
        expect(mocked_rep.created(nil)).to eql(
          "jql=reporter="
        )
      end
    end

    describe '#resolved' do
      it 'has from, till and reporter' do
        expect(mocked_rep.resolved(usr, from, till)).to eql(
          "jql=resolved>=#{from} AND resolved<=#{till} AND 'First Resolution User'=#{usr}"
        )
      end
      it 'has from and reporter' do
        expect(mocked_rep.resolved(usr, from)).to eql(
          "jql=resolved>=#{from} AND 'First Resolution User'=#{usr}"
        )
      end
      it 'has till and reporter' do
        expect(mocked_rep.resolved(usr, nil, till)).to eql(
          "jql=resolved<=#{till} AND 'First Resolution User'=#{usr}"
        )
      end
      it 'has only reporter' do
        expect(mocked_rep.resolved(usr)).to eql(
          "jql='First Resolution User'=#{usr}"
        )
      end
      it 'has not parameters' do
        expect(mocked_rep.resolved(nil)).to eql(
          "jql='First Resolution User'="
        )
      end
    end

    describe '#reopened' do
      it 'has from, till and reporter' do
        expect(mocked_rep.reopened(usr, from, till)).to eql(
          "jql='First Reopened Date'>=#{from} "\
          "AND 'First Reopened Date'<=#{till} "\
          "AND 'First Reopened User'=#{usr}"
        )
      end
      it 'has from and reporter' do
        expect(mocked_rep.reopened(usr, from)).to eql(
          "jql='First Reopened Date'>=#{from} "\
          "AND 'First Reopened User'=#{usr}"
        )
      end
      it 'has till and reporter' do
        expect(mocked_rep.reopened(usr, nil, till)).to eql(
          "jql='First Reopened Date'<=#{till} "\
          "AND 'First Reopened User'=#{usr}"
        )
      end
      it 'has only reporter' do
        expect(mocked_rep.reopened(usr)).to eql(
          "jql='First Reopened User'=#{usr}"
        )
      end
      it 'has not parameters' do
        expect(mocked_rep.reopened(nil)).to eql(
          "jql='First Reopened User'="
        )
      end
    end

    describe '#closed' do
      it 'has from, till and reporter' do
        expect(mocked_rep.closed(usr, from, till)).to eql(
          "jql='First Closed Date'>=#{from} "\
          "AND 'First Closed Date'<=#{till} "\
          "AND 'First Closed User'=#{usr}"
        )
      end
      it 'has from and reporter' do
        expect(mocked_rep.closed(usr, from)).to eql(
          "jql='First Closed Date'>=#{from} "\
          "AND 'First Closed User'=#{usr}"
        )
      end
      it 'has till and reporter' do
        expect(mocked_rep.closed(usr, nil, till)).to eql(
          "jql='First Closed Date'<=#{till} "\
          "AND 'First Closed User'=#{usr}"
        )
      end
      it 'has only reporter' do
        expect(mocked_rep.closed(usr)).to eql(
          "jql='First Closed User'=#{usr}"
        )
      end
      it 'has not parameters' do
        expect(mocked_rep.closed(nil)).to eql(
          "jql='First Closed User'="
        )
      end
    end
  end
end