text:
package com.jfsoft.basegroupitem.controller;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.alibaba.fastjson.serializer.SimplePropertyPreFilter;
import com.base.BaseController;
import com.jfsoft.basegroupitem.service.IBaseGroupitemService;
import com.jfsoft.model.BaseGroupitem;
import com.jfsoft.model.SysUser;
import com.jfsoft.utils.Constants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 组合项目管理
 */
@Controller
public class BaseGroupitemController extends BaseController {

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

    @Autowired
    private IBaseGroupitemService baseGroupitemService;

    /**
     * 查询组合项目列表
     */
    @ResponseBody
    @RequestMapping(value = "/list", method = RequestMethod.POST)
    public String list(String currentPage, String pageSize, String name) {

        Map<String, Object> result = new HashMap<String, Object>();

        List<BaseGroupitem> baseGroupitemList = null;
        int pageCount = 0;

        try {
            baseGroupitemList = baseGroupitemService.findPage(currentPage, pageSize, name);
            pageCount = baseGroupitemService.findPageCount(name);

            result.put("status", Constants.RETURN_STATUS_SUCCESS);
            result.put("data", baseGroupitemList);
        } catch (Exception e) {
            result.put("status", Constants.RETURN_STATUS_FAILURE);
            e.printStackTrace();
        }

        SimplePropertyPreFilter filter = new SimplePropertyPreFilter(BaseGroupitem.class,
                "id", "code", "name", "deptcode", "deptname", "isuse", "synctime");

        String resultJson = JSON.toJSONString(result, filter,
                SerializerFeature.WriteMapNullValue,
                SerializerFeature.WriteNullNumberAsZero,
                SerializerFeature.WriteNullStringAsEmpty);

        return resultJson;
    }

    /**
     * 同步组合项目信息
     */
    @ResponseBody
    @RequestMapping(value = "/sync", method = RequestMethod.POST)
    public String sync() {

        Map<String, Object> result = new HashMap<String, Object>();

        try {
            boolean flage = baseGroupitemService.sync();
            if(flage) {
                result.put("status", Constants.RETURN_STATUS_SUCCESS);
                result.put("data", "同步成功!");
            } else {
                result.put("status", Constants.RETURN_STATUS_FAILURE);
                result.put("data", "同步失败!");
            }
        } catch (Exception e) {
            result.put("status", Constants.RETURN_STATUS_FAILURE);
            result.put("data", "同步失败!");
            e.printStackTrace();
        }

        String resultJson = JSON.toJSONString(result);

        return resultJson;
    }

}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
          "http://www.w3.org/TR/html4/strict.dtd">

  <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  <title><atomic> design</title>
  <link type="text/css" rel="stylesheet" href="menu.css">
  <link type="text/css" rel="stylesheet" href="content.css">

    LLVM Home

    libc++ Info
    About

    Quick Links
    cfe-dev
    cfe-commits
    Bug Reports
    Browse Sources

<atomic> design

The <tt><atomic></tt> header is one of the most closely coupled headers to
the compiler.  Ideally when you invoke any function from
<tt><atomic></tt>, it should result in highly optimized assembly being
inserted directly into your application ...  assembly that is not otherwise
representable by higher level C or C++ expressions.  The design of the libc++
<tt><atomic></tt> header started with this goal in mind.  A secondary, but
still very important goal is that the compiler should have to do minimal work to
facilitate the implementation of <tt><atomic></tt>.  Without this second
goal, then practically speaking, the libc++ <tt><atomic></tt> header would
be doomed to be a barely supported, second class citizen on almost every
platform.

Goals:

Optimal code generation for atomic operations

Minimal effort for the compiler to achieve goal 1 on any given platform

Conformance to the C++0X draft standard

The purpose of this document is to inform compiler writers what they need to do
to enable a high performance libc++ <tt><atomic></tt> with minimal effort.

The minimal work that must be done for a conforming <tt><atomic></tt>

The only "atomic" operations that must actually be lock free in
<tt><atomic></tt> are represented by the following compiler intrinsics:

__atomic_flag__
__atomic_exchange_seq_cst(__atomic_flag__ volatile* obj, __atomic_flag__ desr)
{
    unique_lock<mutex> _(some_mutex);
    __atomic_flag__ result = *obj;
    *obj = desr;
    return result;
}

void
__atomic_store_seq_cst(__atomic_flag__ volatile* obj, __atomic_flag__ desr)
{
    unique_lock<mutex> _(some_mutex);
    *obj = desr;
}

Where:

If <tt>__has_feature(__atomic_flag)</tt> evaluates to 1 in the preprocessor then
the compiler must define <tt>__atomic_flag__</tt> (e.g. as a typedef to
<tt>int</tt>).

If <tt>__has_feature(__atomic_flag)</tt> evaluates to 0 in the preprocessor then
the library defines <tt>__atomic_flag__</tt> as a typedef to <tt>bool</tt>.

To communicate that the above intrinsics are available, the compiler must
arrange for <tt>__has_feature</tt> to return 1 when fed the intrinsic name
appended with an '_' and the mangled type name of <tt>__atomic_flag__</tt>.

For example if <tt>__atomic_flag__</tt> is <tt>unsigned int</tt>:

__has_feature(__atomic_flag) == 1
__has_feature(__atomic_exchange_seq_cst_j) == 1
__has_feature(__atomic_store_seq_cst_j) == 1

typedef unsigned int __atomic_flag__;

unsigned int __atomic_exchange_seq_cst(unsigned int volatile*, unsigned int)
{
   // ...
}

void __atomic_store_seq_cst(unsigned int volatile*, unsigned int)
{
   // ...
}

That's it!  Compiler writers do the above and you've got a fully conforming
(though sub-par performance) <tt><atomic></tt> header!

Recommended work for a higher performance <tt><atomic></tt>

It would be good if the above intrinsics worked with all integral types plus
<tt>void*</tt>.  Because this may not be possible to do in a lock-free manner for
all integral types on all platforms, a compiler must communicate each type that
an intrinsic works with.  For example if <tt>__atomic_exchange_seq_cst</tt> works
for all types except for <tt>long long</tt> and <tt>unsigned long long</tt>
then:

__has_feature(__atomic_exchange_seq_cst_b) == 1  // bool
__has_feature(__atomic_exchange_seq_cst_c) == 1  // char
__has_feature(__atomic_exchange_seq_cst_a) == 1  // signed char
__has_feature(__atomic_exchange_seq_cst_h) == 1  // unsigned char
__has_feature(__atomic_exchange_seq_cst_Ds) == 1 // char16_t
__has_feature(__atomic_exchange_seq_cst_Di) == 1 // char32_t
__has_feature(__atomic_exchange_seq_cst_w) == 1  // wchar_t
__has_feature(__atomic_exchange_seq_cst_s) == 1  // short
__has_feature(__atomic_exchange_seq_cst_t) == 1  // unsigned short
__has_feature(__atomic_exchange_seq_cst_i) == 1  // int
__has_feature(__atomic_exchange_seq_cst_j) == 1  // unsigned int
__has_feature(__atomic_exchange_seq_cst_l) == 1  // long
__has_feature(__atomic_exchange_seq_cst_m) == 1  // unsigned long
__has_feature(__atomic_exchange_seq_cst_Pv) == 1 // void*

Note that only the <tt>__has_feature</tt> flag is decorated with the argument
type.  The name of the compiler intrinsic is not decorated, but instead works
like a C++ overloaded function.

Additionally there are other intrinsics besides
<tt>__atomic_exchange_seq_cst</tt> and <tt>__atomic_store_seq_cst</tt>.  They
are optional.  But if the compiler can generate faster code than provided by the
library, then clients will benefit from the compiler writer's expertise and
knowledge of the targeted platform.

Below is the complete list of sequentially consistent intrinsics, and
their library implementations.  Template syntax is used to indicate the desired
overloading for integral and void* types.  The template does not represent a
requirement that the intrinsic operate on any type!

T is one of:  bool, char, signed char, unsigned char, short, unsigned short,
              int, unsigned int, long, unsigned long,
              long long, unsigned long long, char16_t, char32_t, wchar_t, void*

template <class T>
T
__atomic_load_seq_cst(T const volatile* obj)
{
    unique_lock<mutex> _(some_mutex);
    return *obj;
}

template <class T>
void
__atomic_store_seq_cst(T volatile* obj, T desr)
{
    unique_lock<mutex> _(some_mutex);
    *obj = desr;
}

template <class T>
T
__atomic_exchange_seq_cst(T volatile* obj, T desr)
{
    unique_lock<mutex> _(some_mutex);
    T r = *obj;
    *obj = desr;
    return r;
}

template <class T>
bool
__atomic_compare_exchange_strong_seq_cst_seq_cst(T volatile* obj, T* exp, T desr)
{
    unique_lock<mutex> _(some_mutex);
    if (std::memcmp(const_cast<T*>(obj), exp, sizeof(T)) == 0)
    {
        std::memcpy(const_cast<T*>(obj), &desr, sizeof(T));
        return true;
    }
    std::memcpy(exp, const_cast<T*>(obj), sizeof(T));
    return false;
}

template <class T>
bool
__atomic_compare_exchange_weak_seq_cst_seq_cst(T volatile* obj, T* exp, T desr)
{
    unique_lock<mutex> _(some_mutex);
    if (std::memcmp(const_cast<T*>(obj), exp, sizeof(T)) == 0)
    {
        std::memcpy(const_cast<T*>(obj), &desr, sizeof(T));
        return true;
    }
    std::memcpy(exp, const_cast<T*>(obj), sizeof(T));
    return false;
}

T is one of:  char, signed char, unsigned char, short, unsigned short,
              int, unsigned int, long, unsigned long,
              long long, unsigned long long, char16_t, char32_t, wchar_t

template <class T>
T
__atomic_fetch_add_seq_cst(T volatile* obj, T operand)
{
    unique_lock<mutex> _(some_mutex);
    T r = *obj;
    *obj += operand;
    return r;
}

template <class T>
T
__atomic_fetch_sub_seq_cst(T volatile* obj, T operand)
{
    unique_lock<mutex> _(some_mutex);
    T r = *obj;
    *obj -= operand;
    return r;
}

template <class T>
T
__atomic_fetch_and_seq_cst(T volatile* obj, T operand)
{
    unique_lock<mutex> _(some_mutex);
    T r = *obj;
    *obj &= operand;
    return r;
}

template <class T>
T
__atomic_fetch_or_seq_cst(T volatile* obj, T operand)
{
    unique_lock<mutex> _(some_mutex);
    T r = *obj;
    *obj |= operand;
    return r;
}

template <class T>
T
__atomic_fetch_xor_seq_cst(T volatile* obj, T operand)
{
    unique_lock<mutex> _(some_mutex);
    T r = *obj;
    *obj ^= operand;
    return r;
}

void*
__atomic_fetch_add_seq_cst(void* volatile* obj, ptrdiff_t operand)
{
    unique_lock<mutex> _(some_mutex);
    void* r = *obj;
    (char*&)(*obj) += operand;
    return r;
}

void*
__atomic_fetch_sub_seq_cst(void* volatile* obj, ptrdiff_t operand)
{
    unique_lock<mutex> _(some_mutex);
    void* r = *obj;
    (char*&)(*obj) -= operand;
    return r;
}

void __atomic_thread_fence_seq_cst()
{
    unique_lock<mutex> _(some_mutex);
}

void __atomic_signal_fence_seq_cst()
{
    unique_lock<mutex> _(some_mutex);
}

One should consult the (currently draft)
C++ standard
for the details of the definitions for these operations.  For example
<tt>__atomic_compare_exchange_weak_seq_cst_seq_cst</tt> is allowed to fail
spuriously while <tt>__atomic_compare_exchange_strong_seq_cst_seq_cst</tt> is
not.

If on your platform the lock-free definition of
<tt>__atomic_compare_exchange_weak_seq_cst_seq_cst</tt> would be the same as
<tt>__atomic_compare_exchange_strong_seq_cst_seq_cst</tt>, you may omit the
<tt>__atomic_compare_exchange_weak_seq_cst_seq_cst</tt> intrinsic without a
performance cost.  The library will prefer your implementation of
<tt>__atomic_compare_exchange_strong_seq_cst_seq_cst</tt> over its own
definition for implementing
<tt>__atomic_compare_exchange_weak_seq_cst_seq_cst</tt>.  That is, the library
will arrange for <tt>__atomic_compare_exchange_weak_seq_cst_seq_cst</tt> to call
<tt>__atomic_compare_exchange_strong_seq_cst_seq_cst</tt> if you supply an
intrinsic for the strong version but not the weak.

