text:
include ../includes.make

# This file has been changed recently to support unusual
# libraries and the new system layout.

#SUBDIRS= spoon libz libpng
#HEADS=  spoon libz libpng

all:
	@echo "compile,clean,install,uninstall"

compile:  install_headers
#	$(MAKE) -s -C vfs compile;
#	$(MAKE) -s -C unix spoon;
	$(MAKE) -s -C libkernel compile;
	$(foreach dir,$(SUBDIRS), \
	   $(MAKE) -s -C $(dir) compile ; )

clean:
#	$(MAKE) -s -C vfs clean;
#	$(MAKE) -s -C unix clean;
	$(MAKE) -s -C libkernel clean;
	$(foreach dir,$(SUBDIRS), \
	   $(MAKE) -s -C $(dir) clean; )

install:
	mkdir -p $(LIBRARYPATH)
#	cp -f ./vfs/libvfs.a $(LIBRARYPATH)
#	cp -f ./unix/libunix.a $(LIBRARYPATH)
	cp -f ./libkernel/libkernel.a $(LIBRARYPATH)
	$(foreach dir,$(SUBDIRS), \
	   $(MAKE) -s -C $(dir) install; )

uninstall:
#	rm -rf /spoon/system/source/include/vfs
#	rm -rf /spoon/system/source/include/unix
	rm -rf /spoon/system/source/include/kernel
	rm -f /spoon/system/source/include/kernel.h
	rm -f $(LIBRARYPATH)/libunix.a
	rm -f $(LIBRARYPATH)/libkernel.a
	rm -f $(LIBRARYPATH)/libvfs.a
	$(foreach dir,$(SUBDIRS), \
	   $(MAKE) -s -C $(dir) uninstall; )

install_headers:
	mkdir -p /spoon/system/source/include/
#	cp -rf ./vfs/include/* /spoon/system/source/include/
#	cp -rf ./unix/include/* /spoon/system/source/include/
	cp -rf ./libkernel/include/* /spoon/system/source/include/
	$(foreach dir,$(HEADS), \
	   $(MAKE) -s -C $(dir) install_headers ; )

redpajama_set_name: RedPajamaGithub


text:
Installation
============

This is a guide on how to install BinPy on your computer.

Linux
-----

.. note::
   We support python 2.7, 3.2, 3.3 and 3.4. If you have any of these
   versions of python you are good to go.

**Dependencies**

We have two dependencies *setuptools* and *ipython*.
setuptools is used to facilitate installation and ipython
is used to provide a separate shell for BinPy.

To install dependencies

.. code-block:: sh

   sudo apt-get install setuptools ipython-notebook  # Debian OS

   sudo yum install python-ipython-notebook # Fedora or CenOS

**Install with pip**

To install pip on debian os

.. code-block:: sh

   sudo apt-get install python-pip

To install pip on fedora or cent os

.. code-block:: sh

   sudo yum -y install python-pip

To get the latest stable version of BinPy

.. code-block:: sh

   pip install BinPy

To get the development version of BinPy

.. code-block:: sh

   pip install https://github.com/BinPy/BinPy/zipball/master

**Install with git**

To install git on your system

.. code-block:: sh

   sudo apt-get install git  # Debian OS

   sudo yum install git-core  # Fedora or CentOS

To get the latest stable version of BinPy

.. code-block:: sh

   git clone https://github.com/BinPy/BinPy
   cd BinPy/
   sudo python setup.py install

To get the development version of BinPy

.. code-block:: sh

   git clone -b develop https://github.com/BinPy/BinPy
   cd BinPy/
   sudo python setup.py install

Windows
-------

To install dependencies(setuptools and ipython) you can check the following links.

* https://pypi.python.org/pypi/setuptools#windows-8-powershell
* http://ipython.org/install.html

To install BinPy on windows you can use our windows installer.

.. note::

   We generate windows installer only for stable release. To get the development version, you'll have to use git.

.. hint::

   If you have the `git cygwin` or you have the `github for windows`
   , you can clone the development branch of our repository from
   https://github.com/BinPy/BinPy.

To install it you will have to run the following commands

.. code-block:: sh

   cd BinPy/
   python setup.py install


text:
/**
 * Plugin Name: Ultimate Addons for Visual Composer
 * Plugin URI: http://codecanyon.net/item/ultimate-addons-for-visual-composer/6892199
 * Description: All in one plugin for your Visual Composer needs!
 * Version: 3.9.3
 * Author: BrainstormForce
 * Author URI: http://codecanyon.net/user/BrainstormForce
 */
/*===================================*/
/*Visual Composer 4.3.1 Compatibility*/
.smile_icon_list_wrap, .smile_icon_list_wrap *,
.aio-icon-component, .aio-icon-component *,
.ult_pricing_table_wrap, .ult_pricing_table_wrap *,
.ult-new-ib, .ult-new-ib *,
.align-icon, .align-icon *,
.flip-box-wrap, .flip-box-wrap *,
.banner-block, .banner-block *,
.uvc-heading, .uvc-heading *,
.ult-animation, .ult-animation *,
.ubtn, .ubtn *,
.stats-block, .stats-block *,
.smile-icon-timeline-wrap, .smile-icon-timeline-wrap *,
.ult-overlay, .ult-overlay *,
.ultimate-map-wrapper, .ultimate-map-wrapper *,
.ultimate-google-trends, .ultimate-google-trends *,
.ult_countdown, .ult_countdown  *,
.info-circle-wrapper, .info-circle-wrapper *,
.uavc-icons, .uavc-icons *,
.uavc-list-icon, .uavc-list-icon * {
	-webkit-box-sizing: border-box;
	-moz-box-sizing: border-box;
	box-sizing: border-box;
}

/* ======== Just Icon CSS =========== */
.aio-icon, .vc_row .aio-icon {
	display: inline-block;
	font-size: 32px;
	height: 2em;
	width: 2em;
	text-align: center;
	line-height: 2em;
	-moz-box-sizing: content-box !important;
	-webkit-box-sizing: content-box !important;
	box-sizing: content-box !important;
	/*overflow: hidden;*/
}
/*Icon without background*/
.aio-icon.none {
	display: inline-block;
	font-size: 32px;
	height: 1em;
	width: 1em;
	text-align: center;
	line-height: 1em;
	/*overflow: visible;*/
}
/*Circle Icon*/
.aio-icon.circle {
	border-radius: 50%;
}
/*Image Icon*/
.aio-icon-img  {
	display: block;
	font-size: 48px;
	width: 1em;
	max-width: 100%;
	-moz-box-sizing: content-box !important;
	-webkit-box-sizing: content-box !important;
	box-sizing: content-box !important;
	/*overflow:hidden;*/
}
/*Circle Image Icon*/
.aio-icon-img.uavc-circle  {
	width: 1em;
	min-height: 1em;
	background: rgba(214, 214, 214, 0.44);
	border-radius: 50%;
	padding: 0.5em;
}
/*Square Image Icon*/
.aio-icon-img.uavc-square  {
	width: 1em;
	min-height: 1em;
	background: rgba(214, 214, 214, 0.44);
	border-radius: 0;
	padding: 0.5em;
}
.aio-icon-img .img-icon
 {
	width: 1em;
	max-width: 100% !important;
	border-radius: 0 !important;
	box-shadow:none !important;
	display: block;
	font-size:inherit;
}
/*Icon Tooltip*/
.aio-tooltip {
	display: inline-block;
	text-align: center;
	width: auto;
	max-width: 100%;
}
/* ======== Icon List CSS =========== */
/*Common*/
.smile_icon_list_wrap,
.wpb_row .wpb_column .wpb_wrapper .smile_icon_list_wrap  {
	margin-bottom: 30px;
}
.smile_icon_list {
	list-style: none !important;
	padding: 0 !important;
	margin-left: 0 !important;
	margin-right: 0 !important;
}
.smile_icon_list li.icon_list_item {
	padding: 0 !important;
	list-style: none !important;
	clear: both !important;
	position: relative !important;
	min-height: 1em !important;
	margin: 0 0 30px !important;
	line-height: 100%;
	overflow: visible;
}
.smile_icon_list li.icon_list_item:last-child {
	margin: 0 !important;
}
a.ulimate-info-list-link {
	position: absolute;
	top: 0;
	left: 0;
	display: block;
	z-index: 9;
	width: 100%;
	height: 100%;
}
.smile_icon_list li .icon_list_icon {
	font-size: 24px;
	width: 3em;
	height: 3em;
	line-height: 3em;
	text-align: center;
	float: left;
	background: #FFF;
	z-index: 9;
	position: relative;
	-moz-box-sizing: content-box !important;
	-webkit-box-sizing: content-box !important;
	box-sizing: content-box !important;
	/*overflow: hidden;*/
}
.smile_icon_list .list-img-icon {
	display: block;
	margin: 0 auto;
	max-height: 100% !important;
	max-width: 100% !important;
	border-radius: 0 !important;
	box-shadow: none !important;
}
.smile_icon_list li .icon_description h3  {
	font-size: 17px;
	line-height: 1.846153846;
	font-weight: bold;
	margin-top: 0;
	margin-bottom: 0em;
	clear: none !important;
}
.smile_icon_list li .icon_description h3 a {
	text-decoration:none;
}
.smile_icon_list li .icon_description p {
	font-size: inherit !important;
	font-weight: inherit !important;
	font-style: inherit !important;
	line-height: inherit !important;
	color: inherit !important;
}
.smile_icon_list li .icon_description div.icon_description_text {
	font-family: inherit;
	font-size: inherit;
	font-weight: inherit;
	color: inherit;
}
.smile_icon_list li .icon_description span.icon_description_text {
	margin: 0;
	padding: 0;
	border: 0;
	vertical-align: baseline;
	font-size: 14px;
	line-height: 1.714285714;
	display: block;
}
.smile_icon_list li .icon_list_connector {
	height: 100%;
	position: absolute;
	top: 1em;
	z-index: 1;
}
.smile_icon_list li:last-child .icon_list_connector {
	display: none;
}
.smile_icon_list.no_bg .icon_list_icon {
    /*background: rgba(0,0,0,0);*/
	border: 2px solid #0183CC;
	color: #0183CC;
}
.smile_icon_list.square .icon_list_icon {
	/*border-radius: 5px;*/
	border-color: inherit;
}
.smile_icon_list.circle .icon_list_icon {
	border-radius: 50%;
	border-color: inherit;
	overflow: hidden;
}
.smile_icon_list.with_bg .icon_list_icon {
	background: #0183CC;
	color: #fff;
}
/*left*/
.smile_icon_list.left li .icon_list_connector {
	left: 0.5em;
	border-right-width: 1px;
	border-right-style: dashed;
}
.smile_icon_list.left li .icon_description {
	margin-left: 1em;
	padding-left: 25px;
}
/*right*/
.smile_icon_list.right {
	text-align: right;
}
.smile_icon_list.right li .icon_list_icon {
	float: right;
	position: relative;
}
.smile_icon_list.right li .icon_list_connector {
	right: 0.5em;
	border-left-width: 1px;
	border-left-style: dashed;
}
.smile_icon_list.right li .icon_description {
	margin-right: 1em;
	padding-right: 25px;
}
/*top*/
.smile_icon_list.top,
.smile_icon_list.top:before,
.smile_icon_list.top:after {
	content: " ";
	display: table;
	-webkit-box-sizing: border-box;
	-moz-box-sizing: border-box;
	box-sizing: border-box;
}
.smile_icon_list.top {
	display: block;
}
.smile_icon_list.top li {
	display: table-cell;
	width: 1%;
	float: none;
	position: relative;
	-webkit-box-sizing: border-box;
	-moz-box-sizing: border-box;
	box-sizing: border-box;
}
.smile_icon_list.top li .icon_list_icon {
	margin: 0 auto;
	float: none;
}
.smile_icon_list.top li .icon_description {
	text-align: center;
	margin: 15px;
	padding-bottom:0;
}
.smile_icon_list.top li .icon_list_connector {
	position: absolute;
	top: 0.5em;
	left: 50%;
	width: 100%;
	height: 10px;
	border-top-width: 1px;
	border-top-style: dashed;
	margin-left: 0.5em;
}

