text:
#if FEATURE_CORE_DLR
using System.Linq.Expressions;
#else
using Microsoft.Scripting.Ast;
#endif

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Dynamic;
using Microsoft.Scripting.Generation;
using Microsoft.Scripting.Runtime;
using Microsoft.Scripting.Utils;
using Microsoft.Scripting.Actions.Calls;
using AstUtils = Microsoft.Scripting.Ast.Utils;

namespace Microsoft.Scripting.Actions {
    using Ast = Expression;

    public partial class DefaultBinder : ActionBinder {
        // TODO: Rename Call to Invoke, obsolete Call
        // TODO: Invoke overloads should also take CallInfo objects to simplify use for languages which don't need CallSignature features.

        /// <summary>
        /// Provides default binding for performing a call on the specified meta objects.
        /// </summary>
        /// <param name="signature">The signature describing the call</param>
        /// <param name="target">The meta object to be called.</param>
        /// <param name="args">
        /// Additional meta objects are the parameters for the call as specified by the CallSignature in the CallAction.
        /// </param>
        /// <returns>A MetaObject representing the call or the error.</returns>
        public DynamicMetaObject Call(CallSignature signature, DynamicMetaObject target, params DynamicMetaObject[] args) {
            return Call(signature, new DefaultOverloadResolverFactory(this), target, args);
        }

        /// <summary>
        /// Provides default binding for performing a call on the specified meta objects.
        /// </summary>
        /// <param name="signature">The signature describing the call</param>
        /// <param name="target">The meta object to be called.</param>
        /// <param name="args">
        /// Additional meta objects are the parameters for the call as specified by the CallSignature in the CallAction.
        /// </param>
        /// <param name="resolverFactory">Overload resolver factory.</param>
        /// <returns>A MetaObject representing the call or the error.</returns>
        public DynamicMetaObject Call(CallSignature signature, OverloadResolverFactory resolverFactory, DynamicMetaObject target, params DynamicMetaObject[] args) {
            return Call(signature, null, resolverFactory, target, args);
        }

        /// <summary>
        /// Provides default binding for performing a call on the specified meta objects.
        /// </summary>
        /// <param name="signature">The signature describing the call</param>
        /// <param name="target">The meta object to be called.</param>
        /// <param name="args">
        /// Additional meta objects are the parameters for the call as specified by the CallSignature in the CallAction.
        /// </param>
        /// <param name="resolverFactory">Overload resolver factory.</param>
        /// <param name="errorSuggestion">The result should the object be uncallable.</param>
        /// <returns>A MetaObject representing the call or the error.</returns>
        public DynamicMetaObject Call(CallSignature signature, DynamicMetaObject errorSuggestion, OverloadResolverFactory resolverFactory, DynamicMetaObject target, params DynamicMetaObject[] args) {
            ContractUtils.RequiresNotNullItems(args, "args");
            ContractUtils.RequiresNotNull(resolverFactory, "resolverFactory");

            TargetInfo targetInfo = GetTargetInfo(target, args);

            if (targetInfo != null) {
                // we're calling a well-known MethodBase
                DynamicMetaObject res = MakeMetaMethodCall(signature, resolverFactory, targetInfo);
                if (res.Expression.Type.IsValueType()) {
                    res = new DynamicMetaObject(
                        AstUtils.Convert(res.Expression, typeof(object)),
                        res.Restrictions
                    );
                }

                return res;
            } else {
                // we can't call this object
                return errorSuggestion ?? MakeCannotCallRule(target, target.GetLimitType());
            }
        }

        #region Method Call Rule

        private DynamicMetaObject MakeMetaMethodCall(CallSignature signature, OverloadResolverFactory resolverFactory, TargetInfo targetInfo) {
            BindingRestrictions restrictions = BindingRestrictions.Combine(targetInfo.Arguments).Merge(targetInfo.Restrictions);
            if (targetInfo.Instance != null) {
                restrictions = targetInfo.Instance.Restrictions.Merge(restrictions);
            }

            DynamicMetaObject[] args;
            CallTypes callType;
            if (targetInfo.Instance != null) {
                args = ArrayUtils.Insert(targetInfo.Instance, targetInfo.Arguments);
                callType = CallTypes.ImplicitInstance;
            } else {
                args = targetInfo.Arguments;
                callType = CallTypes.None;
            }

            return CallMethod(resolverFactory.CreateOverloadResolver(args, signature, callType), targetInfo.Targets, restrictions);
        }

        #endregion

        #region Target acquisition

        /// <summary>
        /// Gets a TargetInfo object for performing a call on this object.
        ///
        /// If this object is a delegate we bind to the Invoke method.
        /// If this object is a MemberGroup or MethodGroup we bind to the methods in the member group.
        /// If this object is a BoundMemberTracker we bind to the methods with the bound instance.
        /// If the underlying type has defined an operator Call method we'll bind to that method.
        /// </summary>
        private TargetInfo GetTargetInfo(DynamicMetaObject target, DynamicMetaObject[] args) {
            Debug.Assert(target.HasValue);
            object objTarget = target.Value;

            return
                TryGetDelegateTargets(target, args, objTarget as Delegate) ??
                TryGetMemberGroupTargets(target, args, objTarget as MemberGroup) ??
                TryGetMethodGroupTargets(target, args, objTarget as MethodGroup) ??
                TryGetBoundMemberTargets(target, args, objTarget as BoundMemberTracker) ??
                TryGetOperatorTargets(target, args, target);
        }

        /// <summary>
        /// Binds to the methods in a method group.
        /// </summary>
        private static TargetInfo TryGetMethodGroupTargets(DynamicMetaObject target, DynamicMetaObject[] args, MethodGroup mthgrp) {
            if (mthgrp != null) {
                List<MethodBase> foundTargets = new List<MethodBase>();

                foreach (MethodTracker mt in mthgrp.Methods) {
                    foundTargets.Add(mt.Method);
                }

                return new TargetInfo(null, ArrayUtils.Insert(target, args), BindingRestrictions.GetInstanceRestriction(target.Expression, mthgrp), foundTargets.ToArray());
            }
            return null;
        }

        /// <summary>
        /// Binds to the methods in a member group.
        ///
        /// TODO: We should really only have either MemberGroup or MethodGroup, not both.
        /// </summary>
        private static TargetInfo TryGetMemberGroupTargets(DynamicMetaObject target, DynamicMetaObject[] args, MemberGroup mg) {
            if (mg != null) {
                MethodBase[] targets;
                List<MethodInfo> foundTargets = new List<MethodInfo>();
                foreach (MemberTracker mt in mg) {
                    if (mt.MemberType == TrackerTypes.Method) {
                        foundTargets.Add(((MethodTracker)mt).Method);
                    }
                }
                targets = foundTargets.ToArray();
                return new TargetInfo(null, ArrayUtils.Insert(target, args), targets);
            }
            return null;
        }

        /// <summary>
        /// Binds to the BoundMemberTracker and uses the instance in the tracker and restricts
        /// based upon the object instance type.
        /// </summary>
        private TargetInfo TryGetBoundMemberTargets(DynamicMetaObject self, DynamicMetaObject[] args, BoundMemberTracker bmt) {
            if (bmt != null) {
                Debug.Assert(bmt.Instance == null); // should be null for trackers that leak to user code

                MethodBase[] targets;

                // instance is pulled from the BoundMemberTracker and restricted to the correct
                // type.
                DynamicMetaObject instance = new DynamicMetaObject(
                    AstUtils.Convert(
                        Ast.Property(
                            Ast.Convert(self.Expression, typeof(BoundMemberTracker)),
                            typeof(BoundMemberTracker).GetDeclaredProperty("ObjectInstance")
                        ),
                        bmt.BoundTo.DeclaringType
                    ),
                    self.Restrictions
                ).Restrict(CompilerHelpers.GetType(bmt.ObjectInstance));

                // we also add a restriction to make sure we're going to the same BoundMemberTracker
                BindingRestrictions restrictions = BindingRestrictions.GetExpressionRestriction(
                    Ast.Equal(
                        Ast.Property(
                            Ast.Convert(self.Expression, typeof(BoundMemberTracker)),
                            typeof(BoundMemberTracker).GetDeclaredProperty("BoundTo")
                        ),
                        AstUtils.Constant(bmt.BoundTo)
                    )
                );

                switch (bmt.BoundTo.MemberType) {
                    case TrackerTypes.MethodGroup:
                        targets = ((MethodGroup)bmt.BoundTo).GetMethodBases();
                        break;
                    case TrackerTypes.Method:
                        targets = new MethodBase[] { ((MethodTracker)bmt.BoundTo).Method };
                        break;
                    default:
                        throw new InvalidOperationException(); // nothing else binds yet
                }

                return new TargetInfo(instance, args, restrictions, targets);
            }
            return null;
        }

        /// <summary>
        /// Binds to the Invoke method on a delegate if this is a delegate type.
        /// </summary>
        private static TargetInfo TryGetDelegateTargets(DynamicMetaObject target, DynamicMetaObject[] args, Delegate d) {
            if (d != null) {
                return new TargetInfo(target, args, d.GetType().GetMethod("Invoke"));
            }
            return null;
        }

        /// <summary>
        /// Attempts to bind to an operator Call method.
        /// </summary>
        private TargetInfo TryGetOperatorTargets(DynamicMetaObject self, DynamicMetaObject[] args, object target) {
            Type targetType = CompilerHelpers.GetType(target);

            MemberGroup callMembers = GetMember(MemberRequestKind.Invoke, targetType, "Call");
            List<MethodBase> callTargets = new List<MethodBase>();
            foreach (MemberTracker mi in callMembers) {
                if (mi.MemberType == TrackerTypes.Method) {
                    MethodInfo method = ((MethodTracker)mi).Method;
                    if (method.IsSpecialName) {
                        callTargets.Add(method);
                    }
                }
            }

            if (callTargets.Count > 0) {
                return new TargetInfo(null, ArrayUtils.Insert(self, args), callTargets.ToArray());
            }

            return null;
        }

        #endregion

        #region Error support

        private DynamicMetaObject MakeCannotCallRule(DynamicMetaObject self, Type type) {
            return MakeError(
                ErrorInfo.FromException(
                    Ast.New(
                        typeof(ArgumentTypeException).GetConstructor(new Type[] { typeof(string) }),
                        AstUtils.Constant(GetTypeName(type) + " is not callable")
                    )
                ),
                self.Restrictions.Merge(BindingRestrictionsHelpers.GetRuntimeTypeRestriction(self.Expression, type)),
                typeof(object)
            );
        }

        #endregion

        /// <summary>
        /// Encapsulates information about the target of the call.  This includes an implicit instance for the call,
        /// the methods that we'll be calling as well as any restrictions required to perform the call.
        /// </summary>
        class TargetInfo {
            public readonly DynamicMetaObject Instance;
            public readonly DynamicMetaObject[] Arguments;
            public readonly MethodBase[] Targets;
            public readonly BindingRestrictions Restrictions;

            public TargetInfo(DynamicMetaObject instance, DynamicMetaObject[] arguments, params MethodBase[] args) :
                this(instance, arguments, BindingRestrictions.Empty, args) {
            }

            public TargetInfo(DynamicMetaObject instance, DynamicMetaObject[] arguments, BindingRestrictions restrictions, params MethodBase[] targets) {
                Assert.NotNullItems(targets);
                Assert.NotNull(restrictions);

                Instance = instance;
                Arguments = arguments;
                Targets = targets;
                Restrictions = restrictions;
            }
        }

    }
}


text:
"""
given PDF (such as a presentation slide) and export HTML
with images of each page and texts of each page
"""
import sys
import subprocess
import shutil
import os
import argparse

parser = argparse.ArgumentParser(description='Convert PDF to movie.')
parser.add_argument('pdfs', metavar='PDF', nargs='+',
                   help='target PDF files')
#parser.add_argument('--resolution', action='store', default='150x100',
#                   help='resolution(default 150x100, good for book)')
parser.add_argument('--resolution', action='store', default='40x40',
                    help='resolution(default 40x40, good for slide)')

args = parser.parse_args()

def output_images():
    shutil.rmtree('tmp', ignore_errors=True)
    os.makedirs('tmp')
    for i, target in enumerate(args.pdfs):
        print i, target
        shutil.copyfile(target, 'tmp.pdf')

        print 'extracting pages'
        subprocess.check_call(
            "gs -q -dBATCH -dNOPAUSE -sDEVICE=png16m".split()
            + ["-r" + args.resolution]
            + ["-sOutputFile=tmp/%03d_%%04d.png" % i]
            + ["tmp.pdf"],
        stdout=sys.stdout, stderr=sys.stderr)

