/*
 *
 * Copyright 2016 gRPC authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

/* Posix code for gpr snprintf support. */

#include <grpc/support/port_platform.h>

#ifdef GPR_WINDOWS

/* Some platforms (namely msys) need wchar to be included BEFORE
   anything else, especially strsafe.h. */
#include <wchar.h>

#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include <strsafe.h>

#include <grpc/support/alloc.h>
#include <grpc/support/string_util.h>

#include "src/core/lib/support/string.h"

#if defined UNICODE || defined _UNICODE
LPTSTR
gpr_char_to_tchar(LPCSTR input) {
  LPTSTR ret;
  int needed = MultiByteToWideChar(CP_UTF8, 0, input, -1, NULL, 0);
  if (needed <= 0) return NULL;
  ret = gpr_malloc((unsigned)needed * sizeof(TCHAR));
  MultiByteToWideChar(CP_UTF8, 0, input, -1, ret, needed);
  return ret;
}

LPSTR
gpr_tchar_to_char(LPCTSTR input) {
  LPSTR ret;
  int needed = WideCharToMultiByte(CP_UTF8, 0, input, -1, NULL, 0, NULL, NULL);
  if (needed <= 0) return NULL;
  ret = gpr_malloc((unsigned)needed);
  WideCharToMultiByte(CP_UTF8, 0, input, -1, ret, needed, NULL, NULL);
  return ret;
}
#else
char *gpr_tchar_to_char(LPTSTR input) { return gpr_strdup(input); }

char *gpr_char_to_tchar(LPTSTR input) { return gpr_strdup(input); }
#endif

char *gpr_format_message(int messageid) {
  LPTSTR tmessage;
  char *message;
  DWORD status = FormatMessage(
      FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |
          FORMAT_MESSAGE_IGNORE_INSERTS,
      NULL, (DWORD)messageid, MAKELANGID(LANG_ENGLISH, SUBLANG_DEFAULT),
      (LPTSTR)(&tmessage), 0, NULL);
  if (status == 0) return gpr_strdup("Unable to retrieve error string");
  message = gpr_tchar_to_char(tmessage);
  LocalFree(tmessage);
  return message;
}

#endif /* GPR_WINDOWS */


created: 20140908125300000
modified: 20160602172722526
tags: Community
title: Tutorials
type: text/vnd.tiddlywiki

Here are some webpages with tips and tutorials related to ~TiddlyWiki.

<$list filter="[tag[Tutorials]!sort[modified]]">

! <$link><$view field="title"/></$link>

Posted <$view field="modified" format="relativedate"/>

<$transclude/>

</$list>


<?xml version="1.0"?>
<!--
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="checkout" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd" label="Multishipping Checkout" design_abstraction="custom">
    <body/>
</page>


<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="false">

    <android.support.design.widget.AppBarLayout
        android:id="@+id/main_abl_app_bar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

        <android.support.design.widget.CollapsingToolbarLayout
            android:layout_width="match_parent"
            android:layout_height="520dp"
            app:layout_scrollFlags="scroll|exitUntilCollapsed|snap">

            <ImageView
                android:id="@+id/main_iv_placeholder"
                android:layout_width="match_parent"
                android:layout_height="300dp"
                android:scaleType="centerCrop"
                android:src="@drawable/large"
                app:layout_collapseMode="parallax" />

            <FrameLayout
                android:id="@+id/main_fl_title"
                android:layout_width="match_parent"
                android:layout_height="220dp"
                android:layout_gravity="bottom|center_horizontal"
                android:background="@color/colorPrimary"
                app:layout_collapseMode="parallax">

                <LinearLayout
                    android:id="@+id/main_ll_title_container"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:layout_marginBottom="20dp"
                    android:orientation="vertical">

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center_horizontal"
                        android:gravity="bottom|center"
                        android:text="@string/person_name"
                        android:textColor="@android:color/white"
                        android:textSize="22sp" />

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center_horizontal"
                        android:layout_marginTop="15dp"
                        android:text="@string/person_title"
                        android:textColor="@android:color/white" />

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center_horizontal"
                        android:layout_marginTop="12dp"
                        android:text="来自 深圳"
                        android:textColor="@android:color/white" />

                </LinearLayout>

                <Button
                    android:layout_width="90dp"
                    android:layout_height="35dp"
                    android:layout_gravity="center|center_horizontal"
                    android:layout_marginTop="55dp"
                    android:background="@drawable/btn_bg"
                    android:text="打招呼"
                    android:textColor="@android:color/white" />

            </FrameLayout>
        </android.support.design.widget.CollapsingToolbarLayout>
    </android.support.design.widget.AppBarLayout>

    <android.support.v4.widget.NestedScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:scrollbars="none"
        app:behavior_overlapTop="30dp"
        app:layout_behavior="@string/appbar_scrolling_view_behavior">

        <android.support.v7.widget.CardView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_margin="8dp"
            app:cardElevation="8dp"
            app:contentPadding="16dp">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="vertical">

                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:orientation="vertical">

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="内心独白"
                        android:textSize="18sp" />

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="15dp"
                        android:text="孙骁骁通过湖南电视台娱乐频道在中国传媒大学的招聘并往长沙进行复试。通过复试后孙骁骁开始主持娱乐资讯类节目《娱乐急先锋》。"
                        android:textSize="15sp" />
                </LinearLayout>

                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:orientation="vertical">

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="内心独白"
                        android:textSize="18sp" />

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="15dp"
                        android:text="孙骁骁通过湖南电视台娱乐频道在中国传媒大学的招聘并往长沙进行复试。通过复试后孙骁骁开始主持娱乐资讯类节目《娱乐急先锋》。"
                        android:textSize="15sp" />
                </LinearLayout>

                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:orientation="vertical">

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="内心独白"
                        android:textSize="18sp" />

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="15dp"
                        android:text="孙骁骁通过湖南电视台娱乐频道在中国传媒大学的招聘并往长沙进行复试。通过复试后孙骁骁开始主持娱乐资讯类节目《娱乐急先锋》。"
                        android:textSize="15sp" />
                </LinearLayout>

                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:orientation="vertical">

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="内心独白"
                        android:textSize="18sp" />

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="15dp"
                        android:text="孙骁骁通过湖南电视台娱乐频道在中国传媒大学的招聘并往长沙进行复试。通过复试后孙骁骁开始主持娱乐资讯类节目《娱乐急先锋》。"
                        android:textSize="15sp" />
                </LinearLayout>

                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:orientation="vertical">

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="内心独白"
                        android:textSize="18sp" />

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="15dp"
                        android:text="孙骁骁通过湖南电视台娱乐频道在中国传媒大学的招聘并往长沙进行复试。通过复试后孙骁骁开始主持娱乐资讯类节目《娱乐急先锋》。"
                        android:textSize="15sp" />
                </LinearLayout>

                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:orientation="vertical">

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="内心独白"
                        android:textSize="18sp" />

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="15dp"
                        android:text="孙骁骁通过湖南电视台娱乐频道在中国传媒大学的招聘并往长沙进行复试。通过复试后孙骁骁开始主持娱乐资讯类节目《娱乐急先锋》。"
                        android:textSize="15sp" />
                </LinearLayout>

                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:orientation="vertical">

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="内心独白"
                        android:textSize="18sp" />

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="15dp"
                        android:text="孙骁骁通过湖南电视台娱乐频道在中国传媒大学的招聘并往长沙进行复试。通过复试后孙骁骁开始主持娱乐资讯类节目《娱乐急先锋》。"
                        android:textSize="15sp" />
                </LinearLayout>

                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:orientation="vertical">

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="内心独白"
                        android:textSize="18sp" />

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="15dp"
                        android:text="孙骁骁通过湖南电视台娱乐频道在中国传媒大学的招聘并往长沙进行复试。通过复试后孙骁骁开始主持娱乐资讯类节目《娱乐急先锋》。"
                        android:textSize="15sp" />
                </LinearLayout>

                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:orientation="vertical">

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="内心独白"
                        android:textSize="18sp" />

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="15dp"
                        android:text="孙骁骁通过湖南电视台娱乐频道在中国传媒大学的招聘并往长沙进行复试。通过复试后孙骁骁开始主持娱乐资讯类节目《娱乐急先锋》。"
                        android:textSize="15sp" />
                </LinearLayout>

            </LinearLayout>
        </android.support.v7.widget.CardView>

    </android.support.v4.widget.NestedScrollView>

    <android.support.v7.widget.Toolbar
        android:id="@+id/main_tb_toolbar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:background="@color/colorPrimary"
        app:layout_anchor="@id/main_fl_title"
        app:theme="@style/ThemeOverlay.AppCompat.Dark">

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:orientation="horizontal">

            <!--<Space-->
            <!--android:layout_width="@dimen/image_final_width"-->
            <!--android:layout_height="@dimen/image_final_width" />-->

            <TextView
                android:id="@+id/main_tv_toolbar_title"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:layout_marginLeft="8dp"
                android:gravity="center_vertical"
                android:text="@string/person_name"
                android:textColor="@android:color/white"
                android:textSize="20sp"
                android:visibility="invisible" />

        </LinearLayout>

    </android.support.v7.widget.Toolbar>

    <de.hdodenhof.circleimageview.CircleImageView
        android:id="@+id/civ"
        android:layout_width="@dimen/image_width"
        android:layout_height="@dimen/image_width"
        android:layout_gravity="center"
        android:src="@drawable/large"
        app:border_color="@android:color/white"
        app:border_width="2dp"
        app:layout_behavior="com.allyn.lives.activity.AvatarImageBehavior" />

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <LinearLayout
            android:id="@+id/lvMenu"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="bottom"
            android:orientation="horizontal"
            android:visibility="invisible">

            <Button
                android:layout_width="match_parent"
                android:layout_height="35dp"
                android:layout_gravity="center|center_horizontal"
                android:layout_margin="10dp"
                android:layout_weight="1"
                android:background="@drawable/btn_status"
                android:text="加关注"
                android:textColor="@android:color/white" />

            <Button
                android:layout_width="match_parent"
                android:layout_height="35dp"
                android:layout_gravity="center|center_horizontal"
                android:layout_margin="10dp"
                android:layout_weight="1"

                android:background="@drawable/btn_status"
                android:text="聊天"
                android:textColor="@android:color/white" />

            <Button
                android:layout_width="match_parent"
                android:layout_height="35dp"
                android:layout_gravity="center|center_horizontal"
                android:layout_margin="10dp"
                android:layout_weight="1"

                android:background="@drawable/btn_status"
                android:text="下一位"
                android:textColor="@android:color/white" />
        </LinearLayout>
    </FrameLayout>

</android.support.design.widget.CoordinatorLayout>


/*=============================================================================
    Copyright (c) 2001-2011 Hartmut Kaiser

    Distributed under the Boost Software License, Version 1.0. (See accompanying
    file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
=============================================================================*/
#if !defined(SPIRIT_ALTERNATIVE_FUNCTION_APRIL_23_2007_1046AM)
#define SPIRIT_ALTERNATIVE_FUNCTION_APRIL_23_2007_1046AM

