text:
<bill session="115" type="h" number="370" updated="2017-07-29T07:16:18Z">
  <state datetime="2017-01-09">REFERRED</state>
  <status>
    <introduced datetime="2017-01-09"/>
  </status>
  <introduced datetime="2017-01-09"/>
  <titles>
    <title type="official" as="introduced">To repeal the Patient Protection and Affordable Care Act and health care-related provisions in the Health Care and Education Reconciliation Act of 2010, and for other purposes.</title>
    <title type="display">To repeal the Patient Protection and Affordable Care Act and health care-related provisions in the Health Care and Education Reconciliation Act of 2010, and for other purposes.</title>
  </titles>
  <sponsor bioguide_id="F000461"/>
  <cosponsors>
    <cosponsor bioguide_id="A000372" joined="2017-07-28"/>
    <cosponsor bioguide_id="C001103" joined="2017-07-24"/>
    <cosponsor bioguide_id="F000460" joined="2017-03-13"/>
    <cosponsor bioguide_id="G000565" joined="2017-07-24"/>
  </cosponsors>
  <actions>
    <action datetime="2017-01-09">
      <text>Introduced in House</text>
    </action>
    <action datetime="2017-01-09" state="REFERRED">
      <text>Referred to the Committee on Energy and Commerce, and in addition to the Committees on Education and the Workforce, Ways and Means, the Judiciary, Natural Resources, Rules, House Administration, Appropriations, and the Budget, for a period to be subsequently determined by the Speaker, in each case for consideration of such provisions as fall within the jurisdiction of the committee concerned.</text>
    </action>
    <action datetime="2017-01-09">
      <text>Referred to House Energy and Commerce</text>
    </action>
    <action datetime="2017-01-09">
      <text>Referred to House Education and the Workforce</text>
    </action>
    <action datetime="2017-01-09">
      <text>Referred to House Ways and Means</text>
    </action>
    <action datetime="2017-01-09">
      <text>Referred to House Judiciary</text>
    </action>
    <action datetime="2017-01-09">
      <text>Referred to House Natural Resources</text>
    </action>
    <action datetime="2017-01-09">
      <text>Referred to House Rules</text>
    </action>
    <action datetime="2017-01-09">
      <text>Referred to House Administration</text>
    </action>
    <action datetime="2017-01-09">
      <text>Referred to House Appropriations</text>
    </action>
    <action datetime="2017-01-09">
      <text>Referred to House Budget</text>
    </action>
    <action datetime="2017-01-25">
      <text>Referred to the Subcommittee on Health.</text>
    </action>
    <action datetime="2017-01-26">
      <text>Referred to the Subcommittee on Health.</text>
    </action>
    <action datetime="2017-02-10">
      <text>Referred to the Subcommittee on Indian, Insular and Alaska Native Affairs.</text>
    </action>
  </actions>
  <committees>
    <committee subcommittee="" code="HSII" name="House Natural Resources" activity="Referral"/>
    <committee subcommittee="Indian, Insular and Alaska Native Affairs" code="HSII24" name="House Natural Resources" activity="Referral"/>
    <committee subcommittee="" code="HSWM" name="House Ways and Means" activity="Referral"/>
    <committee subcommittee="Health" code="HSWM02" name="House Ways and Means" activity="Referral"/>
    <committee subcommittee="" code="HSIF" name="House Energy and Commerce" activity="Referral"/>
    <committee subcommittee="Health" code="HSIF14" name="House Energy and Commerce" activity="Referral"/>
    <committee subcommittee="" code="HSBU" name="House Budget" activity="Referral"/>
    <committee subcommittee="" code="HSAP" name="House Appropriations" activity="Referral"/>
    <committee subcommittee="" code="HSHA" name="House Administration" activity="Referral"/>
    <committee subcommittee="" code="HSRU" name="House Rules" activity="Referral"/>
    <committee subcommittee="" code="HSJU" name="House Judiciary" activity="Referral"/>
    <committee subcommittee="" code="HSED" name="House Education and the Workforce" activity="Referral"/>
  </committees>
  <relatedbills>
    <bill type="h" session="115" relation="unknown" number="277"/>
  </relatedbills>
  <subjects>
    <term name="Health"/>
    <term name="Health care costs and insurance"/>
    <term name="Health care coverage and access"/>
  </subjects>
  <amendments/>
  <summary date="2017-01-09T05:00:00Z" status="Introduced in House">This bill repeals the Patient Protection and Affordable Care Act and the health care provisions of the Health Care and Education Reconciliation Act of 2010. The repeal is effective on January 1, 2020. Provisions of law amended by the repealed provisions are restored.

The budgetary effects of this bill must not be entered on the PAYGO scorecards maintained by the Office of Management and Budget.</summary>
  <committee-reports/>
</bill>


text:
/* this file has been autogenerated by vtkNodeJsWrap */
/* editing this might proof futile */

#ifndef NATIVE_EXTENSION_VTK_VTKDIJKSTRAIMAGECONTOURLINEINTERPOLATORWRAP_H
#define NATIVE_EXTENSION_VTK_VTKDIJKSTRAIMAGECONTOURLINEINTERPOLATORWRAP_H

#include <nan.h>

#include <vtkSmartPointer.h>
#include <vtkDijkstraImageContourLineInterpolator.h>

#include "vtkContourLineInterpolatorWrap.h"
#include "../../plus/plus.h"

class VtkDijkstraImageContourLineInterpolatorWrap : public VtkContourLineInterpolatorWrap
{
	public:
		using Nan::ObjectWrap::Wrap;
		static void Init(v8::Local<v8::Object> exports);
		static void InitPtpl();
		static void ConstructorGetter(
			v8::Local<v8::String> property,
			const Nan::PropertyCallbackInfo<v8::Value>& info);

		VtkDijkstraImageContourLineInterpolatorWrap(vtkSmartPointer<vtkDijkstraImageContourLineInterpolator>);
		VtkDijkstraImageContourLineInterpolatorWrap();
		~VtkDijkstraImageContourLineInterpolatorWrap( );
		static Nan::Persistent<v8::FunctionTemplate> ptpl;

	private:
		static void New(const Nan::FunctionCallbackInfo<v8::Value>& info);

		static void GetClassName(const Nan::FunctionCallbackInfo<v8::Value>& info);
		static void GetCostImage(const Nan::FunctionCallbackInfo<v8::Value>& info);
		static void GetDijkstraImageGeodesicPath(const Nan::FunctionCallbackInfo<v8::Value>& info);
		static void InterpolateLine(const Nan::FunctionCallbackInfo<v8::Value>& info);
		static void IsA(const Nan::FunctionCallbackInfo<v8::Value>& info);
		static void NewInstance(const Nan::FunctionCallbackInfo<v8::Value>& info);
		static void SafeDownCast(const Nan::FunctionCallbackInfo<v8::Value>& info);
		static void SetCostImage(const Nan::FunctionCallbackInfo<v8::Value>& info);

#ifdef VTK_NODE_PLUS_VTKDIJKSTRAIMAGECONTOURLINEINTERPOLATORWRAP_CLASSDEF
		VTK_NODE_PLUS_VTKDIJKSTRAIMAGECONTOURLINEINTERPOLATORWRAP_CLASSDEF
#endif
};

