text:
// Copyright © Microsoft Corporation.  All Rights Reserved.
// This code released under the terms of the
// Microsoft Public License (MS-PL, http://opensource.org/licenses/ms-pl.html.)

using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using Microsoft.TeamFoundation.Client;
using Microsoft.TeamFoundation.Migration.BusinessModel;
using Microsoft.TeamFoundation.VersionControl.Client;
using Microsoft.TeamFoundation.VersionControl.Common;

namespace Microsoft.TeamFoundation.Migration.Shell.Tfs2010ShellAdapter
{
    /// <summary>
    /// Interaction logic for VCServerPathDialog.xaml
    /// </summary>
    public partial class VCServerPathDialog : Window
    {
        private VCServerPathViewModel m_vcServerPathViewModel;

        internal VCServerPathDialog(FilterItem filterItem, MigrationSource migrationSource)
        {
            InitializeComponent();

            m_vcServerPathViewModel = new VCServerPathViewModel(filterItem, migrationSource);
            m_vcServerPathViewModel.Initialize();

            this.Closed += new EventHandler(VCServerPathDialog_Closed);

            DataContext = m_vcServerPathViewModel;

            rootTreeView.Focus();
        }

        void VCServerPathDialog_Closed(object sender, EventArgs e)
        {
            m_vcServerPathViewModel.Dispose();
        }

        private void saveButton_Click(object sender, RoutedEventArgs e)
        {
            m_vcServerPathViewModel.Save();
            DialogResult = true;
            Close();
        }

        private void TreeViewItem_Selected(object sender, RoutedEventArgs e)
        {
            if (sender is TreeViewItem)
            {
                TreeViewItem selectedItem = sender as TreeViewItem;
                if (selectedItem.DataContext is VCServerPathNodeViewModel)
                {
                    m_vcServerPathViewModel.SelectedNode = selectedItem.DataContext as VCServerPathNodeViewModel;
                    e.Handled = true;
                }
                selectedItem.BringIntoView();
            }
        }
    }

    internal class VCServerPathViewModel : INotifyPropertyChanged, IDisposable
    {
        private MigrationSource m_migrationSource;
        private FilterItem m_filterItem;
        private BackgroundWorker m_worker;
        private VersionControlServer m_server;

        public VCServerPathViewModel(FilterItem filterItem, MigrationSource migrationSource)
        {
            m_filterItem = filterItem;
            m_migrationSource = migrationSource;

            m_worker = new BackgroundWorker();
            m_worker.DoWork += new DoWorkEventHandler(m_worker_DoWork);
            m_worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(m_worker_RunWorkerCompleted);
        }

        private Queue<VCServerPathNodeViewModel> m_queue = new Queue<VCServerPathNodeViewModel>();
        public void QueueLoadChildren(VCServerPathNodeViewModel node)
        {
            if (m_worker.IsBusy)
            {
                m_queue.Enqueue(node);
            }
            else
            {
                m_worker.RunWorkerAsync(node);
            }
        }

        public void Initialize()
        {
            if (!m_worker.IsBusy)
            {
                IsLoading = true;
                m_worker.RunWorkerAsync();
            }
        }

        void m_worker_DoWork(object sender, DoWorkEventArgs e)
        {
            if (e.Argument is VCServerPathNodeViewModel)
            {
                VCServerPathNodeViewModel node = e.Argument as VCServerPathNodeViewModel;
                node.GetItems(m_server);
                e.Result = node;
            }
            else
            {
                TfsTeamProjectCollection collection = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri(m_migrationSource.ServerUrl));
                m_server = collection.GetService<VersionControlServer>();

                Item item = m_server.GetItem(VersionControlPath.RootFolder + m_migrationSource.SourceIdentifier);
                VCServerPathRootViewModel rootNode = new VCServerPathRootViewModel(item, this);
                rootNode.Load(m_server);
                rootNode.IsExpanded = true;
                SelectedNode = rootNode;
                string[] tokens = m_filterItem.FilterString.Split(VersionControlPath.Separator);
                for (int i = 2; i < tokens.Length; i++)
                {
                    SelectedNode.Load(m_server);
                    SelectedNode.IsExpanded = true;

                    VCServerPathNodeViewModel newSelectedNode = SelectedNode.Children.FirstOrDefault(x => string.Equals(x.DisplayName, tokens[i]));

                    if (newSelectedNode != null)
                    {
                        SelectedNode = newSelectedNode;
                    }
                    else
                    {
                        break;
                    }
                }
                e.Result = rootNode;
            }
        }

