text:
define(['services/unitofwork', 'services/utils'],function (unitofwork, utils) {

    return {
        donors: ko.observableArray(),
        contacts: ko.observableArray(),
        addressTypes: ko.observableArray(),
        contactPhoneTypes: ko.observableArray(),
        donorPhoneTypes: ko.observableArray(),

        viewAttached: function () {
            var self = this,
            uow = unitofwork.create();

            uow.definitions.all()
                .then(function (data) {

                    self.addressTypes(utils.getDefinitions(data, 'address_type'));
                    self.contactPhoneTypes(utils.getDefinitions(data, 'phone_type', 'contact'));
                    self.donorPhoneTypes(utils.getDefinitions(data, 'phone_type', 'donor'));
                    //self.activityTypes(getDefinitions(data, 'activity_type'));

                }).fail(function (error) {
                    alert(error);
                });

            //self.addressTypes(uow.addressTypes);
            //uow.addressTypes.then(function (data) {
            //    self.addressTypes(data);
            //}).fail(function (error) {
            //    alert(error);
            //});
            //uow.contactPhoneTypes.then(function (data) {
            //    self.contactPhoneTypes(data);
            //}).fail(function (error) {
            //    alert(error);
            //});
            //uow.donorPhoneTypes.then(function (data) {
            //    self.donorPhoneTypes(data);
            //}).fail(function (error) {
            //    alert(error);
            //});
            //self.contactPhoneTypes(uow.contactPhoneTypes);
            //self.donorPhoneTypes(uow.donorPhoneTypes);
            //uow.addressTypes.all().then(function (data) {
            //    console.log(data);
            //});
            //uow.tags.all().then(function (data) {
            //    console.log(data);
            //});
            uow.donors.all().then(function (data) {
                self.donors(data);
                Stashy.Table("#donors", { idprefix: "art-", menuClass: "btn btn-primary" }).on();
            });
            uow.contacts.all().then(function (data) {
                self.contacts(data);
                Stashy.Table("#contacts", { idprefix: "art-", menuClass: "btn btn-primary" }).on();
            });
        },
        activate: function () {
            ga('send', 'pageview', { 'page': window.location.href, 'title': document.title });
        }
    }
});

redpajama_set_name: RedPajamaGithub


text:
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 297028 $ -->
<refentry xml:id="function.stream-wrapper-unregister" xmlns="http://docbook.org/ns/docbook">
 <refnamediv>
  <refname>stream_wrapper_unregister</refname>
  <refpurpose>Unregister a URL wrapper</refpurpose>
 </refnamediv>
 <refsect1 role="description">
  &reftitle.description;
  <methodsynopsis>
   <type>bool</type><methodname>stream_wrapper_unregister</methodname>
   <methodparam><type>string</type><parameter>protocol</parameter></methodparam>
  </methodsynopsis>
  <para>
   Allows you to disable an already defined stream wrapper. Once the wrapper
   has been disabled you may override it with a user-defined wrapper using
   <function>stream_wrapper_register</function> or reenable it later on with
   <function>stream_wrapper_restore</function>.
  </para>
 </refsect1>
 <refsect1 role="parameters">
  &reftitle.parameters;
  <para>
   <variablelist>
    <varlistentry>
     <term><parameter>protocol</parameter></term>
     <listitem>
      <para>
      </para>
     </listitem>
    </varlistentry>
   </variablelist>
  </para>
 </refsect1>
 <refsect1 role="returnvalues">
  &reftitle.returnvalues;
  <para>
   &return.success;
  </para>
 </refsect1>
</refentry>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->


text:
package net.orfjackal.pommac;

import net.orfjackal.pommac.util.FileUtil;

import java.io.File;
import java.util.*;
import java.util.regex.*;

/**
 * @author Esko Luontola
 * @since 1.3.2008
 */
public final class ExpressionInterpreter {

    private ExpressionInterpreter() {
    }

    public static String evaluate(File workDir, String expression) {
        List<String> words = splitWords(expression);
        if (words.size() == 1) {
            return words.get(0);
        }
        String pathQuery = words.get(0);
        String op1 = words.get(1);
        String regex = words.get(2);
        String op2 = words.get(3);
        String format = words.get(4);

        FileLocator locator = new FileLocator();
        String result;
        try {
            File file = locator.findFile(workDir, pathQuery);
            String haystack = dataForMatching(op1, file);
            String[] groups = findMatches(regex, haystack);
            result = format(op2, format, groups);
        } finally {
            locator.dispose();
        }
        return result;
    }

    private static List<String> splitWords(String s) {
        List<String> words = new ArrayList<String>();
        Scanner in = new Scanner(s);
        while (in.hasNext()) {
            words.add(in.next());
        }
        return words;
    }

    private static String dataForMatching(String op, File file) {
        if (op.equals("|")) {
            return file.getName();
        } else if (op.equals(">>")) {
            return FileUtil.contentsOf(file);
        } else {
            throw new IllegalArgumentException("Unknown operator: " + op);
        }
    }

    private static String[] findMatches(String regex, String s) {
        Matcher m = Pattern.compile(regex).matcher(s);
        if (m.find()) {
            return groupsToArray(m);
        }
        throw new IllegalArgumentException("'" + regex + "' does not match '" + s + "'");
    }

    private static String[] groupsToArray(Matcher m) {
        String[] groups = new String[m.groupCount()];
        for (int i = 0; i < groups.length; i++) {
            groups[i] = m.group(i + 1);
        }
        return groups;
    }

    private static String format(String op, String format, String[] args) {
        if (op.equals(">>")) {
            return String.format(format, (Object[]) args);
        } else {
            throw new IllegalArgumentException("Unknown operator: " + op);
        }
    }
}


text:
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:aop="http://www.springframework.org/schema/aop">
  <bean id="newName"/>
  <aop:config>
    <aop:aspect ref="newName">
      <aop:before pointcut="bean(n<caret>ewName)"/>
    </aop:aspect>
  </aop:config>
</beans>


text:
using System;
using System.Threading;
using Microsoft.ApplicationServer.Caching;
using NUnit.Framework;
using OneCache.AppFabric.SystemTests.Infrastructure.PS;
using OneCache.Regions;

namespace OneCache.AppFabric.SystemTests
{
	[TestFixture]
	public class CacheUnavailableTests
	{
		[TearDown]
		public void OnTearDown()
		{
			try
			{
				AppFabricPowerShell.RunAppFabricCommands(StartCacheClusterCommand);
				Thread.Sleep(3000);
			}
			catch
			{
				Console.WriteLine("CacheUnavailableTests - OnTearDown. Could not {0}", StartCacheClusterCommand);
			}
		}

		private static OneCache.DistributedCache GetCacheProvider()
		{
			return new OneCache.DistributedCache(NamespaceSetup.CacheName, NamespaceSetup.ProductInstancePrefix,
				new DistributedCacheFactory(new CacheConfiguration(new DataCacheFactoryConfiguration(), false)));
		}

		private static string GetSomething()
		{
			return Guid.NewGuid().ToString();
		}

		[Test]
		public void WhenCacheIsDownCanInvoke_Operation()
		{
			using (var target = GetCacheProvider())
			{
				AppFabricPowerShell.RunAppFabricCommands(StopCacheClusterCommand);
				var key = GetSomething();

				Assert.DoesNotThrow(() => target.Add(key, _testRegion, new object()));
			}
		}

		[Explicit]
		[Test]
		public void WhenCacheIsDownCanInvoke_Operation_OnceIsUp()
		{
			using (var target = GetCacheProvider())
			{
				AppFabricPowerShell.RunAppFabricCommands(StopCacheClusterCommand);
				var key = GetSomething();

				Assert.DoesNotThrow(() => target.Add(key, _testRegion, GetSomething()));

				AppFabricPowerShell.RunAppFabricCommands(StartCacheClusterCommand);
				Thread.Sleep(3000);
				//NamespaceSetup.SetUp();
				//first time wakes up the manager
				target.Add(key, _testRegion, GetSomething());
				Assert.IsNull(target.Get<object>(key, _testRegion));
				Thread.Sleep(TimeSpan.FromSeconds(31)); //Timespan between checks
				target.Get<object>(key, _testRegion); //this checks availability
				Thread.Sleep(3000);

				//second time should be up
				var expected = GetSomething();
				target.Add(key, _testRegion, expected);
				var actual = target.Get<object>(key, _testRegion);
				Assert.IsNotNull(actual);
				Assert.AreEqual(expected, actual);
			}
		}

		private const string StartCacheClusterCommand = "Start-CacheCluster";
		private const string StopCacheClusterCommand = "Stop-CacheCluster";
		private readonly ICacheRegion _testRegion = new CacheRegionProvider().GetByEnum(RegionName.RegionName1);
	}
}


text:
/*
 * DO NOT EDIT.  THIS FILE IS GENERATED FROM e:/builds/moz2_slave/rel-m-rel-xr-w32-bld/build/content/base/public/nsIDOMFileReader.idl
 */

#ifndef __gen_nsIDOMFileReader_h__
#define __gen_nsIDOMFileReader_h__

#ifndef __gen_nsIDOMEventTarget_h__
#include "nsIDOMEventTarget.h"
#endif

#include "jspubtd.h"

/* For IDL files that don't want to include root IDL files. */
#ifndef NS_NO_VTABLE
#define NS_NO_VTABLE
#endif
class nsIDOMEventListener; /* forward declaration */

class nsIDOMBlob; /* forward declaration */

class nsIDOMDOMError; /* forward declaration */

/* starting interface:    nsIDOMFileReader */
#define NS_IDOMFILEREADER_IID_STR "faed1779-b523-4060-8c3b-7199f347b273"

#define NS_IDOMFILEREADER_IID \
  {0xfaed1779, 0xb523, 0x4060, \
    { 0x8c, 0x3b, 0x71, 0x99, 0xf3, 0x47, 0xb2, 0x73 }}

class NS_NO_VTABLE NS_SCRIPTABLE nsIDOMFileReader : public nsIDOMEventTarget {
 public:

  NS_DECLARE_STATIC_IID_ACCESSOR(NS_IDOMFILEREADER_IID)

  /* [implicit_jscontext] void readAsArrayBuffer (in nsIDOMBlob filedata); */
  NS_SCRIPTABLE NS_IMETHOD ReadAsArrayBuffer(nsIDOMBlob *filedata, JSContext* cx) = 0;

  /* void readAsBinaryString (in nsIDOMBlob filedata); */
  NS_SCRIPTABLE NS_IMETHOD ReadAsBinaryString(nsIDOMBlob *filedata) = 0;

  /* void readAsText (in nsIDOMBlob filedata, [optional] in DOMString encoding); */
  NS_SCRIPTABLE NS_IMETHOD ReadAsText(nsIDOMBlob *filedata, const nsAString & encoding) = 0;

  /* void readAsDataURL (in nsIDOMBlob file); */
  NS_SCRIPTABLE NS_IMETHOD ReadAsDataURL(nsIDOMBlob *file) = 0;

  /* void abort (); */
  NS_SCRIPTABLE NS_IMETHOD Abort(void) = 0;

  enum {
    EMPTY = 0U,
    LOADING = 1U,
    DONE = 2U
  };

  /* readonly attribute unsigned short readyState; */
  NS_SCRIPTABLE NS_IMETHOD GetReadyState(PRUint16 *aReadyState) = 0;

  /* [implicit_jscontext] readonly attribute jsval result; */
  NS_SCRIPTABLE NS_IMETHOD GetResult(JSContext* cx, JS::Value *aResult) = 0;