#endif

redpajama_set_name: RedPajamaGithub


text:
title: Hyper-V Containers - Quick Start
description: Hyper-V containers quick start.
keywords: docker, containers
author: neilpeterson
manager: timlt
ms.date: 05/02/2016
ms.topic: article
ms.prod: windows-containers
ms.service: windows-containers
ms.assetid: 7b907b0e-3fa8-4925-8615-bbb5812c2402
redirect_url: ./quick_start
---

# Document has been deprecated.


text:
package waechter

// UserLoginEmailOrUsernameParams is the required information for logging in
type UserLoginEmailOrUsernameParams struct {
	UsernameOrEmail string `json:"usernameOrEmail" binding:"required"`
	Password        string `json:"password" binding:"required"`
	RememberMe      bool   `json:"rememberMe"`
}

// UserLoginWithUsernameOrEmail logs a user in using email or username and password. Returns a new refresh token.
func (waechter *Waechter) UserLoginWithUsernameOrEmail(parameters UserLoginEmailOrUsernameParams) (string, *AuthError) {
	var user *User
	var err error
	// Retrieve the desired user
	if user, err = waechter.getDBAdapter().GetUserByUsernameOrEmail(parameters.UsernameOrEmail); err != nil {
		return "", userNotFoundError(err)
	}

	return waechter.performLogin(parameters.Password, user, parameters.RememberMe)
}


text:
layout: page
title: Hahn Pride Networks Trade Fair
date: 2016-05-24
author: Charles Moreno
tags: weekly links, java
status: published
summary: Pellentesque quis pellentesque tellus. Nam imperdiet mi dolor, eget.
banner: images/banner/leisure-02.jpg
booking:
  startDate: 08/29/2016
  endDate: 09/01/2016
  ctyhocn: OLNNYHX
  groupCode: HPNTF
published: true
---
Sed et venenatis nibh. Etiam rhoncus auctor tellus lacinia facilisis. In quis sodales dui. Suspendisse mollis congue est quis ornare. Donec at lectus et justo fermentum pretium quis sed eros. Curabitur finibus, libero sed finibus pretium, lacus augue consequat quam, eget tristique justo ipsum vitae metus. Quisque nec ligula felis. Nunc id erat sed tellus semper ornare.
Sed blandit dignissim consectetur. Integer facilisis pulvinar tempor. Pellentesque fringilla non ipsum ac lobortis. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Proin a ex metus. Interdum et malesuada fames ac ante ipsum primis in faucibus. In hac habitasse platea dictumst. Fusce interdum mauris et turpis gravida fringilla.

* Maecenas interdum lacus a sem condimentum maximus
* Mauris vitae ante vitae lorem ultrices vestibulum
* Aenean id ipsum quis mi ornare placerat quis consequat leo.

Fusce mattis enim ligula, ac faucibus odio ultricies sed. Etiam eu turpis sed ex rutrum luctus. Donec cursus lorem in diam faucibus, in vestibulum enim molestie. Suspendisse imperdiet malesuada elit, id rutrum dui. Cras tristique neque ipsum, eget hendrerit diam aliquam nec. Proin pharetra erat eu mi cursus, non tempor turpis auctor. Fusce pretium rhoncus orci ut sollicitudin. Phasellus nec ligula at tellus fringilla accumsan.


text:
#import "IoTDeviceController.h"
#import <itoast.h>

typedef enum
{
    // writable
    IoTDeviceWriteUpdateData = 0,   //更新数据
    IoTDeviceWriteLED_R_onOff,      //LED R开关
    IoTDeviceWriteLED_Color,        //LED 组合颜色
    IoTDeviceWriteLED_R,            //LED R值
    IoTDeviceWriteLED_G,            //LED G值
    IoTDeviceWriteLED_B,            //LED B值
    IoTDeviceWriteMotorSpeed,       //电机转速

    // readonly
    IoTDeviceReadIR,                //红外
    IoTDeviceReadTemperature,       //温度
    IoTDeviceReadHumidity,          //湿度

    // alarm
    IoTDeviceAlarm1,                //报警1
    IoTDeviceAlarm2,                //报警2

    // fault
    IoTDeviceFaultLED,              //LED故障
    IoTDeviceFaultMotor,            //电机故障
    IoTDeviceFaultSensor,           //温湿度传感器故障
    IoTDeviceFaultIR,               //红外故障
}IoTDeviceDataPoint;

typedef enum
{
    IoTDeviceCommandWrite = 1,      //写
    IoTDeviceCommandRead = 2,       //读
    IoTDeviceCommandResponse = 3,   //读响应
    IoTDeviceCommandNotify = 4,     //通知
}IoTDeviceCommand;

#define DATA_CMD                        @"cmd"      //命令
#define DATA_ENTITY                     @"entity0"  //实体
#define DATA_ATTR_LED_R_ONOFF           @"attr0"    //属性:LED R开关
#define DATA_ATTR_LED_COLOR             @"attr1"    //属性:LED 组合颜色
#define DATA_ATTR_LED_R                 @"attr2"    //属性:LED R值
#define DATA_ATTR_LED_G                 @"attr3"    //属性:LED G值
#define DATA_ATTR_LED_B                 @"attr4"    //属性:LED B值
#define DATA_ATTR_MOTORSPEED            @"attr5"    //属性:电机转速
#define DATA_ATTR_IR                    @"attr6"    //属性:红外探测
#define DATA_ATTR_TEMPERATURE           @"attr7"    //属性:温度
#define DATA_ATTR_HUMIDITY              @"attr8"    //属性:湿度

@interface IoTDeviceController ()
{
    UIAlertView *_alertView;

    // 这些变量用于数据更新
    BOOL bLedCtrl;
    NSInteger iLedR;
    NSInteger iledColor;
    CGFloat fLedR;
    CGFloat fLedG;
    CGFloat fLedB;
    CGFloat fMonitorSpeed;
    NSInteger iir;
    CGFloat fTemperature;
    CGFloat fHumidity;

    // 暂停数据更新
    NSTimer *remainTimer;
    NSMutableArray *updateCtrl;
}

@property (readonly, nonatomic) XPGWifiDevice *device;
@property (weak, nonatomic) IBOutlet UITableView *tableView;
@property (assign) BOOL isToasted;

@end

@implementation IoTDeviceController

- (id)initWithDevice:(XPGWifiDevice *)device
{
    self = [super init];
    if(self)
    {
        if(nil == device || !device.isConnected)
            return nil;

        _device = device;
    }
    return self;
}