        void m_worker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            if (m_disposeRequested)
            {
                Dispose();
                return;
            }
            if (e.Error == null)
            {
                if (e.Result is VCServerPathRootViewModel)
                {
                    VCServerPathRootViewModel rootNode = e.Result as VCServerPathRootViewModel;
                    RootList.Add(rootNode);
                }
                else if (e.Result is VCServerPathNodeViewModel)
                {
                    VCServerPathNodeViewModel node = e.Result as VCServerPathNodeViewModel;
                    node.PopulateChildren();

                    if (m_queue.Count > 0)
                    {
                        QueueLoadChildren(m_queue.Dequeue());
                    }
                }
            }
            IsLoading = false;
        }

        private bool m_isLoading = false;
        public bool IsLoading
        {
            get
            {
                return m_isLoading;
            }
            private set
            {
                m_isLoading = value;
                OnPropertyChanged("IsLoading");
            }
        }

        private ObservableCollection<VCServerPathNodeViewModel> m_rootList;
        public ObservableCollection<VCServerPathNodeViewModel> RootList
        {
            get
            {
                if (m_rootList == null)
                {
                    m_rootList = new ObservableCollection<VCServerPathNodeViewModel>();
                }
                return m_rootList;
            }
        }

        private VCServerPathNodeViewModel m_selectedNode;
        public VCServerPathNodeViewModel SelectedNode
        {
            get
            {
                return m_selectedNode;
            }
            set
            {
                if (m_selectedNode != null)
                {
                    m_selectedNode.IsSelected = false;
                }
                m_selectedNode = value;
                if (m_selectedNode != null)
                {
                    m_selectedNode.IsSelected = true;
                }
                OnPropertyChanged("SelectedNode");
            }
        }

        public void Save()
        {
            m_filterItem.FilterString = SelectedNode.ServerPath;
        }

        #region INotifyPropertyChanged Members

        public event PropertyChangedEventHandler PropertyChanged;
        protected void OnPropertyChanged(string info)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(info));
            }
        }

        #endregion

        #region IDisposable Members

        private bool m_disposeRequested = false;
        public void Dispose()
        {
            if (m_worker != null)
            {
                if (m_worker.IsBusy)
                {
                    m_disposeRequested = true;
                    return;
                }

                m_worker.DoWork -= m_worker_DoWork;
                m_worker.RunWorkerCompleted -= m_worker_RunWorkerCompleted;
                m_worker.Dispose();
                m_worker = null;
            }
        }

        #endregion
    }

    internal class VCServerPathRootViewModel : VCServerPathNodeViewModel
    {
        public VCServerPathRootViewModel(Item item, VCServerPathViewModel container)
            : base(item,  container)
        {
            Type = NodeType.Root;
        }
    }

    internal class VCServerPathStubViewModel : VCServerPathNodeViewModel
    {
        public VCServerPathStubViewModel() : base(null,  null)
        {
            Type = NodeType.None;
        }

        public override string ServerPath
        {
            get
            {
                return null;
            }
        }

        public override string DisplayName
        {
            get
            {
                return "Loading...";
            }
        }
    }

    internal class VCServerPathNodeViewModel : INotifyPropertyChanged
    {
        private Item m_item;
        private VCServerPathViewModel m_container;

        public VCServerPathNodeViewModel(Item item, VCServerPathViewModel container)
        {
            m_container = container;
            m_item = item;
            if (m_item != null)
            {
                if (m_item.IsBranch)
                {
                    Type = NodeType.Branch;
                }
                else
                {
                    Type = NodeType.Folder;
                }
            }
        }

        private ItemSet m_itemSet;
        public void GetItems(VersionControlServer server)
        {
            ItemSpec spec = new ItemSpec(ServerPath, RecursionType.OneLevel);
            GetItemsOptions options = GetItemsOptions.IncludeBranchInfo;
            m_itemSet = server.GetItems(spec, VersionSpec.Latest, DeletedState.NonDeleted, ItemType.Folder, options);
        }

        public void PopulateChildren()
        {
            if (m_itemSet != null)
            {
                Children.Clear();
                for (int i = 1; i < m_itemSet.Items.Length; i++)
                {
                    Children.Add(new VCServerPathNodeViewModel(m_itemSet.Items[i], m_container));
                }
            }
            IsLoading = false;
            IsLoaded = true;
        }

        public void Load(VersionControlServer server)
        {
            if (!IsLoaded)
            {
                GetItems(server);
                PopulateChildren();
            }
        }

        private bool m_isLoading = false;
        public bool IsLoading
        {
            get
            {
                return m_isLoading;
            }
            private set
            {
                if (m_isLoading != value)
                {
                    m_isLoading = value;
                    OnPropertyChanged("IsLoading");
                }
            }
        }

        public NodeType Type { get; set; }
        public bool IsSelected { get; set; }

        private bool m_isExpanded = false;
        public bool IsExpanded
        {
            get
            {
                return m_isExpanded && Children.Count > 0;
            }
            set
            {
                m_isExpanded = value;
                if (m_isExpanded && !IsLoaded)
                {
                    Children.Clear();
                    IsLoading = true;
                    m_container.QueueLoadChildren(this);
                }
                OnPropertyChanged("IsExpanded");
            }
        }

        private bool m_isLoaded = false;
        public bool IsLoaded
        {
            get
            {
                return m_isLoaded;
            }
            private set
            {
                m_isLoaded = value;
                OnPropertyChanged("IsLoaded");
                OnPropertyChanged("IsExpanded");
            }
        }

        public virtual string ServerPath
        {
            get
            {
                return m_item.ServerItem;
            }
        }

        public virtual string DisplayName
        {
            get
            {
                return VersionControlPath.GetFileName(ServerPath);
            }
        }

        private ObservableCollection<VCServerPathNodeViewModel> m_children;
        public ObservableCollection<VCServerPathNodeViewModel> Children
        {
            get
            {
                if (m_children == null)
                {
                    m_children = new ObservableCollection<VCServerPathNodeViewModel>();
                    m_children.Add(new VCServerPathStubViewModel());
                }
                return m_children;
            }
        }

        #region INotifyPropertyChanged Members

        public event PropertyChangedEventHandler PropertyChanged;
        protected void OnPropertyChanged(string info)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(info));
            }
        }

        #endregion

        public enum NodeType
        {
            Root,
            Folder,
            Branch,
            None
        }
    }
}


text:
<!DOCTYPE html>

  <title>Susan | Resume </title>
  <link rel="stylesheet" type="text/css" href="resumeStyle.css">

   <link rel="stylesheet" type="text/css" <link href='https://fonts.googleapis.com/css?family=Averia+Serif+Libre' rel='stylesheet' type='text/css'>