Taking advantage of weaker memory synchronization

So far all of the intrinsics presented require a sequentially
consistent memory ordering.  That is, no loads or stores can move across
the operation (just as if the library had locked that internal mutex).  But
<tt><atomic></tt> supports weaker memory ordering operations.  In all,
there are six memory orderings (listed here from strongest to weakest):

memory_order_seq_cst
memory_order_acq_rel
memory_order_release
memory_order_acquire
memory_order_consume
memory_order_relaxed

(See the
C++ standard
for the detailed definitions of each of these orderings).

On some platforms, the compiler vendor can offer some or even all of the above
intrinsics at one or more weaker levels of memory synchronization.  This might
lead for example to not issuing an <tt>mfence</tt> instruction on the x86.

If the compiler does not offer any given operation, at any given memory ordering
level, the library will automatically attempt to call the next highest memory
ordering operation.  This continues up to <tt>seq_cst</tt>, and if that doesn't
exist, then the library takes over and does the job with a <tt>mutex</tt>.  This
is a compile-time search & selection operation.  At run time, the
application will only see the few inlined assembly instructions for the selected
intrinsic.

Each intrinsic is appended with the 7-letter name of the memory ordering it
addresses.  For example a <tt>load</tt> with <tt>relaxed</tt> ordering is
defined by:

T __atomic_load_relaxed(const volatile T* obj);

And announced with:

__has_feature(__atomic_load_relaxed_b) == 1  // bool
__has_feature(__atomic_load_relaxed_c) == 1  // char
__has_feature(__atomic_load_relaxed_a) == 1  // signed char
...

The <tt>__atomic_compare_exchange_strong(weak)</tt> intrinsics are parameterized
on two memory orderings.  The first ordering applies when the operation returns
<tt>true</tt> and the second ordering applies when the operation returns
<tt>false</tt>.

Not every memory ordering is appropriate for every operation.  <tt>exchange</tt>
and the <tt>fetch_op</tt> operations support all 6.  But <tt>load</tt>
only supports <tt>relaxed</tt>, <tt>consume</tt>, <tt>acquire</tt> and <tt>seq_cst</tt>.
<tt>store</tt>
only supports <tt>relaxed</tt>, <tt>release</tt>, and <tt>seq_cst</tt>.  The
<tt>compare_exchange</tt> operations support the following 16 combinations out
of the possible 36:

relaxed_relaxed
consume_relaxed
consume_consume
acquire_relaxed
acquire_consume
acquire_acquire
release_relaxed
release_consume
release_acquire
acq_rel_relaxed
acq_rel_consume
acq_rel_acquire
seq_cst_relaxed
seq_cst_consume
seq_cst_acquire
seq_cst_seq_cst

Again, the compiler supplies intrinsics only for the strongest orderings where
it can make a difference.  The library takes care of calling the weakest
supplied intrinsic that is as strong or stronger than the customer asked for.

redpajama_set_name: RedPajamaGithub


text:
using System.Collections.Generic;

public class CarFactory
{
    public Car Create(List<string> args, Tyre tyre)
    {
        var hp = int.Parse(args[0]);
        var fuelAmount = double.Parse(args[1]);

        return new Car(hp, fuelAmount, tyre);
    }
}


text:
require File.expand_path("#{File.dirname(__FILE__)}/../../unit_spec_helper")

module JsTestCore
  module Resources
    describe WebRoot do
      attr_reader :web_root
      before(:each) do
        @web_root = WebRoot.new(:connection => connection, :public_path => public_path)
      end

      describe "GET /stylesheets" do
        it "returns a page with a of files in the directory" do
          mock(connection).send_head()
          mock(connection).send_body(Regexp.new('example.css'))

          connection.receive_data("GET /stylesheets HTTP/1.1\r\nHost: _\r\n\r\n")
        end
      end

      describe "GET /stylesheets/example.css" do
        it "returns a page with a of files in the directory" do
          path = "#{public_path}/stylesheets/example.css"
          mock(connection).send_head(200, 'Content-Type' => "text/css", 'Content-Length' => ::File.size(path), 'Last-Modified' => ::File.mtime(path).rfc822)
          mock(connection).send_data(::File.read(path))
          stub(EventMachine).close_connection

          connection.receive_data("GET /stylesheets/example.css HTTP/1.1\r\nHost: _\r\n\r\n")
        end
      end
    end
  end
end


text:
<!doctype html>

  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Yuki Asayama | Cryptocurrency</title>
  <link rel="stylesheet" href="/index.css">

Cryptocurrency

    Maecenas sed diam eget risus varius blandit sit amet non magna. Nullam quis
    risus eget urna mollis ornare vel eu leo. Praesent commodo cursus magna, vel
    scelerisque nisl consectetur et. Donec ullamcorper nulla non metus auctor
    fringilla. Sed posuere consectetur est at lobortis.


text:
<?xml version="1.0" encoding="UTF-8" ?>

<Configuration monitorInterval="5">
    <Appenders>
        <RollingFile name="LOG" fileName="logs/bitflow-bitcoin.log" filePattern="logs/bitflow-bitcoin.%d{yyyy-MM-dd}.log.gz">
            <PatternLayout pattern="%d{ISO8601} %-5p - %t %c - %m%n"/>
            <Policies>
                <TimeBasedTriggeringPolicy interval="1"/>
            </Policies>
            <DefaultRolloverStrategy max="30"/>
        </RollingFile>

        <Console name="STDOUT" target="SYSTEM_OUT">
            <PatternLayout pattern="%d{ISO8601} %-5p - %t %c - %m%n"/>
        </Console>
    </Appenders>
    <Loggers>
        <Logger name="org.drausin" level="debug" additivity="false">
            <AppenderRef ref="STDOUT"/>
            <AppenderRef ref="LOG"/>
        </Logger>

        <Root level="warn">
            <AppenderRef ref="STDOUT"/>
            <AppenderRef ref="LOG"/>
        </Root>
    </Loggers>
</Configuration>


text:
package org.apache.hadoop.hdds.scm.block;

/**
 * JMX interface for the block manager.
 */
public interface BlockmanagerMXBean {

  /**
   * Number of open containers manager by the block manager.
   */
  int getOpenContainersNo();
}


text:
package com.amazonaws.services.workspaces.model.transform;

import javax.annotation.Generated;

import com.amazonaws.SdkClientException;
import com.amazonaws.services.workspaces.model.*;

import com.amazonaws.protocol.*;
import com.amazonaws.annotation.SdkInternalApi;

/**
 * WorkspaceCreationPropertiesMarshaller
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
@SdkInternalApi
public class WorkspaceCreationPropertiesMarshaller {

    private static final MarshallingInfo<Boolean> ENABLEWORKDOCS_BINDING = MarshallingInfo.builder(MarshallingType.BOOLEAN)
            .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("EnableWorkDocs").build();
    private static final MarshallingInfo<Boolean> ENABLEINTERNETACCESS_BINDING = MarshallingInfo.builder(MarshallingType.BOOLEAN)
            .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("EnableInternetAccess").build();
    private static final MarshallingInfo<String> DEFAULTOU_BINDING = MarshallingInfo.builder(MarshallingType.STRING).marshallLocation(MarshallLocation.PAYLOAD)
            .marshallLocationName("DefaultOu").build();
    private static final MarshallingInfo<String> CUSTOMSECURITYGROUPID_BINDING = MarshallingInfo.builder(MarshallingType.STRING)
            .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("CustomSecurityGroupId").build();
    private static final MarshallingInfo<Boolean> USERENABLEDASLOCALADMINISTRATOR_BINDING = MarshallingInfo.builder(MarshallingType.BOOLEAN)
            .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("UserEnabledAsLocalAdministrator").build();
    private static final MarshallingInfo<Boolean> ENABLEMAINTENANCEMODE_BINDING = MarshallingInfo.builder(MarshallingType.BOOLEAN)
            .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("EnableMaintenanceMode").build();

    private static final WorkspaceCreationPropertiesMarshaller instance = new WorkspaceCreationPropertiesMarshaller();

    public static WorkspaceCreationPropertiesMarshaller getInstance() {
        return instance;
    }

    /**
     * Marshall the given parameter object.
     */
    public void marshall(WorkspaceCreationProperties workspaceCreationProperties, ProtocolMarshaller protocolMarshaller) {

        if (workspaceCreationProperties == null) {
            throw new SdkClientException("Invalid argument passed to marshall(...)");
        }

        try {
            protocolMarshaller.marshall(workspaceCreationProperties.getEnableWorkDocs(), ENABLEWORKDOCS_BINDING);
            protocolMarshaller.marshall(workspaceCreationProperties.getEnableInternetAccess(), ENABLEINTERNETACCESS_BINDING);
            protocolMarshaller.marshall(workspaceCreationProperties.getDefaultOu(), DEFAULTOU_BINDING);
            protocolMarshaller.marshall(workspaceCreationProperties.getCustomSecurityGroupId(), CUSTOMSECURITYGROUPID_BINDING);
            protocolMarshaller.marshall(workspaceCreationProperties.getUserEnabledAsLocalAdministrator(), USERENABLEDASLOCALADMINISTRATOR_BINDING);
            protocolMarshaller.marshall(workspaceCreationProperties.getEnableMaintenanceMode(), ENABLEMAINTENANCEMODE_BINDING);
        } catch (Exception e) {
            throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
        }
    }

}


text:
namespace MediaMonitoringSystem.Models.Sql
{
    using System.Collections.Generic;
    using System.ComponentModel.DataAnnotations;

    public class Client
    {
        private ICollection<Theme> themes;

        public Client()
        {
            this.themes = new HashSet<Theme>();
        }

        [Key]
        public int Id { get; set; }

        [Required]
        [MinLength(3)]
        [MaxLength(40)]
        public string Name { get; set; }

        public virtual ICollection<Theme> Themes
        {
            get
            {
                return this.themes;
            }

            set
            {
                this.themes = value;
            }
        }
    }
}


text:
package net.zer0bandwidth.android.lib.database.sqlitehouse;

import android.support.test.runner.AndroidJUnit4;

import net.zer0bandwidth.android.lib.database.sqlitehouse.annotations.SQLiteTable;
import net.zer0bandwidth.android.lib.database.sqlitehouse.testschema.Blargh;
import net.zer0bandwidth.android.lib.database.sqlitehouse.testschema.BorkBorkBork;
import net.zer0bandwidth.android.lib.database.sqlitehouse.testschema.Dargle;
import net.zer0bandwidth.android.lib.database.sqlitehouse.testschema.Fargle;
import net.zer0bandwidth.android.lib.database.sqlitehouse.testschema.Sparkle;

import org.junit.Test;
import org.junit.runner.RunWith;

import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertTrue;

/**
 * Exercises the static utility methods of {@link SQLightable.Reflection}.
 * @since zer0bandwidth-net/android 0.1.7 (#50)
 */
@RunWith( AndroidJUnit4.class )
public class SQLightableStaticsTest
{
	/**
	 * Exercises the static {@link SQLightable.Reflection#getTableName(Class)},
	 * which, in turn, exercises the protected
	 * {@link SQLightable.Reflection#getTableName(Class, SQLiteTable)}.
	 */
	@Test
	public void testStaticGetTableName()
	{
		assertEquals( "fargles",
				SQLightable.Reflection.getTableName( Fargle.class ) ) ;
		assertEquals( "dargles",
				SQLightable.Reflection.getTableName( Dargle.class ) ) ;
		assertEquals( "sparkles",
				SQLightable.Reflection.getTableName( Sparkle.class ) ) ;
		// Also works on classes that don't have an annotation.
		assertEquals( "blargh",
				SQLightable.Reflection.getTableName( Blargh.class ) ) ;
		// Also works on classes whose reflections are otherwise broken.
		assertEquals( "borkborkbork",
				SQLightable.Reflection.getTableName( BorkBorkBork.class ) ) ;
	}

	/** Exercises {@link SQLightable.Reflection#buildInsert(Class)}. */
	@Test
	public void testBuildInsert()
	{
		assertTrue( SQLightable.Reflection.buildInsert( Fargle.class )
				.toString().startsWith( "INSERT INTO fargles" ) ) ;
	}