- (void)viewDidLoad {
    [super viewDidLoad];

    UIImage *image = [UIImage imageNamed:@"align"];
    image = [IoTAppDelegate imageWithImage:image scaledToSize:CGSizeMake(25, 20)];
    UIBarButtonItem *rightItem = [[UIBarButtonItem alloc] initWithImage:image style:UIBarButtonItemStylePlain target:self action:@selector(rightMenu)];
    self.navigationItem.rightBarButtonItem = rightItem;
}

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];

    //大循环判断设备是否在线
    if(!self.device.isOnline && !self.device.isLAN)
    {
        [_alertView dismissWithClickedButtonIndex:0 animated:YES];
        _alertView = [[UIAlertView alloc] initWithTitle:@"警告" message:@"设备不在线,你不可以控制设备,但你可以解除绑定信息。" delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil];
        [_alertView show];
        self.view.userInteractionEnabled = NO;
    }

    //初始化信息
    self.navigationItem.title = _device.productName;

    [XPGWifiSDK sharedInstance].delegate = self;
    _device.delegate = self;

    iLedR = 0;
    iledColor = -1;
    fLedG = 0;
    fLedB = 0;
    iir = 0;
    fMonitorSpeed = 0;
    fTemperature = -1;
    fHumidity = -1;

    //暂停更新页面的计时器
    if(!remainTimer)
        remainTimer = [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(onRemainTimer) userInfo:nil repeats:YES];
    updateCtrl = [NSMutableArray array];
}

- (void)viewDidAppear:(BOOL)animated
{
    [self writeDataPoint:IoTDeviceWriteUpdateData value:nil];
}

- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];
    _device.delegate = nil;
    [XPGWifiSDK sharedInstance].delegate = nil;
    [remainTimer invalidate];
    remainTimer = nil;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

#pragma mark - tableView
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 9;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    switch (indexPath.row) {
        case 2:
        case 3:
        case 4:
        case 5:
            return 70;
        default:
            break;
    }
    return 44;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *slider_id = @"SliderCell";
    static NSString *label_id = @"LabelCell";
    static NSString *bool_id = @"BoolCell";
    static NSString *enum_id = @"EnumCell";

    NSString *reuseIndentifer = @"";

    switch (indexPath.row) {
        case 0:
        case 6:
            reuseIndentifer = bool_id;
            break;
        case 1:
            reuseIndentifer = enum_id;
            break;
        case 2:
        case 3:
        case 4:
        case 5:
           reuseIndentifer = slider_id;
            break;
        case 7:
        case 8:
            reuseIndentifer = label_id;
            break;
        default:
            break;
    }

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:reuseIndentifer];
    if(nil == cell)
    {
        UINib *nib = nil;
        if([reuseIndentifer isEqualToString:slider_id])
            nib = [UINib nibWithNibName:@"IoTDeviceSliderCell" bundle:nil];
        else if([reuseIndentifer isEqualToString:label_id])
            nib = [UINib nibWithNibName:@"IoTDeviceLabelCell" bundle:nil];
        else if([reuseIndentifer isEqualToString:bool_id])
            nib = [UINib nibWithNibName:@"IoTDeviceBoolCell" bundle:nil];
        else if([reuseIndentifer isEqualToString:enum_id])
            nib = [UINib nibWithNibName:@"IoTDeviceEnumCell" bundle:nil];

        if(nib)
        {
            [tableView registerNib:nib forCellReuseIdentifier:reuseIndentifer];
            cell = [tableView dequeueReusableCellWithIdentifier:reuseIndentifer];
        }
    }

    if(!cell)
        return cell;

    switch (indexPath.row) {
        case 0:
        {
            IoTDeviceBoolCell *boolCell = (IoTDeviceBoolCell *)cell;
            boolCell.title = @"开启/关闭红色灯";
            boolCell.value = iLedR;
            boolCell.tag = indexPath.row;
            boolCell.delegate = self;
            break;
        }
        case 1:
        {
            IoTDeviceEnumCell *enumCell = (IoTDeviceEnumCell *)cell;
            enumCell.title = @"设定LED组合颜色";
            enumCell.values = @[@"自定义", @"黄色", @"紫色", @"粉色"];
            enumCell.index = iledColor;
            enumCell.tag = indexPath.row;
            enumCell.delegate = self;
            break;
        }
        case 2:
        {
            IoTDeviceSliderCell *sliderCell = (IoTDeviceSliderCell *)cell;
            sliderCell.title = @"设定LED颜色R值";
            sliderCell.min = 0;
            sliderCell.max = 254;
            sliderCell.value = fLedR;
            sliderCell.step = 1;
            sliderCell.tag = indexPath.row;
            sliderCell.delegate = self;
            sliderCell.userInteractionEnabled = bLedCtrl;
            break;
        }
        case 3:
        {
            IoTDeviceSliderCell *sliderCell = (IoTDeviceSliderCell *)cell;
            sliderCell.title = @"设定LED颜色G值";
            sliderCell.min = 0;
            sliderCell.max = 254;
            sliderCell.value = fLedG;
            sliderCell.step = 1;
            sliderCell.tag = indexPath.row;
            sliderCell.delegate = self;
            sliderCell.userInteractionEnabled = bLedCtrl;
            break;
        }
        case 4:
        {
            IoTDeviceSliderCell *sliderCell = (IoTDeviceSliderCell *)cell;
            sliderCell.title = @"设定LED颜色B值";
            sliderCell.min = 0;
            sliderCell.max = 254;
            sliderCell.value = fLedB;
            sliderCell.step = 1;
            sliderCell.tag = indexPath.row;
            sliderCell.delegate = self;
            sliderCell.userInteractionEnabled = bLedCtrl;
            break;
        }
        case 5:
        {
            IoTDeviceSliderCell *sliderCell = (IoTDeviceSliderCell *)cell;
            sliderCell.title = @"设定电机转速";
            sliderCell.min = -5;
            sliderCell.max = 5;
            sliderCell.value = fMonitorSpeed;
            sliderCell.step = 1;
            sliderCell.tag = indexPath.row;
            sliderCell.delegate = self;
            break;
        }
        case 6:
        {
            IoTDeviceBoolCell *boolCell = (IoTDeviceBoolCell *)cell;
            boolCell.title = @"红外探测";
            boolCell.value = iir;
            boolCell.tag = indexPath.row;
            boolCell.delegate = self;
            boolCell.userInteractionEnabled = NO;
            break;
        }
        case 7:
        {
            IoTDeviceLabelCell *sliderCell = (IoTDeviceLabelCell *)cell;
            sliderCell.title = @"温度";
            if(fTemperature < 0)
                sliderCell.value = @"-";
            else
                sliderCell.value = [NSString stringWithFormat:@"%@", @(fTemperature)];
            break;
        }
        case 8:
        {
            IoTDeviceLabelCell *sliderCell = (IoTDeviceLabelCell *)cell;
            sliderCell.title = @"湿度";
            if(fHumidity < 0)
                sliderCell.value = @"-";
            else
                sliderCell.value = [NSString stringWithFormat:@"%@", @(fHumidity)];
            break;
        }
        default:
            break;
    }

    return cell;
}

