text:
from django.shortcuts import render, redirect,render_to_response
from piebase.models import Project, Priority, Severity, TicketStatus, Ticket, Requirement
from forms import CreateProjectForm, PriorityForm, SeverityForm, TicketStatusForm, RoleForm, CommentForm
import json
import random
import string
from django.utils import timezone
from django.template.defaultfilters import slugify
from django.contrib.auth.decorators import login_required
from django.http import HttpResponse
from django.contrib.auth.tokens import default_token_generator
from django.core.urlresolvers import reverse
from piebase.models import User, Project, Organization, Role, Milestone, Requirement
from forms import CreateProjectForm, CreateMemberForm, PasswordResetForm, MilestoneForm, RequirementForm
from .tasks import send_mail_old_user
from django.core import serializers

from django.core.paginator import Paginator,PageNotAnInteger,EmptyPage

@login_required
def create_project(request):
    if(request.method == "POST"):
        organization = request.user.organization
        form = CreateProjectForm(request.POST, organization=organization)
        if(form.is_valid()):
            slug = slugify(request.POST['name'])
            project_obj = Project.objects.create(name=request.POST['name'], slug=slug, description=request.POST[
                                                 'description'], modified_date=timezone.now(), organization=organization)
            project_obj.members.add(request.user)
            project_obj.save()
            json_data = {'error': False, 'errors': form.errors, 'slug': slug}
            return HttpResponse(json.dumps(json_data), content_type="application/json")
        else:
            return HttpResponse(json.dumps({'error': True, 'errors': form.errors}), content_type="application/json")
    return render(request, 'project/create_project.html')

@login_required
def list_of_projects(request):
    template_name = 'project/projects_list.html'
    projects_list = Project.objects.filter(members__email=request.user)
    dict_items = {'projects_list': projects_list}
    return render(request, template_name, dict_items)

@login_required
def project_detail(request, slug):
    template_name = 'project/project_description.html'
    project_object = Project.objects.get(slug=slug)
    project_members = project_object.members.all()
    dict_items = {'project_object': project_object, 'project_members': project_members}
    return render(request, template_name, dict_items)

@login_required
def project_details(request, slug):
    project = Project.objects.get(slug=slug)
    dictionary = {'project': project, 'slug': slug}
    template_name = 'project/project_project_details.html'

    if(request.method == 'POST'):
        organization = request.user.organization
        form = CreateProjectForm(request.POST, organization=organization)

        if(form.is_valid()):
            slug = slugify(request.POST['name'])
            project = Project.objects.get(
                slug=request.POST['oldname'], organization=organization)
            project.name = request.POST['name']
            project.slug = slug
            project.modified_date = timezone.now()
            project.save()
            return HttpResponse(json.dumps({'error': False, 'slug': slug}), content_type="application/json")
        else:
            return HttpResponse(json.dumps({'error': True, 'errors': form.errors}), content_type="application/json")

    return render(request, template_name, dictionary)

@login_required
def delete_project(request, id):
    Project.objects.get(id=id).delete()
    return redirect("project:list_of_projects")

@login_required
def priorities(request, slug):
    priority_list = Priority.objects.filter(
    project=Project.objects.get(slug=slug))
    return render(request, 'settings/priorities.html', {'slug': slug, 'priority_list': priority_list})

@login_required
def priority_create(request, slug):
    project = Project.objects.get(slug=slug)
    form = PriorityForm(request.POST, project=project)
    if(form.is_valid()):
        priority = form.save()
        return HttpResponse(json.dumps({'error': False, 'color': priority.color, 'name': priority.name, 'proj_id': priority.id, 'slug': priority.slug}), content_type="application/json")
    else:
        return HttpResponse(json.dumps({'error': True, 'errors': form.errors}), content_type="application/json")

@login_required
def priority_edit(request, slug, priority_slug):
    project = Project.objects.get(slug=slug)
    instance = Priority.objects.get(slug=priority_slug, project=project)
    form = PriorityForm(request.POST, instance=instance,project=project)
    if(form.is_valid()):
        priority = form.save()
        return HttpResponse(json.dumps({'error': False, 'color': priority.color, 'name': priority.name, 'proj_id': priority.id, 'slug': priority.slug}), content_type="application/json")
    else:
        return HttpResponse(json.dumps({'error': True, 'errors': form.errors}), content_type="application/json")

@login_required
def priority_delete(request, slug, priority_slug):
    Priority.objects.get(
        slug=priority_slug, project=Project.objects.get(slug=slug)).delete()
    return HttpResponse(json.dumps({'error': False}), content_type="application/json")

@login_required
def severities(request, slug):
    severity_list = Severity.objects.filter(
        project=Project.objects.get(slug=slug))
    return render(request, 'settings/severities.html', {'slug': slug, 'severity_list': severity_list})

@login_required
def severity_create(request, slug):
    project = Project.objects.get(slug=slug)
    form = SeverityForm(request.POST, project=project)
    if(form.is_valid()):
        severity = form.save()
        return HttpResponse(json.dumps({'error': False, 'color': severity.color, 'name': severity.name, 'proj_id': severity.id, 'slug': severity.slug}), content_type="application/json")
    else:
        return HttpResponse(json.dumps({'error': True, 'errors': form.errors}), content_type="application/json")

@login_required
def severity_edit(request, slug, severity_slug):
    project = Project.objects.get(slug=slug)
    instance = Severity.objects.get(slug=severity_slug, project=project)
    form = SeverityForm(request.POST, instance=instance, project=project)
    if(form.is_valid()):
        severity = form.save()
        return HttpResponse(json.dumps({'error': False, 'color': severity.color, 'name': severity.name, 'proj_id': severity.id, 'slug': severity.slug}), content_type="application/json")
    else:
        return HttpResponse(json.dumps({'error': True, 'errors': form.errors}), content_type="application/json")

@login_required
def severity_delete(request, slug, severity_slug):
    Severity.objects.get(
        slug=severity_slug, project=Project.objects.get(slug=slug)).delete()
    return HttpResponse(json.dumps({'error': False}), content_type="application/json")

@login_required
def ticket_status(request, slug):
    ticket_status_list = TicketStatus.objects.filter(
        project=Project.objects.get(slug=slug))
    return render(request, 'settings/ticket_status.html', {'slug': slug, 'ticket_status_list': ticket_status_list})

@login_required
def ticket_status_create(request, slug):
    project = Project.objects.get(slug=slug)
    form = TicketStatusForm(request.POST, project=project)
    if(form.is_valid()):
        ticket_status = form.save()
        return HttpResponse(json.dumps({'error': False, 'color': ticket_status.color, 'name': ticket_status.name, 'proj_id': ticket_status.id, 'slug': ticket_status.slug}), content_type="application/json")
    else:
        return HttpResponse(json.dumps({'error': True, 'errors': form.errors}), content_type="application/json")

@login_required
def ticket_status_edit(request, slug, ticket_slug):
    project = Project.objects.get(slug=slug)
    instance = TicketStatus.objects.get(slug=ticket_slug, project=project)
    form = TicketStatusForm(request.POST, instance=instance, project=project)
    if(form.is_valid()):
        ticket_status = form.save()
        return HttpResponse(json.dumps({'error': False, 'color': ticket_status.color, 'name': ticket_status.name, 'proj_id': ticket_status.id, 'slug': ticket_status.slug}), content_type="application/json")
    else:
        return HttpResponse(json.dumps({'error': True, 'errors': form.errors}), content_type="application/json")

@login_required
def ticket_status_delete(request, slug, ticket_slug):
    TicketStatus.objects.get(
        slug=ticket_slug, project=Project.objects.get(slug=slug)).delete()
    return HttpResponse(json.dumps({'error': False}), content_type="application/json")

def password_reset(request, to_email):
    from_email = 'dineshmcmf@gmail.com'
    to_email_dict = {'email': to_email}
    token_generator = default_token_generator
    email_template_name = 'email/reset_email.html'
    subject_template_name = 'email/reset_subject.txt'
    form = PasswordResetForm(to_email_dict)
    if form.is_valid():
        opts = {
            'use_https': request.is_secure(),
            'from_email': from_email,
            'email_template_name': email_template_name,
            'subject_template_name': subject_template_name,
            'request': request}
        form.save(**opts)

@login_required
def project_team(request, slug):
    project = Project.objects.get(slug=slug)
    mem_details = []
    for member in project.members.exclude(email=request.user.email):
        mem_details.append(
            (member, Role.objects.get(users__email=member.email)))
    dictionary = {'project_id': project.id,
                  'mem_details': mem_details, 'slug': slug}
    return render(request, 'settings/team.html', dictionary)

@login_required
def create_member(request, slug):
    if request.method == 'POST':
        error_count = 0
        json_data = {}
        json_post_index = 0
        email_list = request.POST.getlist('email')
        designation_list = request.POST.getlist('designation')
        description = request.POST.get('description')
        post_dict = {'description': description}
        post_tuple = zip(email_list, designation_list)
        for email_iter, designation_iter in post_tuple:
            post_dict['email'] = email_iter
            post_dict['designation'] = designation_iter
            create_member_form = CreateMemberForm(post_dict)
            if create_member_form.is_valid():
                email = post_dict['email']
                designation = post_dict['designation']
                description = post_dict['description']
                organization_obj = request.user.organization
                if User.objects.filter(email=email).exists():
                    send_mail_old_user.delay(email)
                    pass
                else:
                    random_password = ''.join(
                        random.choice(string.digits) for _ in xrange(8))
                    new_user_obj = User.objects.create_user(
                        email=email, username=email, password=random_password, organization=organization_obj, pietrack_role='user')
                    password_reset(request, email_iter)
                project_obj = Project.objects.get(slug=slug)
                user_obj = User.objects.get(email=email)
                project_obj.members.add(user_obj)
                project_obj.organization = organization_obj
                project_obj.save()

                random_slug = ''.join(
                    random.choice(string.ascii_letters + string.digits) for _ in xrange(10))
                role_obj = Role.objects.create(
                    name=designation, slug=random_slug, project=project_obj)
                role_obj.users.add(user_obj)
                role_obj.save()
            else:
                error_count += 1
            json_data[json_post_index] = create_member_form.errors
            json_post_index += 1
        if error_count == 0:
            json_data['error'] = False
        else:
            json_data['error'] = True
        return HttpResponse(json.dumps(json_data), content_type='application/json')
    else:
        return render(request, 'settings/create_member.html')

@login_required
def member_roles(request, slug):
    project = Project.objects.get(slug=slug)
    list_of_roles = Role.objects.filter(project=project)
    dictionary = {'list_of_roles': list_of_roles, 'slug': slug}
    return render(request, 'settings/member_roles.html', dictionary)

@login_required
def member_role_create(request, slug):
    project = Project.objects.get(slug=slug)
    form = RoleForm(request.POST, project=project)
    if(form.is_valid()):
        role = form.save()
        return HttpResponse(json.dumps({'error': False, 'role_id': role.id, 'role_name': role.name, 'slug': role.slug}), content_type="application/json")
    else:
        return HttpResponse(json.dumps({'error': True, 'errors': form.errors}), content_type="application/json")

@login_required
def member_role_edit(request, slug, member_role_slug):
    project=Project.objects.get(slug=slug)
    instance = Role.objects.get(
        slug=member_role_slug, project=project)
    form = RoleForm(request.POST, instance=instance, project=project)
    if(form.is_valid()):
        role = form.save()
        return HttpResponse(json.dumps({'error': False, 'role_id': role.id, 'role_name': role.name, 'slug': role.slug}), content_type="application/json")
    else:
        return HttpResponse(json.dumps({'error': True, 'errors': form.errors}), content_type="application/json")

@login_required
def member_role_delete(request, slug, member_role_slug):
    project = Project.objects.get(slug=slug)
    Role.objects.get(slug=member_role_slug, project=project).delete()
    return HttpResponse(json.dumps({'error': False}), content_type="application/json")