#if defined(_MSC_VER)
#pragma once
#endif

#include <boost/spirit/home/qi/domain.hpp>
#include <boost/spirit/home/qi/detail/assign_to.hpp>
#include <boost/spirit/home/support/unused.hpp>
#include <boost/spirit/home/qi/detail/attributes.hpp>
#include <boost/variant.hpp>
#include <boost/mpl/bool.hpp>

namespace boost { namespace spirit { namespace qi { namespace detail
{
    template <typename Variant, typename Expected>
    struct find_substitute
    {
        // Get the typr from the variant that can be a substitute for Expected.
        // If none is found, just return Expected

        typedef Variant variant_type;
        typedef typename variant_type::types types;
        typedef typename mpl::end<types>::type end;

        typedef typename
            mpl::find_if<types, is_same<mpl::_1, Expected> >::type
        iter_1;

        typedef typename
            mpl::eval_if<
                is_same<iter_1, end>,
                mpl::find_if<types, traits::is_substitute<mpl::_1, Expected> >,
                mpl::identity<iter_1>
            >::type
        iter;

        typedef typename
            mpl::eval_if<
                is_same<iter, end>,
                mpl::identity<Expected>,
                mpl::deref<iter>
            >::type
        type;
    };

    template <typename Iterator, typename Context, typename Skipper,
        typename Attribute>
    struct alternative_function
    {
        alternative_function(
            Iterator& first_, Iterator const& last_, Context& context_,
            Skipper const& skipper_, Attribute& attr_)
          : first(first_), last(last_), context(context_), skipper(skipper_),
            attr(attr_)
        {
        }

        template <typename Component>
        bool call(Component const& component, mpl::true_) const
        {
            // if Attribute is not a variant, then pass it as-is
            return component.parse(first, last, context, skipper, attr);
        }

        template <typename Component>
        bool call_optional_or_variant(Component const& component, mpl::true_) const
        {
            // If Attribute is an optional, then create an attribute for the Component
            // with the type optional::value_type. If the expected attribute is unused type,
            // use it instead.
            typedef typename
                traits::attribute_of<Component, Context, Iterator>::type
            expected_type;

            typename mpl::if_<
                is_same<expected_type, unused_type>,
                unused_type,
                typename Attribute::value_type>::type
            val;

            if (component.parse(first, last, context, skipper, val))
            {
                traits::assign_to(val, attr);
                return true;
            }
            return false;
        }

        template <typename Component>
        bool call_variant(Component const& component, mpl::false_) const
        {
            // If Attribute is a variant, then search the variant types for a
            // suitable substitute type.

            typename
                find_substitute<Attribute,
                    typename traits::attribute_of<Component, Context, Iterator>::type
                >::type
            val;

            if (component.parse(first, last, context, skipper, val))
            {
                traits::assign_to(val, attr);
                return true;
            }
            return false;
        }

        template <typename Component>
        bool call_variant(Component const& component, mpl::true_) const
        {
            // If Attribute is a variant and the expected attribute is
            // the same type (pass the variant as-is).

            return component.parse(first, last, context, skipper, attr);
        }

        template <typename Component>
        bool call_optional_or_variant(Component const& component, mpl::false_) const
        {
            // Attribute is a variant...

            typedef typename
                traits::attribute_of<Component, Context, Iterator>::type
            expected;
            return call_variant(component,
                is_same<Attribute, expected>());
        }

        template <typename Component>
        bool call(Component const& component, mpl::false_) const
        {
            return call_optional_or_variant(
                component, spirit::traits::not_is_variant<Attribute, qi::domain>());
        }

        template <typename Component>
        bool call_unused(Component const& component, mpl::true_) const
        {
            // return true if the parser succeeds
            return call(component,
                mpl::and_<
                    spirit::traits::not_is_variant<Attribute, qi::domain>,
                    spirit::traits::not_is_optional<Attribute, qi::domain>
                >());
        }

        template <typename Component>
        bool call_unused(Component const& component, mpl::false_) const
        {
            return component.parse(first, last, context, skipper, unused);
        }

        template <typename Component>
        bool operator()(Component const& component) const
        {
            // return true if the parser succeeds
            typedef typename traits::not_is_unused<
                typename traits::attribute_of<Component, Context, Iterator>::type
            >::type predicate;

            return call_unused(component, predicate());
        }

        Iterator& first;
        Iterator const& last;
        Context& context;
        Skipper const& skipper;
        Attribute& attr;

    private:
        // silence MSVC warning C4512: assignment operator could not be generated
        alternative_function& operator= (alternative_function const&);
    };

    template <typename Iterator, typename Context, typename Skipper>
    struct alternative_function<Iterator, Context, Skipper, unused_type const>
    {
        alternative_function(
            Iterator& first_, Iterator const& last_, Context& context_,
            Skipper const& skipper_, unused_type)
          : first(first_), last(last_), context(context_), skipper(skipper_)
        {
        }

        template <typename Component>
        bool operator()(Component const& component) const
        {
            // return true if the parser succeeds
            return component.parse(first, last, context, skipper,
                unused);
        }

        Iterator& first;
        Iterator const& last;
        Context& context;
        Skipper const& skipper;

    private:
        // silence MSVC warning C4512: assignment operator could not be generated
        alternative_function& operator= (alternative_function const&);
    };

}}}}

#endif


import React from "react";
import PropTypes from "prop-types";
import {
  Glyphicon,
  MenuItem,
  OverlayTrigger,
  Tooltip,
  Navbar,
  Nav,
  NavDropdown,
  NavItem
} from "react-bootstrap";

const TopMenu = ( {
  createBlankObsCard,
  confirmRemoveSelected,
  selectAll,
  combineSelected,
  duplicateSelected,
  trySubmitObservations,
  fileChooser,
  countTotal,
  countSelected,
  selectNone,
  scrolledPastToolbar
} ) => {
  let saveButton;
  if ( countTotal > 0 ) {
    saveButton = (
      <button
        type="button"
        onClick={trySubmitObservations}
        className="btn btn-success navbar-btn"
      >
        { I18n.t( "submit_observations", { count: countTotal } ) }
      </button>
    );
  }
  const dropdownToggle = (

      <Glyphicon glyph="plus" />
      { I18n.t( "add" ) }

  );
  let className = "nav_add_obs";
  if ( scrolledPastToolbar ) { className += " fixed"; }
  const removeDisabled = countSelected === 0;
  const combineDisabled = countSelected < 2;
  const duplicateDisabled = countSelected === 0;
  const selectAllDisabled = countTotal === 0;
  return (
    <Navbar className={className} fluid>

        <OverlayTrigger
          placement="top"
          delayShow={1000}
          overlay={( <Tooltip id="add-tip">{ I18n.t( "uploader.tooltips.add" ) }</Tooltip> )}
        >
          <NavDropdown title={dropdownToggle} id="add_photos">
            <MenuItem onClick={fileChooser}>{ I18n.t( "photos_or_sounds" ) }</MenuItem>
            <MenuItem onClick={createBlankObsCard}>
              { I18n.t( "observation_without_media" ) }
            </MenuItem>
          </NavDropdown>
        </OverlayTrigger>
        <OverlayTrigger
          placement="top"
          delayShow={1000}
          overlay={
            removeDisabled
              ?
              : <Tooltip id="remove-tip">{ I18n.t( "uploader.tooltips.remove" ) }</Tooltip>
          }
        >
          <NavItem
            onClick={confirmRemoveSelected}
            disabled={removeDisabled}
          >
            <Glyphicon glyph="remove" />
            { I18n.t( "remove" ) }
          </NavItem>
        </OverlayTrigger>
        <OverlayTrigger
          placement="top"
          delayShow={1000}
          overlay={
            combineDisabled
              ?
              : <Tooltip id="merge-tip">{ I18n.t( "uploader.tooltips.combine" ) }</Tooltip>
          }
        >
          <NavItem
            onClick={combineSelected}
            disabled={combineDisabled}
          >
            <Glyphicon glyph="resize-small" />
            { I18n.t( "combine" ) }
          </NavItem>
        </OverlayTrigger>
        <OverlayTrigger
          placement="top"
          delayShow={1000}
          overlay={
            duplicateDisabled
              ?
              : <Tooltip id="duplicate-tip">{ I18n.t( "uploader.tooltips.duplicate" ) }</Tooltip>
          }
        >
          <NavItem
            onClick={duplicateSelected}
            disabled={duplicateDisabled}
          >

            { " " }
            { I18n.t( "duplicate_verb" ) }
          </NavItem>
        </OverlayTrigger>
        <OverlayTrigger
          placement="top"
          delayShow={1000}
          overlay={
            selectAllDisabled
              ?
              : <Tooltip id="select-tip">{ I18n.t( "uploader.tooltips.select_all" ) }</Tooltip>
          }
        >
          <li className={`select ${countTotal === 0 && "disabled"}`}>
            <form className="navbar-form" role="search">
              <input
                id="select-all"
                type="checkbox"
                key={`select${countSelected}${countTotal}`}
                disabled={selectAllDisabled}
                checked={countTotal > 0 && countSelected === countTotal}
                onChange={
                  ( ) => ( countSelected !== countTotal ? selectAll( ) : selectNone( ) )
                }
              />
              { I18n.t( "select_all" ) }
            </form>

        </OverlayTrigger>

      { saveButton }
    </Navbar>
  );
};

TopMenu.propTypes = {
  combineSelected: PropTypes.func,
  confirmRemoveSelected: PropTypes.func,
  countSelected: PropTypes.number,
  countTotal: PropTypes.number,
  createBlankObsCard: PropTypes.func,
  duplicateSelected: PropTypes.func,
  fileChooser: PropTypes.func,
  scrolledPastToolbar: PropTypes.bool,
  selectAll: PropTypes.func,
  selectNone: PropTypes.func,
  trySubmitObservations: PropTypes.func
};

export default TopMenu;


# coding: utf-8

# During build, the Gemfile is temporarily moved and
# we must manually define the project root
if ENV['MSF_ROOT']
  lib = File.realpath(File.expand_path('lib', ENV['MSF_ROOT']))
else
  # have to use realpath as metasploit-framework is often loaded through a symlink and tools like Coverage and debuggers
  # require realpaths.
  lib = File.realpath(File.expand_path('../lib', __FILE__))
end

$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'metasploit/framework/version'
require 'metasploit/framework/rails_version_constraint'
require 'msf/util/helper'