#pragma mark - Data Point
- (void)writeDataPoint:(IoTDeviceDataPoint)dataPoint value:(id)value
{
    NSDictionary *data = nil;
    switch (dataPoint) {
        case IoTDeviceWriteUpdateData:
            data = @{DATA_CMD: @(IoTDeviceCommandRead)};
            break;
        case IoTDeviceWriteLED_R_onOff:
            data = @{DATA_CMD: @(IoTDeviceCommandWrite), DATA_ENTITY: @{DATA_ATTR_LED_R_ONOFF: value}};
            break;
        case IoTDeviceWriteLED_Color:
            data = @{DATA_CMD: @(IoTDeviceCommandWrite), DATA_ENTITY: @{DATA_ATTR_LED_COLOR: value}};
            break;
        case IoTDeviceWriteLED_R:
            data = @{DATA_CMD: @(IoTDeviceCommandWrite), DATA_ENTITY: @{DATA_ATTR_LED_R: value}};
            break;
        case IoTDeviceWriteLED_G:
            data = @{DATA_CMD: @(IoTDeviceCommandWrite), DATA_ENTITY: @{DATA_ATTR_LED_G: value}};
            break;
        case IoTDeviceWriteLED_B:
            data = @{DATA_CMD: @(IoTDeviceCommandWrite), DATA_ENTITY: @{DATA_ATTR_LED_B: value}};
            break;
        case IoTDeviceWriteMotorSpeed:
            data = @{DATA_CMD: @(IoTDeviceCommandWrite), DATA_ENTITY: @{DATA_ATTR_MOTORSPEED: value}};
            break;
        default:
            NSLog(@"Error: write invalid datapoint, skip.");
            return;
    }

    NSLog(@"Write data: %@", data);
    [self.device write:data];
}

- (id)readDataPoint:(IoTDeviceDataPoint)dataPoint data:(NSDictionary *)data
{
    if(![data isKindOfClass:[NSDictionary class]])
    {
        NSLog(@"Error: could not read data, error data format.");
        return nil;
    }

    NSNumber *nCommand = [data valueForKey:DATA_CMD];
    if(![nCommand isKindOfClass:[NSNumber class]])
    {
        NSLog(@"Error: could not read cmd, error cmd format.");
        return nil;
    }

    int nCmd = [nCommand intValue];
    if(nCmd != IoTDeviceCommandResponse && nCmd != IoTDeviceCommandNotify)
    {
        NSLog(@"Error: command is invalid, skip.");
        return nil;
    }

    NSDictionary *attributes = [data valueForKey:DATA_ENTITY];
    if(![attributes isKindOfClass:[NSDictionary class]])
    {
        NSLog(@"Error: could not read attributes, error attributes format.");
        return nil;
    }

    switch (dataPoint) {
        case IoTDeviceWriteLED_R_onOff:
            return [attributes valueForKey:DATA_ATTR_LED_R_ONOFF];
        case IoTDeviceWriteLED_Color:
            return [attributes valueForKey:DATA_ATTR_LED_COLOR];
        case IoTDeviceWriteLED_R:
            return [attributes valueForKey:DATA_ATTR_LED_R];
        case IoTDeviceWriteLED_G:
            return [attributes valueForKey:DATA_ATTR_LED_G];
        case IoTDeviceWriteLED_B:
            return [attributes valueForKey:DATA_ATTR_LED_B];
        case IoTDeviceWriteMotorSpeed:
            return [attributes valueForKey:DATA_ATTR_MOTORSPEED];
        case IoTDeviceReadIR:
            return [attributes valueForKey:DATA_ATTR_IR];
        case IoTDeviceReadTemperature:
            return [attributes valueForKey:DATA_ATTR_TEMPERATURE];
        case IoTDeviceReadHumidity:
            return [attributes valueForKey:DATA_ATTR_HUMIDITY];
        default:
            NSLog(@"Error: read invalid datapoint, skip.");
            break;
    }
    return nil;
}

- (void)rightMenu
{
    UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"" delegate:self cancelButtonTitle:@"取消" destructiveButtonTitle:nil otherButtonTitles:@"断开连接",@"解除绑定",@"获取设备状态",
                                  nil];
    actionSheet.tag = 1;
    [actionSheet showInView:self.view];
}

#pragma mark - Callbacks
- (void)IoTDeviceSliderDidUpdateValue:(IoTDeviceSliderCell *)cell value:(CGFloat)value
{
    switch (cell.tag) {
        case 2:
            fLedR = value;
            [self writeDataPoint:IoTDeviceWriteLED_R value:@(value)];
            [self addRemainElement:cell.tag];
            break;
        case 3:
            fLedG = value;
            [self writeDataPoint:IoTDeviceWriteLED_G value:@(value)];
            [self addRemainElement:cell.tag];
            break;
        case 4:
            fLedB = value;
            [self writeDataPoint:IoTDeviceWriteLED_B value:@(value)];
            [self addRemainElement:cell.tag];
            break;
        case 5:
            fMonitorSpeed = value;
            [self writeDataPoint:IoTDeviceWriteMotorSpeed value:@(value)];
            [self addRemainElement:cell.tag];
            break;
        default:
            return;
    }
    [self addRemainElement:cell.tag];
}

- (void)IoTDeviceSwitchDidUpdateValue:(IoTDeviceBoolCell *)cell value:(BOOL)value
{
    switch (cell.tag) {
        case 0:
            iLedR = value;
            [self writeDataPoint:IoTDeviceWriteLED_R_onOff value:@(value)];
            [self addRemainElement:cell.tag];
            break;
        default:
            break;
    }
}

- (void)IoTDeviceDidSelectedEnum:(IoTDeviceEnumCell *)cell
{
    IoTDeviceEnumSelection *selectController = [[IoTDeviceEnumSelection alloc] initWithEnumCell:cell];
    [self.navigationController pushViewController:selectController animated:YES];
}

- (void)IoTDeviceEnumDidSelectedValue:(IoTDeviceEnumCell *)cell index:(NSInteger)index
{
    switch (cell.tag) {
        case 1:
            iledColor = index;
            [self writeDataPoint:IoTDeviceWriteLED_Color value:@(index)];
            [self addRemainElement:cell.tag];
            break;
        default:
            break;
    }
}

- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
    switch (actionSheet.tag) {
        case 1://控制页面
        {
            switch (buttonIndex) {
                case 0:
                    //断开链接
                    [self popViewController];
                    break;
                case 1:
                {
                    //解绑
                    MBProgressHUD *hud = AppDelegate.hud;
                    hud.labelText = @"与服务器解除绑定...";
                    [hud show:YES];
                    [[XPGWifiSDK sharedInstance] unbindDeviceWithUid:AppDelegate.uid token:AppDelegate.token did:self.device.did passCode:nil];
                    break;
                }
                case 2:
                {
                    //更新数据
                    [self writeDataPoint:IoTDeviceWriteUpdateData value:nil];
                    break;
                }
                default:
                    break;
            }
            break;
        }
        default:
            break;
    }
}

- (CGFloat)prepareForUpdateFloatRows:(NSString *)str value:(CGFloat)value rows:(NSMutableArray *)rows index:(NSInteger)index
{
    if([self isElementRemaining:index])
        return value;

    if([str isKindOfClass:[NSNumber class]] ||
       ([str isKindOfClass:[NSString class]] && str.length > 0))
    {
        CGFloat newValue = [str floatValue];
        if(newValue != value)
        {
            value = newValue;
            [rows addObject:[NSIndexPath indexPathForRow:index inSection:0]];
        }
    }
    return value;
}