@login_required
def taskboard(request,slug,milestone_slug):
    project = Project.objects.get(slug=slug)
    milestone = Milestone.objects.get(slug=milestone_slug,project=project)
    ticket_status_list = TicketStatus.objects.filter(project=project)
    return render(request,'project/taskboard.html',{'ticket_status_list':ticket_status_list,'slug':slug,'milestone':milestone})

@login_required
def update_taskboard_status(request,slug,status_slug,task_id):
    task = Ticket.objects.get(id=task_id)
    ticket_status = TicketStatus.objects.get(slug=status_slug,project=Project.objects.get(slug=slug))
    task.status = ticket_status
    task.save()
    return HttpResponse("")

@login_required
def load_tasks(request,slug,milestone_slug,status_slug):
    project = Project.objects.get(slug=slug)
    status = TicketStatus.objects.get(slug=status_slug,project=project)
    milestone = Milestone.objects.get(slug=milestone_slug,project=project)
    tasks = Ticket.objects.filter(status=status,milestone=milestone)

    paginator = Paginator(tasks, 10)
    page = request.GET.get('page')
    try:
        tasks = paginator.page(page)
    except PageNotAnInteger:
        pass
    except EmptyPage:
        pass
    return render_to_response('project/partials/task.html',{'tasks':tasks,'milestone':milestone,'slug':slug})

@login_required
def requirement_tasks(request,slug,milestone_slug,requirement_id):
    project = Project.objects.get(slug=slug)
    milestone = Milestone.objects.get(slug=milestone_slug,project=project)
    ticket_status_list = TicketStatus.objects.filter(project=project)
    return render(request,'project/partials/requirement_tasks.html',{'ticket_status_list':ticket_status_list,'slug':slug,'requirement_id':requirement_id,'milestone':milestone})

@login_required
def requirement_tasks_more(request,slug,milestone_slug,status_slug,requirement_id):
    requirement = Requirement.objects.get(id=requirement_id)
    project = Project.objects.get(slug=slug)
    milestone = Milestone.objects.get(slug=milestone_slug,project=project)
    tasks = requirement.tasks.filter(status__slug=status_slug)
    paginator = Paginator(tasks,10)
    page = request.GET.get('page')
    try:
        tasks = paginator.page(page)
    except PageNotAnInteger:
        pass
    except EmptyPage:
        pass
    return render_to_response('project/partials/task.html',{'tasks':tasks,'milestone':milestone,'slug':slug})

@login_required
def task_details(request,slug,milestone_slug,task_id):
    task = Ticket.objects.get(id=task_id)
    return render(request,'task/Task_detail.html',{'task':task,'slug':slug})

def task_comment(request,slug,task_id):
    print request.POST.get('comment')
    print request.FILES.get('file')
    project = Project.objects.get(slug=slug,organization=request.user.organization)
    task = Ticket.objects.get(id=task_id)
    form = CommentForm(request.POST,task=task,user=request.user,file=request.FILES.get('file'),project=project)

    print form.is_valid()
    if form.is_valid():
        comment = form.save()
        print comment
        return HttpResponse(json.dumps({'error':False}), content_type="json/application")
    else:
        return HttpResponse(json.dumps({'error':True,'errors':form.errors}), content_type="json/application")

@login_required
def milestone_create(request, slug):
    if request.method == 'POST':
        json_data = {}
        milestone_dict = request.POST.copy()
        project_id = Project.objects.get(slug = slug).id
        milestone_dict['project'] = project_id
        milestone_form = MilestoneForm(request.user, milestone_dict)
        if milestone_form.is_valid():
            milestone_form.save()
            json_data['error'] = False
            return HttpResponse(json.dumps(json_data), content_type = 'application/json')
        else:
            json_data['error'] = True
            json_data['form_errors'] = milestone_form.errors
            return HttpResponse(json.dumps(json_data), content_type = 'application/json')
    else:
        return render(request, 'project/milestone.html')

@login_required
def milestone_edit(request, slug):
    milestone_obj = Milestone.objects.get(slug = slug)
    if request.method == 'POST':
        json_data = {}
        milestone_dict = request.POST.copy()
        project_id = milestone_obj.project.id
        milestone_dict['project'] = project_id
        milestone_form = MilestoneForm(request.user, milestone_dict, instance = milestone_obj)
        if milestone_form.is_valid():
            milestone_form.save()
            json_data['error'] = False
            return HttpResponse(json.dumps(json_data), content_type = 'application/json')
        else:
            json_data['error'] = True
            json_data['form_errors'] = milestone_form.errors
            return HttpResponse(json.dumps(json_data), content_type = 'application/json')
    else:
        return render(request, 'project/milestone.html', {'milestone_obj': milestone_obj})

@login_required
def milestone_delete(request, slug):
    Milestone.objects.get(slug = slug).delete()
    return HttpResponse(json.dumps({'error': False}))

@login_required
def project_edit(request, slug):
    milestone_list = Milestone.objects.all()
    project_obj = Project.objects.get(slug = slug)
    member_dict = {}
    for member_iter in project_obj.members.all():
        member_dict[member_iter.email] = [role.name for role in member_iter.user_roles.all()]
    return render(request, 'project/project_edit.html', {'milestone_list': milestone_list, 'member_dict': member_dict, 'project_slug': slug})

@login_required
def requirement_create(request, slug):
    project_obj = Project.objects.get(slug=slug)
    if request.POST:
        json_data = {}
        requirement_form = RequirementForm(request.POST)
        if requirement_form.is_valid():
            name = request.POST.get('name')
            milestone_obj = Milestone.objects.get(id=request.POST.get('milestone'))
            Requirement.objects.create(name=name, slug=name, description=request.POST.get('description'), project=project_obj, milestone=milestone_obj)
            json_data['error'] = False
            return HttpResponse(json.dumps(json_data), content_type='application/json')
        else:
            json_data['error'] = True
            json_data['form_errors'] = requirement_form.errors
            return HttpResponse(json.dumps(json_data), content_type='application/json')
    else:
        milestone = project_obj.milestones.all()
        return render(request, 'project/requirement.html', {'milestone': milestone})


text:
[![Software License][ico-license]](LICENSE.md)
[![Build Status][ico-travis]][link-travis]
[![Code Climate][ico-code-climate]][link-code-climate]
[![Test Coverage][ico-code-climate-coverage]][link-code-climate-coverage]

StateMachine for Magento2.

## License

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

[ico-license]: https://img.shields.io/github/license/Dopamedia/StateMachine.svg?style=flat-square
[ico-travis]: https://img.shields.io/travis/Dopamedia/StateMachine/dev.svg?style=flat-square
[ico-code-climate]: https://codeclimate.com/github/Dopamedia/StateMachine/badges/gpa.svg
[ico-code-climate-coverage]: https://codeclimate.com/github/Dopamedia/StateMachine/badges/coverage.svg

[link-travis]: https://travis-ci.org/Dopamedia/StateMachine
[link-code-climate]: https://codeclimate.com/github/Dopamedia/StateMachine
[link-code-climate-coverage]: https://codeclimate.com/github/Dopamedia/StateMachine/coverage

redpajama_set_name: RedPajamaGithub


text:
import sys
import os
import re
import shutil
import traceback

import avmerge
import sequence
import audio_slice
import pathutil

_SECTION_PARSE = re.compile('(?P<begin>[^-]+)(-(?P<end>[^-]+)?)?')

def _sec_args():
    if len(sys.argv) == 1:
        begin_sec = ':begin'
        end_sec = ':end'
        return ':begin', ':end'
    if len(sys.argv) == 2:
        return sys.argv[1], sys.argv[1]
    return sys.argv[1], sys.argv[2]

def slice():
    begin_sec, end_sec = _sec_args()
    print 'Use sections', begin_sec, '->', end_sec
    try:
        avmerge.merge_partial(begin_sec, end_sec)
    except sequence.ParseError, e:
        traceback.print_exc()
        print >> sys.stderr, e.linenum, ':', e.message, ':', e.content

def inspect():
    begin_sec, end_sec = _sec_args()
    print 'Use sections', begin_sec, '->', end_sec
    try:
        _, end_time, sections = avmerge.find_range(begin_sec, end_sec)
        if len(sections) == 0:
            return
        sliced_segs = avmerge.slice_partial(sections)
    except sequence.ParseError, e:
        traceback.print_exc()
        print >> sys.stderr, e.linenum, ':', e.message, ':', e.content
        return

    def next_section(sec_index, seg_index, expected_len, actual_len):
        sec = sections[sec_index]
        print ':.:', sec.name
        sec_len = 0.0
        for seg in sec.segments:
            seg_len = audio_slice.audio_len(sliced_segs[seg_index])
            print '  >', seg.duration, seg_len
            sec_len += seg_len
            seg_index += 1
        actual_len += sec_len
        if sec_index == len(sections) - 1:
            expected_len += end_time - sec.start
            print '  :', end_time - sec.start, sec_len,
            print ':', expected_len, actual_len, actual_len - expected_len
            return
        expected_len += sections[sec_index + 1].start - sec.start
        print '  :', sections[sec_index + 1].start - sec.start, sec_len,
        print ':', expected_len, actual_len, actual_len - expected_len
        next_section(sec_index + 1, seg_index, expected_len, actual_len)

    next_section(0, 0, 0, 0)

def export():
    if len(sys.argv) != 2:
        print >> sys.stderr, 'Args:'
        print >> sys.stderr, '    OUTPUT_DIRECTORY'
        return sys.exit(1)
    if not pathutil.isdir(sys.argv[1]):
        print >> sys.stderr, sys.argv[1], 'is not a directory'
        return sys.exit(1)

    try:
        files = avmerge.slice_partial(avmerge.find_range(':begin', ':end')[2])
    except sequence.ParseError, e:
        traceback.print_exc()
        print >> sys.stderr, e.linenum, ':', e.message, ':', e.content
    for i, f in enumerate(files):
        shutil.copy(f, os.path.join(sys.argv[1], 'mmexport_%03d.mp4' % i))


text:
<?php

// AdminBundle:News:editNews.html.twig
return array (
);


text:
namespace Portal.Model.Context
{
    using System;
    using System.Collections.Generic;

    public partial class system_Menu
    {
        public int Id { get; set; }
        public string Name { get; set; }
        public string Url { get; set; }
        public Nullable<int> SortOrder { get; set; }
        public string Target { get; set; }
        public Nullable<int> Type { get; set; }
        public string Icon { get; set; }
        public Nullable<int> Status { get; set; }
        public Nullable<System.Guid> CreatedBy { get; set; }
        public Nullable<System.DateTime> CreatedDate { get; set; }
        public Nullable<System.Guid> ModifiedBy { get; set; }
        public Nullable<System.DateTime> ModifiedDate { get; set; }
    }
}


text:
var _ = require('underscore');