.info-wrapper .smile_icon_list li .icon_description p {
	font-size: 13px !important;
	font-weight: normal !important;
	line-height: 1.64em !important;
	color: inherit !important;
}
@media only screen and (max-width : 768px) {
	.smile_icon_list_wrap .smile_icon_list.top {
		display: inline-block;
		width: 100%;
	}
	.smile_icon_list.top li.icon_list_item {
		display: block;
		width: 100%;
		float: left;
	}
	.smile_icon_list.top li .icon_list_connector {
		display: none;
	}
}
/*Hexagonal*/
.hexagon li .icon_list_icon:before {
	content: "";
	position: absolute;
	top: -1em;
	left: 0;
	border-left: 1.5em solid rgba(0, 0, 0, 0);
	border-right: 1.5em solid rgba(0, 0, 0, 0);
	border-bottom: 1em solid;
	border-bottom-color: inherit !important;
}
.hexagon li .icon_list_icon {
	width: 3em !important;
	height: 1.5em !important;
	line-height: 1.5em !important;
	background: #0183CC;
	border-color: #0183CC;
	color: #FFF;
	position: absolute;
	top: 1em;
	overflow:inherit;
}
.hexagon li .icon_list_icon:after {
	content: "";
	position: absolute;
	bottom: -1em;
	left: 0;
	border-left: 1.5em solid rgba(0, 0, 0, 0);
	border-right: 1.5em solid rgba(0, 0, 0, 0);
	border-top: 1em solid;
	border-top-color: inherit !important;
}
.smile_icon_list.top.hexagon .icon_list_icon {
	position: relative;
	margin-bottom: 2em;
}
.smile_icon_list.top.hexagon .icon_list_connector {
	top: 0.55em;
}
/*Genesis Compatibility*/
.full-width-content.wpb-js-composer .site-inner {
	overflow: visible !important;
}
/*icon .circle theme depened fix*/
.smile_icon_list.circle {
	float:none;
	border:0;
	width:auto;
	margin:0;
	cursor: inherit;
}
/*Animation Block Transition*/
.ult-animation.ult-animate-viewport {
	-webkit-transition: opacity 900ms linear;
	-moz-transition: opacity 900ms linear;
	transition: opacity 900ms linear;
}
/*==============================*/
/*List Icon*/
.uavc-list-icon ul {
	list-style: none !important;
	padding: 0 !important;
	margin: 0 0 30px !important;
	position: relative !important;
}
.uavc-list-icon ul:last-child {
	margin: 0 !important;
}
.uavc-list-icon li {
	padding: 0 !important;
	margin: 0 !important;
	list-style: none !important;
	clear: both !important;
	line-height: 1.6em;
	overflow: visible;
}
.uavc-list-content {
	display: table;
	width: 100%;
	margin-bottom: 7px;
}
.uavc-list-content .aio-icon{
	display:inline-block;
	padding: 0;
	margin: 0;
}
.uavc-list-content span.uavc-list-desc {
	display: table-cell;
	padding: 0;
	margin: 0;
	vertical-align: middle;
	width:100%;
}
/*Icons*/
.uavc-icons,
.wpb_column .wpb_wrapper .uavc-icons {
	display: block;
	margin-bottom: 15px;
	line-height: 1;
}
.uavc-icons:last-child,
.wpb_column .wpb_wrapper .uavc-icons:last-child {
margin-bottom: 0;
}
.uavc-icons-left.uavc-icons {
	text-align: left;
}
.uavc-icons-center.uavc-icons {
	text-align: center;
}
.uavc-icons-right.uavc-icons {
	text-align: right;
}

/*U-Design Theme Compatibility*/
.aio-icon i {
	line-height: inherit;
}

.ultimate_google_map img{max-width:initial !important}


text:
/**
 * @file
 * WebP encoder using libwebp (WebPEncode API)
 */

#include "libwebpenc_common.h"

typedef LibWebPContextCommon LibWebPContext;

static av_cold int libwebp_encode_init(AVCodecContext *avctx)
{
    return ff_libwebp_encode_init_common(avctx);
}

static int libwebp_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
                                const AVFrame *frame, int *got_packet)
{
    LibWebPContext *s  = avctx->priv_data;
    WebPPicture *pic = NULL;
    AVFrame *alt_frame = NULL;
    WebPMemoryWriter mw = { 0 };

    int ret = ff_libwebp_get_frame(avctx, s, frame, &alt_frame, &pic);
    if (ret < 0)
        goto end;

    WebPMemoryWriterInit(&mw);
    pic->custom_ptr = &mw;
    pic->writer     = WebPMemoryWrite;

    ret = WebPEncode(&s->config, pic);
    if (!ret) {
        av_log(avctx, AV_LOG_ERROR, "WebPEncode() failed with error: %d\n",
               pic->error_code);
        ret = ff_libwebp_error_to_averror(pic->error_code);
        goto end;
    }

    ret = ff_alloc_packet2(avctx, pkt, mw.size, mw.size);
    if (ret < 0)
        goto end;
    memcpy(pkt->data, mw.mem, mw.size);

    pkt->flags |= AV_PKT_FLAG_KEY;
    *got_packet = 1;

end:
#if (WEBP_ENCODER_ABI_VERSION > 0x0203)
    WebPMemoryWriterClear(&mw);
#else
    free(mw.mem); /* must use free() according to libwebp documentation */
#endif
    WebPPictureFree(pic);
    av_freep(&pic);
    av_frame_free(&alt_frame);

    return ret;
}

static int libwebp_encode_close(AVCodecContext *avctx)
{
    LibWebPContextCommon *s  = avctx->priv_data;
    av_frame_free(&s->ref);

    return 0;
}

static const AVClass class = {
    .class_name = "libwebp",
    .item_name  = av_default_item_name,
    .option     = options,
    .version    = LIBAVUTIL_VERSION_INT,
};

AVCodec ff_libwebp_encoder = {
    .name           = "libwebp",
    .long_name      = NULL_IF_CONFIG_SMALL("libwebp WebP image"),
    .type           = AVMEDIA_TYPE_VIDEO,
    .id             = AV_CODEC_ID_WEBP,
    .priv_data_size = sizeof(LibWebPContext),
    .init           = libwebp_encode_init,
    .encode2        = libwebp_encode_frame,
    .close          = libwebp_encode_close,
    .pix_fmts       = (const enum AVPixelFormat[]) {
        AV_PIX_FMT_RGB32,
        AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUVA420P,
        AV_PIX_FMT_NONE
    },
    .priv_class     = &class,
    .defaults       = libwebp_defaults,
    .wrapper_name   = "libwebp",
};


text:
DumpVTable
==========

This program generates a Python script to give public interface names in an ActiveX file to the IDA Pro database file (IDB).

Usage
-----------------
    >DumpVTable.exe
    usage:
        >this.exe target_file out_file [-r] [-y]

        target_file: A path of a target COM file.
        out_file: A file name of an output Python script.
        -r: Register a target file as COM during analysis.
            It may require Administrators privilege.
        -y: Do not show a warning message.

As an example, assuming that you are going to analyze Flash10zr.ocx with IDA Pro.

First, you can use this tool to create a Python script (out.py).

    >DumpVTable.exe C:\Windows\SysWOW64\Macromed\Flash\Flash10zr.ocx out.py

Next, you can open the target file with IDA Pro.

![Before](/img/before.png)

Then, you apply the script to the IDB from [File] > [Script file] menu on IDA Pro.

![After](/img/after.png)

That's it. Have fun!

Note
-----------------
- When you see the error message 'ERROR: CoCreateInstance returned 80040154', you will need to register the target file with a command line option '-r'.
- When you see the error message 'ERROR: File mismatch [<path>]', you will need to specify <path> as a target file.

Supported Platforms
-----------------
- Windows 10 x64
- IDA Pro 7.3 and later
- x86/x64 bit both supported

License
-----------------
This software is released under the MIT License, see LICENSE.


text:
Github site for personal projects.

It uses react router for navigation but refreshing doesn't work on github.