- (NSInteger)prepareForUpdateIntegerRows:(NSString *)str value:(NSInteger)value rows:(NSMutableArray *)rows index:(NSInteger)index
{
    if([self isElementRemaining:index])
        return value;

    if([str isKindOfClass:[NSNumber class]] ||
        ([str isKindOfClass:[NSString class]] && str.length > 0))
    {
        NSInteger newValue = [str integerValue];
        if(newValue != value)
        {
            value = newValue;
            [rows addObject:[NSIndexPath indexPathForRow:index inSection:0]];
        }
    }
    return value;
}

- (BOOL)XPGWifiDevice:(XPGWifiDevice *)device didReceiveData:(NSDictionary *)data result:(int)result
{
    /**
     * 数据部分
     */
    NSDictionary *_data = [data valueForKey:@"data"];

    NSString *ledRonOff = [self readDataPoint:IoTDeviceWriteLED_R_onOff data:_data];
    NSString *ledColor = [self readDataPoint:IoTDeviceWriteLED_Color data:_data];
    NSString *ledR = [self readDataPoint:IoTDeviceWriteLED_R data:_data];
    NSString *ledG = [self readDataPoint:IoTDeviceWriteLED_G data:_data];
    NSString *ledB = [self readDataPoint:IoTDeviceWriteLED_B data:_data];
    NSString *motorSpeed = [self readDataPoint:IoTDeviceWriteMotorSpeed data:_data];
    NSString *ir = [self readDataPoint:IoTDeviceReadIR data:_data];
    NSString *temperature = [self readDataPoint:IoTDeviceReadTemperature data:_data];
    NSString *humidity = [self readDataPoint:IoTDeviceReadHumidity data:_data];

    NSMutableArray *rows = [NSMutableArray array];

    iLedR = [self prepareForUpdateIntegerRows:ledRonOff value:iLedR rows:rows index:0];
    iledColor = [self prepareForUpdateIntegerRows:ledColor value:iledColor rows:rows index:1];

    fLedR = [self prepareForUpdateFloatRows:ledR value:fLedR rows:rows index:2];
    fLedG = [self prepareForUpdateFloatRows:ledG value:fLedG rows:rows index:3];
    fLedB = [self prepareForUpdateFloatRows:ledB value:fLedB rows:rows index:4];

    fMonitorSpeed = [self prepareForUpdateFloatRows:motorSpeed value:fMonitorSpeed rows:rows index:5];
    iir = [self prepareForUpdateIntegerRows:ir value:iir rows:rows index:6];
    fTemperature = [self prepareForUpdateFloatRows:temperature value:fTemperature rows:rows index:7] + 13;//y=x+13
    fHumidity = [self prepareForUpdateFloatRows:humidity value:fHumidity rows:rows index:8];

    if(rows.count > 0)
        [self.tableView reloadRowsAtIndexPaths:rows withRowAnimation:UITableViewRowAnimationNone];

    // 如果 LED 组合颜色不是自定义,则 LED 不可控制
    if(iledColor > 0)
        [self setCustomLEDMode:NO];
    else
        [self setCustomLEDMode:YES];

    /**
     * 报警和错误
     */
    if([self.navigationController.viewControllers lastObject] != self ||
       self.isToasted)
        return YES;

    NSString *str = @"";
    NSArray *alerts = [data valueForKey:@"alerts"];
    NSArray *faults = [data valueForKey:@"faults"];

    if(alerts.count == 0 && faults.count == 0)
        return YES;

    if(alerts.count > 0)
    {
        str = @"设备报警:";
        for(NSDictionary *dict in alerts)
        {
            for(NSString *name in dict.allKeys)
            {
                if(str.length > 0)
                    str = [str stringByAppendingString:@"\n"];
                NSNumber *value = [dict valueForKey:name];
                NSString *alert = [NSString stringWithFormat:@"%@ 错误码:%@", name, value];
                str = [str stringByAppendingString:alert];
            }
        }
    }

    if(faults.count > 0)
    {
        if(str.length > 0)
            str = [str stringByAppendingString:@"\n"];
        str = [str stringByAppendingString:@"设备错误:"];

        for(NSDictionary *dict in faults)
        {
            for(NSString *name in dict.allKeys)
            {
                if(str.length > 0)
                    str = [str stringByAppendingString:@"\n"];
                NSNumber *value = [dict valueForKey:name];
                NSString *fault = [NSString stringWithFormat:@"%@ 错误码:%@", name, value];
                str = [str stringByAppendingString:fault];
            }
        }
    }

    [self performSelectorInBackground:@selector(toast:) withObject:str];

    return YES;
}

- (void)XPGWifiDeviceDidDisconnected:(XPGWifiDevice *)device
{
    if(AppDelegate.hud.alpha == 0)
    {
        [_alertView dismissWithClickedButtonIndex:0 animated:YES];
        _alertView = [[UIAlertView alloc] initWithTitle:@"提示" message:@"连接已断开" delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil];
        [_alertView show];
        [self performSelector:@selector(popViewController) withObject:nil afterDelay:0.5];
    }
}

- (void)XPGWifiSDK:(XPGWifiSDK *)wifiSDK didUnbindDevice:(NSString *)did error:(NSNumber *)error errorMessage:(NSString *)errorMessage
{
    if([self.device.did isEqualToString:did])
    {
        //为了防止解除绑定和断开连接的时间冲突,先把 device.delegate 赋空
        self.device.delegate = nil;

        //处理解绑事件
        [AppDelegate.hud hide:YES];
        NSDictionary *params = ([error intValue] == 0)?
        @{@"title": @"已成功解除绑定",
          @"delegate": self}:
        @{@"title": @"解除绑定失败"};
        [[[UIAlertView alloc] initWithTitle:[params valueForKey:@"title"] message:@"" delegate:[params valueForKey:@"delegate"] cancelButtonTitle:@"确定" otherButtonTitles: nil] show];
        [self performSelector:@selector(popViewController) withObject:nil afterDelay:0.5];
    }
}

#pragma mark - others
- (void)setCustomLEDMode:(BOOL)mode
{
    //设置 LED 的 RGB 值是否可用
    bLedCtrl = mode;
    NSArray *leds = @[[NSIndexPath indexPathForRow:2 inSection:0],
                      [NSIndexPath indexPathForRow:3 inSection:0],
                      [NSIndexPath indexPathForRow:4 inSection:0]];
    [self.tableView reloadRowsAtIndexPaths:leds withRowAnimation:UITableViewRowAnimationNone];
}

- (void)toast:(NSString *)strToast
{
    //弹出一段字符,最多不超过3行
    self.isToasted = YES;
    iToast *toast = [iToast makeText:strToast];
    [toast performSelectorOnMainThread:@selector(show) withObject:nil waitUntilDone:YES];
    sleep(3);
    self.isToasted = NO;
}

- (void)popViewController
{
    [self.navigationController popViewControllerAnimated:YES];
}