var BeakerPageObject = function() {
  this.baseURL = 'http://localhost:8801/';
  this.mainmenu = element.all(by.repeater('m in getMenus()'));
  //jscs:disable
  this.submenu = element.all(by.repeater("item in getMenuItems() | filter:isHidden | orderBy:'sortorder'"))
  //jscs:enable
    .filter(function(e, i) { return e.isDisplayed(); });

  this.waitForInstantiationCells = function() {
    // First wait for the modal to show up when opening a URL
    browser.wait(function() {
      return element(by.css('.modal-dialog')).isDisplayed()
      .then(function(v) {
        return v;
      })
      .thenCatch(function() {
        return false;
      });
    }, 100000);

    // wait for the modal to close
    return browser.wait(function() {
      return element(by.css('.modal-dialog')).isDisplayed()
      .then(function(v) {
        return false;
      })
      .thenCatch(function() {
        return true;
      });
    }, 100000);
  }

  this.openFile = function(path) {
    this.openMenuAtIndex(0);

    browser.sleep(1000); // mouseMove happens too fast and the menu doesnt display sometimes. Couldn't find a better solution.
    browser.actions().mouseMove(element(by.css('#open-menuitem'))).perform();

    element(by.css('a[title="Open a bkr notebook file"]')).click();
    browser.wait(function() {
      return element(by.css('input.form-control')).sendKeys(path)
        .then(function() {
          return true;
        })
        .thenCatch(function() {
          return false;
        });
    }, 5000)

    return element(by.css('.modal-submit')).click();
  };

  this.waitUntilGraphOutputPresent = function() {
    return browser.wait(function() {
      return element(by.css('bk-output-display[type="Plot"]')).isDisplayed()
      .then(function() {
        return true;
      })
      .thenCatch(function() {
        return false;
      });
    }, 10000);
  };

  this.openMenuAtIndex = function(index) {
    return this.mainmenu.get(index).element(by.css('.dropdown-toggle')).click();
  };

  this.toggleLanguageCellMenu = function(opts) {
    return element.all(by.css('.dropdown-toggle bk-language-logo'))
    .get(opts.cellIndex).click();
  };

  this.isLanguageCellMenuOpen = function() {
    return browser.executeScript('return $(".inputcellmenu:visible").length > 0');
  };

  this.toggleCellMenu = function(opts) {
    return element.all(by.css('.bkcell .toggle-menu .dropdown-promoted'))
    .get(opts.cellIndex)
    .click();
  };

  this.toggleAdvancedMode = function() {
    return element(by.css('.view-menu'))
    .click()
    .then(element(by.partialLinkText('Advanced Mode')).click);
  };

  this.isCellMenuOpen = function(opts) {
    return element.all(by.css('.bkcell .open.toggle-menu.bkr'))
    .get(opts.cellIndex)
    .isDisplayed()
    .then(function() {
      return true;
    })
    .thenCatch(function() {
      return false;
    });
  };

  this.createMarkdownCell = function(text) {
    return element(by.css('bk-new-cell-menu .dropdown-toggle'))
    .click()
    .then(function() {
      return element(by.css('.insert-text'));
    })
    .then(function(el) {
      return el.click();
    })
    .then(function() {
      return this.setCellInput(text);
    }.bind(this));
  }.bind(this);

  this.newEmptyNotebook = element(by.className('new-empty-notebook'));

  this.fileMenu = element(by.className('file-menu'));
  this.viewMenu = element(by.className('view-menu'));
  this.notebookMenu = element(by.className('notebook-menu'));
  this.helpMenu = element(by.className('help-menu'));

  this.languageManagerMenuItem = element(by.className('language-manager-menuitem'));
  this.closeMenuItem = element(by.className('close-menuitem'));

  this.closeNotebook = function() {
    return this.fileMenu.click()
    .then(this.closeMenuItem.click)
    .then(this.modalDialogNoButton.click)
    .thenCatch(function(e) {
      //if there has been no change do not fail here;
    });
  }.bind(this);

  this.codeCell = function(index) {
    return _.extend(element.all(by.css('.bkcell.code')).get(index),
                    require('./mixins/cell.js'));
  };
  this.waitForPlugin = function(plugin) {
    browser.wait(function() {
      var deferred = protractor.promise.defer();
      this.languageManagerButtonActive(plugin).isPresent()
        .then(function(result) {
          deferred.fulfill(result);
        });
      return deferred.promise;
    }.bind(this));
  };

  this.readMarkdownCell = function() {
    element(by.css('body')).click();

    return element(by.css('.markup p')).getText();
  };

  this.activateLanguageInManager = function(language) {
    this.languageManagerButtonActive(language).isPresent()
    .then(function(isActive) {
      if (!isActive) {
        return this.languageManagerButton(language).click();
      }
    }.bind(this));
  };

  this.languageManager = element(by.className('plugin-manager'));
  this.languageManagerButtonKnown = function(language) {
    return element(by.css('.plugin-manager .' + language + ' .plugin-known'));
  };
  this.languageManagerButtonActive = function(language) {
    return element(by.css('.plugin-manager .' + language + ' .plugin-active'));
  };
  this.languageManagerButton = function(language) {
    return element(by.css('.plugin-manager .' + language));
  };

  this.getEvaluateButton = function() {
    return element(by.className('evaluate-script'));
  };

  this.languageManagerCloseButton = element(by.className('language-manager-close-button'));
  this.insertCellButton = element(by.className('insert-cell'));
  this.evaluateButton = this.getEvaluateButton();
  this.modalDialogYesButton = element(by.css('.modal .yes'));
  this.modalDialogNoButton = element(by.css('.modal .no'));
  this.modalDialogCancelButton = element(by.css('.modal .cancel'));

  this.cellEvaluatorMenu = element(by.css('.code-cell-area .cell-evaluator-menu'));
  this.cellEvaluatorMenuItem = function(language) {
    return element(by.css('.code-cell-area .' + language + '-menuitem'));
  };
  this.cellEvaluatorDisplay = element(by.css('.code-cell-area .cell-evaluator-menu b'));
  this.setCellInput = function(code) {
    browser.executeScript('$(".CodeMirror")[0].CodeMirror.setValue("' + code + '")');
  };

  this.toggleOutputCellExpansion = function() {
    return element(by.css('.toggle-menu .expand-contract')).click();
  };

  this.evaluateCell = function() {
    var self = this;

    return browser.wait(function() {
      return self.getEvaluateButton().click()
      .then(function() {
        return true;
      })
      .thenCatch(function() {
        return false;
      });
    }, 5000);
  };

  this.insertNewCell = function() {
    element(by.css('bk-new-cell-menu')).click();
    return this.insertCellButton.click();
  };

  this.openSection = function() {
    return element(by.css('.bksectiontoggleplus')).click();
  }

  this.getCellOutput = function() {
    return element(by.css('bk-output-display > div'));
  };

  this.getLoadingIndicator = function() {
    return element(by.css('.navbar-text > i'));
  }

  this.waitForCellOutput = function(plugin) {
    var self = this;

    browser.wait(function() {
      return self.getCellOutput().isPresent()
      .then(function() {
        return true;
      })
      .thenCatch(function() {
        return false;
      });
    }, 10000);

    return browser.wait(function() {
      return self.getCellOutput().getText()
      .then(function(txt) {
        return txt.indexOf('Elapsed:') === -1;
      })
      .thenCatch(function() {
        return false;
      });
    }, 10000);
  };

  this.waitUntilLoadingFinished = function() {
    var self = this;
    return browser.wait(function() {
      return self.getLoadingIndicator().isPresent()
      .then(function(present) {
        return !present;
      })
      .thenCatch(function() {
        return false;
      });
    }, 10000);
  }

};
module.exports = BeakerPageObject;


text:
package com.ineunet.knife.qlmap.criteria;

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

import com.ineunet.knife.util.Asserts;
import com.ineunet.knife.util.StringUtils;

/**
 * 先上例子:

 *
 * Criteria c = new Criteria(User.class, "u", true);

 * c.addRestrictor(Restrictors.moreEq("writeTime", new Date()));

 * c.add(Restrictors.like("name", "1"));

 * c.add(Restrictors.eq("sex", 0));
 * c.orderBy("shopName desc");

 * c.limit(0, 10);

 * System.out.println(c.queryString());

 * : "from Criteria o where 1=1 and o.writeTime>=:writeTime and o.name like :name and o.sex=:sex order by o.shopName desc limit 0,10"
 *
 *

 *
 *
 * Criteria c = new Criteria(User.class, "u", true);

 * c.addRestrictor(Restrictors.moreEq("writeTime", new Date()));

 * c.addIfNotBlank(Restrictors.like("name", "1"));

 * c.addIfNotBlank(Restrictors.eq("sex", "0"));

 * c.addIfNotBlank(Restrictors.eq("sex", 0));
 * c.addIfNotBlank(Restrictors.eq("alias", ""));

 * c.orderBy("shopName desc");

 * c.limit(0, 10);

 * System.out.println(c.queryString());

 * : "from Criteria o where 1=1 and o.writeTime>=:writeTime and o.name like :name and o.sex=:sex order by o.shopName desc limit 0,10"
 *
 *

 *
 * List<User> users = PersistUtils.getHibernateTemplate().find(c);
 *

 *
 * 支持直接对数据库表(table)和对象实体(entity)进行查询。只负责组装查询语句,与具体持久层技术无关。
 *

 * 例子1,查询数据库表或视图:

 * sql      : select * from user where user_id=? and password=?;

 * Criteria :
 * { Criteria c= new Criteria("user");
 * c.add(Restrictor.eq("user_id", "wangx"));

 * c.add(Restrictor.eq("password", "z")); }

 * 查询:findBySql(sql, new String[]{"wangx", "z"}); findBySql(c);
 *
 *

 * 例子2,查询实体:

 * hql: from User where userId=? and password=?;

 * Criteria:{ Criteria cq = new Criteria(User.class); cq.add(Restrictor.eq("userId", 'wangx'));
 * cq.add(Restrictor.eq("password", 'z')); }

 * 查询: find(hql, new String[]{"wangx", "z"}); find(c);
 *
 *

 * 例子3,查询实体(Named Parameter,别名):

 * hql: from User u where u.userId=:userId and u.password=:password;

 * Criteria:{
 * Criteria cq = new Criteria(User.class, "u", true); cq.add(Restrictor.eq("userId", 'wangx'));
 * cq.add(Restrictor.eq("password", 'z')); }

 * 查询: find(hql, new String[]{"wangx", "z"}); find(c);
 *
 *

 * 例子4,逻辑或查询:

 * hql:from SysOrganization where organizationType='3' or password='4';
 * Criteria:{ Criteria c = new Criteria(SysOrganization.class);
 * c.add(Restrictor.or(Restrictor.eq("organizationType", "4"),
 * Restrictor.eq("organizationType", "3")) ); }

 * 查询:find(c);
 *
 * @author Hilbert Wang
 *
 * @since 2010-7-2
 *
 */
public class Criteria implements ICriteria {

	/** 查询语句中 属性值的占位符 e.g. name=? and pwd=? */
	static final String VALUE_PLACEHOLDER = "?";
	static final String VALUE_NAMED_SIGN = ":";

	private String select = "*";
	private StringBuilder queryString;
	private StringBuilder orderBy;
	private StringBuilder limit;

	private List<Object> values = new ArrayList<Object>();

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

	/** is sql or hql */
	private boolean sql = false;

	/**
	 * use named parameters or JPA-style positional parameters
	 */
	private boolean namedParam = false;

	private String alias;

	private static final String restriction_isNull = Restrictors.getRestriction(RestrictType.isNull);
	private static final String restriction_isNotNull = Restrictors.getRestriction(RestrictType.isNotNull);

	/**
	 * 查询映射实体
	 * @param entityClass 实体类型
	 */
	public Criteria(Class<?> entityClass) {
		queryString = new StringBuilder().append(entityClass.getSimpleName()).append(" where 1=1");
	}

	public Criteria(Class<?> entityClass, String alias) {
		this.alias = alias;
		queryString = new StringBuilder().append(entityClass.getSimpleName()).append(" ").append(alias).append(" where 1=1");
	}

	public Criteria(Class<?> entityClass, String alias, boolean namedParam) {
		this(entityClass, alias);
		this.namedParam = namedParam;
	}

	/**
	 * 直接查询数据库
	 * @param table 查询的表名
	 */
	public Criteria(String table) {
		sql = true;
		queryString = new StringBuilder().append(table).append(" where 1=1");
	}

	public Criteria(String table, boolean namedParam) {
		sql = true;
		this.namedParam = namedParam;
		queryString = new StringBuilder().append(table).append(" where 1=1");
	}

	public Criteria(String table, String alias) {
		Asserts.notBlank(alias);
		this.alias = alias;
		sql = true;
		queryString = new StringBuilder().append(table).append(" ").append(alias).append(" where 1=1");
	}