	/** Exercises {@link SQLightable.Reflection#buildUpdate(Class)}. */
	@Test
	public void testBuildUpdate()
	{
		assertTrue( SQLightable.Reflection.buildUpdate( Dargle.class )
				.toString().startsWith( "UPDATE dargles" ) ) ;
	}

	/** Exercises {@link SQLightable.Reflection#buildSelect(Class)}. */
	@Test
	public void testBuildSelect()
	{
		assertTrue( SQLightable.Reflection.buildSelect( Blargh.class )
				.toString().startsWith( "SELECT * FROM blargh" ) ) ;
	}

	/** Exercises {@link SQLightable.Reflection#buildDelete(Class)}. */
	@Test
	public void testBuildDelete()
	{
		assertTrue( SQLightable.Reflection.buildDelete( Sparkle.class )
				.toString().startsWith( "DELETE FROM sparkles" ) ) ;
	}
}


text:
{- |
A script for running the Haskell interpreter on Haskell code in bazel project.

For more information, see ...
-}
module Main (main)  where

import Data.List (isPrefixOf, partition)
import qualified Data.Text as Text
import Bazel (defBazelOpts, BazelOpts(..))
import Bazel.Name (parsePackageName, PackageName)
import Repl (runWith, ReplOptions(..))
import Options.Applicative

-- TODO(jinwoo): Consider merging this with ReplOptions once the test
-- interacts directly with the binary.
data MainOptions = MainOptions
  { replOptions :: ReplOptions
  }

parseOptions :: Parser MainOptions
parseOptions =
    MainOptions
        <$> parseReplOptions

parseReplOptions :: Parser ReplOptions
parseReplOptions =
    liftA2 uncurry
        (ReplOptions <$> bazelOpts <*> packageIds <*> rtsOpts <*> interpretDeps)
        ghcFlagsAndTargets

ghcFlagsAndTargets :: Parser ([String], [String])
ghcFlagsAndTargets = fmap (partition isFlag) $ many
                          $ strArgument
                              (metavar "ARGUMENTS"
                                <> help "A Bazel target or a GHC flag")
                            <|> failOnPackageFlag
  where
    isFlag ('-':_) = True
    isFlag _ = False

-- | Blacklist the specific flag "-package", to avoid confusion with
-- the "--package" flag which could lead to
-- However, allow any other "-p..." flags to pass through to GHC.
-- (This is a bit of a hack because optparse-applicative always parses
-- flags like "-pabcdefg" as "-p=abcdefg", unlike GHC.)
failOnPackageFlag :: Parser String
failOnPackageFlag =
    ("-p" ++) <$> option (eitherReader checkIsNotPackage) (short 'p')
  where
    checkIsNotPackage s
        | "ackage" `isPrefixOf` s =
            Left $ "The \"-package\" flag is not supported; did you mean "
                    ++ "\"--package\"?"
        | otherwise = Right s

bazelOpts :: Parser BazelOpts
bazelOpts = (\bazel preArgs args cmds ->
        defBazelOpts
          { bazelBin = bazel
          , bazelPre = bazelPre defBazelOpts ++ preArgs
          , bazelPost = bazelPost defBazelOpts ++ args
          , bazelShowCommands = cmds
          })
    <$> bazelBinPath
    <*> manySpaced bazelPreArgs
    <*> manySpaced bazelArgs
    <*> showCommands
  where
    manySpaced = fmap (concatMap words) . many
    bazelBinPath = strOption
        $ long "bazel"
       <> value (bazelBin defBazelOpts)
       <> metavar "PATH"
       <> help "Path to the bazel executable"
    bazelPreArgs = strOption
        $ long "bazel-pre-args"
       <> metavar "ARGS"
       <> help ("Space-separated arguments to pass to Bazel before "
                ++ "the main command")
    bazelArgs =
      strOption (
        long "bazel-args"
        <> metavar "ARGS"
        <> help "Space-separated arguments to pass to Bazel"
      ) <|>
      ((\mode -> "-c " <> mode) <$>
       strOption (
          short 'c'
          <> long "compilation_mode"
          <> metavar "MODE"
          <> help "Compilation mode passed to Bazel"
       )
      )
    showCommands = switch $
                      long "show-commands"
                      <> help "Print the calls to Bazel"

packageIds :: Parser [String]
packageIds = many $ strOption
                  $ long "package"
                  <> metavar "TARGET"
                  <> help ("Allows a given library to be imported "
                           ++ "in the interpreter session.")

rtsOpts :: Parser String
rtsOpts = strOption
              $ long "with-rtsopts"
              <> value ""
              <> metavar "OPTS"
              <> help ("RTS options to be used for running the target. "
                       ++ "Space-separated.")

interpretDeps :: Parser [PackageName]
interpretDeps = many
    $ fmap (parsePackageName . Text.pack)
    $ strOption
    $ long "interpret-deps"
    <> metavar "PACKAGE"
    <> help "Also interpret any dependencies under the given Blaze package."

main :: IO ()
main = do
    opts <- execParser $ info (helper <*> parseOptions) forwardOptions
    runWith $ replOptions opts


text:
/**
 * @private
 */
Ext.define('Ext.device.browser.Abstract', {
    /**
     * Used to open a new browser window.
     *
     * When used with Cordova, a new InAppBrowser window opens. With Cordova, you also have the ability
     * to listen when the window starts loading, is finished loading, fails to load, and when it is closed.
     * You can also use the {@link #close} method to close the window, if opened.
     *
     * @param {Object} options
     * The options to use when opening a new browser window.
     *
     * @param {String} options.url
     * The URL to open.
     *
     * @param {Object} options.listeners
     * The listeners you want to add onto the window. Available events are:
     *
     * - `loadstart` - when the window starts loading the URL
     * - `loadstop` - when the window is finished loading the URL
     * - `loaderror` - when the window encounters an error loading the URL
     * - `close` - when the window is closed
     *
     * @param {Boolean} options.showToolbar
     * True to show the toolbar in the browser window.
     *
     * @param {String} options.options
     * A string of options which are used when using Cordova. For a full list of options, visit the
     * [PhoneGap documention](http://docs.phonegap.com/en/2.6.0/cordova_inappbrowser_inappbrowser.md.html#window.open).
     */
    open: Ext.emptyFn,

    /**
     * Used to close the browser, if one is opened.
     */
    close: Ext.emptyFn
});


text:
package org.ktc.soapui.maven.extension;

import static org.sonatype.aether.util.filter.DependencyFilterUtils.classpathFilter;

import com.eviware.soapui.tools.SoapUIMockAsWarGenerator;
import java.io.File;
import java.io.FilenameFilter;
import java.io.IOException;
import java.util.Collection;
import java.util.List;
import org.apache.commons.io.FileUtils;
import org.apache.maven.model.Build;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.ktc.soapui.maven.extension.impl.ProjectInfo;
import org.ktc.soapui.maven.extension.impl.RunnerType;
import org.ktc.soapui.maven.extension.impl.enums.EnumConverter;
import org.sonatype.aether.RepositorySystem;
import org.sonatype.aether.RepositorySystemSession;
import org.sonatype.aether.collection.CollectRequest;
import org.sonatype.aether.graph.Dependency;
import org.sonatype.aether.repository.RemoteRepository;
import org.sonatype.aether.resolution.ArtifactResult;
import org.sonatype.aether.resolution.DependencyRequest;
import org.sonatype.aether.resolution.DependencyResolutionException;
import org.sonatype.aether.util.artifact.DefaultArtifact;
import org.sonatype.aether.util.artifact.JavaScopes;

public class MockAsWarMojo extends AbstractSoapuiRunnerMojo {
    // for 2.2.x support, see http://docs.codehaus.org/display/MAVENUSER/Mojo+Developer+Cookbook
    // http://blog.sonatype.com/people/2011/01/how-to-use-aether-in-maven-plugins/
    // http://www.jcabi.com/jcabi-aether/

    // TODO add a default value (build.getDirectory() + "/soapui/mock-as-war/" + "maven-artifactId.war")
    private File warFile;
    // TODO add a default value (build.getDirectory() + "/soapui/mock-as-war/" + "exploded")
    private File explodedWarDirectory;

    private boolean enableWebUI;

    /**
     * The entry point to Aether, i.e. the component doing all the work.
     * @component
     */
    private RepositorySystem repoSystem;

    /**
     * The current repository/network configuration of Maven.
     * @parameter default-value="${repositorySystemSession}"
     * @readonly
     */
    private RepositorySystemSession repoSession;

    /**
     * The project's remote repositories to use for the resolution of plugins and their dependencies.
     * @parameter default-value="${project.remotePluginRepositories}"
     * @readonly
     */
    private List<RemoteRepository> remoteRepos;

    @Override
    protected void performRunnerExecute() throws MojoExecutionException, MojoFailureException {
        // List<RemoteRepository> remoteRepos = getRemoteRepos();
        getLog().info("Running Mock As War");

        RunnerType runnerTypeEnum = EnumConverter.toRunnerType(runnerType);
        // be carefull, if in the same jvm, the oss generator is used then the pro test runner, we got a class cast
        // exception when loading the project (actual type: oss project, fail to cast into a pro project)
        SoapUIMockAsWarGenerator runner = runnerTypeEnum.newMockAsWarGenerator();

        configureWithSharedParameters(runner);

        // TODO should be set to false in all runner mojo
//        runner.setEnableUI(false);
        // TODO check if this is a parameter in the abstract mojo + set by super class
//        runner.setOutputFolder(null);

        try {
            buildSoapuiGuiEnvironment();

            // TODO needed as mockaswar generator does not create subdirectories
            explodedWarDirectory.mkdirs();
            runner.setOutputFolder(explodedWarDirectory.getAbsolutePath());

            if (warFile != null) {
                // TODO needed as mockaswar generator does not create subdirectories
                warFile.getParentFile().mkdirs();
                runner.setWarFile(warFile.getAbsolutePath());
            }

            // specific configuration
             runner.setEnableWebUI(enableWebUI);
            // runner.setLocalEndpoint(null);
            // TODO related java system properties must be correctly set (add documentation)
            // WARN the mock generator does not respect properties (it used directories in the soapui.home directory)
            // runner.setIncludeActions(false);
            // runner.setIncludeLibraries(false);
            // runner.setIncludeListeners(false);

            // TODO pro feature: include scripts

            runner.run();
        } catch (Exception e) {
            getLog().debug(e);
            throw new MojoFailureException("SoapUI has errors: " + e.getMessage(), e);
        }
    }

    // TODO extend this: add a boolean parameter to specify if jars must be downloaded
    // can create the /ext and /script (pro only?) directory
    // if system properties are not set to configure the 2 directories, set them to use directories in soapui fake. This
    // will avoid warning on soapui startup
    // if the soapui.home property if already set, we should restore the initial value after the call of this mojo
    private void buildSoapuiGuiEnvironment() throws DependencyResolutionException, IOException {
        getLog().info("Building a SoapUI Gui environment");

        String version = ProjectInfo.getVersion();
        // use our plugin to be sure we do not have missing dependencies (at least for versions prior to 4.5.2)
        File soapuiLibDirectory = getBuiltSoapuiGuiLibDirectory();
        resolveAndCopyDependencies(new DefaultArtifact("com.github.redfish4ktc.soapui:maven-soapui-extension-plugin:"
                + version), soapuiLibDirectory);
        // Needed, otherwise the generator mess up
        File soapuiBinDirectory = getBuiltSoapuiGuiBinDirectory();
        copySoapuiJar(soapuiLibDirectory, soapuiBinDirectory);

        System.setProperty("soapui.home", soapuiBinDirectory.getAbsolutePath());
        getLog().info("SoapUI Gui environment built");

        // TODO check to set this java property if setting headless does not work:
        // uncomment to disable browser component
        // -Dsoapui.jxbrowser.disable="true"
    }

    private void resolveAndCopyDependencies(DefaultArtifact rootArtifact, File soapuiLibDirectory) throws DependencyResolutionException,
            IOException {
        getLog().info("Resolving artifact " + rootArtifact + " from " + remoteRepos);
        Collection<ArtifactResult> results = repoSystem.resolveDependencies(repoSession,
                newDependencyRequest(rootArtifact)).getArtifactResults();
        getLog().info("Artifact resolved with transitive dependencies: " + results.size());

        getLog().info("Copying artifacts to " + soapuiLibDirectory);
        for (ArtifactResult result : results) {
            File artifactFile = result.getArtifact().getFile();
            File ouputFile = new File(soapuiLibDirectory, artifactFile.getName());
            FileUtils.copyFile(artifactFile, ouputFile);
        }
        getLog().info("Copy done");
    }