#pragma mark - 发控制指令后一段时间内禁止推送
- (void)addRemainElement:(NSInteger)row
{
    BOOL isEqual = NO;
    NSNumber *timeout = @3;    // 发控制指令后,等待3s后才可接收指定控件的变更

    for(NSMutableDictionary *dict in updateCtrl)
    {
        NSNumber *object = [dict valueForKey:@"object"];
        if([object intValue] == row)
        {
            [dict setValue:timeout forKey:@"remaining"];
            isEqual = YES;
            break;
        }
    }

    if(!isEqual)
    {
        NSMutableDictionary *mdict = [NSMutableDictionary dictionaryWithDictionary:@{@"object": @(row), @"remaining": timeout}];
        [updateCtrl addObject:mdict];
    }
}

- (void)onRemainTimer
{
    //根据系统的 Timer 去更新控件可以变更的剩余时间
    NSMutableArray *removeCtrl = [NSMutableArray array];
    for(NSMutableDictionary *dict in updateCtrl)
    {
        int remainTime = [[dict valueForKey:@"remaining"] intValue] - 1;
        if(remainTime != 0)
            [dict setValue:@(remainTime) forKey:@"remaining"];
        else
            [removeCtrl addObject:dict];
    }
    [updateCtrl removeObjectsInArray:removeCtrl];
}

- (BOOL)isElementRemaining:(NSInteger)row
{
    //判断某个控件是否能更新内容
    for(NSMutableDictionary *dict in updateCtrl)
    {
        NSNumber *object = [dict valueForKey:@"object"];
        if([object intValue] == row)
            return YES;
    }
    return NO;
}

@end


text:
import React from 'react';
import { mount } from 'enzyme';
import { TransitionGroup } from 'react-transition-group';
import { Fade } from '../';

class Helper extends React.Component {
  constructor(props) {
    super(props);
    this.toggle = this.toggle.bind(this);
    this.state = {
      showItem: props.showItem
    };
  }

  toggle() {
    this.setState({
      showItem: !this.state.showItem
    });
  }

  render() {
    return (

Toggle

        <TransitionGroup component="div">
          {this.state.showItem ? this.props.children : null}
        </TransitionGroup>

    );
  }
}

describe('Fade', () => {
  beforeEach(() => {
    jest.useFakeTimers();
  });

  afterEach(() => {
    jest.clearAllTimers();
  });

  it('should transition classes from "fade" to "fade show" on appear', () => {
    let isOpen = true;
    const wrapper = mount(
      <Helper showItem={isOpen} >
        <Fade key={Math.random()}>Yo!</Fade>
        <Fade appear={false} key={Math.random()}>Yo 2!</Fade>
      </Helper>
    );

    expect(wrapper.update().find('div.fade').hostNodes().length).toBe(2);
    expect(wrapper.update().find('div.fade.show').hostNodes().length).toBe(1);

    jest.runTimersToTime(300);

    expect(wrapper.update().find('div.fade.show').hostNodes().length).toBe(2);

    wrapper.find('.trigger').hostNodes().simulate('click');
    expect(wrapper.update().find('div.fade.show').hostNodes().length).toBe(0);
  });

  it('should transition classes from "fade" to "fade show" on enter', () => {
    const onEnter = jest.fn();
    const onExit = jest.fn();
    let isOpen = false;
    const wrapper = mount(
      <Helper showItem={isOpen} >
        <Fade onEnter={onEnter} onExit={onExit} key={Math.random()}>Yo 3!</Fade>
        <Fade appear={false} enter={false} exit={false} key={Math.random()}>Yo 4!</Fade>
      </Helper>
    );

    expect(wrapper.update().find('div.fade').hostNodes().length).toBe(0);
    expect(wrapper.update().find('div.fade.show').hostNodes().length).toBe(0);

    wrapper.find('.trigger').hostNodes().simulate('click');

    expect(wrapper.update().find('div.fade').hostNodes().length).toBe(2);
    expect(wrapper.update().find('div.fade.show').hostNodes().length).toBe(1);
    expect(onEnter).toHaveBeenCalled();

    jest.runTimersToTime(300);

    expect(onEnter).toHaveBeenCalled();
    expect(onExit).not.toHaveBeenCalled();
    expect(wrapper.update().find('div.fade.show').hostNodes().length).toBe(2);

    wrapper.find('.trigger').hostNodes().simulate('click');
    expect(wrapper.update().find('div.fade.show').hostNodes().length).toBe(0);
    expect(onExit).toHaveBeenCalled();
  });

  it('should pass className down', () => {
    const alert = mount(<Fade className="test-class-name">Yo!</Fade>);
    expect(alert.find('.fade').hostNodes().prop('className')).toContain('test-class-name');
  });

  it('should pass other props down', () => {
    const alert = mount(<Fade data-testprop="testvalue">Yo!</Fade>);
    expect(alert.find('.fade').hostNodes().prop('data-testprop')).toContain('testvalue');
  });

  it('should support custom tag', () => {
    const alert = mount(<Fade tag="p">Yo!</Fade>);
    expect(alert.find('p').hostNodes().length).toBe(1);
  });
});


text:
all:
	ocamlbuild -libs str src/main.native


text:
zipay
=====

personal fan pool


text:
'use strict';

const path = require('path');
const utils = require('../utils');

// Electron provides `window.require`, whereas Browserify overwrite `require`.
const {remote} = window.require('electron');
const dialog = remote.dialog;
const fs = remote.require('fs');

module.exports = {
  browse() {
    return new Promise(function (resolve) {
      dialog.showOpenDialog(
          null,
          { properties: ['openDirectory'] },
          function (filenames) {
            resolve(typeof filenames !== 'undefined' ? filenames[0] : null);
          }
      );
    });
  },

  getBaseEntryAndPath(baseId) {
    return Promise.resolve([baseId, baseId]);
  },

  getBaseUrl(entry) {
    return entry + path.sep;
  },

  getEntryId(entry) {
    return entry;
  },

  getEntryPath(entry) {
    return Promise.resolve(entry);
  },

  getIndex(currentUrl, baseEntry) {
    const cwd = currentUrl || baseEntry;

    const parseFile = function (url) {
      url = path.join(cwd, url);
      if (fs.statSync(url).isDirectory()) {
        url += path.sep;
      }
      return { name: utils.toName(path.basename(url)), url: url };
    };

    return new Promise(function (resolve) {
      fs.readdir(cwd, function (err, files) {
        if (files) {
          resolve(utils.sortBy(files.map(parseFile), 'name'));
        }
      });
    });
  },

  makeUrl(url) {
    return Promise.resolve('file://' + url);
  },

  revokeUrl() {
    // No-op.
  }
};


text:
package skettios.mods.livingthread.api.internal;

import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.ResourceLocation;

import java.util.Map;

public interface ILivingThread
{
    IThreadDrop createThreadDrop(Class<? extends EntityLivingBase> entityClass, Map<IEnumThread, Float> dropPercentages);

    IEnumThread getThreadFromName(String name);

    void registerThreadDrop(IThreadDrop threadDrop);

    void registerThreadDrops(IThreadDrop... threadDrops);

    void copyAndRegisterThreadDrops(ResourceLocation location);
}


text:
<?php

/**
 * Offer model
 *
 * @category    Mfb
 * @package     Mfb_Myflyingbox
 * @author      Ultimate Module Creator
 */