	/**
	 * Ignore when { null, empty String, 0 Long }
	 * @param restrictor Restrictor
	 * @return criteria
	 */
	@Override
	public ICriteria addIfNotBlank(Restrictor restrictor) {
		if(restrictor instanceof SimpleRestrictor) {
			Object val = ((SimpleRestrictor) restrictor).getValue();
			if(val == null) return this;

			if(val instanceof String) {
				String valStr = (String) val;
				if(valStr.trim().length() == 0) return this;
			} else if (val instanceof Long) {
				Long valLong = (Long) val;
				if(valLong == 0) return this;
			}  else if (val instanceof Integer) {
				Integer valInteger = (Integer) val;
				if(valInteger == 0) return this;
			}
		}
		return this.addRestrictor(restrictor);
	}

	public ICriteria addRestrictor(Restrictor criterion) {
		if(criterion == null) return this;
		queryString.append(" and ");
		if (criterion instanceof SimpleRestrictor)
			addSimpleExpression(criterion);
		else if(criterion instanceof ExpressionRestrictor)
			addExpressionCriterion(criterion);
		else if (criterion instanceof LogicRestrictor)
			addLogicalExpression(criterion);
		return this;
	}

	@Override
	public ICriteria orderBy(String orderby) {
		if(orderby == null || orderby.trim().length() == 0) return this;
		orderBy = new StringBuilder();
		if(sql) {
			// order by shopName ASC
			String[] arr = orderby.trim().split(" +");
			if(arr.length == 2) {
				String orderField = arr[0].trim();
				String sort = arr[1].trim();
				orderby = CriteriaUtils.propToColumn(orderField) + " " + sort;
			} else {
				orderby = CriteriaUtils.propToColumn(arr[0].trim());
			}
		}
		orderBy.append(" order by ");
		if (this.hasAlias()) {
			orderBy.append(this.alias).append(".");
		}
		orderBy.append(orderby);
		return this;
	}

	@Override
	public ICriteria limit(int start, int rows) {
		limit = new StringBuilder();
		limit.append(" limit ").append(start).append(",").append(rows);
		return this;
	}

	/*
	 * 添加简单运算表达式
	 */
	private ICriteria addSimpleExpression(Restrictor criterion) {
		SimpleRestrictor e = (SimpleRestrictor) criterion;
		String restriction = e.getRestriction();
		if (this.hasAlias()) {
			queryString.append(this.alias).append(".");
		}
		queryString.append(e.getProperty());
		queryString.append(restriction);
		if (restriction.equals(restriction_isNull) || restriction.equals(restriction_isNotNull)) {
			return this;
		}

		if (this.namedParam) {
			queryString.append(VALUE_NAMED_SIGN).append(e.getProperty());
			namedValues.put(e.getProperty().trim(), e.getValue());
		} else {
			queryString.append(VALUE_PLACEHOLDER);
			values.add(e.getValue());
		}
		return this;
	}

	// Like SimpleExpression. But not use VALUE_PLACEHOLDER
	private ICriteria addExpressionCriterion(Restrictor criterion) {
		ExpressionRestrictor e = (ExpressionRestrictor) criterion;
		if (this.hasAlias()) {
			queryString.append(this.alias).append(".");
		}
		queryString.append(e.getProperty());
		queryString.append(e.getRestriction());
		queryString.append(e.getExpression());
		return this;
	}

	/*
	 * 添加逻辑运算表达式
	 */
	private ICriteria addLogicalExpression(Restrictor criterion) {
		LogicRestrictor e = (LogicRestrictor) criterion;
		Restrictor ic1 = e.getLeft();
		Restrictor ic2 = e.getRight();

		boolean isOr = RestrictType.or.toString().equals(e.getRestriction());
		if (isOr)// 如果是 or 运算,用小括号扩上
			queryString.append("(");

		// 添加左侧表达式
		if (ic1 instanceof SimpleRestrictor)
			addSimpleExpression(ic1);
		else if (ic1 instanceof LogicRestrictor)
			addLogicalExpression(ic1);

		// 添加逻辑运算符
		queryString.append(" ").append(e.getRestriction()).append(" ");

		// 添加右侧表达式
		if (ic2 instanceof SimpleRestrictor)
			addSimpleExpression(ic2);
		else if (ic2 instanceof LogicRestrictor)
			addLogicalExpression(ic2);

		if (isOr)// 如果是 or 运算,用小括号扩上
			queryString.append(")");

		return this;
	}

	@Override
	public ICriteria setSelectColumns(String select) {
		this.select = select;
		return this;
	}

	public String getQueryString() {
		StringBuilder qs = new StringBuilder();
		if (sql) {
			qs.append("select ").append(select).append(" from ").append(queryString);
		} else {
			qs.append("from ").append(queryString.toString());
		}
		if(this.orderBy != null)
			qs.append(this.orderBy);
		if(this.limit != null)
			qs.append(this.limit);
		return qs.toString();
	}

	@Override
	public String getCountString() {
		return "select count(*) from " + queryString.toString();
	}

	@Override
	public String getDeleteString() {
		return "delete from " + queryString.toString();
	}

	public Object[] getValues() {
		return values.toArray();
	}

	@Override
	public Map<String, Object> getNamedValues() {
		return namedValues;
	}

	public String getOrderBy() {
		if(orderBy == null) return null;
		return orderBy.toString();
	}

	@Override
	public String getAlias() {
		return this.alias;
	}

	public boolean hasAlias() {
		return StringUtils.isNotBlank(alias);
	}

	@Override
	public boolean isNamedParam() {
		return namedParam;
	}

	@Override
	public String toString() {
		return this.getQueryString();
	}

}


text:
<?php

print file_get_contents('https://api.github.com/users/seagoj/repos');


text:
require "digest/sha1"
require "launchy"

module LetterOpener
  class DeliveryMethod
    class InvalidOption < StandardError; end

    attr_accessor :settings

    def initialize(options = {})
      options[:message_template] ||= LetterOpener.configuration.message_template
      options[:location] ||= LetterOpener.configuration.location
      options[:file_uri_scheme] ||= LetterOpener.configuration.file_uri_scheme

      raise InvalidOption, "A location option is required when using the Letter Opener delivery method" if options[:location].nil?

      self.settings = options
    end

    def deliver!(mail)
      validate_mail!(mail)
      location = File.join(settings[:location], "#{Time.now.to_f.to_s.tr('.', '_')}_#{Digest::SHA1.hexdigest(mail.encoded)[0..6]}")

      messages = Message.rendered_messages(mail, location: location, message_template: settings[:message_template])
      ::Launchy.open("#{settings[:file_uri_scheme]}#{messages.first.filepath}")
    end

    private

    def validate_mail!(mail)
      if !mail.smtp_envelope_from || mail.smtp_envelope_from.empty?
        raise ArgumentError, "SMTP From address may not be blank"
      end

      if !mail.smtp_envelope_to || mail.smtp_envelope_to.empty?
        raise ArgumentError, "SMTP To address may not be blank"
      end
    end
  end
end


text:
package org.apache.cassandra.streaming;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import org.apache.commons.lang.StringUtils;

import org.apache.cassandra.io.ICompactSerializer;
import org.apache.cassandra.io.sstable.Descriptor;
import org.apache.cassandra.utils.Pair;

/**
 * Represents portions of a file to be streamed between nodes.
 */
public class PendingFile
{
    private static PendingFileSerializer serializer_ = new PendingFileSerializer();

    public static PendingFileSerializer serializer()
    {
        return serializer_;
    }

    public final Descriptor desc;
    public final String component;
    public final List<Pair<Long,Long>> sections;
    public final long size;
    public long progress;

    public PendingFile(Descriptor desc, PendingFile pf)
    {
        this(desc, pf.component, pf.sections);
    }

    public PendingFile(Descriptor desc, String component, List<Pair<Long,Long>> sections)
    {
        this.desc = desc;
        this.component = component;
        this.sections = sections;
        long tempSize = 0;
        for(Pair<Long,Long> section : sections)
        {
            tempSize += section.right - section.left;
        }
        size = tempSize;
    }

    public String getFilename()
    {
        return desc.filenameFor(component);
    }

    public boolean equals(Object o)
    {
        if ( !(o instanceof PendingFile) )
            return false;

        PendingFile rhs = (PendingFile)o;
        return getFilename().equals(rhs.getFilename());
    }

    public int hashCode()
    {
        return getFilename().hashCode();
    }

    public String toString()
    {
        return getFilename() + "/" + StringUtils.join(sections, ",") + "\n\t progress=" + progress + "/" + size + " - " + progress*100/size + "%";
    }

    public static class PendingFileSerializer implements ICompactSerializer<PendingFile>
    {
        public void serialize(PendingFile sc, DataOutputStream dos) throws IOException
        {
            if (sc == null)
            {
                dos.writeUTF("");
                return;
            }

            dos.writeUTF(sc.desc.filenameFor(sc.component));
            dos.writeUTF(sc.component);
            dos.writeInt(sc.sections.size());
            for (Pair<Long,Long> section : sc.sections)
            {
                dos.writeLong(section.left); dos.writeLong(section.right);
            }
        }

        public PendingFile deserialize(DataInputStream dis) throws IOException
        {
            String filename = dis.readUTF();
            if (filename.isEmpty())
                return null;

            Descriptor desc = Descriptor.fromFilename(filename);
            String component = dis.readUTF();
            int count = dis.readInt();
            List<Pair<Long,Long>> sections = new ArrayList<Pair<Long,Long>>(count);
            for (int i = 0; i < count; i++)
                sections.add(new Pair<Long,Long>(Long.valueOf(dis.readLong()), Long.valueOf(dis.readLong())));
            return new PendingFile(desc, component, sections);
        }
    }
}