def output_texts():
    subprocess.check_call(
        'pdf2txt.py -V -o tmp.txt tmp.pdf'.split(), stdout=sys.stdout, stderr=sys.stderr)

    data = file('tmp.txt').read().split('\x0c')
    return data

output_images()
data = output_texts()
fo = file('out.html', 'w')
fo.write('')
pages = 0
for f in sorted(os.listdir('tmp')):
    fo.write('
' % f)
    fo.write('

%s
' % data[pages])
    pages += 1
fo.close()

redpajama_set_name: RedPajamaGithub


text:
<?php

namespace Google\Service\Contentwarehouse;

class QualitySalientTermsDocData extends \Google\Collection
{
  protected $collection_key = 'signalData';
  /**
   * @var float
   */
  public $confidence;
  /**
   * @var float
   */
  public $headVolumeRatio;
  /**
   * @var string
   */
  public $language;
  protected $signalDataType = QualitySalientTermsSignalData::class;
  protected $signalDataDataType = 'array';
  /**
   * @var float
   */
  public $virtualVolume;

  /**
   * @param float
   */
  public function setConfidence($confidence)
  {
    $this->confidence = $confidence;
  }
  /**
   * @return float
   */
  public function getConfidence()
  {
    return $this->confidence;
  }
  /**
   * @param float
   */
  public function setHeadVolumeRatio($headVolumeRatio)
  {
    $this->headVolumeRatio = $headVolumeRatio;
  }
  /**
   * @return float
   */
  public function getHeadVolumeRatio()
  {
    return $this->headVolumeRatio;
  }
  /**
   * @param string
   */
  public function setLanguage($language)
  {
    $this->language = $language;
  }
  /**
   * @return string
   */
  public function getLanguage()
  {
    return $this->language;
  }
  /**
   * @param QualitySalientTermsSignalData[]
   */
  public function setSignalData($signalData)
  {
    $this->signalData = $signalData;
  }
  /**
   * @return QualitySalientTermsSignalData[]
   */
  public function getSignalData()
  {
    return $this->signalData;
  }
  /**
   * @param float
   */
  public function setVirtualVolume($virtualVolume)
  {
    $this->virtualVolume = $virtualVolume;
  }
  /**
   * @return float
   */
  public function getVirtualVolume()
  {
    return $this->virtualVolume;
  }
}

// Adding a class alias for backwards compatibility with the previous class name.
class_alias(QualitySalientTermsDocData::class, 'Google_Service_Contentwarehouse_QualitySalientTermsDocData');


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="Enrich your life today,. yesterday is history.tomorrow is mystery.">

    <title>EffectiveOC的学习-3 - Luo Xianming's Blog</title>

    <link rel="canonical" href="http://luoxianming.cn/2016/06/06/EffectiveOC3/">

    <link rel="stylesheet" href="http://luoxianming.cn/css/bootstrap.min.css">

    <link rel="stylesheet" href="http://luoxianming.cn/css/clean-blog.css">

    <link rel="stylesheet" href="http://luoxianming.cn/css/syntax.css">

    <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css" rel="stylesheet" type="text/css">
    <link href='//fonts.googleapis.com/css?family=Lora:400,700,400italic,700italic' rel='stylesheet' type='text/css'>
    <link href='//fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800' rel='stylesheet' type='text/css'>

            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
                Toggle navigation

            </button>
            主页

                    分类

                    归档

                    关于我

EffectiveOC的学习-3

这里是EffectiveOC的 第 13,14条

                    2016-06-06

                            | 阅读次

13. 使用Method Swizzling

在Objective-C中,类的方法列表中将selector的名称映射到相关的方法实现上,即这个方法列表中对应了方法名与函数指针的关系,使得 动态消息派发系统能够据此找到应该调用的方法.而这种函数指针,被叫做IMP,对于IMP的定义一般为:

id (*IMP)(id,SEL,...)

所以,OC中的类的函数,实际是以C的函数来实现的,而这个函数的第一个参数是id,一般为self,第二个参数为SEL,然后才是函数定义的参数.

在说具体实现Method swizzling之前,要了解几个runtime的函数 :

BOOL class_addMethod(Class cls, SEL name, IMP imp, const char *types) : 为类添加函数,可以override父类中的函数,但是不能替换已经存在的函数. 最后一个参数types是runtime中的type encoding类型. 返回值表示函数是否添加成功,如果当前类中已有要添加的函数名对应的函数,则添加失败.

IMP method_setImplementation( Method method, IMP imp) : 为类设置函数实现, method代表了函数的声明,而IMP来表示具体函数指针,也就是具体的函数实现. 返回值类型是一个IMP,表示设置之前的函数实现.

void method_exchangeImplementations( Method m1, Method m2) : 交换函数实现,一般的Method swizzling就是通过该方法来实现,这个方法实际上调用了执行了以下操作:

IMP imp1 = method_getImplementation(m1);
IMP imp2 = method_getImplementation(m2);
method_setImplementation(m1, imp2);
method_setImplementation(m2, imp1);

IMP class_replaceMethod(Class cls, SEL name, IMP imp, const char *types) : 这个函数如果从名字上理解其功能,会觉得就与method_exchangeImplementations很相似,但是两者不做相同的操作 , class_replaceMethod只更换一个函数的具体实现,而不是将两个函数的实现继续交行. class_replaceMethod , 如果指定的sel当前已经存在,则执行method_setImplementation,即将这个sel对应的函数的实现替换成对应的IMP;而如果指定的SEL当前类内没有具体实现,则执行class_addMethod ,添加一个新的函数.

了解了runtime中对于函数的操作后,很容易想到method swizzling的具体实现.

首先,我们要先添加一个方法到指定的类上,添加方法,我们有两种方式,一种通过category直接为指定的类添加指定的方法,这种情况一般是我们知道具体要为指定的类和指定的方法进行替换.一种方式是通过class_addMethod来动态添加函数,多用于我们不确定要为哪些类进行method swizzling的时候,一般使用imp_implementationWithBlock来将一个block转换为IMP指针,如下:

SEL swizzledSelector = NSSelectorFromString(@"Beacon_tableView:didSelectRowAtIndexPath:");
Method originMethod = class_getInstanceMethod([delegate class], @selector(tableView:didSelectRowAtIndexPath:));
        IMP swizzleIMP = imp_implementationWithBlock(^(id obj,UITableView *tableView,NSIndexPath *indexPath) {
            NSLog(@"click");
            [obj performSelector:swizzledSelector withObject:tableView withObject:indexPath];
        });
        BOOL didAddMethod = class_addMethod([delegate class], swizzledSelector, swizzleIMP, method_getTypeEncoding(originMethod));
        if (didAddMethod) {
            Method swizzleMethod = class_getInstanceMethod([delegate class], swizzledSelector);
            method_exchangeImplementations(originMethod,swizzleMethod);
        }

添加方法后,就可以使用method_exchangeImplementations来交换两个函数的实现了. 这里一般使用method_exchangeImplementations来交换一个类中两个函数的实现,而不是去通过class_replaceMethod来将一个函数单独的进行替换成我们想要的实现,原因是,很多时候我们还需要用到原函数的功能,所以要在类中保留原有函数的实现.

需要注意的一点,在上面代码中,我们在替换的函数实现中,调用了

[obj performSelector:swizzledSelector withObject:tableView withObject:indexPath];

而这个swizzledSelector是我们添加的函数的SEL,即Beacon_tableView:didSelectRowAtIndexPath:. 需要注意的就是,进行Method swizzling后, 所有的Beacon_tableView:didSelectRowAtIndexPath:都指向了替换前的函数tableView:didSelectRowAtIndexPath:的实现,而所有的tableView:didSelectRowAtIndexPath:的函数调用,实际上都是在调用添加的这个block的实现.

而Method swizzling的特点在于,可以通过替换方法来实现一个钩子,可以在不被人察觉的情况进行特别的功能. 一般用于用户行为的收集,如上述,通过Method swizzling,对所有的TableViewDeletage添加方法,以在点击事件发生时,截获并记录事件的发生.

Method swizzling是一个危险而又有用的工具,危险在于你不了解它,如果你理解了它的实现,了解需要注意的地方,那它就只是一个有用的工具,而不再危险了.

14.理解"类对象"的含义

要理解Objective-C对象的本质,类对象是一个指向某块内存地址的指针.一般用id表示,而id如此定义:

struct objc_object {
    Class isa;
};

typedef struct objc_object *id;

id是一个objc_object的结构体的指针,这个结构体只有一个Class对象. 也就表示了任何一个类的实例,在内存上地址的第一块,是一个isa指针,指向的是实现的类对象.而 Class对象是这样的定义的:

typedef struct objc_class *Class;

而这个objc_class具体定义如下:

struct objc_class {
    Class isa; // isa指针,指出类的类型
    Class super_class ; // 父类
    const char *name; // 类名
    long version ; // 版本信息,不重要
    long info ;
    long instance_size; // 类的实例变量的大小
    struct objc_ivar_list *ivars; // 成员变量数组
    struct objc_method_list **methodLists; // 方法数组
    struct objc_cache *cache; // 方法的缓存,提高方法调用速率
    struct objc_protocol_list *protocols; // 协议的数组.
}

通过这个定义,我们可以看到OC是如何使用C来实现一个类的. 其中需要重点讨论的是isa指针, 任何一个id对象都有一个isa指针,指向了对象的类,而这个类还有一个isa指针,这个指针指向了 另外一个类 metaClass,metaclass中放置了类对象本身所具有的元数据,即类方法定义在metaclass中. 所以一个对象的类 实际上由两个objc_class结构组成,一个objc_class存放了实例方法和实例变量,一个objc_class称为metaclass存放了类方法.结合继承的结构,如下图所示 :

类是单例的,即对于一个类,只有 一个类和一个metaclass.

NSObject协议(NSObject类并不是整个OC所有对象的积累)中有两个方法 与 类对象相关 :

// 检测对象是否是这个类或者派生类的实例
- (BOOL)isKindOfClass:(Class)aClass;
// 检测对象是否是这个类的实例.
- (BOOL)isMemberOfClass:(Class)aClass;

检测对象的类是否相同,也通过 :

if([objectA class] == [objectB class])

来进行判断.

                        ← Previous Post

                        Next Post →

Copyright © Luo Xianming's Blog 2017

                      本站访问次


text:
<?php

class dmAdminBreadCrumb
{
  protected
  $context,
  $i18n,
  $helper,
  $record;

  public function __construct(dmContext $context, dmI18n $i18n, dmHelper $helper)
  {
    $this->context  = $context;
    $this->i18n     = $i18n;
    $this->helper   = $helper;

    $this->initialize();
  }

  protected function initialize()
  {

  }

  public function connect()
  {
    $this->context->getEventDispatcher()->connect('admin.edit_object', array($this, 'listenToEditObjectEvent'));
  }

  public function listenToEditObjectEvent(sfEvent $event)
  {
    $this->setRecord($event['object']);
  }

  public function setRecord(dmDoctrineRecord $record)
  {
    $this->record = $record;
  }

  public function getLinks()
  {
    if ($this->context->isModuleAction('dmAdmin', 'index'))
    {
      return array();
    }

    $module = $this->record ? $this->record->getDmModule() : $this->context->getModuleManager()->getModuleBySfName(
      $this->context->getRequest()->getParameter('module')
    );

    $links = array();

    $links['home'] = array();

    if ($module)
    {
      $space = $module->getSpace();
      $type  = $space->getType();

      $links['module_type']   = array('type' => $type);
      $links['module_space']  = array('space' => $space);
      $links['module']        = array('module' => $module);

      if ($this->record)
      {
        $links['object'] = array('object' => $this->record);
      }
      elseif(($action = $this->context->getActionName()) !== 'index')
      {
        $links['action'] = array('action' => dmString::humanize('create' === $action ? 'new' : $action));
      }
    }

    /*
     * Allow listeners of dm.bread_crumb.filter_links event
     * to filter and modify the links list
     */
    return $this->context->getEventDispatcher()->filter(new sfEvent($this, 'dm.bread_crumb.filter_links'), $links)->getReturnValue();

  }

  public function renderHomeLink(array $options = array())
  {
    return $this->helper->link()
    ->text(_tag('span.s16block.s16_home_gray', ' '))
    ->title($this->i18n->__('Home'))->set('.home');
  }

  public function renderModuleTypeLink(array $options = array())
  {
    return $this->helper->link($this->context->getRouting()->getModuleTypeUrl($options['type']))
    ->text($this->i18n->__($options['type']->getPublicName()));
  }

  public function renderModuleSpaceLink(array $options = array())
  {
    return $this->helper->link($this->context->getRouting()->getModuleSpaceUrl($options['space']))
    ->text($this->i18n->__($options['space']->getPublicName()));
  }

  public function renderModuleLink(array $options = array())
  {
    return dmArray::get($options, 'last')
    ? $this->helper->tag('h1', $this->i18n->__($options['module']->getPlural()))
    : $this->helper->link('@'.$options['module']->getUnderscore())
    ->text($this->i18n->__($options['module']->getPlural()));
  }

  public function renderActionLink(array $options = array())
  {
    return $this->helper->tag('h1', __($options['action']));
  }

  public function renderObjectLink(array $options = array())
  {
    return dmArray::get($options, 'last')
    ? $this->helper->tag('h1', $options['object']->__toString())
    : $this->helper->link($options['object']);
  }

  public function renderRawLink($html)
  {
    return $html;
  }

  public function renderLinksArray(array $links)
  {
    $html = array();
    $nbLinks = count($links);

    $it = 0;

    foreach($links as $type => $options)
    {
      if (is_string($type))
      {
        $method = 'render'.dmString::camelize($type).'Link';

        if (++$it === $nbLinks)
        {
          $options['last'] = true;
        }

        $html[$type] = $this->$method($options);
      }
      else
      {
        $html[$type] = $options;
      }
    }

    return $html;
  }

  public function render()
  {
    $t = dmDebug::timerOrNull('dmAdminBreadCrumb::render');

    $links = $this->renderLinksArray($this->getLinks());

    if (empty($links))
    {
      $html = '';
    }
    else
    {
      $html =
      $this->helper->open('div#breadCrumb.mt10.clearfix').
      $this->helper->tag('ol', '
'.implode('

>

', $links).'
');

      if ($miniSearchForm = dmArray::get($this->context->getResponse()->getSlots(), 'dm.mini_search_form'))
      {
        $html .= $this->helper->tag('div.dm_mini_search_form', $miniSearchForm);
      }

      $html .= $this->helper->close('div');
    }

    $t && $t->addTime();

    return $html;
  }
}


text:
import React, { Component } from 'react';
import { Link } from "react-router";
import logo from './logo.svg';
import './App.css';

import Search from './components/Search';

class App extends Component {
  constructor(props) {
    super(props);

    this.state = {
      recalls: [],
      selectedRecall: null
    };
  }

  recallSearch(term) {
    this.props.router.push(`/recalls/${term}`);
  }

  render() {
    return (

          <Link
            to={{ pathname: `/` }} >

          </Link>

Food Recalls

        <Search onSearchTermChange={(term) => this.recallSearch(term)} term={this.props.params.recallType || ""} />
        {React.cloneElement(this.props.children, { ...this.props })}

    );
  }
}

export default App;


text:
from datetime import datetime
from optparse import make_option

from go.billing.models import Statement, Account
from go.billing.tasks import month_range, archive_transactions
from go.base.command_utils import BaseGoCommand, get_user_by_email

class Command(BaseGoCommand):
    help = (
        "Archive transactions for an account to S3 for the specified months.")

    option_list = BaseGoCommand.option_list + (
        make_option(
            '--email-address', dest='email_address',
            help="Email address of the account to archive transactions for."),
        make_option(
            '--month', dest='months', action='append',
            help="Month to generate statements for in the form YYYY-MM, "
            "e.g. 2014-01. Multiple may be specified."),
        make_option(
            '--delete', dest='delete', action="store_true", default=False,
            help=("Delete the transactions after uploading the archive."
                  " Default: FALSE.")),
        make_option(
            '--no-statement',
            dest='no_statement', action="store_true", default=False,
            help=("Allow transactions to be archived even if no equivalent "
                  "billing statement is found. Default: FALSE.")))

    def statement_exists(self, account, from_date, to_date):
        statements = Statement.objects.filter(
            account=account,
            from_date=from_date,
            to_date=to_date)

        return statements.exists()

    def missing_statement_months(self, account, months):
        return [
            m for m in months
            if not self.statement_exists(account, *month_range(0, m))]

    def archive_month_transactions(self, account, month, delete):
        from_date, to_date = month_range(0, month)

        self.stdout.write(
            "Archiving transactions that occured in %s..."
            % (datetime.strftime(month, '%Y-%m'),))

        archive = archive_transactions(
            account.id, from_date, to_date, delete=delete)

        self.stdout.write("Archived to S3 as %s." % (archive.filename,))
        self.stdout.write("Archive status is: %s." % (archive.status,))
        self.stdout.write("")

    def archive_transactions(self, account, months, delete):
        for month in months:
            self.archive_month_transactions(account, month, delete)

    def handle(self, *args, **opts):
        user = get_user_by_email(opts['email_address'])
        account_number = user.get_profile().user_account
        account = Account.objects.get(account_number=account_number)

        months = [datetime.strptime(m, '%Y-%m') for m in opts['months']]

        if opts['no_statement']:
            missing_months = []
        else:
            missing_months = self.missing_statement_months(account, months)

        if missing_months:
            self.stderr.write(
                "Aborting archiving, no statements found for the "
                "following months:")

            for m in missing_months:
                self.stderr.write(datetime.strftime(m, '%Y-%m'))
        else:
            self.stdout.write(
                "Archiving transactions for account %s..."
                % (opts['email_address'],))
            self.archive_transactions(account, months, opts['delete'])


text:
module Azure::Logic::Mgmt::V2016_06_01
  module Models
    #
    # The azure resource error info.
    #
    class AzureResourceErrorInfo < ErrorInfo

      include MsRestAzure

      # @return [String] The error message.
      attr_accessor :message

      # @return [Array<AzureResourceErrorInfo>] The error details.
      attr_accessor :details

      #
      # Mapper for AzureResourceErrorInfo class as Ruby Hash.
      # This will be used for serialization/deserialization.
      #
      def self.mapper()
        {
          client_side_validation: true,
          required: false,
          serialized_name: 'AzureResourceErrorInfo',
          type: {
            name: 'Composite',
            class_name: 'AzureResourceErrorInfo',
            model_properties: {
              code: {
                client_side_validation: true,
                required: true,
                serialized_name: 'code',
                type: {
                  name: 'String'
                }
              },
              message: {
                client_side_validation: true,
                required: true,
                serialized_name: 'message',
                type: {
                  name: 'String'
                }
              },
              details: {
                client_side_validation: true,
                required: false,
                serialized_name: 'details',
                type: {
                  name: 'Sequence',
                  element: {
                      client_side_validation: true,
                      required: false,
                      serialized_name: 'AzureResourceErrorInfoElementType',
                      type: {
                        name: 'Composite',
                        class_name: 'AzureResourceErrorInfo'
                      }
                  }
                }
              }
            }
          }
        }
      end
    end
  end
end


text:
package unfixedSwitch;

public class Envelope {
	public String inport;
	public String ipdst;
	public String ipsrc;
	public String action;
	public String priority;

	public String getIn_port() {
		return inport;
	}

	public void setInport(String inport) {
		this.inport = inport;
	}

	public String getIpdst() {
		return ipdst;
	}

	public void setIpdst(String ipdst) {
		this.ipdst = ipdst;
	}

	public String getIpsrc() {
		return ipsrc;
	}

	public void setIpsrc(String ipsrc) {
		this.ipsrc = ipsrc;
	}

	public String getAction() {
		return action;
	}

	public void setAction(String action) {
		this.action = action;
	}

	public String getPriority() {
		return priority;
	}

	public void setPriority(String priority) {
		this.priority = priority;
	}

}


text:
#pragma once
#include <aws/iottwinmaker/IoTTwinMaker_EXPORTS.h>
#include <aws/iottwinmaker/IoTTwinMakerRequest.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <utility>

namespace Aws
{
namespace IoTTwinMaker
{
namespace Model
{

  /**
   */
  class AWS_IOTTWINMAKER_API ListTagsForResourceRequest : public IoTTwinMakerRequest
  {
  public:
    ListTagsForResourceRequest();

    // Service request name is the Operation name which will send this request out,
    // each operation should has unique request name, so that we can get operation's name from this request.
    // Note: this is not true for response, multiple operations may have the same response name,
    // so we can not get operation's name from response.
    inline virtual const char* GetServiceRequestName() const override { return "ListTagsForResource"; }

    Aws::String SerializePayload() const override;

    /**
     *
The ARN of the resource.

     */
    inline const Aws::String& GetResourceARN() const{ return m_resourceARN; }

    /**
     *
The ARN of the resource.

     */
    inline bool ResourceARNHasBeenSet() const { return m_resourceARNHasBeenSet; }

    /**
     *
The ARN of the resource.

     */
    inline void SetResourceARN(const Aws::String& value) { m_resourceARNHasBeenSet = true; m_resourceARN = value; }

    /**
     *
The ARN of the resource.

     */
    inline void SetResourceARN(Aws::String&& value) { m_resourceARNHasBeenSet = true; m_resourceARN = std::move(value); }

    /**
     *
The ARN of the resource.

     */
    inline void SetResourceARN(const char* value) { m_resourceARNHasBeenSet = true; m_resourceARN.assign(value); }

    /**
     *
The ARN of the resource.

     */
    inline ListTagsForResourceRequest& WithResourceARN(const Aws::String& value) { SetResourceARN(value); return *this;}

    /**
     *
The ARN of the resource.

     */
    inline ListTagsForResourceRequest& WithResourceARN(Aws::String&& value) { SetResourceARN(std::move(value)); return *this;}

    /**
     *
The ARN of the resource.

     */
    inline ListTagsForResourceRequest& WithResourceARN(const char* value) { SetResourceARN(value); return *this;}

    /**
     *
The maximum number of results to return at one time. The default is 25.

     *
Valid Range: Minimum value of 1. Maximum value of 250.

     */
    inline int GetMaxResults() const{ return m_maxResults; }

    /**
     *
The maximum number of results to return at one time. The default is 25.

     *
Valid Range: Minimum value of 1. Maximum value of 250.

     */
    inline bool MaxResultsHasBeenSet() const { return m_maxResultsHasBeenSet; }

    /**
     *
The maximum number of results to return at one time. The default is 25.

     *
Valid Range: Minimum value of 1. Maximum value of 250.

     */
    inline void SetMaxResults(int value) { m_maxResultsHasBeenSet = true; m_maxResults = value; }

    /**
     *
The maximum number of results to return at one time. The default is 25.

     *
Valid Range: Minimum value of 1. Maximum value of 250.

     */
    inline ListTagsForResourceRequest& WithMaxResults(int value) { SetMaxResults(value); return *this;}

    /**
     *
The string that specifies the next page of results.

     */
    inline const Aws::String& GetNextToken() const{ return m_nextToken; }

    /**
     *
The string that specifies the next page of results.

     */
    inline bool NextTokenHasBeenSet() const { return m_nextTokenHasBeenSet; }

    /**
     *
The string that specifies the next page of results.

     */
    inline void SetNextToken(const Aws::String& value) { m_nextTokenHasBeenSet = true; m_nextToken = value; }

    /**
     *
The string that specifies the next page of results.

     */
    inline void SetNextToken(Aws::String&& value) { m_nextTokenHasBeenSet = true; m_nextToken = std::move(value); }

    /**
     *
The string that specifies the next page of results.

     */
    inline void SetNextToken(const char* value) { m_nextTokenHasBeenSet = true; m_nextToken.assign(value); }

    /**
     *
The string that specifies the next page of results.

     */
    inline ListTagsForResourceRequest& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;}

    /**
     *
The string that specifies the next page of results.

     */
    inline ListTagsForResourceRequest& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;}

    /**
     *
The string that specifies the next page of results.

     */
    inline ListTagsForResourceRequest& WithNextToken(const char* value) { SetNextToken(value); return *this;}

  private:

    Aws::String m_resourceARN;
    bool m_resourceARNHasBeenSet = false;

    int m_maxResults;
    bool m_maxResultsHasBeenSet = false;

    Aws::String m_nextToken;
    bool m_nextTokenHasBeenSet = false;
  };

} // namespace Model
} // namespace IoTTwinMaker
} // namespace Aws


text:
export { default } from './List';
export { default as listClasses } from './listClasses';
export * from './ListProps';


text:
IN_PROC_BROWSER_TEST_F(ExtensionApiTest,
                       ExtensionPointerLockAccessFail) {
  // Test that pointer lock cannot be accessed from an extension without
  // permission.
  ASSERT_TRUE(RunPlatformAppTest("pointer_lock/no_permission")) << message_;
}

// http://crbug.com/223447
#if defined(OS_LINUX)
#define MAYBE_ExtensionPointerLockAccessPass \
    DISABLED_ExtensionPointerLockAccessPass
#else
#define MAYBE_ExtensionPointerLockAccessPass ExtensionPointerLockAccessPass
#endif
IN_PROC_BROWSER_TEST_F(ExtensionApiTest,
                       MAYBE_ExtensionPointerLockAccessPass) {
  // Test that pointer lock can be accessed from an extension with permission.
  ASSERT_TRUE(RunPlatformAppTest("pointer_lock/has_permission")) << message_;
}


text:
using System;
using System.Diagnostics.Contracts;

namespace Yargon.Parser.Sdf.ParseTrees
{
	/// <summary>
	/// A visitor for parse nodes.
	/// </summary>
	/// <typeparam name="TResult">The type of results.</typeparam>
	public interface IParseNodeVisitor<TResult>
	{
		/// <summary>
		/// Visits a parse node.
		/// </summary>
		/// <param name="node">The node.</param>
		/// <returns>The result.</returns>
		TResult VisitParseNode(IParseNode node);

		/// <summary>
		/// Visits an application node.
		/// </summary>
		/// <param name="node">The node.</param>
		/// <returns>The result.</returns>
		TResult VisitApplication(IApplicationParseNode node);

		/// <summary>
		/// Visits a production node.
		/// </summary>
		/// <param name="node">The node.</param>
		/// <returns>The result.</returns>
		TResult VisitProduction(IProductionParseNode node);

		/// <summary>
		/// Visits an ambiguity node.
		/// </summary>
		/// <param name="node">The node.</param>
		/// <returns>The result.</returns>
		TResult VisitAmbiguity(IAmbiguityParseNode node);

		/// <summary>
		/// Visits a cycle node.
		/// </summary>
		/// <param name="node">The node.</param>
		/// <returns>The result.</returns>
		TResult VisitCycle(ICycleParseNode node);
	}
}


text:
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**amount** | **number** |  | [optional]
**category** | **string** |  | [optional]
**description** | **string** |  | [optional]
**identifier** | **string** |  | [optional]
**type** | **string** |  | [optional]
**isBillPay** | **boolean** |  | [optional]
**isDirectDeposit** | **boolean** |  | [optional]
**isExpense** | **boolean** |  | [optional]
**isFee** | **boolean** |  | [optional]
**isIncome** | **boolean** |  | [optional]
**isInternational** | **boolean** |  | [optional]
**isOverdraftFee** | **boolean** |  | [optional]
**isPayrollAdvance** | **boolean** |  | [optional]
**merchantCategoryCode** | **number** |  | [optional]
**merchantGuid** | **string** |  | [optional]
**originalDescription** | **string** |  | [optional]


text:
/**
 * @file
 * @author  Piotr Bartosiewicz (p.bartosiewi@partner.samsung.com)
 * @brief   Dbus exceptions
 */

#ifndef DBUS_EXCEPTION_HPP
#define DBUS_EXCEPTION_HPP

#include <stdexcept>

namespace dbus {

/**
 * Base class for dbus exceptions
 */
struct DbusException: public std::runtime_error {

    explicit DbusException(const std::string& error = "") : std::runtime_error(error) {}
};

/**
 * Dbus IO exception (connection failed, connection lost, etc)
 */
struct DbusIOException: public DbusException {

    explicit DbusIOException(const std::string& error = "") : DbusException(error) {}
};

/**
 * Dbus operation failed exception
 */
struct DbusOperationException: public DbusException {

    explicit DbusOperationException(const std::string& error = "") : DbusException(error) {}
};

/**
 * Dbus custom exception triggered by user logic
 */
struct DbusCustomException: public DbusException {

    explicit DbusCustomException(const std::string& error = "") : DbusException(error) {}
};

/**
 * Dbus invalid argument exception
 */
struct DbusInvalidArgumentException: public DbusException {

    explicit DbusInvalidArgumentException(const std::string& error = "") : DbusException(error) {}
};

} // namespace dbus

#endif // DBUS_EXCEPTION_HPP


text:
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE124_Buffer_Underwrite__CWE839_fscanf_82_goodG2B.cpp
Label Definition File: CWE124_Buffer_Underwrite__CWE839.label.xml
Template File: sources-sinks-82_goodG2B.tmpl.cpp
*/
/*
 * @description
 * CWE: 124 Buffer Underwrite
 * BadSource: fscanf Read data from the console using fscanf()
 * GoodSource: Non-negative but less than 10
 * Sinks:
 *    GoodSink: Ensure the array index is valid
 *    BadSink : Improperly check the array index by not checking the lower bound
 * Flow Variant: 82 Data flow: data passed in a parameter to an virtual method called via a pointer
 *
 * */
#ifndef OMITGOOD

#include "std_testcase.h"
#include "CWE124_Buffer_Underwrite__CWE839_fscanf_82.h"

namespace CWE124_Buffer_Underwrite__CWE839_fscanf_82
{

void CWE124_Buffer_Underwrite__CWE839_fscanf_82_goodG2B::action(int data)
{
    {
        int i;
        int buffer[10] = { 0 };
        /* POTENTIAL FLAW: Attempt to access a negative index of the array
        * This code does not check to see if the array index is negative */
        if (data < 10)
        {
            buffer[data] = 1;
            /* Print the array values */
            for(i = 0; i < 10; i++)
            {
                printIntLine(buffer[i]);
            }
        }
        else
        {
            printLine("ERROR: Array index is negative.");
        }
    }
}

}
#endif /* OMITGOOD */


text:
import sys
import gtk
import gobject
from NDImplementationDecorator import NDImplementationDecorator

__author__ = 'Shamal Faily'

class ConceptReferenceNodeDialog:
  def __init__(self,refName,dimName,objtName,refDesc,builder):
    self.window = builder.get_object("ConceptReferenceNodeDialog")
    self.decorator = NDImplementationDecorator(builder)
    self.decorator.updateTextCtrl("conceptReferenceNameCtrl",refName)
    self.decorator.updateTextCtrl("conceptReferenceTypeCtrl",dimName)
    self.decorator.updateTextCtrl("conceptReferenceArtifactCtrl",objtName)
    self.decorator.updateMLTextCtrl("conceptReferenceDescriptionCtrl",refDesc)

    self.window.resize(350,200)

  def on_conceptReferenceOkButton_clicked(self,callback_data):
    self.window.destroy()

  def show(self):
    self.window.show()


text:
'use strict';

const gulp = require('gulp');
const build = require('@microsoft/sp-build-web');
build.addSuppression(`Warning - [sass] The local CSS class 'ms-Grid' is not camelCase and will not be type-safe.`);

const fs = require('fs')

if (1) {
  fs.chmod = (a, b, cb) => cb(0)
}

build.initialize(gulp);


text:
function startBoth()
{
	DURATION=$1
	PKT_SIZE=$2
	ITERATION=$3
	MODE=$4
	SENDING_DUR=$5
	SENSING_DUR=$6

	echo "iteration = $ITERATION"
	echo "pkt size = $PKT_SIZE"
	echo "mode = $MODE"

	./chimas_tx.py --interferer --args addr=143.54.83.29 --log --mode $MODE --samp-rate 195512 --duration $DURATION --pkt-size $PKT_SIZE --platform tx --iteration $ITERATION --sending-duration $SENDING_DUR --sensing-duration $SENSING_DUR &

	sleep 3
	./chimas_tx.py --args addr=143.54.83.28 --log --mode $MODE --samp-rate 195512 --duration $DURATION --pkt-size $PKT_SIZE --platform tx --iteration $ITERATION --sending-duration $SENDING_DUR --sensing-duration $SENSING_DUR
	sleep 10
	killall Python
	killall python
}

for i in `seq 0 1`; do
	startBoth 3300 32 $i ss 1.0  0.1
done


text:
use crate::fns::FnMut1;
use core::fmt;
use core::pin::Pin;
use futures_core::future::Future;
use futures_core::ready;
use futures_core::stream::{FusedStream, Stream};
use futures_core::task::{Context, Poll};
#[cfg(feature = "sink")]
use futures_sink::Sink;
use pin_project_lite::pin_project;

pin_project! {
    /// Stream for the [`filter_map`](super::StreamExt::filter_map) method.
    #[must_use = "streams do nothing unless polled"]
    pub struct FilterMap<St, Fut, F> {
        #[pin]
        stream: St,
        f: F,
        #[pin]
        pending: Option<Fut>,
    }
}

impl<St, Fut, F> fmt::Debug for FilterMap<St, Fut, F>
where
    St: fmt::Debug,
    Fut: fmt::Debug,
{
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        f.debug_struct("FilterMap")
            .field("stream", &self.stream)
            .field("pending", &self.pending)
            .finish()
    }
}