Gem::Specification.new do |spec|
  spec.name          = 'metasploit-framework'
  spec.version       = Metasploit::Framework::GEM_VERSION
  spec.authors       = ['Metasploit Hackers']
  spec.email         = ['msfdev@metasploit.com']
  spec.summary       = 'metasploit-framework'
  spec.description   = 'metasploit-framework'
  spec.homepage      = 'https://www.metasploit.com'
  spec.license       = 'BSD-3-clause'

  # only do a git ls-files if the .git folder exists and we have a git binary in PATH
  if File.directory?(File.join(File.dirname(__FILE__), ".git")) && Msf::Util::Helper.which("git")
    spec.files         = `git ls-files`.split($/).reject { |file|
      file =~ /^documentation|^external/
    }
  end
  spec.bindir = '.'
  if ENV['CREATE_BINSTUBS']
    spec.executables   = [
      'msfconsole',
      'msfd',
      'msfrpc',
      'msfrpcd',
      'msfvenom'
    ]
  end
  spec.test_files    = spec.files.grep(%r{^spec/})
  spec.require_paths = ["lib"]

  spec.required_ruby_version = '>= 2.5'

  # Database support
  spec.add_runtime_dependency 'activerecord', *Metasploit::Framework::RailsVersionConstraint::RAILS_VERSION
  # Need 3+ for ActiveSupport::Concern
  spec.add_runtime_dependency 'activesupport', *Metasploit::Framework::RailsVersionConstraint::RAILS_VERSION
  # Needed for config.action_view for view plugin compatibility for Pro
  spec.add_runtime_dependency 'actionpack', *Metasploit::Framework::RailsVersionConstraint::RAILS_VERSION
  # Needed for some admin modules (cfme_manageiq_evm_pass_reset.rb)
  spec.add_runtime_dependency 'bcrypt'
  # Needed for Javascript obfuscation
  spec.add_runtime_dependency 'jsobfu'
  # Needed for some admin modules (scrutinizer_add_user.rb)
  spec.add_runtime_dependency 'json'
  # Metasm compiler/decompiler/assembler
  spec.add_runtime_dependency 'metasm'
  # Metasploit::Concern hooks
  spec.add_runtime_dependency 'metasploit-concern'
  # Metasploit::Credential database models
  spec.add_runtime_dependency 'metasploit-credential'
  # Database models shared between framework and Pro.
  spec.add_runtime_dependency 'metasploit_data_models'
  # Things that would normally be part of the database model, but which
  # are needed when there's no database
  spec.add_runtime_dependency 'metasploit-model'
  # Needed for Meterpreter
  spec.add_runtime_dependency 'metasploit-payloads', '2.0.14'
  # Needed for the next-generation POSIX Meterpreter
  spec.add_runtime_dependency 'metasploit_payloads-mettle', '1.0.2'
  # Needed by msfgui and other rpc components
  spec.add_runtime_dependency 'msgpack'
  # get list of network interfaces, like eth* from OS.
  spec.add_runtime_dependency 'network_interface'
  # NTLM authentication
  spec.add_runtime_dependency 'rubyntlm'
  # Needed by anemone crawler
  spec.add_runtime_dependency 'nokogiri'
  # Needed by db.rb and Msf::Exploit::Capture
  spec.add_runtime_dependency 'packetfu'
  # For sniffer and raw socket modules
  spec.add_runtime_dependency 'pcaprub'
  # Used by the Metasploit data model, etc.
  # bound to 0.2x for Activerecord 4.2.8 deprecation warnings:
  # https://github.com/ged/ruby-pg/commit/c90ac644e861857ae75638eb6954b1cb49617090
  spec.add_runtime_dependency 'pg'
  # Run initializers for metasploit-concern, metasploit-credential, metasploit_data_models Rails::Engines
  spec.add_runtime_dependency 'railties'
  # required for OS fingerprinting
  spec.add_runtime_dependency 'recog'
  # required for bitlocker fvek extraction
  spec.add_runtime_dependency 'openssl-ccm'
  # Needed for documentation generation
  spec.add_runtime_dependency 'octokit'
  spec.add_runtime_dependency 'redcarpet'
  # Needed for Microsoft patch finding tool (msu_finder)
  spec.add_runtime_dependency 'patch_finder'
  # Required for Metasploit Web Services
  spec.add_runtime_dependency 'thin'
  spec.add_runtime_dependency 'sinatra'
  spec.add_runtime_dependency 'warden'
  # Required for JSON-RPC client
  spec.add_runtime_dependency 'em-http-request'
  # TimeZone info
  spec.add_runtime_dependency 'tzinfo-data'
  # Gem for dealing with SSHKeys
  spec.add_runtime_dependency 'sshkey'
  # BitStruct Library used for handling certain Protocol Header/Packet construction
  spec.add_runtime_dependency 'bit-struct'
  # Library for interpreting Windows error codes and strings
  spec.add_runtime_dependency 'windows_error'
  # This used to be depended on by nokogiri, depended on by wmap
  if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.3.0')
    spec.add_runtime_dependency 'xmlrpc'
  end

  #
  # File Parsing Libraries
  #
  # Needed by auxiliary/gather/http_pdf_authors module
  spec.add_runtime_dependency 'pdf-reader'
  spec.add_runtime_dependency 'ruby-macho'
  # Needed for mongodb/bson
  spec.add_runtime_dependency 'bson'

  #
  # Protocol Libraries
  #
  spec.add_runtime_dependency 'dnsruby'
  spec.add_runtime_dependency 'mqtt'
  spec.add_runtime_dependency 'net-ssh'
  spec.add_runtime_dependency 'ed25519' # Adds ed25519 keys for net-ssh
  spec.add_runtime_dependency 'bcrypt_pbkdf'
  spec.add_runtime_dependency 'ruby_smb', '~> 2.0'
  spec.add_runtime_dependency 'net-ldap'

  #
  # REX Libraries
  #
  # Core of the Ruby Exploitation Library
  spec.add_runtime_dependency 'rex-core'
  # Text manipulation library for things like generating random string
  spec.add_runtime_dependency 'rex-text'
  # Library for Generating Randomized strings valid as Identifiers such as variable names
  spec.add_runtime_dependency 'rex-random_identifier'
  # library for creating Powershell scripts for exploitation purposes
  spec.add_runtime_dependency 'rex-powershell'
  # Library for processing and creating Zip compatbile archives
  spec.add_runtime_dependency 'rex-zip'
  # Library for parsing offline Windows Registry files
  spec.add_runtime_dependency 'rex-registry'
  # Library for parsing Java serialized streams
  spec.add_runtime_dependency 'rex-java'
  # Library for C-style structs
  spec.add_runtime_dependency 'rex-struct2'
  # Library which contains architecture specific information such as registers, opcodes,
  # and stack manipulation routines.
  spec.add_runtime_dependency 'rex-arch'
  # Library for working with OLE.
  spec.add_runtime_dependency 'rex-ole'
  # Library for creating and/or parsing MIME messages.
  spec.add_runtime_dependency 'rex-mime'
  # Library for Dynamic Multi-byte x86 NOP generation
  spec.add_runtime_dependency 'rex-nop'
  # Library for parsing and manipulating executable binaries
  spec.add_runtime_dependency 'rex-bin_tools'
  # Rex Socket Abstraction Layer
  spec.add_runtime_dependency 'rex-socket'
  # Library for scanning a server's SSL/TLS capabilities
  spec.add_runtime_dependency 'rex-sslscan'
  # Library and tool for finding ROP gadgets in a supplied binary
  spec.add_runtime_dependency 'rex-rop_builder'
  # Library for polymorphic encoders; used for payload encoding
  spec.add_runtime_dependency 'rex-encoder'
  # Library for exploit development helpers
  spec.add_runtime_dependency 'rex-exploitation'
  # Command line editing, history, and tab completion in msfconsole
  spec.add_runtime_dependency 'rb-readline'
  # Needed by some modules
  spec.add_runtime_dependency 'rubyzip'
  # Needed for some post modules
  spec.add_runtime_dependency 'sqlite3'
  # required for Time::TZInfo in ActiveSupport
  spec.add_runtime_dependency 'tzinfo'
  # Needed so that disk size output isn't horrible
  spec.add_runtime_dependency 'filesize'
  # Needed for openvas plugin
  spec.add_runtime_dependency 'openvas-omp'
  # Needed by metasploit nessus bridge
  spec.add_runtime_dependency 'nessus_rest'
  # Nexpose Gem
  spec.add_runtime_dependency 'nexpose'
  # Needed for NDMP sockets
  spec.add_runtime_dependency 'xdr'
  # Needed for ::Msf...CertProvider
  spec.add_runtime_dependency 'faker'
  # Pinned as a dependency of i18n to the last working version
  spec.add_runtime_dependency 'concurrent-ruby','1.0.5'
  # SSH server library
  spec.add_runtime_dependency 'hrr_rb_ssh', '0.3.0.pre2'
  # Needed for irb internal command
  spec.add_runtime_dependency 'irb'

  # AWS enumeration modules
  spec.add_runtime_dependency 'aws-sdk-s3'
  spec.add_runtime_dependency 'aws-sdk-ec2'
  spec.add_runtime_dependency 'aws-sdk-iam'

  # Needed for WebSocket Support
  spec.add_runtime_dependency 'faye-websocket'
  spec.add_runtime_dependency 'eventmachine'

  # Earlier than latest Faraday gem is used to prevent upstream Octokit errors
  spec.add_runtime_dependency 'faraday'

end


@import "utils";
.TagItem {
  display: inline-flex;
  padding: 0.5rem 1rem;
  margin: 0.375rem;
  background: white;
  border: 1px solid $oc-gray-4;
  color: $oc-gray-8;
  align-items: center;
  border-radius: 1.0625rem;
  cursor: pointer;
  .name {
    font-size: 0.875rem;
    font-weight: 500;
  }
  .counts {
    margin-left: 0.5rem;
    color: $oc-gray-6;
    font-size: 0.625rem;
  }
  @include media("<large") {
    padding: 0.4rem 0.8rem;
    margin: 0.15rem;
    .name {
      font-size: 0.75rem;
    }
    .counts {
      font-size: 0.5rem;
    }
  }
  &:hover {
    .name {
      color: $oc-violet-6;
    }
    border: 1px solid $oc-violet-5;
  }
}


/obj/effect/proc_holder/spell/targeted/click/chaplain_bless
	name = "Bless"
	desc = "Blesses a single person."

	school = "transmutation"
	charge_max = 60
	clothes_req = FALSE
	invocation = "none"
	invocation_type = "none"

	max_targets = 1
	include_user = FALSE
	allowed_type = /mob/living/carbon/human
	selection_activated_message = "You prepare a blessing. Click on a target to start blessing."
	selection_deactivated_message = "The crew will be blessed another time."
	range = 1
	click_radius = -1 // Only precision clicking
	cooldown_min = 20
	action_icon_state = "shield"

/obj/effect/proc_holder/spell/targeted/click/chaplain_bless/valid_target(mob/living/carbon/human/target, user)
	if(!..())
		return FALSE

	return target.mind && target.ckey && !target.stat