    // highly inspired by MockAsWar#prepareWarFile
    private void copySoapuiJar(File sourceDirectory, File destinationDirectory) throws IOException {
        getLog().info("Copying soapui jar to " + destinationDirectory);
        File[] mainJars = sourceDirectory.listFiles(new FilenameFilter() {
            @Override
            public boolean accept(File dir, String name) {
                if (name.toLowerCase().startsWith("soapui") && name.toLowerCase().endsWith(".jar"))
                    return true;
                return false;
            }
        });

        if (mainJars.length == 0) {
            throw new RuntimeException("Unable to found a soapui jar in " + sourceDirectory);
        }
        File soapuiSourceJar = mainJars[0];
        FileUtils.copyFileToDirectory(soapuiSourceJar, destinationDirectory);
        getLog().info("Copy done");
    }

    private File getBuiltSoapuiGuiLibDirectory() {
        return new File(getBuiltSoapuiGuiHomeDirectory(), "lib");
    }

    private File getBuiltSoapuiGuiBinDirectory() {
        return new File(getBuiltSoapuiGuiHomeDirectory(), "bin");
    }

    private String getBuiltSoapuiGuiHomeDirectory() {
        Build build = project.getBuild();
        return build.getDirectory() + "/soapui/home";
    }

    private List<RemoteRepository> getRemoteRepos() {
        // @SuppressWarnings("unchecked")
        // List<RemoteRepository> remoteRepos = project.getPluginRepositories();
        return remoteRepos;
    }

    private DependencyRequest newDependencyRequest(DefaultArtifact artifact) {
        return new DependencyRequest(newRequest(new Dependency(artifact, JavaScopes.RUNTIME)),
                classpathFilter(JavaScopes.RUNTIME));
    }

    private CollectRequest newRequest(final Dependency root) {
        final CollectRequest request = new CollectRequest();
        request.setRoot(root);
        request.setRepositories(getRemoteRepos());
        return request;
    }

}


text:
ActiveAdmin.register Project do
  menu :priority => 8

  filter :project_pid
  filter :name
  filter :status, :as => :select, :collection => ["Live","Paused","Suspended"]
  filter :contract_id,:as => :select, :collection => Contract.all

  index do |project|
    #last_executions = ExecutionLog.get_last_executions()
    #pp last_executions
    column :name
    column :project_pid
    column :status
    column :muted do |project|
      elements = ''
      if project.muted?
        elements += image_tag('true_icon.png', :size => '28x20') + ' '
        elements += link_to 'Mutes list', admin_mutes_path('mute_ids' => project.all_mutes.map(&:id), 'commit' => 'Filter')
      else
        elements += image_tag('false_icon.png', :size => '20x20') + ' '
        elements += link_to 'Mute', new_admin_mute_path(:reference_id => project.send(Project.primary_key.to_sym), :reference_type => Project.name)
      end
      elements.html_safe
    end
    column :detail do |project|
      link_to('Detail', admin_project_detail_path(project.project_pid))
    end
    column :schedules do |project|
      links = ''.html_safe
      links += link_to "List", :controller => "schedules", :action => "index",'q[r_project_contains]' => "#{project.project_pid}".html_safe,'commit' => "Filter"
      links += " "
      links += link_to "New", :controller => "schedules", :action => "new",:project_pid =>  project.project_pid
      links
    end
    actions
  end

  form :validate => true do |f|
    f.inputs "Info" do
      if f.object.new_record?
        f.input :project_pid
      end
      f.input :name
      f.input :status, :as => :select, :collection => ["Live", "Development", "Suspended"]
      f.input :ms_person
    end
    f.inputs "Contact" do
      f.input :contract_id, :as => :select,:collection => Contract.all(:order => "name")
    end
    f.actions

  end

  show do |at|
    columns do
      column  :max_width => "350px" do
          panel ("Info") do
            attributes_table_for project do
              pp project
              [:name, :status].each do |column|
                row column
              end
              row :updated_by do |p|
                AdminUser.find(p.updated_by).email || "Unknown"
              end
            end

          end
          panel ("Contact") do
            attributes_table_for project do
              [:customer_name, :customer_contact_name, :customer_contact_email].each do |column|
                row column
              end
            end
          end

      end

      column :min_width => "750px",:min_height => "520px" do
        attributes_table do
          text_node %{<iframe frameborder="0" src="https://na1.secure.gooddata.com/dashboard.html?label.sla_project.project_pid=#{params[:id]}#project=/gdc/projects/e30u9871uuqmtqz9053bshwxw0ph6gwf&dashboard=/gdc/md/e30u9871uuqmtqz9053bshwxw0ph6gwf/obj/303014" width="100%" height="470px"></iframe>}.html_safe
        end
      end
    end
  end

  action_item :only => [:show] do
    link_to "Schedules", :controller => "schedules", :action => "index",'q[r_project_eq]' => "#{params["id"]}".html_safe
  end

  action_item :only => [:show] do
    link_to('Detail', admin_project_detail_path(params["id"]))
  end

  controller do
    include ApplicationHelper

    before_filter :only => [:index] do
      if params['commit'].blank? and params['q'].blank?
        params['q'] = {:is_deleted_eq => '0'}
      elsif !params['q'].blank?
        params['q'].merge!({:is_deleted_eq => '0'})
      end
    end

    #def resource
    #  @project = Project.where(project_pid: params[:id])
    #end

    #def new
    #  @project = Project.new(params[:project]) if (!params[:project].nil?)
    #  pp params
    #  new!
    #end

    def scoped_collection
      end_of_association_chain.with_mutes
    end

    def update
      project = Project.where("project_pid = ?",params[:id]).first
      public_attributes = Project.get_public_attributes
      pp params
      ActiveRecord::Base.transaction do
        public_attributes.each do |attr|
          if (!same?(params[:project][attr],project[attr]))
            ProjectHistory.add_change(project.project_pid,attr,params[:project][attr].to_s,current_active_admin_user)
            project[attr] = params[:project][attr]
          end
        end
        project.updated_by = current_active_admin_user.id
        project.save
      end

      redirect_to admin_project_path(params[:id])
    end

    def destroy
      project = Project.where("project_pid = ?",params[:id]).first

      ActiveRecord::Base.transaction do
        ProjectHistory.add_change(project.project_pid,"is_deleted","true",current_active_admin_user)
        project.is_deleted = true
        project.updated_by = current_active_admin_user.id
        project.save
      end
      redirect_to admin_projects_path,:notice => "Project was deleted!"
    end

    def create
      public_attributes = Project.get_public_attributes
      project = nil
      begin
        ActiveRecord::Base.transaction do
          project = Project.new()
          project.project_pid = params[:project]["project_pid"]
          project.updated_by = current_active_admin_user.id
          public_attributes.each do |attr|
            project[attr] =  params[:project][attr]
          end
          project.save!

          project_detail = ProjectDetail.new()
          project_detail.project_pid = project.project_pid
          project_detail.save!

          public_attributes.each do |attr|
            ProjectHistory.add_change(project.project_pid,attr,params[:project][attr].to_s,current_active_admin_user)
          end
        end
        #redirect_to admin_project_path(project.id),:notice => "Project was created successfully"
        redirect_to new_admin_schedule_path(:project_pid =>  project.project_pid),:notice => "Project was created successfully"
      rescue ActiveRecord::ActiveRecordError => e
        redirect_to new_admin_project_path(params),:flash => { :error => "There was error in creating project - #{e.message}" }
      end

    end

  end

end


text:
// --------------------------------------------------------------------
// crow_riot, 2013
// --------------------------------------------------------------------

#include "flashwindow.h"
#include "flashplayer.h"
#include "defines.h"
#include "../preload/drawhook.h"
#include "../preload/inputhook.h"
#include "../third_party/npapi/npfunctions.h"
#include <string.h>
#include <iostream>
#include <stdlib.h>
#include <dlfcn.h>

#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <X11/Xlib.h>

#ifndef GSEAL
#define GSEAL(x) x
#endif

#include <gtk/gtk.h>
#include <gdk/gdkx.h>
#include <gdk/gdkkeysyms.h>
#include <gdk/gdkscreen.h>
#include <gdk/gdkx.h>

using namespace std;

#ifdef _DEBUG
#define DEBUG_KEY_HANDLERS
//#define DEBUG_MOTION_HANDLERS
#define DEBUG_BUTTON_HANDLERS
#endif

static gboolean KeyHandler(GtkWidget *widget, GdkEventKey *event, gpointer user_data)
{
#ifdef _DEBUG
    DEBUG_FUNCTION_NAME
    cout << "\tkeyval=" << event->keyval << " modifier=" << event->state << " type=" << event->type << endl;
#endif

    return reinterpret_cast<FlashWindow*>(user_data)->OnKey(widget, event);
}

static gboolean KeySnooperHandler(GtkWidget* widget, GdkEventKey* event, gpointer user_data)
{
#ifdef DEBUG_KEY_HANDLERS
    DEBUG_FUNCTION_NAME
    cout << "\tkeyval=" << event->keyval << " modifier=" << event->state << " type=" << event->type << endl;
#endif

    return reinterpret_cast<FlashWindow*>(user_data)->OnKeySnooper(widget, event);
}

static void DestroyHandler( GtkWidget *widget, gpointer data )
{
    gtk_main_quit();
}

static void EventHandler(GdkEvent* event, gpointer data)
{
    reinterpret_cast<FlashWindow*>(data)->OnEvent(event);

    gtk_main_do_event(event);
}

EnableFramebufferDrawFN G_enable_framebuffer_draw = 0;

FlashWindow::FlashWindow()
    : m_MainWindow(0)
    , m_NPWindow(0)
    , m_BlankCursor(0)
    , m_PrevCursor(0)
    , m_KeyBindings(0)
    , m_Socket(0)
    , m_SrcWidth(SCREENWIDTH)
    , m_SrcHeight(SCREENHEIGHT)
    , m_TrgWidth(SCREENWIDTH)
    , m_TrgHeight(SCREENHEIGHT)
    , m_OffsetX(0)
    , m_OffsetY(0)
    , m_BlackGC(0)
    , m_LeftClickOnExpose(true)
{

}

FlashWindow::~FlashWindow()
{
    delete m_NPWindow;
}

void FlashWindow::SetDimensions(int src_width, int src_height, int trg_width, int trg_height)
{
    m_SrcWidth = src_width; m_SrcWidth += m_SrcWidth%8; //width must be divisible by 8 for fb draw to work!
    m_SrcHeight = src_height;
    m_TrgWidth = trg_width;
    m_TrgHeight = trg_height;

    if (m_TrgWidth==0 || m_TrgWidth==0)
    {
        float scale_factor = MIN(float(SCREENWIDTH)/m_SrcWidth, float(SCREENHEIGHT)/m_SrcHeight);
        m_TrgWidth = (int)(m_SrcWidth * scale_factor);
        m_TrgHeight = (int)(m_SrcHeight * scale_factor);
    }
    if (m_TrgWidth>SCREENWIDTH) m_TrgWidth = SCREENWIDTH;
    if (m_TrgHeight>SCREENHEIGHT) m_TrgHeight = SCREENHEIGHT;

    m_OffsetX = SCREENWIDTH/2 - m_TrgWidth/2;
    m_OffsetY = SCREENHEIGHT/2 - m_TrgHeight/2;
}

void FlashWindow::SetKeyMap(const KeyMapGdk& key_map)
{
    m_KeyMap = key_map;
}

void FlashWindow::SetPlayer(FlashPlayer* player)
{
    m_Player = player;
}