  /* readonly attribute nsIDOMDOMError error; */
  NS_SCRIPTABLE NS_IMETHOD GetError(nsIDOMDOMError * *aError) = 0;

  /* attribute nsIDOMEventListener onloadstart; */
  NS_SCRIPTABLE NS_IMETHOD GetOnloadstart(nsIDOMEventListener * *aOnloadstart) = 0;
  NS_SCRIPTABLE NS_IMETHOD SetOnloadstart(nsIDOMEventListener *aOnloadstart) = 0;

  /* attribute nsIDOMEventListener onprogress; */
  NS_SCRIPTABLE NS_IMETHOD GetOnprogress(nsIDOMEventListener * *aOnprogress) = 0;
  NS_SCRIPTABLE NS_IMETHOD SetOnprogress(nsIDOMEventListener *aOnprogress) = 0;

  /* attribute nsIDOMEventListener onload; */
  NS_SCRIPTABLE NS_IMETHOD GetOnload(nsIDOMEventListener * *aOnload) = 0;
  NS_SCRIPTABLE NS_IMETHOD SetOnload(nsIDOMEventListener *aOnload) = 0;

  /* attribute nsIDOMEventListener onabort; */
  NS_SCRIPTABLE NS_IMETHOD GetOnabort(nsIDOMEventListener * *aOnabort) = 0;
  NS_SCRIPTABLE NS_IMETHOD SetOnabort(nsIDOMEventListener *aOnabort) = 0;

  /* attribute nsIDOMEventListener onerror; */
  NS_SCRIPTABLE NS_IMETHOD GetOnerror(nsIDOMEventListener * *aOnerror) = 0;
  NS_SCRIPTABLE NS_IMETHOD SetOnerror(nsIDOMEventListener *aOnerror) = 0;

  /* attribute nsIDOMEventListener onloadend; */
  NS_SCRIPTABLE NS_IMETHOD GetOnloadend(nsIDOMEventListener * *aOnloadend) = 0;
  NS_SCRIPTABLE NS_IMETHOD SetOnloadend(nsIDOMEventListener *aOnloadend) = 0;

};

  NS_DEFINE_STATIC_IID_ACCESSOR(nsIDOMFileReader, NS_IDOMFILEREADER_IID)

/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_NSIDOMFILEREADER \
  NS_SCRIPTABLE NS_IMETHOD ReadAsArrayBuffer(nsIDOMBlob *filedata, JSContext* cx); \
  NS_SCRIPTABLE NS_IMETHOD ReadAsBinaryString(nsIDOMBlob *filedata); \
  NS_SCRIPTABLE NS_IMETHOD ReadAsText(nsIDOMBlob *filedata, const nsAString & encoding); \
  NS_SCRIPTABLE NS_IMETHOD ReadAsDataURL(nsIDOMBlob *file); \
  NS_SCRIPTABLE NS_IMETHOD Abort(void); \
  NS_SCRIPTABLE NS_IMETHOD GetReadyState(PRUint16 *aReadyState); \
  NS_SCRIPTABLE NS_IMETHOD GetResult(JSContext* cx, JS::Value *aResult); \
  NS_SCRIPTABLE NS_IMETHOD GetError(nsIDOMDOMError * *aError); \
  NS_SCRIPTABLE NS_IMETHOD GetOnloadstart(nsIDOMEventListener * *aOnloadstart); \
  NS_SCRIPTABLE NS_IMETHOD SetOnloadstart(nsIDOMEventListener *aOnloadstart); \
  NS_SCRIPTABLE NS_IMETHOD GetOnprogress(nsIDOMEventListener * *aOnprogress); \
  NS_SCRIPTABLE NS_IMETHOD SetOnprogress(nsIDOMEventListener *aOnprogress); \
  NS_SCRIPTABLE NS_IMETHOD GetOnload(nsIDOMEventListener * *aOnload); \
  NS_SCRIPTABLE NS_IMETHOD SetOnload(nsIDOMEventListener *aOnload); \
  NS_SCRIPTABLE NS_IMETHOD GetOnabort(nsIDOMEventListener * *aOnabort); \
  NS_SCRIPTABLE NS_IMETHOD SetOnabort(nsIDOMEventListener *aOnabort); \
  NS_SCRIPTABLE NS_IMETHOD GetOnerror(nsIDOMEventListener * *aOnerror); \
  NS_SCRIPTABLE NS_IMETHOD SetOnerror(nsIDOMEventListener *aOnerror); \
  NS_SCRIPTABLE NS_IMETHOD GetOnloadend(nsIDOMEventListener * *aOnloadend); \
  NS_SCRIPTABLE NS_IMETHOD SetOnloadend(nsIDOMEventListener *aOnloadend);

/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_NSIDOMFILEREADER(_to) \
  NS_SCRIPTABLE NS_IMETHOD ReadAsArrayBuffer(nsIDOMBlob *filedata, JSContext* cx) { return _to ReadAsArrayBuffer(filedata, cx); } \
  NS_SCRIPTABLE NS_IMETHOD ReadAsBinaryString(nsIDOMBlob *filedata) { return _to ReadAsBinaryString(filedata); } \
  NS_SCRIPTABLE NS_IMETHOD ReadAsText(nsIDOMBlob *filedata, const nsAString & encoding) { return _to ReadAsText(filedata, encoding); } \
  NS_SCRIPTABLE NS_IMETHOD ReadAsDataURL(nsIDOMBlob *file) { return _to ReadAsDataURL(file); } \
  NS_SCRIPTABLE NS_IMETHOD Abort(void) { return _to Abort(); } \
  NS_SCRIPTABLE NS_IMETHOD GetReadyState(PRUint16 *aReadyState) { return _to GetReadyState(aReadyState); } \
  NS_SCRIPTABLE NS_IMETHOD GetResult(JSContext* cx, JS::Value *aResult) { return _to GetResult(cx, aResult); } \
  NS_SCRIPTABLE NS_IMETHOD GetError(nsIDOMDOMError * *aError) { return _to GetError(aError); } \
  NS_SCRIPTABLE NS_IMETHOD GetOnloadstart(nsIDOMEventListener * *aOnloadstart) { return _to GetOnloadstart(aOnloadstart); } \
  NS_SCRIPTABLE NS_IMETHOD SetOnloadstart(nsIDOMEventListener *aOnloadstart) { return _to SetOnloadstart(aOnloadstart); } \
  NS_SCRIPTABLE NS_IMETHOD GetOnprogress(nsIDOMEventListener * *aOnprogress) { return _to GetOnprogress(aOnprogress); } \
  NS_SCRIPTABLE NS_IMETHOD SetOnprogress(nsIDOMEventListener *aOnprogress) { return _to SetOnprogress(aOnprogress); } \
  NS_SCRIPTABLE NS_IMETHOD GetOnload(nsIDOMEventListener * *aOnload) { return _to GetOnload(aOnload); } \
  NS_SCRIPTABLE NS_IMETHOD SetOnload(nsIDOMEventListener *aOnload) { return _to SetOnload(aOnload); } \
  NS_SCRIPTABLE NS_IMETHOD GetOnabort(nsIDOMEventListener * *aOnabort) { return _to GetOnabort(aOnabort); } \
  NS_SCRIPTABLE NS_IMETHOD SetOnabort(nsIDOMEventListener *aOnabort) { return _to SetOnabort(aOnabort); } \
  NS_SCRIPTABLE NS_IMETHOD GetOnerror(nsIDOMEventListener * *aOnerror) { return _to GetOnerror(aOnerror); } \
  NS_SCRIPTABLE NS_IMETHOD SetOnerror(nsIDOMEventListener *aOnerror) { return _to SetOnerror(aOnerror); } \
  NS_SCRIPTABLE NS_IMETHOD GetOnloadend(nsIDOMEventListener * *aOnloadend) { return _to GetOnloadend(aOnloadend); } \
  NS_SCRIPTABLE NS_IMETHOD SetOnloadend(nsIDOMEventListener *aOnloadend) { return _to SetOnloadend(aOnloadend); }

/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
#define NS_FORWARD_SAFE_NSIDOMFILEREADER(_to) \
  NS_SCRIPTABLE NS_IMETHOD ReadAsArrayBuffer(nsIDOMBlob *filedata, JSContext* cx) { return !_to ? NS_ERROR_NULL_POINTER : _to->ReadAsArrayBuffer(filedata, cx); } \
  NS_SCRIPTABLE NS_IMETHOD ReadAsBinaryString(nsIDOMBlob *filedata) { return !_to ? NS_ERROR_NULL_POINTER : _to->ReadAsBinaryString(filedata); } \
  NS_SCRIPTABLE NS_IMETHOD ReadAsText(nsIDOMBlob *filedata, const nsAString & encoding) { return !_to ? NS_ERROR_NULL_POINTER : _to->ReadAsText(filedata, encoding); } \
  NS_SCRIPTABLE NS_IMETHOD ReadAsDataURL(nsIDOMBlob *file) { return !_to ? NS_ERROR_NULL_POINTER : _to->ReadAsDataURL(file); } \
  NS_SCRIPTABLE NS_IMETHOD Abort(void) { return !_to ? NS_ERROR_NULL_POINTER : _to->Abort(); } \
  NS_SCRIPTABLE NS_IMETHOD GetReadyState(PRUint16 *aReadyState) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetReadyState(aReadyState); } \
  NS_SCRIPTABLE NS_IMETHOD GetResult(JSContext* cx, JS::Value *aResult) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetResult(cx, aResult); } \
  NS_SCRIPTABLE NS_IMETHOD GetError(nsIDOMDOMError * *aError) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetError(aError); } \
  NS_SCRIPTABLE NS_IMETHOD GetOnloadstart(nsIDOMEventListener * *aOnloadstart) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetOnloadstart(aOnloadstart); } \
  NS_SCRIPTABLE NS_IMETHOD SetOnloadstart(nsIDOMEventListener *aOnloadstart) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetOnloadstart(aOnloadstart); } \
  NS_SCRIPTABLE NS_IMETHOD GetOnprogress(nsIDOMEventListener * *aOnprogress) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetOnprogress(aOnprogress); } \
  NS_SCRIPTABLE NS_IMETHOD SetOnprogress(nsIDOMEventListener *aOnprogress) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetOnprogress(aOnprogress); } \
  NS_SCRIPTABLE NS_IMETHOD GetOnload(nsIDOMEventListener * *aOnload) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetOnload(aOnload); } \
  NS_SCRIPTABLE NS_IMETHOD SetOnload(nsIDOMEventListener *aOnload) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetOnload(aOnload); } \
  NS_SCRIPTABLE NS_IMETHOD GetOnabort(nsIDOMEventListener * *aOnabort) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetOnabort(aOnabort); } \
  NS_SCRIPTABLE NS_IMETHOD SetOnabort(nsIDOMEventListener *aOnabort) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetOnabort(aOnabort); } \
  NS_SCRIPTABLE NS_IMETHOD GetOnerror(nsIDOMEventListener * *aOnerror) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetOnerror(aOnerror); } \
  NS_SCRIPTABLE NS_IMETHOD SetOnerror(nsIDOMEventListener *aOnerror) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetOnerror(aOnerror); } \
  NS_SCRIPTABLE NS_IMETHOD GetOnloadend(nsIDOMEventListener * *aOnloadend) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetOnloadend(aOnloadend); } \
  NS_SCRIPTABLE NS_IMETHOD SetOnloadend(nsIDOMEventListener *aOnloadend) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetOnloadend(aOnloadend); }