Menu

Resume

 Download Resume

2015 Susan Savariar. All rights reserved.

redpajama_set_name: RedPajamaGithub


text:
import { CommonModule } from '@angular/common';

import { RouterModule } from '@angular/router';
import { NgModule, ModuleWithProviders } from '@angular/core';

import { ActivityButtonComponent } from './';

import { ImageModule } from 'src/app/maincontent/image/image.module';
import { SharedModule } from 'src/app/shared/shared.module';
import { ActivityService } from './activity.service';

@NgModule({
    imports: [
      CommonModule,

      RouterModule,
      ImageModule,
      SharedModule,
    ],
    declarations: [
      ActivityButtonComponent,

    ],
    providers: [
      ActivityService,
    ],
    entryComponents: [
    ],
    exports: [
      ActivityButtonComponent,
    ],

})
export class ActivityModule {
}


text:
namespace onnxruntime {

static const NPUDataTransfer* GetNPUDataTransfer(const SessionState* session_state) {
  OrtDevice npu_device(OrtDevice::NPU, OrtDevice::MemType::DEFAULT, 0);
  OrtDevice cpu_device;
  return static_cast<const NPUDataTransfer*>(
      session_state->GetDataTransferMgr().GetDataTransfer(npu_device, cpu_device));
}

void* CANNAllocator::Alloc(size_t size) {
  void* p = nullptr;
  aclrtMemMallocPolicy policy = ACL_MEM_MALLOC_HUGE_FIRST;
  if (size > 0) {
    CANN_CALL_THROW(aclrtMalloc(reinterpret_cast<void**>(&p), size, policy));
  }
  return p;
}

void CANNAllocator::Free(void* p) {
  aclrtFree(p);
}

FencePtr CANNAllocator::CreateFence(const SessionState* session_state) {
  return std::make_shared<CANNFence>(GetNPUDataTransfer(session_state));
}

void* CANNPinnedAllocator::Alloc(size_t size) {
  void* p = nullptr;
  if (size > 0) {
    CANN_CALL_THROW(aclrtMallocHost(reinterpret_cast<void**>(&p), size));
  }
  return p;
}

void CANNPinnedAllocator::Free(void* p) {
  CANN_CALL_THROW(aclrtFreeHost(p));
}

FencePtr CANNPinnedAllocator::CreateFence(const SessionState* session_state) {
  return std::make_shared<CANNFence>(GetNPUDataTransfer(session_state));
}

}  // namespace onnxruntime


text:
<!DOCTYPE html>

	<title>Leaflet debug page</title>

	<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.0.0-beta.2/leaflet.css" />

	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<link rel="stylesheet" href="../screen.css" />

	<link rel="stylesheet" href="../../dist/MarkerCluster.css" />
	<link rel="stylesheet" href="../../dist/MarkerCluster.Default.css" />

	<button id="doit">Zoom in</button>

	Bug #216. Click the button. It will zoom in, leaflet will not do an animation for the zoom. A marker should be visible.


text:
<!DOCTYPE html>

    <meta name="top_category" value="develop" />

    <meta name="subcategory" value="reference" />

      <meta name="book_path" value="/reference/android/support/test/_book.yaml" />

<title>ResettingStubber</title>

Summary:

  Methods

  | Inherited Methods

| [Expand All]

ResettingStubber

  public

  interface
  ResettingStubber

      implements

        IntentStubber

    android.support.test.espresso.intent.ResettingStubber

  Known Indirect Subclasses

              ResettingStubberImpl

        ResettingStubberImpl

          Implementation of ResettingStubber

A sneaky singleton object used to respond to intents with fake responses.
 This interface is not meant for public consumption. Test authors should use Intents
 instead.

Summary

Public methods

        abstract

        void

      initialize()

Marks this spy as initialized.

        abstract

        boolean

      isInitialized()

        abstract

        void

      reset()

Clears state (initialization, expected responses).

        abstract

        void

      <a href="/reference/android/support/test/espresso/intent/ResettingStubber.html#setActivityResultForIntent(org.hamcrest.Matcher<android.content.Intent>, android.app.Instrumentation.ActivityResult)">setActivityResultForIntent(Matcher<Intent> matcher, Instrumentation.ActivityResult result)

Sets the result that will be returned to the intent sender (if the sender expects the
 result), next time an intent matched by the given matcher is launched.

Inherited methods

  From
interface

    android.support.test.runner.intent.IntentStubber

        abstract

        Instrumentation.ActivityResult

      getActivityResultForIntent(Intent intent)

Returns the first matching stubbed result for the given activity if stubbed result was set
 by test author.

Public methods

initialize

void initialize ()

Marks this spy as initialized. Once initialized, ResettingStubber begins recording intents
 and provides intent stubbing.

isInitialized

boolean isInitialized ()

Returns

        boolean
        true if this spy is initialized

reset

void reset ()

Clears state (initialization, expected responses).

 Must be called on main thread.

<A NAME="setActivityResultForIntent(org.hamcrest.Matcher<android.content.Intent>, android.app.Instrumentation.ActivityResult)">

setActivityResultForIntent

void setActivityResultForIntent (Matcher<Intent> matcher,
                Instrumentation.ActivityResult result)

Sets the result that will be returned to the intent sender (if the sender expects the
 result), next time an intent matched by the given matcher is launched.

Parameters

        matcher

          Matcher

        result

          Instrumentation.ActivityResult

Interfaces

ResettingStubber

ResolvedIntent