bool FlashWindow::InitializeNPWindow()
{
    m_MainWindow = gtk_window_new(GTK_WINDOW_TOPLEVEL);

    gdk_event_handler_set(EventHandler,this,NULL);

    gtk_key_snooper_install(KeySnooperHandler, this);

    gtk_widget_set_usize(m_MainWindow,SCREENWIDTH,SCREENHEIGHT);

    gtk_widget_realize(m_MainWindow);

    gtk_window_fullscreen((GtkWindow*)m_MainWindow);

    m_BlackGC = m_MainWindow->style->black_gc;

    m_Socket = gtk_socket_new();

    gtk_widget_set_usize(m_Socket, m_SrcWidth, m_SrcHeight);

    // m_ScrollWindow = gtk_scrolled_window_new (NULL, NULL);
    // gtk_container_add (GTK_CONTAINER(m_MainWindow), m_ScrollWindow);
    // gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(m_ScrollWindow),GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC);
    // gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(m_ScrollWindow), m_Socket);

    gtk_container_add(GTK_CONTAINER(m_MainWindow),m_Socket);

    gtk_widget_realize(m_Socket);

    g_signal_connect(G_OBJECT(m_MainWindow), "key-press-event", G_CALLBACK(KeyHandler), this);
    g_signal_connect(G_OBJECT(m_MainWindow), "key-release-event", G_CALLBACK(KeyHandler), this);
    g_signal_connect(G_OBJECT(m_MainWindow), "destroy", G_CALLBACK(DestroyHandler), NULL);

    g_signal_connect(m_Socket, "destroy", G_CALLBACK(gtk_widget_destroyed), &m_Socket);

    GdkNativeWindow ww = gtk_socket_get_id(GTK_SOCKET(m_Socket));
    GdkWindow *w = gdk_window_lookup(ww);

    m_NPWindow = new NPWindow;
    memset(m_NPWindow,0,sizeof(NPWindow));

    m_NPWindow->window = (void*)(unsigned long)ww;
    m_NPWindow->x = 0;
    m_NPWindow->y = 0;
    m_NPWindow->width = m_SrcWidth;
    m_NPWindow->height = m_SrcHeight;

    NPSetWindowCallbackStruct* ws_info = new NPSetWindowCallbackStruct;
    ws_info->type = NP_SETWINDOW;
    ws_info->display = GDK_WINDOW_XDISPLAY(w);
    ws_info->colormap = GDK_COLORMAP_XCOLORMAP(gdk_drawable_get_colormap(w));

    GdkVisual* gdkVisual = gdk_drawable_get_visual(w);
    ws_info->visual = GDK_VISUAL_XVISUAL(gdkVisual);
    ws_info->depth = gdkVisual->bits_per_rgb;

    m_NPWindow->ws_info = ws_info;
    m_NPWindow->type = NPWindowTypeWindow;

    GdkColor black = {0,0,0,0};
    for (int state=0; state<=GTK_STATE_INSENSITIVE; ++state)
    {
        gtk_widget_modify_bg(m_MainWindow, (GtkStateType)state, &black);
        gtk_widget_modify_bg(m_Socket, (GtkStateType)state, &black);
    }

    SetupFramebuffer();

    return true;
}

void FlashWindow::Show()
{
    gtk_widget_show_all(m_MainWindow);
}

void FlashWindow::Step()
{
    gtk_main_iteration_do(false);
}

void FlashWindow::RunLoop()
{
    gtk_main();

    RestoreFramebuffer();
}

unsigned long FlashWindow::GetMainWindowXID() const
{
    return GDK_WINDOW_XWINDOW(m_MainWindow->window);
}

bool FlashWindow::OnKey(_GtkWidget* widget, _GdkEventKey* event)
{
    switch(event->keyval)
    {
    case GDK_q:
    case GDK_Q:
        if (event->type==GDK_KEY_PRESS && event->state & GDK_CONTROL_MASK)
        {
            gtk_main_quit();
            return 1;
        }
        break;
    case GDK_m:
    case GDK_M:
        if (event->type==GDK_KEY_PRESS && event->state & GDK_CONTROL_MASK)
        {
            if (m_BlankCursor==NULL)
                m_BlankCursor = gdk_cursor_new(GDK_BLANK_CURSOR);

            if (gdk_window_get_cursor(widget->window)!=m_BlankCursor)
            {
                m_PrevCursor = gdk_window_get_cursor(widget->window);
                gdk_window_set_cursor(widget->window,m_BlankCursor);
            }
            else
                gdk_window_set_cursor(widget->window,m_PrevCursor);

            return 1;
        }
        break;

    }
    return 0;
}

/// modified code from
/// https://git.gnome.org/browse/gtk+/plain/gdk/x11/gdktestutils-x11.c
/// _gdk_x11_window_simulate_key
gboolean CreateKeyEvent(GdkWindow *window,
                        int x,
                        int y,
                        guint keyval,
                        GdkModifierType modifiers,
                        GdkEventType    key_pressrelease,
                        XKeyEvent& xev)
{

    GdkScreen *screen;
    GdkKeymapKey *keys = NULL;
    gboolean success;
    gint n_keys = 0;

    screen = gdk_screen_get_default();

    xev.serial = 0;
    xev.send_event = 1;
    xev.type = key_pressrelease == GDK_KEY_PRESS ? KeyPress : KeyRelease;
    xev.display = GDK_WINDOW_XDISPLAY (window);
    xev.window = GDK_WINDOW_XID (window);
    xev.root = RootWindow (xev.display, GDK_SCREEN_XNUMBER(screen));
    xev.subwindow = 0;
    xev.time = 0;
    xev.x = MAX (x, 0);
    xev.y = MAX (y, 0);
    xev.x_root = 0;
    xev.y_root = 0;
    xev.state = modifiers;
    xev.keycode = 0;
    xev.same_screen = 1;
    success = gdk_keymap_get_entries_for_keyval( gdk_keymap_get_for_display(gdk_display_get_default()) , keyval, &keys, &n_keys);
    success &= n_keys > 0;
    if (success)
    {
        gint i;
        for (i = 0; i < n_keys; i++)
        {
            if (keys[i].group == 0 && (keys[i].level == 0 || keys[i].level == 1))
            {
                xev.keycode = keys[i].keycode;
                if (keys[i].level == 1)
                {
                    /* Assume shift takes us to level 1 */
                    xev.state |= GDK_SHIFT_MASK;
                }
                break;
            }
        }
        if (i >= n_keys) /* no match for group==0 and level==0 or 1 */
            xev.keycode = keys[0].keycode;
    }

    g_free (keys);

    return success;
}

bool FlashWindow::OnKeySnooper(_GtkWidget* widget, _GdkEventKey* event)
{
    if (widget == m_MainWindow && (event->type==GDK_KEY_PRESS || event->type==GDK_KEY_RELEASE) && IsPandoraKey(event->keyval))
    {
        KeyMapGdk::iterator it = m_KeyMap.find(event->keyval);
        if (it!=m_KeyMap.end())
        {

            GdkDisplay* display = gdk_display_get_default ();
            gint x=0,y=0;
            gdk_display_get_pointer (display, NULL, &x, &y, NULL);

            const vector<SimpleKey>& target_keys = it->second;
            for (size_t k=0; k<target_keys.size();  ++k)
            {
                const SimpleKey& sim_key = target_keys[k];

                XKeyEvent key_event;
                CreateKeyEvent(widget->window, x, y, sim_key.keyval, sim_key.modifier, event->type, key_event);
                m_Player->SendEvent(&key_event);

            }
            return 1;
        }
    }

    return 0;
}

void FlashWindow::OnEvent(_GdkEvent* event)
{
    if (event->type==GDK_BUTTON_PRESS || event->type==GDK_BUTTON_RELEASE)
    {
        event->button.x -= m_OffsetX; event->button.x *= m_SrcWidth; event->button.x /= m_TrgWidth;
        event->button.y -= m_OffsetY; event->button.y *= m_SrcHeight; event->button.y /= m_TrgHeight;
    }
    else
    if (event->type==GDK_MOTION_NOTIFY)
    {
        event->motion.x -= m_OffsetX; event->motion.x *= m_SrcWidth; event->motion.x /= m_TrgWidth;
        event->motion.y -= m_OffsetY; event->motion.y *= m_SrcHeight; event->motion.y /= m_TrgHeight;
    }
    else
    if (event->type==GDK_EXPOSE)
    {
        if (m_LeftClickOnExpose)
        {
            SimulateLeftClick(0,0);
            m_LeftClickOnExpose=false;
        }

        gdk_draw_rectangle(event->expose.window,
                           m_BlackGC,
                           true,
                           event->expose.area.x,
                           event->expose.area.y,
                           event->expose.area.width,
                           event->expose.area.height);
    }
}

void FlashWindow::SetupFramebuffer()
{
    G_enable_framebuffer_draw =
            (EnableFramebufferDrawFN)(dlsym(dlopen(DRAWHOOK_LIBRARY_NAME,RTLD_LAZY),ENABLEFRAMEBUFFERDRAW_FUNCTION_NAME));

    SetPointerChangeFN set_pointer_change =
        (SetPointerChangeFN)(dlsym(dlopen(INPUTHOOK_LIBRARY_NAME,RTLD_LAZY),SETPOINTERCHANGE_FUNCTION_NAME));

    if (m_SrcWidth!=m_TrgWidth || m_SrcHeight!=m_TrgHeight)
    {
        if (G_enable_framebuffer_draw) (*G_enable_framebuffer_draw)(1);

        //# ofbset -fb /dev/fb1 -pos 0 0 -size 800 480 -mem 192000 -en 1
        //# fbset -fb /dev/fb1 -g 400 240 400 240 16

        int pages = FB_PAGES;
        int bpp = 16;
        int mem = pages*m_SrcWidth*m_SrcHeight*bpp/8;

        char ofbset[PATH_MAX];
        sprintf(ofbset,"ofbset -fb /dev/fb1 -pos %d %d -size %d %d -mem %d -en 1", m_OffsetX, m_OffsetY, m_TrgWidth, m_TrgHeight, mem);
        char fbset[PATH_MAX];
        sprintf(fbset,"fbset -fb /dev/fb1 -g %d %d %d %d %d", m_SrcWidth, m_SrcHeight, m_SrcWidth, m_SrcHeight*pages, bpp);

        system(ofbset);
        system(fbset);

        PointerChange change;
        change.off_x = m_OffsetX;
        change.mul_x = m_SrcWidth;
        change.div_x = m_TrgWidth;

        change.off_y = m_OffsetY;
        change.mul_y = m_SrcHeight;
        change.div_y = m_TrgHeight;

        if (set_pointer_change) (*set_pointer_change)(change);
    }
    else
    {
        if (G_enable_framebuffer_draw) (*G_enable_framebuffer_draw)(0);
    }
}

void FlashWindow::RestoreFramebuffer()
{
    if (m_SrcWidth!=m_TrgWidth || m_SrcHeight!=m_TrgHeight)
    {
        if (G_enable_framebuffer_draw) (*G_enable_framebuffer_draw)(0);

        system("ofbset -fb /dev/fb1 -pos 0 0 -size 0 0 -mem 0 -en 0");
    }
}

void FlashWindow::CenterMouseCursor()
{
    Display* display = GDK_WINDOW_XDISPLAY(m_MainWindow->window);
    Window xwindow = GDK_WINDOW_XWINDOW(m_MainWindow->window);
    XWarpPointer(display,None,xwindow,0,0,0,0,SCREENWIDTH/2,SCREENHEIGHT/2);
}

void FlashWindow::SimulateLeftClick(int x, int y)
{
    Display* display = GDK_WINDOW_XDISPLAY(m_MainWindow->window);
    Window xwindow = GDK_WINDOW_XWINDOW(m_MainWindow->window);
    XEvent event;
    memset(&event,0,sizeof(XEvent));

    event.type = ButtonPress;
    event.xbutton.window = xwindow;
    event.xbutton.same_screen = true;
    event.xbutton.button = 1;
    event.xbutton.root = RootWindow(display,DefaultScreen(display));
    event.xbutton.x_root = x;
    event.xbutton.y_root = y;
    event.xbutton.x = x;
    event.xbutton.y = y;

    XSendEvent(display, xwindow, True, ButtonPressMask, &event);

    XFlush(display);

    usleep(100);

    event.type = ButtonRelease;

    XSendEvent(display, xwindow, True, ButtonReleaseMask, &event);

    XFlush(display);
}


text:
package org.elasticsearch.search.suggest.completion;

import org.elasticsearch.common.io.stream.BytesStreamOutput;
import org.elasticsearch.common.io.stream.NamedWriteableAwareStreamInput;
import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.Writeable;
import org.elasticsearch.test.ESTestCase;

import java.io.IOException;
import java.util.Collections;

import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.not;

/**
 * Base class for testing serialization and equality for
 * {@link Writeable} models
 */
public abstract class WritableTestCase<M extends Writeable> extends ESTestCase {