/obj/effect/proc_holder/spell/targeted/click/chaplain_bless/cast(list/targets, mob/living/user = usr)
	if(!istype(user))
		to_chat(user, "Somehow, you are not a living mob. This should never happen. Report this bug.")
		revert_cast()
		return

	if(!user.mind)
		to_chat(user, "Somehow, you are mindless. This should never happen. Report this bug.")
		revert_cast()
		return

	if(!user.mind.isholy)
		to_chat(user, "Somehow, you are not holy enough to use this ability. This should never happen. Report this bug.")
		revert_cast()
		return

	var/mob/living/carbon/human/target = targets[1]

	spawn(0) // allows cast to complete even if recipient ignores the prompt
		if(alert(target, "[user] wants to bless you, in the name of [user.p_their()] religion. Accept?", "Accept Blessing?", "Yes", "No") == "Yes") // prevents forced conversions
			user.visible_message("[user] starts blessing [target] in the name of [SSticker.Bible_deity_name].", "You start blessing [target] in the name of [SSticker.Bible_deity_name].")
			if(do_after(user, 150, target = target))
				user.visible_message("[user] has blessed [target] in the name of [SSticker.Bible_deity_name].", "You have blessed [target] in the name of [SSticker.Bible_deity_name].")
				if(!target.mind.isblessed)
					target.mind.isblessed = TRUE
					user.mind.num_blessed++


<!--
  -  OpenVPN rules
  -  Author: Julio Camargo <julio.camargo@trustux.com.br>
  -  Updated by Wazuh, Inc.
  -  Copyright (C) 2015-2020, Wazuh Inc.
  -  This program is a free software; you can redistribute it and/or modify it under the terms of GPLv2.
-->

<!-- ID: 81800 - 81899 -->

<group name="openvpn,">
    <rule id="81800" level="0">
        <decoded_as>openvpn</decoded_as>
        <description>OpenVPN messages grouped.</description>
    </rule>

    <!--
    Jul 21 18:31:19 fw01 openvpn[76395]: 200.200.200.200:17777 [chapolin] Peer Connection Initiated with [AF_INET]200.200.200.200:17777
    -->
    <rule id="81801" level="3">
        <if_sid>81800</if_sid>
        <match>Peer Connection Initiated with</match>
        <description>OpenVPN: User logged in</description>
        <mitre>
            <id>T1078</id>
        </mitre>
        <group>authentication_success,pci_dss_10.2.5,gpg13_7.1,gpg13_7.2,gdpr_IV_32.2,hipaa_164.312.b,nist_800_53_AU.14,nist_800_53_AC.7,tsc_CC6.8,tsc_CC7.2,tsc_CC7.3,</group>
    </rule>

    <rule id="81802" level="3" frequency="3" timeframe="60">
        <if_matched_sid>81801</if_matched_sid>
        <user />
        <description>OpenVPN: Concurrent connections</description>
    </rule>

    <!--
    Jul 22 11:46:19 fw01 openvpn[43658]: 201.201.201.201:1194 TLS Auth Error: Auth Username/Password verification failed for peer
    Jul 22 13:10:29 fw01 openvpn[76395]: girafalez/202.202.202.202:1194 TLS Error: TLS key negotiation failed to occur within 60 seconds (check your network connectivity)
    Jul 22 13:10:29 fw01 openvpn[76395]: girafalez/202.202.202.202:1194 TLS Error: TLS handshake failed
    -->
    <rule id="81803" level="4">
        <if_sid>81800</if_sid>
        <match>TLS Error|TLS Auth Error</match>
        <description>OpenVPN: Connection Certificate Failed</description>
        <mitre>
            <id>T1133</id>
        </mitre>
        <group>openvpn-error,gdpr_IV_35.7.d,</group>
    </rule>

    <rule id="81804" level="4" frequency="3" timeframe="60">
        <if_matched_sid>81803</if_matched_sid>
        <description>OpenVPN: Certificate failed - Possible revoked user</description>
        <mitre>
            <id>T1133</id>
        </mitre>
        <group>openvpn-error,gdpr_IV_35.7.d,gdpr_IV_32.2,</group>
    </rule>

<!--
 Author: Stuart Williams <stwilliams@workforcesoftware.com>
    Date: 2019-01-29
    Note: Enhanced decoder rules to handle LDAP integrated authentication
Comments: Not sure how useful the first entry is but will 'log' it - could be useful in auditing numbers etc

Jan 28 14:25:49 VPN-SERVER-05892 openvpn: LDAP bind failed: Invalid credentials (80090308: LdapErr: DSID-55555555, comment: AcceptSecurityContext error, data 775, v3839)
Jan 28 14:25:49 VPN-SERVER-05892 openvpn: Incorrect password supplied for LDAP DN "CN=Harry T. Hacker,OU=business unit,OU=department,DC=domain,DC=com".
-->

  <rule id="81805" level="5">
    <if_sid>81800</if_sid>
    <match>^LDAP bind failed:</match>
    <description>OpenVPN LDAP Bind Failure: $(ldap_data.error_message)</description>
    <group>pci_dss_10.2.5,gpg13_7.1,gpg13_7.2,gdpr_IV_32.2,hipaa_164.312.b,nist_800_53_AU.14,nist_800_53_AC.7</group>
  </rule>

  <rule id="81806" level="5">
    <if_sid>81800</if_sid>
    <match>^Incorrect password supplied for LDAP DN</match>
    <description>OpenVPN LDAP Logon Failure: $(ldap_data.Username) [$(ldap_data.Department)]</description>
    <group>pci_dss_10.2.5,gpg13_7.1,gpg13_7.2,gdpr_IV_32.2,hipaa_164.312.b,nist_800_53_AU.14,nist_800_53_AC.7,</group>
  </rule>

</group>


/**
 *
 * Copyright (c) 2014, the Railo Company Ltd. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
 *
 **/
/**
 * Implements the CFML Function getfunctiondescription
 */
package lucee.runtime.functions.other;

import java.util.Iterator;
import java.util.Map.Entry;

import lucee.commons.io.res.util.ResourceUtil;
import lucee.commons.lang.ExceptionUtil;
import lucee.commons.lang.StringUtil;
import lucee.runtime.Component;
import lucee.runtime.ComponentSpecificAccess;
import lucee.runtime.PageContext;
import lucee.runtime.PageContextImpl;
import lucee.runtime.component.ComponentLoader;
import lucee.runtime.config.ConfigWebUtil;
import lucee.runtime.customtag.InitFile;
import lucee.runtime.exp.ExpressionException;
import lucee.runtime.exp.FunctionException;
import lucee.runtime.exp.PageException;
import lucee.runtime.ext.function.Function;
import lucee.runtime.op.Caster;
import lucee.runtime.tag.CFTagCore;
import lucee.runtime.tag.TagUtil;
import lucee.runtime.type.Collection.Key;
import lucee.runtime.type.Struct;
import lucee.runtime.type.StructImpl;
import lucee.runtime.type.util.KeyConstants;
import lucee.runtime.type.util.ListUtil;
import lucee.transformer.library.tag.TagLib;
import lucee.transformer.library.tag.TagLibFactory;
import lucee.transformer.library.tag.TagLibTag;
import lucee.transformer.library.tag.TagLibTagAttr;
import lucee.transformer.library.tag.TagLibTagScript;

public final class GetTagData implements Function {

	private static final long serialVersionUID = -4928080244340202246L;

	public static Struct call(PageContext pc, String nameSpace, String strTagName) throws PageException {
		return _call(pc, nameSpace, strTagName, pc.getCurrentTemplateDialect());
	}

	public static Struct call(PageContext pc, String nameSpace, String strTagName, String strDialect) throws PageException {
		int dialect = ConfigWebUtil.toDialect(strDialect, -1);
		if (dialect == -1) throw new FunctionException(pc, "GetTagData", 3, "dialect", "invalid dialect [" + strDialect + "] definition");

		return _call(pc, nameSpace, strTagName, dialect);
	}

	private static Struct _call(PageContext pc, String nameSpace, String strTagName, int dialect) throws PageException {
		TagLibTag tlt = TagUtil.getTagLibTag(pc, dialect, nameSpace, strTagName);
		if (tlt == null) throw new ExpressionException("tag [" + nameSpace + strTagName + "] is not a built in tag");

		// CFML Based Function
		Class clazz = null;
		try {
			clazz = tlt.getTagClassDefinition().getClazz();
		}
		catch (Throwable t) {
			ExceptionUtil.rethrowIfNecessary(t);
		}

		if (clazz == CFTagCore.class) {
			PageContextImpl pci = (PageContextImpl) pc;
			boolean prior = pci.useSpecialMappings(true);
			try {
				return cfmlBasedTag(pc, tlt.getTagLib(), tlt);
			}
			finally {
				pci.useSpecialMappings(prior);
			}

		}
		return javaBasedTag(tlt.getTagLib(), tlt);
	}

	private static Struct cfmlBasedTag(PageContext pc, TagLib tld, TagLibTag tag) throws PageException {

		// Map attrs = tag.getAttributes();

		TagLibTagAttr attrFilename = tag.getAttribute("__filename");
		TagLibTagAttr attrMapping = tag.getAttribute("__mapping");
		TagLibTagAttr attrIsWeb = tag.getAttribute("__isweb");

		String filename = Caster.toString(attrFilename.getDefaultValue());
		String name = Caster.toString(attrFilename.getDefaultValue());
		String mapping = Caster.toString(attrMapping.getDefaultValue());
		if (StringUtil.isEmpty(mapping)) mapping = "mapping-tag";
		boolean isWeb = Caster.toBooleanValue(attrIsWeb.getDefaultValue());
		InitFile source = CFTagCore.createInitFile(pc, isWeb, filename, mapping);
		String callPath = ResourceUtil.removeExtension(source.getFilename(), source.getFilename());

		Component cfc = ComponentLoader.loadComponent(pc, source.getPageSource(), callPath, false, true);
		ComponentSpecificAccess cw = ComponentSpecificAccess.toComponentSpecificAccess(Component.ACCESS_PRIVATE, cfc);
		Struct metadata = Caster.toStruct(cw.get("metadata", null), null, false);

		Struct sct = new StructImpl(StructImpl.TYPE_LINKED);
		sct.set("nameSpaceSeperator", tld.getNameSpaceSeparator());
		sct.set("nameSpace", tld.getNameSpace());
		sct.set(KeyConstants._name, name.substring(0, name.lastIndexOf('.')));
		sct.set("hasNameAppendix", Boolean.FALSE);
		sct.set(KeyConstants._status, "implemented");
		sct.set(KeyConstants._type, "cfml");

		sct.set("bodyType", getBodyType(tag));
		sct.set("attrMin", Caster.toDouble(0));
		sct.set("attrMax", Caster.toDouble(0));
		sct.set("attributeCollection", getSupportAttributeCollection(tag));

		// TODO add support for script for cfml tags
		Struct scp = new StructImpl(StructImpl.TYPE_LINKED);
		sct.set(KeyConstants._script, scp);
		scp.set("rtexpr", Boolean.FALSE);
		scp.set(KeyConstants._type, "none");

		if (metadata != null) {
			sct.set(KeyConstants._description, metadata.get("hint", ""));
			sct.set("attributeType", metadata.get("attributeType", ""));
			sct.set("parseBody", Caster.toBoolean(metadata.get("parseBody", Boolean.FALSE), Boolean.FALSE));

			Struct _attrs = new StructImpl(StructImpl.TYPE_LINKED);
			sct.set(KeyConstants._attributes, _attrs);

			Struct srcAttrs = Caster.toStruct(metadata.get(KeyConstants._attributes, null), null, false);
			Struct src;
			if (srcAttrs != null) {
				// Key[] keys = srcAttrs.keys();
				Iterator<Entry<Key, Object>> it = srcAttrs.entryIterator();
				Entry<Key, Object> e;
				while (it.hasNext()) {
					e = it.next();
					src = Caster.toStruct(e.getValue(), null, false);
					if (Caster.toBooleanValue(src.get(KeyConstants._hidden, null), false)) continue;
					Struct _attr = new StructImpl(StructImpl.TYPE_LINKED);
					_attr.set(KeyConstants._status, "implemented");
					_attr.set(KeyConstants._description, src.get(KeyConstants._hint, ""));
					_attr.set(KeyConstants._type, src.get(KeyConstants._type, "any"));
					_attr.set(KeyConstants._required, Caster.toBoolean(src.get(KeyConstants._required, ""), null));
					_attr.set("scriptSupport", "none");
					_attrs.setEL(e.getKey().getLowerString(), _attr);

				}
			}
		}
		return sct;
	}