impl<St, Fut, F> FilterMap<St, Fut, F>
where
    St: Stream,
    F: FnMut(St::Item) -> Fut,
    Fut: Future,
{
    pub(super) fn new(stream: St, f: F) -> Self {
        Self { stream, f, pending: None }
    }

    delegate_access_inner!(stream, St, ());
}

impl<St, Fut, F, T> FusedStream for FilterMap<St, Fut, F>
where
    St: Stream + FusedStream,
    F: FnMut1<St::Item, Output = Fut>,
    Fut: Future<Output = Option<T>>,
{
    fn is_terminated(&self) -> bool {
        self.pending.is_none() && self.stream.is_terminated()
    }
}

impl<St, Fut, F, T> Stream for FilterMap<St, Fut, F>
where
    St: Stream,
    F: FnMut1<St::Item, Output = Fut>,
    Fut: Future<Output = Option<T>>,
{
    type Item = T;

    fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<T>> {
        let mut this = self.project();
        Poll::Ready(loop {
            if let Some(p) = this.pending.as_mut().as_pin_mut() {
                // We have an item in progress, poll that until it's done
                let item = ready!(p.poll(cx));
                this.pending.set(None);
                if item.is_some() {
                    break item;
                }
            } else if let Some(item) = ready!(this.stream.as_mut().poll_next(cx)) {
                // No item in progress, but the stream is still going
                this.pending.set(Some(this.f.call_mut(item)));
            } else {
                // The stream is done
                break None;
            }
        })
    }

    fn size_hint(&self) -> (usize, Option<usize>) {
        let pending_len = if self.pending.is_some() { 1 } else { 0 };
        let (_, upper) = self.stream.size_hint();
        let upper = match upper {
            Some(x) => x.checked_add(pending_len),
            None => None,
        };
        (0, upper) // can't know a lower bound, due to the predicate
    }
}