    protected static final int NUMBER_OF_RUNS = 20;

    /**
     * create random model that is put under test
     */
    protected abstract M createTestModel();

    /**
     * mutate the given model so the returned model is different
     */
    protected abstract M createMutation(M original) throws IOException;

    /**
     * Read from a stream.
     */
    protected abstract M readFrom(StreamInput in) throws IOException;

    /**
     * Test serialization and deserialization of the tested model.
     */
    public void testSerialization() throws IOException {
        for (int i = 0; i < NUMBER_OF_RUNS; i++) {
            M testModel = createTestModel();
            M deserializedModel = copyModel(testModel);
            assertEquals(testModel, deserializedModel);
            assertEquals(testModel.hashCode(), deserializedModel.hashCode());
            assertNotSame(testModel, deserializedModel);
        }
    }

    /**
     * Test equality and hashCode properties
     */
    @SuppressWarnings("unchecked")
    public void testEqualsAndHashcode() throws IOException {
        M firstModel = createTestModel();
        String modelName = firstModel.getClass().getSimpleName();
        assertFalse(modelName + " is equal to null", firstModel.equals(null));
        assertFalse(modelName + " is equal to incompatible type", firstModel.equals(""));
        assertTrue(modelName + " is not equal to self", firstModel.equals(firstModel));
        assertThat("same "+ modelName + "'s hashcode returns different values if called multiple times", firstModel.hashCode(),
                equalTo(firstModel.hashCode()));
        assertThat("different " + modelName + " should not be equal", createMutation(firstModel), not(equalTo(firstModel)));

        M secondModel = copyModel(firstModel);
        assertTrue(modelName + " is not equal to self", secondModel.equals(secondModel));
        assertTrue(modelName + " is not equal to its copy", firstModel.equals(secondModel));
        assertTrue("equals is not symmetric", secondModel.equals(firstModel));
        assertThat(modelName + " copy's hashcode is different from original hashcode", secondModel.hashCode(),
                equalTo(firstModel.hashCode()));

        M thirdModel = copyModel(secondModel);
        assertTrue(modelName + " is not equal to self", thirdModel.equals(thirdModel));
        assertTrue(modelName + " is not equal to its copy", secondModel.equals(thirdModel));
        assertThat(modelName + " copy's hashcode is different from original hashcode", secondModel.hashCode(),
                equalTo(thirdModel.hashCode()));
        assertTrue("equals is not transitive", firstModel.equals(thirdModel));
        assertThat(modelName + " copy's hashcode is different from original hashcode", firstModel.hashCode(),
                equalTo(thirdModel.hashCode()));
        assertTrue(modelName + " equals is not symmetric", thirdModel.equals(secondModel));
        assertTrue(modelName + " equals is not symmetric", thirdModel.equals(firstModel));
    }

    private M copyModel(M original) throws IOException {
        try (BytesStreamOutput output = new BytesStreamOutput()) {
            original.writeTo(output);
            try (StreamInput in = new NamedWriteableAwareStreamInput(output.bytes().streamInput(), provideNamedWritableRegistry())) {
                return readFrom(in);
            }
        }
    }

    protected NamedWriteableRegistry provideNamedWritableRegistry() {
        return new NamedWriteableRegistry(Collections.emptyList());
    }
}


text:
	<title>Burt's Books – Book Detail</title>

	<link rel="stylesheet" href="{{ static_url("stylesheets/main.css") }}">
<link rel="stylesheet" href="{{ static_url("stylesheets/bootstrap.min.css") }}">

Burt's Books

The Definitive Guide to the Internet

			Anonymous

		<input type="hidden" id="session" value="{{ session }}" />

Only {{ count }}
				left in stock! Order now!

$20.00 <input type="submit" value="Add to Cart" id="add-button" />

One copy is in your cart.

<input type="submit" value="Remove from Cart" id="remove-button" />


text:
@interface PodsDummy_JXSegmentedView : NSObject
@end
@implementation PodsDummy_JXSegmentedView
@end


text:
package gotumblr

import "encoding/json"

type PostsResponse struct {
	Blog  BlogInfo
	Posts []json.RawMessage
	Total_posts int64
}


text:
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Xml;
using System.Xml.Linq;
using Palaso.Code;
using Palaso.IO;
using Palaso.Xml;

namespace Palaso.Lift
{
	/// <summary>
	/// <para>Given a lift or lift ranges pathname, sort it and write it back to the same file.</para>
	///
	/// <para>Sorting will include all attributes of all elements and any elements where the Lift specification allows for no ordering.
	/// Where possible, element names will be used for the ordering, but at times one or more attribute values will help.
	/// For instance, entry elements will be sorted by their guid attribute values. When the Lift specification does not allow for
	/// such sorting (e.g., sense elements) the order of that group of child elements will be retained, even though that group may be reordered,
	/// as a block among other sibling elements.</para>
	///
	/// <para>Besides being sorted, the resulting file will use the canonical xml writer settings defined elsewhere.
	/// The resulting file ought to make life easier for programs, such as Mercurial,
	/// as well as for humans who want to compare two, or more, versions of lift files.</para>
	/// </summary>
	public static class LiftSorter
	{
		private static readonly Encoding Utf8 = Encoding.UTF8;

		public static void SortLiftFile(string liftPathname)
		{
			Guard.AgainstNullOrEmptyString(liftPathname, "liftPathname");
			Guard.Against(Path.GetExtension(liftPathname).ToLowerInvariant() != ".lift", "Unexpected file extension");
			Guard.Against<FileNotFoundException>(!File.Exists(liftPathname), "Lift file does not exist.");

			using (var tempFile = new TempFile(File.ReadAllText(liftPathname), Utf8))
			{
				var sortedRootAttributes = SortRootElementAttributes(tempFile.Path);
				var sortedEntries = new SortedDictionary<string, XElement>(StringComparer.InvariantCultureIgnoreCase);
				XElement header = null;
				using (var splitter = new FastXmlElementSplitter(tempFile.Path))
				{
					bool hasHeader;
					foreach (var record in splitter.GetSecondLevelElementStrings("header", "entry", out hasHeader))
					{
						var element = XElement.Parse(record);
						SortAttributes(element);

						if (hasHeader)
						{
							hasHeader = false;
							header = element;
							SortHeader(header);
						}
						else
						{
							var guidKey = element.Attribute("guid").Value.ToLowerInvariant();
							if (!sortedEntries.ContainsKey(guidKey))
							{
								SortEntry(element);
								sortedEntries.Add(GetUniqueKey(sortedEntries.Keys, guidKey), element);
							}
						}
					}
				}

				using (var writer = XmlWriter.Create(tempFile.Path, CanonicalXmlSettings.CreateXmlWriterSettings()))
				{
					writer.WriteStartDocument();
					writer.WriteStartElement("lift");

					foreach (var rootAttributeKvp in sortedRootAttributes)
					{
						writer.WriteAttributeString(rootAttributeKvp.Key, rootAttributeKvp.Value);
					}

					if (header != null)
					{
						WriteElement(writer, header);
					}

					foreach (var entryElement in sortedEntries.Values)
					{
						WriteElement(writer, entryElement);
					}

					writer.WriteEndElement();
					writer.WriteEndDocument();
				}
				File.Copy(tempFile.Path, liftPathname, true);
			}
		}

		public static void SortLiftRangesFile(string liftRangesPathname)
		{
			Guard.AgainstNullOrEmptyString(liftRangesPathname, "liftRangesPathname");
			Guard.Against(Path.GetExtension(liftRangesPathname).ToLowerInvariant() != ".lift-ranges", "Unexpected file extension");
			Guard.Against<FileNotFoundException>(!File.Exists(liftRangesPathname), "Lift range file does not exist.");

			using (var tempFile = new TempFile(File.ReadAllText(liftRangesPathname), Utf8))
			{
				var sortedRootAttributes = SortRootElementAttributes(tempFile.Path);

				var doc = XDocument.Load(liftRangesPathname);
				SortAttributes(doc.Root);
				SortRanges(doc.Root);

				using (var writer = XmlWriter.Create(tempFile.Path, CanonicalXmlSettings.CreateXmlWriterSettings()))
				{
					writer.WriteStartDocument();
					writer.WriteStartElement(doc.Root.Name.LocalName);

					foreach (var rootAttributeKvp in sortedRootAttributes)
					{
						writer.WriteAttributeString(rootAttributeKvp.Key, rootAttributeKvp.Value);
					}

					foreach (var rangeElement in doc.Root.Elements())
					{
						WriteElement(writer, rangeElement);
					}

					writer.WriteEndElement();
					writer.WriteEndDocument();
				}

				File.Copy(tempFile.Path, liftRangesPathname, true);
			}
		}

		/// <summary>
		/// Return a set of the names of those elements in LIFT were we must not indent each child on a separate line.
		/// This is basically the elements which can contain both text and elements as children.
		/// In particular we must know about any parent where it is possible all children are elements, but where
		/// additional white space is significant.
		/// </summary>
		public static HashSet<string> LiftSuppressIndentingChildren
		{
			get
			{
				var result = new HashSet<string>();
				result.Add("text");
				result.Add("span");
				return result;
			}
		}

		private static void SortRange(XElement rangeElement)
		{
			var sortedChildRanges = new SortedDictionary<string, XElement>(StringComparer.InvariantCultureIgnoreCase);
			foreach (var childRangeElement in rangeElement.Elements("range-element").ToList())
			{
				SortBasicsOfRangeElement(childRangeElement);
				sortedChildRanges.Add(GetUniqueKey(sortedChildRanges.Keys, childRangeElement.Attribute("id").Value), childRangeElement);
				childRangeElement.Remove();
			}

			SortBasicsOfRangeElement(rangeElement);

			foreach (var childRangeElement in sortedChildRanges.Values)
			{
				rangeElement.Add(childRangeElement);
			}
		}

		private static void SortBasicsOfRangeElement(XElement rangeElement)
		{
			var description = rangeElement.Element("description");
			if (description != null)
			{
				SortMultiformElement(description);
				description.Remove();
			}
			var label = rangeElement.Element("label");
			if (label != null)
			{
				SortMultiformElement(label);
				label.Remove();
			}
			var abbrev = rangeElement.Element("abbrev");
			if (abbrev != null)
			{
				SortMultiformElement(abbrev);
				abbrev.Remove();
			}
			var leftovers = rangeElement.Elements().ToList();

			rangeElement.RemoveNodes();

			if (description != null)
				rangeElement.Add(description);
			if (label != null)
				rangeElement.Add(label);
			if (abbrev != null)
				rangeElement.Add(abbrev);
			foreach (var leftover in leftovers)
			{
				rangeElement.Add(leftover);
			}
		}

		private static void WriteElement(XmlWriter writer, XElement element)
		{
			XmlUtils.WriteNode(writer, element, LiftSuppressIndentingChildren);
		}

		private static void WriteElement(XmlWriter writer, string element)
		{
			XmlUtils.WriteNode(writer, element, LiftSuppressIndentingChildren);
		}

		private static void WriteElement(XmlWriter writer, byte[] element)
		{
			WriteElement(writer, Encoding.UTF8.GetString(element));
		}

		private static SortedDictionary<string, string> SortRootElementAttributes(string pathname)
		{
			var sortedRootAttributes = new SortedDictionary<string, string>(StringComparer.InvariantCultureIgnoreCase);
			using (var tempReader = XmlReader.Create(pathname, CanonicalXmlSettings.CreateXmlReaderSettings()))
			{
				tempReader.MoveToContent();
				for (var i = 0; i < tempReader.AttributeCount; ++i)
				{
					tempReader.MoveToAttribute(i);
					sortedRootAttributes.Add(GetUniqueKey(sortedRootAttributes.Keys, tempReader.LocalName), tempReader.Value);
				}
			}
			return sortedRootAttributes;
		}

		private static void SortHeader(XElement header)
		{
			// Has three optional elements: description, ranges, and fields.
			// Put them in this order, if present: description, ranges, and fields.
			var description = header.Element("description");
			if (description != null)
			{
				description.Remove();
			}
			var ranges = header.Element("ranges");
			if (ranges != null)
			{
				ranges.Remove();
			}
			var fields = header.Element("fields");
			if (fields != null)
			{
				fields.Remove();
			}
			var leftovers = header.Elements().ToList();

			header.RemoveNodes();

			if (description != null)
			{
				SortMultiformElement(description);
				header.Add(description);
			}
			if (ranges != null)
			{
				SortRanges(ranges);
				header.Add(ranges);
			}
			if (fields != null)
			{
				var sortedFields = SortFields(fields, "tag");
				header.Add(fields);
				foreach (var field in sortedFields.Values)
				{
					fields.Add(field);
				}
			}

			foreach (var leftover in leftovers)
			{
				header.Add(leftover);
			}
		}