text:
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class frmMain
    Inherits System.Windows.Forms.Form

    'Form 重写 Dispose,以清理组件列表。
    <System.Diagnostics.DebuggerNonUserCode()> _
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        Try
            If disposing AndAlso components IsNot Nothing Then
                components.Dispose()
            End If
        Finally
            MyBase.Dispose(disposing)
        End Try
    End Sub

    'Windows 窗体设计器所必需的
    Private components As System.ComponentModel.IContainer

    '注意: 以下过程是 Windows 窗体设计器所必需的
    '可以使用 Windows 窗体设计器修改它。
    '不要使用代码编辑器修改它。
    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
        Me.components = New System.ComponentModel.Container()
        Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(frmMain))
        Me.MenuStrip1 = New System.Windows.Forms.MenuStrip()
        Me.新建ToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
        Me.打开ToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
        Me.保存ToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
        Me.生成图片ToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
        Me.PrintToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
        Me.ContextMenuStrip1 = New System.Windows.Forms.ContextMenuStrip(Me.components)
        Me.删除ToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
        Me.btnAutoNo = New System.Windows.Forms.Button()
        Me.PropertyGrid1 = New System.Windows.Forms.PropertyGrid()
        Me.btnReset = New System.Windows.Forms.Button()
        Me.StatusStrip1 = New System.Windows.Forms.StatusStrip()
        Me.ToolStripStatusLabel1 = New System.Windows.Forms.ToolStripStatusLabel()
        Me.MainBoxPoint = New System.Windows.Forms.ToolStripStatusLabel()
        Me.ToolStripStatusLabel2 = New System.Windows.Forms.ToolStripStatusLabel()
        Me.OriPoint = New System.Windows.Forms.ToolStripStatusLabel()
        Me.ToolStripStatusLabel3 = New System.Windows.Forms.ToolStripStatusLabel()
        Me.labFPS = New System.Windows.Forms.ToolStripStatusLabel()
        Me.btnWire = New System.Windows.Forms.Button()
        Me.PictureBox9 = New System.Windows.Forms.PictureBox()
        Me.picLight = New System.Windows.Forms.PictureBox()
        Me.PictureBox7 = New System.Windows.Forms.PictureBox()
        Me.picMain = New System.Windows.Forms.PictureBox()
        Me.PictureBox3 = New System.Windows.Forms.PictureBox()
        Me.PictureBox6 = New System.Windows.Forms.PictureBox()
        Me.picVoltmeter = New System.Windows.Forms.PictureBox()
        Me.PictureBox4 = New System.Windows.Forms.PictureBox()
        Me.picMotor = New System.Windows.Forms.PictureBox()
        Me.picAmmeter = New System.Windows.Forms.PictureBox()
        Me.btnStart = New System.Windows.Forms.Button()
        Me.btnStop = New System.Windows.Forms.Button()
        Me.picNotGate = New System.Windows.Forms.PictureBox()
        Me.picHub3p = New System.Windows.Forms.PictureBox()
        Me.MenuStrip1.SuspendLayout()
        Me.ContextMenuStrip1.SuspendLayout()
        Me.StatusStrip1.SuspendLayout()
        CType(Me.PictureBox9, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.picLight, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.PictureBox7, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.picMain, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.PictureBox3, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.PictureBox6, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.picVoltmeter, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.PictureBox4, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.picMotor, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.picAmmeter, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.picNotGate, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.picHub3p, System.ComponentModel.ISupportInitialize).BeginInit()
        Me.SuspendLayout()
        '
        'MenuStrip1
        '
        Me.MenuStrip1.ImageScalingSize = New System.Drawing.Size(20, 20)
        Me.MenuStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.新建ToolStripMenuItem, Me.打开ToolStripMenuItem, Me.保存ToolStripMenuItem, Me.生成图片ToolStripMenuItem, Me.PrintToolStripMenuItem})
        Me.MenuStrip1.Location = New System.Drawing.Point(0, 0)
        Me.MenuStrip1.Name = "MenuStrip1"
        Me.MenuStrip1.Padding = New System.Windows.Forms.Padding(8, 2, 0, 2)
        Me.MenuStrip1.Size = New System.Drawing.Size(844, 28)
        Me.MenuStrip1.TabIndex = 1
        Me.MenuStrip1.Text = "菜单"
        '
        '新建ToolStripMenuItem
        '
        Me.新建ToolStripMenuItem.Name = "新建ToolStripMenuItem"
        Me.新建ToolStripMenuItem.Size = New System.Drawing.Size(51, 24)
        Me.新建ToolStripMenuItem.Text = "新建"
        '
        '打开ToolStripMenuItem
        '
        Me.打开ToolStripMenuItem.Name = "打开ToolStripMenuItem"
        Me.打开ToolStripMenuItem.Size = New System.Drawing.Size(51, 24)
        Me.打开ToolStripMenuItem.Text = "打开"
        '
        '保存ToolStripMenuItem
        '
        Me.保存ToolStripMenuItem.Name = "保存ToolStripMenuItem"
        Me.保存ToolStripMenuItem.Size = New System.Drawing.Size(51, 24)
        Me.保存ToolStripMenuItem.Text = "保存"
        '
        '生成图片ToolStripMenuItem
        '
        Me.生成图片ToolStripMenuItem.Name = "生成图片ToolStripMenuItem"
        Me.生成图片ToolStripMenuItem.Size = New System.Drawing.Size(81, 24)
        Me.生成图片ToolStripMenuItem.Text = "生成图片"
        '
        'PrintToolStripMenuItem
        '
        Me.PrintToolStripMenuItem.Name = "PrintToolStripMenuItem"
        Me.PrintToolStripMenuItem.Size = New System.Drawing.Size(51, 24)
        Me.PrintToolStripMenuItem.Text = "打印"
        '
        'ContextMenuStrip1
        '
        Me.ContextMenuStrip1.ImageScalingSize = New System.Drawing.Size(20, 20)
        Me.ContextMenuStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.删除ToolStripMenuItem})
        Me.ContextMenuStrip1.Name = "ContextMenuStrip1"
        Me.ContextMenuStrip1.Size = New System.Drawing.Size(109, 28)
        '
        '删除ToolStripMenuItem
        '
        Me.删除ToolStripMenuItem.Name = "删除ToolStripMenuItem"
        Me.删除ToolStripMenuItem.Size = New System.Drawing.Size(108, 24)
        Me.删除ToolStripMenuItem.Text = "删除"
        '
        'btnAutoNo
        '
        Me.btnAutoNo.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.btnAutoNo.Location = New System.Drawing.Point(600, 538)
        Me.btnAutoNo.Margin = New System.Windows.Forms.Padding(4)
        Me.btnAutoNo.Name = "btnAutoNo"
        Me.btnAutoNo.Size = New System.Drawing.Size(228, 29)
        Me.btnAutoNo.TabIndex = 10
        Me.btnAutoNo.Text = "自动编号"
        Me.btnAutoNo.UseVisualStyleBackColor = True
        '
        'PropertyGrid1
        '
        Me.PropertyGrid1.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
            Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.PropertyGrid1.Location = New System.Drawing.Point(600, 35)
        Me.PropertyGrid1.Margin = New System.Windows.Forms.Padding(4)
        Me.PropertyGrid1.Name = "PropertyGrid1"
        Me.PropertyGrid1.Size = New System.Drawing.Size(228, 495)
        Me.PropertyGrid1.TabIndex = 11
        '
        'btnReset
        '
        Me.btnReset.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.btnReset.Location = New System.Drawing.Point(600, 575)
        Me.btnReset.Margin = New System.Windows.Forms.Padding(4)
        Me.btnReset.Name = "btnReset"
        Me.btnReset.Size = New System.Drawing.Size(228, 29)
        Me.btnReset.TabIndex = 12
        Me.btnReset.Text = "复位原点"
        Me.btnReset.UseVisualStyleBackColor = True
        '
        'StatusStrip1
        '
        Me.StatusStrip1.ImageScalingSize = New System.Drawing.Size(20, 20)
        Me.StatusStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.ToolStripStatusLabel1, Me.MainBoxPoint, Me.ToolStripStatusLabel2, Me.OriPoint, Me.ToolStripStatusLabel3, Me.labFPS})
        Me.StatusStrip1.Location = New System.Drawing.Point(0, 687)
        Me.StatusStrip1.Name = "StatusStrip1"
        Me.StatusStrip1.Padding = New System.Windows.Forms.Padding(1, 0, 19, 0)
        Me.StatusStrip1.Size = New System.Drawing.Size(844, 25)
        Me.StatusStrip1.TabIndex = 13
        Me.StatusStrip1.Text = "StatusStrip1"
        '
        'ToolStripStatusLabel1
        '
        Me.ToolStripStatusLabel1.Name = "ToolStripStatusLabel1"
        Me.ToolStripStatusLabel1.Size = New System.Drawing.Size(129, 20)
        Me.ToolStripStatusLabel1.Text = "相对于操作框坐标"
        '
        'MainBoxPoint
        '
        Me.MainBoxPoint.Name = "MainBoxPoint"
        Me.MainBoxPoint.Size = New System.Drawing.Size(45, 20)
        Me.MainBoxPoint.Text = "(0, 0)"
        '
        'ToolStripStatusLabel2
        '
        Me.ToolStripStatusLabel2.Name = "ToolStripStatusLabel2"
        Me.ToolStripStatusLabel2.Size = New System.Drawing.Size(114, 20)
        Me.ToolStripStatusLabel2.Text = "相对于原点坐标"
        '
        'OriPoint
        '
        Me.OriPoint.Name = "OriPoint"
        Me.OriPoint.Size = New System.Drawing.Size(45, 20)
        Me.OriPoint.Text = "(0, 0)"
        '
        'ToolStripStatusLabel3
        '
        Me.ToolStripStatusLabel3.Name = "ToolStripStatusLabel3"
        Me.ToolStripStatusLabel3.Size = New System.Drawing.Size(35, 20)
        Me.ToolStripStatusLabel3.Text = "FPS"
        '
        'labFPS
        '
        Me.labFPS.Name = "labFPS"
        Me.labFPS.Size = New System.Drawing.Size(15, 20)
        Me.labFPS.Text = "-"
        '
        'btnWire
        '
        Me.btnWire.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.btnWire.Location = New System.Drawing.Point(600, 612)
        Me.btnWire.Margin = New System.Windows.Forms.Padding(4)
        Me.btnWire.Name = "btnWire"
        Me.btnWire.Size = New System.Drawing.Size(228, 29)
        Me.btnWire.TabIndex = 14
        Me.btnWire.Text = "导线"
        Me.btnWire.UseVisualStyleBackColor = True
        '
        'PictureBox9
        '
        Me.PictureBox9.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
        Me.PictureBox9.Image = CType(resources.GetObject("PictureBox9.Image"), System.Drawing.Image)
        Me.PictureBox9.Location = New System.Drawing.Point(256, 596)
        Me.PictureBox9.Margin = New System.Windows.Forms.Padding(4)
        Me.PictureBox9.Name = "PictureBox9"
        Me.PictureBox9.Size = New System.Drawing.Size(49, 49)
        Me.PictureBox9.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize
        Me.PictureBox9.TabIndex = 17
        Me.PictureBox9.TabStop = False
        '
        'picLight
        '
        Me.picLight.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
        Me.picLight.Location = New System.Drawing.Point(172, 538)
        Me.picLight.Margin = New System.Windows.Forms.Padding(4)
        Me.picLight.Name = "picLight"
        Me.picLight.Size = New System.Drawing.Size(70, 50)
        Me.picLight.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize
        Me.picLight.TabIndex = 16
        Me.picLight.TabStop = False
        '
        'PictureBox7
        '
        Me.PictureBox7.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
        Me.PictureBox7.Image = CType(resources.GetObject("PictureBox7.Image"), System.Drawing.Image)
        Me.PictureBox7.Location = New System.Drawing.Point(199, 596)
        Me.PictureBox7.Margin = New System.Windows.Forms.Padding(4)
        Me.PictureBox7.Name = "PictureBox7"
        Me.PictureBox7.Size = New System.Drawing.Size(49, 49)
        Me.PictureBox7.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize
        Me.PictureBox7.TabIndex = 15
        Me.PictureBox7.TabStop = False
        '
        'picMain
        '
        Me.picMain.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
            Or System.Windows.Forms.AnchorStyles.Left) _
            Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.picMain.ContextMenuStrip = Me.ContextMenuStrip1
        Me.picMain.Location = New System.Drawing.Point(16, 35)
        Me.picMain.Margin = New System.Windows.Forms.Padding(4)
        Me.picMain.Name = "picMain"
        Me.picMain.Size = New System.Drawing.Size(576, 495)
        Me.picMain.TabIndex = 0
        Me.picMain.TabStop = False
        '
        'PictureBox3
        '
        Me.PictureBox3.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
        Me.PictureBox3.Image = CType(resources.GetObject("PictureBox3.Image"), System.Drawing.Image)
        Me.PictureBox3.Location = New System.Drawing.Point(16, 596)
        Me.PictureBox3.Margin = New System.Windows.Forms.Padding(4)
        Me.PictureBox3.Name = "PictureBox3"
        Me.PictureBox3.Size = New System.Drawing.Size(49, 49)
        Me.PictureBox3.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize
        Me.PictureBox3.TabIndex = 5
        Me.PictureBox3.TabStop = False
        '
        'PictureBox6
        '
        Me.PictureBox6.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
        Me.PictureBox6.Image = CType(resources.GetObject("PictureBox6.Image"), System.Drawing.Image)
        Me.PictureBox6.Location = New System.Drawing.Point(130, 596)
        Me.PictureBox6.Margin = New System.Windows.Forms.Padding(4)
        Me.PictureBox6.Name = "PictureBox6"
        Me.PictureBox6.Size = New System.Drawing.Size(61, 49)
        Me.PictureBox6.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize
        Me.PictureBox6.TabIndex = 8
        Me.PictureBox6.TabStop = False
        '
        'picVoltmeter
        '
        Me.picVoltmeter.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
        Me.picVoltmeter.Location = New System.Drawing.Point(94, 538)
        Me.picVoltmeter.Margin = New System.Windows.Forms.Padding(4)
        Me.picVoltmeter.Name = "picVoltmeter"
        Me.picVoltmeter.Size = New System.Drawing.Size(70, 50)
        Me.picVoltmeter.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize
        Me.picVoltmeter.TabIndex = 7
        Me.picVoltmeter.TabStop = False
        '
        'PictureBox4
        '
        Me.PictureBox4.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
        Me.PictureBox4.Image = CType(resources.GetObject("PictureBox4.Image"), System.Drawing.Image)
        Me.PictureBox4.Location = New System.Drawing.Point(73, 596)
        Me.PictureBox4.Margin = New System.Windows.Forms.Padding(4)
        Me.PictureBox4.Name = "PictureBox4"
        Me.PictureBox4.Size = New System.Drawing.Size(49, 49)
        Me.PictureBox4.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize
        Me.PictureBox4.TabIndex = 6
        Me.PictureBox4.TabStop = False
        '
        'picMotor
        '
        Me.picMotor.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
        Me.picMotor.Location = New System.Drawing.Point(250, 538)
        Me.picMotor.Margin = New System.Windows.Forms.Padding(4)
        Me.picMotor.Name = "picMotor"
        Me.picMotor.Size = New System.Drawing.Size(70, 50)
        Me.picMotor.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize
        Me.picMotor.TabIndex = 4
        Me.picMotor.TabStop = False
        '
        'picAmmeter
        '
        Me.picAmmeter.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
        Me.picAmmeter.Location = New System.Drawing.Point(16, 538)
        Me.picAmmeter.Margin = New System.Windows.Forms.Padding(4)
        Me.picAmmeter.Name = "picAmmeter"
        Me.picAmmeter.Size = New System.Drawing.Size(70, 50)
        Me.picAmmeter.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize
        Me.picAmmeter.TabIndex = 2
        Me.picAmmeter.TabStop = False
        '
        'btnStart
        '
        Me.btnStart.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.btnStart.Location = New System.Drawing.Point(600, 648)
        Me.btnStart.Name = "btnStart"
        Me.btnStart.Size = New System.Drawing.Size(108, 29)
        Me.btnStart.TabIndex = 19
        Me.btnStart.Text = "开始"
        Me.btnStart.UseVisualStyleBackColor = True
        '
        'btnStop
        '
        Me.btnStop.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.btnStop.Location = New System.Drawing.Point(720, 648)
        Me.btnStop.Name = "btnStop"
        Me.btnStop.Size = New System.Drawing.Size(108, 29)
        Me.btnStop.TabIndex = 20
        Me.btnStop.Text = "停止"
        Me.btnStop.UseVisualStyleBackColor = True
        '
        'picNotGate
        '
        Me.picNotGate.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
        Me.picNotGate.Location = New System.Drawing.Point(328, 538)
        Me.picNotGate.Margin = New System.Windows.Forms.Padding(4)
        Me.picNotGate.Name = "picNotGate"
        Me.picNotGate.Size = New System.Drawing.Size(70, 50)
        Me.picNotGate.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize
        Me.picNotGate.TabIndex = 21
        Me.picNotGate.TabStop = False
        '
        'picHub3p
        '
        Me.picHub3p.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
        Me.picHub3p.Location = New System.Drawing.Point(406, 553)
        Me.picHub3p.Margin = New System.Windows.Forms.Padding(4)
        Me.picHub3p.Name = "picHub3p"
        Me.picHub3p.Size = New System.Drawing.Size(30, 35)
        Me.picHub3p.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize
        Me.picHub3p.TabIndex = 22
        Me.picHub3p.TabStop = False
        '
        'frmMain
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(8.0!, 15.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(844, 712)
        Me.Controls.Add(Me.picHub3p)
        Me.Controls.Add(Me.picNotGate)
        Me.Controls.Add(Me.btnStop)
        Me.Controls.Add(Me.btnStart)
        Me.Controls.Add(Me.PictureBox9)
        Me.Controls.Add(Me.picLight)
        Me.Controls.Add(Me.PictureBox7)
        Me.Controls.Add(Me.btnWire)
        Me.Controls.Add(Me.StatusStrip1)
        Me.Controls.Add(Me.PropertyGrid1)
        Me.Controls.Add(Me.picMain)
        Me.Controls.Add(Me.btnReset)
        Me.Controls.Add(Me.PictureBox3)
        Me.Controls.Add(Me.PictureBox6)
        Me.Controls.Add(Me.btnAutoNo)
        Me.Controls.Add(Me.picVoltmeter)
        Me.Controls.Add(Me.PictureBox4)
        Me.Controls.Add(Me.MenuStrip1)
        Me.Controls.Add(Me.picMotor)
        Me.Controls.Add(Me.picAmmeter)
        Me.MainMenuStrip = Me.MenuStrip1
        Me.Margin = New System.Windows.Forms.Padding(4)
        Me.Name = "frmMain"
        Me.Text = "Circuit 0.1 Alpha"
        Me.MenuStrip1.ResumeLayout(False)
        Me.MenuStrip1.PerformLayout()
        Me.ContextMenuStrip1.ResumeLayout(False)
        Me.StatusStrip1.ResumeLayout(False)
        Me.StatusStrip1.PerformLayout()
        CType(Me.PictureBox9, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.picLight, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.PictureBox7, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.picMain, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.PictureBox3, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.PictureBox6, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.picVoltmeter, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.PictureBox4, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.picMotor, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.picAmmeter, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.picNotGate, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.picHub3p, System.ComponentModel.ISupportInitialize).EndInit()
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub
    Friend WithEvents picMain As System.Windows.Forms.PictureBox
    Friend WithEvents MenuStrip1 As System.Windows.Forms.MenuStrip
    Friend WithEvents 新建ToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem
    Friend WithEvents 保存ToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem
    Friend WithEvents 生成图片ToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem
    Friend WithEvents picAmmeter As System.Windows.Forms.PictureBox
    Friend WithEvents ContextMenuStrip1 As System.Windows.Forms.ContextMenuStrip
    Friend WithEvents 删除ToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem
    Friend WithEvents picMotor As System.Windows.Forms.PictureBox
    Friend WithEvents PictureBox3 As System.Windows.Forms.PictureBox
    Friend WithEvents PictureBox4 As System.Windows.Forms.PictureBox
    Friend WithEvents picVoltmeter As System.Windows.Forms.PictureBox
    Friend WithEvents PictureBox6 As System.Windows.Forms.PictureBox
    Friend WithEvents btnAutoNo As System.Windows.Forms.Button
    Friend WithEvents PropertyGrid1 As System.Windows.Forms.PropertyGrid
    Friend WithEvents btnReset As System.Windows.Forms.Button
    Friend WithEvents StatusStrip1 As System.Windows.Forms.StatusStrip
    Friend WithEvents ToolStripStatusLabel1 As System.Windows.Forms.ToolStripStatusLabel
    Friend WithEvents MainBoxPoint As System.Windows.Forms.ToolStripStatusLabel
    Friend WithEvents ToolStripStatusLabel2 As System.Windows.Forms.ToolStripStatusLabel
    Friend WithEvents OriPoint As System.Windows.Forms.ToolStripStatusLabel
    Friend WithEvents btnWire As System.Windows.Forms.Button
    Friend WithEvents PictureBox7 As System.Windows.Forms.PictureBox
    Friend WithEvents picLight As System.Windows.Forms.PictureBox
    Friend WithEvents PictureBox9 As System.Windows.Forms.PictureBox
    Friend WithEvents 打开ToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem
    Friend WithEvents PrintToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem
    Friend WithEvents btnStart As System.Windows.Forms.Button
    Friend WithEvents btnStop As System.Windows.Forms.Button
    Friend WithEvents ToolStripStatusLabel3 As System.Windows.Forms.ToolStripStatusLabel
    Friend WithEvents labFPS As System.Windows.Forms.ToolStripStatusLabel
    Friend WithEvents picNotGate As System.Windows.Forms.PictureBox
    Friend WithEvents picHub3p As System.Windows.Forms.PictureBox

End Class


text:
YUI.add('anim-xy', function (Y, NAME) {

/**
 * Adds support for the xy property in from and
 * to attributes.
 * @module anim
 * @submodule anim-xy
 */

var NUM = Number;

Y.Anim.behaviors.xy = {
    set: function(anim, att, from, to, elapsed, duration, fn) {
        anim._node.setXY([
            fn(elapsed, NUM(from[0]), NUM(to[0]) - NUM(from[0]), duration),
            fn(elapsed, NUM(from[1]), NUM(to[1]) - NUM(from[1]), duration)
        ]);
    },
    get: function(anim) {
        return anim._node.getXY();
    }
};

}, '@VERSION@', {"requires": ["anim-base", "node-screen"]});


text:
package org.hope6537.file;

import java.io.*;

/**
 * @version 0.9
 * @Describe 关于文件的操作
 * @Author Hope6537(赵鹏)
 * @Signdate 2014-4-29下午06:23:16
 * @company Changchun University&SHXT
 */
public class FileByteUtil {

    /**
     * @Descirbe 文件转化成数组
     * @Author Hope6537(赵鹏)
     * @Params @param file
     * @Params @return
     * @SignDate 2014-4-29下午06:23:31
     * @Version 0.9
     */
    public static byte[] getBytesFromFile(File file) {
        byte[] ret = null;
        try {
            if (file == null) {
                // log.error("helper:the file is null!");
                return null;
            }
            FileInputStream in = new FileInputStream(file);
            ByteArrayOutputStream out = new ByteArrayOutputStream(4096);
            byte[] b = new byte[4096];
            int n;
            while ((n = in.read(b)) != -1) {
                out.write(b, 0, n);
            }
            in.close();
            out.close();
            ret = out.toByteArray();
        } catch (IOException e) {
            // log.error("helper:get bytes from file process error!");
            e.printStackTrace();
        }
        return ret;
    }

    /**
     * @Descirbe 字符数组转化成文件
     * @Author Hope6537(赵鹏)
     * @Params @param b
     * @Params @param outputFile
     * @Params @return
     * @SignDate 2014-4-29下午06:23:58
     * @Version 0.9
     */
    public static File getFileFromBytes(byte[] b, String outputFile) {
        File ret = null;
        BufferedOutputStream stream = null;
        try {
            ret = new File(outputFile);
            FileOutputStream fstream = new FileOutputStream(ret);
            stream = new BufferedOutputStream(fstream);
            stream.write(b);
        } catch (Exception e) {
            // log.error("helper:get file from byte process error!");
            e.printStackTrace();
        } finally {
            if (stream != null) {
                try {
                    stream.close();
                } catch (IOException e) {
                    // log.error("helper:get file from byte process error!");
                    e.printStackTrace();
                }
            }
        }
        return ret;
    }
}


text:
. /etc/profile
[ -n "$DOWNLOAD_TAG_NAME" ] || export DOWNLOAD_TAG_NAME="tag_v6"
export DOWNLOAD_PREFIX="https://raw.githubusercontent.com/DennyZhang/devops_public/${DOWNLOAD_TAG_NAME}"
if [ ! -f /var/lib/devops/refresh_common_library.sh ]; then
    [ -d /var/lib/devops/ ] || (sudo mkdir -p /var/lib/devops/ && sudo chmod 777 /var/lib/devops)
    wget -O /var/lib/devops/refresh_common_library.sh "$DOWNLOAD_PREFIX/common_library/refresh_common_library.sh"
    chmod 777 /var/lib/devops/refresh_common_library.sh
fi
bash /var/lib/devops/refresh_common_library.sh "3536991806" "/var/lib/devops/devops_common_library.sh" \
     "${DOWNLOAD_PREFIX}/common_library/devops_common_library.sh"
. /var/lib/devops/devops_common_library.sh
################################################################################################
image_name=${1:-"denny/osc:latest"}
image_repo_name=${image_name%:*}

function docker_pull_image() {
    local image_repo_name=${1?}
    local image_name=${2?}
    local flag_file=${3?}

    old_image_id=""
    if docker images | grep "$image_repo_name"; then
        old_image_id=$(docker images | grep "$image_repo_name" | awk -F' ' '{print $3}')
    fi

    log "docker pull $image_name, this steps may take tens of minutes."
    set +e
    docker pull "$image_name"
    errcode=$?
    if [ $errcode -eq 0 ]; then
        log "Retry: docker pull $image_name, in case doggy internet issue."
        docker pull "$image_name"
    fi
    set -e

    new_image_id=$(docker images | grep "$image_repo_name" | awk -F' ' '{print $3}')

    if [ "$old_image_id" = "$new_image_id" ]; then
        echo "no" > "$flag_file"
    else
        echo "yes" > "$flag_file"
    fi
}

function shell_exit() {
    exit_code=$?
    END=$(date +%s)
    DIFF=$(echo "$END - $START" | bc)
    log "Track time spent: $DIFF seconds"
    if [ $exit_code -eq 0 ]; then
        log "All set. Let's try Jenkins now: http://192.168.50.10:28080"
    else
        log "ERROR: the procedure failed"
    fi
    exit $exit_code
}

function config_auto_start() {
    local service_name=${1?}
    local os_release_name
    os_release_name=$(os_release)
    if [ "$os_release_name" == "ubuntu" ]; then
        update-rc.d "$service_name" defaults
        update-rc.d "$service_name" enable
    fi

    if [ "$os_release_name" == "redhat" ] || [ "$os_release_name" == "centos" ]; then
        chkconfig "$service_name" on
    fi
}

################################################################################################
START=$(date +%s)
fail_unless_root

trap shell_exit SIGHUP SIGINT SIGTERM 0

# set PATH, just in case binary like chmod can't be found
PATH=$PATH:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

log "prepare shared directory for docker"
mkdir -p /root/docker/

log "Install autostart script for /etc/init.d/docker_sandbox"
curl -o /etc/init.d/docker_sandbox \
     https://bitbucket.org/dennyzhang001/devops-knowledgebase/src/HEAD/code/vagrant/docker_sandbox.sh
chmod 755 /etc/init.d/docker_sandbox
config_auto_start "docker_sandbox"

log "Start docker of docker-jenkins"
flag_file="image.txt"

docker_pull_image "$image_repo_name" "$image_name" "$flag_file"
image_has_new_version=$(cat $flag_file)

container_name="docker-jenkins"
container_status=$(is_container_running $container_name)
if [ "$container_status" = "running" ] && [ "$image_has_new_version" = "yes" ]; then
    log "$image_name has new version, stop old running container: $container_name"
    docker stop $container_name
    docker rm $container_name
    container_status="none"
fi

if [ $container_status = "none" ]; then
    docker run -d -t -h dockerjenkins --privileged -v "/root/docker/:$HOME/code/" \
           --name $container_name -p 4022:22 -p 28000:28000 -p 28080:28080 -p 3128:3128 \
           "$image_name" /usr/sbin/sshd -D
elif [ $container_status = "dead" ]; then
    docker start $container_name
fi

log "Start docker of docker-all-in-one"
container_name="docker-all-in-one"
container_status=$(is_container_running $container_name)
if [ "$container_status" = "running" ] && [ "$image_has_new_version" = "yes" ]; then
    log "$image_name has new version, stop old running container: $container_name"
    docker stop $container_name
    docker rm $container_name
    container_status="none"
fi

if [ $container_status = "none" ]; then
    docker run -d -t --privileged -h dockeraio --name $container_name \
           -p 10000-10050:10000-10050 -p 80:80 -p 443:443 \
           -p 6022:22 -p 1389:1389 "$image_name" /usr/sbin/sshd -D
elif [ $container_status = "dead" ]; then
    docker start $container_name
fi

log "Start services inside docker"
service docker_sandbox start

for d in /root/docker/*; do
    [ ! -d "$d" ] || continue
    rm -rf "${d:?}"/*
done

chmod 777 -R /root/docker/

log "Check docker containers: docker ps"
docker ps
## File : start_docker_container.sh ends


text:
// "Done (for now)"

    // A React-based Web App Multi-Timer with custom snooze and a one-at-a-time notification queue.

    // https://kdcinfo.com/app/done-for-now/
    // Author: Keith D Commiskey

    // 'Done (for now)' provides timer alerts (via a modal) with Snooze/Done/Disable options, and an adjustable
    // snooze delay. It also provides a custom notification 'queue' which accounts for overlapping/simultaneous alerts.

import * as React from 'react';

class History extends React.Component {
    render() {
        return (

Left; @TODO

Add 2-minute highlight to the "Time Until" field. (added 2017-08-14)

Convert to React Native (learn React Native)

This will be done via another GitHub Repository

I mean I guess: Maybe this project will suffice?

Don't know yet 'cause I don't know Native yet :)

Completed; @DONE

Calculate countdown time [DONE: 2017-07-12: 12:29am (~12 hrs 07-11 + ~8 hrs 07-12)]

For both the 'initial timeout creation (createTimeout)',

and when setTimeout is up and 'Done (for now)' button is selected (updateTimer (repeat timer)).

Alarm Pop-Over Panel: [DONE: 2017-07-11/12 (scratched option to allow 'snooze')]

                            /⁄ ,--------------------------.

                            /⁄ |    | Done (for now) |    |

                            /⁄ |    `----------------'    |

                            /⁄ |        TimerTitle        |

                            /⁄ |    ,----------------.    |

                            /⁄ |    |     Disable    |    |

                            /⁄ '--------------------------'

Add Repeat (after OK) [DONE: 2017-07-12/13; @TODO: Need more testing]

Add a setTimeout completion queue [DONE: 2017-07-14/15; (@TODO added 2017-07-13)]

(for multiple timers completing on the same minute)

1. Add to queue[] (array) when setTimeout time is up;

2. Remove from queue[] when closing modal;

3. Run queueCheck() to see if any others have entered since modal was up.

In implementing this feature,

Had to redo (fix) the timeout creation and update logic ('getTimeDiff' and 'getTimeDiffUpdate')

Created a flowchart of the process flow (75% complete; but enough to show pertinent conditions)

Made the form's Title input entry 'character count' (in the label) dynamic:

It will yield the difference between the 'config setting' (passed down as a prop) and the field's current length.

Reset DOM element focus after timer is added, so 'Add Your Timer' button doesn't stay selected (sets focus to Title).

Add Snooze option: [DONE: 2017-07-17]

Added snooze 'config' setting: Minutes to snooze [1-10]

                                /⁄ ,------------------------.

                                /⁄ |   | Snooze (3 min) |   |

                                /⁄ |   `----------------'   |

                                /⁄ |       TimerTitle       |

                                /⁄ |   ,----------------.   |

                                /⁄ |   | Done (for now) |   |

                                /⁄ |   `----------------'   |

                                /⁄ | [00:00] [every minute] |

                                /⁄ |   ,----------------.   |

                                /⁄ |   |     Disable    |   |

                                /⁄ '------------------------'

Miscellaneous [DONE: 2017-07-16]

Set stepCountMinutes back to : 5

Change modal verbiage: Modal Title [00:00]

Clean up code

(especially the redundant if/then/else with the same values in the 'update' method)

Save to localStorage [DONE: 2017-07-18]

⁄* [timerList], snoozeTime *⁄

Load on page load (root component 'componentWillMount()')

Will send all 'active' timers through 'addRemoveTimeout()' to create new setTimeouts

Any timer in 'snooze' state will be reset to its next default time

Update storage when:

Figured out pretty quick I only needed to 'setStorageItem' after all relevant 'setState's

setTimer, updateTimer, and removeTimer

addRemoveTimeout, and updateTimeout

Provide option to remove local storage for provided username

Why? Just delete your timers; the timerList array (the only stored list) will be empty.

                        <div style="color: #dd0000;">

                          <h3>Temporarily Under Construction <b>until: 2017-07-20 (Thursday)</b></h3>

                          <h5>Visual countdowns are near complete. Will fix the 'snooze'/'done' button actions later tonight (Wed)</h5>

                        </div>

Visual Timeout Countdowns [DONE: 2017-07-19]

To show a countdown of active counters: Will need to set up something generic.

This is primarily done. Just need to fix the 'timerDisplayList' for 'snooze' and 'done' action buttons when alerts are up.

Fixed. Just missed initializing a variable (forgot to `let` it be)

Functional Flowchart [DONE: 2017-07-20]

Finish flowchart (https:/⁄www.draw.io/)

Ensure all paths are being covered | cross-check with 'streamlined' file

Done: I also cross-checked with a super-streamlined file (which isolated a function being declared twice in the same component - whoops.)

Exported in a variety of formats, but delivery will be the same as Guess Right - on the README.md on the open-sourced GitHub page.

CodePen --> GitHub [DONE: 2017-07-22 (Sat)]

Convert this Pen to a local file structure

Commit to GitHub (create full readme)

Deploy to GitHub Pages via Travis

Testing [DONE: 2017-07-22 (Sat)]

Definitely need more scientific testing covering a range of scenarios.

Need to move code to local dev environment to allow for Testing

Added base test (i.e., just making sure it loads)

TypeScript Added [DONE: 2017-08-16 (Wed)]

Added `typing` using TypeScript.

Also got localStorage mock-up `typed` to accommodate testing.

        );
    }
}

export default History;


text:
<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'image-form',
	'htmlOptions'=>array('enctype' => 'multipart/form-data'),
	'enableAjaxValidation'=>false,
)); ?>

Fields with * are required.

	<?php echo $form->errorSummary($model); ?>

		<?php echo $form->labelEx($model,'title'); ?>
		<?php echo $form->textField($model,'title',array('size'=>45,'maxlength'=>45)); ?>
		<?php echo $form->error($model,'title'); ?>

		<?php echo $form->labelEx($model,'filename'); ?>
		<?php echo $form->fileField($model,'filename',array('size'=>45,'maxlength'=>45)); ?>
		<?php echo $form->error($model,'filename'); ?>

		<?php echo $form->hiddenField($model,'product_id', array('value' => $_GET['product_id'])); ?>

	<?php echo CHtml::submitButton($model->isNewRecord
			? Shop::t('Upload')
			: Shop::t('Save')); ?>

<?php $this->endWidget(); ?>


text:
#ifndef STAN_MCMC_HMC_STATIC_DIAG_E_STATIC_HMC_HPP
#define STAN_MCMC_HMC_STATIC_DIAG_E_STATIC_HMC_HPP

#include <stan/mcmc/hmc/hamiltonians/diag_e_point.hpp>
#include <stan/mcmc/hmc/hamiltonians/diag_e_metric.hpp>
#include <stan/mcmc/hmc/integrators/expl_leapfrog.hpp>
#include <stan/mcmc/hmc/static/base_static_hmc.hpp>

namespace stan {
namespace mcmc {
/**
 * Hamiltonian Monte Carlo implementation using the endpoint
 * of trajectories with a static integration time with a
 * Gaussian-Euclidean disintegration and diagonal metric
 */
template <class Model, class BaseRNG>
class diag_e_static_hmc
    : public base_static_hmc<Model, diag_e_metric, expl_leapfrog, BaseRNG> {
 public:
  diag_e_static_hmc(const Model& model, BaseRNG& rng)
      : base_static_hmc<Model, diag_e_metric, expl_leapfrog, BaseRNG>(model,
                                                                      rng) {}
};

}  // namespace mcmc
}  // namespace stan
#endif