class Mfb_Myflyingbox_Model_Offer extends Mage_Core_Model_Abstract
{
    /**
     * Entity code.
     * Can be used as part of method name for entity processing
     */
    const ENTITY    = 'mfb_myflyingbox_offer';
    const CACHE_TAG = 'mfb_myflyingbox_offer';

    /**
     * Prefix of model events names
     *
     * @var string
     */
    protected $_eventPrefix = 'mfb_myflyingbox_offer';

    /**
     * Parameter name in event
     *
     * @var string
     */
    protected $_eventObject = 'offer';

    /**
     * constructor
     *
     * @access public
     * @return void
     * @author Ultimate Module Creator
     */
    public function _construct()
    {
        parent::_construct();
        $this->_init('mfb_myflyingbox/offer');
    }

    /**
     * before save offer
     *
     * @access protected
     * @return Mfb_Myflyingbox_Model_Offer
     * @author Ultimate Module Creator
     */
    protected function _beforeSave()
    {
        parent::_beforeSave();
        $now = Mage::getSingleton('core/date')->gmtDate();
        if ($this->isObjectNew()) {
            $this->setCreatedAt($now);
        }
        $this->setUpdatedAt($now);
        return $this;
    }

    /**
     * save offer relation
     *
     * @access public
     * @return Mfb_Myflyingbox_Model_Offer
     * @author Ultimate Module Creator
     */
    protected function _afterSave()
    {
        return parent::_afterSave();
    }

    /**
     * Retrieve parent
     *
     * @access public
     * @return null|Mfb_Myflyingbox_Model_Quote
     * @author Ultimate Module Creator
     */
    public function getParentQuote()
    {
        if (!$this->hasData('_parent_quote')) {
            if (!$this->getQuoteId()) {
                return null;
            } else {
                $quote = Mage::getModel('mfb_myflyingbox/quote')
                    ->load($this->getQuoteId());
                if ($quote->getId()) {
                    $this->setData('_parent_quote', $quote);
                } else {
                    $this->setData('_parent_quote', null);
                }
            }
        }
        return $this->getData('_parent_quote');
    }

    /**
     * get default values
     *
     * @access public
     * @return array
     * @author Ultimate Module Creator
     */
    public function getDefaultValues()
    {
        $values = array();
        $values['status'] = 1;
        return $values;
    }

    public function formattedPrice() {
      return ($this->getBasePriceInCents() / 100).' '.$this->getCurrency();
    }

    public function getFormattedRelayAddress($code) {
      foreach ( $this->getDeliveryLocations() as $location ) {
        if ($location->code == $code) {
          return implode("\n",array($location->company, $location->street, $location->postal_code.' '.$location->city));
        }
      }
    }

    /**
     *
     * @param $order_total_amount
     * @return bool
     */
    public function shouldBeInsuredByDefault($order_total_amount = 0){

        $insurable = false;
        $service = Mage::getModel('mfb_myflyingbox/service')->loadByCode($this->getMfbProductCode());
        if(!$service)
            return false;

        $order_total = (int)$order_total_amount;
        if($order_total === 0)
            return false;

        $service_insurance_minimum_amount = (int)$service->getInsuranceMinimumAmount();

        if($service->getInsurance() && $order_total > $service_insurance_minimum_amount)
            $insurable = true;

        return $insurable ;
    }
}


text:
<?php
	namespace Navigation;

	class Item Extends \BaseClass {
		public $id;
		private $menu_id;
		public $title;
		public $target;
		public $view_order;
		public $alt;
		public $description;
		public $parent_id;
		public $external = false;
		public $ssl = false;

		public function __construct($id = 0) {
			if (is_numeric($id) && $id > 0) {
				$this->id = $id;
				$this->details();
			}
		}

		public function delete() {
			$drop_object_query = "
				DELETE
				FROM	navigation_menu_items
				WHERE	id = ?
			";
			$GLOBALS['_database']->Execute($drop_object_query,array($this->id));
			if ($GLOBALS['_database']->ErrorMsg()) {
				$this->SQLError($GLOBALS['_database']->ErrorMsg());
				return false;
			}
			return true;
		}

		public function add($parameters) {
			if ($parameters['menu_id']) {
				$menu = new Menu($parameters['menu_id']);
				if (! $menu->id) {
					$this->error("Menu not found");
					return false;
				}
			}

			$add_object_query = "
				INSERT
				INTO	navigation_menu_items
				(		menu_id,title)
				VALUES
				(		?,?)
			";

			$bind_params = array($parameters['menu_id'],$parameters['title']);
			$GLOBALS['_database']->Execute($add_object_query,$bind_params);

			if ($GLOBALS['_database']->ErrorMsg()) {
				$this->SQLError($GLOBALS['_database']->ErrorMsg());
				return false;
			}

			$id = $GLOBALS['_database']->Insert_ID();
			$this->id = $id;
			return $this->update($parameters);
		}

		public function get($menu_id,$code,$parent = null) {
			$get_object_query = "
				SELECT	id
				FROM	navigation_menu_items
				WHERE	menu_id = ?
				AND		title = ?
			";

			$bind_params = array($menu_id,$code);
			if (isset($parent) and is_object($parent)) {
				$get_object_query .= "
				AND		parent_id = ?";
				array_push($bind_params,$parent->id);
			}

            query_log($get_object_query,$bind_params);
			$rs = $GLOBALS['_database']->Execute($get_object_query,$bind_params);

			if (! $rs) {
				$this->SQLError($GLOBALS['_database']->ErrorMsg());
				return false;
			}
			list($id) = $rs->FetchRow();
			if ($id) {
				$this->id = $id;
				return $this->details();
			}
			else {
				return false;
			}
		}

		public function update($parameters) {
			$update_object_query = "
				UPDATE	navigation_menu_items
				SET		id = id";

			$bind_params = array();
			if (isset($parameters['title'])) {
				$update_object_query .= ",
						title = ?";
				array_push($bind_params,$parameters['title']);
			}
			if (isset($parameters['target'])) {
				$update_object_query .= ",
						target = ?";
				array_push($bind_params,$parameters['target']);
			}
			if (isset($parameters['parent_id'])) {
				$update_object_query .= ",
					parent_id = ?";
				array_push($bind_params,$parameters['parent_id']);
			}
			if (isset($parameters['alt'])) {
				$update_object_query .= ",
						alt = ?";
				array_push($bind_params,$parameters['alt']);
			}
			if (isset($parameters['description'])) {
				$update_object_query .= ",
						description = ?";
				array_push($bind_params,$parameters['description']);
			}
			if (isset($parameters['view_order'])) {
				$update_object_query .= ",
						view_order = ?";
				array_push($bind_params,$parameters['view_order']);
			}

			$update_object_query .= "
				WHERE	id = ?
			";
			array_push($bind_params,$this->id);
			query_log($update_object_query,$bind_params,true);
			$GLOBALS['_database']->Execute($update_object_query,$bind_params);
			if ($GLOBALS['_database']->ErrorMsg()) {
				$this->SQLError($GLOBALS['_database']->ErrorMsg());
				return false;
			}
			return $this->details();
		}

		public function details() {
			$get_object_query = "
				SELECT	*
				FROM	navigation_menu_items
				WHERE	id = ?
			";
			$rs = $GLOBALS['_database']->Execute($get_object_query,array($this->id));
			if (! $rs) {
				$this->SQLError($GLOBALS['_database']->ErrorMsg());
				return false;
			}

			$object = $rs->FetchNextObject(false);
			if ($object->id) {
				$this->id = $object->id;
				$this->menu_id= $object->menu_id;
				$this->title = $object->title;
				$this->target = $object->target;
				$this->view_order = $object->view_order;
				$this->alt = $object->alt;
				$this->description = $object->description;
				$this->parent_id = $object->parent_id;
				if ($object->external) $this->external = true;
				else $this->external = false;
				if ($object->ssl) $this->ssl = true;
				else $this->ssl = false;
			}
			else {
				$this->id = null;
				$this->menu = new Menu(null);
				$this->title = null;
				$this->target = null;
				$this->view_order = null;
				$this->alt = null;
				$this->description = null;
				$this->parent_id = null;
				$this->external = null;
				$this->ssl = null;
			}
			return true;
		}

		public function menu() {
			return new \Navigation\Menu($this->menu_id);
		}

		public function hasChildren() {
			$get_children_query = "
				SELECT	count(*)
				FROM	navigation_menu_items
				WHERE	parent_id = ?
			";
			$rs = $GLOBALS['_database']->Execute($get_children_query,array($this->id));
			if (! $rs) {
				$this->SQLError($GLOBALS['_database']->ErrorMsg());
				return null;
			}
			list($count) = $rs->FetchRow();
			if ($count > 0) {
				return true;
			}
			else {
				return false;
			}
		}

		public function children() {
			$itemList = new \Navigation\ItemList();
			$items = $itemList->find(array('parent_id' => $this->id));
			return $items;
		}

		public function validTitle($string) {
			return $this->validName($string);
		}

		public function validTarget($string) {
			if (preg_match('/\.\./',$string)) return false;
			if (preg_match('/\<\>/',$string)) return false;
			return true;
		}
	}