// Forwarding impl of Sink from the underlying stream
#[cfg(feature = "sink")]
impl<S, Fut, F, Item> Sink<Item> for FilterMap<S, Fut, F>
where
    S: Stream + Sink<Item>,
    F: FnMut1<S::Item, Output = Fut>,
    Fut: Future,
{
    type Error = S::Error;

    delegate_sink!(stream, Item);
}


text:
module.exports = function(mongoose){
    return [{
    name: {type: String, required: true},
    description: {type: String},
    uniqueId: { type: String, required: true, index: true, unique: true},
    email: {type: String},
    authorSite: {type: String},
    authorImg: {type: String},
    banner: {type: String},
    authorTag: {type: String},
    location: {type: String},
    slug: {type: String},
    socialLinks: {type: Object},
    isApplicationUser: {type: Boolean, default: false},
    status: {type: String, default: 'active', enum: ['active', 'inactive', 'deleted']},
    appUserDetails: {
        id: {type: mongoose.Schema.Types.ObjectId},
        email: {type: String}
    }
}, {
    timestamps: true,
    createdby: true,
    updatedby: true
}]
};


text: Base template, cross-platform, MVC/ASP.NET 5


text:
import {PageCallbackRouter, PageHandlerFactory} from './launcher_internals.mojom-webui.js';

export class BrowserProxy {
  callbackRouter: PageCallbackRouter = new PageCallbackRouter();

  constructor() {
    const factory = PageHandlerFactory.getRemote();
    factory.createPageHandler(this.callbackRouter.$.bindNewPipeAndPassRemote());
  }