	private static Struct javaBasedTag(TagLib tld, TagLibTag tag) throws PageException {
		Struct sct = new StructImpl(StructImpl.TYPE_LINKED);
		sct.set("nameSpaceSeperator", tld.getNameSpaceSeparator());
		sct.set("nameSpace", tld.getNameSpace());
		sct.set(KeyConstants._name, tag.getName());
		sct.set(KeyConstants._description, tag.getDescription());
		sct.set(KeyConstants._status, TagLibFactory.toStatus(tag.getStatus()));

		sct.set("attributeType", getAttributeType(tag));
		sct.set("parseBody", Caster.toBoolean(tag.getParseBody()));
		sct.set("bodyType", getBodyType(tag));
		sct.set("attrMin", Caster.toDouble(tag.getMin()));
		sct.set("attrMax", Caster.toDouble(tag.getMax()));
		sct.set("hasNameAppendix", Caster.toBoolean(tag.hasAppendix()));
		sct.set("attributeCollection", getSupportAttributeCollection(tag));
		if (tag.getIntroduced() != null) sct.set(GetFunctionData.INTRODUCED, tag.getIntroduced().toString());

		// script
		TagLibTagScript script = tag.getScript();
		if (script != null) {
			Struct scp = new StructImpl(StructImpl.TYPE_LINKED);
			sct.set(KeyConstants._script, scp);
			scp.set("rtexpr", Caster.toBoolean(script.getRtexpr()));
			scp.set(KeyConstants._type, TagLibTagScript.toType(script.getType(), "none"));
			if (script.getType() == TagLibTagScript.TYPE_SINGLE) {
				TagLibTagAttr attr = script.getSingleAttr();
				if (attr != null) scp.set("singletype", attr.getScriptSupportAsString());
				else scp.set("singletype", "none");
			}
		}

		sct.set(KeyConstants._type, "java");

		Struct _args = new StructImpl(StructImpl.TYPE_LINKED);
		sct.set(KeyConstants._attributes, _args);

		// Map<String,TagLibTagAttr> atts = tag.getAttributes();
		Iterator<Entry<String, TagLibTagAttr>> it = tag.getAttributes().entrySet().iterator();
		Entry<String, TagLibTagAttr> e;
		while (it.hasNext()) {
			e = it.next();
			TagLibTagAttr attr = e.getValue();
			if (attr.getHidden()) continue;
			// for(int i=0;i<args.size();i++) {
			Struct _arg = new StructImpl(StructImpl.TYPE_LINKED);
			_arg.set(KeyConstants._status, TagLibFactory.toStatus(attr.getStatus()));
			_arg.set(KeyConstants._description, attr.getDescription());
			_arg.set(KeyConstants._type, attr.getType());
			if (attr.getAlias() != null) _arg.set(KeyConstants._alias, ListUtil.arrayToList(attr.getAlias(), ","));
			if (attr.getValues() != null) _arg.set(KeyConstants._values, Caster.toArray(attr.getValues()));
			if (attr.getDefaultValue() != null) _arg.set("defaultValue", attr.getDefaultValue());
			_arg.set(KeyConstants._required, attr.isRequired() ? Boolean.TRUE : Boolean.FALSE);
			_arg.set("scriptSupport", attr.getScriptSupportAsString());
			if (attr.getIntroduced() != null) _arg.set(GetFunctionData.INTRODUCED, attr.getIntroduced().toString());

			_args.setEL(attr.getName(), _arg);
		}
		return sct;
	}

	private static String getBodyType(TagLibTag tag) {
		if (!tag.getHasBody()) return "prohibited";
		if (tag.isBodyFree()) return "free";
		return "required";
	}

	private static String getAttributeType(TagLibTag tag) {
		int type = tag.getAttributeType();
		if (TagLibTag.ATTRIBUTE_TYPE_DYNAMIC == type) return "dynamic";
		if (TagLibTag.ATTRIBUTE_TYPE_FIXED == type) return "fixed";
		if (TagLibTag.ATTRIBUTE_TYPE_MIXED == type) return "mixed";
		if (TagLibTag.ATTRIBUTE_TYPE_NONAME == type) return "noname";

		return "fixed";
	}

	private static Boolean getSupportAttributeCollection(TagLibTag tag) {
		return !tag.hasTTTClassDefinition() ? Boolean.TRUE : Boolean.FALSE;
	}
}


package sjsonnet

import ujson.Value
import utest._

object FormatTests extends TestSuite{
  def check(fmt: String, jsonStr: String, expected: String) = {
    val json = ujson.read(jsonStr)
    val formatted = Format.format(fmt, Materializer.reverse(json), -1)(
      new FileScope(DummyPath("(unknown)"), Map.empty),
      new EvalScope{
        def extVars: Map[String, Value] = Map()
        def loadCachedSource(p: Path): Option[String] = None
        def wd: Path = DummyPath()
        def visitExpr(expr: Expr)(implicit scope: ValScope, fileScope: FileScope): Val = ???
        def materialize(v: Val): Value = ???
      }
    )
    assert(formatted == expected)
  }