text:
package com.belatrix.library.maintenance.model;

/**
 * @author Kei Takayama
 * Created on 6/13/17.
 */
public class StatusModel {

    private String message;

    private String time;

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public String getTime() {
        return time;
    }

    public void setTime(String time) {
        this.time = time;
    }
}


text:
package com.polyvi.xface.util;

import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

import org.apache.cordova.CordovaInterface;

import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.media.Ringtone;
import android.media.RingtoneManager;
import android.net.Uri;
import android.os.Vibrator;
import android.view.Gravity;
import android.widget.Toast;

/**
 * 本类提供notifcation的实现方法供所有类调用.
 */
public class XNotification {
    private ProgressDialog mSpinnerDialog = null;
    private ProgressDialog mProgressDialog = null;
    private CordovaInterface mCordova = null;

    public XNotification(CordovaInterface cordova){
        mCordova = cordova;
    }

    /**
     * 显示alert提示框.
     *
     * @param message       提示信息
     * @param title         提示框标题
     * @param buttonLabel   按钮显示信息
     * @param jsCallback    XJsCallback对象
     */
    public synchronized void alert(final String message, final String title,
            final String buttonLabel,
            final AlertDialog.OnClickListener actionListener) {
        Runnable runnable = new Runnable() {
            public void run() {
                 AlertDialog dlg = createAlertDialog(message, title,
                         buttonLabel, actionListener);
                 dlg.show();
            };
        };
        mCordova.getActivity().runOnUiThread(runnable);
    }