VerifiableIntent

VerificationMode

Classes

Checks

Intents

OngoingStubbing

ResettingStubberImpl

VerificationModes


text:
require 'rails_helper'

RSpec.describe 'Home page' do
  before(:each) do
    # Mock the Lateral API with valid key of 'test'
    # Sets @results and @documents instance variables
    init_fake_lateral!
    @creds = FactoryGirl.create(:credentials, key: 'test', name: 'Max')
  end

  scenario 'renders the page if not password protectd', js: true do
    visit "/#{@creds.url_hash}/#{@creds.slug}"
    wait_for_ajax
    assert_equal 200, page.status_code
    expect(page).to have_content 'MAX NAVIGATOR'
  end

  scenario 'gets past auth if password protected', js: true do
    creds = FactoryGirl.create(:credentials, key: 'test', name: 'Max', password_protected: true,
                                             username: 'max', password: 'password')
    page.driver.basic_authorize creds.username, creds.password
    visit "/#{creds.url_hash}/#{creds.slug}"
    wait_for_ajax
    assert_equal 200, page.status_code
    expect(page).to have_content 'MAX NAVIGATOR'
  end

  scenario 'renders five results', js: true do
    visit "/#{@creds.url_hash}/#{@creds.slug}"
    wait_for_ajax
    expect(page).to have_content @documents.last[:meta][:title]
    expect(page).to have_selector('.result', count: 5)
  end

  scenario 'clicking a random document gets results', js: true do
    visit "/#{@creds.url_hash}/#{@creds.slug}"
    wait_for_ajax
    page.all(:css, "a[data-id='#{@documents.first[:id]}']")[0].click
    wait_for_ajax
    expect(page).to have_content @documents.first[:meta][:title]
    @results.each do |result|
      expect(page).to have_content result[:meta][:title]
    end
  end
end


text:
using namespace mesos::internal::slave;

using namespace process;

using std::vector;

using testing::_;
using testing::Return;

namespace mesos {
namespace internal {
namespace tests {

class ComposingContainerizerTest : public MesosTest {};

class MockContainerizer : public slave::Containerizer
{
public:
  MOCK_METHOD1(
      recover,
      process::Future<Nothing>(
          const Option<slave::state::SlaveState>&));

  MOCK_METHOD7(
      launch,
      process::Future<bool>(
          const ContainerID&,
          const ExecutorInfo&,
          const std::string&,
          const Option<std::string>&,
          const SlaveID&,
          const process::PID<Slave>&,
          bool));

  MOCK_METHOD8(
      launch,
      process::Future<bool>(
          const ContainerID&,
          const TaskInfo&,
          const ExecutorInfo&,
          const std::string&,
          const Option<std::string>&,
          const SlaveID&,
          const process::PID<Slave>&,
          bool));

  MOCK_METHOD2(
      update,
      process::Future<Nothing>(
          const ContainerID&,
          const Resources&));

  MOCK_METHOD1(
      usage,
      process::Future<ResourceStatistics>(
          const ContainerID&));

  MOCK_METHOD1(
      wait,
      process::Future<containerizer::Termination>(
          const ContainerID&));

  MOCK_METHOD1(
      destroy,
      void(const ContainerID&));

  MOCK_METHOD0(
      containers,
      process::Future<hashset<ContainerID> >());
};

// This test checks if destroy is called while container is being
// launched, the composing containerizer still calls the underlying
// containerizer's destroy and skip calling the rest of the
// containerizers.
TEST_F(ComposingContainerizerTest, DestroyWhileLaunching)
{
  vector<Containerizer*> containerizers;

  MockContainerizer* mockContainerizer = new MockContainerizer();
  MockContainerizer* mockContainerizer2 = new MockContainerizer();

  containerizers.push_back(mockContainerizer);
  containerizers.push_back(mockContainerizer2);

  ComposingContainerizer containerizer(containerizers);
  ContainerID containerId;
  containerId.set_value("container");
  TaskInfo taskInfo;
  ExecutorInfo executorInfo;
  SlaveID slaveId;
  PID<Slave> slavePid;

  Promise<bool> launchPromise;

  EXPECT_CALL(*mockContainerizer, launch(_, _, _, _, _, _, _, _))
    .WillOnce(Return(launchPromise.future()));

  Future<Nothing> destroy;

  EXPECT_CALL(*mockContainerizer, destroy(_))
    .WillOnce(FutureSatisfy(&destroy));

  Future<bool> launch = containerizer.launch(
      containerId,
      taskInfo,
      executorInfo,
      "dir",
      "user",
      slaveId,
      slavePid,
      false);

  Resources resources = Resources::parse("cpus:1;mem:256").get();

  EXPECT_TRUE(launch.isPending());

  containerizer.destroy(containerId);

  EXPECT_CALL(*mockContainerizer2, launch(_, _, _, _, _, _, _, _))
    .Times(0);

  // We make sure the destroy is being called on the first containerizer.
  // The second containerizer shouldn't be called as well since the
  // container is already destroyed.
  AWAIT_READY(destroy);

  launchPromise.set(false);
  AWAIT_FAILED(launch);
}

} // namespace tests {
} // namespace internal {
} // namespace mesos {


text:
package com.github.gfronza.mods.bayeux.impl.protocol.transports;

import io.vertx.core.http.HttpServerRequest;

import com.github.gfronza.mods.bayeux.impl.protocol.Transport;

public class LongPollingTransport implements Transport {

	@Override
	public String getName() {
		// TODO
		return null;
	}

	@Override
	public boolean accept(HttpServerRequest request) {
		// TODO
		return false;
	}