  def tests = Tests{
    test("hash"){
      // #
      check("No format chars\n", """[]""", "No format chars\n")
      check("", """[]""", "")
      check("%#%", """[]""", "%")
      check("%# +05.3%", """[]""", "    %")
      check("%# -+05.3%", """[]""", "%    ")
      check("%##--#      +05.3%", """[]""", "%    ")
    }

    test("percent"){
      // %
      check("%%", """[]""", "%")
      check("%%%%", """[]""", "%%")
      check("%s%%", """["foo"]""", "foo%")
      check("%%%s", """["foo"]""", "%foo")
    }

    test("s") {
      // s
      check("%s", """["test"]""", "test")
      check("%s", """[true]""", "true")
      check("%5s", """["test"]""", " test")
    }
    test("c") {
      // c
      check("%c", """["a"]""", "a")
      check("%# +05.3c", """["a"]""", "    a")
      //    check("%c", """[std.codepoint("a")]""", "a")
    }
    test("d") {
      // d (also a quick test of i and u)
      check("thing-%d", """[10]""", "thing-10")
      //    check("thing-%#ld", """[10]""", "thing-10")
      check("thing-%d", """[-10]""", "thing--10")
      check("thing-%4d", """[10]""", "thing-  10")
      check("thing-%04d", """[10]""", "thing-0010")
      check("thing-% d", """[10]""", "thing- 10")
      check("thing-%- 4d", """[10]""", "thing- 10 ")
      check("thing-% d", """[-10]""", "thing--10")
      check("thing-%5.3d", """[10.3]""", "thing-  010")
      check("thing-%+5.3d", """[10.3]""", "thing- +010")
      check("thing-%+-5.3d", """[10.3]""", "thing-+010 ")
      check("thing-%-5.3d", """[10.3]""", "thing-010  ")
      check("thing-%#-5.3d", """[10.3]""", "thing-010  ")
      check("thing-%#-5.3i", """[10.3]""", "thing-010  ")
      check("thing-%#-5.3u", """[10.3]""", "thing-010  ")
    }
    test("o") {
      // o
      check("thing-%o", """[10]""", "thing-12")
      check("thing-%lo", """[10]""", "thing-12")
      check("thing-%o", """[-10]""", "thing--12")
      check("thing-%4o", """[10]""", "thing-  12")
      check("thing-%04o", """[10]""", "thing-0012")
      check("thing-% o", """[10]""", "thing- 12")
      check("thing-%- 4o", """[10]""", "thing- 12 ")
      check("thing-% o", """[-10]""", "thing--12")
      check("thing-%5.3o", """[10.3]""", "thing-  012")
      check("thing-%+5.3o", """[10.3]""", "thing- +012")
      check("thing-%+-5.3o", """[10.3]""", "thing-+012 ")
      check("thing-%-5.3o", """[10.3]""", "thing-012  ")
      check("thing-%#o", """[10]""", "thing-012")
      check("thing-%#lo", """[10]""", "thing-012")
      check("thing-%#o", """[-10]""", "thing--012")
      check("thing-%#4o", """[10]""", "thing- 012")
      check("thing-%#04o", """[10]""", "thing-0012")
      check("thing-%# o", """[10]""", "thing- 012")
      check("thing-%#- 4o", """[10]""", "thing- 012")
      check("thing-%# o", """[-10]""", "thing--012")
      check("thing-%#5.3o", """[10.3]""", "thing-  012")
      check("thing-%#+5.3o", """[10.3]""", "thing- +012")
      check("thing-%#+-5.3o", """[10.3]""", "thing-+012 ")
      check("thing-%#-5.3o", """[10.3]""", "thing-012  ")
    }
    test("x") {
      // x
      check("thing-%x", """[910]""", "thing-38e")
      check("thing-%lx", """[910]""", "thing-38e")
      check("thing-%x", """[-910]""", "thing--38e")
      check("thing-%5x", """[910]""", "thing-  38e")
      check("thing-%05x", """[910]""", "thing-0038e")
      check("thing-% x", """[910]""", "thing- 38e")
      check("thing-%- 5x", """[910]""", "thing- 38e ")
      check("thing-% x", """[-910]""", "thing--38e")
      check("thing-%6.4x", """[910.3]""", "thing-  038e")
      check("thing-%+6.4x", """[910.3]""", "thing- +038e")
      check("thing-%+-6.4x", """[910.3]""", "thing-+038e ")
      check("thing-%-6.4x", """[910.3]""", "thing-038e  ")
      check("thing-%#x", """[910]""", "thing-0x38e")
      check("thing-%#lx", """[910]""", "thing-0x38e")
      check("thing-%#x", """[-910]""", "thing--0x38e")
      check("thing-%#7x", """[910]""", "thing-  0x38e")
      check("thing-%#07x", """[910]""", "thing-0x0038e")
      check("thing-%# x", """[910]""", "thing- 0x38e")
      check("thing-%#- 7x", """[910]""", "thing- 0x38e ")
      check("thing-%# x", """[-910]""", "thing--0x38e")
      check("thing-%#8.4x", """[910.3]""", "thing-  0x038e")
      check("thing-%#+8.4x", """[910.3]""", "thing- +0x038e")
      check("thing-%#+-8.4x", """[910.3]""", "thing-+0x038e ")
      check("thing-%#-8.4x", """[910.3]""", "thing-0x038e  ")
    }
    test("X") {
      // X
      check("thing-%X", """[910]""", "thing-38E")
      check("thing-%lX", """[910]""", "thing-38E")
      check("thing-%X", """[-910]""", "thing--38E")
      check("thing-%5X", """[910]""", "thing-  38E")
      check("thing-%05X", """[910]""", "thing-0038E")
      check("thing-% X", """[910]""", "thing- 38E")
      check("thing-%- 5X", """[910]""", "thing- 38E ")
      check("thing-% X", """[-910]""", "thing--38E")
      check("thing-%6.4X", """[910.3]""", "thing-  038E")
      check("thing-%+6.4X", """[910.3]""", "thing- +038E")
      check("thing-%+-6.4X", """[910.3]""", "thing-+038E ")
      check("thing-%-6.4X", """[910.3]""", "thing-038E  ")
      check("thing-%#X", """[910]""", "thing-0X38E")
      check("thing-%#lX", """[910]""", "thing-0X38E")
      check("thing-%#X", """[-910]""", "thing--0X38E")
      check("thing-%#7X", """[910]""", "thing-  0X38E")
      check("thing-%#07X", """[910]""", "thing-0X0038E")
      check("thing-%# X", """[910]""", "thing- 0X38E")
      check("thing-%#- 7X", """[910]""", "thing- 0X38E ")
      check("thing-%# X", """[-910]""", "thing--0X38E")
      check("thing-%#8.4X", """[910.3]""", "thing-  0X038E")
      check("thing-%#+8.4X", """[910.3]""", "thing- +0X038E")
      check("thing-%#+-8.4X", """[910.3]""", "thing-+0X038E ")
      check("thing-%#-8.4X", """[910.3]""", "thing-0X038E  ")
    }

    test("e") {
      // e
      check("%e", """[910]""", "9.100000e+02")
      check("%.0le", """[910]""", "9e+02")
      check("%#e", """[-910]""", "-9.100000e+02")
      check("%16e", """[910]""", "    9.100000e+02")
      check("%016e", """[910]""", "00009.100000e+02")
      check("%016e", """[-910]""", "-0009.100000e+02")
      check("% e", """[910]""", " 9.100000e+02")
      check("%- 16e", """[910]""", " 9.100000e+02   ")
      check("% e", """[-910]""", "-9.100000e+02")
      check("%16.4e", """[910.3]""", "      9.1030e+02")
      check("%+16.4e", """[910.3]""", "     +9.1030e+02")
      check("%+-16.4e", """[910.3]""", "+9.1030e+02     ")
      check("%-16.4e", """[910.3]""", "9.1030e+02      ")
      check("%#.0e", """[910.3]""", "9.e+02")
      check("%#.0e", """[900]""", "9.e+02")
      check("%.3e", """[1000000001]""", "1.000e+09")
    }
    test("E") {
      // E
      check("%E", """[910]""", "9.100000E+02")
      check("%.0lE", """[910]""", "9E+02")
      check("%#E", """[-910]""", "-9.100000E+02")
      check("%16E", """[910]""", "    9.100000E+02")
      check("%016E", """[910]""", "00009.100000E+02")
      check("% E", """[910]""", " 9.100000E+02")
      check("%- 16E", """[910]""", " 9.100000E+02   ")
      check("% E", """[-910]""", "-9.100000E+02")
      check("%16.4E", """[910.3]""", "      9.1030E+02")
      check("%+16.4E", """[910.3]""", "     +9.1030E+02")
      check("%+-16.4E", """[910.3]""", "+9.1030E+02     ")
      check("%-16.4E", """[910.3]""", "9.1030E+02      ")
      check("%#.0E", """[910.3]""", "9.E+02")
      check("%#.0E", """[900]""", "9.E+02")
      check("%.3E", """[1000000001]""", "1.000E+09")
    }
    test("f") {
      // f
      check("%f", """[910]""", "910.000000")
      check("%f", """0""", "0.000000")
      check("%.0lf", """[910]""", "910")
      check("%#f", """[-910]""", "-910.000000")
      check("%12f", """[910]""", "  910.000000")
      check("%012f", """[910]""", "00910.000000")
      check("%012f", """[-910]""", "-0910.000000")
      check("% f", """[910]""", " 910.000000")
      check("%- 12f", """[910]""", " 910.000000 ")
      check("% f", """[-910]""", "-910.000000")
      check("%12.4f", """[910.3]""", "    910.3000")
      check("%+12.4f", """[910.3]""", "   +910.3000")
      check("%+-12.4f", """[910.3]""", "+910.3000   ")
      check("%-12.4f", """[910.3]""", "910.3000    ")
      check("%#.0f", """[910.3]""", "910.")
      check("%#.0f", """[910]""", "910.")
      check("%.3f", """[1000000001]""", "1000000001.000")
    }
    test("g") {
      // g
      check("%#.3g", """[1000000001]""", "1.00e+09")
      check("%#.3g", """[1100]""", "1.10e+03")
      check("%#.3g", """[1.1]""", "1.10")
      check("%#.5g", """[1000000001]""", "1.0000e+09")
      check("%#.5g", """[1100]""", "1100.0")
      check("%#.5g", """[110]""", "110.00")
      check("%#.5g", """[1.1]""", "1.1000")
      check("%#10.3g", """[1000000001]""", "  1.00e+09")
      check("%#10.3g", """[1100]""", "  1.10e+03")
      check("%#10.3g", """[1.1]""", "      1.10")
      check("%#10.5g", """[1000000001]""", "1.0000e+09")
      check("%#10.5g", """[1100]""", "    1100.0")
      check("%#10.5g", """[110]""", "    110.00")
      check("%#10.5g", """[1.1]""", "    1.1000")
      check("%.3g", """[1000000001]""", "1e+09")
      check("%.3g", """[1100]""", "1.1e+03")
      check("%.3g", """[1.1]""", "1.1")
      check("%.5g", """[1000000001]""", "1e+09")
      check("%.5g", """[1100]""", "1100")
      check("%.5g", """[110]""", "110")
      check("%.5g", """[1.1]""", "1.1")
      check("%10.3g", """[1000000001]""", "     1e+09")
      check("%10.3g", """[1100]""", "   1.1e+03")
      check("%10.3g", """[1.1]""", "       1.1")
      check("%10.5g", """[1000000001]""", "     1e+09")
      check("%10.5g", """[1100]""", "      1100")
      check("%10.5g", """[110]""", "       110")
      check("%10.5g", """[1.1]""", "       1.1")
    }
    test("G") {
      // G
      check("%#.3G", """[1000000001]""", "1.00E+09")
      check("%#.3G", """[1100]""", "1.10E+03")
      check("%#.3G", """[1.1]""", "1.10")
      check("%#.5G", """[1000000001]""", "1.0000E+09")
      check("%#.5G", """[1100]""", "1100.0")
      check("%#.5G", """[110]""", "110.00")
      check("%#.5G", """[1.1]""", "1.1000")
      check("%#10.3G", """[1000000001]""", "  1.00E+09")
      check("%#10.3G", """[1100]""", "  1.10E+03")
      check("%#10.3G", """[1.1]""", "      1.10")
      check("%#10.5G", """[1000000001]""", "1.0000E+09")
      check("%#10.5G", """[1100]""", "    1100.0")
      check("%#10.5G", """[110]""", "    110.00")
      check("%#10.5G", """[1.1]""", "    1.1000")
      check("%.3G", """[1000000001]""", "1E+09")
      check("%.3G", """[1100]""", "1.1E+03")
      check("%.3G", """[1.1]""", "1.1")
      check("%.5G", """[1000000001]""", "1E+09")
      check("%.5G", """[1100]""", "1100")
      check("%.5G", """[110]""", "110")
      check("%.5G", """[1.1]""", "1.1")
      check("%10.3G", """[1000000001]""", "     1E+09")
      check("%10.3G", """[1100]""", "   1.1E+03")
      check("%10.3G", """[1.1]""", "       1.1")
      check("%10.5G", """[1000000001]""", "     1E+09")
      check("%10.5G", """[1100]""", "      1100")
      check("%10.5G", """[110]""", "       110")
      check("%10.5G", """[1.1]""", "       1.1")
    }
    test("misc") {
      // lots together, also test % operator
      check("%s[%05d]-%2x%2x%2x%c", """["foo", 3991, 17, 18, 17, 100]""", "foo[03991]-111211d")

      // use of *
      //    check("%*d", """[10, 8]""", "%10d" % [8])
      //    check("%*.*f", """[10, 3, 1 / 3]""", "%10.3f" % [1 / 3])

      // Test mappings
      check(
        "%(name)s[%(id)05d]-%(a)2x%(b)2x%(c)2x%(x)c",
        """{ "name": "foo", "id": 3991, "a": 17, "b": 18, "c": 17, "x": 100 }""",
        "foo[03991]-111211d"
      )

      // apparently you can pass in positional parameters to named interpolations
      check("XXX%(ignored_lols)sXXX %s", """[1.1, 2]""", "XXX1.1XXX 2")
    }
  }
}


using System.Reflection;
using System.Runtime.CompilerServices;
using Android.App;

// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.

[assembly: AssemblyTitle ("NasaMissions.Droid")]
[assembly: AssemblyDescription ("")]
[assembly: AssemblyConfiguration ("")]
[assembly: AssemblyCompany ("")]
[assembly: AssemblyProduct ("")]
[assembly: AssemblyCopyright ("glennwester")]
[assembly: AssemblyTrademark ("")]
[assembly: AssemblyCulture ("")]

// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.

[assembly: AssemblyVersion ("1.0.0")]

// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.

//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]


# Applies BINLOG statements equivalent to a binlog generated with GTID_MODE=OFF
source include/have_binlog_format_mixed_or_row.inc;
source include/master-slave.inc;

SET @saved_slave_type_conversions = @@slave_type_conversions;
SET GLOBAL SLAVE_TYPE_CONVERSIONS = 'ALL_NON_LOSSY';

CREATE DATABASE track;
USE track;

SET sql_mode = 'NO_ENGINE_SUBSTITUTION';

CREATE TABLE `visits` (
  `visits_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `myid` varchar(32) NOT NULL DEFAULT '',
  `src` varchar(64) NOT NULL DEFAULT '',
  `ip` int(10) unsigned NOT NULL DEFAULT '0',
  `cc` char(2) NOT NULL DEFAULT '',
  `org` varchar(80) DEFAULT NULL,
  `ref` varchar(255) NOT NULL DEFAULT '',
  `time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `host` varchar(30) NOT NULL DEFAULT '',
  `entry` varchar(255) NOT NULL DEFAULT '',
  `visit_exit` varchar(255) NOT NULL DEFAULT '',
  `user_id` int(11) unsigned NOT NULL DEFAULT '0',
  `visit_start` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`visits_id`),
  KEY `ip` (`ip`),
  KEY `time` (`time`),
  KEY `user_id` (`user_id`)
) AUTO_INCREMENT=21293381 DEFAULT CHARSET=latin1;