		private static void SortRanges(XElement rangesParent)
		{
			if (!rangesParent.HasElements)
				return;

			// Optional, multiple <range> elements. Unordered. Key attr: id
			var sortedRanges = new SortedDictionary<string, XElement>(StringComparer.InvariantCultureIgnoreCase);
			foreach (var rangeElement in rangesParent.Elements("range").ToList())
			{
				SortRange(rangeElement);
				sortedRanges.Add(GetUniqueKey(sortedRanges.Keys, rangeElement.Attribute("id").Value), rangeElement);
				rangeElement.Remove();
			}
			var leftovers = rangesParent.Elements().ToList();

			rangesParent.RemoveNodes();

			foreach (var rangeElement in sortedRanges.Values)
			{
				rangesParent.Add(rangeElement);
			}
			foreach (var leftover in leftovers)
			{
				rangesParent.Add(leftover);
			}
		}

		private static SortedDictionary<string, XElement> SortFields(XElement fieldsParent, string keyFieldAttribute)
		{
			var sortedFields = new SortedDictionary<string, XElement>(StringComparer.InvariantCultureIgnoreCase);

			if (!fieldsParent.HasElements)
				return sortedFields;

			// Optional, multiple <field> elements. Unordered. Key attr: tag
			foreach (var fieldElement in fieldsParent.Elements("field").ToList())
			{
				var sortedForms = SortMultiformElementCore(fieldElement);
				var sortedExtensibleSansFields = SortExtensibleSansField(fieldElement);

				sortedFields.Add(GetUniqueKey(sortedFields.Keys, fieldElement.Attribute(keyFieldAttribute).Value), fieldElement);

				fieldElement.Remove();

				foreach (var form in sortedForms.Values)
				{
					fieldElement.Add(form);
				}
				RestoreSortedExtensibles(sortedExtensibleSansFields, fieldElement);
			}

			return sortedFields;
		}

		private static void SortEntry(XElement entry)
		{
			var lexicalUnit = entry.Element("lexical-unit");
			if (lexicalUnit != null)
			{
				SortMultiformElement(lexicalUnit);
				lexicalUnit.Remove();
			}
			var citation = entry.Element("citation");
			if (citation != null)
			{
				SortMultiformElement(citation);
				citation.Remove();
			}

			var pronunciations = SortPronunciations(entry);
			var variants = SortVariantContents(entry);
			var sensesInFileOrder = SortSenseContent(entry, "sense");
			var sortedEtymologies = SortedEtymologies(entry);
			var notes = SortedNotes(entry);
			var sortedRelations = SortedRelations(entry);
			var sortedExtensibles = SortExtensibleWithField(entry);
			var leftovers = entry.Elements().ToList();

			entry.RemoveNodes();

			if (lexicalUnit != null)
				entry.Add(lexicalUnit);
			if (citation != null)
				entry.Add(citation);
			foreach (var pronunciation in pronunciations)
				entry.Add(pronunciation);
			foreach (var variant in variants)
				entry.Add(variant);
			foreach (var sense in sensesInFileOrder)
				entry.Add(sense);
			foreach (var note in notes.Values)
				entry.Add(note);
			foreach (var relation in sortedRelations.Values)
				entry.Add(relation);
			foreach (var etymology in sortedEtymologies.Values)
				entry.Add(etymology);
			RestoreSortedExtensibles(sortedExtensibles, entry);
			foreach (var leftover in leftovers)
				entry.Add(leftover);
		}

		private static SortedDictionary<string, XElement> SortedNotes(XElement notesParent)
		{
			var sortedNotes = new SortedDictionary<string, XElement>(StringComparer.InvariantCultureIgnoreCase);
			var fakeKeyPart = 1;
			var tempGuid = Guid.NewGuid();
			foreach (var note in notesParent.Elements("note").ToList())
			{
				var sortedForms = SortMultiformElementCore(note);
				var typeAttr = note.Attribute("type");
				var key = typeAttr == null ? "@@@@@@" + tempGuid.ToString() + fakeKeyPart : typeAttr.Value;
				sortedNotes.Add(GetUniqueKey(sortedNotes.Keys, key), note);
				if (typeAttr == null)
					fakeKeyPart++;

				var sortedExtensibles = SortExtensibleWithField(note);

				note.Remove();

				foreach (var form in sortedForms.Values)
				{
					note.Add(form);
				}
				RestoreSortedExtensibles(sortedExtensibles, note);
			}
			return sortedNotes;
		}

		private static SortedDictionary<string, XElement> SortedEtymologies(XElement entry)
		{
			var sortedEtymologies = new SortedDictionary<string, XElement>(StringComparer.InvariantCultureIgnoreCase);

			foreach (var etymology in entry.Elements("etymology").ToList())
			{
				var sortedForms = SortMultiformElementCore(etymology);
				var sortedGlosses = new SortedDictionary<string, XElement>();
				foreach (var gloss in etymology.Elements("gloss").ToList())
				{
					sortedGlosses.Add(GetUniqueKey(sortedGlosses.Keys, gloss.Attribute("lang").Value), gloss);
					gloss.Remove();
				}
				var sortedExtensibles = SortExtensibleWithField(etymology);

				sortedEtymologies.Add(GetUniqueKey(sortedEtymologies.Keys, etymology.Attribute("source").Value + etymology.Attribute("type").Value), etymology);
				etymology.Remove();

				foreach (var form in sortedForms.Values)
				{
					etymology.Add(form);
				}
				foreach (var gloss in sortedGlosses.Values)
				{
					etymology.Add(gloss);
				}
				RestoreSortedExtensibles(sortedExtensibles, etymology);
			}
			return sortedEtymologies;
		}

		private static SortedDictionary<string, XElement> SortedRelations(XElement relationParent)
		{
			var sortedRelations = new SortedDictionary<string, XElement>(StringComparer.InvariantCultureIgnoreCase);
			var relations = relationParent.Elements("relation").ToList();
			foreach (var relation in relations)
			{
				var usage = relation.Element("usage");
				if (usage != null)
				{
					SortMultiformElement(usage);
					usage.Remove();
				}
				var sortedExtensible = SortExtensibleWithField(relation);
				sortedRelations.Add(GetUniqueKey(sortedRelations.Keys, relation.Attribute("ref").Value + relation.Attribute("type").Value), relation);

				relation.Remove();

				RestoreSortedExtensibles(sortedExtensible, relation);
				if (usage != null)
				{
					relation.Add(usage);
				}
			}
			return sortedRelations;
		}

		private static IEnumerable<XElement> SortVariantContents(XElement entry)
		{
			var variants = entry.Elements("variant").ToList();
			foreach (var variant in variants)
			{
				var sortedForms = SortMultiformElementCore(variant);
				var sortedExtensible = SortExtensibleWithField(variant);
				var sortedPronunciations = SortPronunciations(variant);
				var sortedRelations = SortedRelations(variant);

				variant.Remove();

				foreach (var form in sortedForms.Values)
				{
					variant.Add(form);
				}
				RestoreSortedExtensibles(sortedExtensible, variant);
				foreach (var pronunciation in sortedPronunciations)
				{
					variant.Add(pronunciation);
				}
				foreach (var relation in sortedRelations.Values)
				{
					variant.Add(relation);
				}
			}
			return variants;
		}

		private static IEnumerable<XElement> SortPronunciations(XElement entry)
		{
			/*
		  <ref name="multitext-content"/>
		  <ref name="extensible-content"/>
		  <zeroOrMore>
			<element name="media">
			  <ref name="URLRef-content"/>
			</element>
		  </zeroOrMore>
			*/
			var pronunciations = entry.Elements("pronunciation").ToList();
			foreach (var pronunciation in pronunciations)
			{
				var sortedForms = SortMultiformElementCore(pronunciation);
				var sortedExtensible = SortExtensibleWithField(pronunciation);
				var sortedMedia = SortedMedia(pronunciation);

				pronunciation.Remove();

				foreach (var form in sortedForms.Values)
				{
					pronunciation.Add(form);
				}
				RestoreSortedExtensibles(sortedExtensible, pronunciation);
				foreach (var media in sortedMedia.Values)
				{
					pronunciation.Add(media);
				}
			}
			return pronunciations;
		}

		private static void RestoreSortedExtensibles(Dictionary<string, SortedDictionary<string, XElement>> sortedExtensible, XElement parent)
		{
			var current = sortedExtensible["annotations"];
			foreach (var annotation in current.Values)
			{
				parent.Add(annotation);
			}

			current = sortedExtensible["traits"];
			foreach (var trait in current.Values)
			{
				parent.Add(trait);
			}

			if (!sortedExtensible.TryGetValue("fields", out current))
				return;

			foreach (var field in current.Values)
			{
				parent.Add(field);
			}
		}

		private static SortedDictionary<string, XElement> SortedMedia(XElement mediaParent)
		{
			var sortedMedia = new SortedDictionary<string, XElement>();

			foreach (var media in mediaParent.Elements("media").ToList())
			{
				var label = media.Element("label");
				if (label != null)
				{
					var sortedForms = SortMultiformElementCore(label);

					foreach (var form in sortedForms.Values)
					{
						label.Add(form);
					}
				}
				sortedMedia.Add(GetUniqueKey(sortedMedia.Keys, media.Attribute("href").Value), media);
				media.Remove();
			}

			return sortedMedia;
		}

		private static IEnumerable<XElement> SortSenseContent(XElement senseParent, string senseElementName)
		{
			var sensesInFileOrder = senseParent.Elements(senseElementName).ToList();

			foreach (var sense in sensesInFileOrder)
			{
				var definition = sense.Element("definition");
				if (definition != null)
				{
					SortMultiformElement(definition);
					definition.Remove();
				}
				var sortedGlosses = new SortedDictionary<string, XElement>(StringComparer.InvariantCultureIgnoreCase);
				var glosses = sense.Elements("gloss").ToList();
				foreach (var gloss in glosses)
				{
					var form = gloss.Element("form");
					if (form != null)
						SortFormContent(form);
					sortedGlosses.Add(GetUniqueKey(sortedGlosses.Keys, gloss.Attribute("lang").Value), gloss);
					gloss.Remove();
				}
				var grammaticalInfo = SortGrammaticalInfoContent(sense);
				var examples = SortedExamplesContents(sense);
				var reversals = SortedReversals(sense);
				var subsenses = SortSenseContent(sense, "subsense");
				var sortedRelations = SortedRelations(sense);
				var sortedIllustrations = SortedIllustrations(sense);
				var sortedNotes = SortedNotes(sense);
				var sortedExtensible = SortExtensibleWithField(sense);
				var leftovers = sense.Elements().ToList();

				sense.RemoveNodes();

				if (definition != null)
					sense.Add(definition);
				foreach (var gloss in sortedGlosses.Values)
					sense.Add(gloss);
				if (grammaticalInfo != null)
					sense.Add(grammaticalInfo);
				foreach (var example in examples)
					sense.Add(example);
				foreach (var reversal in reversals.Values)
					sense.Add(reversal);
				foreach (var subsense in subsenses)
					sense.Add(subsense);
				foreach (var relation in sortedRelations.Values)
					sense.Add(relation);
				foreach (var illustration in sortedIllustrations.Values)
					sense.Add(illustration);
				foreach (var note in sortedNotes.Values)
					sense.Add(note);
				RestoreSortedExtensibles(sortedExtensible, sense);
				foreach (var leftover in leftovers)
					sense.Add(leftover);
				sense.Remove();
			}
			return sensesInFileOrder;
		}

		private static SortedDictionary<string, XElement> SortedIllustrations(XElement sense)
		{
			var sortedIllustrations = new SortedDictionary<string, XElement>(StringComparer.InvariantCultureIgnoreCase);
			var illustrations = sense.Elements("illustration").ToList();
			foreach (var illustration in illustrations)
			{
				var label = illustration.Element("label");
				if (label != null)
					SortMultiformElement(label);
				sortedIllustrations.Add(GetUniqueKey(sortedIllustrations.Keys, illustration.Attribute("href").Value), illustration);
				illustration.Remove();
			}
			return sortedIllustrations;
		}