#if 0
/* Use the code below as a template for the implementation class for this interface. */

/* Header file */
class nsDOMFileReader : public nsIDOMFileReader
{
public:
  NS_DECL_ISUPPORTS
  NS_DECL_NSIDOMFILEREADER

  nsDOMFileReader();

private:
  ~nsDOMFileReader();

protected:
  /* additional members */
};

/* Implementation file */
NS_IMPL_ISUPPORTS1(nsDOMFileReader, nsIDOMFileReader)

nsDOMFileReader::nsDOMFileReader()
{
  /* member initializers and constructor code */
}

nsDOMFileReader::~nsDOMFileReader()
{
  /* destructor code */
}

/* [implicit_jscontext] void readAsArrayBuffer (in nsIDOMBlob filedata); */
NS_IMETHODIMP nsDOMFileReader::ReadAsArrayBuffer(nsIDOMBlob *filedata, JSContext* cx)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* void readAsBinaryString (in nsIDOMBlob filedata); */
NS_IMETHODIMP nsDOMFileReader::ReadAsBinaryString(nsIDOMBlob *filedata)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* void readAsText (in nsIDOMBlob filedata, [optional] in DOMString encoding); */
NS_IMETHODIMP nsDOMFileReader::ReadAsText(nsIDOMBlob *filedata, const nsAString & encoding)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* void readAsDataURL (in nsIDOMBlob file); */
NS_IMETHODIMP nsDOMFileReader::ReadAsDataURL(nsIDOMBlob *file)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* void abort (); */
NS_IMETHODIMP nsDOMFileReader::Abort()
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* readonly attribute unsigned short readyState; */
NS_IMETHODIMP nsDOMFileReader::GetReadyState(PRUint16 *aReadyState)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* [implicit_jscontext] readonly attribute jsval result; */
NS_IMETHODIMP nsDOMFileReader::GetResult(JSContext* cx, JS::Value *aResult)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* readonly attribute nsIDOMDOMError error; */
NS_IMETHODIMP nsDOMFileReader::GetError(nsIDOMDOMError * *aError)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* attribute nsIDOMEventListener onloadstart; */
NS_IMETHODIMP nsDOMFileReader::GetOnloadstart(nsIDOMEventListener * *aOnloadstart)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsDOMFileReader::SetOnloadstart(nsIDOMEventListener *aOnloadstart)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* attribute nsIDOMEventListener onprogress; */
NS_IMETHODIMP nsDOMFileReader::GetOnprogress(nsIDOMEventListener * *aOnprogress)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsDOMFileReader::SetOnprogress(nsIDOMEventListener *aOnprogress)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* attribute nsIDOMEventListener onload; */
NS_IMETHODIMP nsDOMFileReader::GetOnload(nsIDOMEventListener * *aOnload)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsDOMFileReader::SetOnload(nsIDOMEventListener *aOnload)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* attribute nsIDOMEventListener onabort; */
NS_IMETHODIMP nsDOMFileReader::GetOnabort(nsIDOMEventListener * *aOnabort)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsDOMFileReader::SetOnabort(nsIDOMEventListener *aOnabort)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* attribute nsIDOMEventListener onerror; */
NS_IMETHODIMP nsDOMFileReader::GetOnerror(nsIDOMEventListener * *aOnerror)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsDOMFileReader::SetOnerror(nsIDOMEventListener *aOnerror)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* attribute nsIDOMEventListener onloadend; */
NS_IMETHODIMP nsDOMFileReader::GetOnloadend(nsIDOMEventListener * *aOnloadend)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsDOMFileReader::SetOnloadend(nsIDOMEventListener *aOnloadend)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* End of implementation class template. */
#endif

#define NS_FILEREADER_CID                            \
{0x06aa7c21, 0xfe05, 0x4cf2,                         \
{0xb1, 0xc4, 0x0c, 0x71, 0x26, 0xa4, 0xf7, 0x13}}
#define NS_FILEREADER_CONTRACTID \
"@mozilla.org/files/filereader;1"

#endif /* __gen_nsIDOMFileReader_h__ */


text:
#include <freerdp/utils/rail.h>
#include <freerdp/utils/memory.h>

#include "window.h"

void update_read_icon_info(STREAM* s, ICON_INFO* icon_info)
{
	stream_read_uint16(s, icon_info->cacheEntry); /* cacheEntry (2 bytes) */
	stream_read_uint8(s, icon_info->cacheId); /* cacheId (1 byte) */
	stream_read_uint8(s, icon_info->bpp); /* bpp (1 byte) */
	stream_read_uint16(s, icon_info->width); /* width (2 bytes) */
	stream_read_uint16(s, icon_info->height); /* height (2 bytes) */

	/* cbColorTable is only present when bpp is 1, 2 or 4 */
	if (icon_info->bpp == 1 || icon_info->bpp == 2 || icon_info->bpp == 4)
		stream_read_uint16(s, icon_info->cbColorTable); /* cbColorTable (2 bytes) */
	else
		icon_info->cbColorTable = 0;

	stream_read_uint16(s, icon_info->cbBitsMask); /* cbBitsMask (2 bytes) */
	stream_read_uint16(s, icon_info->cbBitsColor); /* cbBitsColor (2 bytes) */

	/* bitsMask */
	if (icon_info->bitsMask == NULL)
		icon_info->bitsMask = (uint8*) xmalloc(icon_info->cbBitsMask);
	else
		icon_info->bitsMask = (uint8*) xrealloc(icon_info->bitsMask, icon_info->cbBitsMask);
	stream_read(s, icon_info->bitsMask, icon_info->cbBitsMask);

	/* colorTable */
	if (icon_info->colorTable == NULL)
		icon_info->colorTable = (uint8*) xmalloc(icon_info->cbColorTable);
	else
		icon_info->colorTable = (uint8*) xrealloc(icon_info->colorTable, icon_info->cbColorTable);
	stream_read(s, icon_info->colorTable, icon_info->cbColorTable);

	/* bitsColor */
	if (icon_info->bitsColor == NULL)
		icon_info->bitsColor = (uint8*) xmalloc(icon_info->cbBitsColor);
	else
		icon_info->bitsColor = (uint8*) xrealloc(icon_info->bitsColor, icon_info->cbBitsColor);
	stream_read(s, icon_info->bitsColor, icon_info->cbBitsColor);
}

void update_read_cached_icon_info(STREAM* s, CACHED_ICON_INFO* cached_icon_info)
{
	stream_read_uint16(s, cached_icon_info->cacheEntry); /* cacheEntry (2 bytes) */
	stream_read_uint8(s, cached_icon_info->cacheId); /* cacheId (1 byte) */
}

void update_read_notify_icon_infotip(STREAM* s, NOTIFY_ICON_INFOTIP* notify_icon_infotip)
{
	stream_read_uint32(s, notify_icon_infotip->timeout); /* timeout (4 bytes) */
	stream_read_uint32(s, notify_icon_infotip->flags); /* infoFlags (4 bytes) */
	rail_read_unicode_string(s, &notify_icon_infotip->text); /* infoTipText */
	rail_read_unicode_string(s, &notify_icon_infotip->title); /* title */
}

void update_read_window_state_order(STREAM* s, WINDOW_ORDER_INFO* orderInfo, WINDOW_STATE_ORDER* window_state)
{
	int i;
	int size;

	if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_OWNER)
		stream_read_uint32(s, window_state->ownerWindowId); /* ownerWindowId (4 bytes) */

	if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_STYLE)
	{
		stream_read_uint32(s, window_state->style); /* style (4 bytes) */
		stream_read_uint32(s, window_state->extendedStyle); /* extendedStyle (4 bytes) */
	}

	if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_SHOW)
		stream_read_uint8(s, window_state->showState); /* showState (1 byte) */

	if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_TITLE)
		rail_read_unicode_string(s, &window_state->titleInfo); /* titleInfo */

	if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_CLIENT_AREA_OFFSET)
	{
		stream_read_uint32(s, window_state->clientOffsetX); /* clientOffsetX (4 bytes) */
		stream_read_uint32(s, window_state->clientOffsetY); /* clientOffsetY (4 bytes) */
	}

	if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_CLIENT_AREA_SIZE)
	{
		stream_read_uint32(s, window_state->clientAreaWidth); /* clientAreaWidth (4 bytes) */
		stream_read_uint32(s, window_state->clientAreaHeight); /* clientAreaHeight (4 bytes) */
	}

	if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_RP_CONTENT)
		stream_read_uint8(s, window_state->RPContent); /* RPContent (1 byte) */

	if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_ROOT_PARENT)
		stream_read_uint32(s, window_state->rootParentHandle);/* rootParentHandle (4 bytes) */

	if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_WND_OFFSET)
	{
		stream_read_uint32(s, window_state->windowOffsetX); /* windowOffsetX (4 bytes) */
		stream_read_uint32(s, window_state->windowOffsetY); /* windowOffsetY (4 bytes) */
	}

	if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_WND_CLIENT_DELTA)
	{
		stream_read_uint32(s, window_state->windowClientDeltaX); /* windowClientDeltaX (4 bytes) */
		stream_read_uint32(s, window_state->windowClientDeltaY); /* windowClientDeltaY (4 bytes) */
	}

	if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_WND_SIZE)
	{
		stream_read_uint32(s, window_state->windowWidth); /* windowWidth (4 bytes) */
		stream_read_uint32(s, window_state->windowHeight); /* windowHeight (4 bytes) */
	}

	if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_WND_RECTS)
	{
		stream_read_uint16(s, window_state->numWindowRects); /* numWindowRects (2 bytes) */

		size = sizeof(RECTANGLE_16) * window_state->numWindowRects;
		window_state->windowRects = (RECTANGLE_16*) xmalloc(size);

		/* windowRects */
		for (i = 0; i < (int) window_state->numWindowRects; i++)
		{
			freerdp_read_rectangle_16(s, &window_state->windowRects[i]);
		}
	}

	if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_VIS_OFFSET)
	{
		stream_read_uint32(s, window_state->visibleOffsetX); /* visibleOffsetX (4 bytes) */
		stream_read_uint32(s, window_state->visibleOffsetY); /* visibleOffsetY (4 bytes) */
	}

	if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_VISIBILITY)
	{
		stream_read_uint16(s, window_state->numVisibilityRects); /* numVisibilityRects (2 bytes) */

		size = sizeof(RECTANGLE_16) * window_state->numVisibilityRects;
		window_state->visibilityRects = (RECTANGLE_16*) xmalloc(size);

		/* visibilityRects */
		for (i = 0; i < (int) window_state->numVisibilityRects; i++)
		{
			freerdp_read_rectangle_16(s, &window_state->visibilityRects[i]);
		}
	}
}

void update_read_window_icon_order(STREAM* s, WINDOW_ORDER_INFO* orderInfo, WINDOW_ICON_ORDER* window_icon)
{
	window_icon->iconInfo = (ICON_INFO*) xzalloc(sizeof(ICON_INFO));
	update_read_icon_info(s, window_icon->iconInfo); /* iconInfo (ICON_INFO) */
}

void update_read_window_cached_icon_order(STREAM* s, WINDOW_ORDER_INFO* orderInfo, WINDOW_CACHED_ICON_ORDER* window_cached_icon)
{
	update_read_cached_icon_info(s, &window_cached_icon->cachedIcon); /* cachedIcon (CACHED_ICON_INFO) */
}