	@Override
	public void handle(HttpServerRequest request) {
		// TODO

	}

}


text:
/*
 * L21_ADC_example.c
 *
 * Created: 8/10/2016 9:58:38 AM
 * Author : jerome.semette (Grom-)
 */

#include "sam.h"

static void TCC0_Init(void);
static void ADC_Init(void);
volatile uint16_t ADC_Result;  // Analog to Digital conversion result

static void TCC0_Init(void){
	// - Enable TCC0 Bus clock (Timer counter control clock)
	MCLK->APBCMASK.reg |= MCLK_APBCMASK_TCC0;
	//Enable GCLK for TCC0 and link it to GCLK0 see "PCHCTRLm Mapping" from product datasheet
	GCLK->PCHCTRL[25].reg = (GCLK_PCHCTRL_CHEN|GCLK_PCHCTRL_GEN(0));
	// - Disable TCC0
	TCC0->CTRLA.reg &=~(TCC_CTRLA_ENABLE);
	// - Set TCC0 in waveform mode Normal PWM
	TCC0->WAVE.reg |= TCC_WAVE_WAVEGEN_NPWM;
	// - Set PER to maximum counter value (resolution : 0xFF)
	TCC0->PER.reg = 0xFF;
	// - Set WO[0] compare register to 0x7F (PWM duty cycle = 50%)
	TCC0->CC[0].reg = 0x7F;
	// - Enable Channel 0 Match Event Output
	TCC0->EVCTRL.bit.MCEO0 = 0x01;
	// - Set PB10 (LED) as TCC0 Waveform out (PMUX : F = 0x05)
	PORT->Group[1].WRCONFIG.reg = (uint32_t)(PORT_WRCONFIG_WRPINCFG|PORT_WRCONFIG_WRPMUX|1<<10|PORT_WRCONFIG_PMUXEN|(0x5<<PORT_WRCONFIG_PMUX_Pos));
	// - ENABLE TCC0
	TCC0->CTRLA.reg |= TCC_CTRLA_ENABLE;
 }

static void ADC_Init(void)
{
	// - Enable TCC0 Bus clock (ADC control clock)
	MCLK->APBDMASK.reg |= MCLK_APBDMASK_ADC;
	// - Enable ADC_GCLK and link it to GCLK0 (see "PCHCTRLm Mapping" from product datasheet)
	GCLK->PCHCTRL[30].reg = (GCLK_PCHCTRL_CHEN|GCLK_PCHCTRL_GEN(0));
	/* Disable ADC (required for configuration) */
	ADC->CTRLA.bit.ENABLE = 0x00;
	/* Reset ADC configuration */
	ADC->CTRLA.bit.SWRST = 0x01;
	/* configure GCLK_ADC prescaler */
	ADC->CTRLB.bit.PRESCALER = ADC_CTRLB_PRESCALER_DIV2_Val;
	/* Set Reference voltage source as internal */
	ADC->REFCTRL.bit.REFSEL = ADC_REFCTRL_REFSEL_INTREF_Val;
	/* Set ADC resolution to 12-bit */
	ADC->CTRLC.bit.RESSEL = ADC_CTRLC_RESSEL_12BIT_Val;
	/* Set conversion type to single ended */
	ADC->CTRLC.bit.DIFFMODE = 0x00;
	/* Enable Start conversion on event reception*/
	ADC->EVCTRL.bit.STARTEI = 0x01;
	/* Enable ADC result ready interrupt */
	ADC->INTENSET.bit.RESRDY = 0x01;
	/* Enable general ADC interrupt (ID 22)*/
	NVIC_EnableIRQ(ADC_IRQn);
	/* Enable ADC */
	ADC->CTRLA.bit.ENABLE = 0x01;
}

static EVSYS_init(void)
{
	// - Enable TCC0 Bus clock (Timer counter control clock)
	MCLK->APBDMASK.reg |= MCLK_APBDMASK_EVSYS;
	// Link ADC START user to CHANNEL0 (see User Multiplexer Number from product datasheet)
	EVSYS->USER[31].bit.CHANNEL = 0x01;
	// Set TCC0 Capture 0 signal as Channel 0 event generator (see "EVGEN[6:0]: Event Generator" table from product datasheet)
	EVSYS->CHANNEL[0].bit.EVGEN = 0x27;
	// Set Channel path as Asynchronous
	EVSYS->CHANNEL[0].bit.PATH = EVSYS_CHANNEL_PATH_ASYNCHRONOUS_Val;
}

/*
 * Handles interrupts coming from the ADC.
 */
void ADC_Handler(void)
{
    uint32_t isr;
	/* Read Interrupt status register*/
    isr = ADC->INTFLAG.reg;
    /* Check if RXBUFF interrupt appears */
    if (isr & ADC_INTFLAG_RESRDY)
    {
	  //Read ADC Result
      ADC_Result = (ADC->RESULT.reg);
	  // Clear RESRDY
	  ADC->INTFLAG.bit.RESRDY = 1;
	}
	/* Check if General Overrun interrupt appears */
    if (isr & ADC_INTFLAG_OVERRUN)
    {
	  /** Debug ** Put a breakpoint there to monitor ADC overrun */
	  while(1);
    }
}

void main( void )
{
   // Initialize System (PLL config + Watchdog disable)
   SystemInit();
   //Configure Event system to link TCC0 compare 0 event to ADC START
   EVSYS_init();
   //Configure ADC
   ADC_Init();
   // configure Timer counter 0
   TCC0_Init();
   while(1);
}