  static getInstance(): BrowserProxy {
    return instance || (instance = new BrowserProxy());
  }

  static setInstance(obj: BrowserProxy) {
    instance = obj;
  }
}

let instance: BrowserProxy|null = null;


text:
namespace Diadoc.Api.Proto.Documents.UniversalTransferDocument
{
  [global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"UniversalTransferDocumentMetadata")]
  public partial class UniversalTransferDocumentMetadata : global::ProtoBuf.IExtensible
  {
    public UniversalTransferDocumentMetadata() {}

    private Diadoc.Api.Proto.Documents.UniversalTransferDocument.UniversalTransferDocumentStatus _DocumentStatus = Diadoc.Api.Proto.Documents.UniversalTransferDocument.UniversalTransferDocumentStatus.UnknownDocumentStatus;
    [global::ProtoBuf.ProtoMember(1, IsRequired = false, Name=@"DocumentStatus", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
    [global::System.ComponentModel.DefaultValue(Diadoc.Api.Proto.Documents.UniversalTransferDocument.UniversalTransferDocumentStatus.UnknownDocumentStatus)]
    public Diadoc.Api.Proto.Documents.UniversalTransferDocument.UniversalTransferDocumentStatus DocumentStatus
    {
      get { return _DocumentStatus; }
      set { _DocumentStatus = value; }
    }
    private string _Total;
    [global::ProtoBuf.ProtoMember(2, IsRequired = true, Name=@"Total", DataFormat = global::ProtoBuf.DataFormat.Default)]
    public string Total
    {
      get { return _Total; }
      set { _Total = value; }
    }

    private string _Vat = "";
    [global::ProtoBuf.ProtoMember(3, IsRequired = false, Name=@"Vat", DataFormat = global::ProtoBuf.DataFormat.Default)]
    [global::System.ComponentModel.DefaultValue("")]
    public string Vat
    {
      get { return _Vat; }
      set { _Vat = value; }
    }

    private string _Grounds = "";
    [global::ProtoBuf.ProtoMember(4, IsRequired = false, Name=@"Grounds", DataFormat = global::ProtoBuf.DataFormat.Default)]
    [global::System.ComponentModel.DefaultValue("")]
    public string Grounds
    {
      get { return _Grounds; }
      set { _Grounds = value; }
    }
    private string _DocumentFunction;
    [global::ProtoBuf.ProtoMember(5, IsRequired = true, Name=@"DocumentFunction", DataFormat = global::ProtoBuf.DataFormat.Default)]
    public string DocumentFunction
    {
      get { return _DocumentFunction; }
      set { _DocumentFunction = value; }
    }
    private int _Currency;
    [global::ProtoBuf.ProtoMember(6, IsRequired = true, Name=@"Currency", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
    public int Currency
    {
      get { return _Currency; }
      set { _Currency = value; }
    }

    private long _ConfirmationDateTimeTicks = default(long);
    [global::ProtoBuf.ProtoMember(8, IsRequired = false, Name=@"ConfirmationDateTimeTicks", DataFormat = global::ProtoBuf.DataFormat.FixedSize)]
    [global::System.ComponentModel.DefaultValue(default(long))]
    public long ConfirmationDateTimeTicks
    {
      get { return _ConfirmationDateTimeTicks; }
      set { _ConfirmationDateTimeTicks = value; }
    }

    private int _InvoiceAmendmentFlags = default(int);
    [global::ProtoBuf.ProtoMember(9, IsRequired = false, Name=@"InvoiceAmendmentFlags", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
    [global::System.ComponentModel.DefaultValue(default(int))]
    public int InvoiceAmendmentFlags
    {
      get { return _InvoiceAmendmentFlags; }
      set { _InvoiceAmendmentFlags = value; }
    }
    private global::ProtoBuf.IExtension extensionObject;
    global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
      { return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); }
  }

  [global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"UniversalTransferDocumentRevisionMetadata")]
  public partial class UniversalTransferDocumentRevisionMetadata : global::ProtoBuf.IExtensible
  {
    public UniversalTransferDocumentRevisionMetadata() {}

    private Diadoc.Api.Proto.Documents.UniversalTransferDocument.UniversalTransferDocumentStatus _DocumentStatus;
    [global::ProtoBuf.ProtoMember(1, IsRequired = true, Name=@"DocumentStatus", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
    public Diadoc.Api.Proto.Documents.UniversalTransferDocument.UniversalTransferDocumentStatus DocumentStatus
    {
      get { return _DocumentStatus; }
      set { _DocumentStatus = value; }
    }
    private string _Total;
    [global::ProtoBuf.ProtoMember(2, IsRequired = true, Name=@"Total", DataFormat = global::ProtoBuf.DataFormat.Default)]
    public string Total
    {
      get { return _Total; }
      set { _Total = value; }
    }

    private string _Vat = "";
    [global::ProtoBuf.ProtoMember(3, IsRequired = false, Name=@"Vat", DataFormat = global::ProtoBuf.DataFormat.Default)]
    [global::System.ComponentModel.DefaultValue("")]
    public string Vat
    {
      get { return _Vat; }
      set { _Vat = value; }
    }

    private string _Grounds = "";
    [global::ProtoBuf.ProtoMember(4, IsRequired = false, Name=@"Grounds", DataFormat = global::ProtoBuf.DataFormat.Default)]
    [global::System.ComponentModel.DefaultValue("")]
    public string Grounds
    {
      get { return _Grounds; }
      set { _Grounds = value; }
    }
    private string _DocumentFunction;
    [global::ProtoBuf.ProtoMember(5, IsRequired = true, Name=@"DocumentFunction", DataFormat = global::ProtoBuf.DataFormat.Default)]
    public string DocumentFunction
    {
      get { return _DocumentFunction; }
      set { _DocumentFunction = value; }
    }
    private int _Currency;
    [global::ProtoBuf.ProtoMember(6, IsRequired = true, Name=@"Currency", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
    public int Currency
    {
      get { return _Currency; }
      set { _Currency = value; }
    }

    private long _ConfirmationDateTimeTicks = default(long);
    [global::ProtoBuf.ProtoMember(7, IsRequired = false, Name=@"ConfirmationDateTimeTicks", DataFormat = global::ProtoBuf.DataFormat.FixedSize)]
    [global::System.ComponentModel.DefaultValue(default(long))]
    public long ConfirmationDateTimeTicks
    {
      get { return _ConfirmationDateTimeTicks; }
      set { _ConfirmationDateTimeTicks = value; }
    }
    private int _InvoiceAmendmentFlags;
    [global::ProtoBuf.ProtoMember(8, IsRequired = true, Name=@"InvoiceAmendmentFlags", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
    public int InvoiceAmendmentFlags
    {
      get { return _InvoiceAmendmentFlags; }
      set { _InvoiceAmendmentFlags = value; }
    }
    private string _OriginalInvoiceNumber;
    [global::ProtoBuf.ProtoMember(9, IsRequired = true, Name=@"OriginalInvoiceNumber", DataFormat = global::ProtoBuf.DataFormat.Default)]
    public string OriginalInvoiceNumber
    {
      get { return _OriginalInvoiceNumber; }
      set { _OriginalInvoiceNumber = value; }
    }
    private string _OriginalInvoiceDate;
    [global::ProtoBuf.ProtoMember(10, IsRequired = true, Name=@"OriginalInvoiceDate", DataFormat = global::ProtoBuf.DataFormat.Default)]
    public string OriginalInvoiceDate
    {
      get { return _OriginalInvoiceDate; }
      set { _OriginalInvoiceDate = value; }
    }
    private global::ProtoBuf.IExtension extensionObject;
    global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
      { return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); }
  }

  [global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"UniversalCorrectionDocumentMetadata")]
  public partial class UniversalCorrectionDocumentMetadata : global::ProtoBuf.IExtensible
  {
    public UniversalCorrectionDocumentMetadata() {}

    private Diadoc.Api.Proto.Documents.UniversalTransferDocument.UniversalTransferDocumentStatus _DocumentStatus;
    [global::ProtoBuf.ProtoMember(1, IsRequired = true, Name=@"DocumentStatus", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
    public Diadoc.Api.Proto.Documents.UniversalTransferDocument.UniversalTransferDocumentStatus DocumentStatus
    {
      get { return _DocumentStatus; }
      set { _DocumentStatus = value; }
    }
    private string _TotalInc;
    [global::ProtoBuf.ProtoMember(2, IsRequired = true, Name=@"TotalInc", DataFormat = global::ProtoBuf.DataFormat.Default)]
    public string TotalInc
    {
      get { return _TotalInc; }
      set { _TotalInc = value; }
    }
    private string _TotalDec;
    [global::ProtoBuf.ProtoMember(3, IsRequired = true, Name=@"TotalDec", DataFormat = global::ProtoBuf.DataFormat.Default)]
    public string TotalDec
    {
      get { return _TotalDec; }
      set { _TotalDec = value; }
    }
    private string _VatInc;
    [global::ProtoBuf.ProtoMember(4, IsRequired = true, Name=@"VatInc", DataFormat = global::ProtoBuf.DataFormat.Default)]
    public string VatInc
    {
      get { return _VatInc; }
      set { _VatInc = value; }
    }
    private string _VatDec;
    [global::ProtoBuf.ProtoMember(5, IsRequired = true, Name=@"VatDec", DataFormat = global::ProtoBuf.DataFormat.Default)]
    public string VatDec
    {
      get { return _VatDec; }
      set { _VatDec = value; }
    }

    private string _Grounds = "";
    [global::ProtoBuf.ProtoMember(6, IsRequired = false, Name=@"Grounds", DataFormat = global::ProtoBuf.DataFormat.Default)]
    [global::System.ComponentModel.DefaultValue("")]
    public string Grounds
    {
      get { return _Grounds; }
      set { _Grounds = value; }
    }
    private string _DocumentFunction;
    [global::ProtoBuf.ProtoMember(7, IsRequired = true, Name=@"DocumentFunction", DataFormat = global::ProtoBuf.DataFormat.Default)]
    public string DocumentFunction
    {
      get { return _DocumentFunction; }
      set { _DocumentFunction = value; }
    }
    private int _Currency;
    [global::ProtoBuf.ProtoMember(8, IsRequired = true, Name=@"Currency", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
    public int Currency
    {
      get { return _Currency; }
      set { _Currency = value; }
    }
    private long _ConfirmationDateTimeTicks;
    [global::ProtoBuf.ProtoMember(9, IsRequired = true, Name=@"ConfirmationDateTimeTicks", DataFormat = global::ProtoBuf.DataFormat.FixedSize)]
    public long ConfirmationDateTimeTicks
    {
      get { return _ConfirmationDateTimeTicks; }
      set { _ConfirmationDateTimeTicks = value; }
    }
    private int _InvoiceAmendmentFlags;
    [global::ProtoBuf.ProtoMember(10, IsRequired = true, Name=@"InvoiceAmendmentFlags", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
    public int InvoiceAmendmentFlags
    {
      get { return _InvoiceAmendmentFlags; }
      set { _InvoiceAmendmentFlags = value; }
    }
    private string _OriginalInvoiceNumber;
    [global::ProtoBuf.ProtoMember(11, IsRequired = true, Name=@"OriginalInvoiceNumber", DataFormat = global::ProtoBuf.DataFormat.Default)]
    public string OriginalInvoiceNumber
    {
      get { return _OriginalInvoiceNumber; }
      set { _OriginalInvoiceNumber = value; }
    }
    private string _OriginalInvoiceDate;
    [global::ProtoBuf.ProtoMember(12, IsRequired = true, Name=@"OriginalInvoiceDate", DataFormat = global::ProtoBuf.DataFormat.Default)]
    public string OriginalInvoiceDate
    {
      get { return _OriginalInvoiceDate; }
      set { _OriginalInvoiceDate = value; }
    }

    private string _OriginalInvoiceRevisionNumber = "";
    [global::ProtoBuf.ProtoMember(13, IsRequired = false, Name=@"OriginalInvoiceRevisionNumber", DataFormat = global::ProtoBuf.DataFormat.Default)]
    [global::System.ComponentModel.DefaultValue("")]
    public string OriginalInvoiceRevisionNumber
    {
      get { return _OriginalInvoiceRevisionNumber; }
      set { _OriginalInvoiceRevisionNumber = value; }
    }

    private string _OriginalInvoiceRevisionDate = "";
    [global::ProtoBuf.ProtoMember(14, IsRequired = false, Name=@"OriginalInvoiceRevisionDate", DataFormat = global::ProtoBuf.DataFormat.Default)]
    [global::System.ComponentModel.DefaultValue("")]
    public string OriginalInvoiceRevisionDate
    {
      get { return _OriginalInvoiceRevisionDate; }
      set { _OriginalInvoiceRevisionDate = value; }
    }
    private global::ProtoBuf.IExtension extensionObject;
    global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
      { return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); }
  }

  [global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"UniversalCorrectionDocumentRevisionMetadata")]
  public partial class UniversalCorrectionDocumentRevisionMetadata : global::ProtoBuf.IExtensible
  {
    public UniversalCorrectionDocumentRevisionMetadata() {}

    private Diadoc.Api.Proto.Documents.UniversalTransferDocument.UniversalTransferDocumentStatus _DocumentStatus;
    [global::ProtoBuf.ProtoMember(1, IsRequired = true, Name=@"DocumentStatus", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
    public Diadoc.Api.Proto.Documents.UniversalTransferDocument.UniversalTransferDocumentStatus DocumentStatus
    {
      get { return _DocumentStatus; }
      set { _DocumentStatus = value; }
    }
    private string _TotalInc;
    [global::ProtoBuf.ProtoMember(2, IsRequired = true, Name=@"TotalInc", DataFormat = global::ProtoBuf.DataFormat.Default)]
    public string TotalInc
    {
      get { return _TotalInc; }
      set { _TotalInc = value; }
    }
    private string _TotalDec;
    [global::ProtoBuf.ProtoMember(3, IsRequired = true, Name=@"TotalDec", DataFormat = global::ProtoBuf.DataFormat.Default)]
    public string TotalDec
    {
      get { return _TotalDec; }
      set { _TotalDec = value; }
    }
    private string _VatInc;
    [global::ProtoBuf.ProtoMember(4, IsRequired = true, Name=@"VatInc", DataFormat = global::ProtoBuf.DataFormat.Default)]
    public string VatInc
    {
      get { return _VatInc; }
      set { _VatInc = value; }
    }
    private string _VatDec;
    [global::ProtoBuf.ProtoMember(5, IsRequired = true, Name=@"VatDec", DataFormat = global::ProtoBuf.DataFormat.Default)]
    public string VatDec
    {
      get { return _VatDec; }
      set { _VatDec = value; }
    }

    private string _Grounds = "";
    [global::ProtoBuf.ProtoMember(6, IsRequired = false, Name=@"Grounds", DataFormat = global::ProtoBuf.DataFormat.Default)]
    [global::System.ComponentModel.DefaultValue("")]
    public string Grounds
    {
      get { return _Grounds; }
      set { _Grounds = value; }
    }
    private string _DocumentFunction;
    [global::ProtoBuf.ProtoMember(7, IsRequired = true, Name=@"DocumentFunction", DataFormat = global::ProtoBuf.DataFormat.Default)]
    public string DocumentFunction
    {
      get { return _DocumentFunction; }
      set { _DocumentFunction = value; }
    }
    private int _Currency;
    [global::ProtoBuf.ProtoMember(8, IsRequired = true, Name=@"Currency", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
    public int Currency
    {
      get { return _Currency; }
      set { _Currency = value; }
    }
    private long _ConfirmationDateTimeTicks;
    [global::ProtoBuf.ProtoMember(9, IsRequired = true, Name=@"ConfirmationDateTimeTicks", DataFormat = global::ProtoBuf.DataFormat.FixedSize)]
    public long ConfirmationDateTimeTicks
    {
      get { return _ConfirmationDateTimeTicks; }
      set { _ConfirmationDateTimeTicks = value; }
    }
    private int _InvoiceAmendmentFlags;
    [global::ProtoBuf.ProtoMember(10, IsRequired = true, Name=@"InvoiceAmendmentFlags", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
    public int InvoiceAmendmentFlags
    {
      get { return _InvoiceAmendmentFlags; }
      set { _InvoiceAmendmentFlags = value; }
    }
    private string _OriginalInvoiceNumber;
    [global::ProtoBuf.ProtoMember(11, IsRequired = true, Name=@"OriginalInvoiceNumber", DataFormat = global::ProtoBuf.DataFormat.Default)]
    public string OriginalInvoiceNumber
    {
      get { return _OriginalInvoiceNumber; }
      set { _OriginalInvoiceNumber = value; }
    }
    private string _OriginalInvoiceDate;
    [global::ProtoBuf.ProtoMember(12, IsRequired = true, Name=@"OriginalInvoiceDate", DataFormat = global::ProtoBuf.DataFormat.Default)]
    public string OriginalInvoiceDate
    {
      get { return _OriginalInvoiceDate; }
      set { _OriginalInvoiceDate = value; }
    }

    private string _OriginalInvoiceRevisionNumber = "";
    [global::ProtoBuf.ProtoMember(13, IsRequired = false, Name=@"OriginalInvoiceRevisionNumber", DataFormat = global::ProtoBuf.DataFormat.Default)]
    [global::System.ComponentModel.DefaultValue("")]
    public string OriginalInvoiceRevisionNumber
    {
      get { return _OriginalInvoiceRevisionNumber; }
      set { _OriginalInvoiceRevisionNumber = value; }
    }

    private string _OriginalInvoiceRevisionDate = "";
    [global::ProtoBuf.ProtoMember(14, IsRequired = false, Name=@"OriginalInvoiceRevisionDate", DataFormat = global::ProtoBuf.DataFormat.Default)]
    [global::System.ComponentModel.DefaultValue("")]
    public string OriginalInvoiceRevisionDate
    {
      get { return _OriginalInvoiceRevisionDate; }
      set { _OriginalInvoiceRevisionDate = value; }
    }
    private string _OriginalInvoiceCorrectionNumber;
    [global::ProtoBuf.ProtoMember(15, IsRequired = true, Name=@"OriginalInvoiceCorrectionNumber", DataFormat = global::ProtoBuf.DataFormat.Default)]
    public string OriginalInvoiceCorrectionNumber
    {
      get { return _OriginalInvoiceCorrectionNumber; }
      set { _OriginalInvoiceCorrectionNumber = value; }
    }
    private string _OriginalInvoiceCorrectionDate;
    [global::ProtoBuf.ProtoMember(16, IsRequired = true, Name=@"OriginalInvoiceCorrectionDate", DataFormat = global::ProtoBuf.DataFormat.Default)]
    public string OriginalInvoiceCorrectionDate
    {
      get { return _OriginalInvoiceCorrectionDate; }
      set { _OriginalInvoiceCorrectionDate = value; }
    }
    private global::ProtoBuf.IExtension extensionObject;
    global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
      { return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); }
  }

    [global::ProtoBuf.ProtoContract(Name=@"UniversalTransferDocumentStatus")]
    public enum UniversalTransferDocumentStatus
    {

      [global::ProtoBuf.ProtoEnum(Name=@"UnknownDocumentStatus", Value=0)]
      UnknownDocumentStatus = 0,

      [global::ProtoBuf.ProtoEnum(Name=@"OutboundWaitingForSenderSignature", Value=1)]
      OutboundWaitingForSenderSignature = 1,

      [global::ProtoBuf.ProtoEnum(Name=@"OutboundWaitingForInvoiceReceiptAndRecipientSignature", Value=2)]
      OutboundWaitingForInvoiceReceiptAndRecipientSignature = 2,

      [global::ProtoBuf.ProtoEnum(Name=@"OutboundWaitingForInvoiceReceipt", Value=3)]
      OutboundWaitingForInvoiceReceipt = 3,

      [global::ProtoBuf.ProtoEnum(Name=@"OutboundWaitingForRecipientSignature", Value=4)]
      OutboundWaitingForRecipientSignature = 4,

      [global::ProtoBuf.ProtoEnum(Name=@"OutboundWithRecipientSignature", Value=5)]
      OutboundWithRecipientSignature = 5,

      [global::ProtoBuf.ProtoEnum(Name=@"OutboundRecipientSignatureRequestRejected", Value=6)]
      OutboundRecipientSignatureRequestRejected = 6,

      [global::ProtoBuf.ProtoEnum(Name=@"OutboundInvalidSenderSignature", Value=7)]
      OutboundInvalidSenderSignature = 7,

      [global::ProtoBuf.ProtoEnum(Name=@"OutboundNotFinished", Value=8)]
      OutboundNotFinished = 8,

      [global::ProtoBuf.ProtoEnum(Name=@"OutboundFinished", Value=9)]
      OutboundFinished = 9,

      [global::ProtoBuf.ProtoEnum(Name=@"InboundWaitingForRecipientSignature", Value=16)]
      InboundWaitingForRecipientSignature = 16,

      [global::ProtoBuf.ProtoEnum(Name=@"InboundWithRecipientSignature", Value=17)]
      InboundWithRecipientSignature = 17,

      [global::ProtoBuf.ProtoEnum(Name=@"InboundRecipientSignatureRequestRejected", Value=18)]
      InboundRecipientSignatureRequestRejected = 18,

      [global::ProtoBuf.ProtoEnum(Name=@"InboundInvalidRecipientSignature", Value=19)]
      InboundInvalidRecipientSignature = 19,

      [global::ProtoBuf.ProtoEnum(Name=@"InboundNotFinished", Value=20)]
      InboundNotFinished = 20,

      [global::ProtoBuf.ProtoEnum(Name=@"InboundFinished", Value=21)]
      InboundFinished = 21
    }

}


text:
package pFive;

public class DupRunner {
	public static void main(String[] args) {
		final String[] samples={
			"a b c d e f g h a b c d e f g h i j k",
			"one two three one two three six seven one two",
			"1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 6"
		};

		for(String x : samples) {
			System.out.println("Original List: "+x);
			System.out.println("Uniques: "+UniquesDupes.getUniques(x));
			System.out.println("Dupes: "+UniquesDupes.getDupes(x)+"\n");
		}
	}
}


text:
Ext.define('Journal.controller.Desktop', {
	extend: 'Journal.controller.Base',

	taskBar: null,
	wallpaper: null,
	windows: null,

	uses: [
		'Ext.util.MixedCollection',
		'Ext.window.Window'
	],

	views: [ 'desktop.View','desktop.Wallpaper','desktop.Settings' ],
	models: [ 'ShortcutModel' ],
	stores: [ 'ShortcutsStore' ],

	init: function() {
		var me = this;
		me.callParent();

		me.windows = new Ext.util.MixedCollection();
	},

	getMainView: function () {
		var me = this;
		if(!me.mainView) me.mainView = Ext.widget('desktopview', me.mConf);
		return me.mainView;
	},

	getTaskBar: function() {
		var me = this;
		if(!me.taskBar) me.taskBar = me.app.getController('TaskBar');
		return me.taskBar;
	},

// System handlers
	onSettings: function () {
		var dlg = Ext.widget('desktopsettings', {
			app: this.app,
			controller: this
		});
		dlg.show();
	},

// Wallpaper events & methods
	getWallpaper: function (cfg) {
		var me = this;
		if(!me.wallpaper) {
			Ext.apply(cfg, me.mConf);
			me.wallpaper = Ext.widget('wallpaper', cfg);
		}
		return me.wallpaper;
	},

	setWallpaper: function(wallpaper, stretch) {
		this.getWallpaper().setWallpaper(wallpaper, stretch);
	},

// Desktop events
	onDesktopMenu: function (e) {
		var me = this,
				menu = me.getMainView().contextMenu;
		e.stopEvent();
		if (!menu.rendered) menu.on('beforeshow', me.onDesktopMenuBeforeShow, me);

		menu.showAt(e.getXY());
		menu.doConstrain();
	},

	onDesktopMenuBeforeShow: function (menu) {
		var me = this,
				count = me.windows.getCount();

		menu.items.each(function (item) {
			var min = item.minWindows || 0;
			item.setDisabled(count < min);
		});
	},

// Window context menu handlers
	onWindowMenuBeforeShow: function (menu) {
		var items = menu.items.items, win = menu.theWin;
		items[0].setDisabled(win.maximized !== true && win.hidden !== true); // Restore
		items[1].setDisabled(!win.minimizable || win.minimized === true); // Minimize
		items[2].setDisabled(!win.maximizable || !win.resizable || win.maximized === true || win.hidden === true); // Maximize
	},

	onWindowMenuClose: function () {
		var me = this, win = me.windowMenu.theWin;
		win.close();
	},

	onWindowMenuHide: function (menu) {
		menu.theWin = null;
	},

	onWindowMenuMaximize: function () {
		var me = this, win = me.windowMenu.theWin;
		win.maximize();
	},

	onWindowMenuMinimize: function () {
		var me = this, win = me.windowMenu.theWin;
		win.minimize();
	},

	onWindowMenuRestore: function () {
		var me = this, win = me.windowMenu.theWin;
		me.restoreWindow(win);
	},

// Windows management
	setTickSize: function(xTickSize, yTickSize) {
		var me = this,
				xt = me.xTickSize = xTickSize,
				yt = me.yTickSize = (arguments.length > 1) ? yTickSize : xt;

		me.windows.each(function(win) {
			var dd = win.dd, resizer = win.resizer;
			dd.xTickSize = xt;
			dd.yTickSize = yt;
			resizer.widthIncrement = xt;
			resizer.heightIncrement = yt;
		});
	},

	cascadeWindows: function() {
		var x = 0, y = 0,
				zmgr = this.app.getDesktop().getDesktopZIndexManager();

		zmgr.eachBottomUp(function(win) {
			if (win.isWindow && win.isVisible() && !win.maximized) {
				win.setPosition(x, y);
				x += 20;
				y += 20;
			}
		});
	},

	createWindow: function(wdg, config) {
		var me = this, win,
				cfg = Ext.applyIf(config || {}, {
					stateful: false,
          isWindow: true,
          constrainHeader: true,
          minimizable: true,
          maximizable: true
				});

		win = Ext.widget(wdg, cfg);
		me.getMainView().add(win);
		me.windows.add(win);

		win.taskButton = me.getTaskBar().addTaskButton(win);
		win.animateTarget = win.taskButton.el;

		win.on({
			activate: me.updateActiveWindow,
			beforeshow: me.updateActiveWindow,
			deactivate: me.updateActiveWindow,
			minimize: me.minimizeWindow,
			destroy: me.onWindowClose,
			scope: me
		});

		win.on({
			boxready: function () {
				win.dd.xTickSize = me.xTickSize;
				win.dd.yTickSize = me.yTickSize;

				if (win.resizer) {
					win.resizer.widthIncrement = me.xTickSize;
					win.resizer.heightIncrement = me.yTickSize;
				}
			},
			single: true
		});

		// replace normal window close w/fadeOut animation:
		win.doClose = function ()  {
			win.doClose = Ext.emptyFn; // dblclick can call again...
			win.el.disableShadow();
			win.el.fadeOut({
				listeners: {
					afteranimate: function () {
						win.destroy();
					}
				}
			});
		};

		return win;
	},

	getActiveWindow: function () {
		var win = null,
				zmgr = this.app.getDesktop().getDesktopZIndexManager();

		if (zmgr) {
			// We cannot rely on activate/deactive because that fires against non-Window
			// components in the stack.

			zmgr.eachTopDown(function (comp) {
				if (comp.isWindow && !comp.hidden) {
					win = comp;
					return false;
				}
				return true;
			});
		}

		return win;
	},

	getDesktopZIndexManager: function () {
		var windows = this.windows;
		// TODO - there has to be a better way to get this...
		return (windows.getCount() && windows.getAt(0).zIndexManager) || null;
	},

	getWindow: function(id) {
		return this.windows.get(id);
	},

	minimizeWindow: function(win) {
		win.minimized = true;
		win.hide();
	},

	restoreWindow: function (win) {
		if (win.isVisible()) {
			win.restore();
			win.toFront();
		} else {
			win.show();
		}
		return win;
	},

	tileWindows: function() {
		var me = this,
				d = me.app.getDesktop();
				availWidth = d.getMainView().body.getWidth(true),
				x = d.xTickSize,
				y = d.yTickSize,
				nextY = y;

		d.windows.each(function(win) {
			if (win.isVisible() && !win.maximized) {
				var w = win.el.getWidth();

				// Wrap to next row if we are not at the line start and this Window will
				// go off the end
				if (x > d.xTickSize && x + w > availWidth) {
					x = d.xTickSize;
					y = nextY;
				}

				win.setPosition(x, y);
				x += w + d.xTickSize;
				nextY = Math.max(nextY, y + win.el.getHeight() + d.yTickSize);
			}
		});
	},

	updateActiveWindow: function () {
		var me = this,
				activeWindow = me.getActiveWindow(),
				last = me.lastActiveWindow;
		if (activeWindow === last) return;

		if (last) {
			if (last.el.dom) {
				last.addCls(me.inactiveWindowCls);
				last.removeCls(me.activeWindowCls);
			}
			last.active = false;
		}

		me.lastActiveWindow = activeWindow;

		if (activeWindow) {
			activeWindow.addCls(me.activeWindowCls);
			activeWindow.removeCls(me.inactiveWindowCls);
			activeWindow.minimized = false;
			activeWindow.active = true;
		}

		me.getTaskBar().setActiveButton(activeWindow && activeWindow.taskButton);
	},

	onWindowClose: function(win) {
		var me = this;
		me.windows.remove(win);
		me.getTaskBar().removeTaskButton(win.taskButton);
		me.updateActiveWindow();
	},

	onDeskResize: function (obj, newWidth, newHeight, opts) {
		var cmp = Ext.getCmp('tools-desk'),
				nds = cmp.getNodes(),
				l = nds.length,
				tWidth = 0;

		if(l > 0) {
			for(var i = 0;i < l;i++) {
	  		tWidth += nds[i].offsetWidth+16;
	  	}
	  	cmp.setWidth(tWidth);
	  }
	},

	onShortcutItemClick: function (dataView, record) {
		var me = this, module = me.app.getModule(record.data.moduleId+'-controller'),
				win = module && module.getMView();

		if (win) me.restoreWindow(win);
	}
});


text:
package org.perfidix;

import org.perfidix.AbstractConfig.StandardConfig;
import org.perfidix.annotation.AfterBenchClass;
import org.perfidix.annotation.BeforeBenchClass;
import org.perfidix.annotation.Bench;
import org.perfidix.element.AbstractMethodArrangement;
import org.perfidix.element.BenchmarkElement;
import org.perfidix.element.BenchmarkExecutor;
import org.perfidix.element.BenchmarkMethod;
import org.perfidix.exceptions.PerfidixMethodCheckException;
import org.perfidix.exceptions.PerfidixMethodInvocationException;
import org.perfidix.result.BenchmarkResult;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.*;

/**
 * Class to hold all classes which want to be benchmarked.
 *
 * <pre>
 *
 *
 * public class MyBenchmark {
 *
 * 	public static void main(final String[] args) {
 * 		// Build up own config
 * 		final AbstractConfig config = new MyConfig();
 *
 * 		// Initialise benchmark with config
 * 		final Benchmark benchmark = new Benchmark(config);
 *
 * 		// Adding Classes to benchmark
 * 		benchmark.add(Class1.class);
 * 		benchmark.add(Class2.class);
 * 		benchmark.add(Object3); // of Class3, every class is allowed to be
 * 								// inserted only once
 *
 * 		// Running benchmark
 * 		final BenchmarkResult result = benchmark.run();
 *
 * 		// Printing out Result in a Tabular, every AbstractOutput implementing
 * 		// class is allowed.
 * 		new TabularSummaryOutput().visitBenchmark(result);
 *
 * 	}
 * }
 *
 * </pre>
 *
 * @author Sebastian Graf, University of Konstanz
 * @see AbstractConfig
 * @see BenchmarkResult
 */
public final class Benchmark {

	/**
	 * Simple random for gc-prob
	 */
	private transient static final Random RAN = new Random();
	/**
	 * Set with all used classes.
	 */
	private transient final Set<Class<?>> clazzes;
	/**
	 * Already instantiated objects
	 */
	private transient final Set<Object> objects;
	/**
	 * Configuration of benchmark, holding everything.
	 */
	private transient final AbstractConfig conf;

	/**
	 * Constructor with a fixed set of used meters.
	 *
	 * @param paramConf
	 *            Configuration for Benchmark
	 */
	public Benchmark(final AbstractConfig paramConf) {
		conf = paramConf;
		this.clazzes = new LinkedHashSet<Class<?>>();
		this.objects = new LinkedHashSet<Object>();

	}

	/**
	 * Convenience constructor using the {@link StandardConfig}
	 */
	public Benchmark() {
		this(new StandardConfig());
	}

	/**
	 * Getting the content of a dataprovider.
	 *
	 * @param meth
	 *            the dataprovider method
	 * @param toInvoke
	 *            the object on which the method is invoked
	 * @return a two-dimensional array containing multiple sets of parameters
	 *         representing single runs each.
	 */
	private static Object[][] getDataProviderContent(final Method meth,
			final Object toInvoke) {

		Object[][] res;
		try {
			res = (Object[][]) meth.invoke(toInvoke);
		} catch (IllegalAccessException | IllegalArgumentException
				| InvocationTargetException e) {
			throw new IllegalArgumentException("Method " + meth
					+ " as data provider throws an exception on invocation");
		}

		return res;
	}

	/**
	 * Adding a class to bench to this benchmark. This class should contain
	 * benchmarkable methods, otherwise it will be ignored.
	 *
	 * @param clazz
	 *            to be added.
	 */
	public void add(final Class<?> clazz) {
		if (this.clazzes.contains(clazz)) {
			throw new IllegalArgumentException(
					"Only one class-instance per benchmark allowed");
		} else {
			this.clazzes.add(clazz);
		}
	}

	/**
	 * Adding a already instantiated objects to benchmark. Per benchmark, only
	 * one objects of each class is allowed.
	 *
	 * @param obj
	 *            to be added
	 */
	public void add(final Object obj) {
		final Class<?> clazz = obj.getClass();

		if (this.clazzes.contains(clazz)) {
			throw new IllegalArgumentException(
					"Only one class-instance per benchmark allowed");
		} else {
			this.clazzes.add(clazz);
			this.objects.add(obj);
		}
	}

	/**
	 * Getting the number of all methods and all runs
	 *
	 * @return a map with all methods and the runs.
	 * @throws PerfidixMethodCheckException
	 *             if methods are not bechmarkable
	 */
	public Map<BenchmarkMethod, Integer> getNumberOfMethodsAndRuns()
			throws PerfidixMethodCheckException {
		final Map<BenchmarkMethod, Integer> returnVal = new HashMap<BenchmarkMethod, Integer>();
		// instantiate objects, just for getting runs
		final List<BenchmarkMethod> meths = getBenchmarkMethods();
		for (final BenchmarkMethod meth : meths) {
			// TODO respect data provider
			int numberOfRuns = BenchmarkMethod.getNumberOfAnnotatedRuns(meth
					.getMethodToBench());
			if (numberOfRuns == Bench.NONE_RUN) {
				numberOfRuns = conf.getRuns();
			}
			returnVal.put(meth, numberOfRuns);
		}
		return returnVal;
	}

	/**
	 * Running this benchmark
	 *
	 * @return {@link BenchmarkResult} the result in an {@link BenchmarkResult}
	 *         container.
	 */
	public BenchmarkResult run() {
		final BenchmarkResult res = new BenchmarkResult(conf.getListener());
		BenchmarkExecutor.initialize(conf, res);

		// instantiate methods
		final Map<Class<?>, Object> instantiatedObjs = instantiateObjects(res);

		// getting Benchmarkables
		try {
			final List<BenchmarkElement> elements = getBenchmarkElements(instantiatedObjs);

			// arranging them
			final AbstractMethodArrangement arrangement = AbstractMethodArrangement
					.getMethodArrangement(elements, conf.getArrangement());

			// getting the mapping and executing beforemethod
			final Map<Class<?>, Object> objectsToExecute = executeBeforeBenchClass(
					instantiatedObjs, res);

			// executing the bench for the arrangement
			for (final BenchmarkElement elem : arrangement) {
				// invoking gc if possible
				if (RAN.nextDouble() < conf.getGcProb()) {
					System.gc();
				}

				final BenchmarkExecutor exec = BenchmarkExecutor
						.getExecutor(elem);

				final Object obj = objectsToExecute.get(elem.getMeth()
						.getMethodToBench().getDeclaringClass());
				// check needed because of failed initialization of objects
				if (obj != null) {
					exec.executeBeforeMethods(obj);
					exec.executeBench(obj, elem.getParameter());
					exec.executeAfterMethods(obj);
				}
			}

			// cleaning up methods to benchmark
			tearDownObjectsToExecute(objectsToExecute, res);
		} catch (PerfidixMethodCheckException exc) {
			res.addException(exc);
		}
		return res;
	}

	/**
	 * Setting up executable objects for all registered classes and executing
	 * {@link BeforeBenchClass} annotated methods. If an {@link Exception}
	 * occurs, this failure will be stored in the {@link BenchmarkResult} and
	 * the class will not be instantiated
	 *
	 * @param res
	 *            {@link BenchmarkResult} for storing possible failures.
	 * @return a mapping with class->objects for all registered classes-
	 */
	private Map<Class<?>, Object> instantiateObjects(final BenchmarkResult res) {
		// datastructure initialization for all objects
		final Map<Class<?>, Object> objectsToUse = new Hashtable<Class<?>, Object>();

		// generating including already instaniated objects
		for (final Object obj : this.objects) {
			final Class<?> clazz = obj.getClass();
			objectsToUse.put(clazz, obj);
		}

		// generating objects for each registered class
		for (final Class<?> clazz : clazzes) {
			// generating a new instance on which the benchmark will be
			// performed if there isn't a user generated one
			if (!objectsToUse.containsKey(clazz)) {
				try {
					final Object obj = clazz.newInstance();
					objectsToUse.put(clazz, obj);
					// otherwise adding an exception to the result
				} catch (final InstantiationException | IllegalAccessException e) {
					res.addException(new PerfidixMethodInvocationException(e,
							BeforeBenchClass.class));
				}
			}
		}

		return objectsToUse;
	}

	/**
	 * Executing beforeBenchClass if present.
	 *
	 * @param instantiatedObj
	 *            with the instantiatedObj;
	 * @param res
	 *            where the Exceptions should be stored to
	 * @return valid instances with valid beforeCall
	 */
	private Map<Class<?>, Object> executeBeforeBenchClass(
			final Map<Class<?>, Object> instantiatedObj,
			final BenchmarkResult res) {

		final Map<Class<?>, Object> returnVal = new Hashtable<Class<?>, Object>();

		// invoking before bench class
		for (final Class<?> clazz : instantiatedObj.keySet()) {

			final Object objectToUse = instantiatedObj.get(clazz);
			// ..the search for the beforeClassMeth begins...
			Method beforeClassMeth = null;
			boolean continueVal = true;
			try {
				beforeClassMeth = BenchmarkMethod
						.findAndCheckAnyMethodByAnnotation(clazz,
								BeforeBenchClass.class);
				// ... and if this search is throwing an exception, the
				// exception will be added and a flag is set to break up
			} catch (final PerfidixMethodCheckException e) {
				res.addException(e);
				continueVal = false;
			}
			// if everything worked well...
			if (continueVal) {
				if (beforeClassMeth == null) {
					// ...either the objects is directly mapped to the class
					// for executing the benches
					returnVal.put(clazz, objectToUse);
				} else {
					// ... or the beforeMethod will be executed and a
					// possible exception stored to the result...
					final PerfidixMethodCheckException beforeByCheck = BenchmarkExecutor
							.checkMethod(objectToUse, BeforeBenchClass.class,
									beforeClassMeth);
					if (beforeByCheck == null) {
						final PerfidixMethodInvocationException beforeByInvok = BenchmarkExecutor
								.invokeMethod(objectToUse,
										BeforeBenchClass.class, beforeClassMeth);
						if (beforeByInvok == null) {
							returnVal.put(clazz, objectToUse);
						} else {
							res.addException(beforeByInvok);
						}
					} else {
						res.addException(beforeByCheck);
					}
				}
			}
		}
		return returnVal;
	}

	/**
	 * Tear down executable objects for all registered classes and executing
	 * {@link AfterBenchClass} annotated methods.
	 *
	 * @param objects
	 *            a mapping with class->objects to be teared down
	 * @param res
	 *            the {@link BenchmarkResult} for storing possible failures.
	 */
	private void tearDownObjectsToExecute(final Map<Class<?>, Object> objects,
			final BenchmarkResult res) {

		// executing tearDown for all clazzes registered in given Map
		for (final Class<?> clazz : objects.keySet()) {
			final Object objectToUse = objects.get(clazz);
			if (objectToUse != null) {
				// executing AfterClass for all objects.
				Method afterClassMeth = null;
				try {
					afterClassMeth = BenchmarkMethod
							.findAndCheckAnyMethodByAnnotation(clazz,
									AfterBenchClass.class);
				} catch (final PerfidixMethodCheckException e) {
					res.addException(e);
				}
				// if afterClassMethod exists, the method will be executed and
				// possible failures will be stored in the BenchmarkResult
				if (afterClassMeth != null) {
					final PerfidixMethodCheckException afterByCheck = BenchmarkExecutor
							.checkMethod(objectToUse, AfterBenchClass.class,
									afterClassMeth);
					if (afterByCheck == null) {
						final PerfidixMethodInvocationException afterByInvok = BenchmarkExecutor
								.invokeMethod(objectToUse,
										AfterBenchClass.class, afterClassMeth);
						if (afterByInvok != null) {
							res.addException(afterByInvok);
						}
					} else {
						res.addException(afterByCheck);
					}
				}
			}
		}
	}

	/**
	 * Getting all Benchmarkable methods out of the registered class.
	 *
	 * @return a Set with {@link BenchmarkMethod}
	 * @throws PerfidixMethodCheckException
	 */
	List<BenchmarkMethod> getBenchmarkMethods()
			throws PerfidixMethodCheckException {
		// Generating Set for returnVal
		final List<BenchmarkMethod> elems = new ArrayList<BenchmarkMethod>();
		// Getting all Methods and testing if its benchmarkable
		for (final Class<?> clazz : clazzes) {
			for (final Method meth : clazz.getDeclaredMethods()) {
				// Check if benchmarkable, if so, insert to returnVal;
				if (BenchmarkMethod.isBenchmarkable(meth)) {
					final BenchmarkMethod benchmarkMeth = new BenchmarkMethod(
							meth);
					elems.add(benchmarkMeth);
				}
			}
		}
		return elems;
	}

	/**
	 * Getting all benchmarkable objects out of the registered classes with the
	 * annotated number of runs.
	 *
	 * @param paramObjs
	 *            a set with all existing objects for getting data from the
	 *            dataproviders
	 * @return a Set with {@link BenchmarkMethod}
	 * @throws PerfidixMethodCheckException
	 */
	private List<BenchmarkElement> getBenchmarkElements(
			final Map<Class<?>, Object> paramObjs)
			throws PerfidixMethodCheckException {

		final List<BenchmarkElement> elems = new ArrayList<BenchmarkElement>();
		final List<BenchmarkMethod> meths = getBenchmarkMethods();

		for (final BenchmarkMethod meth : meths) {

			final Method dataProv = meth.getDataProvider();
			// Test if benchmark is parameterized. If not..
			if (dataProv == null) {
				// ...simple execute the benchrun on the base of the runs set...
				int numberOfRuns = BenchmarkMethod
						.getNumberOfAnnotatedRuns(meth.getMethodToBench());
				if (numberOfRuns == Bench.NONE_RUN) {
					numberOfRuns = conf.getRuns();
				}

				// ...and adding this number of
				// elements to the set to be evaluated.
				for (int i = 0; i < numberOfRuns; i++) {
					elems.add(new BenchmarkElement(meth));
				}
			}// If the method is parameterized...
			else {
				// ..get the parameters
				final Object[][] dataProvider = getDataProviderContent(
						dataProv, paramObjs.get(meth.getMethodToBench()
								.getDeclaringClass()));
				for (final Object[] parameterSet : dataProvider) {
					elems.add(new BenchmarkElement(meth, parameterSet));
				}

				// TODO continue over here
			}
		}

		return elems;
	}
}


text:
@charset "UTF-8";

@import "default.css";
@import "base.css";
@import "layout.css";
@import "contents.css";
@import url(//fonts.googleapis.com/earlyaccess/notosansjapanese.css);


text:
"""
Functional tests for the File store interface
"""

import os
import os.path

import fixtures
import oslo.config.cfg
import testtools

import glance.store.filesystem
import glance.tests.functional.store as store_tests

class TestFilesystemStore(store_tests.BaseTestCase, testtools.TestCase):

    store_cls_path = 'glance.store.filesystem.Store'
    store_cls = glance.store.filesystem.Store
    store_name = 'filesystem'

    def setUp(self):
        super(TestFilesystemStore, self).setUp()
        self.tmp_dir = self.useFixture(fixtures.TempDir()).path

        self.store_dir = os.path.join(self.tmp_dir, 'images')
        os.mkdir(self.store_dir)

        config_file = os.path.join(self.tmp_dir, 'glance.conf')
        with open(config_file, 'w') as fap:
            fap.write("[DEFAULT]\n")
            fap.write("filesystem_store_datadir=%s" % self.store_dir)

        oslo.config.cfg.CONF(default_config_files=[config_file], args=[])

    def get_store(self, **kwargs):
        store = glance.store.filesystem.Store(context=kwargs.get('context'))
        store.configure()
        store.configure_add()
        return store

    def stash_image(self, image_id, image_data):
        filepath = os.path.join(self.store_dir, image_id)
        with open(filepath, 'w') as fap:
            fap.write(image_data)
        return 'file://%s' % filepath


text:
function toggleElement(elementId, displayStyle)
{
    var current = getStyle(elementId, 'display');
    document.getElementById(elementId).style.display = (current == 'none' ? displayStyle : 'none');
}

function getStyle(elementId, property)
{
    var element = document.getElementById(elementId);
    return element.currentStyle ? element.currentStyle[property]
           : document.defaultView.getComputedStyle(element, null).getPropertyValue(property);
}

function toggle(toggleId)
{
    var toggle;
    if (document.getElementById)
    {
        toggle = document.getElementById(toggleId);
    }
    else if (document.all)
    {
        toggle = document.all[toggleId];
    }
    toggle.textContent = toggle.innerHTML == '\u25b6' ? '\u25bc' : '\u25b6';
}


text:
#ifndef GLFIGURE_HPP
#define GLFIGURE_HPP

#include "common.hpp"
#include "globject.hpp"
#include <GL/gl.h>
#include <vector>
#include "figure.hpp"

class glfigure: public globject
{
public:
    GLfloat solid[4], wired[4];

    glfigure();
    glfigure(const figure &, const GLfloat solidc[4], const GLfloat wiredc[4]);
    virtual void draw();
    virtual glfigure *do_clone();
private:
    figure f;
};

#endif // GLFIGURE_HPP


text:
import cycles.b
import cycles.f


text:
<?php
/**
 * Update to 3.0.13
 *
 * @package SimpleCalendar/Updates
 */
namespace SimpleCalendar\Updates;

use Carbon\Carbon;
use SimpleCalendar\Post_Types;

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

/**
 * Update to 3.0.13
 */
class Update_V3013 {

	/**
	 * Update posts and options.
	 *
	 * @param array $posts
	 */
	public function __construct( $posts ) {

		$this->update_options();
	}

	/**
	 * Update options.
	 */
	public function update_options() {

		$settings_advanced = get_option( 'simple-calendar_settings_advanced' );

		// Remove stored always_enqueue value
		if ( isset( $settings_advanced['assets']['always_enqueue'] ) ) {
			unset( $settings_advanced['assets']['always_enqueue'] );
		}

		// Remove stored disable_js value
		if ( isset( $settings_advanced['assets']['disable_js'] ) ) {
			unset( $settings_advanced['assets']['disable_js'] );
		}

		update_option( 'simple-calendar_settings_advanced', $settings_advanced );

		// Delete legacy options.
		delete_option( 'simple-calendar_defaults' );
	}

}


text:
module HungryForm
  HungryFormException = Class.new(StandardError)
end


text:
namespace llvm {

class GlobalValue;
class Type;

/// This struct contains the mappings from the slot numbers to unnamed metadata
/// nodes, global values and types. It also contains the mapping for the named
/// types.
/// It can be used to save the parsing state of an LLVM IR module so that the
/// textual references to the values in the module can be parsed outside of the
/// module's source.
struct SlotMapping {
  std::vector<GlobalValue *> GlobalValues;
  std::map<unsigned, TrackingMDNodeRef> MetadataNodes;
  StringMap<Type *> NamedTypes;
  std::map<unsigned, Type *> Types;
};

} // end namespace llvm

#endif


text:
layout: page
title: Installation
permalink: /install/
---

See [Installing the Tools](https://github.com/ZettelGeist/zettelgeist/wiki/Installing-the-Tools).