void update_read_window_delete_order(STREAM* s, WINDOW_ORDER_INFO* orderInfo)
{
	/* window deletion event */
}

void update_recv_window_info_order(rdpUpdate* update, STREAM* s, WINDOW_ORDER_INFO* orderInfo)
{
	rdpContext* context = update->context;
	rdpWindowUpdate* window = update->window;

	stream_read_uint32(s, orderInfo->windowId); /* windowId (4 bytes) */

	if (orderInfo->fieldFlags & WINDOW_ORDER_ICON)
	{
		DEBUG_WND("Window Icon Order");
		update_read_window_icon_order(s, orderInfo, &window->window_icon);
		IFCALL(window->WindowIcon, context, orderInfo, &window->window_icon);
	}
	else if (orderInfo->fieldFlags & WINDOW_ORDER_CACHED_ICON)
	{
		DEBUG_WND("Window Cached Icon Order");
		update_read_window_cached_icon_order(s, orderInfo, &window->window_cached_icon);
		IFCALL(window->WindowCachedIcon, context, orderInfo, &window->window_cached_icon);
	}
	else if (orderInfo->fieldFlags & WINDOW_ORDER_STATE_DELETED)
	{
		DEBUG_WND("Window Deleted Order");
		update_read_window_delete_order(s, orderInfo);
		IFCALL(window->WindowDelete, context, orderInfo);
	}
	else
	{
		DEBUG_WND("Window State Order");
		update_read_window_state_order(s, orderInfo, &window->window_state);

		if (orderInfo->fieldFlags & WINDOW_ORDER_STATE_NEW)
			IFCALL(window->WindowCreate, context, orderInfo, &window->window_state);
		else
			IFCALL(window->WindowUpdate, context, orderInfo, &window->window_state);
	}
}

void update_read_notification_icon_state_order(STREAM* s, WINDOW_ORDER_INFO* orderInfo, NOTIFY_ICON_STATE_ORDER* notify_icon_state)
{
	if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_NOTIFY_VERSION)
		stream_read_uint32(s, notify_icon_state->version); /* version (4 bytes) */

	if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_NOTIFY_TIP)
		rail_read_unicode_string(s, &notify_icon_state->toolTip); /* toolTip (UNICODE_STRING) */

	if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_NOTIFY_INFO_TIP)
		update_read_notify_icon_infotip(s, &notify_icon_state->infoTip); /* infoTip (NOTIFY_ICON_INFOTIP) */

	if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_NOTIFY_STATE)
		stream_read_uint32(s, notify_icon_state->state); /* state (4 bytes) */

	if (orderInfo->fieldFlags & WINDOW_ORDER_ICON)
		update_read_icon_info(s, &notify_icon_state->icon); /* icon (ICON_INFO) */

	if (orderInfo->fieldFlags & WINDOW_ORDER_CACHED_ICON)
		update_read_cached_icon_info(s, &notify_icon_state->cachedIcon); /* cachedIcon (CACHED_ICON_INFO) */
}

void update_read_notification_icon_delete_order(STREAM* s, WINDOW_ORDER_INFO* orderInfo)
{
	/* notification icon deletion event */
}

void update_recv_notification_icon_info_order(rdpUpdate* update, STREAM* s, WINDOW_ORDER_INFO* orderInfo)
{
	rdpContext* context = update->context;
	rdpWindowUpdate* window = update->window;

	stream_read_uint32(s, orderInfo->windowId); /* windowId (4 bytes) */
	stream_read_uint32(s, orderInfo->notifyIconId); /* notifyIconId (4 bytes) */

	if (orderInfo->fieldFlags & WINDOW_ORDER_STATE_DELETED)
	{
		DEBUG_WND("Delete Notification Icon Deleted Order");
		update_read_notification_icon_delete_order(s, orderInfo);
		IFCALL(window->NotifyIconDelete, context, orderInfo);
	}
	else
	{
		DEBUG_WND("Notification Icon State Order");
		update_read_notification_icon_state_order(s, orderInfo, &window->notify_icon_state);

		if (orderInfo->fieldFlags & WINDOW_ORDER_STATE_NEW)
			IFCALL(window->NotifyIconCreate, context, orderInfo, &window->notify_icon_state);
		else
			IFCALL(window->NotifyIconUpdate, context, orderInfo, &window->notify_icon_state);
	}
}

void update_read_desktop_actively_monitored_order(STREAM* s, WINDOW_ORDER_INFO* orderInfo, MONITORED_DESKTOP_ORDER* monitored_desktop)
{
	int i;
	int size;

	if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_DESKTOP_ACTIVE_WND)
		stream_read_uint32(s, monitored_desktop->activeWindowId); /* activeWindowId (4 bytes) */

	if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_DESKTOP_ZORDER)
	{
		stream_read_uint8(s, monitored_desktop->numWindowIds); /* numWindowIds (1 byte) */

		size = sizeof(uint32) * monitored_desktop->numWindowIds;

		if (monitored_desktop->windowIds == NULL)
			monitored_desktop->windowIds = (uint32*) xmalloc(size);
		else
			monitored_desktop->windowIds = (uint32*) xrealloc(monitored_desktop->windowIds, size);

		/* windowIds */
		for (i = 0; i < (int) monitored_desktop->numWindowIds; i++)
		{
			stream_read_uint32(s, monitored_desktop->windowIds[i]);
		}
	}
}

void update_read_desktop_non_monitored_order(STREAM* s, WINDOW_ORDER_INFO* orderInfo)
{
	/* non-monitored desktop notification event */
}

void update_recv_desktop_info_order(rdpUpdate* update, STREAM* s, WINDOW_ORDER_INFO* orderInfo)
{
	rdpContext* context = update->context;
	rdpWindowUpdate* window = update->window;

	if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_DESKTOP_NONE)
	{
		DEBUG_WND("Non-Monitored Desktop Order");
		update_read_desktop_non_monitored_order(s, orderInfo);
		IFCALL(window->NonMonitoredDesktop, context, orderInfo);
	}
	else
	{
		DEBUG_WND("Actively Monitored Desktop Order");
		update_read_desktop_actively_monitored_order(s, orderInfo, &window->monitored_desktop);
		IFCALL(window->MonitoredDesktop, context, orderInfo, &window->monitored_desktop);
	}
}

void update_recv_altsec_window_order(rdpUpdate* update, STREAM* s)
{
	uint16 orderSize;
	rdpWindowUpdate* window = update->window;

	stream_read_uint16(s, orderSize); /* orderSize (2 bytes) */
	stream_read_uint32(s, window->orderInfo.fieldFlags); /* FieldsPresentFlags (4 bytes) */

	if (window->orderInfo.fieldFlags & WINDOW_ORDER_TYPE_WINDOW)
		update_recv_window_info_order(update, s, &window->orderInfo);
	else if (window->orderInfo.fieldFlags & WINDOW_ORDER_TYPE_NOTIFY)
		update_recv_notification_icon_info_order(update, s, &window->orderInfo);
	else if (window->orderInfo.fieldFlags & WINDOW_ORDER_TYPE_DESKTOP)
		update_recv_desktop_info_order(update, s, &window->orderInfo);
}


text:
#region license
// Copyright (c) 2005 - 2007 Ayende Rahien (ayende@ayende.com)
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
//     * Redistributions of source code must retain the above copyright notice,
//     this list of conditions and the following disclaimer.
//     * Redistributions in binary form must reproduce the above copyright notice,
//     this list of conditions and the following disclaimer in the documentation
//     and/or other materials provided with the distribution.
//     * Neither the name of Ayende Rahien nor the names of its
//     contributors may be used to endorse or promote products derived from this
//     software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#endregion

using System;
using System.Reflection;
using Castle.Core.Interceptor;

namespace Rhino.Mocks.Interfaces
{
	/// <summary>
	/// Different actions on this mock
	/// </summary>
	public interface IMockState
	{
		/// <summary>
		/// Add a method call for this state' mock.
		/// </summary>
        /// <param name="invocation">The invocation for this method</param>
		/// <param name="method">The method that was called</param>
		/// <param name="args">The arguments this method was called with</param>
        object MethodCall(IInvocation invocation, MethodInfo method, params object[] args);

		/// <summary>
		/// Verify that this mock expectations have passed.
		/// </summary>
		void Verify();

		/// <summary>
		/// Gets the matching verify state for this state
		/// </summary>
		IMockState VerifyState { get; }

		/// <summary>
		/// Verify that we can move to replay state and move
		/// to the reply state.
		/// </summary>
		IMockState Replay();

        /// <summary>
        /// Gets a mock state that match the original mock state of the object.
        /// </summary>
        IMockState BackToRecord();

		/// <summary>
		/// Get the options for the last method call
		/// </summary>
		IMethodOptions<T> GetLastMethodOptions<T>();

		/// <summary>
		/// Get the options for the last method call
		/// </summary>
		IMethodOptions<object> LastMethodOptions { get; }

		/// <summary>
		/// Set the exception to throw when Verify is called.
		/// This is used to report exception that may have happened but where caught in the code.
		/// This way, they are reported anyway when Verify() is called.
		/// </summary>
		void SetExceptionToThrowOnVerify(Exception ex);

        /// <summary>
        /// This method is called to indicate that a property behavior call.
        /// This is done so we generate good error message in the common case of people using
        /// Stubbed properties with Return().
        /// </summary>
	    void NotifyCallOnPropertyBehavior();
	}
}


text:
Quickly learn how to rename worksheet with spreadsheet sdk in C# with this sample source code. ByteScout Data Extraction Suite is the bundle that includes three SDK tools for data extraction from PDF, scans, images and from spreadsheets: PDF Extractor SDK, Data Extraction SDK, Barcode Reader SDK and you can use it to rename worksheet with spreadsheet sdk with C#.

 These C# code samples for C# guide developers to speed up coding of the application when using ByteScout Data Extraction Suite. IF you want to implement the functionality, just copy and paste this code for C# below into your code editor with your app, compile and run your application. Want to see how it works with your data then code testing will allow the function to be tested and work properly.

You can download free trial version of ByteScout Data Extraction Suite from our website with this and other source code samples for C#.

## REQUEST FREE TECH SUPPORT