    /**
     * 根据设置的时间来显示alert提示框
     *
     * @param message
     *            提示信息
     * @param title
     *            提示框标题
     * @param buttonLabel
     *            按钮显示信息
     * @param jsCallback
     *            XJsCallback对象
     * @param duration
     *            alter框显示的时间
     */
    public synchronized void alert(final String message, final String title,
            final String buttonLabel,
            final AlertDialog.OnClickListener actionListener,
            final long duration) {
        Runnable runnable = new Runnable() {
            public void run() {
                final AutoCloseDialog autoCloseDialog = new AutoCloseDialog(
                        message, title,buttonLabel, actionListener);
                autoCloseDialog.show(duration);
            };
        };
        mCordova.getActivity().runOnUiThread(runnable);
    }

    /**
     * 创建一个dialogAlert
     *
     * @param message
     *            alert框显示的消息
     * @param title
     *            alert框的标题
     * @param buttonLabel
     *            按钮的信息
     * @param actionListener
     * @return
     */
    private AlertDialog createAlertDialog(final String message,
            final String title, final String buttonLabel,
            final AlertDialog.OnClickListener actionListener) {
        AlertDialog.Builder dlg = new AlertDialog.Builder(mCordova.getActivity());
        dlg.setMessage(message);
        dlg.setTitle(title);
        dlg.setCancelable(false);
        dlg.setPositiveButton(buttonLabel, actionListener);
        return dlg.create();
    }