Cloned from the excellent React starter kit [here](https://github.com/davezuko/react-redux-starter-kit)


text:
SYNONYM

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

#### Published in
Beitr. Kenntn. Pilze Mitteleur. 7: 71 (1991)

#### Original name
Tricholoma glaucocanum Bres., 1881

### Remarks
null


text:
<!DOCTYPE html>

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    <title>Creating Your Own Hand Prefabs — Leap Motion Java SDK v3.1 documentation</title>

    <link rel="stylesheet" href="../../cpp/_static/bootstrap-3.0.0/css/documentation-bundle.1471552333.css" type="text/css" />

    <link rel="top" title="Leap Motion Java SDK v3.1 documentation" href="../index.html" />

<link rel="stylesheet" href="/assets/standalone-header.css?r9" type="text/css" />

<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'>
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1'>
<meta name="apple-mobile-web-app-capable" content="yes">

            Developer Portal

      <button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">

      </button>

What's new

Getting Started

Documentation

 Examples

 Blog

 Community

      JavaScript

      Unity

      C#

      C++

      Java

      Python

      Objective-C

      Unreal

<form class="navbar-form" action="../search.html" method="get" onsubmit="storeThisPage()">

  <input type="search" results="5" name="q" class="form-control" placeholder="Search" />

  <input type="hidden" name="check_keywords" value="yes" />
  <input type="hidden" name="area" value="default" />
</form>

Creating Your Own Hand Prefabs¶

You can make your own hand prefabs similar to those include in the core asset package. This allows you to create your own graphics and customized behaviors based on the existing scripts.

Discrete Hand Prefabs¶

“Discrete” hands mean that each part of the hand is a separate game object with its own position and orientation. In the core asset package, the robot hands and the minimal hands are examples of discrete hands. Creating the prefabs is a bit of an involved process. The following discussion walks through the steps using Unity built-in primitive objects (cylinders and spheres).

A prefab hand created using Unity primitives

A couple of points before we get started:

Each graphics primitive is placed inside an empty game object. The hand and finger scripts update the transform of this empty game object. The local transform of the primitive object itself orients and sizes the object relative to this empty parent.

Remove any colliders from the parts of the graphics hand. Otherwise, these will make the colliders in the RigidHand bounce around.

Generally, you don’t need parts for both the joints and the bones. They aren’t really independent of each other, so you can use which ever makes more sense for your hand model. In this tutorial, we will add both just to show how it is done.

Similarly, your model might not need both metacarpal bones and a palm. The metacarpal bones are enclosed in the palm and don’t move independently. This tutorial includes both.

Use real-world sizes for the hand model. The hand and finger scripts do not resize the parts individually. The overall scale is set by scale assigned to the LeapHandController object, but this also affects the range of motion of the hand. The size of the hand at 1:1 should be that of a typical human hand (and remember that the standard unit in Unity is 1 meter).

Very abstract and symmetrical designs, like the one created in this tutorial, can use the same prefab for both right and left hands. Most models, however, will need a different prefab for each hand in order to adjust the local transforms of the hand components properly.

First, we will create a prefab for the finger and then use that in constructing the hand prefab. To get started, create a new Unity project and import the Leap Motion asset package.

Create the Finger Prefab¶

To create the finger prefab:

Create a scene for the construction.

Add an empty game object, named KnobbyFinger, to the scene.

Create the bones:

Add an empty game object to KnobbyFinger. Name it Metacarpal.

Add a Cylinder to Metacarpal, name it Tube. When creating your own hands, replace the cylinder with your own graphics object or objects.

Remove the collider component — otherwise the RigidHand colliders bounce off it.

Set the x rotation to 90.

It helps to be in top view to align the graphics object to the finger. In top view, the direction from base of finger (or hand) toward the tip is toward the top of the screen (+z). The x axis corresponds to the left/right direction (+x is right). The Unity cylinder primitive is in the wrong orientation. Rotating it 90 degrees aligns it with the finger axis. This rotation has to be done on the Tube transform since the Metacarpal transform is controlled by the finger script. Your own graphics objects might need a different rotation.

Set both the Tube x and z scale to .003 (3 millimeters). This hand created in this tutorial intentionally uses extra-skinny bones. Real fingers are fatter.

Set the Tube y scale to .034 (34mm). The y scale value determines length of finger segment.

The sizes must use real-world hand sizes, converted into meters. The length (y scale) is half the target length of 68mm because the primitive cylinder is 2 units tall. Thus we have to scale down by an additional 50%. Note that these numbers aren't magic. Feel free to experiment.

Duplicate Metacarpal, name it Proximal, and set the y scale of its Tube to .02.

Duplicate Metacarpal again, name it Intermediate, and set the y scale of its Tube to .01.

Duplicate Metacarpal again, name it Distal, and set the y scale of its Tube to .007.

All these bones must be children of the KnobbyFinger object.

Create the Joints:

Remember, you don't necessarily need both bones and joints.

Add an empty game object to KnobbyFinger. Name it MetacarpophalangealJoint.

Add a Sphere primitive to the joint. Name it Knob.

Remove the collider component from Knob.

Set all the scale values of Knob to .01 (1cm).

Duplicate MetacarpophalangealJoint and rename it ProximalinterphalangealJoint.

Duplicate MetacarpophalangealJoint again and rename it DistalinterphalangealJoint.

Add the SkeletalFinger script component to the KnobbyFinger object

Drag each of the bones and joints you just created to corresponding the bone and joint slots in the script.

The bones and joints must be in the following slots in the SkeletalFinger Bones and Joints arrays:

Bones:

0 - Metacarpal

1 - Proximal

2 - Intermediate

3 - Distal

Joints:

0 - MetacarpohalangealJoint

1 - ProximalinterphalangealJoint

2 - DistalphalangealJoint

Make the KnobbyFinger into a prefab by dragging it into the Asset folder from the Hierarchy panel.

Create the Hand Prefab¶

To create the hand prefab (after you have created the finger prefab):

Create an empty game object. Name it KnobbyHand.

Add the SkeletalHand script component to KnobbyHand.

Set the Handedness property of the hand script to “Left.” This will need to be changed for the right hand prefab when you add it to the hand pool in the scene – or you can create unique prefabs for the left and right hands. For now, we want to make the prefab first; then we can copy it for the right hand.

Drag 5 KnobyFinger prefabs into the hand. Name them Thumb, Index, Middle, Ring, and Pinky.

For each finger, set the Finger type in the SkeletalFinger script component to the matching type.

Drag the fingers to their correct slot in the SkeletalHand script component on KnobbyHand.

Finger element order:

0 - Thumb

1 - Index

2 - Middle

3 - Ring

4 - Pinky

The Thumb is special in that it doesn't have a real Metacarpal. Edit Thumb and remove the bone from element 0 in the bone array (leave as None). Delete the Metacarpal game object child of the thumb object in KnobbyHand.

Add the palm:

You can leave the slots for palm, wrist and forearm blank (None) if you don't have graphics for them. The palm is also represented by RigidHand, so if you don’t use a palm, you might also want to modify a copy of RigidHand to remove the rigid body and collider for the palm.

Add an empty game object to KnobbyHand. Name it Palm.

Add a Cylinder primitive to Palm. Name it Disc.

Remove the Collider component.

Set the Disc transform scale to (.085, .0015, .085). (Again, these numbers aren't magic, feel free to experiment).

Drag Palm to the Palm slot in the SkeletalHand script.

Add the wrist:

Add an empty game object to KnobbyHand. Name it Wrist.

Add a Sphere primitive to Wrist. Name it Ball.

Remove the Collider.

Set the Ball transform scale to (.03, .03, .03).

Drag Wrist to the WristJoint slot in the SkeletalHand script.

Add the arm:

Add an empty game object to KnobbyHand. Name it Arm.

Add a Cylinder primitive to Arm. Name it Rod.

Remove the Collider.

Set the Rod transform x rotation to 90.

Set the Rod transform scale to (.02, .12, .02).

Drag Arm to the Forearm slot in the SkeletalHand script.

The KnobbyHand hierarchy should look like the following:

Drag the KnobbyHand to the Asset folder to create a prefab. Rename the prefab, KnobbyHand-Left.

Drag the KnobbyHand to the Asset folder a second tme to create another prefab. Rename this prefab, KnobbyHand-Right.

Select the KnobbyHand-Right prefab in the project panel. In the Inspector, chang its Handedness (chirality) setting to “Right.”

Test Your new Hand¶

To test the hands:

Start with the Leap_Hands_Demo_Desktop, which already has a LeapHandController setup.

Drag your KnobbyHand-Left and KnobbyHand-Right prefabs into the scene under the Camera>HandModels game object.

You can delete the two CapsuleHand prefabs.

4. Select the LeapHandController game object and locate its Hand Pool component.
3. Drag KnobbyHand-Left to the Left Graphics_Hands model slot (replacing the CapsuleHands-L model).
4. Drag KnobbyHand-Right to the Right Graphics_Hands Model slot (replacing the CapsuleHands-R model).
6. Play the level and observe the hands.

Creating hands is a complicated process and there is a lot that can go wrong. Use the hierarchy view to find the parts of the "live" hand, if one isn't in the right place. You can pause the game to freeze the live hand so that you can inspect its properties more closely.

If the RigidHand components, visible in scene view, are jittery or bouncing, make sure that you removed all the collider components from the graphics hand parts.

If fingers overlap and move under control of a single real finger, check the finger type settings in the SkeletalFinger script components of the fingers.

If the hand parts are all munged together in a big blob, the primitive scale values are set too large. Remember that in Unity, 1 is 1 meter. A typical hand width is 8.5 centimeters, or .085 in the Unity transform scale value. To make hands larger in a game, scale up the LeapHandController object.

Java Docs (v3.1)

API Overview

Guidelines

Application Development

Using the Tracking API

API Reference

Appendices


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:gravity="center"
              android:orientation="vertical">

    <TextView
        android:id="@+id/txt_alert_button"
        android:layout_width="200dp"
        android:layout_height="200dp"
        android:background="@drawable/textview"
        android:gravity="center"
        android:text="@string/alert"
        android:textColor="#FFFFFF"
        android:textSize="30sp"
        android:textStyle="bold"/>

    <TextView
        android:id="@+id/txt_carrier_one"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="16dp"
        android:padding="8dp"
        android:textColor="#000000"
        android:textSize="15sp"/>

    <TextView
        android:id="@+id/txt_carrier_two"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="16dp"
        android:padding="8dp"
        android:textColor="#000000"
        android:textSize="15sp"/>

</LinearLayout>


text:
import csv
import os
import sys,re

homedir = os.path.expanduser("~")
csvfile = os.path.join(homedir, "2013-03-25_write.csv")

print csvfile

#pathtocsv = os.path.join(os.path.expanduser('~'), csvfile)

#with open(csvfile, 'rb') as f:
#    readfile = csv.reader(f, delimiter=",")
#    for row in readfile:
#        print row

pattern_url = r'/^(((http|https|ftp):\/\/)?([[a-zA-Z0-9]\-\.])+(\.)([[a-zA-Z0-9]]){2,4}([[a-zA-Z0-9]\/+=%&_\.~?\-]*))*$/'

pattern_exiftag = r'([A-Z]\w+?:[A-Za-z]\w+?)'

#pattern_exifval = r'([A-Za-z0-9]*?\s*?\W+?)'

pattern_exifval = r'([A-Z0-9]\w+?\s?[A-Za-z]+\')'
regex_exif = re.compile(pattern_exiftag + "=" + pattern_exifval)
pattern = re.compile(r'(\d+?[/|-]+?\d+?[/|-]+?\d+?)')

f = open(csvfile, 'rb')

string = re.findall(pattern, f.read())
sorted(string)
print list(string)
#for f in listdir(dir_homedir):
#     fpath = os.path.abspath(f)
#     re.findall(pattern, fpath)

querystr = 'http://www.bluefly.com/_/N-1aaq/Ntt-{style}/Nrk-all/Nrr-all/Nrt-{style}/Ntk-all/Ntx-mode+matchallpartial/search.fly?init=y'.format(style=colorstyle)

startDateFrom=&startDateTo=&colorGroup=&searchBrand=&eventId=&productStatus=&merchantStatus=&inventory=&active=&store=&styleNumbers=324162301&vendorStyleNumbers=&shortName=&poHdrs=&searchCategory=&jdaCategory=&Submit=Search&exportToExcel=false&exportImages=false&solrQuery=&currentPage=0

import asyncore, socket

class HTTPClient(asyncore.dispatcher):

    def __init__(self, host, path):
        asyncore.dispatcher.__init__(self)
        self.create_socket(socket.AF_INET, socket.SOCK_STREAM)
        self.connect( (host, 80) )
        self.buffer = 'GET %s HTTP/1.0\r\n\r\n' % path

    def handle_connect(self):
        pass

    def handle_close(self):
        self.close()

    def handle_read(self):
        print self.recv(8192)

    def writable(self):
        return (len(self.buffer) > 0)

    def handle_write(self):
        sent = self.send(self.buffer)
        self.buffer = self.buffer[sent:]

#client = HTTPClient('www.python.org', '/')
#asyncore.loop()

import asyncore
import socket

class EchoHandler(asyncore.dispatcher_with_send):

    def handle_read(self):
        data = self.recv(8192)
        if data:
            self.send(data)

class EchoServer(asyncore.dispatcher):

    def __init__(self, host, port):
        asyncore.dispatcher.__init__(self)
        self.create_socket(socket.AF_INET, socket.SOCK_STREAM)
        self.set_reuse_addr()
        self.bind((host, port))
        self.listen(5)

    def handle_accept(self):
        pair = self.accept()
        if pair is not None:
            sock, addr = pair
            print 'Incoming connection from %s' % repr(addr)
            handler = EchoHandler(sock)

#server = EchoServer('localhost', 8080)
#asyncore.loop()

class http_request_handler(asynchat.async_chat):

    def __init__(self, sock, addr, sessions, log):
        asynchat.async_chat.__init__(self, sock=sock)
        self.addr = addr
        self.sessions = sessions
        self.ibuffer = []
        self.obuffer = ""
        self.set_terminator("\r\n\r\n")
        self.reading_headers = True
        self.handling = False
        self.cgi_data = None
        self.log = log

    def collect_incoming_data(self, data):
        """Buffer the data"""
        self.ibuffer.append(data)

    def found_terminator(self):
        if self.reading_headers:
            self.reading_headers = False
            self.parse_headers("".join(self.ibuffer))
            self.ibuffer = []
            if self.op.upper() == "POST":
                clen = self.headers.getheader("content-length")
                self.set_terminator(int(clen))
            else:
                self.handling = True
                self.set_terminator(None)
                self.handle_request()
        elif not self.handling:
            self.set_terminator(None) # browsers sometimes over-send
            self.cgi_data = parse(self.headers, "".join(self.ibuffer))
            self.handling = True
            self.ibuffer = []
            self.handle_request()

def sqlQueryReturnStylesbyPO(str(ponum)):
    import sqlalchemy
    orcl_engine = sqlalchemy.create_engine('oracle+cx_oracle://jbragato:Blu3f!y@192.168.30.66:1531/dssprd1')
    connection = orcl_engine.connect()
    querymake_ponum_to_colorstyle="SELECT POMGR_SNP.PRODUCT_COLOR.ID AS colorstyle, POMGR_SNP.PO_LINE.PO_HDR_ID AS po_hdr FROM POMGR_SNP.PRODUCT_COLOR INNER JOIN POMGR_SNP.PO_LINE ON POMGR_SNP.PRODUCT_COLOR.ID = POMGR_SNP.PO_LINE.PRODUCT_COLOR_ID WHERE POMGR_SNP.PO_LINE.PO_HDR_ID = '" + ponum + "'"
    result = connection.execute(querymake_ponum_to_colorstyle)
    colorstyle_po_ret = {}
    for row in result:
        ret = {}
        ret['colorstyle'] = row['colorstyle']
        colorstyle_po_ret[row['po_hdr']] = ret
    connection.close()
    return ccolorstyle_po_ret

def url2_download_read_http(targeturl):
    from time import time
    import urllib2, subprocess
    url_start = time()
    targetreq = urllib2.Request(targeturl)
    downloadfile = urllib2.urlopen(targetreq).read()
    url_end = time()
    print "Download Time -> %s"  % (url_end - url_start)
    return downloadfile

class DropboxDownloadPageURLs():

    import urllib,os,time,subprocess,requests
    from bs4 import BeautifulSoup

    def __init__(self,dropboxsharedurl):

#### Get URL parse for image links return Unique Image Link List
def html_parse_dropbox_frlink(dropboxsharedurl):
    import os,re,sys,requests
    from bs4 import BeautifulSoup

    url = sys.argv[1]

    r = requests.get(url)
    soup = BeautifulSoup(r.text)
    souplist = []
    for link in soup.find_all('a'):
        print(link.get('href'))
        souplist.append(link)

    jpglist = []
    for link in souplist:
        found = link.get('href')
        jpglist.append(found)
    imglinks = unique(jpglist)
    return imglinks


text:
package ch.eitchnet.hedgehog.web.model;

public class Constants {

    /**
     * Types
     */
    public static final String TYPE_MEMBER = "Member";
    public static final String TYPE_SPONSORED_ITEM= "SponsoredItem";
    public static final String TYPE_SECTION = "Section";

    /**
     * Parameter Bags
     */
    public static final String BAG_PARAMETERS = "parameters";
    public static final String BAG_RELATIONS = "relations";

    /**
     * Parameter names
     */
    public static final String NAME = "name";
    public static final String MEMBER_TYPE = "memberType";
    public static final String EXT_ID = "extId";
    public static final String REGISTERED_AT = "registeredAt";
    public static final String TERMINATION_AT = "terminationAt";
    public static final String EMAIL = "email";
    public static final String BIRTHDATE = "birthdate";
    public static final String COMMENTS = "comments";
    public static final String NO_SNAIL_MAIL = "noSnailMail";
    public static final String NEWSLETTER = "newsletter";
    public static final String GENDER = "gender";
    public static final String CITY = "city";
    public static final String ZIP = "zip";
    public static final String COUNTRY = "country";
    public static final String PHONE = "phone";
    public static final String ADDRESS1 = "address1";
    public static final String ADDRESS2 = "address2";
    public static final String FIRST_NAME = "firstName";
    public static final String LAST_NAME = "lastName";
    public static final String SALUTATION = "salutation";
    public static final String COMPANY_NAME = "companyName";
    public static final String SPONSOR = "sponsor";
    public static final String SECTIONS = "sections";

    /**
     * Misc
     */
    public static final String MSG = "msg";
    public static final String DATA = "data";

    /**
     * Roles
     */
    public static final String ROLE_USER = "User";
    public static final String ROLE_USER_DEVICE = "UserDevice";
    public static final String ROLE_USER_PRIVILEGES = "UserPrivileges";

}


text:
// Copyright Node.js contributors. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.

/**
 * Node's lib/internal/assert.js modified for Axway Titanium
 *
 * @see https://github.com/nodejs/node/blob/master/lib/internal/assert.js
 */

import { codes } from './errors';

let error;
function lazyError() {
	if (!error) {
		// @fixme rollup cannot handle lazy loaded modules, maybe move to webpack?
		// error = require('./errors').codes.ERR_INTERNAL_ASSERTION;
		error = codes.ERR_INTERNAL_ASSERTION;
	}
	return error;
}
function assert(value, message) {
	if (!value) {
		const ERR_INTERNAL_ASSERTION = lazyError();
		throw new ERR_INTERNAL_ASSERTION(message);
	}
}

function fail(message) {
	const ERR_INTERNAL_ASSERTION = lazyError();
	throw new ERR_INTERNAL_ASSERTION(message);
}

assert.fail = fail;

export default assert;


text:
package org.apache.sshd.agent.common;

import java.io.IOException;
import java.security.KeyPair;
import java.security.PublicKey;
import java.util.List;

import org.apache.sshd.agent.SshAgent;

public class AgentDelegate implements SshAgent {

    private final SshAgent agent;

    public AgentDelegate(SshAgent agent) {
        this.agent = agent;
    }

    public void close() {
    }

    public List<Pair<PublicKey, String>> getIdentities() throws IOException {
        return agent.getIdentities();
    }

    public byte[] sign(PublicKey key, byte[] data) throws IOException {
        return agent.sign(key, data);
    }

    public void addIdentity(KeyPair key, String comment) throws IOException {
        agent.addIdentity(key, comment);
    }

    public void removeIdentity(PublicKey key) throws IOException {
        agent.removeIdentity(key);
    }

    public void removeAllIdentities() throws IOException {
        agent.removeAllIdentities();
    }
}


text:
Let's quickly walk through setting up a development environment.

If you don't mind using a VM and things being a bit slower, we've
[provided] one for you, the user and password are both "nate". The VM
should already have everything you need installed, and will boot with a
terminal open in the repository. You just need to activate the python
virtualenv with

``` shellsession
~/nate $ source .venv/bin/activate
```

and then you should be able to skip to "Reproducing the evaluation".

[provided]: https://www.dropbox.com/s/b8a7nfwi8loiwvp/nate-artifact.ova?dl=0

### Getting the source

Make sure you clone with `--recursive` as we have a few submodules.

``` shellsession
~ $ git clone --recursive https://github.com/ucsd-progsys/nate.git
~ $ cd nate
```

### Building

This project uses Haskell for feature extraction and Python (2.7) for
learning/executing the models.

There are also some required libraries and tools that won't be installed
automatically: ncurses, graphviz, BLAS, Tk, and Java/Ant (if you want to
run the SHErrLoc comparison). If you're on Ubuntu, the following command
should suffice.

``` shellsession
$ sudo apt-get install ncurses-dev graphviz libopenblas-dev python-tk openjdk-8-jdk ant
```

We recommend building the Haskell components using the [stack] tool.

[stack]: https://docs.haskellstack.org/en/stable/README/

``` shellsession
~/nate $ stack setup && stack build
```

For python we recommend using [virtualenv].

[virtualenv]: https://virtualenv.pypa.io/en/stable/

``` shellsession
~/nate $ virtualenv .venv
~/nate $ source .venv/bin/activate
~/nate $ pip install -r requirements.txt
```

### Testing

Let's run a quick test to make sure everything was built/installed
correctly. We'll train a logistic regression on just the local syntactic
features.

First, we'll extract the features from the paired programs. This should
take a few minutes. You'll also see a bunch of warnings about unbound
variables (in particular for variants of `printf` which we don't yet
support), this is expected. OCaml interleaves name resolution and type
checking, so it will sometimes abort with a type error before discovering
an unbound variable.

``` shellsession
~/nate $ stack exec -- generate-features \
           --source features/data/ucsd/data/derived/sp14/pairs.json \
           --features op \
           --out data/sp14
~/nate $ stack exec -- generate-features \
           --source features/data/ucsd/data/derived/fa15/pairs.json \
           --features op \
           --out data/fa15
```

The result will be a set of `.ml` files in the `data/{sp14,fa15}`
directories, containing the individual programs, and a set of `.csv`
files in the `data/{sp14,fa15}/op` directories, containing the extracted
features for each program.

Next, let's train a logistic regression on the sp14 programs and test it
on the fa15 programs. The specific learning parameters don't particularly
matter here since we're just trying to make sure everything was built
properly.

``` shellsession
~/nate $ python learning/learn.py \
           --data=data/sp14/op --test_data=data/fa15/op \
           --model=linear --learn_rate=0.01 --reg_rate=0.01 \
           --batch_size=200 --n_epochs=10 --seed=0
training complete in 5.48 seconds
final accuracy: 0.492 / 0.663 / 0.782
avg/std recall: 0.532 / 0.388
avg / std / med samples: 10.50 / 6.99 / 9.00
avg / std / med changes: 2.74 / 2.34 / 2.00
avg prediction time: 0.179411
testing complete in 430.08 seconds
```

And for good measure let's try a decision tree too.

``` shellsession
~/nate $ python learning/trees.py decision-tree data/sp14/op data/fa15/op
(40938, 49)
(40938, 45)
precision for top 3
top 1
0.534460887949
top 2
0.707822410148
top 3
0.780549682875
recall for top 3
0.415379864114
```

## Reproducing the evaluation

Running the entire evaluation can take quite a while (i.e. hours) since
there are so many different combinations of feature sets and models to
train and evaluate. Where possible, we provide commands to run both the
full evaluation and a smaller subset, which may be particularly useful
if you're using our VM.

If you're running the FASTER commands and want to examine a different
feature set, here's a simple table to help select a feature set.

| Segment  | Description                                   |
| -------- | --------------------------------------------- |
| op       | baseline of local syntax (always comes first) |
| +context | add contextual syntax                         |
| +type    | add typing features (local and contextual)    |
| +size    | add expression size                           |

For example, to use the feature set with local and contextual syntax
features and expression size, we would use `op+context+size`.

### Generating all feature sets

We examine many different combinations of feature sets in our evaluation,
so let's go a head and generate them all.

This will take a while depending on how many cores you have, so you might
want to go grab a cup of coffee.

``` shellsession
~/nate $ make -j20 csvs
# FASTER: just the full feature set
~/nate $ make -j2 sp14-op+context+type+size-csvs fa15-op+context+type+size-csvs
```

### Comparing Blame Accuracy (Sec. 4.2)

The first experiment compares the accuracy of our learned models against
OCaml and the state-of-the-art SHErrLoc and Mycroft tools.

Let's first train all of NATE's various models. This will also take a
while, so if you're in a hurry or on a low-powered machine try the
FASTER command.

``` shellsession
~/nate $ make -j5 linear tree hidden
# FASTER: just the MLP-500 with the op+context+type+size features
~/nate $ make op+context+type+size-hidden-500
```

Running `make -j` will garble the results printed to stdout, but we also
store each model's predictions for offline analysis. The predictions are
stored in `data/{sp14,fa15}/<features>/<model>/<program>.ml.out`, with a
single predicted blame span per line. For example, to see the
predictions of the MLP-500 on the op+context+type features from the sp14
dataset, we would look at the files in
`data/sp14/op+context+type+size/hidden-500`.

We can compute the top-k accuracy summaries with the `results` target.

``` shellsession
~/nate $ make -j5 results
# FASTER: just the MLP-500
~/nate $ make op+context+type+size-hidden-500-results
```

This will produce a `results.csv` file in the same directory as the
`<program>.ml.out` files. For example, here are the results for the
MLP-500 on the op+context+type features.

``` shellsession
~/nate $ cat data/sp14/op+context+type+size/hidden-500/results.csv
tool,year,features,model,top-1,top-2,top-3,recall,total
op+context+type+size/hidden-500,sp14,op+context+type+size,hidden-500,0.736,0.864,0.915,0.720,2712
~/nate $ cat data/fa15/op+context+type+size/hidden-500/results.csv
tool,year,features,model,top-1,top-2,top-3,recall,total
op+context+type+size/hidden-500,fa15,op+context+type+size,hidden-500,0.701,0.841,0.907,0.696,2365
```

#### State of the Art

You may also want to compare our models against OCaml, SHErrLoc, and
Mycroft. We have patched all of these tools slightly to produce source
locations in a standard format, so you will have to build the included
versions.

Unfortunately, Mycroft is not available publicly so we are not
comfortable distributing it ourselves. Please contact the authors for a
copy if you wish to rerun the Mycroft benchmarks.

##### Building OCaml

``` shellsession
~/nate $ cd eval/ocaml
~/nate/eval/ocaml $ ./configure -prefix $(pwd)/../build
~/nate/eval/ocaml $ make world world.opt
# NOTE: at the moment, ocaml's `make install` seems to
# get stuck in an infinite recursion, just hit Ctrl-C
# after a few seconds and it should be fine.. Sorry!
~/nate/eval/ocaml $ make install
```

##### Building Sherrloc

``` shellsession
# first we have to build sherrloc's version of easyocaml
~/nate $ cd eval/sherrloc/easyocaml++
~/nate/eval/sherrloc/easyocaml++ $ ./configure -prefix $(pwd)/../../build/eocaml
~/nate/eval/sherrloc/easyocaml++$ ./build/smallworld.sh
~/nate/eval/sherrloc/easyocaml++$ ./build/install.sh
# now we can build sherrloc itself
~/eval/sherrloc/easyocaml++ $ cd ..
~/eval/sherrloc $ ant
```

##### Gathering state-of-the-art predictions

Once you have built the tools, we provide another `make` target to
gather the predictions. Note that SHErrLoc in particular is quite slow
on some programs, so you may want to use our cached predictions instead
of reproducing them yourself.

``` shellsession
~/nate $ make -j6 ocaml sherrloc # mycroft
# FASTER: just ocaml
~/nate $ make -j2 ocaml
# EVEN FASTER: use our cached predictions
```

NOTE: As mentioned in the paper, there are a number of programs that
SHErrLoc was unable to check due to unsupported language features or
exceeding its 1GB heap limit. These will present in the logs as errors
of the form:

```
This feature is not supported by EasyOcaml
eval/bin/ecamlc: line 14: error.con: No such file or directory

OR

OutOfMemoryError
```

The predictions are stored as above, in
`data/{sp14,fa15}/<tool>/<program>.ml.out` files. As before, we provide
a `make` target to compute the accuracy summaries.

``` shellsession
~/nate $ make -j6 ocaml-results sherrloc-results # mycroft-results
# FASTER: just ocaml
~/nate $ make ocaml-sp14-results ocaml-fa15-results
# EVEN FASTER: use the cached results
```

NOTE: As mentioned in the paper, there are a number of programs for
which SHErrLoc and OCaml either did not produce any blame locations
(perhaps due to a timeout), or our scripts could not match one of their
blame locations with program locations as we see them (basically,
off-by-one errors in comparing source spans). In these cases, you will
see warnings of the form:

```
WARN: no blamed spans

OR

WARN: blamed spans not subset of all spans
```

As before, you should now see `results.csv` files.

``` shellsession
~/nate $ cat data/sp14/ocaml/results.csv
tool,year,features,model,top-1,top-2,top-3,recall,total
ocaml,sp14,.,ocaml,0.448,0.448,0.448,0.227,2652
~/nate $ cat data/fa15/ocaml/results.csv
tool,year,features,model,top-1,top-2,top-3,recall,total
ocaml,fa15,.,ocaml,0.435,0.435,0.435,0.219,2328
```

The actual bar graphs in the paper are produced by LaTeX, to rebuild
them after running the benchmarks:

``` shellsession
~/nate $ cd paper/oopsla17-submission && latexmk -pdf main
```

### Comparing Feature Utility (Sec. 4.3)

Next, let's see how to reproduce the feature utility results.

This will take quite a while as there are many combinations of feature
sets and models to test, and each combination does a 10-fold
cross-validation.

``` shellsession
~/nate $ make feature-cross  # this will take a few hours, and requires all feature sets
# FASTER: just run the MLP-500 on the op+context+type+size features
~/nate $ python learning/learn.py \
           --data data/fa15/op+context+type+size:data/sp14/op+context+type+size \
           --model=hidden --hidden_layers=500 \
           --learn_rate=0.001 --reg_rate=0.001 \
           --batch_size=200 --n_epochs=20 --n_folds=10 \
           --seed 0
```

There's no interleaving of output here, so you can scroll through the log
if you like, or you can look at the summary csvs we produce in
`models/<model>-<features>.cross.csv`. For example, to see the results
for the MLP-500 on the op+context+type feature set:

``` shellsession
~/nate $ cat models/hidden-500-op+context+type+size.cross.csv
model,features,top-1,top-2,top-3,recall
hidden-500,op+context+type+size,0.773,0.883,0.929,0.737
```

As before, the bar graphs in the paper are produced directly by LaTeX.

### Explaining Predictions (Sec. 4.4)

In this final experiment we try to explain specific predictions from our
decision-tree classifier. We use the op+context+type feature set since
we don't expect the expression size feature to produce a very intuitive
explanation.

If you've been following the FASTER path, you may need to first extract
the op+context+type feature set and train a decision tree with:

``` shellsession
~/nate $ python learning/trees.py decision-tree data/fa15/op+context+type data/sp14/op+context+type
```

Now, we'll use the `learning/decisionpath.py` script to print out
the sequence of decisions made by the tree. When we train the
decision-tree, we also store a copy of the trained model in
`models/data-<quarter>-<features>.pkl`, so let's use the tree trained on
the fa15 data with the op+context+type features to explain the first
bogus prediction.

``` shellsession
~/nate $ python learning/decisionpath.py models/decision-tree-data-fa15-op+context+type.pkl data/sp14/op+context+type/0967.csv
# This script prints out decision paths for each expression, but we're
# only interested in the recursive call to `clone` here
...
For span
(3,42)-(3,47)
with confidence
0.369841269841
our prediction is
0.0
should be
1.0
Rules used to predict sample 2:
F-Is-Type-Fun : (= 1.0) > 0.5
F-Is-App : (= 0.0) <= 0.5
F-Is-Fun-C1 : (= 0.0) <= 0.5
F-Is-App-C1 : (= 0.0) <= 0.5
F-Is-Fun-P : (= 0.0) <= 0.5
F-Is-Type-Fun-P : (= 0.0) <= 0.5
F-Is-App-P : (= 1.0) > 0.5
F-Is-Type-Tuple-P : (= 0.0) <= 0.5
F-Is-Type-float-P : (= 0.0) <= 0.5
F-Is-Type-Tuple-C1 : (= 0.0) <= 0.5
F-Is-Type-int-P : (= 0.0) <= 0.5
F-Is-Type-expr-P : (= 0.0) <= 0.5
F-Is-Type-unit-P : (= 0.0) <= 0.5
F-Is-Type-char-P : (= 0.0) <= 0.5
F-Is-Type-bool-P : (= 0.0) <= 0.5
F-Is-Type-string-P : (= 0.0) <= 0.5
F-Is-Type-Fun-C1 : (= 0.0) <= 0.5
F-Is-Type-list-P : (= 1.0) > 0.5
leaf node 2821 reached, no decision here
...
```

There are a few important pieces of information here. First of all, we
can see that we predicted 0 (i.e. no-blame), when the correct answer was
1, and furthermore our "confidence" was 0.369. Confidence is a bit of a
misnomer here, it's really the probability that we should predict blame,
i.e. < 0.5 means we will predict no-blame, and > 0.5 means we will
predict blame.

More importantly, we see the sequence of decisions made by the tree. Each
line is as follows

```
<feature> : (= <feature-value>) [> <=] 0.5
```

which says that `<feature>`, with a value `<feature-value>` is greater
or less than the threshold (in our case with binary features, always
0.5). For example, the first line says that the `F-Is-Type-Fun` feature
(i.e. the type of this expression mentions the `->` type constructor) is
1 (i.e. true), which is greater than the threshold. Continuing on, we
can see that the only enabled features are `F-Is-Type-Fun`,
`F-Is-App-P` (the parent expression is an application), and
`F-Is-Type-list-P` (the type of the parent expression mentions `list`).

There should also now be a visualization of the entire tree in
`models/decision-tree-data-fa15-op+context+type.pkl.pdf`. Each node in
the tree lists a decision as above, and is shaded either blue
(indicating the classifier is leaning towards **blame**) or orange
(indicating it's leaning towards **no-blame**). Deeper shades indicate
higher confidence. When the condition of a node is true, the tree will
descend into the left child. Note that all of the conditions have the
form `<feature> <= 0.5`, so taking the left path means the feature
was disabled, the right path means the feature was enabled.

## Extending / Reusing

There are a few ways in which you may want to build on top of our work.
You might have your own dataset that you wish to evaluate NATE's models
on. Perhaps you have some clever ideas for additional features or
classifiers to use with our data. Or maybe you would like to do your own
analyses on the raw student interactions with OCaml.

### New Datasets

If you have your own dataset of ill-typed programs paired with fixes,
and you would like to see how NATE's models perform on it, it should
be fairly straightforward to integrate your data into our processing
pipeline.

First, we expect the program pairs to be in a single `pairs.json` file,
with a single JSON object on each line. Each object should have a `bad`
field with the ill-typed program, and a `fix` field with the fixed
program.

Once you have the `pairs.json` file, run

``` shellsession
~/nate $ stack exec -- generate-features \
           --source path/to/pairs.json \
           --features <features> \
           --out path/to/csvs
```

with a suitable choice of `features`, based on our experiments
`op+context+type` will probably perform best.

Then you can train and evaluate a model with your data. For example,
suppose we want to train on the combined sp14/fa15 data and evaluate on
your data, to see how well the models generalize to other
datasets. We'll use the MLP-500 classifier and op+context+type features
since they give the best results.

``` shellsession
~/nate $ python learning/learn.py \
           --data=data/sp14/op+context+type:data/fa15/op+context+type \
           --test_data=path/to/csvs \
           --model=hidden --hidden_layers=500 \
           --learn_rate=0.001 --reg_rate=0.001 \
           --batch_size=200 --n_epochs=20 \
           --seed 0
```

The `learn_rate`, `reg_rate`, `batch_size`, and `n_epochs` are learning
parameters, feel free to experiment with them, but these values seem to
work well in practice. `seed` is an optional random seed for
reproducibility.

### New features

Perhaps you have a clever idea for a new feature to improve NATE's
accuracy.

At a high level we model features as real-valued functions over typed
expressions, but things are slightly more complex in the implementation.

The feature extraction functions are defined in
`features/src/NanoML/Classify.hs`, using the type alias

``` haskell
type Feature = ([String], (TExpr -> TExpr -> [Double]))
```

That is, a `Feature` is a pair of a list of labels and a function that
takes two typed expressions and returns a list of `Double`s. The reason
we define it this way, multiple features together, is that each
expression is also given features of its parent and children, so it's
very convenient to define a feature function for the current expression,
and then use `mkContextLabels` and `mkContextFeatures` to lift it to the
surrounding context.

As an example, look at how we define the features for the syntactic
class of an expression, `preds_tis_ctx`, in terms of
`tis_op_ctx`, `tis_op`, etc.

Once you have added your new feature function, you must hook it up to
the `generate-features` binary. For this, open up
`features/bin/Generate.hs` and look at the case-analysis in the `main`
function. Here you just need to add a new case for your desired feature
set, using the `mkBadFeatures` function. For example, to create a new
feature set with local syntax and your new feature, you might add:

``` haskell
    "op+myfeature"
      -> mkBadFeatures src cls (preds_tis ++ preds_myfeature) jsons
```

Then, recompile and extract the features:

``` shellsession
~/nate $ stack build && stack exec -- generate-features \
           --source path/to/pairs.json \
           --features op+myfeature \
           --out path/to/csvs
```

### New models

Adding a new model could mean a few things. At the simple end of the
spectrum, you might want to test a different architectures for the MLP.
This requires no code changes at all, just a different setting for the
`--hidden_layers` flag. It accepts a `-` separated list of numbers,
specifying the number of hidden layers and how many units each should
have. For example, if we wanted to train an MLP with an initial hidden
layer of 250 units and a second layer of 500 units, we would call

``` shellsession
~/nate $ python learning/learn.py \
           --model=hidden --hidden_layers=250-500 # ...
```

You may also want to experiment with different settings for the learning
parameters `--learn_rate`, `--reg_rate` (for L2 regularization),
`--batch_size`, and `--n_epochs`.

If you want to make more invasive changes, e.g. different activation
functions or connections between layers, see the `build_model` function
in `learning/hidden.py`.

It's also quite straightforward to use any of scikit-learn's built-in
classifiers, just extend the switch at
https://github.com/ucsd-progsys/ml2/blob/master/learning/trees.py#L103-L119
with your choice of classifier.

Of course, you can always write your own classifier from scratch if it
doesn't fit nicely into the tensorflow or scikit-learn models. As long
as your classifier can read our CSV files and output a sequence of
ranked predictions in the one-per-line format described above (see
"Comparing Blame Accuracy"), it will fit nicely into our evaluation
pipeline. The CSV files themselves are quite simple and look roughly as
follows.

```
SourceSpan,L-NoChange,L-DidChange,F-InSlice,F-Feature1,F-Feature2,etc.
"(1,1)-(2,2)",0,1,1,0,0,...
"(1,5)-(1,8)",1,0,1,1,0,...
...
```

The `SourceSpan` column contains the source span for each expression,
and is what your classifier should output as predictions. The
`L-{No,Did}Change` columns are the boolean output labels, indicating
whether the expression changed in the fixed program. Having two columns
here is redundant, you can just use one of them. The `F-InSlice` column
indicates whether the expression is part of a type error
slice. Regardless of the feature set, this column will be present, and
based on our experiments, but you can safely ignore it unless you are
working with the op+slice dataset, as we usually discard expressions
where `F-InSlice` is false during feature extraction. Finally, there are
an arbitrary number of `F-Feature` columns for the input features to the
model.

### Other analyses on the interaction traces

If you just want to work with the interaction traces we collected from the
students, you can find the full (anonymized) dataset at https://github.com/ucsd-progsys/yunounderstand-data.


text:
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>

<template id="footer_custom" inherit_id="website.footer_default" name="Footer Partners Link">
    <xpath expr="//div[@id='info']/ul" position="inside">

Resellers

    </xpath>
</template>

<template id="layout" name="Partners Layout">
    <t t-call="website.layout">
        <t t-set="additional_title">Resellers</t>

                    <t t-raw="ref_content" />

    </t>
</template>

<template id="index" name="Find Resellers">
    <t t-call="website_crm_partner_assign.layout">
        <t t-set="ref_content">

                    Looking For a Local Store?

                    Contact a reseller

Filter by Level

                    <t t-foreach="grades" t-as="grade">

                                <t t-esc="grade['grade_id'][1]"/>

                    </t>

Filter by Country

                    <t t-foreach="countries" t-as="country">

                                <t t-esc="country['country_id'][1]"/>

                    </t>

                        <t t-call="website.pager"/>
                        <form action="" method="get" class="navbar-search pull-right pagination form-inline">

                                <input type="text" name="search" class="search-query col-md-2 mt4 form-control" placeholder="Search" t-att-value="searches.get('search', '')"/>

                        </form>

No result found

                    <t t-foreach="partners" t-as="partner">
                        <t t-if="last_grade != partner.grade_id.id">

                                 Partners
                                <t t-call="website.publish_management">
                                    <t t-set="object" t-value="partner.grade_id"/>
                                    <t t-set="publish_edit" t-value="True"/>
                                </t>

                            <t t-set="last_grade" t-value="partner.grade_id.id"/>
                        </t>

                                <t t-if="any([p.website_published for p in partner.implemented_partner_ids])">

                                        <t t-raw="len([p for p in partner.implemented_partner_ids if p.website_published])"/> reference(s)

                                </t>

                    </t>

                    <t t-call="website.pager">
                       <t t-set="classname">pull-left</t>
                    </t>

        </t>
    </t>
</template>

<template id="ref_country" inherit_id="website_crm_partner_assign.index" customize_show="True" name="Left World Map">
    <xpath expr="//ul[@id='reseller_countries']" position="after">
        <t t-if="google_maps_api_key">

                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>

World Map

World Map<button class="btn btn-link" data-toggle="modal" data-target=".partner_map_modal"></button>

        </t>
    </xpath>
</template>

<template id="partner" name="Partner Detail">
    <t t-call="website_crm_partner_assign.layout">
        <t t-set="ref_content">

Our Partners

            <t t-call="website_partner.partner_detail">
                <t t-set="right_column">

<t t-call="website_crm_partner_assign.references_block"/>

                </t>
            </t>
        </t>
    </t>
</template>

<template id="grade_in_detail" inherit_id="website_partner.partner_detail">
  <xpath expr="//*[@id='partner_name']" position="after">

       Partner

  </xpath>
</template>

<template id="references_block" name="Partner References Block">
    <t t-if="any([p.website_published for p in partner.implemented_partner_ids])">

References

          <t t-if="reference.website_published">

          </t>

    </t>
</template>

</data>
</openerp>


text:
package command

import (
	"github.com/marcelfw/mgit/engine"
	"github.com/marcelfw/mgit/repository"
	"os/exec"
	"strings"
)

type cmdGitProxy struct {
	interactive bool

	command string
	args    []string

	usage string
	help  string
}

func NewGitProxyCommand(command string, vars map[string]string) cmdGitProxy {
	var cmd cmdGitProxy

	cmd.command = command
	cmd.args = make([]string, 0, 10)
	cmd.args = append(cmd.args, command)

	cmd.usage = "Run \"git " + command + "\"."

	if value, ok := vars["usage"]; ok {
		cmd.usage = value
	}
	if value, ok := vars["help"]; ok {
		cmd.help = value
	}

	if value, ok := vars["interactive"]; ok {
		if value == "yes" || value == "1" || value == "true" {
			cmd.interactive = true
		}
	}

	return cmd
}

func (cmd cmdGitProxy) Usage() string {
	return cmd.usage
}

func (cmd cmdGitProxy) Help() string {
	if cmd.help == "" {
		extCmd := exec.Command("git", "help", cmd.command)

		output, err := extCmd.CombinedOutput()
		if err == nil {
			return string(output)
		}

		return "No help information available."
	}
	return cmd.help
}

func (cmd cmdGitProxy) Init(args []string, interactive bool) (outCmd repository.Command) {
	cmd.args = append(cmd.args, args...)
	cmd.interactive = interactive
	return cmd
}

func (cmd cmdGitProxy) IsInteractive() bool {
	return cmd.interactive
}

func (cmd cmdGitProxy) Run(repository repository.Repository) (outRepository repository.Repository, output bool) {
	args := repository.ReplaceMacros(cmd.args)

	if cmd.interactive {
		_ = repository.ExecGitInteractive(args...)

		repository.PutInfo("proxy."+cmd.command, "(interactive command ran)")
	} else {
		var result string

		// we just want the return anything, even if it is an error
		result, _, _ = repository.ExecGit(args...)

		repository.PutInfo("proxy."+cmd.command, strings.TrimSpace(result))
	}

	return repository, true
}

func (cmd cmdGitProxy) Header() []string {
	columns := make([]string, 2, 2)

	columns[0] = strings.Title(cmd.command)
	columns[1] = "Output"

	return columns
}

// Output returns the result of the command
func (cmd cmdGitProxy) Output(repository repository.Repository) interface{} {
	return engine.FormatRow(repository.GetShowName(), repository.GetInfo("proxy."+cmd.command).(string))
}


text:
/**************************************************************************//**
 * @file     fmc.h
 * @version  V1.00
 * @brief    M480 Series Flash Memory Controller Driver Header File
 *
 * @copyright (C) 2016 Nuvoton Technology Corp. All rights reserved.
 ******************************************************************************/
#ifndef __FMC_H__
#define __FMC_H__

#ifdef __cplusplus
extern "C"
{
#endif

/** @addtogroup M480_Device_Driver M480 Device Driver
  @{
*/

/** @addtogroup M480_FMC_Driver FMC Driver
  @{
*/

/** @addtogroup M480_FMC_EXPORTED_CONSTANTS FMC Exported Constants
  @{
*/

/*---------------------------------------------------------------------------------------------------------*/
/* Define Base Address                                                                                */
/*---------------------------------------------------------------------------------------------------------*/
#define FMC_APROM_BASE          0x00000000UL    /*!< APROM base address          \hideinitializer */
#define FMC_APROM_END           0x00080000UL    /*!< APROM end address           \hideinitializer */
#define FMC_APROM_BANK0_END     (FMC_APROM_END/2UL)  /*!< APROM bank0 end address     \hideinitializer */
#define FMC_LDROM_BASE          0x00100000UL    /*!< LDROM base address          \hideinitializer */
#define FMC_LDROM_END           0x00101000UL    /*!< LDROM end address           \hideinitializer */
#define FMC_SPROM_BASE          0x00200000UL    /*!< SPROM base address          \hideinitializer */
#define FMC_SPROM_END           0x00201000UL    /*!< SPROM end address           \hideinitializer */
#define FMC_CONFIG_BASE         0x00300000UL    /*!< User Configuration address  \hideinitializer */
#define FMC_USER_CONFIG_0       0x00300000UL    /*!< User Config 0 address       \hideinitializer */
#define FMC_USER_CONFIG_1       0x00300004UL    /*!< User Config 1 address       \hideinitializer */
#define FMC_USER_CONFIG_2       0x00300008UL    /*!< User Config 2 address       \hideinitializer */
#define FMC_KPROM_BASE          0x00301000UL    /*!< Security ROM base address   \hideinitializer */
#define FMC_OTP_BASE            0x00310000UL    /*!< OTP flash base address      \hideinitializer */

#define FMC_FLASH_PAGE_SIZE     0x1000UL        /*!< Flash Page Size (4K bytes)  \hideinitializer */
#define FMC_PAGE_ADDR_MASK      0xFFFFF000UL    /*!< Flash page address mask     \hideinitializer */

#define FMC_APROM_SIZE          FMC_APROM_END   /*!< APROM Size                  \hideinitializer */
#define FMC_BANK_SIZE           (FMC_APROM_SIZE/2UL) /*!< APROM Bank Size             \hideinitializer */
#define FMC_LDROM_SIZE          0x1000UL        /*!< LDROM Size (4 Kbytes)       \hideinitializer */
#define FMC_SPROM_SIZE          0x1000UL        /*!< SPROM Size (4 Kbytes)       \hideinitializer */
#define FMC_OTP_ENTRY_CNT       256UL           /*!< OTP entry number            \hideinitializer */

/*---------------------------------------------------------------------------------------------------------*/
/*  ISPCMD constant definitions                                                                            */
/*---------------------------------------------------------------------------------------------------------*/
#define FMC_ISPCMD_READ         0x00UL          /*!< ISP Command: Read flash word         \hideinitializer */
#define FMC_ISPCMD_READ_UID     0x04UL          /*!< ISP Command: Read Unique ID          \hideinitializer */
#define FMC_ISPCMD_READ_ALL1    0x08UL          /*!< ISP Command: Read all-one result     \hideinitializer */
#define FMC_ISPCMD_READ_CID     0x0BUL          /*!< ISP Command: Read Company ID         \hideinitializer */
#define FMC_ISPCMD_READ_PID     0x0CUL          /*!< ISP Command: Read Product ID         \hideinitializer */
#define FMC_ISPCMD_READ_CKS     0x0DUL          /*!< ISP Command: Read checksum           \hideinitializer */
#define FMC_ISPCMD_PROGRAM      0x21UL          /*!< ISP Command: Write flash word        \hideinitializer */
#define FMC_ISPCMD_PAGE_ERASE   0x22UL          /*!< ISP Command: Page Erase Flash        \hideinitializer */
#define FMC_ISPCMD_BANK_ERASE   0x23UL          /*!< ISP Command: Erase Flash bank 0 or 1 \hideinitializer */
#define FMC_ISPCMD_BLOCK_ERASE  0x25UL          /*!< ISP Command: Erase 4 pages alignment of APROM in bank 0 or 1  \hideinitializer */
#define FMC_ISPCMD_PROGRAM_MUL  0x27UL          /*!< ISP Command: Multuple word program   \hideinitializer */
#define FMC_ISPCMD_RUN_ALL1     0x28UL          /*!< ISP Command: Run all-one verification \hideinitializer */
#define FMC_ISPCMD_RUN_CKS      0x2DUL          /*!< ISP Command: Run checksum calculation \hideinitializer */
#define FMC_ISPCMD_VECMAP       0x2EUL          /*!< ISP Command: Vector Page Remap       \hideinitializer */
#define FMC_ISPCMD_READ_64      0x40UL          /*!< ISP Command: Read double flash word  \hideinitializer */
#define FMC_ISPCMD_PROGRAM_64   0x61UL          /*!< ISP Command: Write double flash word \hideinitializer */

#define IS_BOOT_FROM_APROM      0UL             /*!< Is booting from APROM                \hideinitializer */
#define IS_BOOT_FROM_LDROM      1UL             /*!< Is booting from LDROM                \hideinitializer */

#define READ_ALLONE_YES         0xA11FFFFFUL    /*!< Check-all-one result is all one.     \hideinitializer */
#define READ_ALLONE_NOT         0xA1100000UL    /*!< Check-all-one result is not all one. \hideinitializer */
#define READ_ALLONE_CMD_FAIL    0xFFFFFFFFUL    /*!< Check-all-one command failed.        \hideinitializer */

/*@}*/ /* end of group M480_FMC_EXPORTED_CONSTANTS */

/** @addtogroup M480_FMC_EXPORTED_FUNCTIONS FMC Exported Functions
  @{
*/

/*---------------------------------------------------------------------------------------------------------*/
/*  Macros                                                                                */
/*---------------------------------------------------------------------------------------------------------*/

#define FMC_SET_APROM_BOOT()        (FMC->ISPCTL &= ~FMC_ISPCTL_BS_Msk)         /*!< Select booting from APROM  \hideinitializer */
#define FMC_SET_LDROM_BOOT()        (FMC->ISPCTL |= FMC_ISPCTL_BS_Msk)          /*!< Select booting from LDROM  \hideinitializer */
#define FMC_ENABLE_AP_UPDATE()      (FMC->ISPCTL |=  FMC_ISPCTL_APUEN_Msk)      /*!< Enable APROM update        \hideinitializer */
#define FMC_DISABLE_AP_UPDATE()     (FMC->ISPCTL &= ~FMC_ISPCTL_APUEN_Msk)      /*!< Disable APROM update       \hideinitializer */
#define FMC_ENABLE_CFG_UPDATE()     (FMC->ISPCTL |=  FMC_ISPCTL_CFGUEN_Msk)     /*!< Enable User Config update  \hideinitializer */
#define FMC_DISABLE_CFG_UPDATE()    (FMC->ISPCTL &= ~FMC_ISPCTL_CFGUEN_Msk)     /*!< Disable User Config update \hideinitializer */
#define FMC_ENABLE_LD_UPDATE()      (FMC->ISPCTL |=  FMC_ISPCTL_LDUEN_Msk)      /*!< Enable LDROM update        \hideinitializer */
#define FMC_DISABLE_LD_UPDATE()     (FMC->ISPCTL &= ~FMC_ISPCTL_LDUEN_Msk)      /*!< Disable LDROM update       \hideinitializer */
#define FMC_ENABLE_SP_UPDATE()      (FMC->ISPCTL |=  FMC_ISPCTL_SPUEN_Msk)      /*!< Enable SPROM update        \hideinitializer */
#define FMC_DISABLE_SP_UPDATE()     (FMC->ISPCTL &= ~FMC_ISPCTL_SPUEN_Msk)      /*!< Disable SPROM update       \hideinitializer */
#define FMC_DISABLE_ISP()           (FMC->ISPCTL &= ~FMC_ISPCTL_ISPEN_Msk)      /*!< Disable ISP function       \hideinitializer */
#define FMC_ENABLE_ISP()            (FMC->ISPCTL |=  FMC_ISPCTL_ISPEN_Msk)      /*!< Enable ISP function        \hideinitializer */
#define FMC_GET_FAIL_FLAG()         ((FMC->ISPCTL & FMC_ISPCTL_ISPFF_Msk) ? 1UL : 0UL)  /*!< Get ISP fail flag  \hideinitializer */
#define FMC_CLR_FAIL_FLAG()         (FMC->ISPCTL |= FMC_ISPCTL_ISPFF_Msk)       /*!< Clear ISP fail flag        \hideinitializer */

/*---------------------------------------------------------------------------------------------------------*/
/*  Functions                                                                                */
/*---------------------------------------------------------------------------------------------------------*/

extern void FMC_Close(void);
extern int32_t FMC_Erase(uint32_t u32PageAddr);
extern int32_t FMC_Erase_SPROM(void);
extern int32_t FMC_Erase_Block(uint32_t u32BlockAddr);
extern int32_t FMC_Erase_Bank(uint32_t u32BankAddr);
extern int32_t FMC_GetBootSource(void);
extern void FMC_Open(void);
extern uint32_t FMC_Read(uint32_t u32Addr);
extern int32_t FMC_Read_64(uint32_t u32addr, uint32_t * u32data0, uint32_t * u32data1);
extern uint32_t FMC_ReadCID(void);
extern uint32_t FMC_ReadPID(void);
extern uint32_t FMC_ReadUCID(uint32_t u32Index);
extern uint32_t FMC_ReadUID(uint32_t u32Index);
extern uint32_t FMC_ReadDataFlashBaseAddr(void);
extern void FMC_SetVectorPageAddr(uint32_t u32PageAddr);
extern void FMC_Write(uint32_t u32Addr, uint32_t u32Data);
extern int32_t  FMC_Write_64(uint32_t u32addr, uint32_t u32data0, uint32_t u32data1);
extern int32_t  FMC_Write_OTP(uint32_t otp_num, uint32_t low_word, uint32_t high_word);
extern int32_t  FMC_Read_OTP(uint32_t otp_num, uint32_t *low_word, uint32_t *high_word);
extern int32_t  FMC_Lock_OTP(uint32_t otp_num);
extern int32_t  FMC_Is_OTP_Locked(uint32_t otp_num);
extern int32_t FMC_ReadConfig(uint32_t u32Config[], uint32_t u32Count);
extern int32_t FMC_WriteConfig(uint32_t u32Config[], uint32_t u32Count);
extern uint32_t FMC_GetChkSum(uint32_t u32addr, uint32_t u32count);
extern uint32_t FMC_CheckAllOne(uint32_t u32addr, uint32_t u32count);
extern int32_t  FMC_SKey_Setup(uint32_t key[3], uint32_t kpmax, uint32_t kemax, const int32_t lock_CONFIG, const int32_t lock_SPROM);
extern int32_t  FMC_SKey_Compare(uint32_t key[3]);

/*@}*/ /* end of group M480_FMC_EXPORTED_FUNCTIONS */

/*@}*/ /* end of group M480_FMC_Driver */

/*@}*/ /* end of group M480_Device_Driver */

#ifdef __cplusplus
}
#endif

#endif   /* __FMC_H__ */

/*** (C) COPYRIGHT 2016 Nuvoton Technology Corp. ***/


text:
(function( $, undefined ) {
//$.mobile.page.prototype.options.backBtnTheme	= "s";

if ($.mobile.page) {
// Clear default theme for child elements
$( function ( o ) {
	o.headerTheme = "s";
	o.footerTheme = "s";
} ( $.mobile.page.prototype.options ) );
}

if ($.mobile.listview) {
// clear listview
( function ( o ) {
	o.theme = "s";
	o.countTheme = "s";
	o.headerTheme = "s";
	o.dividerTheme = "s";
	o.splitTheme = "s";
} ( $.mobile.listview.prototype.options ) );
}

if ($.mobile.collapsible) {
// Collapsible
( function ( o ) {
	o.heading = o.heading + ',li';		// Add listitem as a heading
	o.inset = false;
	o.iconPos = "right";	// Move iconPos to right position
	o.collapsedIcon = "arrow-u";
	o.expandedIcon = "arrow-d";
	o.animation = true;
	o.customEventHandler = function ( isCollapse ) {
		var self = this,
			c = $(self).children('.ui-collapsible-content')[0];

		function _getHeight( el ) {
			var h = 0,
				heading = $( el ).children('.ui-collapsible-heading')[0],
				content = $( el ).children('.ui-collapsible-content')[0];

			h += heading.clientHeight;
			$( content ).children().each ( function ( idx, _el ) {
				if ( $( _el ).hasClass( 'ui-collapsible' ) ) {	// recursive call for nested collapsible list
					h += _getHeight( _el );

				} else {
					h += _el.clientHeight;
				}
			} );
			return h;
		}

		if ( isCollapse ) {	// collapse!
			// remember current height
			$( c ).data( 'max-height', _getHeight( self ) );
			$( self ).parentsUntil( '.ui-page', '.ui-collapsible' ).each( function( idx, el ) {
				var content = $( el ).children('.ui-collapsible-content')[0];
				$( content ).data( 'max-height', _getHeight( el ) );
			} );

		} else {	// expand!
			h = $( c ).data( 'max-height' );
			if ( !h ) {
				h = document.body.clientHeight;
				$( c ).data( 'max-height', h );
			}
			$( c ).css( 'max-height', h );
			$( self ).parentsUntil( '.ui-page', '.ui-collapsible' ).each( function( idx, el ) {
				var content = $( el ).children('.ui-collapsible-content')[0];
				$( content ).css( 'max-height', _getHeight( el ) );
			} );
		}
	};
} ( $.mobile.collapsible.prototype.options ) );
}

if ($.mobile.button) {
//clear button theme
$.mobile.button.prototype.options.theme = "s";
$.fn.buttonMarkup.defaults.theme = "s";
}

if ($.mobile.page) {
// Default theme swatch
$.mobile.page.prototype.options.theme = "s";
}

if ($.tizen.frameworkData) {
// Original scale of the theme
$.tizen.frameworkData.defaultViewportWidth = 360;	// Fit to device-width
$.tizen.frameworkData.defaultFontSize = 22;
}

})(jQuery);


text:
import sys
from django.core.management.sql import emit_post_migrate_signal, emit_pre_migrate_signal
from django.db import connections, transaction, DEFAULT_DB_ALIAS
from django.contrib.contenttypes.models import ContentType
from django.core.management.color import no_style
from django.utils.encoding import smart_unicode
import logging

logger = logging.getLogger('default')

def create(model, using):
    """ Mostly lifted from django.core.management.commands.migrate """

    # Get database connection and cursor
    db = using or DEFAULT_DB_ALIAS
    connection = connections[db]
    cursor = connection.cursor()
    try:
        # Get a list of already installed *models* so that references work right.
        tables = connection.introspection.table_names()
        seen_models = connection.introspection.installed_models(tables)
        created_models = set()
        pending_references = {}

        # Abort if the table we're going to create already exists
        if model._meta.db_table in tables:
            return

        emit_pre_migrate_signal(0, False, connection.alias)
        # with transaction.atomic(using=connection.alias, savepoint=False):
        #     sql, references = connection.creation.sql_create_model(model, no_style(), seen_models)
        #     seen_models.add(model)
        #     created_models.add(model)
        #     for refto, refs in references.items():
        #         pending_references.setdefault(refto, []).extend(refs)
        #         if refto in seen_models:
        #             sql.extend(connection.creation.sql_for_pending_references(refto, no_style(), pending_references))
        #     sql.extend(connection.creation.sql_for_pending_references(model, no_style(), pending_references))
        #
        #     for statement in sql:
        #         cursor.execute(statement)
        #     custom_sql = custom_sql_for_model(model, no_style(), connection)
        #     for sql in custom_sql:
        #         cursor.execute(sql)
        #     index_sql = connection.creation.sql_indexes_for_model(model, no_style())
        #     for sql in index_sql:
        #         cursor.execute(sql)
        #     tables.append(connection.introspection.table_name_converter(model._meta.db_table))
        with transaction.atomic(using=connection.alias, savepoint=connection.features.can_rollback_ddl):
            deferred_sql = []

            if model._meta.can_migrate(connection):
                with connection.schema_editor() as editor:
                    editor.create_model(model)
                    deferred_sql.extend(editor.deferred_sql)
                    editor.deferred_sql = []
                created_models.add(model)

            for statement in deferred_sql:
                cursor.execute(statement)

    finally:
        cursor.close()

    # Send the post_syncdb signal, so individual apps can do whatever they need
    # to do at this point.
    emit_post_migrate_signal(0, False, connection.alias)
    create_content_type(model)

def create_content_type(model):
    opts = model._meta
    try:
        ct = ContentType.objects.get(app_label=opts.app_label,
                                     model=opts.object_name.lower())
    except ContentType.DoesNotExist:
        ct = ContentType(app_label=opts.app_label, model=opts.object_name.lower())
    ct.save()

def clean_content_type(model):
    opts = model._meta
    try:
        ContentType.objects.get(app_label=opts.app_label, model=opts.object_name.lower()).delete()
    except ContentType.DoesNotExist:
        pass

def update_content_type(old_model, new_model):
    opts = old_model._meta
    new_opts = new_model._meta
    if opts.object_name.lower() != new_opts.object_name.lower() or opts.app_label != new_opts.app_label:
        try:
            ct = ContentType.objects.get(app_label=opts.app_label,
                                         model=opts.object_name.lower())
            ct.app_lable = new_opts.app_label
            ct.model = new_opts.object_name.lower()
            ct.save()
        except ContentType.DoesNotExist:
            pass


text:
@interface YRMTabBar : UITabBar

@end


text:
package build.tools.javazic;

import java.util.StringTokenizer;

/**
 * RuleRec class represents one record of the Rule set.
 *
 * @since 1.4
 */
class RuleRec {
    private int fromYear;
    private int toYear;
    private String type;
    private Month inMonth;
    private RuleDay onDay;
    private Time atTime;
    private int save;
    private String letters;
    private String line;
    private boolean isLastRule;

    int getFromYear() {
        return fromYear;
    }

    int getToYear() {
        return toYear;
    }

    Month getMonth() {
        return inMonth;
    }

    int getMonthNum() {
        return inMonth.value();
    }

    RuleDay getDay() {
        return onDay;
    }

    Time getTime() {
        return atTime;
    }

    int getSave() {
        return save;
    }

    String getLine() {
        return line;
    }

    /**
     * Sets the line from the text file.
     * @param line the text of the line
     */
    void setLine(String line) {
        this.line = line;
    }

    /**
     * @return true if the rule type is "odd".
     */
    boolean isOdd() {
        return "odd".equals(type);
    }

    /**
     * @return true if the rule type is "even".
     */
    boolean isEven() {
        return "even".equals(type);
    }

    /**
     * Determines if this rule record is the last DST schedule rule.
     *
     * @return true if this rule record has "max" as TO (year).
     */
    boolean isLastRule() {
        return isLastRule;
    }

    /**
     * Determines if the unadjusted until time of the specified ZoneRec
     * is the same as the transition time of this rule in the same
     * year as the ZoneRec until year.
     *
     * @param zrec ZoneRec to compare to
     * @param save the amount of daylight saving in milliseconds
     * @param gmtOffset the GMT offset value in milliseconds
     * @return true if the unadjusted until time is the same as rule's
     * transition time.
     */
    boolean isSameTransition(ZoneRec zrec, int save, int gmtOffset) {
        long    until, transition;

        if (zrec.getUntilTime().getType() != atTime.getType()) {
            until = zrec.getLocalUntilTime(save, gmtOffset);
            transition = Time.getLocalTime(zrec.getUntilYear(),
                                           getMonth(),
                                           getDay(),
                                           save,
                                           gmtOffset,
                                           atTime);
        } else {
            until = zrec.getLocalUntilTime();
            transition = Time.getLocalTime(zrec.getUntilYear(),
                                           getMonth(),
                                           getDay(),
                                           atTime.getTime());
        }

        return until == transition;
    }

    /**
     * Parses a Rule line and returns a RuleRec object.
     *
     * @param tokens a StringTokenizer object that should contain a
     * token for the "FROM" field and the rest.
     * @return a RuleRec object.
     */
    static RuleRec parse(StringTokenizer tokens) {
        RuleRec rec = new RuleRec();
        try {
            // FROM
            String token = tokens.nextToken();
            try {
                rec.fromYear = Integer.parseInt(token);
            } catch (NumberFormatException e) {
                // it's not integer
                if ("min".equals(token) || "minimum".equals(token)) {
                    rec.fromYear = Zoneinfo.getMinYear();
                } else if ("max".equals(token) || "maximum".equals(token)) {
                    rec.fromYear = Zoneinfo.getMaxYear();
                } else {
                    Main.panic("invalid year value: "+token);
                }
            }

            // TO
            token = tokens.nextToken();
            rec.isLastRule = false;
            try {
                rec.toYear = Integer.parseInt(token);
            } catch (NumberFormatException e) {
                // it's not integer
                if ("min".equals(token) || "minimum".equals(token)) {
                    rec.fromYear = Zoneinfo.getMinYear();
                } else if ("max".equals(token) || "maximum".equals(token)) {
                    rec.toYear = Integer.MAX_VALUE;
                    rec.isLastRule = true;
                } else if ("only".equals(token)) {
                    rec.toYear = rec.fromYear;
                } else {
                    Main.panic("invalid year value: "+token);
                }
            }

            // TYPE
            rec.type = tokens.nextToken();

            // IN
            rec.inMonth = Month.parse(tokens.nextToken());

            // ON
            rec.onDay = RuleDay.parse(tokens.nextToken());

            // AT
            rec.atTime = Time.parse(tokens.nextToken());

            // SAVE
            rec.save = (int) Time.parse(tokens.nextToken()).getTime();

            // LETTER/S
            rec.letters = tokens.nextToken();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return rec;
    }

    /**
     * Calculates the transition time of the given year under this rule.
     * @param year the year value
     * @param gmtOffset the GMT offset value in milliseconds
     * @param save the amount of daylight save time
     * @return the transition time in milliseconds of the given year in UTC.
     */
    long getTransitionTime(int year, int gmtOffset, int save) {
        long time = Time.getLocalTime(year, getMonth(),
                                      getDay(), atTime.getTime());
        if (atTime.isSTD()) {
            time -= gmtOffset;
        } else if (atTime.isWall()) {
            time -= gmtOffset + save;
        }
        return time;
    }

    private static int getInt(StringTokenizer tokens) {
        String token = tokens.nextToken();
        return Integer.parseInt(token);
    }
}


text:
This code is not the current version of my blog. Current version is written on Django framework and [can be found here](https://github.com/daGrevis/daGrevis.lv).

# Code of [my blog](http://dagrevis.lv/ "daGrevis.lv") (based on [Kohana](http://kohanaframework.org/ "Kohana") 3.2)

## How to get it working?

1. Get `system/` directory of Kohana 3.2 and place it in `/`,
2. Get the needed modules (in `application/modules.php` you can find the list),
3. Adjust `.htaccess` and `application/bootstrap.php`,
4. Adjust all needed files in `application/config` (like `database.php`),
5. Execute all SQL scripts from `application/sql`;

## First and second step explained

    [dagrevis@raitis dagrevis_lv]$ mkdir -m 777 application/cache application/logs
    [dagrevis@raitis dagrevis_lv]$ ls application/
    bootstrap.php  cache  classes  config  logs  messages  modules.php  routes.php  sql  vendor  views
    [dagrevis@raitis dagrevis_lv]$ git clone https://github.com/kohana/core system
    [dagrevis@raitis dagrevis_lv]$ ls system/
    classes  config  guide  i18n  media  messages  tests  utf8  views
    [dagrevis@raitis dagrevis_lv]$ mkdir modules
    [dagrevis@raitis dagrevis_lv]$ cd modules/
    [dagrevis@raitis modules]$ git clone https://github.com/Alert/profilertoolbar
    [dagrevis@raitis modules]$ git clone https://github.com/kohana/database
    [dagrevis@raitis modules]$ git clone https://github.com/zombor/Auto-Modeler am
    [dagrevis@raitis modules]$ git clone https://github.com/kohana/orm
    [dagrevis@raitis modules]$ git clone https://github.com/kohana/unittest
    [dagrevis@raitis modules]$ git clone https://github.com/kloopko/kohana-pagination pagination
    [dagrevis@raitis modules]$ git clone https://github.com/daGrevis/Darkmown darkmown
    [dagrevis@raitis modules]$ cd ../
    [dagrevis@raitis dagrevis_lv]$ ls modules/
    am  darkmown  database  orm  pagination  profilertoolbar  unittest


text:
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

namespace Microsoft.AspNetCore.ResponseCaching;

internal interface IResponseCachingKeyProvider
{
    /// <summary>
    /// Create a base key for a response cache entry.
    /// </summary>
    /// <param name="context">The <see cref="ResponseCachingContext"/>.</param>
    /// <returns>The created base key.</returns>
    string CreateBaseKey(ResponseCachingContext context);

    /// <summary>
    /// Create a vary key for storing cached responses.
    /// </summary>
    /// <param name="context">The <see cref="ResponseCachingContext"/>.</param>
    /// <returns>The created vary key.</returns>
    string CreateStorageVaryByKey(ResponseCachingContext context);

    /// <summary>
    /// Create one or more vary keys for looking up cached responses.
    /// </summary>
    /// <param name="context">The <see cref="ResponseCachingContext"/>.</param>
    /// <returns>An ordered <see cref="IEnumerable{T}"/> containing the vary keys to try when looking up items.</returns>
    IEnumerable<string> CreateLookupVaryByKeys(ResponseCachingContext context);
}


text:
package eu.dnetlib.iis.wf.report.pushgateway.converter;

import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

/**
 * Configuration of labeled metric. Labeled metric configuration is given by metric name and a list of label configurations.
 */
public class LabeledMetricConf {
    private String metricName;
    private List<LabelConf> labelConfs;

    public LabeledMetricConf() {
    }

    public LabeledMetricConf(String metricName, List<LabelConf> labelConfs) {
        this.metricName = metricName;
        this.labelConfs = labelConfs;
    }

    public String getMetricName() {
        return metricName;
    }

    public void setMetricName(String metricName) {
        this.metricName = metricName;
    }

    public List<LabelConf> getLabelConfs() {
        return labelConfs;
    }

    public void setLabelConfs(List<LabelConf> labelConfs) {
        this.labelConfs = labelConfs;
    }

    public ExtractedMetric toExtractedMetric(List<String> labelValues, Double value) {
        return new ExtractedMetric(metricName,
                labelConfs.stream().map(LabelConf::getLabelName).collect(Collectors.toList()),
                labelValues,
                value);
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        LabeledMetricConf that = (LabeledMetricConf) o;
        return Objects.equals(metricName, that.metricName) &&
                Objects.equals(labelConfs, that.labelConfs);
    }

    @Override
    public int hashCode() {
        return Objects.hash(metricName, labelConfs);
    }
}


text:
/**
 * Contains annotators that annotate language features within text, including sentences, word tokens
 * and Part-of-Speech (POS) tags.
 *
 * <p>Classes in this package should generally be run at the start of the pipeline, as many of the
 * annotations they generate are used by subsequent annotations.
 */
// Dstl (c) Crown Copyright 2017
package uk.gov.dstl.baleen.annotators.language;


text:
title: Commands
weight: 20
pre: "<b>2. </b>"
chapter: true
---

### NuKeeper

# Commands

| Name      |  Type    | Intention |
|-----------|----------|---------------------------|
| `inspect` | local | inspect outdated packages |
| `update` | local| updates outdated packages |
| `repo` | remote| find outdated packages and updates it with a PR to your platform |
| `organisation` | remote| find outdated packages and updates it with a PR to your platform for the whole organisation. |
| `global` | remote| find outdated packages and updates it with a PR to your platform for all your repositories.|

{{% notice info %}}
The organisation and the global command are only available for *github*, because the other platforms don't allow such a powerful token.
{{% /notice %}}