text:
/*jslint devel: true,  undef: true, newcap: true, strict: true, maxerr: 50 */

/*global YUI*/

/**
 * Chart to show throughput (bytes per second) for send/receive summed across
 * all NICs, for each gateway.
 *
 * @module nic-write-thpt-combined-chart
 */
YUI.add('nic-write-thpt-combined-chart', function(Y) {
    "use strict";

    // handy constants and shortcuts used in the module
    var Lang = Y.Lang,
    NAME = 'nicWriteThptCombinedChart';

    /**
     * The View for the 'nic write throughput' (Bps) when combining the write
     * output of all the NICs on the gateway's host.
     *
     * @class NicWriteThptCombinedChart
     * @extends Y.DashboardChart
     * @uses xxxxx
     * @constructor
     * @cfg {object} configuration attributes
     */
    Y.NicWriteThptCombinedChart = Y.Base.create(
        NAME,
        Y.DashboardChart,
        [],
        {
            initializer: function() {
                var $this = this;

                var model = $this.get('model');

                model && model.addTarget($this);

                // We're going to listen for NIC list update events ONLY.
                // Because we can retrieve the gatewayModel instance from that
                // event, we know what gatewayModel instances we need to display.
                // We should NOT have to listen for GATEWAY_AVAILABLE and
                // GATEWAY_UNAVAILABLE events because of this.
                $this.on(Y.NicListModel.prototype.UPDATE_EVENT,
                            $this.onNicListUpdate,
                            $this);
            },

            // The listener for additions to the data. This is the ONLY
            // routine that will get data.
            onNicListUpdate: function(ev) {
                var dashboard = this.get('dashboard');

                var shouldDraw = false;

                // Because we're getting this event, we know that we
                // have at least one gateway that is reporting information.
                var nicListModel = ev.model;
                var gatewayModel = nicListModel.get('gatewayModel');

                var dataItemValues = this.get('dataItemValues');

                var instanceKey = gatewayModel.get('instanceKey');

                // the array of N NICs, M values per NIC, for a given gateway.
                var nicData = ev.data;
                var numNics = nicData.length;

                if (numNics == 0) {
                    return;  // should never happen, but just in case
                }

                // Each gateway has an array of data item values
                var values = dataItemValues[instanceKey];
                if (!values) {
                    values = [];
                    dataItemValues[instanceKey] = values;
                    shouldDraw = true;
                }

                // Get the indexes of the values we need to read from the nicList data
                var txBytesPerSecondIndex = this.get('txBytesPerSecondIndex');
                var readTimeIndex = this.get('readTimeIndex');

                if (txBytesPerSecondIndex == null) {
                    readTimeIndex = gatewayModel.summaryAttributeIndex('nicList', 'readTime');
                    txBytesPerSecondIndex = gatewayModel.summaryAttributeIndex('nicList', 'txBytesPerSecond');
                    this.set('readTimeIndex', readTimeIndex);
                    this.set('txBytesPerSecondIndex', txBytesPerSecondIndex);
                }

                // For this chart, the new read and write values are a combination of
                // values across all the NICs.

                // total the nicData across all the NICs
                var newTxValue = 0.0;

                for (var nicIndex = 0; nicIndex < numNics; nicIndex++) {
                    newTxValue += nicData[nicIndex][txBytesPerSecondIndex];
                }

                if (numNics > 0) {
                    newTxValue = newTxValue / numNics;
                }

                // Take the time from the first NIC's entries
                var newTime = ev.data[0][readTimeIndex];

                // Adjust the Y domain min/max and values multiplier, if these
                // new data points are outside the current bounds.
                var yDomain = this.get('yDomain');
                var valuesMultiplier = this.get('valuesMultiplier');

                var newBounds = this.computeDomainBounds(newTxValue,
                                                         yDomain[0],
                                                         yDomain[1],
                                                         valuesMultiplier);

                if (newBounds.domainMin !== yDomain[0] ||
                    newBounds.domainMax !== yDomain[1] ||
                    newBounds.valuesMultiplier !== valuesMultiplier) {
                    this.set('yDomain', [newBounds.domainMin, newBounds.domainMax]);
                    this.set('valuesMultiplier', newBounds.valuesMultiplier);
                    shouldDraw = true;
                }

                // Insert the new [time, value] pairs into the right slots in their values list.
                insertChartValue(values, newTime, newTxValue);

                // XXX The following is not the best, as it misses the case
                // where the point is the first one off the screen to the
                // right, extending on that was on-screen.
                if (dashboard.isTimeVisible(newTime)) {
                    shouldDraw = true;
                }

                this.adjustTitle();
                this.adjustSummary();

                if (shouldDraw) {
                    this.drawChart();
                }
            },

            /**
             * Retrieve the current list of data items. Each will be used to
             * draw a path. The function can do anything it wants, but must
             * return an array of items. We'll just return a list of gateway
             * instanceKeys, since they are immutable and never go away, and
             * we're already using them as keys into the dataItemValues.
             */
            getDataItems: function() {
                var clusterModel = this.get('model');

                var dataItems = [];
                var dataItemValues = this.get('dataItemValues');

                for (var instanceKey in dataItemValues) {
                    if (dataItemValues.hasOwnProperty(instanceKey)) {
                        if (this.isShowGateway(clusterModel.findGatewayModelByInstanceKey(instanceKey))) {
                            dataItems.push(instanceKey);
                        }
                    }
                }

                return dataItems;
            },

            /**
             * Return the list of [time,value] pairs for a given dataItem.
             * This chart's dataItems are its gateway instanceKeys.
             */
            getDataItemValues: function(dataItem) {
                var values = this.get('dataItemValues')[dataItem];
                return (!values ? [] : values);
            },

            /**
             * Compute a string of HTML we'll use for our summary line at
             * the bottom of the chart.
             */
            computeSummaryHtml: function() {
                var dashboard = this.get('dashboard');

                var val = minMaxAverageSummaryFn(this.get('dataItemValues'),
                                                 this.get('valuesMultiplier'),
                                                 dashboard.get('xDomainClip')[1]);
                return val;
            },

            /**
             * Given a data item (for this chart, an instanceKey), return the color to use for its line.
             */
            getDataItemColor: function(dataItem) {
                var gatewayModel = this.get('model').findGatewayModelByInstanceKey(dataItem);
                return this.get('dashboard').getColor(gatewayModel.get('connectionUrl'));
            },

            /**
             * Given two dataItems (for this chart, each is a gatewayModel)
             * return whether they are equal or not.
             */
            dataItemsEqual: function(dataItem1, dataItem2) {
                return (dataItem1 === dataItem2);
            }
        },
        {
            ATTRS: {
                title: {
                    value: null
                },

                valueType: {
                    value: 'byteRate'
                },

                showUnits: {
                    value: true
                },

                // an object containing one property for each gateway, the
                // gateway's gatewayLabel. For this chart, the value
                // is an array of [time, value] pairs, the relevant NICList
                // 'txBytesPerSecond' property value for that gateway at that specific time.
                dataItemValues: {
                    value: {}
                },

                // the index in the summary data of the 'txBytesPerSecond' property.
                // NOTE: we're assuming it's the same for all gateways, which
                // may or may not be true if they are at different versions.
                txBytesPerSecondIndex: {
                    value: null
                },

                // The index in the summary data of the 'readTime' attribute
                readTimeIndex: {
                    value: null
                }
            }
        }
    );
}, '0.99', {
    requires: ['kaazing-view', 'dashboard-chart', 'gateway-model']
});