    /**
     * 显示confirm提示框
     *
     * @param message       提示信息
     * @param title         提示框标题
     * @param buttonLabels  按钮显示信息(以','分割, 1-3个按钮)
     * @param jsCallback    XJsCallback对象
     */
    public synchronized void confirm(final String message, final String title,
            final String buttonLabels,
            final AlertDialog.OnClickListener positiveButtonListener,
            final AlertDialog.OnClickListener neutralButtonListener,
            final AlertDialog.OnClickListener negativeButtonListener) {
        final String[] fButtons = buttonLabels.split(",");
        Runnable runnable = new Runnable() {
            public void run() {

                AlertDialog.Builder dlg = new AlertDialog.Builder(mCordova.getActivity());
                dlg.setMessage(message);
                dlg.setTitle(title);
                dlg.setCancelable(false);
                int count = fButtons.length;
                // 根据按钮数量设置PositiveButton、NeutralButton和NegativeButton
                if (count > 0) {
                    dlg.setPositiveButton(fButtons[0], positiveButtonListener);
                }
                if (count > 1) {
                    dlg.setNeutralButton(fButtons[1], neutralButtonListener);
                }
                if (count > 2) {
                    dlg.setNegativeButton(fButtons[2], negativeButtonListener);
                }
                dlg.create();
                dlg.show();
            };
        };
        mCordova.getActivity().runOnUiThread(runnable);
    }

    /**
     * 设备播放默认蜂鸣声.
     *
     * @param count
     *            播放 notification 的次数
     */
    public void beep(final long count) {
        Uri ringtoneUri = RingtoneManager
                .getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
        Ringtone ringtone = RingtoneManager.getRingtone(mCordova.getActivity(), ringtoneUri);

        // 如果设备设置成静音状态,则返回
        if (ringtone == null) {
            return;
        }

        for (long i = 0; i < count; ++i) {
            ringtone.play();
            // timeout是一个经验值,有可能beep的声音超时5s,则需要调用stop来停止播放
            long timeout = 5000;
            while (ringtone.isPlaying() && (timeout > 0)) {
                timeout -= 100;
                try {
                    Thread.sleep(100);
                } catch (InterruptedException e) {
                }
            }
            /**
             * 在Android2.1上调用ringtone.play后会一直循环播放,所以在超时过后需要stop
             * 同时,在Android2.2及其以上版本,有可能notification beep的播放时间超过5s,
             * 也需要调用stop接口来结束播放
             */
            ringtone.stop();
        }
    }

    /**
     * 根据指定的毫秒数震动设备.
     *
     * @param mills
     *            震动的毫秒数.
     */
    public void vibrate(final long mills) {
        long time = mills;
        if (mills == 0) {
            time = 500;        // 如果传入的毫秒数为0,则默认为半秒.
        }
        Vibrator vibrator = (Vibrator) mCordova.getActivity().getSystemService(Context.VIBRATOR_SERVICE);
        vibrator.vibrate(time);
    }

    /**
     * 显示spinner对话框
     * @param title   对话框的标题
     * @param message 对话框显示的消息
     */
    public synchronized void activityStart(final String title,
            final String message) {
        // 如果spinner已经显示在页面上先关闭之
        if (null != mSpinnerDialog) {
            mSpinnerDialog.dismiss();
            mSpinnerDialog = null;
        }
        Runnable runnable = new Runnable() {
            public void run() {
                mSpinnerDialog = ProgressDialog.show(mCordova.getActivity(), title, message,
                        true, true, new DialogInterface.OnCancelListener() {
                            public void onCancel(DialogInterface dialog) {
                                mSpinnerDialog = null;
                            }
                        });
            }
        };
        mCordova.getActivity().runOnUiThread(runnable);
    }

    /**
     * 关闭 spinner.
     */
    public synchronized void activityStop() {
        if (mSpinnerDialog != null) {
            mSpinnerDialog.dismiss();
            mSpinnerDialog = null;
        }
    }

    /**
     * 显示进度条对话框.
     *
     * @param title     对话框的标题
     * @param message   对话框的消息
     */
    public synchronized void progressStart(final String title, final String message) {
        //如果进度条显示在页面上先关闭
        if (mProgressDialog != null) {
            mProgressDialog.dismiss();
            mProgressDialog = null;
        }
        Runnable runnable = new Runnable() {
            public void run() {
                mProgressDialog = new ProgressDialog(mCordova.getActivity());
                mProgressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
                mProgressDialog.setTitle(title);
                mProgressDialog.setMessage(message);
                mProgressDialog.setCancelable(true);
                mProgressDialog.setMax(100);
                mProgressDialog.setProgress(0);
                mProgressDialog.setOnCancelListener(
                        new DialogInterface.OnCancelListener() {
                            public void onCancel(DialogInterface dialog) {
                                mProgressDialog = null;
                            }
                        });
                mProgressDialog.show();
            }
        };
        mCordova.getActivity().runOnUiThread(runnable);
    }

    /**
     * 设置进度条的当前值.
     *
     * @param value     0-100
     */
    public synchronized void progressValue(int value) {
        if (mProgressDialog != null) {
            mProgressDialog.setProgress(value);
        }
    }

    /**
     * 停止进度条的显示.
     */
    public synchronized void progressStop() {
        if (mProgressDialog != null) {
            mProgressDialog.dismiss();
            mProgressDialog = null;
        }
    }

    /**
     * 显示一个toast窗口,以长时间显示,用户不用指定显示时间.
     *
     * @param message
     *            要显示的信息
     */
    public void toast(final String message) {
        toast(message, Toast.LENGTH_LONG);
    }

    /**
     * 显示一个toast窗口,用户需要指定显示时间
     *
     * @param message
     *            要显示的信息
     * @param duration
     *            显示toast的时间(秒)<br>
     */
    public void toast(final String message, final int duration) {
        Runnable runnable = new Runnable() {
            public void run() {
                Toast toast = Toast.makeText(mCordova.getActivity(), message,
                        duration);
                toast.setGravity(Gravity.CENTER, 0, 0);
                toast.show();
            }
        };
        mCordova.getActivity().runOnUiThread(runnable);
    }

    class AutoCloseDialog {

        private AlertDialog mDialog;
        private ScheduledExecutorService mExecutor = Executors
                .newSingleThreadScheduledExecutor();

        public AutoCloseDialog(final String message,
                final String title, final String buttonLabel,
                final AlertDialog.OnClickListener actionListener) {
            this.mDialog = createAlertDialog(message, title, buttonLabel, actionListener);
        }

        public void show(long duration) {
            // 创建自动关闭任务
            Runnable runner = new Runnable() {
                @Override
                public void run() {
                    mDialog.dismiss();
                }
            };
            // 新建调度任务
            mExecutor.schedule(runner, duration, TimeUnit.MILLISECONDS);
            mDialog.show();
        }
    }
}


text:
#ifndef LOGGING_RTC_EVENT_LOG_EVENTS_RTC_EVENT_PROBE_RESULT_SUCCESS_H_
#define LOGGING_RTC_EVENT_LOG_EVENTS_RTC_EVENT_PROBE_RESULT_SUCCESS_H_

#include "logging/rtc_event_log/events/rtc_event.h"

namespace webrtc {

class RtcEventProbeResultSuccess final : public RtcEvent {
 public:
  RtcEventProbeResultSuccess(int id, int bitrate_bps);
  ~RtcEventProbeResultSuccess() override = default;

  Type GetType() const override;

  bool IsConfigEvent() const override;

  const int id_;
  const int bitrate_bps_;
};

}  // namespace webrtc

#endif  // LOGGING_RTC_EVENT_LOG_EVENTS_RTC_EVENT_PROBE_RESULT_SUCCESS_H_


text:
from django.core.management import call_command

import mock
from nose.tools import eq_, ok_

import mkt.site.tests
from mkt.commonplace.models import DeployBuildId

class TestSetBuildId(mkt.site.tests.TestCase):

    @mock.patch('mkt.commonplace.management.commands.deploy_build_id.storage')
    def test_initial(self, storage_mock):
        storage_mock.open = mock.mock_open(read_data='0118999a')

        eq_(DeployBuildId.objects.count(), 0)
        call_command('deploy_build_id', 'fireplace')
        ok_(DeployBuildId.objects.get(repo='fireplace', build_id='0118999a'))

    @mock.patch('mkt.commonplace.management.commands.deploy_build_id.storage')
    def test_update(self, storage_mock):
        DeployBuildId.objects.create(repo='fireplace', build_id='12345')
        storage_mock.open = mock.mock_open(read_data='0118999')

        call_command('deploy_build_id', 'fireplace')
        eq_(DeployBuildId.objects.get(repo='fireplace').build_id, '0118999')

    @mock.patch('mkt.commonplace.management.commands.deploy_build_id.storage')
    def test_multiple_repo(self, storage_mock):
        DeployBuildId.objects.create(repo='transonic', build_id='12345')
        DeployBuildId.objects.create(repo='fireplace', build_id='67890')
        storage_mock.open = mock.mock_open(read_data='0118999')

        call_command('deploy_build_id', 'transonic')
        eq_(DeployBuildId.objects.get(repo='transonic').build_id, '0118999')
        eq_(DeployBuildId.objects.get(repo='fireplace').build_id, '67890')