SET sql_mode = default;

CREATE TABLE `visits_events` (
  `event_id` mediumint(8) unsigned NOT NULL DEFAULT '0',
  `visit_id` int(11) unsigned NOT NULL DEFAULT '0',
  `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `src` varchar(64) NOT NULL DEFAULT '',
  `data` varchar(255) NOT NULL DEFAULT '',
  `visits_events_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  PRIMARY KEY (`visits_events_id`),
  KEY `event_id` (`event_id`),
  KEY `visit_id` (`visit_id`),
  KEY `data` (`data`)
) AUTO_INCREMENT=33900731 DEFAULT CHARSET=latin1;

/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
--delimiter /*!*/;

# at 4 (0x4)
#071204 14:29:31 server id 1  end_log_pos 106
# Position  Timestamp   Type   Master ID        Size      Master Pos    Flags
#        4 3b 56 55 47   0f   01 00 00 00   66 00 00 00   6a 00 00 00   00 00
#       17 04 00 35 2e 31 2e 32 33  2d 72 63 2d 64 65 62 75 |..5.1.23.rc.debu|
#       27 67 2d 6c 6f 67 00 00 00  00 00 00 00 00 00 00 00 |g.log...........|
#       37 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 |................|
#       47 00 00 00 00 3b 56 55 47  13 38 0d 00 08 00 12 00 |.....VUG.8......|
#       57 04 04 04 04 12 00 00 53  00 04 1a 08 00 00 00 08 |.......S........|
#       67 08 08 02                                         |...|
#       Start: binlog v 4, server v 5.1.23-rc-debug-log created 071204 14:29:31 at startup

BINLOG '
O1ZVRw8BAAAAZgAAAGoAAAAAAAQANS4xLjIzLXJjLWRlYnVnLWxvZwAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAA7VlVHEzgNAAgAEgAEBAQEEgAAUwAEGggAAAAICAgC
'/*!*/;

# at 164170623
# at 164170679
#7918 3:59:2 server id 436  end_log_pos 164170679
#  9c90b7f 06 4d ef 46 13 b4 01 00  00 38 00 00 00 b7 0b c9 |.M.F.....8......|
#  9c90b8f 09 00 00 99 57 17 02 00  00 00 00 05 74 72 61 63 |....W.......trac|
#  9c90b9f 6b 00 0d 76 69  |k..vi|
# 	Table_map: `track`.`visits_events` mapped to number 35084185
#7918 3:59:2 server id 436  end_log_pos 164170769
#  9c90bb7 06 4d ef 46 17 b4 01 00  00 5a 00 00 00 11 0c c9 |.M.F.....Z......|
#  9c90bc7 09 10 00 99 57 17 02 00  00 01 00 06 ff c0 20 4e |....W..........N|
#  9c90bd7 00 be f5 43 01 06 4d ef  46 00 2b 44 6f 77 6e 6c |...C..M.F..Downl|
#  9c90be7 6f 61 64 73 2f 4d 79 53  51 4c 2d 34 2e 31 2f 6d |oads.MySQL.4.1.m|
#  9c90bf7 79 73 71 6c 2d 34 2e  |ysql.4.|
# 	Write_rows: table id 35084185 flags: STMT_END_F

BINLOG '
Bk3vRhO0AQAAOAAAALcLyQkAAJlXFwIAAAAABXRyYWNrAA12aXNpdHNfZXZlbnRzAAYJAwcPDwM=
Bk3vRhe0AQAAWgAAABEMyQkQAJlXFwIAAAEABv/AIE4AvvVDAQZN70YAK0Rvd25sb2Fkcy9NeVNR
TC00LjEvbXlzcWwtNC4xLjEyYS13aW4zMi56aXBPaAIC
'/*!*/;
# at 164170769
#7918 3:59:2 server id 436  end_log_pos 164170797
#  9c90c11 06 4d ef 46 05 b4 01 00  00  |.M.F.....|
# 	Intvar
SET INSERT_ID=21231039/*!*/;
# at 164170797
#7918 3:59:2 server id 436  end_log_pos 164171293
#  9c90c2d 06 4d ef 46 02 b4 01 00  00 f0 01 00 00 1d 0e c9 |.M.F............|
#  9c90c3d 09 10 00 28 80 af 01 00  00 00 00 05 00 00 1f 00 |................|
#  9c90c4d 00 00 40 00 00 01 00 00  00 00 00 00 00 00 06 03 |................|
#  9c90c5d 73 74 64 04 08 00 08 00  08 00 05 03 55 54 43 74 |std.........UTCt|
#  9c90c6d 72 61 63 6b 00 49 4e 53  45 52 54 20 49 4e 54 4f |rack.INSERT.INTO|
#  9c90c7d 20 76 69 73 69 74 73 20  28 6d 79 69 64 2c 20 75 |.visits..myid..u|
#  9c90c8d 73 65 72 5f 69 64 2c 20  73 72 63 2c 20 69 70 2c |ser.id..src..ip.|
#  9c90c9d 20 63 63 2c 20 6f 72 67  2c 20 72 65 66 2c 20 74 |.cc..org..ref..t|
#  9c90cad 69 6d 65 2c 20 68 6f 73  74 2c 20 65 6e 74 72 79 |ime..host..entry|
#  9c90cbd 2c 20 76 69 73 69 74 5f  65 78 69 74 2c 20 76 69 |..visit.exit..vi|
#  9c90ccd 73 69 74 5f 73 74 61 72  74 29 0a 09 09 09 56 41 |sit.start.....VA|
#  9c90cdd 4c 55 45 53 20 28 27 33  6d 33 6c 34 72 68 73 36 |LUES...3m3l4rhs6|
#  9c90ced 64 6f 30 73 66 35 70 31  69 39 6c 72 39 34 67 39 |do0sf5p1i9lr94g9|
#  9c90cfd 32 38 61 32 37 32 76 27  2c 20 27 27 2c 20 27 27 |28a272v.........|
#  9c90d0d 2c 20 49 4e 45 54 5f 41  54 4f 4e 28 27 37 31 2e |..INET.ATON..71.|
#  9c90d1d 31 31 38 2e 31 32 34 2e  39 38 27 29 2c 20 27 27 |118.124.98......|
#  9c90d2d 2c 20 27 27 2c 20 27 68  74 74 70 3a 2f 2f 64 65 |.......http...de|
#  9c90d3d 76 2e 6d 79 73 71 6c 2e  63 6f 6d 2f 64 6f 77 6e |v.mysql.com.down|
#  9c90d4d 6c 6f 61 64 73 2f 63 6f  6e 6e 65 63 74 6f 72 2f |loads.connector.|
#  9c90d5d 6a 2f 33 2e 30 2e 68 74  6d 6c 27 2c 20 4e 55 4c |j.3.0.html...NUL|
#  9c90d6d 4c 2c 20 27 64 65 76 2e  6d 79 73 71 6c 2e 63 6f |L...dev.mysql.co|
#  9c90d7d 6d 27 2c 20 27 2f 67 65  74 2f 44 6f 77 6e 6c 6f |m.....get.Downlo|
#  9c90d8d 61 64 73 2f 43 6f 6e 6e  65 63 74 6f 72 2d 4a 2f |ads.Connector.J.|
#  9c90d9d 6d 79 73 71 6c 2d 63 6f  6e 6e 65 63 74 6f 72 2d |mysql.connector.|
#  9c90dad 6a 61 76 61 2d 33 2e 30  2e 31 37 2d 67 61 2e 7a |java.3.0.17.ga.z|
#  9c90dbd 69 70 2f 66 72 6f 6d 2f  70 69 63 6b 27 2c 20 27 |ip.from.pick....|
#  9c90dcd 2f 67 65 74 2f 44 6f 77  6e 6c 6f 61 64 73 2f 43 |.get.Downloads.C|
#  9c90ddd 6f 6e 6e 65 63 74 6f 72  2d 4a 2f 6d 79 73 71 6c |onnector.J.mysql|
#  9c90ded 2d 63 6f 6e 6e 65 63 74  6f 72 2d 6a 61 76 61 2d |.connector.java.|
#  9c90dfd 33 2e 30 2e 31 37 2d 67  61 2e 7a 69 70  |3.0.17.ga.zip|
# 	Query	thread_id=28278824	exec_time=0	error_code=0
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
use track/*!*/;
SET TIMESTAMP=1190087942/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
SET @@session.time_zone='UTC'/*!*/;
INSERT INTO visits (myid, user_id, src, ip, cc, org, ref, time, host, entry, visit_exit, visit_start)
VALUES ('3m3l4rhs6do0sf5p1i9lr94g928a272v', '', '', INET_ATON('71.118.124.98'), '', '', 'http://dev.mysql.com/downloads/connector/j/3.0.html', CURRENT_TIMESTAMP , 'dev.mysql.com', '/get/Downloads/Connector-J/mysql-connector-java-3.0.17-ga.zip/from/pick', '/get/Downloads/Connector-J/mysql-connector-java-3.0.17-ga.zip/from/pick', NOW())/*!*/;
# at 164171293

--delimiter ;

--replace_column 8 CURRENT_TIMESTAMP
SELECT * FROM visits;
SELECT * FROM visits_events;

SET GLOBAL SLAVE_TYPE_CONVERSIONS = @saved_slave_type_conversions;

# Cleanup
DROP DATABASE track;
--source include/sync_slave_sql_with_master.inc

--echo End of 5.1 tests
--source include/rpl_end.inc


/*******************************************************************************
 * Copyright (c) 2008 Actuate Corporation.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *  Actuate Corporation  - initial API and implementation
 *******************************************************************************/

package org.eclipse.birt.report.engine.internal.index.v2;

import java.io.DataOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;

import org.eclipse.birt.core.archive.IDocArchiveWriter;
import org.eclipse.birt.core.archive.RAOutputStream;
import org.eclipse.birt.core.util.IOUtil;
import org.eclipse.birt.report.engine.content.impl.BookmarkContent;

public class IndexWriter implements IndexConstants
{

	public static int MAX_INLINE_INDEX_ENTRY = MAX_INLINE_ENTIRES;

	IDocArchiveWriter archive;
	String name;

	int type;
	HashMap<String, Object> inlineMap;
	BTreeMap btree;

	int entrySize;

	public IndexWriter( IDocArchiveWriter archive, String name )
	{
		this.archive = archive;
		this.name = name;
	}

	void add( String key, long value ) throws IOException
	{
		if ( inlineMap == null )
		{
			type = BTreeMap.LONG_VALUE;
			inlineMap = new HashMap<String, Object>( );
		}
		if ( inlineMap.size( ) >= MAX_INLINE_INDEX_ENTRY )
		{
			flushBtree( );
			inlineMap.clear( );
		}
		if ( !inlineMap.containsKey( key ) )
		{
			inlineMap.put( key, value );
			entrySize++;
		}
	}