text:
'use strict';
var db = require('orm').db;
var express = require('express');

/**
 * Verificar la existencia del usuario
 */
exports.GetUser = function(req, res) {
	var username = req.param("username");
	var password = req.param("password");

	db.models.tbusers.find({
		login: username,
		pass: password
	}, function(err, users) {
		if (err) {
			console.log(err);
			res.send(500, {
				error: "Error de Conexion con la Base de Datos"
			});
		}

		if (users.length > 0) {
			express.session.authenticate = 'true';
			req.session.authenticate = 'true';
			res.send(users);
		} else {
			res.send(400, {
				error: "No se ha encontrado el usuario"
			});
		}
	});
};

/**
 * Obtener el listado de todos los usuarios
 */
exports.GetAllUsers = function(req, res) {
	console.log([req.params], ['-->>>>get list users']);
	db.models.tbusers.find(function(err, users) {
		if (err) {
			console.log([err], ['Error in Getting Users!']);
			res.send({
				'success': false,
				'msg': 'Error obteniendo el paciente'
			});
		} else {
			console.log(['Getting Users!']);
			res.send({
				'success': true,
				'data': users
			});
		}
	});
};


text:
package com.emistoolbox.common.model.mapping.impl;

import com.emistoolbox.common.model.mapping.DbRowFieldAccess;
import java.io.Serializable;
import java.util.Map;
import java.util.Set;

public class DbRowFieldAccessImpl extends DbRowAccessBase implements DbRowFieldAccess, Serializable
{
    private static final long serialVersionUID = 1L;
    private String field;

    public String getFieldName()
    {
        return this.field;
    }

    public void setFieldName(String name)
    {
        this.field = name;
    }

    public String getValue(int valueIndex, Map<String, String> row)
    {
        return (String) row.get(this.field);
    }

    public int getValuesPerRow()
    {
        return 1;
    }

    public void addColumns(Set<String> columns)
    {
        columns.add(this.field);
    }

    public String getInfo()
    { return "field:" + field; }
}


text:
function n = ndims( x )
n = length( size( x ) );

% Copyright 2012 CVX Research, Inc.
% See the file COPYING.txt for full copyright information.
% The command 'cvx_where' will show where this file is located.


text: export * from './url-validation-demo.component';


text:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <title>ActionView::Base</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link rel="stylesheet" href="../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../css/main.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../css/github.css" type="text/css" media="screen" />

            Ruby on Rails 4.1.6

            Class
            ActionView::Base

                <

                    Object

/Users/Sean/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/actionview-4.1.6/lib/action_view/base.rb

Action View Base

Action View templates can be written in several ways. If the template file
has a .erb extension then it uses a mixture of ERB (included in Ruby) and HTML. If the template file has a
.builder extension then Jim Weirich's Builder::XmlMarkup
library is used.

ERB

You trigger ERB by using embeddings such as <%
%>, <% -%>, and <%= %>. The <%= %> tag set is used
when you want output. Consider the following loop for names:

<b>Names of all the people</b>
<% @people.each do |person| %>
  Name: <%= person.name %><br/>
<% end %>

The loop is setup in regular embedding tags <% %> and the name is
written using the output embedding tag <%= %>. Note that this is not
just a usage suggestion. Regular output functions like print or puts
won't work with ERB templates. So this would
be wrong:

<%# WRONG %>
Hi, Mr. <% puts "Frodo" %>

If you absolutely must write from within a function use
concat.

<%- and -%> suppress leading and trailing whitespace, including the
trailing newline, and can be used interchangeably with <% and %>.

Using sub templates