		private static SortedDictionary<string, XElement> SortedReversals(XElement reversalParent)
		{
			var sortedReversals = new SortedDictionary<string, XElement>();
			var fakeKeyPart = 1;
			var tempGuid = Guid.NewGuid();
			foreach (var reversal in reversalParent.Elements("reversal").ToList())
			{
				SortReversalContents(reversal);

				var typeAttr = reversal.Attribute("type");
				var key = typeAttr == null ? "@@@@@@" + tempGuid.ToString() + fakeKeyPart : typeAttr.Value;
				sortedReversals.Add(GetUniqueKey(sortedReversals.Keys, key), reversal);
				if (typeAttr == null)
					fakeKeyPart++;
			}

			return sortedReversals;
		}

		private static void SortReversalContents(XElement reversal)
		{
			var sortedForms = SortMultiformElementCore(reversal);
			var grammaticalInfo = SortGrammaticalInfoContent(reversal);

			var sortedNestedReversal = reversal.Element("main");
			if (sortedNestedReversal != null)
				SortReversalContents(sortedNestedReversal);

			reversal.Remove();

			foreach (var form in sortedForms.Values)
			{
				reversal.Add(form);
			}
			if (grammaticalInfo != null)
				reversal.Add(grammaticalInfo);
			if (sortedNestedReversal != null)
				reversal.Add(sortedNestedReversal);
		}

		private static IEnumerable<XElement> SortedExamplesContents(XElement sense)
		{
			var examples = sense.Elements("example").ToList();
			foreach (var example in examples)
			{
				var sortedForms = SortMultiformElementCore(example);
				var sortedTranslations = SortedTranslations(example);
				var sortedNotes = SortedNotes(example);
				var sortedExtensibles = SortExtensibleWithField(example);

				example.Remove();

				foreach (var form in sortedForms.Values)
				{
					example.Add(form);
				}
				foreach (var translation in sortedTranslations.Values)
				{
					example.Add(translation);
				}
				foreach (var note in sortedNotes.Values)
				{
					example.Add(note);
				}
				RestoreSortedExtensibles(sortedExtensibles, example);
			}
			return examples;
		}

		private static SortedDictionary<string, XElement> SortedTranslations(XElement translationParent)
		{
			var sortedTranslations = new SortedDictionary<string, XElement>();
			var fakeKeyPart = 1;
			var tempGuid = Guid.NewGuid();
			foreach (var translation in translationParent.Elements("translation").ToList())
			{
				var sortedForms = SortMultiformElementCore(translation);
				var typeAttr = translation.Attribute("type");
				var key = typeAttr == null ? "@@@@@@" + tempGuid.ToString() + fakeKeyPart : typeAttr.Value;
				sortedTranslations.Add(GetUniqueKey(sortedTranslations.Keys, key), translation);
				if (typeAttr == null)
					fakeKeyPart++;

				translation.Remove();

				foreach (var form in sortedForms.Values)
				{
					translation.Add(form);
				}
			}
			return sortedTranslations;
		}

		private static XElement SortGrammaticalInfoContent(XElement grammaticalInfoParent)
		{
			var grammaticalInfo = grammaticalInfoParent.Element("grammatical-info");
			if (grammaticalInfo != null)
			{
				var sortedTraits = SortedTraits(grammaticalInfo);

				grammaticalInfo.Remove();

				foreach (var trait in sortedTraits.Values)
				{
					grammaticalInfo.Add(trait);
				}
			}
			return grammaticalInfo;
		}

		private static Dictionary<string, SortedDictionary<string, XElement>> SortExtensibleSansField(XElement extensibleParent)
		{
			return new Dictionary<string, SortedDictionary<string, XElement>>(2, StringComparer.InvariantCultureIgnoreCase)
				{
					{"annotations", SortedAnnotations(extensibleParent)},
					{"traits", SortedTraits(extensibleParent)}
				};
		}

		private static Dictionary<string, SortedDictionary<string, XElement>> SortExtensibleWithField(XElement extensibleParent)
		{
			return new Dictionary<string, SortedDictionary<string, XElement>>(2, StringComparer.InvariantCultureIgnoreCase)
				{
					{"annotations", SortedAnnotations(extensibleParent)},
					{"traits", SortedTraits(extensibleParent)},
					{"fields", SortFields(extensibleParent, "type")}
				};
		}

		private static SortedDictionary<string, XElement> SortedAnnotations(XElement annotationParent)
		{
			var sortedAnnotations = new SortedDictionary<string, XElement>(StringComparer.InvariantCultureIgnoreCase);
			var fakeKeyPart = 1;
			var tempGuid = Guid.NewGuid();
			foreach (var annotation in annotationParent.Elements("annotation").ToList())
			{
				var sortedForms = SortMultiformElementCore(annotation);
				var valueAttr = annotation.Attribute("value");
				var valuePartOfKey = valueAttr == null ? "@@@@@@" + tempGuid.ToString() + fakeKeyPart : valueAttr.Value;
				sortedAnnotations.Add(GetUniqueKey(sortedAnnotations.Keys, annotation.Attribute("name").Value + valuePartOfKey), annotation);
				if (valueAttr == null)
					fakeKeyPart++;
				foreach (var form in sortedForms.Values)
				{
					annotation.Add(form);
				}
				annotation.Remove();
			}
			return sortedAnnotations;
		}

		private static SortedDictionary<string, XElement> SortedTraits(XElement traitParent)
		{
			var sortedTraits = new SortedDictionary<string, XElement>(StringComparer.InvariantCultureIgnoreCase);
			foreach (var trait in traitParent.Elements("trait").ToList())
			{
				var sortedAnnotations = SortedAnnotations(trait);
				sortedTraits.Add(GetUniqueKey(sortedTraits.Keys, trait.Attribute("name").Value + trait.Attribute("value").Value), trait);
				trait.Remove();

				foreach (var annotation in sortedAnnotations.Values)
				{
					trait.Add(annotation);
				}
			}
			return sortedTraits;
		}

		private static void SortMultiformElement(XElement multiformElementParent)
		{
			if (multiformElementParent == null)
				return;

			var sortedForms = SortMultiformElementCore(multiformElementParent);

			foreach (var form in sortedForms.Values)
				multiformElementParent.Add(form);
		}

		private static SortedDictionary<string, XElement> SortMultiformElementCore(XElement multiformElementParent)
		{
			var sortedForms = new SortedDictionary<string, XElement>(StringComparer.InvariantCultureIgnoreCase);
			if (multiformElementParent == null)
				return sortedForms;

			foreach (var form in multiformElementParent.Elements("form").ToList())
			{
				SortFormContent(form);
				sortedForms.Add(GetUniqueKey(sortedForms.Keys, form.Attribute("lang").Value), form);
				form.Remove();
			}
			return sortedForms;
		}

		private static void SortFormContent(XElement formElement)
		{
			// Don't even think of messing with the <text> innards.
			var textElement = formElement.Element("text");
			textElement.Remove();
			var sortedAnnotations = SortedAnnotations(formElement);

			formElement.Add(textElement);
			foreach (var annotation in sortedAnnotations.Values)
			{
				formElement.Add(annotation);
			}
		}

		private static void SortAttributes(XElement element)
		{
			if (element.HasElements)
			{
				// Recurse all the way down
				foreach (var childElement in element.Elements())
					SortAttributes(childElement);
			}

			if (element.Attributes().Count() < 2)
				return;

			var sortedAttributes = new SortedDictionary<string, XAttribute>();
			foreach (var attr in element.Attributes())
			{
				sortedAttributes.Add(GetUniqueKey(sortedAttributes.Keys, attr.Name.LocalName), attr);
			}

			element.Attributes().Remove();
			foreach (var sortedAttrKvp in sortedAttributes)
				element.Add(sortedAttrKvp.Value);
		}

		internal static string GetUniqueKey(ICollection<string> keys, string keyCandidate)
		{
			var keyWithSuffix = keyCandidate;
			var suffix = 1;
			while (true)
			{
				if (!keys.Contains(keyWithSuffix))
					return keyWithSuffix;
				keyWithSuffix = keyCandidate + suffix++;
			}
		}
	}
}


text:
package com.contexthub.boundaries.fragments;

import android.os.Bundle;
import android.view.View;

import com.chaione.contexthub.sdk.ContextHub;
import com.chaione.contexthub.sdk.model.Geofence;
import com.contexthub.boundaries.R;
import com.google.android.gms.maps.model.LatLng;

import java.util.Arrays;

/**
 * Dialog fragment for creating a geofence
 */
public class GeofenceCreateDialogFragment extends GeofenceEditDialogFragment {

    private static final int GEOFENCE_RADIUS = 500;

    private static final String ARG_COORDINATES = "coordinates";

    public static GeofenceCreateDialogFragment newInstance(LatLng coordinates) {
        GeofenceCreateDialogFragment fragment = new GeofenceCreateDialogFragment();
        Bundle args = new Bundle();
        args.putParcelable(ARG_COORDINATES, coordinates);
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    public void onClick(View v) {
        if(!validGeofence()) return;
        showProgressDialog(R.string.creating_geofence);
        LatLng coordinates = (LatLng) getArguments().getParcelable(ARG_COORDINATES);
        proxy.createGeofence(geofenceName.getText().toString(), coordinates.latitude, coordinates.longitude,
                GEOFENCE_RADIUS, Arrays.asList("geofence-tag"), this);
    }

    @Override
    protected void postGeofenceChangedEvent(Geofence geofence) {
        ContextHub.getInstance().getBus().post(new GeofenceCreatedEvent(geofence));
    }

    public class GeofenceCreatedEvent {
        private Geofence geofence;

        public GeofenceCreatedEvent(Geofence geofence) {
            this.geofence = geofence;
        }

        public Geofence getGeofence() {
            return geofence;
        }
    }
}


text:
#include <ztest.h>
#define TIMEOUT 2000
#define BLK_SIZE_MIN 4
#define BLK_SIZE_MID 16
#define BLK_SIZE_MAX 64
#define BLK_NUM_MIN 32
#define BLK_NUM_MAX 2
#define BLK_ALIGN BLK_SIZE_MIN

K_MEM_POOL_DEFINE(mpool3, BLK_SIZE_MIN, BLK_SIZE_MAX, BLK_NUM_MAX, BLK_ALIGN);

/*test cases*/
void test_mpool_alloc_merge_failed_diff_size(void)
{
	struct k_mem_block block[BLK_NUM_MIN], block_fail;
	size_t block_size[] = {
		BLK_SIZE_MIN, BLK_SIZE_MIN, BLK_SIZE_MIN, BLK_SIZE_MIN,
		BLK_SIZE_MID, BLK_SIZE_MID, BLK_SIZE_MID,
		BLK_SIZE_MIN, BLK_SIZE_MIN, BLK_SIZE_MIN, BLK_SIZE_MIN,
		BLK_SIZE_MID, BLK_SIZE_MID, BLK_SIZE_MID};
	int block_count = sizeof(block_size)/sizeof(size_t);

	/**
	 * TESTPOINT: the merging algorithm cannot combine adjacent free blocks
	 * of different sizes
	 * Test steps: 1. allocate 14 blocks in different sizes
	 *             2. free block [2~8], in different sizes
	 *             3. request a big block
	 *                verify blocks [2~8] can't be merged
	 *             4. tear down, free blocks [0, 1, 9~13]
	 */
	for (int i = 0; i < block_count; i++) {
		/* 1. allocate blocks in different sizes*/
		assert_true(k_mem_pool_alloc(&mpool3, &block[i], block_size[i],
			K_NO_WAIT) == 0, NULL);
	}
	/* 2. free block [2~8], in different sizes*/
	for (int i = 2; i < 9; i++) {
		k_mem_pool_free(&block[i]);
	}
	/* 3. request a big block, expected failed to merge*/
	k_mem_pool_defrag(&mpool3);
	assert_true(k_mem_pool_alloc(&mpool3, &block_fail, BLK_SIZE_MAX,
		TIMEOUT) == -EAGAIN, NULL);

	/* 4. test case tear down*/
	k_mem_pool_free(&block[0]);
	k_mem_pool_free(&block[1]);
	for (int i = 9; i < block_count; i++) {
		k_mem_pool_free(&block[i]);
	}
}