	void add( String bookmark, BookmarkContent info ) throws IOException
	{
		if ( inlineMap == null )
		{
			type = BTreeMap.BOOKMARK_VALUE;
			inlineMap = new HashMap<String, Object>( );
		}
		if ( inlineMap.size( ) >= MAX_INLINE_INDEX_ENTRY )
		{
			flushBtree( );
			inlineMap.clear( );
		}
		if ( !inlineMap.containsKey( bookmark ) )
		{
			inlineMap.put( bookmark, info );
			entrySize++;
		}
	}

	void close( ) throws IOException
	{
		if ( btree == null )
		{
			RAOutputStream stream = archive.createOutputStream( name );
			try
			{
				DataOutputStream output = new DataOutputStream( stream );
				if ( type == BTreeMap.LONG_VALUE )
				{
					IOUtil.writeInt( output, VERSION_0 );
					IOUtil.writeInt( output, INLINE_MAP );
					IOUtil.writeInt( output, inlineMap.size( ) );
					for ( Map.Entry<String, Object> entry : inlineMap
							.entrySet( ) )
					{
						IOUtil.writeString( output, entry.getKey( ) );
						IOUtil.writeLong( output, (Long) entry.getValue( ) );
					}
				}
				else if ( type == BTreeMap.BOOKMARK_VALUE )
				{
					IOUtil.writeInt( output, VERSION_1 );
					IOUtil.writeInt( output, INLINE_MAP );
					IOUtil.writeInt( output, inlineMap.size( ) );
					for ( Map.Entry<String, Object> entry : inlineMap
							.entrySet( ) )
					{
						IOUtil.writeString( output, entry.getKey( ) );
						( (BookmarkContent) entry.getValue( ) )
								.writeStream( output );
					}
				}
				inlineMap.clear( );
			}
			finally
			{
				stream.close( );
			}
		}
		if ( btree != null )
		{
			flushBtree( );
			btree.close( );
		}
	}

	protected void flushBtree( ) throws IOException
	{
		if ( btree == null )
		{
			btree = BTreeMap.createTreeMap( archive, name, type );
		}
		ArrayList<Map.Entry<String, Object>> entries = new ArrayList<Map.Entry<String, Object>>(
				inlineMap.entrySet( ) );
		Collections.sort( entries,
				new Comparator<Map.Entry<String, Object>>( ) {

					public int compare( Entry<String, Object> o1,
							Entry<String, Object> o2 )
					{
						return o1.getKey( ).compareTo( o2.getKey( ) );
					}
				} );

		for ( Map.Entry<String, Object> entry : entries )
		{
			btree.insert( entry.getKey( ), entry.getValue( ) );
		}
	}
}


package lz4

import (
	"encoding/binary"
	"fmt"
	"io"

	"github.com/pierrec/lz4/internal/xxh32"
)

// Writer implements the LZ4 frame encoder.
type Writer struct {
	Header
	// Handler called when a block has been successfully written out.
	// It provides the number of bytes written.
	OnBlockDone func(size int)

	buf       [19]byte      // magic number(4) + header(flags(2)+[Size(8)+DictID(4)]+checksum(1)) does not exceed 19 bytes
	dst       io.Writer     // Destination.
	checksum  xxh32.XXHZero // Frame checksum.
	zdata     []byte        // Compressed data.
	data      []byte        // Data to be compressed.
	idx       int           // Index into data.
	hashtable [winSize]int  // Hash table used in CompressBlock().
}

// NewWriter returns a new LZ4 frame encoder.
// No access to the underlying io.Writer is performed.
// The supplied Header is checked at the first Write.
// It is ok to change it before the first Write but then not until a Reset() is performed.
func NewWriter(dst io.Writer) *Writer {
	return &Writer{dst: dst}
}

// writeHeader builds and writes the header (magic+header) to the underlying io.Writer.
func (z *Writer) writeHeader() error {
	// Default to 4Mb if BlockMaxSize is not set.
	if z.Header.BlockMaxSize == 0 {
		z.Header.BlockMaxSize = bsMapID[7]
	}
	// The only option that needs to be validated.
	bSize := z.Header.BlockMaxSize
	bSizeID, ok := bsMapValue[bSize]
	if !ok {
		return fmt.Errorf("lz4: invalid block max size: %d", bSize)
	}
	// Allocate the compressed/uncompressed buffers.
	// The compressed buffer cannot exceed the uncompressed one.
	if n := 2 * bSize; cap(z.zdata) < n {
		z.zdata = make([]byte, n, n)
	}
	z.data = z.zdata[:bSize]
	z.zdata = z.zdata[:cap(z.zdata)][bSize:]
	z.idx = 0

	// Size is optional.
	buf := z.buf[:]

	// Set the fixed size data: magic number, block max size and flags.
	binary.LittleEndian.PutUint32(buf[0:], frameMagic)
	flg := byte(Version << 6)
	flg |= 1 << 5 // No block dependency.
	if z.Header.BlockChecksum {
		flg |= 1 << 4
	}
	if z.Header.Size > 0 {
		flg |= 1 << 3
	}
	if !z.Header.NoChecksum {
		flg |= 1 << 2
	}
	buf[4] = flg
	buf[5] = bSizeID << 4

	// Current buffer size: magic(4) + flags(1) + block max size (1).
	n := 6
	// Optional items.
	if z.Header.Size > 0 {
		binary.LittleEndian.PutUint64(buf[n:], z.Header.Size)
		n += 8
	}

	// The header checksum includes the flags, block max size and optional Size.
	buf[n] = byte(xxh32.ChecksumZero(buf[4:n]) >> 8 & 0xFF)
	z.checksum.Reset()

	// Header ready, write it out.
	if _, err := z.dst.Write(buf[0 : n+1]); err != nil {
		return err
	}
	z.Header.done = true
	if debugFlag {
		debug("wrote header %v", z.Header)
	}

	return nil
}

// Write compresses data from the supplied buffer into the underlying io.Writer.
// Write does not return until the data has been written.
func (z *Writer) Write(buf []byte) (int, error) {
	if !z.Header.done {
		if err := z.writeHeader(); err != nil {
			return 0, err
		}
	}
	if debugFlag {
		debug("input buffer len=%d index=%d", len(buf), z.idx)
	}

	zn := len(z.data)
	var n int
	for len(buf) > 0 {
		if z.idx == 0 && len(buf) >= zn {
			// Avoid a copy as there is enough data for a block.
			if err := z.compressBlock(buf[:zn]); err != nil {
				return n, err
			}
			n += zn
			buf = buf[zn:]
			continue
		}
		// Accumulate the data to be compressed.
		m := copy(z.data[z.idx:], buf)
		n += m
		z.idx += m
		buf = buf[m:]
		if debugFlag {
			debug("%d bytes copied to buf, current index %d", n, z.idx)
		}

		if z.idx < len(z.data) {
			// Buffer not filled.
			if debugFlag {
				debug("need more data for compression")
			}
			return n, nil
		}

		// Buffer full.
		if err := z.compressBlock(z.data); err != nil {
			return n, err
		}
		z.idx = 0
	}

	return n, nil
}

// compressBlock compresses a block.
func (z *Writer) compressBlock(data []byte) error {
	if !z.NoChecksum {
		z.checksum.Write(data)
	}

	// The compressed block size cannot exceed the input's.
	var zn int
	var err error

	if level := z.Header.CompressionLevel; level != 0 {
		zn, err = CompressBlockHC(data, z.zdata, level)
	} else {
		zn, err = CompressBlock(data, z.zdata, z.hashtable[:])
	}

	var zdata []byte
	var bLen uint32
	if debugFlag {
		debug("block compression %d => %d", len(data), zn)
	}
	if err == nil && zn > 0 && zn < len(data) {
		// Compressible and compressed size smaller than uncompressed: ok!
		bLen = uint32(zn)
		zdata = z.zdata[:zn]
	} else {
		// Uncompressed block.
		bLen = uint32(len(data)) | compressedBlockFlag
		zdata = data
	}
	if debugFlag {
		debug("block compression to be written len=%d data len=%d", bLen, len(zdata))
	}

	// Write the block.
	if err := z.writeUint32(bLen); err != nil {
		return err
	}
	written, err := z.dst.Write(zdata)
	if err != nil {
		return err
	}
	if h := z.OnBlockDone; h != nil {
		h(written)
	}

	if !z.BlockChecksum {
		if debugFlag {
			debug("current frame checksum %x", z.checksum.Sum32())
		}
		return nil
	}
	checksum := xxh32.ChecksumZero(zdata)
	if debugFlag {
		debug("block checksum %x", checksum)
		defer func() { debug("current frame checksum %x", z.checksum.Sum32()) }()
	}
	return z.writeUint32(checksum)
}

// Flush flushes any pending compressed data to the underlying writer.
// Flush does not return until the data has been written.
// If the underlying writer returns an error, Flush returns that error.
func (z *Writer) Flush() error {
	if debugFlag {
		debug("flush with index %d", z.idx)
	}
	if z.idx == 0 {
		return nil
	}

	if err := z.compressBlock(z.data[:z.idx]); err != nil {
		return err
	}
	z.idx = 0
	return nil
}

// Close closes the Writer, flushing any unwritten data to the underlying io.Writer, but does not close the underlying io.Writer.
func (z *Writer) Close() error {
	if !z.Header.done {
		if err := z.writeHeader(); err != nil {
			return err
		}
	}
	if err := z.Flush(); err != nil {
		return err
	}

	if debugFlag {
		debug("writing last empty block")
	}
	if err := z.writeUint32(0); err != nil {
		return err
	}
	if z.NoChecksum {
		return nil
	}
	checksum := z.checksum.Sum32()
	if debugFlag {
		debug("stream checksum %x", checksum)
	}
	return z.writeUint32(checksum)
}

// Reset clears the state of the Writer z such that it is equivalent to its
// initial state from NewWriter, but instead writing to w.
// No access to the underlying io.Writer is performed.
func (z *Writer) Reset(w io.Writer) {
	z.Header = Header{}
	z.dst = w
	z.checksum.Reset()
	z.zdata = z.zdata[:0]
	z.data = z.data[:0]
	z.idx = 0
}

// writeUint32 writes a uint32 to the underlying writer.
func (z *Writer) writeUint32(x uint32) error {
	buf := z.buf[:4]
	binary.LittleEndian.PutUint32(buf, x)
	_, err := z.dst.Write(buf)
	return err
}


IPMI Firmware Update
====================

The process for updating firmware on the IBM Power9 Server (Boston) is documented below.

Collect the required files
--------------------------

Collect the following files and put them into a directory on the Management Node.

   * pUpdate utility
   * .pnor for host
   * .bin for bmc

If running ``rflash`` in Hierarchy, the firmware files/directory must be accessible on the Service Nodes.

Flash Firmware
--------------

Using xCAT ``rflash`` command, specify the directory containing the files with the ``-d`` option. ::

   rflash <noderange> -d /path-to-directory/

The ``pUpdate`` utility is leveraged in doing the firmware update against the target node and will do the following:

   * power off the host
   * flash bmc and reboot
   * flash host
   * power on the host

Monitor the progress for the nodes by looking at the files under ``/var/log/xcat/rflash/``.

Validatation
------------

Use the ``rinv`` command to validate firmware level: ::

    rinv <noderange> firm | xcoll