Using sub templates allows you to sidestep tedious replication and extract
common display structures in shared templates. The classic example is the
use of a header and footer (even though the Action Pack-way would be to use
Layouts):

<%= render "shared/header" %>
Something really specific and terrific
<%= render "shared/footer" %>

As you see, we use the output embeddings for the render methods. The render
call itself will just return a string holding the result of the rendering.
The output embedding writes it to the current template.

But you don't have to restrict yourself to static includes. Templates
can share variables amongst themselves by using instance variables defined
using the regular embedding tags. Like this:

<% @page_title = "A Wonderful Hello" %>
<%= render "shared/header" %>

Now the header can pick up on the @page_title variable and use
it for outputting a title tag:

<title><%= @page_title %></title>

Passing local variables to sub templates

You can pass local variables to sub templates by using a hash with the
variable names as keys and the objects as values:

<%= render "shared/header", { headline: "Welcome", person: person } %>

These can now be accessed in shared/header with:

Headline: <%= headline %>
First name: <%= person.first_name %>

If you need to find out whether a certain local variable has been assigned
a value in a particular render call, you need to use the following pattern:

<% if local_assigns.has_key? :headline %>
  Headline: <%= headline %>
<% end %>

Testing using defined? headline will not work. This is an
implementation restriction.

Template caching

By default, Rails will compile each template to a method in order to render
it. When you alter a template, Rails will check the file's modification
time and recompile it in development mode.

Builder

Builder templates are a more programmatic alternative to ERB. They are especially useful for generating XML
content. An XmlMarkup object named xml is automatically made
available to templates with a .builder extension.

Here are some basic examples:

xml.em("emphasized")                                 # => <em>emphasized</em>
xml.em { xml.b("emph & bold") }                      # => <em><b>emph &amp; bold</b></em>
xml.a("A Link", "href" => "http://onestepback.org")  # => <a href="http://onestepback.org">A Link</a>
xml.target("name" => "compile", "option" => "fast")  # => <target option="fast" name="compile"\>
                                                     # NOTE: order of attributes is not specified.

Any method with a block will be treated as an XML markup tag with nested
markup in the block. For example, the following:

xml.div do
  xml.h1(@person.name)
  xml.p(@person.bio)
end

would produce something like:

<div>
  <h1>David Heinemeier Hansson</h1>
  <p>A product of Danish Design during the Winter of '79...</p>
</div>

A full-length RSS example actually used on Basecamp:

xml.rss("version" => "2.0", "xmlns:dc" => "http://purl.org/dc/elements/1.1/") do
  xml.channel do
    xml.title(@feed_title)
    xml.link(@url)
    xml.description "Basecamp: Recent items"
    xml.language "en-us"
    xml.ttl "40"

    @recent_items.each do |item|
      xml.item do
        xml.title(item_title(item))
        xml.description(item_description(item)) if item_description(item)
        xml.pubDate(item_pubDate(item))
        xml.guid(@person.firm.account.url + @recent_items.url(item))
        xml.link(@person.firm.account.url + @recent_items.url(item))

        xml.tag!("dc:creator", item.author_name) if item_has_creator?(item)
      end
    end
  end
end

More builder documentation can be found at builder.rubyforge.org.

Methods

C

                cache_template_loading,

                cache_template_loading=

Included Modules

              ActionView::Helpers

              ERB::Util

              ActionView::Context

Attributes

              [RW]

            view_renderer

Class Public methods

              cache_template_loading()

            Link

                Source:
                show

# File ../../.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/actionview-4.1.6/lib/action_view/base.rb, line 166
def cache_template_loading
  ActionView::Resolver.caching?
end

              cache_template_loading=(value)

            Link

                Source:
                show

# File ../../.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/actionview-4.1.6/lib/action_view/base.rb, line 170
def cache_template_loading=(value)
  ActionView::Resolver.caching = value
end


text:
<?php

namespace Magento\Framework\App;

/**
 * An exception that indicates application initialization error
 */
class InitException extends \Exception
{
}


text:
usage() {
  echo "Usage: ${0} <filename>"
}

# check parameter number
if [ $# -ne 1 ]; then
  usage
  exit 1
fi

# source common labs
source ../../mylibs/commons.sh

# remove previous NAT settings
./bulkRemoveLocalNAT.sh ${1}

# Read lines as array to MAPFILE
readLinesFromFile ${1}

for line in "${MAPFILE[@]}"
do
  debug "./addLocalNAT.sh ${line}"
  ./addLocalNAT.sh ${line}
done
exit 0


text:
package org.jkiss.dbeaver.ext.postgresql.model.data;

import org.jkiss.dbeaver.model.impl.data.formatters.BinaryFormatterHex;

/**
 * PostgreBinaryFormatter
 */
public class PostgreBinaryFormatter extends BinaryFormatterHex {

    public static final PostgreBinaryFormatter INSTANCE = new PostgreBinaryFormatter();
    private static final String HEX_PREFIX = "decode('";
    private static final String HEX_POSTFIX = "','hex')";

    @Override
    public String getId()
    {
        return "pghex";
    }

    @Override
    public String getTitle()
    {
        return "PostgreSQL Hex";
    }

    @Override
    public String toString(byte[] bytes, int offset, int length)
    {
        return HEX_PREFIX + super.toString(bytes, offset, length) + HEX_POSTFIX;
    }

    @Override
    public byte[] toBytes(String string)
    {
        if (string.startsWith(HEX_PREFIX)) {
            string = string.substring(
                HEX_PREFIX.length(),
                string.length() - HEX_POSTFIX.length());
        }
        return super.toBytes(string);
    }

}