[Click here to get in touch](https://bytescout.zendesk.com/hc/en-us/requests/new?subject=ByteScout%20Data%20Extraction%20Suite%20Question)

or just send email to [support@bytescout.com](mailto:support@bytescout.com?subject=ByteScout%20Data%20Extraction%20Suite%20Question)

## ON-PREMISE OFFLINE SDK

[Get Your 60 Day Free Trial](https://bytescout.com/download/web-installer?utm_source=github-readme)
[Explore SDK Docs](https://bytescout.com/documentation/index.html?utm_source=github-readme)
[Sign Up For Online Training](https://academy.bytescout.com/)

## ON-DEMAND REST WEB API

[Get your API key](https://pdf.co/documentation/api?utm_source=github-readme)
[Explore Web API Documentation](https://pdf.co/documentation/api?utm_source=github-readme)
[Explore Web API Samples](https://github.com/bytescout/ByteScout-SDK-SourceCode/tree/master/PDF.co%20Web%20API)

## VIDEO REVIEW

[https://www.youtube.com/watch?v=NEwNs2b9YN8](https://www.youtube.com/watch?v=NEwNs2b9YN8)

<!-- code block begin -->

##### ****Program.cs:**

```
using System;
using System.Collections.Generic;
using System.Text;
using Bytescout.Spreadsheet;
using System.Diagnostics;
using System.IO;

namespace HelloWorld
{
    class Program
    {
        static void Main(string[] args)
        {
            // Create new Spreadsheet
            Spreadsheet document = new Spreadsheet();
            document.LoadFromFile("Data.xls");

            // Get worksheet by name
            Worksheet worksheet = document.Workbook.Worksheets.ByName("Sheet1");

            // Set new worksheet name
            worksheet.Name = "Collected Data Sheet";

            // delete output file if exists already
            if (File.Exists("Output.xls")){
                File.Delete("Output.xls");
            }

            // Save document
            document.SaveAs("Output.xls");

            // Close Spreadsheet
            document.Close();

            // open generated XLS document in default program
            Process.Start("Output.xls");
        }
    }
}

```

<!-- code block end -->

<!-- code block begin -->

##### ****RenameSheets.VS2005.csproj:**

```
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProductVersion>8.0.50727</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{B441ACCF-FC7C-467C-81C0-1B9D64D07BF7}</ProjectGuid>
    <OutputType>Exe</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>RenameSheets</RootNamespace>
    <AssemblyName>RenameSheets</AssemblyName>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="Bytescout.Spreadsheet, Version=1.2.0.4, Culture=neutral, PublicKeyToken=f7dd1bd9d40a50eb, processorArchitecture=MSIL">
      <SpecificVersion>False</SpecificVersion>
    </Reference>
    <Reference Include="System" />
    <Reference Include="System.Data" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <None Include="Data.xls">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </None>
  </ItemGroup>
  <ItemGroup>
    <Compile Include="Program.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
  </ItemGroup>
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>
```

<!-- code block end -->

<!-- code block begin -->

##### ****RenameSheets.VS2008.csproj:**

```
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProductVersion>9.0.21022</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{B441ACCF-FC7C-467C-81C0-1B9D64D07BF7}</ProjectGuid>
    <OutputType>Exe</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>RenameSheets</RootNamespace>
    <AssemblyName>RenameSheets</AssemblyName>
    <OldToolsVersion>2.0</OldToolsVersion>
    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="Bytescout.Spreadsheet, Version=1.2.0.4, Culture=neutral, PublicKeyToken=f7dd1bd9d40a50eb, processorArchitecture=MSIL">
      <SpecificVersion>False</SpecificVersion>
    </Reference>
    <Reference Include="System" />
    <Reference Include="System.Data" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <None Include="Data.xls">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </None>
  </ItemGroup>
  <ItemGroup>
    <Compile Include="Program.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
  </ItemGroup>
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>
```

<!-- code block end -->

<!-- code block begin -->

##### ****RenameSheets.VS2010.csproj:**

```
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProductVersion>
    </ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{B441ACCF-FC7C-467C-81C0-1B9D64D07BF7}</ProjectGuid>
    <OutputType>Exe</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>RenameSheets</RootNamespace>
    <AssemblyName>RenameSheets</AssemblyName>
    <OldToolsVersion>3.5</OldToolsVersion>
    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="Bytescout.Spreadsheet, Version=1.2.0.4, Culture=neutral, PublicKeyToken=f7dd1bd9d40a50eb, processorArchitecture=MSIL">
      <SpecificVersion>False</SpecificVersion>
    </Reference>
    <Reference Include="System" />
    <Reference Include="System.Data" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <None Include="Data.xls">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </None>
  </ItemGroup>
  <ItemGroup>
    <Compile Include="Program.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
  </ItemGroup>
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>
```

<!-- code block end -->


text:
.class public Lcom/android/server/enterprise/otp/engine/handler/proto/pskc/generic/KeyType;
.super Ljava/lang/Object;
.source "KeyType.java"

# instance fields
.field private algorithm:Ljava/lang/String;

.field private algorithmParameter:Lcom/android/server/enterprise/otp/engine/handler/proto/pskc/generic/AlgorithmParameter;

.field private data:Lcom/android/server/enterprise/otp/engine/handler/proto/pskc/generic/Data;

.field private friendlyName:Ljava/lang/String;

.field private id:Ljava/lang/String;

.field private issuer:Ljava/lang/String;

.field private keyProfileId:Ljava/lang/String;

.field private keyReference:Ljava/lang/String;

.field public ocraSuite:Ljava/lang/String;

.field private policy:Lcom/android/server/enterprise/otp/engine/handler/proto/pskc/generic/Policy;

.field private userId:Ljava/lang/String;

# direct methods
.method public constructor <init>()V
    .locals 0

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method

# virtual methods
.method public getAlgorithm()Ljava/lang/String;
    .locals 1

    iget-object v0, p0, Lcom/android/server/enterprise/otp/engine/handler/proto/pskc/generic/KeyType;->algorithm:Ljava/lang/String;

    return-object v0
.end method

.method public getAlgorithmParameter()Lcom/android/server/enterprise/otp/engine/handler/proto/pskc/generic/AlgorithmParameter;
    .locals 1

    iget-object v0, p0, Lcom/android/server/enterprise/otp/engine/handler/proto/pskc/generic/KeyType;->algorithmParameter:Lcom/android/server/enterprise/otp/engine/handler/proto/pskc/generic/AlgorithmParameter;

    return-object v0
.end method

.method public getData()Lcom/android/server/enterprise/otp/engine/handler/proto/pskc/generic/Data;
    .locals 1

    iget-object v0, p0, Lcom/android/server/enterprise/otp/engine/handler/proto/pskc/generic/KeyType;->data:Lcom/android/server/enterprise/otp/engine/handler/proto/pskc/generic/Data;

    return-object v0
.end method

.method public getFriendlyName()Ljava/lang/String;
    .locals 1

    iget-object v0, p0, Lcom/android/server/enterprise/otp/engine/handler/proto/pskc/generic/KeyType;->friendlyName:Ljava/lang/String;

    return-object v0
.end method

.method public getId()Ljava/lang/String;
    .locals 1

    iget-object v0, p0, Lcom/android/server/enterprise/otp/engine/handler/proto/pskc/generic/KeyType;->id:Ljava/lang/String;

    return-object v0
.end method

.method public getIssuer()Ljava/lang/String;
    .locals 1

    iget-object v0, p0, Lcom/android/server/enterprise/otp/engine/handler/proto/pskc/generic/KeyType;->issuer:Ljava/lang/String;

    return-object v0
.end method

.method public getKeyProfileID()Ljava/lang/String;
    .locals 1

    iget-object v0, p0, Lcom/android/server/enterprise/otp/engine/handler/proto/pskc/generic/KeyType;->keyProfileId:Ljava/lang/String;

    return-object v0
.end method

.method public getKeyReference()Ljava/lang/String;
    .locals 1

    iget-object v0, p0, Lcom/android/server/enterprise/otp/engine/handler/proto/pskc/generic/KeyType;->keyReference:Ljava/lang/String;

    return-object v0
.end method

.method public getPolicy()Lcom/android/server/enterprise/otp/engine/handler/proto/pskc/generic/Policy;
    .locals 1

    iget-object v0, p0, Lcom/android/server/enterprise/otp/engine/handler/proto/pskc/generic/KeyType;->policy:Lcom/android/server/enterprise/otp/engine/handler/proto/pskc/generic/Policy;

    return-object v0
.end method

.method public getUserID()Ljava/lang/String;
    .locals 1

    iget-object v0, p0, Lcom/android/server/enterprise/otp/engine/handler/proto/pskc/generic/KeyType;->userId:Ljava/lang/String;

    return-object v0
.end method

.method public setAlgorithm(Ljava/lang/String;)V
    .locals 4

    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string/jumbo v2, "KeyType::setAlgorithm: ENTER ["

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    const-string/jumbo v2, "]"

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-static {v1}, Lcom/android/server/enterprise/otp/engine/common/Print;->i(Ljava/lang/String;)V

    iput-object p1, p0, Lcom/android/server/enterprise/otp/engine/handler/proto/pskc/generic/KeyType;->algorithm:Ljava/lang/String;

    invoke-virtual {p1}, Ljava/lang/String;->toLowerCase()Ljava/lang/String;

    move-result-object v1

    const-string/jumbo v2, "ocra"

    invoke-virtual {v1, v2}, Ljava/lang/String;->contains(Ljava/lang/CharSequence;)Z

    move-result v1

    if-eqz v1, :cond_0

    :try_start_0
    invoke-virtual {p1}, Ljava/lang/String;->toLowerCase()Ljava/lang/String;

    move-result-object v1

    const-string/jumbo v2, "ocra-1:"

    const/4 v3, 0x0

    invoke-virtual {p1, v2, v3}, Ljava/lang/String;->indexOf(Ljava/lang/String;I)I

    move-result v2

    invoke-virtual {v1, v2}, Ljava/lang/String;->substring(I)Ljava/lang/String;

    move-result-object v1

    iput-object v1, p0, Lcom/android/server/enterprise/otp/engine/handler/proto/pskc/generic/KeyType;->ocraSuite:Ljava/lang/String;
    :try_end_0
    .catch Ljava/lang/IndexOutOfBoundsException; {:try_start_0 .. :try_end_0} :catch_0

    :cond_0
    :goto_0
    return-void

    :catch_0
    move-exception v0

    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string/jumbo v2, "KeyType::setAlgorithm: IndexOutOfBoundsException "

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v0}, Ljava/lang/IndexOutOfBoundsException;->getMessage()Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-static {v1}, Lcom/android/server/enterprise/otp/engine/common/Print;->e(Ljava/lang/String;)V

    goto :goto_0
.end method

.method public setAlgorithmParameter(Lcom/android/server/enterprise/otp/engine/handler/proto/pskc/generic/AlgorithmParameter;)V
    .locals 2

    iget-object v0, p0, Lcom/android/server/enterprise/otp/engine/handler/proto/pskc/generic/KeyType;->algorithm:Ljava/lang/String;

    invoke-virtual {v0}, Ljava/lang/String;->toLowerCase()Ljava/lang/String;

    move-result-object v0

    const-string/jumbo v1, "ocra"

    invoke-virtual {v0, v1}, Ljava/lang/String;->contains(Ljava/lang/CharSequence;)Z

    move-result v0

    if-eqz v0, :cond_0

    invoke-virtual {p1}, Lcom/android/server/enterprise/otp/engine/handler/proto/pskc/generic/AlgorithmParameter;->getSuite()Ljava/lang/String;

    move-result-object v0

    if-nez v0, :cond_0

    iget-object v0, p0, Lcom/android/server/enterprise/otp/engine/handler/proto/pskc/generic/KeyType;->ocraSuite:Ljava/lang/String;

    invoke-virtual {p1, v0}, Lcom/android/server/enterprise/otp/engine/handler/proto/pskc/generic/AlgorithmParameter;->setSuite(Ljava/lang/String;)V

    :cond_0
    iput-object p1, p0, Lcom/android/server/enterprise/otp/engine/handler/proto/pskc/generic/KeyType;->algorithmParameter:Lcom/android/server/enterprise/otp/engine/handler/proto/pskc/generic/AlgorithmParameter;

    return-void
.end method

.method public setData(Lcom/android/server/enterprise/otp/engine/handler/proto/pskc/generic/Data;)V
    .locals 0

    iput-object p1, p0, Lcom/android/server/enterprise/otp/engine/handler/proto/pskc/generic/KeyType;->data:Lcom/android/server/enterprise/otp/engine/handler/proto/pskc/generic/Data;

    return-void
.end method

.method public setFriendlyName(Ljava/lang/String;)V
    .locals 0

    iput-object p1, p0, Lcom/android/server/enterprise/otp/engine/handler/proto/pskc/generic/KeyType;->friendlyName:Ljava/lang/String;

    return-void
.end method

.method public setId(Ljava/lang/String;)V
    .locals 0

    iput-object p1, p0, Lcom/android/server/enterprise/otp/engine/handler/proto/pskc/generic/KeyType;->id:Ljava/lang/String;

    return-void
.end method

.method public setIssuer(Ljava/lang/String;)V
    .locals 0

    iput-object p1, p0, Lcom/android/server/enterprise/otp/engine/handler/proto/pskc/generic/KeyType;->issuer:Ljava/lang/String;

    return-void
.end method

.method public setKeyProfileID(Ljava/lang/String;)V
    .locals 0

    iput-object p1, p0, Lcom/android/server/enterprise/otp/engine/handler/proto/pskc/generic/KeyType;->keyProfileId:Ljava/lang/String;

    return-void
.end method

.method public setKeyReference(Ljava/lang/String;)V
    .locals 0

    iput-object p1, p0, Lcom/android/server/enterprise/otp/engine/handler/proto/pskc/generic/KeyType;->keyReference:Ljava/lang/String;

    return-void
.end method

.method public setPolicy(Lcom/android/server/enterprise/otp/engine/handler/proto/pskc/generic/Policy;)V
    .locals 0

    iput-object p1, p0, Lcom/android/server/enterprise/otp/engine/handler/proto/pskc/generic/KeyType;->policy:Lcom/android/server/enterprise/otp/engine/handler/proto/pskc/generic/Policy;

    return-void
.end method

.method public setUserID(Ljava/lang/String;)V
    .locals 0

    iput-object p1, p0, Lcom/android/server/enterprise/otp/engine/handler/proto/pskc/generic/KeyType;->userId:Ljava/lang/String;

    return-void
.end method


text:
/**
 * @author Toru Nagashima <https://github.com/mysticatea>
 * See LICENSE file in root directory for full license.
 */
"use strict"

const utils = require("./utils")
const COMMENT_DIRECTIVE = /^\s*(eslint-(?:en|dis)able(?:(?:-next)?-line)?)\s*(?:(\S|\S[\s\S]*\S)\s*)?$/u
const DELIMITER = /[\s,]+/gu
const pool = new WeakMap()

module.exports = class DisabledArea {
    /**
     * Get singleton instance for the given source code.
     *
     * @param {eslint.SourceCode} sourceCode - The source code to get.
     * @returns {DisabledArea} The singleton object for the source code.
     */
    static get(sourceCode) {
        let retv = pool.get(sourceCode.ast)

        if (retv == null) {
            retv = new DisabledArea()
            retv._scan(sourceCode)
            pool.set(sourceCode.ast, retv)
        }

        return retv
    }

    /**
     * Constructor.
     */
    constructor() {
        this.areas = []
        this.duplicateDisableDirectives = []
        this.unusedEnableDirectives = []
        this.numberOfRelatedDisableDirectives = new Map()
    }

    /**
     * Make disabled area.
     *
     * @param {Token} comment - The comment token to disable.
     * @param {object} location - The start location to disable.
     * @param {string[]|null} ruleIds - The ruleId names to disable.
     * @param {string} kind - The kind of disable-comments.
     * @returns {void}
     * @private
     */
    _disable(comment, location, ruleIds, kind) {
        if (ruleIds) {
            for (const ruleId of ruleIds) {
                if (this._getArea(ruleId, location) != null) {
                    this.duplicateDisableDirectives.push({ comment, ruleId })
                }

                this.areas.push({
                    comment,
                    ruleId,
                    kind,
                    start: location,
                    end: null,
                })
            }
        } else {
            if (this._getArea(null, location) != null) {
                this.duplicateDisableDirectives.push({ comment, ruleId: null })
            }

            this.areas.push({
                comment,
                ruleId: null,
                kind,
                start: location,
                end: null,
            })
        }
    }

    /**
     * Close disabled area.
     *
     * @param {Token} comment - The comment token to enable.
     * @param {object} location - The start location to enable.
     * @param {string[]|null} ruleIds - The ruleId names to enable.
     * @param {string} kind - The kind of disable-comments.
     * @returns {void}
     * @private
     */
    _enable(comment, location, ruleIds, kind) {
        const relatedDisableDirectives = new Set()

        if (ruleIds) {
            for (const ruleId of ruleIds) {
                let used = false

                for (let i = this.areas.length - 1; i >= 0; --i) {
                    const area = this.areas[i]

                    if (
                        area.end === null &&
                        area.kind === kind &&
                        area.ruleId === ruleId
                    ) {
                        relatedDisableDirectives.add(area.comment)
                        area.end = location
                        used = true
                    }
                }

                if (!used) {
                    this.unusedEnableDirectives.push({ comment, ruleId })
                }
            }
        } else {
            let used = false

            for (let i = this.areas.length - 1; i >= 0; --i) {
                const area = this.areas[i]

                if (area.end === null && area.kind === kind) {
                    relatedDisableDirectives.add(area.comment)
                    area.end = location
                    used = true
                }
            }

            if (!used) {
                this.unusedEnableDirectives.push({ comment, ruleId: null })
            }
        }

        this.numberOfRelatedDisableDirectives.set(
            comment,
            relatedDisableDirectives.size
        )
    }

    /**
     * Gets the area of the given ruleId and location.
     *
     * @param {string|null} ruleId - The ruleId name to get.
     * @param {object} location - The location to get.
     * @returns {object|null} The area of the given ruleId and location.
     * @private
     */
    _getArea(ruleId, location) {
        for (let i = this.areas.length - 1; i >= 0; --i) {
            const area = this.areas[i]

            if (
                (area.ruleId === null || area.ruleId === ruleId) &&
                utils.lte(area.start, location) &&
                (area.end === null || utils.lte(location, area.end))
            ) {
                return area
            }
        }

        return null
    }

    /**
     * Scan the souce code and setup disabled area list.
     *
     * @param {eslint.SourceCode} sourceCode - The source code to scan.
     * @returns {void}
     * @private
     */
    _scan(sourceCode) {
        for (const comment of sourceCode.getAllComments()) {
            const m = COMMENT_DIRECTIVE.exec(comment.value)
            if (m == null) {
                continue
            }
            const kind = m[1]
            const ruleIds = m[2] ? m[2].split(DELIMITER) : null

            if (comment.type === "Block" && kind === "eslint-disable") {
                this._disable(comment, comment.loc.start, ruleIds, "block")
            } else if (comment.type === "Block" && kind === "eslint-enable") {
                this._enable(comment, comment.loc.start, ruleIds, "block")
            } else if (
                comment.type === "Line" &&
                kind === "eslint-disable-line"
            ) {
                const line = comment.loc.start.line
                const start = { line, column: 0 }
                const end = { line: line + 1, column: -1 }

                this._disable(comment, start, ruleIds, "line")
                this._enable(comment, end, ruleIds, "line")
            } else if (
                comment.type === "Line" &&
                kind === "eslint-disable-next-line"
            ) {
                const line = comment.loc.start.line
                const start = { line: line + 1, column: 0 }
                const end = { line: line + 2, column: -1 }

                this._disable(comment, start, ruleIds, "line")
                this._enable(comment, end, ruleIds, "line")
            }
        }
    }
}


text:
#region License

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

#endregion

using Prism.Commands;
using System;
using System.Collections.Generic;
using System.Windows.Input;
using VEF.Interfaces.Controls;
using VEF.Interfaces.Services;

namespace VEF.Model.Services
{
    /// <summary>
    /// The command manager class where you can register and query for a command
    /// </summary>
    public class CommandManager : ICommandManager
    {
        /// <summary>
        /// The dictionary which holds all the commands
        /// </summary>
        private readonly Dictionary<string, ICommand> _commands;

        /// <summary>
        /// Command manager constructor
        /// </summary>
        public CommandManager()
        {
            _commands = new Dictionary<string, ICommand>();
        }

        #region ICommandManager Members

        /// <summary>
        /// Register a command with the command manager
        /// </summary>
        /// <param name="name">The name of the command</param>
        /// <param name="command">The command to register</param>
        /// <returns>true if a command is registered, false otherwise</returns>
        public bool RegisterCommand(string name, ICommand command)
        {
            if (_commands.ContainsKey(name))
                throw new Exception("Command " + name + " already exists !");

            _commands.Add(name, command);
            return true;
        }

        /// <summary>
        /// Gets the command if registered with the command manager
        /// </summary>
        /// <param name="name">The name of the command</param>
        /// <returns>The command if available, null otherwise</returns>
        public ICommand GetCommand(string name)
        {
            if (_commands.ContainsKey(name))
                return _commands[name];
            return null;
        }

        /// <summary>
        /// Calls RaiseCanExecuteChanged on all Delegate commands available in the command manager
        /// </summary>
        public void Refresh()
        {
            foreach (var keyValuePair in _commands)
            {
                if (keyValuePair.Value is DelegateCommand)
                {
                    var c = keyValuePair.Value as DelegateCommand;
                    c.RaiseCanExecuteChanged();
                }
            }
        }

        #endregion
    }
}


text:
<!DOCTYPE html>

  <meta charset="utf-8">
  <base data-ice="baseUrl" href="../../../../">
  <title data-ice="title">src/components/select/Select.js | API Document</title>
  <link type="text/css" rel="stylesheet" href="css/style.css">
  <link type="text/css" rel="stylesheet" href="css/prettify-tomorrow.css">

  Home

  Reference
  Source

  Repository

    <input class="search-input">

CFormioForm

CFormio

CFormioWizard

VFormioFactory

components
CFormioComponents

VValidator

components/address
CAddressComponent

components/address/fixtures
Vcomponent

Vcomponents

components/base
CBaseComponent

components/base/fixtures
Vcomponent

Vcomponent

Vcomponents

components/button
CButtonComponent

components/button/fixtures
Vcomponent

Vcomponents

components/checkbox
CCheckBoxComponent

components/checkbox/fixtures
Vcomponent

Vcomponents

components/columns
CColumnComponent

CColumnsComponent

components/columns/fixtures
Vcomponent

Vcomponents

components/container
CContainerComponent

components/container/fixtures
Vcomponent

Vcomponents

components/content
CContentComponent

components/content/fixtures
Vcomponent

Vcomponents

components/currency
CCurrencyComponent

components/currency/fixtures
Vcomponent

Vcomponents

components/datagrid
CDataGridComponent

components/datagrid/fixtures
Vcomponent

Vcomponents

components/datetime
CDateTimeComponent

components/datetime/fixtures
Vcomponent

Vcomponents

components/day
CDayComponent

components/day/fixtures
Vcomponent

Vcomponents

components/email
CEmailComponent

components/email/fixtures
Vcomponent

Vcomponents

components/fieldset
CFieldsetComponent

components/fieldset/fixtures
Vcomponent

Vcomponents

components/form
CFormComponent

components/form/fixtures
Vcomponent

Vcomponents

components/gmap
CGmapComponent

components/gmap/fixtures
Vcomponent

Vcomponents

components/hidden
CHiddenComponent

components/hidden/fixtures
Vcomponent

Vcomponents

components/html
CHTMLComponent

components/html/fixtures
Vcomponent

Vcomponents

components/number
CNumberComponent

components/number/fixtures
Vcomponent

Vcomponents

components/panel
CPanelComponent

components/panel/fixtures
Vcomponent

Vcomponents

components/password
CPasswordComponent

components/password/fixtures
Vcomponent

Vcomponents

components/phonenumber
CPhoneNumberComponent

components/phonenumber/fixtures
Vcomponent

Vcomponents

components/radio
CRadioComponent

components/radio/fixtures
Vcomponent

Vcomponents

components/resource
CResourceComponent

components/resource/fixtures
Vcomponent

Vcomponents

components/select
CSelectComponent

components/select/fixtures
Vcomponent

Vcomponents

components/selectboxes
CSelectBoxesComponent

components/selectboxes/fixtures
Vcomponent

Vcomponents

components/signature
CSignatureComponent

components/signature/fixtures
Vcomponent

Vcomponents

components/survey
CSurveyComponent

components/survey/fixtures
Vcomponent

Vcomponents

components/table
CTableComponent

components/table/fixtures
Vcomponent

Vcomponents

components/textarea
CTextAreaComponent

components/textarea/fixtures
Vcomponent

Vcomponents

components/textfield
CTextFieldComponent

components/textfield/fixtures
Vcomponent

Vcomponents

components/unknown
CUnknownComponent

components/well
CWellComponent

components/well/fixtures
Vcomponent

Vcomponents

src/components/select/Select.js

import { BaseComponent } from '../base/Base';
import Choices from 'choices.js';
import Formio from '../../formio';
import _each from 'lodash/each';
import _get from 'lodash/get';
import _isEmpty from 'lodash/isEmpty';
import _isArray from 'lodash/isArray';
export class SelectComponent extends BaseComponent {
  constructor(component, options, data) {
    super(component, options, data);

    // If they wish to refresh on a value, then add that here.
    if (this.component.refreshOn) {
      this.on('change', (event) => {
        if (this.component.refreshOn === 'data') {
          this.updateItems();
        }
        else if (event.changed.component.key === this.component.refreshOn) {
          this.updateItems();
        }
      });
    }
  }

  elementInfo() {
    let info = super.elementInfo();
    info.type = 'select';
    info.changeEvent = 'change';
    return info;
  }

  createWrapper() {
    return false;
  }

  itemTemplate(data) {
    return this.component.template ? this.interpolate(this.component.template, {item: data}) : data.label;
  }

  itemValue(data) {
    return this.component.valueProperty ? _get(data, this.component.valueProperty) : data;
  }

  setItems(items) {
    if (!this.choices) {
      return;
    }
    this.choices._clearChoices();

    // If they provided select values, then we need to get them instead.
    if (this.component.selectValues) {
      items = _get(items, this.component.selectValues);
    }

    // Iterate through each of the items.
    _each(items, (item) => {

      // Add the choice to the select list.
      this.choices._addChoice(false, false, this.itemValue(item), this.itemTemplate(item));
    });

    // If a value is provided, then select it.
    if (this.value) {
      this.setValue(this.value, true);
    }
  }

  loadItems(url, input, headers, options) {
    let query = (this.component.dataSrc === 'url') ? {} : {
      limit: 100,
      skip: 0
    };

    // Allow for url interpolation.
    url = this.interpolate(url, {
      data: this.data,
      formioBase: Formio.getBaseUrl()
    });

    // Add search capability.
    if (this.component.searchField && input) {
      query[this.component.searchField] = input;
    }

    // Add filter capability
    if (this.component.filter) {
      let filter = this.interpolate(this.component.filter, {data: this.data});
      url += ((url.indexOf('?') === -1) ? '?' : '&') + filter;
    }

    // If they wish to return only some fields.
    if (this.component.selectFields) {
      query.select = this.component.selectFields;
    }

    if (!_isEmpty(query)) {
      // Add the query string.
      url += '?' + Formio.serialize(query);
    }

    // Make the request.
    Formio.request(url, null, null, headers, options)
      .then((response) => this.setItems(response))
      .catch(() => console.warn('Unable to load resources for ' + this.component.key))
  }

  updateItems() {
    switch(this.component.dataSrc) {
      case 'values':
        this.component.valueProperty = 'value';
        this.setItems(this.component.data.values);
        break;
      case 'json':
        try {
          this.setItems(JSON.parse(this.component.data.json));
        }
        catch (err) {
          console.warn('Unable to parse JSON for ' + this.component.key);
        }
        break;
      case 'resource':
        try {
          this.loadItems(Formio.getAppUrl() + '/form/' + this.component.data.resource + '/submission');
        }
        catch (err) {
          console.warn('Unable to load resources for ' + this.component.key);
        }
        break;
      case 'url':
        this.loadItems(this.component.data.url, null, new Headers(), {
          noToken: true
        });
        break;
    }
  }

  addInput(input, container) {
    super.addInput(input, container, true);
    if (this.component.multiple) {
      input.setAttribute('multiple', true);
    }
    var self = this;
    this.choices = new Choices(input, {
      placeholder: !!this.component.placeholder,
      placeholderValue: this.component.placeholder,
      removeItemButton: true,
      itemSelectText: '',
      classNames: {
        containerOuter: 'choices form-group formio-choices',
        containerInner: 'form-control'
      }
    });
    if (this.disabled) {
      this.choices.disable();
    }
    this.updateItems();
  }

  set disabled(disabled) {
    super.disabled = disabled;
    if (!this.choices) {
      return;
    }
    if (disabled) {
      this.choices.disable();
    }
    else {
      this.choices.enable();
    }
  }

  getValue() {
    return this.choices.getValue(true);
  }

  setValue(value, noUpdate, noValidate) {
    this.value = value;
    if (value && this.choices) {
      if (this.choices.store) {
        // Search for the choice.
        const choices = this.choices.store.getChoices();
        const foundChoice = choices.find((choice) => {
          return choice.value === value;
        });

        // If it is not found, then add it.
        if (!foundChoice) {
          this.choices._addChoice(false, false, value, value);
        }
      }

      // Now set the value.
      this.choices.setValueByChoice(_isArray(value) ? value : [value]);
    }
    if (!noUpdate) {
      this.updateValue(noValidate);
    }
  }

  destroy() {
    if (this.choices) {
      this.choices.destroy();
    }
  }
}

  Generated by ESDoc(0.5.2)


text:
<?xml version="1.0" encoding="UTF-8"?>

<!--
  * tiles.xml
  *
  * Copyright (C) 2014 Paperbet S.A.
 -->

<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:util="http://www.springframework.org/schema/util" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="
		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
		http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.2.xsd
	">

	<util:list id="tiles">
		<value>/views/master-page/tiles.xml</value>
		<value>/views/misc/tiles.xml</value>
		<value>/views/security/tiles.xml</value>
		<value>/views/welcome/tiles.xml</value>
		<value>/views/administrator/tiles.xml</value>
		<value>/views/user/tiles.xml</value>
		<value>/views/moderator/tiles.xml</value>
		<value>/views/gamble/tiles.xml</value>
		<value>/views/bet/tiles.xml</value>
		<value>/views/money/tiles.xml</value>
	</util:list>

</beans>


text:
extern crate test_crate;

#[test_crate::multiple_tokens]
type T = ();

fn main() {}


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

    <com.example.yifengliu.test.Test7
        android:id="@+id/test7_group"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <ListView
            android:id="@+id/test7_listview"
            android:layout_width="match_parent"
            android:layout_height="match_parent">

        </ListView>

    </com.example.yifengliu.test.Test7>

</LinearLayout>


text:
layout: default
published: true
categories:
- blog
---

Run C:\Users\blah\AppData\Local\Android\android-sdk\platform-tools\adb.exe logcat

And run Android emulator:

C:\Usesr\blah\AppData\Local\Android\android-sdk\tools\emulator-arm.exe -avd [android_emulator_name]


text:
package io.sharedstreets.tools.builder.osm.model;

public class WayEntity extends Relation {

    public boolean isHighway() {

        if (fields == null)
            return false;

        assert fields != null;

        return fields.containsKey("highway");

    }
}


text:
define([
    'backbone',
    'marionette',
    'underscore',
    'moment',
    'app/applets/addOrder/helpers/opDataUtil',
    'app/applets/addOrder/helpers/validation',
    'hbs!app/applets/addOrder/templates/alertTemplate'
], function(Backbone, Marionette, _, Moment, opDataUtil, Validation, alertTemplate) {
    'use strict';

    var strength,
        verb,
        amount,
        route,
        schedule,
        prn,
        supply,
        quantity,
        refills,
        pickup,
        priority,
        comments,
        gatherInput,
        getPreviewString,
        instructions,
        defaultSaveObj,
        saveMed,
        callbacks,
        doseString,
        drugIEN,
        routeIEN,
        patientIEN,
        medName,
        MedModel = Backbone.Model.extend({});

    patientIEN = function() {
        return ADK.PatientRecordService.getCurrentPatient().get('localId');
    };

    callbacks = {
        error: function(model, resp) {
            //add error banner to modal
            //opDataUtil.errorView.addError(resp.responseText, 'Save Failed');
            $('#btn-add-order-accept').html('<span class="sr-only"> Press enter to </span>Accept Order');
            $('#btn-add-order-accept').removeClass('disabled');
            alert(resp.responseText);
        },
        success: function(model, resp) {
            // this is a temporary option to display the order number
            var message = 'Saved Successfully. Order#: ' + resp.data.items.split(';')[0];
            var msgModel = new Backbone.Model();
            msgModel.set('message', message);
            var MessageBox = Backbone.Marionette.ItemView.extend({
                template: alertTemplate
            });
            var messageBox = new MessageBox({
                model: msgModel
            });
            var modalOptions = {
                'size': 'small'
            };

            // Send updated model to meds medChangeChannel
            var channel = ADK.Messaging.getChannel('medicationChannel');
            var deferredResponse = channel.request('refresh');
            var afterSync = function(response) {
                var medicationCollectionHandler = response.medicationCollectionHandler;
                medicationCollectionHandler.fetchAllMeds();
                ADK.hideModal();
            };
            //Wait for sync to complete, then update applet
            _.delay(deferredResponse.done, 6000, afterSync);

            ADK.showModal(messageBox, modalOptions);
        }
    };

    gatherInput = function() {
        var displayObj = opDataUtil.getPreviewValues();
        doseString = displayObj.doseString || '';
        strength = displayObj.strength || '';
        verb = displayObj.verb || '';
        amount = displayObj.amount || '';
        route = displayObj.route || '';
        schedule = displayObj.schedule || '';
        drugIEN = displayObj.drugIEN || '';
        routeIEN = displayObj.routeIEN || '';
        medName = displayObj.medName || '';
        supply = displayObj.supply || '';
        quantity = displayObj.quantity || '';
        refills = displayObj.refills || '';
        pickup = displayObj.pickup || '';
        priority = displayObj.priority || '';

        prn = $('#prn').is(':checked') ? 'AS NEEDED' : '';
        comments = $('#comments').val() || '';

        instructions = (verb && verb + ' ') + (amount && amount + ' ') +
            (route && route + ' ') + (schedule && schedule + ' ') +
            (prn && prn + ' ');
    };

    getPreviewString = function() {
        gatherInput();
        // TODO: Get medication from opDataUtil
        var line1 = '<p>',
            line2 = '<p>',
            line3 = '<p>';
        line1 += medName + ' ' + (strength && strength + ' ');
        line2 += (instructions && instructions + ' ') +
            (comments && comments + ' ');
        line3 += 'Quantity: ' + quantity + ' Refills: ' + refills;

        return line1 + line2 + line3;
    };

    defaultSaveObj = function() {
        gatherInput();
        var m = opDataUtil.model;
        m.set({
            param: {
                'ien': patientIEN(),
                'provider': 10000000226,    //check the visit context for this
                'location': 23,             //check the visit context for this
                'orderDialog': 'PSO OERR',
                'displayGroup': 4,
                'quickOrderDialog': 147,
                'orderID': '',
                'ORDIALOG': {
                    'medIEN': opDataUtil.getMed().get('IEN'),
                    'strength': strength,
                    'drugIEN': drugIEN,
                    'doseString': doseString,
                    'dose': strength,
                    'routeIEN': routeIEN,
                    'schedule': schedule,
                    'supply': supply,
                    'quantity' : quantity,
                    'refills': refills,
                    'pickup': pickup,
                    'priority': priority,
                    'instructions': instructions,
                    'comment': comments,
                    'ORCHECK': 0,
                    'ORTS': 0   //0 for outpatient, 9 for inpatient
                }
            }
        }, {
            'validate': true
        });

        var id = '',
            patient = ADK.PatientRecordService.getCurrentPatient();

        // Get the pid param in the same way as ADK.PatientRecordService.fetchCollection does
        if (patient.get('icn')) {
            id = patient.get('icn');
        } else if (patient.get('pid')) {
            id = patient.get('pid');
        } else {
            id = patient.get('id');
        }

        m.urlRoot = ADK.ResourceService.buildUrl('write-back-outpatient-med-save', {
            pid: id
        });

        return m;
    };

    saveMed = function() {
        var saveModel = defaultSaveObj();

        saveModel.save(null, callbacks);
    };

    var util = {

        buildPreview: function() {
            if (opDataUtil.model.isValid()) {
                $('#previewOrder').html(getPreviewString());
            }
        },
        saveMed: function() {
            saveMed();
        },

        getVisitModel: function() {
            var selectedVisit = new Backbone.Model({
                'visit': ADK.PatientRecordService.getCurrentPatient().get('visit')
            });
            return selectedVisit;
        },
        getModel: function() {
            return MedModel.extend(Validation);
        },
        update: function() {
            defaultSaveObj();
            $('#btn-add-order-accept').prop('disabled', false);
        }
    };

    return util;
});


text:
package config

import (
	"encoding/json"
	"time"
)

// FluxConfigFromJSON converts a json string to a FluxConfig instance
func FluxConfigFromJSON(data []byte) (*FluxConfig, error) {
	r := &FluxConfig{}
	err := json.Unmarshal(data, r)
	return r, err
}

// FromJSON converts a json string to a FluxConfig instance
func (r *FluxConfig) FromJSON(data []byte) error {
	c := FluxConfig{}
	err := json.Unmarshal(data, &c)
	*r = c
	return err
}

// ToJSON converts a FluxConfig to a JSON string
func (r *FluxConfig) ToJSON() ([]byte, error) {
	return json.Marshal(r)
}

type FluxConfig struct {
	Seasons        []Season           `json:"seasons"`
	Weather        []Weather          `json:"weather"`
	SuncalcMoments []AddSuncalcMoment `json:"suncalc_moments"`
	Lighttype      []Lighttype        `json:"lighttype"`
	Lighttime      []Lighttime        `json:"lighttime"`
}

type Lighttime struct {
	CT          FromTo         `json:"ct"`
	Bri         FromTo         `json:"bri"`
	Darkorlight Darkorlight    `json:"darkorlight"`
	TimeSlot    TaggedTimeSlot `json:"timeslot"`
}

type TaggedTimeSlot struct {
	StartMoment string `json:"start"`
	StartTime   time.Time
	EndMoment   string `json:"end"`
	EndTime     time.Time
}

type Lighttype struct {
	MetricsName string `json:"metricsname"`
	LightName   string `json:"lightname"`
	LightType   string `json:"lighttype"`
	Channel     string `json:"channel"`
	CT          MinMax `json:"ct"`
	BRI         MinMax `json:"bri"`
}

type FromTo struct {
	From float64 `json:"from"`
	To   float64 `json:"to"`
}

// LinearInterpolated returns interpolated value between From-To
func (f FromTo) LinearInterpolated(x float64) float64 {
	return f.From + x*(f.To-f.From)
}

type MinMax struct {
	Min float64 `json:"min"`
	Max float64 `json:"max"`
}

// LinearInterpolated returns interpolated value between Min-Max
func (m MinMax) LinearInterpolated(x float64) float64 {
	return m.Min + x*(m.Max-m.Min)
}

type Season struct {
	Name string `json:"name"`
	CT   MinMax `json:"ct"`
	BRI  MinMax `json:"bri"`
}

type AddSuncalcMoment struct {
	Name  string `json:"name"`
	Tag   string `json:"tag"`
	Shift int64  `json:"shift"` // Shift in minutes +/-
}

type Weather struct {
	Clouds MinMax  `json:"clouds"`
	CTPct  float64 `json:"ct_pct"`
	BriPct float64 `json:"bri_pct"`
}

type Darkorlight string

const (
	Dark     Darkorlight = "dark"
	Light    Darkorlight = "light"
	Twilight Darkorlight = "twilight"
)


text:
Subcolumn Title

        <task ng-repeat="task in taskGroup.tasks" task="task"></task>

    <add-task-modal task-group="taskGroup"></add-task-modal>


text:
#import <Foundation/Foundation.h>
#import "AWSMobileAnalyticsDefaultInterceptor.h"
#import "AWSMobileAnalyticsSDKInfo.h"

static NSString *const CLIENT_SDK_VERSION_HEADER_NAME = @"x-amzn-ClientSDKVersion";

@interface AWSMobileAnalyticsSDKInfoInterceptor : AWSMobileAnalyticsDefaultInterceptor

-(id) initWithSDKInfo: (AWSMobileAnalyticsSDKInfo *) theSDKInfo;

-(void) before:(id<AWSMobileAnalyticsRequest>) theRequest;

@property (nonatomic, readwrite) AWSMobileAnalyticsSDKInfo *sdkInfo;

@end


text:
<?php
include "file/tema/edisi_spesial/login.php";
?>

			<?php
			$pertanyaan=mysql_query("SELECT * FROM sh_sidebar WHERE jenis='polling' AND status='1' AND isi2='pertanyaan'");
			$tanya=mysql_fetch_array($pertanyaan);
			echo "

<form method='POST' action='kontenweb/insert_polling.php'>

$tanya[nama]

			";

			$polling=mysql_query("SELECT * FROM sh_sidebar WHERE jenis='polling' AND status='1' AND isi2!='pertanyaan'");
			while($pol=mysql_fetch_array($polling)){
			?>

<input type="radio" name="poll" id="poll" <?php echo "value=$pol[id_sidebar]";?>>	<?php echo "$pol[nama]";?>

			<?php } ?>

<input type="submit" class="tombol" value="Poll"> <input type="button" class="tombol" value="Hasil" onclick="window.location.href='?p=polling';">

			</form>

			<?php
			$ym=mysql_query("SELECT * FROM sh_sidebar WHERE jenis='ym' AND status='1'");
			while($y=mysql_fetch_array($ym)){ ?>

			<a href="ymsgr:sendIM?<?php echo $y[isi1]?>"><img src="http://opi.yahoo.com/online?u=<?php echo $y[isi1]?>&m=g&t=1" alt="YM" border="0" />

			<?php echo $y[nama]?>

			<?php } ?>

			<?php
			$link=mysql_query("SELECT * FROM sh_sidebar WHERE jenis='link' AND status='1'");
			while($l=mysql_fetch_array($link)){ ?>

<a href="http://<?php echo "$l[isi1]";?>" target="_blank"><?php echo "$l[nama]";?>

			<?php } ?>

			<?php
			  $ip      = $_SERVER['REMOTE_ADDR'];
              $tanggal = date("Ymd");
              $waktu   = time();

              $cekstatistik = mysql_query("SELECT * FROM sh_statistik WHERE ip_addres='$ip' AND tanggal='$tanggal'");
              // Kalau belum ada, simpan data user tersebut ke database
              if(mysql_num_rows($cekstatistik) == 0){
                mysql_query("INSERT INTO sh_statistik(ip_addres, tanggal ,mengunjungi, online) VALUES('$ip','$tanggal','1','$waktu')");
              }
              else{
                mysql_query("UPDATE sh_statistik SET mengunjungi=mengunjungi+1, online='$waktu' WHERE ip_addres='$ip' AND tanggal='$tanggal'");
              }

              $pengunjung       = mysql_num_rows(mysql_query("SELECT * FROM sh_statistik WHERE tanggal='$tanggal' GROUP BY ip_addres"));
              $totalpengunjung  = mysql_result(mysql_query("SELECT COUNT(mengunjungi) FROM sh_statistik"), 0);
              $hits             = mysql_fetch_assoc(mysql_query("SELECT SUM(mengunjungi) as kunjunganhariini FROM sh_statistik WHERE tanggal='$tanggal' GROUP BY tanggal"));
              $totalhits        = mysql_result(mysql_query("SELECT SUM(mengunjungi) FROM sh_statistik"), 0);
              $bataswaktu       = time() - 300;
              $pengunjungonline = mysql_num_rows(mysql_query("SELECT * FROM sh_statistik WHERE online > '$bataswaktu'"));
			?>

<?php echo "$totalhits";?>

				Total Hits Halaman

<?php echo "$totalpengunjung";?>

				Total Pengunjung

<?php echo "$hits[kunjunganhariini]";?>

				Hits Hari Ini

<?php echo "$pengunjung";?>

				Pengunjung Hari Ini

<?php echo "$pengunjungonline";?>

				Pengunjung Online


text:
<?php

/**
 * Class BasicTest
 */

class BasicTest extends TestCase
{
    /**
     * A basic test example. May take a minute because the test data is being generated.
     *
     * @slowThreshold 60000
     * @return void
     */
    public function testExample()
    {
        $this->assertTrue(true);

    }
}


text:
import zipfile
import os.path

def unzip( archive_path, result_dir ):
    z = zipfile.ZipFile( archive_path, 'r', zipfile.ZIP_DEFLATED )
    for f in z.infolist():
        result = open( os.path.join( result_dir, f.filename ), 'wb' )
        result.write( z.read( f.filename ) )
        result.close()

    z.close()


text:
import { IResolve } from '../interfaces/IResolve';
import { IResolvePackageKey } from '../interfaces/IResolvePackageKey';
import { IResolvePackageUrl } from '../interfaces/IResolvePackageUrl';
import { ISassUrlVariants } from '../interfaces/ISassUrlVariants';

export function resolvePackageUrlFactory(
  resolve: IResolve,
  resolvePackageKey: IResolvePackageKey,
  sassUrlVariants: ISassUrlVariants,
): IResolvePackageUrl {
  return (url: string, extensions: string[], cwd: string, packageKeys: any) => {
    let file: string|null = null;

    sassUrlVariants(url, extensions).some((urlVariant) => {
      try {
        /* istanbul ignore next: resolve.sync is mocked anyway */
        const resolvedPath = resolve.sync(urlVariant, {
          basedir: cwd,
          packageFilter: (packageJson) => resolvePackageKey(packageJson, packageKeys),
          extensions,
        });
        if (resolvedPath) {
          file = resolvedPath;
          return true;
        }
      } catch (e) {
        // Prevent the resolve module from throwing an
        // exception if no matching package is found.
      }
      return false;
    });

    return file;
  };
}