text:
import React from 'react';
import ReactDOM from 'react-dom';
import DonutChart from './DonutChart';

jQuery.fn.extend({
    DonutChart: function(props) {
        this.each(
            function () {
                ReactDOM.render((
                    <DonutChart {...props}/>
                ), this);
            }
        );
    }
});


text:
var BootState = require("./states/boot");
var PreloadState = require("./states/preload");
var MenuState = require("./states/menu");
var PlayState = require("./states/play");

function GrandmaController() {

  var game = new Phaser.Game(1000, 700, Phaser.AUTO, "grandma_stage");

  //define the game states
  game.state.add("boot", BootState);
  game.state.add("preload", PreloadState);
  game.state.add("menu", MenuState);
  game.state.add("play", PlayState);

  //start the game
  game.state.start("boot");

}

angular.module("pixi_sandbox").controller("GrandmaController", [
  GrandmaController
]);


text:
package org.codehaus.mojo.keytool;

import org.apache.maven.plugins.annotations.Mojo;
import org.codehaus.mojo.keytool.requests.KeyToolDeleteRequest;

/**
 * To delete an entry alias from a keystore.
 *

 * Implemented as a wrapper around the SDK {@code keytool -delete} command.
 *

 * See keystore documentation.
 *
 * @author tchemit <chemit@codelutin.com>
 * @since 1.2
 */
@Mojo( name = "deleteAlias", requiresProject = true )
public class DeleteAliasMojo
    extends AbstractKeyToolRequestWithKeyStoreAndAliasParametersMojo<KeyToolDeleteRequest>
{

    /**
     * Default contructor.
     */
    public DeleteAliasMojo()
    {
        super( KeyToolDeleteRequest.class );
    }

}


text:
angular.module('ngSampleApp')
  .controller('SigninCtrl', function ($scope, $resource, $location, $cookies) {

    $scope.error = false;

    /* REST API actions */
    var user = $resource(
      '/signin',
      {},
      {
        signin: {
          method: 'POST'
        }
      }
    );

    $scope.signin = function() {
      user.signin($scope.signinForm, function (res) {
        $cookies.api_key = res.api_key;
        $cookies.username = res.username;
        $location.path('/');
      },
      function (err) {
        if (err.status == 401 || err.status == 404) {
          $scope.error = true;
        }
      });
    };
  });


text:
<?php

namespace Nathanmac\Utilities\Responder\Tests;

use Nathanmac\Utilities\Responder\Responder;

class YAMLTest extends \PHPUnit_Framework_TestCase
{
    /** @test */
    public function parser_validates_yaml_data()
    {
        $payload  = ['status' => 123, 'message' => 'hello world'];
        $expected = (new \Symfony\Component\Yaml\Dumper)->dump(['data' => $payload], 9999);

        $responder = new Responder();
        $this->assertEquals($expected, $responder->yaml($payload));
    }

    /** @test */
    public function parser_empty_yaml_data()
    {
        $responder = new Responder();
        $this->assertEquals('', $responder->yaml([]));
    }

    /** @test */
    public function throws_an_exception_when_parsed_yaml_bad_data()
    {
        $responder = new Responder();
        $this->setExpectedException('Exception', 'Failed To Generate YAML');
        $responder->yaml(tmpfile());
    }

    /** @test */
    public function format_detection_yaml()
    {
        $responder = new Responder();

        $_SERVER['HTTP_ACCEPT'] = "application/yaml";
        $this->assertEquals('Nathanmac\Utilities\Responder\Formats\YAML', $responder->getFormatClass());

        $_SERVER['HTTP_ACCEPT'] = "application/x-yaml";
        $this->assertEquals('Nathanmac\Utilities\Responder\Formats\YAML', $responder->getFormatClass());

        $_SERVER['HTTP_ACCEPT'] = "text/yaml";
        $this->assertEquals('Nathanmac\Utilities\Responder\Formats\YAML', $responder->getFormatClass());

        $_SERVER['HTTP_ACCEPT'] = "text/x-yaml";
        $this->assertEquals('Nathanmac\Utilities\Responder\Formats\YAML', $responder->getFormatClass());

        unset($_SERVER['HTTP_ACCEPT']);
    }
}


text:
Factory.define :route, :class => "Chouette::Route" do |route|
  route.sequence(:name) { |n| "Route #{n}" }
  route.sequence(:published_name) { |n| "Long route #{n}" }
  route.sequence(:number) { |n| "#{n}" }
  route.sequence(:wayback_code) { |n| Chouette::Wayback.new( n % 2) }
  route.sequence(:direction_code) { |n| Chouette::Direction.new( n % 12) }
  route.sequence(:objectid) { |n| "test:Route:#{n}" }

  route.association :line, :factory => :line

  route.after_create do |r|
    0.upto(4) do |i|
      Factory(:stop_point, :position => i, :route => r)
    end
  end

end


text:
const char *disp;

X11Display xdisp(disp);

int main(int argc, char **argv)
{
  if(argc < 2)
    return 1;
  disp=argv[1];
  int keycode=atoi(argv[2]);
  printf("%d\n", xdisp.sendKeyEvent(keycode, true));
  printf("%d\n", xdisp.sendKeyEvent(keycode, false));
  return 0;
}