text:
namespace xwalk {

namespace {

XWalkRunner* g_xwalk_runner = NULL;

}  // namespace

XWalkRunner::XWalkRunner()
    : app_component_(nullptr) {
  VLOG(1) << "Creating XWalkRunner object.";
  DCHECK(!g_xwalk_runner);
  g_xwalk_runner = this;

  XWalkRuntimeFeatures::GetInstance()->Initialize(
      base::CommandLine::ForCurrentProcess());

  // Initializing after the g_xwalk_runner is set to ensure
  // XWalkRunner::GetInstance() can be used in all sub objects if needed.
  content_browser_client_.reset(new XWalkContentBrowserClient(this));
}

XWalkRunner::~XWalkRunner() {
  DCHECK(g_xwalk_runner);
  g_xwalk_runner = NULL;
  VLOG(1) << "Destroying XWalkRunner object.";
}

// static
XWalkRunner* XWalkRunner::GetInstance() {
  return g_xwalk_runner;
}

application::ApplicationSystem* XWalkRunner::app_system() {
  return app_component_ ? app_component_->app_system() : NULL;
}

void XWalkRunner::PreMainMessageLoopRun() {
  browser_context_.reset(new XWalkBrowserContext);
  app_extension_bridge_.reset(new XWalkAppExtensionBridge());

  base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess();
  if (!cmd_line->HasSwitch(switches::kXWalkDisableExtensions))
    extension_service_.reset(new extensions::XWalkExtensionService(
        app_extension_bridge_.get()));

  CreateComponents();
  app_extension_bridge_->SetApplicationSystem(app_component_->app_system());
  browser_context_->set_application_service(
      app_system()->application_service());
}

void XWalkRunner::PostMainMessageLoopRun() {
  DestroyComponents();
  extension_service_.reset();
  browser_context_.reset();
  DisableRemoteDebugging();
}

void XWalkRunner::CreateComponents() {
  std::unique_ptr<ApplicationComponent> app_component(CreateAppComponent());
  // Keep a reference as some code still needs to call
  // XWalkRunner::app_system().
  app_component_ = app_component.get();
  AddComponent(std::move(app_component));

  if (XWalkRuntimeFeatures::isSysAppsEnabled())
    AddComponent(CreateSysAppsComponent());
  if (XWalkRuntimeFeatures::isStorageAPIEnabled())
    AddComponent(CreateStorageComponent());
}

void XWalkRunner::DestroyComponents() {
  // The ScopedVector takes care of deleting all the components. Ensure that
  // components are deleted before their dependencies by reversing the order.
  std::reverse(components_.begin(), components_.end());
  components_.clear();

  app_component_ = NULL;
}

void XWalkRunner::AddComponent(std::unique_ptr<XWalkComponent> component) {
  components_.push_back(component.release());
}

std::unique_ptr<ApplicationComponent> XWalkRunner::CreateAppComponent() {
  return base::WrapUnique(new ApplicationComponent(browser_context_.get()));
}

std::unique_ptr<SysAppsComponent> XWalkRunner::CreateSysAppsComponent() {
  return base::WrapUnique(new SysAppsComponent());
}

std::unique_ptr<StorageComponent> XWalkRunner::CreateStorageComponent() {
  return base::WrapUnique(new StorageComponent());
}

void XWalkRunner::InitializeRuntimeVariablesForExtensions(
    const content::RenderProcessHost* host,
    base::ValueMap* variables) {
  application::Application* app = app_system()->application_service()->
      GetApplicationByRenderHostID(host->GetID());

  if (app)
    (*variables)["app_id"] = new base::StringValue(app->id());
}

void XWalkRunner::OnRenderProcessWillLaunch(content::RenderProcessHost* host) {
  if (!extension_service_)
    return;

  std::vector<extensions::XWalkExtension*> ui_thread_extensions;
  std::vector<extensions::XWalkExtension*> extension_thread_extensions;

  ScopedVector<XWalkComponent>::iterator it = components_.begin();
  for (; it != components_.end(); ++it) {
    XWalkComponent* component = *it;
    component->CreateUIThreadExtensions(host, &ui_thread_extensions);
    component->CreateExtensionThreadExtensions(
        host, &extension_thread_extensions);
  }

  // TODO(cmarcelo): Once functionality is moved to components, remove
  // CreateInternalExtensions*() functions from XWalkBrowserMainParts.
  XWalkBrowserMainParts* main_parts = content_browser_client_->main_parts();
  main_parts->CreateInternalExtensionsForUIThread(
      host, &ui_thread_extensions);
  main_parts->CreateInternalExtensionsForExtensionThread(
      host, &extension_thread_extensions);

  InitializeEnvironmentVariablesForGoogleAPIs(host);

  std::unique_ptr<base::ValueMap> runtime_variables(new base::ValueMap);
  InitializeRuntimeVariablesForExtensions(host, runtime_variables.get());
  extension_service_->OnRenderProcessWillLaunch(
      host, &ui_thread_extensions, &extension_thread_extensions,
      std::move(runtime_variables));
}

void XWalkRunner::InitializeEnvironmentVariablesForGoogleAPIs(
    content::RenderProcessHost* host) {
}

void XWalkRunner::OnRenderProcessHostGone(content::RenderProcessHost* host) {
  if (!extension_service_)
    return;
  extension_service_->OnRenderProcessDied(host);
}

void XWalkRunner::EnableRemoteDebugging(int port) {
  const char* local_ip = "0.0.0.0";
  if (port > 0 && port < 65535) {
    if (remote_debugging_server_.get() &&
        remote_debugging_server_.get()->port() == port)
      remote_debugging_server_.reset();
    remote_debugging_server_.reset(
        new RemoteDebuggingServer(browser_context(),
            local_ip, port, std::string()));
  }
}

void XWalkRunner::DisableRemoteDebugging() {
  remote_debugging_server_.reset();
}

// static
std::unique_ptr<XWalkRunner> XWalkRunner::Create() {
#if defined (OS_WIN)
  return std::unique_ptr<XWalkRunner>(new XWalkRunnerWin);
#else
  return std::unique_ptr<XWalkRunner>(new XWalkRunner);
#endif
}

content::ContentBrowserClient* XWalkRunner::GetContentBrowserClient() {
  return content_browser_client_.get();
}

}  // namespace xwalk


text:
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

/**
 * @constructor
 * @extends {CSSRule}
 * @see http://dev.w3.org/csswg/css-animations/#interface-csskeyframerule
 */
function CSSKeyframeRule() {}

/** @type {string} */
CSSKeyframeRule.prototype.keyText;

/** @type {CSSStyleDeclaration} */
CSSKeyframeRule.prototype.style;

/**
 * @constructor
 * @extends {CSSRule}
 * @see http://dev.w3.org/csswg/css-animations/#interface-csskeyframesrule
 */
function CSSKeyframesRule() {}

/** @type {string} */
CSSKeyframesRule.prototype.name;

/** @type {!CSSRuleList} */
CSSKeyframesRule.prototype.cssRules;

/**
 * @type {number}
 * @see http://dev.w3.org/csswg/css-animations/#interface-cssrule
 */
CSSRule.KEYFRAMES_RULE = 7;

/**
 * @type {number}
 */
CSSRule.WEBKIT_KEYFRAMES_RULE = 7;

/**
 * @type {number}
 * @see http://dev.w3.org/csswg/css-animations/#interface-cssrule
 */
CSSRule.KEYFRAME_RULE = 8;

/**
 * @type {number}
 */
CSSRule.WEBKIT_KEYFRAME_RULE = 8;

redpajama_set_name: RedPajamaGithub


text:
{{title}}

    Hello {{name}}

<input type="text" [(ngModel)]="name">
<button (click)="changeSuitColor()">Change Suit Color</button>

<app-workouts></app-workouts>


text:
// OpenGLView.cpp: Implementierungsdatei
//

#include "stdafx.h"
#include "OpenGLView.h"
#include "OpenGLDoc.h"
#include "CrypToolVolRen.h"
#include "3DVisOpt.h"

#include "OpenGL.h"
#include <gl/gl.h>
#include <gl/glu.h>
#include ".\openglview.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

// DONT KNOW WHAT IAM DOING

unsigned char threeto8[8] =
{
	0, 0111>>1, 0222>>1, 0333>>1, 0444>>1, 0555>>1, 0666>>1, 0377
};

unsigned char twoto8[4] =
{
	0, 0x55, 0xaa, 0xff
};

unsigned char oneto8[2] =
{
	0, 255
};

static int defaultOverride[13] =
{
	0, 3, 24, 27, 64, 67, 88, 173, 181, 236, 247, 164, 91
};

static PALETTEENTRY defaultPalEntry[20] =
{
	{ 0,   0,   0,    0 },
	{ 0x80,0,   0,    0 },
	{ 0,   0x80,0,    0 },
	{ 0x80,0x80,0,    0 },
	{ 0,   0,   0x80, 0 },
	{ 0x80,0,   0x80, 0 },
	{ 0,   0x80,0x80, 0 },
	{ 0xC0,0xC0,0xC0, 0 },

	{ 192, 220, 192,  0 },
	{ 166, 202, 240,  0 },
	{ 255, 251, 240,  0 },
	{ 160, 160, 164,  0 },

	{ 0x80,0x80,0x80, 0 },
	{ 0xFF,0,   0,    0 },
	{ 0,   0xFF,0,    0 },
	{ 0xFF,0xFF,0,    0 },
	{ 0,   0,   0xFF, 0 },
	{ 0xFF,0,   0xFF, 0 },
	{ 0,   0xFF,0xFF, 0 },
	{ 0xFF,0xFF,0xFF, 0 }
};

// DONT KNOW WHAT IAM DOING

/////////////////////////////////////////////////////////////////////////////
// COpenGLView

IMPLEMENT_DYNCREATE(COpenGLView, CView)

COpenGLView::COpenGLView()
{
	m_pVolumeRenderer = NULL;
	m_pDC = NULL;
	m_pOldPalette = NULL;
}

COpenGLView::~COpenGLView()
{
}

BEGIN_MESSAGE_MAP(COpenGLView, CView)
	//{{AFX_MSG_MAP(COpenGLView)
	ON_WM_CREATE()
	ON_WM_MOUSEMOVE()
	ON_WM_LBUTTONDOWN()
	ON_WM_LBUTTONUP()
	ON_WM_SIZE()
	ON_WM_CONTEXTMENU()
	ON_COMMAND(ID_POPUP_OPENGL_SHOW_BOX, OnPopupOpenglShowBox)
	ON_WM_DESTROY()
	ON_COMMAND(ID_POPUP_OPENGL_EIGENSCHAFTEN, OnPopupOpenglEigenschaften)
	ON_WM_RBUTTONDOWN()
	ON_WM_RBUTTONUP()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// Zeichnung COpenGLView

void COpenGLView::OnDraw(CDC* pDC)
{
	static BOOL busy = FALSE;
	// ZU ERLEDIGEN: Code zum Zeichnen hier einfügen
	if ( busy )
		return;
	busy = TRUE;

	if ( wglMakeCurrent(m_pDC->GetSafeHdc(), m_hOpenGLContext))
	{
		glDrawBuffer(GL_BACK);

		glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
		glShadeModel(GL_SMOOTH);
		glEnable(GL_DEPTH_TEST);
		glPixelStorei(GL_UNPACK_ALIGNMENT, 1); // IN

		glClearDepth(1.0f);
		glClearColor(0.0f,0.0f,0.0f,1.0f);
		glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

		m_pVolumeRenderer->renderScene();

		glFinish();
		SwapBuffers(wglGetCurrentDC());
	}
	busy = FALSE;
}

/////////////////////////////////////////////////////////////////////////////
// Diagnose COpenGLView

#ifdef _DEBUG
void COpenGLView::AssertValid() const
{
	CView::AssertValid();
}

void COpenGLView::Dump(CDumpContext& dc) const
{
	CView::Dump(dc);
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// Behandlungsroutinen für Nachrichten COpenGLView

int COpenGLView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (CView::OnCreate(lpCreateStruct) == -1)
		return -1;

	Init();

	return 0;
}

int COpenGLView::Init()
{
	PIXELFORMATDESCRIPTOR pfd;
	int		n;

	m_pDC = new CClientDC(this);
	ASSERT(m_pDC != NULL);

	if (!bSetupPixelFormat())
		return 0;

	n = ::GetPixelFormat(m_pDC->GetSafeHdc());
	::DescribePixelFormat(m_pDC->GetSafeHdc(), n, sizeof(pfd), &pfd);

	CreateRGBPalette(); // DONT KNOW WHAT IAM DOING

    // Createan  OpenGL rendering context
	m_hOpenGLContext = wglCreateContext(m_pDC->GetSafeHdc());
	ASSERT(m_hOpenGLContext != NULL);
	wglMakeCurrent(m_pDC->GetSafeHdc(), m_hOpenGLContext);
	glEnable(GL_DEPTH_TEST);

	return 1;
}

void COpenGLView::OnMouseMove(UINT nFlags, CPoint point)
{
	// TODO: Code für die Behandlungsroutine für Nachrichten hier einfügen und/oder Standard aufrufen
	if (NULL != m_pVolumeRenderer) {
		m_pVolumeRenderer->OnMouseMove(nFlags,point);
	}

	CView::OnMouseMove(nFlags, point);
}

void COpenGLView::OnLButtonDown(UINT nFlags, CPoint point)
{
	// TODO: Code für die Behandlungsroutine für Nachrichten hier einfügen und/oder Standard aufrufen
	if (NULL != m_pVolumeRenderer) {
		m_pVolumeRenderer->OnLButtonDown(nFlags,point);
	}

	CView::OnLButtonDown(nFlags, point);
}

void COpenGLView::OnLButtonUp(UINT nFlags, CPoint point)
{
	// TODO: Code für die Behandlungsroutine für Nachrichten hier einfügen und/oder Standard aufrufen
	if (NULL != m_pVolumeRenderer) {
		m_pVolumeRenderer->OnLButtonUp(nFlags,point);
	}

	CView::OnLButtonUp(nFlags, point);
}

BOOL COpenGLView::PreCreateWindow(CREATESTRUCT& cs)
{
	cs.style |= WS_CLIPSIBLINGS | WS_CLIPCHILDREN;
	if( !CView::PreCreateWindow(cs) )
		return FALSE;
	cs.dwExStyle &= ~WS_EX_CLIENTEDGE;
	cs.lpszClass = AfxRegisterWndClass(0);
	return TRUE;
}

BOOL COpenGLView::OnCommand(WPARAM wParam, LPARAM lParam)
{
    switch (LOWORD(wParam))
    {
    case CM_OPENGL_PROPERTIES:
			OnPopupOpenglEigenschaften();
			return TRUE;
    case CM_OPENGL_TOGGLE_BORDER_LINES:
			OnPopupOpenglShowBox();
			return TRUE;
    default:
			return CView::OnCommand(wParam, lParam);
    }
}

#ifdef _DEBUG

COpenGLDoc* COpenGLView::GetDocument()
{
	return STATIC_DOWNCAST(COpenGLDoc, m_pDocument);
}

#endif //_DEBUG

void COpenGLView::OnInitialUpdate()
{
	CView::OnInitialUpdate();

	// TODO: Speziellen Code hier einfügen und/oder Basisklasse aufrufen
	COpenGLDoc *pDoc = GetDocument();
	m_pVolumeRenderer = new CCrypToolVolRen(this);

	if ( m_pVolumeRenderer )
	{
  		if ( pDoc->volume )
			m_pVolumeRenderer->setVolume(pDoc->nResolution, pDoc->dVoxelSize, pDoc->volume->getVolume());
		RECT l_rect;
		this->GetWindowRect(&l_rect);
		m_pVolumeRenderer->setSize(l_rect.right-l_rect.left, l_rect.bottom -l_rect.top);
	}

}

void COpenGLView::OnSize(UINT nType, int cx, int cy)
{
	CView::OnSize(nType, cx, cy);

	if ( m_pVolumeRenderer )
	{
		m_pVolumeRenderer->setSize(cx, cy);
	}
}

void COpenGLView::OnContextMenu(CWnd* pWnd, CPoint point)
{
	// we're MANUALLY building the context menu here, because static resources
	// don't allow dynamic menu content (more precisely: I don't know how to do it...)

	CMenu menu;
	menu.CreatePopupMenu();
	CString menuText;

	// first menu entry
	menuText.LoadString(IDS_CONTEXT_MENU_OPENGL_PROPERTIES);
	menu.InsertMenu(0, MF_BYPOSITION, CM_OPENGL_PROPERTIES, menuText);

	// second menu entry (depending on the "isBoundingBoxVisible" function)
	if(m_pVolumeRenderer) {
		if(m_pVolumeRenderer->isBoundingBoxVisible()) {
			menuText.LoadString(IDS_CONTEXT_MENU_OPENGL_DISABLE_BORDER_LINES);
		}
		else {
			menuText.LoadString(IDS_CONTEXT_MENU_OPENGL_ENABLE_BORDER_LINES);
		}
		menu.InsertMenu(1, MF_BYPOSITION, CM_OPENGL_TOGGLE_BORDER_LINES, menuText);
	}

	// build the context menu
	menu.TrackPopupMenu(TPM_LEFTALIGN | TPM_LEFTBUTTON | TPM_RIGHTBUTTON, point.x, point.y, this);
}

void COpenGLView::OnPopupOpenglShowBox()
{
	// TODO: Code für Befehlsbehandlungsroutine hier einfügen
	if ( m_pVolumeRenderer )
	{
		if ( m_pVolumeRenderer->isBoundingBoxVisible() )
			m_pVolumeRenderer->displayBoundingBox(false);
		else
			m_pVolumeRenderer->displayBoundingBox(true);
	}
}

// DONT KNOW WHAT IAM DOING

void COpenGLView::CreateRGBPalette()
{
	PIXELFORMATDESCRIPTOR pfd;
	LOGPALETTE *pPal;
	int n, i;
	n = ::GetPixelFormat(m_pDC->GetSafeHdc());
	::DescribePixelFormat(m_pDC->GetSafeHdc(), n, sizeof(pfd), &pfd);

	if (pfd.dwFlags & PFD_NEED_PALETTE)
	{
		n = 1 << pfd.cColorBits;
		pPal = (PLOGPALETTE) new char[sizeof(LOGPALETTE) + n * sizeof(PALETTEENTRY)];

		ASSERT(pPal != NULL);

		pPal->palVersion = 0x300;
		pPal->palNumEntries = n;
		for (i=0; i<n; i++)
		{
			pPal->palPalEntry[i].peRed =
					ComponentFromIndex(i, pfd.cRedBits, pfd.cRedShift);
			pPal->palPalEntry[i].peGreen =
					ComponentFromIndex(i, pfd.cGreenBits, pfd.cGreenShift);
			pPal->palPalEntry[i].peBlue =
					ComponentFromIndex(i, pfd.cBlueBits, pfd.cBlueShift);
			pPal->palPalEntry[i].peFlags = 0;
		}

		/* fix up the palette to include the default GDI palette */
		if ((pfd.cColorBits == 8)                           &&
			(pfd.cRedBits   == 3) && (pfd.cRedShift   == 0) &&
			(pfd.cGreenBits == 3) && (pfd.cGreenShift == 3) &&
			(pfd.cBlueBits  == 2) && (pfd.cBlueShift  == 6)
		   )
		{
			for (i = 1 ; i <= 12 ; i++)
				pPal->palPalEntry[defaultOverride[i]] = defaultPalEntry[i];
		}

		m_cPalette.CreatePalette(pPal);
		delete pPal;

		m_pOldPalette = m_pDC->SelectPalette(&m_cPalette, FALSE);
		m_pDC->RealizePalette();
	}
}

unsigned char COpenGLView::ComponentFromIndex(int i, UINT nbits, UINT shift)
{
	unsigned char val;

	val = (unsigned char) (i >> shift);
	switch (nbits)
	{

	case 1:
		val &= 0x1;
		return oneto8[val];
	case 2:
		val &= 0x3;
		return twoto8[val];
	case 3:
		val &= 0x7;
		return threeto8[val];

	default:
		return 0;
	}
}

// DONT KNOW WHAT IAM DOING

void COpenGLView::OnDestroy()
{
	HGLRC   hrc;
	hrc = ::wglGetCurrentContext();

	::wglMakeCurrent(NULL,  NULL);

	if (hrc)
		::wglDeleteContext(hrc);

	if (m_pOldPalette)
		m_pDC->SelectPalette(m_pOldPalette, FALSE);

	if (m_pDC)
		delete m_pDC;

	CView::OnDestroy();

	// TODO: Code für die Behandlungsroutine für Nachrichten hier einfügen

}

BOOL COpenGLView::bSetupPixelFormat(void)
{
	static PIXELFORMATDESCRIPTOR pfd =
	{
		sizeof(PIXELFORMATDESCRIPTOR),  // size of this pfd
		1,                              // version number
		PFD_DRAW_TO_WINDOW |            // support window
		  PFD_SUPPORT_OPENGL |          // support OpenGL
		  PFD_DOUBLEBUFFER,             // double buffered
		PFD_TYPE_RGBA,                  // RGBA type
		24,                             // 24-bit color depth
		0, 0, 0, 0, 0, 0,               // color bits ignored
		0,                              // no alpha buffer
		0,                              // shift bit ignored
		0,                              // no accumulation buffer
		0, 0, 0, 0,                     // accum bits ignored
		32,                             // 32-bit z-buffer
		0,                              // no stencil buffer
		0,                              // no auxiliary buffer
		PFD_MAIN_PLANE,                 // main layer
		0,                              // reserved
		0, 0, 0                         // layer masks ignored
	};
	int pixelformat;

	if ( (pixelformat = ChoosePixelFormat(m_pDC->GetSafeHdc(), &pfd)) == 0 )
	{
		MessageBox("ChoosePixelFormat failed");
		return FALSE;
	}

	if (SetPixelFormat(m_pDC->GetSafeHdc(), pixelformat, &pfd) == FALSE)
	{
		MessageBox("SetPixelFormat failed");
		return FALSE;
	}

	return TRUE;
}

void COpenGLView::OnPopupOpenglEigenschaften()
{
	// INITIALISATIONS Dlg.Memberfunction/variable
	COpenGLDoc* pDoc = GetDocument();

	int currentResolution = pDoc->getResolution();
	int currentDensity    = pDoc->getDensity();
	int currentShift      = pDoc->getShift();
	int currentWordLen    = pDoc->getWordLen();

	C3DVisOpt Dlg(NULL, currentResolution, currentDensity, currentShift, currentWordLen);

	if ( IDOK == Dlg.DoModal() )
	{
		if ((currentResolution != Dlg.resolution) ||
			(currentDensity != Dlg.density) ||
			(currentShift != Dlg.shift) ||
			(currentWordLen != Dlg.wordsize)) {

			// change rendering settings
			pDoc->setResolution(Dlg.resolution);
			pDoc->setDensity(Dlg.density);
			pDoc->setShift(Dlg.shift);
			pDoc->setWordLen(Dlg.wordsize);

			// recompute cube data
			pDoc->createVolumeData();

			if ( pDoc->volume )
				m_pVolumeRenderer->setVolume(pDoc->nResolution, pDoc->dVoxelSize, pDoc->volume->getVolume());

			// redraw
			RECT l_rect;
			this->GetWindowRect(&l_rect);
			m_pVolumeRenderer->setSize(l_rect.right-l_rect.left, l_rect.bottom -l_rect.top, TRUE);

			this->OnDraw(NULL);

		}

	}
}

void COpenGLView::OnRButtonDown(UINT nFlags, CPoint point)
{
	// TODO: Code für die Behandlungsroutine für Nachrichten hier einfügen und/oder Standard aufrufen
	if (NULL != m_pVolumeRenderer) {
		m_pVolumeRenderer->OnRButtonDown(nFlags,point);
	}

	CView::OnRButtonDown(nFlags, point);
}

void COpenGLView::OnRButtonUp(UINT nFlags, CPoint point)
{
	// TODO: Code für die Behandlungsroutine für Nachrichten hier einfügen und/oder Standard aufrufen
	if (NULL != m_pVolumeRenderer) {
		m_pVolumeRenderer->OnRButtonUp(nFlags,point);
	}

	CView::OnRButtonUp(nFlags, point);
}


text:
layout: default
---

    {{ page.title }}
    {{ page.date | date_to_string }}

  {{ content }}

{% if site.related_posts.size > 0 %}

Related Posts

    {% for post in site.related_posts limit:3 %}

          {{ post.title }}
          {{ post.date | date_to_string }}

    {% endfor %}

{% endif %}


text:
class PeopleController < ApplicationController

  # def index
  #   @people = People.all
  #   respond_to do |format|
  #     format.html
  #   end
  # end

  # def show
  #   @person = People.find(params[:id])
  # end

end


text:
function [optimal_acc,optimal_stats] = CBIG_TRBPC_multiKRR_LpOCV_pick_optima(N_fold, data_dir, stem)

% [optimal_acc,optimal_stats] = CBIG_TRBPC_multiKRR_LpOCV_pick_optima(N_fold, data_dir, stem)
%
% Gather the prediction results of all cross-validation folds.
%
% Inputs:
%   - N_fold
%     Scalar. Number of cross-validation folds
%
%   - data_dir
%     Full path of the input/output directory. Assumptions of subfolders:
%     (1) [data_dir '/innerloop_cv/fold_' num2str(test_fold)]: stores
%         inner-loop cross-validation results for each test fold. See
%         CBIG_KRR_innerloop_cv_allparams.m
%     (2) [data_dir '/test_cv/fold_' num2str(test_fold)]: stores
%         training-test cross-validation results for each test fold. See
%         CBIG_KRR_test_cv_allparams.m
%     A .mat file [data_dir '/final_result_' stem '.mat'] will be created
%     to save the optimal hyperparameters and corresponding accuracy and
%     predicted scores.
%
%   - stem
%     A string appended to specify the input files. For example, if the
%     inner-loop CV and test CV accuracy filename, as output from
%     CBIG_KRR_innerloop_cv_allparam.m, has the format
%     <path_to-file>/acc_58behaviors.mat, then stem = '58behaviors'.
%     If accuracy input files are <path_to-file>/acc.mat, then stem = ''.
%
% Outputs:
%   - optimal_acc
%     A #TestFolds x #TargetVariable matrix of optimal accuracy (as correlation) of each
%     test fold and each target measure predicted.
%
%   - optimal_stats
%     A struct. Each field is a A #TestFolds x #TargetVariable matrix of
%     prediction stats
%
% Written by Jianzhong Chen and CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md

%% get data dimension
load(fullfile(data_dir,'optimal_acc','fold_1',['acc_' stem '.mat']));
opt_stats = opt_stats_cell{1};
N_score = length(opt_pred_acc);
N_stats = length(opt_stats_cell{1});

%% load all prediction results
optimal_acc = zeros(N_fold,N_score);
optimal_hyp = cell(N_fold,1);
optimal_y_pred = cell(N_fold,1);
stats_name = cell(N_stats,1);
for i = 1:N_stats
    stats_name{i} = opt_stats(i).description;
    optimal_stats.(stats_name{i}) = zeros(N_fold,N_score);
end

for i = 1:N_fold
    load(fullfile(data_dir,'optimal_acc',['fold_' num2str(i)],['acc_' stem '.mat']));
    optimal_acc(i,:) = opt_pred_acc;
    opt_stats = opt_stats_cell{1};
    for j = 1:N_stats
        optimal_stats.(stats_name{j})(i,:) = opt_stats(j).value;
    end
    optimal_hyp{i} = opt_hyp;
    optimal_y_pred{i} = opt_y_pred;
end

save(fullfile(data_dir,['final_result_' stem '.mat']),'optimal_acc',...
    'optimal_hyp','optimal_y_pred','optimal_stats');


text:
/* Athena CSS Definitions */

A {
    text-decoration: none;
}

TABLE {
    margin-top:    4px;
    margin-bottom: 4px;
}

TR {
    vertical-align: baseline;
}

TH {
    padding-left: 4px;
}

TD {
    padding-left: 4px;
}

/* Spans for different entity states */

SPAN.disabled {
    text-decoration: line-through;
    color: #999999;
}

SPAN.invalid {
    text-decoration: line-through;
    color: #C7001B;
}

SPAN.error {
    color: #C7001B;
}

/* Text Span Classes */

SPAN.tiny {
    font-size: 0.875em;
}

SPAN.tinyb {
    font-weight: bold;
    font-size: 0.875em;
}

SPAN.tinyi {
    font-style: italic;
    font-size: 0.875em;
}

/* Page Header */
IMG.logo {
    position:absolute;
    margin:3px; border: 0;
}

DIV.tagline {
    font-family: Verdana, sans-serif;
    float:right;
    text-align:right;
    font-style:italic;
    width:300px;
    margin:12px;
    margin-top:58px;
}

/*--------------------------------------------------
 * Table Formatting Classes
 *
 * Use class "table" for standard table formatting,
 * with "tr-odd" on odd body rows and "tr-even" on even
 * body rows.  The header is row 1 so the first body row
 * is even.
 */

.table {  /* Replaces "pretty" */
    border: 1px solid black;
    border-spacing: 0;
    color: black;
    background-color: white;
}

.table tr:first-child {  /* Replaces "header" */
    font-weight: bold;
    color: white;
    background-color: #000099;
}

.table tr.tr-odd {      /* Replaces "evenrow" */
    background-color: #EEEEEE;
}

.table tr.tr-even { }   /* Replaces "oddrow" */

.table th {
    padding:    5px;
    text-align: left;
}

.table td {
    padding: 5px;
    vertical-align: baseline;
}

table.table-wide {
    width: 100%;
}

/* OBSOLETE: Old-style Table Formatting Classes: "pretty"
 * Border around the outside, even/odd striping, no internal
 * border lines.
 */
TABLE.pretty {
    font-weight: normal;
    border: 1px solid black;
    border-spacing: 0;
}

TABLE.pretty TR.header {
    color: white;
    background-color: #000099;
}

TABLE.pretty TR.oddrow {
    color: black;
    background-color: white;
}

TABLE.pretty TR.evenrow {
    color: black;
    background-color: #EEEEEE;
}

/* Examples, listings, and marks */
PRE.example {
    background:     #FFFDD1 ;
    border:         1px solid blue;
    padding-top:    2px;
    padding-bottom: 2px;
    padding-left:   4px;
}

PRE.listing {
    background:     #FFFDD1 ;
    border:         1px solid blue;
    padding-top:    4px;
    padding-bottom: 4px;
    padding-left:   4px;
}

SPAN.linenum {
    background:     #E3E08F ;
}

DIV.mark {
    display: inline;
    font-family: Verdana;
    font-size: 75%;
    background: black;
    color: white;
    border: 1px solid black;
    border-radius: 5px;
    padding-left: 2px;
    padding-right: 2px;
}

DIV.bigmark {
    display: inline;
    font-family: Verdana;
    font-size: 100%;
    background: black;
    color: white;
    border: 1px solid black;
    border-radius: 5px;
    padding-left: 2px;
    padding-right: 2px;
}

/* Topic Lists. */
TR.topic {
    vertical-align: baseline;
}

TR.topicname {
    min-width: 1.5em;
}

BODY {
    margin: auto;
    padding: 8px 1%;
    color: black;
    background: white;
    font-family: Verdana, sans-serif;
}

/* Linkbars */

TABLE.linkbar {
  clear: both;
  border-radius: 8px;
  background: #000099;
  padding: 0px;
  margin: 0px;
  cell-spacing: 0px;
}
DIV.linkbar {
  text-align: left;
  line-height: 1.6em;
  margin: 0;
  padding: 0px 8px;
}
DIV.linkbar span { color: white; text-decoration: none; padding: 6px 12px; }
DIV.linkbar a { color: white; text-decoration: none; padding: 6px 12px; }
DIV.linkbar a:visited { color: white; }
DIV.linkbar a.active { color: yellow; text-decoration: none; padding: 6px 12px; }
DIV.linkbar a:hover { color: #000099; background: white; }


text:
namespace chromecast {

class CastSysInfo;

class CHROMECAST_EXPORT CastSysInfoShlib {
 public:
  // Returns a instance of CastSysInfo for the platform from a shared library.
  // Caller will take ownership of returned pointer.
  static CastSysInfo* Create(const std::vector<std::string>& argv);
};

}  // namespace chromecast

#endif  // CHROMECAST_PUBLIC_CAST_SYS_INFO_SHLIB_H_


text:
import platform
import os

def autodetect():

    """
    Returns
    -------
    bool
        True if current platform matches, otherwise False
    """

    if 'CI' in os.environ:
        if os.environ['CI'] != 'true':
            return False

    if not 'JENKINS_HOME' in os.environ:
        return False

    return True

if __name__ == "__main__":
    print("Autodetect: "+str(autodetect()))


text:
	// If we are building DLL files we must declare dllexport/dllimport
	#ifdef IVW_MODULE_{{ upper(module/name) }}_EXPORTS
		#ifdef _WIN32
			#define {{ module/api }} __declspec(dllexport)
		#else  //UNIX (GCC)
			#define {{ module/api }} __attribute__ ((visibility ("default")))
		#endif
	#else
		#ifdef _WIN32
			#define {{ module/api }} __declspec(dllimport)
		#else
			#define {{ module/api }}
		#endif
	#endif
#else  //STATIC
	#define {{ module/api }}
#endif
// clang-format on


text:
A python library for building and/or consuming LTI apps.

`dce_lti_py` is a fork of [ims_lti_py](https://github.com/tophatmonocle/ims_lti_py).

## Installation

Install via pip:

```
pip install dce_lti_py
```

## Dependencies

 * [lxml](https://github.com/lxml/lxml)
 * [oauthlib](https://github.com/idan/oauthlib)
 * [requests-oauthlib](https://github.com/requests/requests-oauthlib)

## Usage

The primary goal of this library is to provide classes for building python LTI
tool providers (i.e., LTI apps). To that end, the functionality you're looking
for is probably in the `ToolConfig` and `ToolProvider` classes.

### tool config example (django)

Here's an example of a django view you might use as the configuration URL when
registering your app with the LTI consumer.

```python

    from dce_lti_py import ToolConfig
    from django.http import HttpResponse

    ...

    def tool_config(request):

        # basic stuff
        app_title = 'My App'
        app_description = 'An example LTI App'
        launch_view_name = 'lti_launch'
        launch_url = request.build_absolute_uri(reverse('lti_launch'))

        # maybe you've got some extensions
        extensions = {
            'my_extensions_provider': {
                # extension settings...
            }
        }

        lti_tool_config = ToolConfig(
            title=app_title,
            launch_url=launch_url,
            secure_launch_url=launch_url,
            extensions=extensions,
            description = app_description
        )

        return HttpResponse(lti_tool_config.to_xml(), content_type='text/xml')
```

### tool provider oauth request validation example (django)

Here's an example of how you would validate an incoming LTI launch request. You'd
probably do this as part of some auth middleware, e.g., [django-auth-lti](https://github.com/Harvard-University-iCommons/django-auth-lti)

```python

    from dce_lti_py.contrib.django import DjangoToolProvider
    from my_app import RequestValidator

    ...

    # create the tool provider instance
    secret = 'my LTI app oauth secret'
    tool_provider = DjangoToolProvider.from_django_request(secret, request)

    # the tool provider uses the 'oauthlib' library which requires an instance
    # of a validator class when doing the oauth request signature checking.
    # see https://oauthlib.readthedocs.org/en/latest/oauth1/validator.html for
    # info on how to create one
    validator = RequestValidator()

    # validate the oauth request signature
    ok = tool_provider.is_valid_request(validator)

    # do stuff if ok / not ok
    ...
```

## Testing
ims-lti-py unit tests can be run by executing

    python setup.py test

Optionally, you can use [tox](https://tox.readthedocs.org/) with the provided `tox.ini` file


text:
/**
 *
 */

angular
    .module("app")
    .component("header", {
        templateUrl: "app/comp/header/header.html",
        controller: function($scope, $rootScope) {
            $rootScope.ciao = 10;
        }
    });


text:
using Android.Widget;
using System;

namespace Square.Picasso
{
    partial class RequestCreator
    {
        public virtual void Into(ImageView imageView, Action onSuccess, Action<Java.Lang.Exception> onError)
        {
            Into(imageView, new ActionCallback(onSuccess, onError));
        }

        private class ActionCallback : Java.Lang.Object, ICallback
        {
            private readonly Action onSuccess;
            private readonly Action<Java.Lang.Exception> onError;

            public ActionCallback(Action onSuccess, Action<Java.Lang.Exception> onError)
            {
                this.onSuccess = onSuccess;
                this.onError = onError;
            }

            public void OnSuccess() =>
                onSuccess?.Invoke();

            public void OnError(Java.Lang.Exception exc) =>
                onError?.Invoke(exc);
        }
    }
}


text:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CircleDrawer {

    public static void Draw(LineRenderer lineRenderer, float xRadius, float yRadius, int segments, float jitter) {
        float x;
        float y;
        float z = 0f;

        float angle = 20f;

        if (lineRenderer.positionCount != segments + 1) { lineRenderer.positionCount = segments + 1; }

        for (int i = 0; i < (segments + 1); i++) {
            x = (Mathf.Sin(Mathf.Deg2Rad * angle) * xRadius) + Random.Range(-jitter, jitter);
            y = 0f;
            z = (Mathf.Cos(Mathf.Deg2Rad * angle) * yRadius) + Random.Range(-jitter, jitter);

            lineRenderer.SetPosition(i, new Vector3(x, y, z));

            angle += (360f / segments);
        }
    }

    public static void DrawCrosshair(LineRenderer lineRenderer, float xRadius, float yRadius, int segments, float jitter) {
        float x;
        float y;
        float z = 0f;

        float angle = 20f;

        if (lineRenderer.positionCount != segments + 1) { lineRenderer.positionCount = segments + 1; }

        for (int i = 0; i < (segments + 1); i++) {
            float xDeath = 0;
            if (i % 2 == 0) { xDeath = GunValueManager.MapTo(0, xRadius); }
            x = (Mathf.Sin(Mathf.Deg2Rad * angle) * (xRadius - xDeath * Random.Range(0.9f, 1.1f)) + Random.Range(-jitter, jitter));
            y = 0f;
            z = (Mathf.Cos(Mathf.Deg2Rad * angle) * (yRadius - xDeath * Random.Range(0.9f, 1.1f)) + Random.Range(-jitter, jitter));

            lineRenderer.SetPosition(i, new Vector3(x, y, z));

            angle += (360f / segments);
        }
    }
}


text:
package ch.nextcarwash.backend.tagservice.model;

import javax.persistence.Column;
import javax.persistence.MappedSuperclass;

/**
 * Eine Basisklasse für alle Entitäten mit öffentlichem Schlüssel
 */
@MappedSuperclass
public abstract class PublicIdEntity extends CreateTimeTrackEntity {
    /** Öffentlicher Schlüssel dieser Entität */
    @Column(name = "PUBLIC_ID", nullable = false, unique = true)
    private String publicId;

    /**
     * @return Öffentlicher Schlüssel dieser Entität
     */
    public String getPublicId() {
        return publicId;
    }

    /**
     * @param publicId Öffentlicher Schlüssel dieser Entität
     */
    public void setPublicId(String publicId) {
        this.publicId = publicId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        PublicIdEntity that = (PublicIdEntity) o;

        if (publicId != null ? !publicId.equals(that.publicId) : that.publicId != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        return publicId != null ? publicId.hashCode() : 0;
    }
}


text:
#if GOOGLE_CUDA || TENSORFLOW_USE_ROCM

#include "tensorflow/core/kernels/cwise_ops_gpu_common.cu.h"

namespace tensorflow {
namespace functor {
#if !defined(MLIR_GENERATED_GPU_KERNELS_ENABLED) || \
    !defined(MLIR_GENERATED_EXPERIMENTAL_KERNELS_ENABLED)
DEFINE_BINARY5(mul, Eigen::half, int8, int16, int32, int64);
#endif
// TODO(b/179783573): Also disable the float and double kernels.
DEFINE_BINARY2(mul, float, double);
DEFINE_BINARY6(mul, uint8, uint32, uint16, uint64, complex64, complex128);
DEFINE_BINARY5(mul_no_nan, Eigen::half, float, double, complex64, complex128);
}  // namespace functor
}  // namespace tensorflow

#endif  // GOOGLE_CUDA || TENSORFLOW_USE_ROCM


text:
<TITLE>Review for Lock, Stock and Two Smoking Barrels (1998)</TITLE>
<LINK REL="STYLESHEET" TYPE="text/css" HREF="/ramr.css">

Lock, Stock and Two Smoking Barrels (1998)

reviewed by
Nathaniel R. Atcheson

Lock, Stock, and Two Smoking Barrels (1998)
A Capsule Review by Nathaniel R. Atcheson

Director: Guy Ritchie
Cast: Jason Flemyng, Dexter Fletcher, Nick Moran, Jason Statham, Steven
Mackintosh, Vinnie Jones, Sting, Lenny McLean, P.H. Moriarty
Screenplay: Guy Ritchie
Producers: Matthew Vaughn
Runtime: 105 min.
US Distribution: Gramercy Pictures
Rated R: strong violence, language, sex, drug use

Copyright 1998 Nathaniel R. Atcheson

Guy Ritchie's relentlessly funny and violent picture is one of the most
artistically original movies I've seen in months. The ingenious plot,
which centers around four friends who get mixed up in a series of
crimes, is flawlessly designed and brought together in the conclusion,
and Ritchie never misses the chance for a terrific shot. The movie does
fail to create real people, and there isn't a shred of humanity to be
found anywhere in the picture, but Lock, Stock, and Two Smoking Barrels
is still great fun.

Psychosis Rating: 8/10

          Visit FILM PSYCHOSIS at
     http://www.pyramid.net/natesmovies

           Nathaniel R. Atcheson

The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).

The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.

Please direct comments/criticisms of the review to relevant newsgroups.

Broken URLs inthe reviews are the responsibility of the author.

The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.

Related links: index of all rec.arts.movies.reviews reviews


text:
require 'fileutils'
module DTK
  class RepoManager
    class AddRemoteFilesInfo
      class Copy < self
        # opts can have keys
        #  :source_dir - absolute path
        #  :target_dir - relative path; default is '.'
        def initialize(opts = {})
          @source_target_pairs = opts[:source_dir] ? [source_target_dir_pair(opts[:source_dir], opts[:target_dir])] : []
        end

        def add_source_target_dir_pair!(source_dir, target_dir = nil)
          @source_target_pairs << source_target_pair(source_dir, target_dir)
          self
        end

        def git_add_needed?
          true
        end

        private

        SourceTargetDirPair = Struct.new(:absolute_source_dir, :relative_target_dir)

        def add_files_git_repo_manager(git_repo_manager)
          base_target_dir = git_repo_manager.path

          @source_target_pairs.each do |source_target_pair|
            absolute_source_dir = source_target_pair.absolute_source_dir
            absolute_target_dir = "#{base_target_dir}/#{source_target_pair.relative_target_dir}"
            FileUtils.mkdir_p(absolute_target_dir)
            FileUtils.cp_r("#{absolute_source_dir}/.", absolute_target_dir)
          end
        end

        TARGET_DIR_DEFAULT = '.'
        def source_target_dir_pair(source_dir, target_dir = nil)
          fail Error, "Unexpected that source_dir is nil" if source_dir.nil?
          SourceTargetDirPair.new(source_dir, target_dir || TARGET_DIR_DEFAULT)
        end

      end
    end
  end
end


text:
'use strict';

var React = require('react-native');
var {
  View,
  WebView
} = React;

var Canvas = React.createClass({

  propTypes: {
    context: React.PropTypes.object,
    render: React.PropTypes.func.isRequired
  },

  render() {

    var contextString = JSON.stringify(this.props.context);
    var renderString = this.props.render.toString();

    return (
      <View>
        <WebView
          automaticallyAdjustContentInsets={false}
          contentInset={{top: 0, right: 0, bottom: 0, left: 0}}
          html={"<style>*{margin:0;padding:0;}canvas{position:absolute;transform:translateZ(0);}</style><canvas></canvas><script>var canvas = document.querySelector('canvas');(" + renderString + ").call(" + contextString + ", canvas);</script>"}
          opaque={false}
          underlayColor={'transparent'}
          style={this.props.style}
        />
      </View>
    );
  }
});

module.exports = Canvas;


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using Inbox2.Platform.Channels.Entities;
using Inbox2.Platform.Channels.Interfaces;
using Inbox2.Platform.Channels.Extensions;

namespace Inbox2.Channels.LinkedIn
{
	public class LinkedInClientChannel : IClientInputChannel, IClientContactsChannel, IClientStatusUpdatesChannel
	{
		public string Hostname
		{
			get { return "http://m.linkedin.com"; }
			set { }
		}
		public int Port
		{
			get { return 80; }
			set { }
		}

		public bool IsSecured
		{
			get { return false; }
			set { }
		}

		public bool IsEnabled { get; set; }

		public int MaxConcurrentConnections { get; set; }

		public IChannelCredentialsProvider CredentialsProvider { get; set; }

		public string Protocol
		{
			get { return "LinkedIn"; }
		}

		/// <summary>
		/// See: http://developer.linkedin.com/docs/DOC-1004
		/// </summary>
		/// <returns></returns>
		public IEnumerable<ChannelContact> GetContacts()
		{
			var result = LinkedInWebRequest.PerformRequest(new Uri("http://api.linkedin.com/v1/people/~/connections"),
				ChannelHelper.ConsumerKey, ChannelHelper.ConsumerSecret, ChannelHelper.Token, ChannelHelper.TokenSecret);

			if (result.Element("connections").Elements().Count() == 0)
				yield break;

			foreach (var response in result.Elements("connections").Elements("person"))
			{
				ChannelContact contact = new ChannelContact();
				contact.Profile.ChannelProfileKey = response.Element("id").Value;
				contact.Person.Firstname = response.Element("first-name").Value;
				contact.Person.Lastname = response.Element("last-name").Value;

				contact.Profile.Title = response.Element("headline").Value;
				contact.Profile.Url = response.Element("site-standard-profile-request").Element("url").Value;

				if (response.Element("picture-url") != null)
				{
					contact.Profile.ChannelAvatar = new ChannelAvatar();
					contact.Profile.ChannelAvatar.Url = response.Element("picture-url").Value;
				}

				contact.Profile.SourceAddress = new SourceAddress(response.Element("id").Value, contact.Person.Name);
				contact.Profile.ProfileType = ProfileType.Social;

				yield return contact;
			}
		}

		IClientContactsChannel IClientContactsChannel.Clone()
		{
			return new LinkedInClientChannel
				{
					Hostname = Hostname,
					Port = Port,
					IsSecured = IsSecured,
					MaxConcurrentConnections = MaxConcurrentConnections,
					CredentialsProvider = CredentialsProvider
				};
		}

		public ChannelSocialProfile GetProfile()
		{
			var result = LinkedInWebRequest.PerformRequest(new Uri("http://api.linkedin.com/v1/people/~:(id,first-name,last-name,picture-url)"),
				ChannelHelper.ConsumerKey, ChannelHelper.ConsumerSecret, ChannelHelper.Token, ChannelHelper.TokenSecret);

			var response = result.Element("person");

			return new ChannelSocialProfile
			{
				Id = response.Element("id").Value,
				FullName = String.Concat(response.Element("first-name").Value, " ", response.Element("last-name").Value),
				AvatarUrl = response.Element("picture-url") == null ? String.Empty : response.Element("picture-url").Value
			};
		}

		public IEnumerable<ChannelStatusUpdate> GetMentions(int pageSize)
		{
			yield break;
		}

		public IEnumerable<ChannelStatusUpdate> GetUpdates(int pageSize)
		{
			var result = LinkedInWebRequest.PerformRequest(new Uri("http://api.linkedin.com/v1/people/~/network"), ChannelHelper.ConsumerKey, ChannelHelper.ConsumerSecret, ChannelHelper.Token, ChannelHelper.TokenSecret);

			if (result.Element("network").Elements().Count() == 0)
				yield break;

			foreach (var response in result.Element("network").Element("updates").Elements("update"))
			{
				ChannelStatusUpdate statusUpdate = null;
				var updateType = (LinkedInUpdateType)Enum.Parse(typeof(LinkedInUpdateType),
					response.Element("update-type").Value);

				switch (updateType)
				{
					case LinkedInUpdateType.ANSW:
						// TODO : Answer Update
						break;
					case LinkedInUpdateType.APPS:
					case LinkedInUpdateType.APPM:
						// TODO : Application Update
						break;
					case LinkedInUpdateType.CONN:
					case LinkedInUpdateType.NCON:
					case LinkedInUpdateType.CCEM:
						// Connection updates
						statusUpdate = new ChannelStatusUpdate
						{
							ChannelStatusKey = BuildChannelStatusKey(response),
							From = BuildSourceAddress(response),
							Status = BuildConnectionStatusMessage(response),
							DatePosted = GetDateTime(response)
						};
						break;
					case LinkedInUpdateType.JOBS:
					case LinkedInUpdateType.JOBP:
						// TODO : Posted a job
						break;
					case LinkedInUpdateType.JGRP:
						// TODO : Joined a group
						break;
					case LinkedInUpdateType.PICT:
					case LinkedInUpdateType.PICU:
						// TODO : Changed a picture
						break;
					case LinkedInUpdateType.RECU:
					case LinkedInUpdateType.PREC:
						// TODO : Recommendations
						break;
					case LinkedInUpdateType.PRFU:
					case LinkedInUpdateType.PROF:
						// TODO : Changed profile
						break;
					case LinkedInUpdateType.QSTN:
						// TODO : Question update
						break;
					case LinkedInUpdateType.STAT:
						// Status update
						statusUpdate = new ChannelStatusUpdate
						{
							ChannelStatusKey = BuildChannelStatusKey(response),
							From = BuildSourceAddress(response),
							Status = response.Element("update-content").Element("person").Element("current-status").Value,
							DatePosted = GetDateTime(response)
						};
						break;
				}

				if (statusUpdate != null)
					yield return statusUpdate;
			}
		}

		private DateTime GetDateTime(XElement response)
		{
			// LinkedIn returns us Milliseconds instead of seconds.
			// We first need to convert this to seconds.
			return ((long)TimeSpan.FromMilliseconds(Int64.Parse(response.Element("timestamp").Value)).TotalSeconds).ToUnixTime();
		}

		private string BuildChannelStatusKey(XElement response)
		{
			return string.Format(
				"{0}-{1}",
				response.Element("timestamp").Value,
				response.Element("update-content").Element("person").Element("id").Value
				);
		}

		private SourceAddress BuildSourceAddress(XElement response)
		{
			if (response.Element("update-content").Element("person").Element("picture-url") != null)
			{
				// User has avatar
				return new SourceAddress(
					response.Element("update-content").Element("person").Element("id").Value,
					string.Format("{0} {1}",
						response.Element("update-content").Element("person").Element("first-name").Value,
						response.Element("update-content").Element("person").Element("last-name").Value),
					response.Element("update-content").Element("person").Element("picture-url").Value,
					response.Element("update-content").Element("person").Element("site-standard-profile-request").Element("url").Value);
			}
			else
			{
				// No Avatar
				var address = new SourceAddress(
					response.Element("update-content").Element("person").Element("id").Value,
					string.Format("{0} {1}",
						response.Element("update-content").Element("person").Element("first-name").Value,
						response.Element("update-content").Element("person").Element("last-name").Value));

				address.ProfileUrl =
					response.Element("update-content").Element("person").Element("site-standard-profile-request").Element("url").Value;

				return address;
			}
		}

		private string BuildConnectionStatusMessage(XElement response)
		{
			StringBuilder stringBuilder = new StringBuilder();
			stringBuilder.Append("is now connected to ");

			var persons = response.Element("update-content").Element("person").Element("connections").Elements("person").ToArray();
			var connectedTo = new string[persons.Count()];
			for (int i = 0; i < persons.Count(); i++)
			{
				connectedTo[i] = String.Format("{0} {1}", persons[i].Element("first-name").Value, persons[i].Element("last-name").Value);
			}
			stringBuilder.Append(String.Join(", ", connectedTo));

			return stringBuilder.ToString();
		}

		public IEnumerable<ChannelStatusUpdate> GetUserUpdates(string username, int pageSize)
		{
			var result = LinkedInWebRequest.PerformRequest(new Uri(String.Concat("http://api.linkedin.com/v1/people/id=", username, ":(current-status,current-status-timestamp)")),
				ChannelHelper.ConsumerKey, ChannelHelper.ConsumerSecret, ChannelHelper.Token, ChannelHelper.TokenSecret);

			if (result.Elements("person").Elements().Count() == 0)
				yield break;

			foreach (var response in result.Elements("person"))
			{
				var update = new ChannelStatusUpdate();

				update.Status = response.Element("current-status").Value;

				var ts = TimeSpan.FromMilliseconds(Double.Parse(response.Element("current-status-timestamp").Value));
				update.DatePosted = ((long) ts.TotalSeconds).ToUnixTime();

				yield return update;
			}
		}

		public IEnumerable<ChannelStatusUpdate> GetUpdates(string keyword, int pageSize)
		{
			yield break;
		}

		public void UpdateMyStatus(ChannelStatusUpdate update)
		{
			var element = new XElement("current-status", update.Status.StripHtml());

			LinkedInWebRequest.Put(new Uri("http://api.linkedin.com/v1/people/~/current-status"), element.ToString(),
				ChannelHelper.ConsumerKey, ChannelHelper.ConsumerSecret, ChannelHelper.Token, ChannelHelper.TokenSecret);
		}

		IClientStatusUpdatesChannel IClientStatusUpdatesChannel.Clone()
		{
			return new LinkedInClientChannel
				{
					Hostname = Hostname,
					Port = Port,
					IsSecured = IsSecured,
					MaxConcurrentConnections = MaxConcurrentConnections,
					CredentialsProvider = CredentialsProvider
				};
		}

		public string SourceAdress
		{
			get { return CredentialsProvider.GetCredentials().Claim; }
		}

		public string AuthMessage { get; private set; }

		public ConnectResult Connect()
		{
			return ConnectResult.Success;
		}

		public IEnumerable<ChannelFolder> GetFolders()
		{
			yield return new ChannelFolder("inbox", "inbox", ChannelFolderType.Inbox);
		}

		public void SelectFolder(ChannelFolder folder)
		{
		}

		public IEnumerable<ChannelMessageHeader> GetHeaders()
		{
			yield break;
		}

		public IEnumerable<ChannelMessage> GetMessage(ChannelMessageHeader header)
		{
			yield break;
		}

		public bool Disconnect()
		{
			return true;
		}

		public IClientInputChannel Clone()
		{
			LinkedInClientChannel channel = new LinkedInClientChannel();
			channel.Hostname = Hostname;
			channel.Port = Port;
			channel.IsSecured = IsSecured;
			channel.MaxConcurrentConnections = MaxConcurrentConnections;
			channel.CredentialsProvider = CredentialsProvider;

			return channel;
		}

		public void Dispose()
		{

		}
	}
}


text:
class JobsQueue
  SET_PREFIX = 'aurora_web_jobs_queue_'

  def initialize redis, name
    @redis = redis
    @name = SET_PREFIX + name.to_s
  end

  def push type:, project: nil, distribution: nil
    # type:
    # - :config, with a project
    # - :build, with a distribution

    case type
    when :config
      @redis.zadd @name, Time.now.to_i, ( job = build_new_job :config, project: project ).to_json
    when :build
      @redis.zadd @name, Time.now.to_i, ( job = build_new_job :build, distribution: distribution ).to_json
    end

    return job[:id]
  end

  def pop
    return nil unless popped_job = @redis.zrange(@name, 0, 0).first
    parsed_popped_job = parse_popping_job JSON.parse(popped_job)
    @redis.zrem @name, popped_job
    return parsed_popped_job
  end

  def remove! distribution
    # return true if found and removed
    @redis.zrem @name, ( build_existing_build_job distribution ).to_json
  end

  def size
    @redis.zcard @name
  end

  def clear!
    @redis.del @name
  end

  private

  def build_new_job type, project: nil, distribution: nil
    case type
    when :config
      {
        id: SecureRandom.uuid,
        type: :config,
        project_id: project.id
      }
    when :build
      {
        id: SecureRandom.uuid,
        type: :build,
        distribution_id: distribution.id
      }
    end
  end

  def build_existing_build_job distribution
    {
      id: distribution.current_building_job_id,
      type: :build,
      distribution_id: distribution.id
    }
  end

  def parse_popping_job popped_job
    case popped_job['type']
    when 'config'
      project = Project.find popped_job['project_id']
      return {
        id: popped_job['id'],
        type: :config,
        project: project.as_json(only: [:id, :name, :git_repo_path])
      }.deep_symbolize_keys
    when 'build'
      distribution = Distribution.find popped_job['distribution_id']
      return {
        id: popped_job['id'],
        type: :build,
        project: distribution.project.as_json(only: [:id, :name, :git_repo_path]),
        distribution: distribution.as_json(only: [:id, :platform])
      }.deep_symbolize_keys
    end
  end

end


text:
import {Component, OnInit, ViewChild} from '@angular/core';

import {ComponentViewer, ComponentApi} from '../../shared/component-viewer';

@Component({template: '<component-api></component-api>'})
export class Api implements OnInit {
  @ViewChild(ComponentApi, {static: true}) _componentApi: ComponentApi;

  ngOnInit() {
    this._componentApi.docApi = {
      sections: [
        {
          header: 'MdcFab',
          selectors: [
            'button[mdc-fab]',
            'a[mdc-fab]',
          ],
          exportedAs: 'mdcFab',
          categories: [
            {
              name: 'Properties',
              items: [
                {name: `mini: boolean`, summary: `Make the fab smaller (40 x 40 pixels).`},
                {name: `exited: boolean`, summary: `Animates the FAB in or out of view.`},
                {name: `extended: boolean`, summary: `Modifies the FAB to wider size which includes a text label.`},
                {name: `fluid: boolean`, summary: `Makes the Extended FAB fluid to container, such as screen width or the layout grid.`},
                {name: `label: string`, summary: `Optional, for the text label. Applicable only for Extended FAB.`},
                {name: `position: string`, summary: `Set the fab absolute position. Valid values: 'bottomLeft' | 'bottomRight'`},
                {name: `icon: string`, summary: `Optional. Apply a Material Icon.`},
                {name: `touch: boolean`, summary: `Set the mini fab touch target to 48 x 48 px. Only applies if FAB is set to mini as well.`},
              ]
            },
            {
              name: 'Methods',
              items: [
                {name: `toggleExited(exited?: boolean)`, summary: `Toggle the fab animation in and out.`},
                {name: `focus()`, summary: `Focuses the button.`},
              ]
            },
          ]
        },
      ]
    };
  }
}

@Component({template: '<component-viewer></component-viewer>'})
export class Fab implements OnInit {
  @ViewChild(ComponentViewer, {static: true}) _componentViewer: ComponentViewer;

  ngOnInit(): void {
    this._componentViewer.template = {
      title: 'Floating Action Button',
      description: 'A floating action button represents the primary action in an application.',
      references: [{
        name: 'Material Design guidelines: Floating Action Button',
        url: 'https://material.io/design/components/buttons-floating-action-button.html'
      }, {
        name: 'Material Components Web',
        url: 'https://github.com/material-components/material-components-web/blob/master/packages/mdc-fab/README.md'
      }],
      mdcUrls: [
        {name: 'Sass Mixins', url: 'https://github.com/material-components/material-components-web/blob/master/packages/mdc-fab/README.md#sass-mixins'},
      ],
      code: `import {MdcFabModule} from '@angular-mdc/web/fab';`,
      sass: `@use '@material/fab/mdc-fab';
@use '@material/fab';`
    };
  }
}

@Component({templateUrl: './examples.html'})
export class Examples {
  example1 = {
    html: `<button mdc-fab>
  <mdc-icon>edit</mdc-icon>
</button>`
  };

  exampleMini = {
    html: `<button mdc-fab mini>
  <mdc-icon>edit</mdc-icon>
</button>`
  };

  exampleFA = {
    html: `<button mdc-fab>
  <mdc-icon fontSet="fa" fontIcon="fa-keyboard-o"></mdc-icon>
</button>`
  };

  exampleShaped = {
    html: `<button mdc-fab class="demo-fab-shaped--one">
  <mdc-icon>favorite_border</mdc-icon>
</button>

<button mdc-fab mini class="demo-fab-shaped--two">
  <mdc-icon>favorite_border</mdc-icon>
</button>

<button mdc-fab class="demo-fab-shape-radius">
  <mdc-icon>favorite_border</mdc-icon>
</button>`,
    sass: `https://raw.githubusercontent.com/trimox/angular-mdc-web/master/demos/src/styles/_fab.scss`
  };

  exampleTheme = {
    html: `<button mdc-fab class="red800Fab" icon="edit"></button>

<button mdc-fab class="yellow800Fab" icon="edit"></button>

<button mdc-fab class="purple500Fab" icon="edit"></button>`,
    sass: `https://raw.githubusercontent.com/trimox/angular-mdc-web/master/demos/src/styles/_fab.scss`
  };

  exampleExtended = {
    html: `<button mdc-fab extended icon="add_shopping_cart" label="Add to cart" class="blackFab"></button>

<button mdc-fab extended label="Create" class="blackFab"></button>

<button mdc-fab extended label="Save Changes" class="purple500Fab">
  <mdc-icon>save</mdc-icon>
</button>

<button mdc-fab extended>
  <mdc-fab-label>Create</mdc-fab-label>
  <mdc-icon>add</mdc-icon>
</button>

<button mdc-fab extended class="demo-fab-extended-shape-radius">
  <mdc-fab-label>Shaped</mdc-fab-label>
  <mdc-icon>add</mdc-icon>
</button>`,
    sass: `https://raw.githubusercontent.com/trimox/angular-mdc-web/master/demos/src/styles/_fab.scss`
  };

  exampleExtendedFluid = {
    html: `<button mdc-fab extended fluid label="Add to cart">
  <mdc-icon>add_shopping_cart</mdc-icon>
</button>`
  };

  exampleExited = {
    html: `<button mdc-fab #exited (click)="exited.toggleExited()">
  <mdc-icon>save</mdc-icon>
</button>`
  };

  exampleCustom = {
    html: `<button mdc-fab class="demo-fab-icon-size" icon="edit"></button>`,
    sass: `https://raw.githubusercontent.com/trimox/angular-mdc-web/master/demos/src/styles/_fab.scss`
  };

  examplePosition = {
    html: `<button mdc-fab position='bottomRight' icon="add"></button>`
  };

  exampleAccessibility = {
    html: `<div class="mdc-touch-target-wrapper">
  <button mdc-fab mini touch>
    <mdc-icon>edit</mdc-icon>
  </button>
</div>`
  };
}


text:
Package.describe({summary: "Telescope share module package"});

Package.onUse(function (api) {

  api.use(['telescope-lib', 'telescope-base', 'fourseven:scss'], ['client', 'server']);

  api.use([
    'jquery',
    'underscore',
    'templating'
  ], 'client');

  api.add_files(['lib/share.js'], ['client', 'server']);

  api.add_files(['lib/client/post_share.html', 'lib/client/post_share.js', 'lib/client/post_share.scss'], ['client']);

  // api.export();
});


text:
module QB
module Docker
module CLI

  # Mixins
  # ========================================================================

  include NRSER::Log::Mixin

  extend ::MethodDecorators

  # Classes
  # ==========================================================================

  class Error < QB::Error

    # Make an instance from a {Cmds::Result}.
    #
    # @param [Cmds::Result] result
    #   Result of command that error'd.
    #
    # @return [self]
    #
    def self.from_result result
      new \
        ( "Command `#{ result.cmd.truncate 40 }` " +
          "failed with exit status #{ result.status }" ),
        status: result.status,
        stderr: result.err,
        stdout: result.out
    end # .from_result

  end # class Error

  class ManifestNotFoundError < Error; end

  # Class Methods
  # ========================================================================

  # @!group Utility Class Methods
  # --------------------------------------------------------------------------

  # Create a {Cmds} with formatting options defaulted for how (at least most)
  # `docker` subcommands seem to work.
  #
  # @see https://www.rubydoc.info/gems/cmds
  #
  # @param [String] exe:
  #   Docker executable to stick in front of `template`.
  #
  # @param (see Cmds.new)
  #
  # @return [Cmds]
  #
  def self.cmd \
        template,
        exe: 'docker',
        array_mode: :repeat,
        dash_opt_names: true,
        hash_join_string: '=',
        long_opt_separator: ' ',
        **options
    Cmds.new \
      "#{ exe.shellescape } #{ template }",
      array_mode: array_mode,
      dash_opt_names: dash_opt_names,
      hash_join_string: hash_join_string,
      long_opt_separator: long_opt_separator,
      **options
  end # .cmd

  # Call {.cmd} with a template suitable for most `docker` subcommands.
  #
  # Format is
  #
  #     docker NAME [OPTS] [ARGS]
  #
  # @see .cmd
  #
  # @param [Array<#to_s>] *args
  #   Positional CLI arguments.
  #
  # @param [Hash] **opts
  #   CLI options.
  #
  # @return [Cmds]
  #
  +QB::Util::Decorators::NoPropsInKwds
  def self.sub_cmd name, *args, **opts
    cmd \
      "<%= sub_cmd %> <%= opts %> <%= *args %>",
      args: args,
      kwds: {
        sub_cmd: name,
        opts: opts,
      }
  end # .sub_cmd

  # @!endgroup Utility Class Methods # ***************************************

  # @!group Sub-Command Class Methods
  # --------------------------------------------------------------------------

  # Build a `docker images` {Cmds} instance.
  #
  # @param [Array<#to_s>] *args
  #   Specific image names to get.
  #
  # @param [nil | Symbol | String] format:
  #   The `--format` option. Pass `nil` to use default formatting.
  #
  # @param [Hash] **opts
  #   Other CLI options.
  #
  # @return [Cmds]
  #
  +QB::Util::Decorators::NoPropsInKwds
  def self.images_cmd *args, format: :raw, **opts
    sub_cmd :images, *args, format: format, **opts
  end # .images

  # Get a hash of image data from `docker images`.
  #
  # @note
  #   If you just want the raw `docker images` output use:
  #
  #       QB::Docker::CLI.images_cmd.out!
  #
  # @param *args    (see .images_cmd)
  # @param format:  (see .images_cmd)
  # @param **opts   (see .images_cmd)
  #
  # @param [Boolean] load:
  #   When `true`, will parse `created_at` to a {Time} and combine
  #   `repository` and `tag` to a {QB::Docker::Image::Name}.
  #
  # @param [Boolean] only_named:
  #   Filter out images that don't have a name or tag.
  #
  # @return [Array<HashWithIndifferentAccess>]
  #   Entry keys and values:
  #
  #   -   `repository: String`
  #
  #       Direct from command output, may be `"<none>"`.
  #
  #   -   `tag: String`
  #
  #       Direct from command output, may be `"<none>"`.
  #
  #   -   `image_id: String`
  #
  #       Short (12 character) image SHA256. Unless you pass the `--no-trunc`
  #       option, then it's the full `sha256:...` version.
  #
  #   -   `created_at: String | Time`
  #
  #       Time image was created (I think? Could be tag...)
  #
  #       -   `String` if `load` keyword is `false`.
  #       -   `Time` if `load` keyword is `true`.
  #
  #   -   `virtual_size: String`
  #
  #       Direct from command output, like `"1.41GB"`.
  #
  #   -   `name: void | QB::Docker::Image::Name`
  #
  #       Combination of `repository` and `tag` parsed into a
  #       {QB::Docker::Image::Name}.
  #
  #       Only present if `load` is `true` *and*
  #
  #
  +QB::Util::Decorators::NoPropsInKwds
  def self.images *args, load: true, only_named: true, **opts
    hashes = images_cmd( *args, **opts ).
      out!.
      split( "\n\n" ).
      map { |chunk|
        chunk.lines.map { |line|
            key, _, value = line.chomp.partition ': '

            if key == 'created_at'
              value = Time.parse value
            end

            [key, value]
          }.
          to_h.
          with_indifferent_access
      }

    if only_named
      hashes.reject! { |hash|
        hash.values_at( :repository, :tag ).any? { |v| v == '<none>' }
      }
    end

    if load
      hashes.each { |hash|
        values = hash.values_at :repository, :tag

        unless values.any? { |v| v == '<none>' }
          hash[:name] = QB::Docker::Image::Name.from_s values.join( ':' )
        end
      }
    end

    hashes
  end

  +QB::Util::Decorators::NoPropsInKwds
  def self.rmi_cmd *args, **opts
    sub_cmd :rmi, *args, **opts
  end

  singleton_class.send :alias_method, :remove_images_cmd, :rmi_cmd

  +QB::Util::Decorators::NoPropsInKwds
  def self.rmi *args, method: :stream!, **opts
    rmi_cmd( *args, **opts ).public_send method
  end

  singleton_class.send :alias_method, :remove_images, :rmi

  +QB::Util::Decorators::NoPropsInKwds
  def self.inspect_image_cmd *args, **opts
    sub_cmd :inspect, *args, **opts
  end

  +QB::Util::Decorators::NoPropsInKwds
  def self.inspect_image *names_or_ids, **opts
    inspect_cmd( *names_or_ids, **opts ).out!.thru { |s| JSON.load s }
  end

  +QB::Util::Decorators::NoPropsInKwds
  def self.pull_cmd *args, **opts
    sub_cmd :pull, *args, **opts
  end

  # Pull an image.
  #
  # @param [String | QB::Docker::Image::Name] name
  #
  +QB::Util::Decorators::NoPropsInKwds
  def self.pull name, **opts
    logger.info "Pulling #{ name }...",
      name: name,
      opts: opts

    result = pull_cmd( name, **opts ).capture

    if result.ok?
      logger.info "Successfully pulled #{ name }."
    else
      logger.info "Failed to pull #{ name }",
        stderr: result.err
    end

    result
  end

  +QB::Util::Decorators::NoPropsInKwds
  def self.push_cmd name, **opts
    sub_cmd :push, name, **opts
  end

  +QB::Util::Decorators::NoPropsInKwds
  def self.push name, **opts
    logger.info "Pushing `#{ name }`...", name: name, opts: opts

    result = push_cmd( name, **opts ).capture
  end

  +QB::Util::Decorators::NoPropsInKwds
  def self.build_cmd path_or_url, **opts
    sub_cmd :build, path_or_url, **opts
  end

  # +QB::Util::Decorators::NoPropsInKwds
  # def self.build path_or_url, **opts
  #
  # end

  def self.tag_cmd current_name, new_name_or_tag
    # Load whatever we have
    current_name = QB::Docker::Image::Name.from current_name

    new_name_or_tag = [
      QB::Docker::Image::Name,
      QB::Docker::Image::Tag,
    ].try_find { |klass| klass.from new_name_or_tag }

    new_name = if new_name_or_tag.is_a?( QB::Docker::Image::Name )
      if new_name_or_tag.tag
        new_name_or_tag
      else
        new_name_or_tag.merge tag: current_name.tag
      end
    else
      current_name.merge tag: new_name_or_tag
    end

    sub_cmd :tag, current_name, new_name_or_tag
  end

  # @!endgroup Sub-Command Class Methods # ***********************************

  # @!group Sugar Class Methods
  # --------------------------------------------------------------------------
  #
  # Making common shit easier.
  #

  # Get just image names from `docker images`.
  #
  # @param *args (see .images)
  # @return [Array<QB::Docker::Image::Name>]
  #
  +QB::Util::Decorators::NoPropsInKwds
  def self.image_names *args, **opts
    images( *args, load: true, only_named: true, **opts ).
      map &:name.to_retriever
  end # .image_names

  # Is there an image with the name?
  #
  # @param [QB::Docker::Image::Name | String] name
  # @return [Boolean]
  #
  +QB::Util::Decorators::NoPropsInKwds
  def self.image_named? name, **opts
    !images( name, load: false, only_named: false, **opts ).empty?
  end

  # Boolean version of {.pull}.
  #
  # @param name (see .pull)
  #
  # @return [Boolean]
  #   `true` if the pull succeeded.
  #
  +QB::Util::Decorators::NoPropsInKwds
  def self.pull? name, **opts
    pull( name, **opts ).ok?
  end

  # Pull an image by name or raise.
  #
  # @param name (see .pull)
  #
  # @todo
  #   Support `@DIGEST`
  #
  # @raise [QB::Docker::CLI::ManifestNotFoundError]
  #   If the name was not found in the repository.
  #
  # @raise [QB::Docker::CLI::Error]
  #   If anything else goes wrong.
  #
  +QB::Util::Decorators::NoPropsInKwds
  def self.pull! name, **opts
    result = pull name, **opts

    if result.err =~ /manifest.*not\ found/
      raise QB::Docker::CLI::ManifestNotFoundError.new \
        "Failed to pull - manifest for #{ name } not found",
        name: name,
        cmd: result.cmd,
        stderr: result.err
    else
      raise QB::Docker::CLI::Error.from_result( result )
    end
  end

  # @!endgroup Sugar Class Methods # *****************************************

end; end; end # module QB::Docker::CLI


text:
<uib-tabset class="nav-tabs">
    <uib-tab index="0" heading="Properties">
        <form name="fieldPropertiesForm" class="form-horizontal">

                        Inline:

                            <input type="checkbox" id="{{field.name}}-inline" name="{{field.name}}-inline"
                                   ng-model="field.inline">

        </form>
    </uib-tab>
    <uib-tab index="1" heading="Options">
        <form name="fieldValidationForm" class="form-horizontal">

                <ods-field-checkboxlist-options field="field"></ods-field-checkboxlist-options>

        </form>
    </uib-tab>
    <uib-tab index="2" heading="Debug" ng-show="debugMode">

    </uib-tab>
</uib-tabset>


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Tuburcinia mussatii Massenot

### Remarks
null


text:
package jsonschema

import (
	jptr "github.com/qri-io/jsonpointer"
)

// ValidationState holds the schema validation state
// The aim is to have one global validation state
// and use local sub states when evaluating parallel branches
// TODO(arqu): make sure this is safe for concurrent use
type ValidationState struct {
	Local                *Schema
	Root                 *Schema
	RecursiveAnchor      *Schema
	BaseURI              string
	InstanceLocation     *jptr.Pointer
	RelativeLocation     *jptr.Pointer
	BaseRelativeLocation *jptr.Pointer

	LocalRegistry        *SchemaRegistry
	LocalKeywordRegistry *KeywordRegistry

	EvaluatedPropertyNames      *map[string]bool
	LocalEvaluatedPropertyNames *map[string]bool
	LastEvaluatedIndex          int
	LocalLastEvaluatedIndex     int
	Misc                        map[string]interface{}

	Errs *[]KeyError
}

// NewValidationState creates a new ValidationState with the provided location pointers and data instance
func NewValidationState(s *Schema) *ValidationState {
	tmpBRLprt := jptr.NewPointer()
	tmpRLprt := jptr.NewPointer()
	tmpILprt := jptr.NewPointer()
	return &ValidationState{
		Root:                        s,
		BaseRelativeLocation:        &tmpBRLprt,
		RelativeLocation:            &tmpRLprt,
		InstanceLocation:            &tmpILprt,
		LocalRegistry:               &SchemaRegistry{},
		LastEvaluatedIndex:          -1,
		LocalLastEvaluatedIndex:     -1,
		EvaluatedPropertyNames:      &map[string]bool{},
		LocalEvaluatedPropertyNames: &map[string]bool{},
		Misc:                        map[string]interface{}{},
		Errs:                        &[]KeyError{},
	}
}

// NewSubState creates a new ValidationState from an existing ValidationState
func (vs *ValidationState) NewSubState() *ValidationState {
	return &ValidationState{
		Local:                       vs.Local,
		Root:                        vs.Root,
		RecursiveAnchor:             vs.RecursiveAnchor,
		LastEvaluatedIndex:          vs.LastEvaluatedIndex,
		LocalLastEvaluatedIndex:     vs.LocalLastEvaluatedIndex,
		BaseURI:                     vs.BaseURI,
		InstanceLocation:            vs.InstanceLocation,
		RelativeLocation:            vs.RelativeLocation,
		BaseRelativeLocation:        vs.RelativeLocation,
		LocalRegistry:               vs.LocalRegistry,
		EvaluatedPropertyNames:      vs.EvaluatedPropertyNames,
		LocalEvaluatedPropertyNames: vs.LocalEvaluatedPropertyNames,
		Misc:                        map[string]interface{}{},
		Errs:                        vs.Errs,
	}
}

// ClearState resets a schema to it's core elements
func (vs *ValidationState) ClearState() {
	vs.EvaluatedPropertyNames = &map[string]bool{}
	vs.LocalEvaluatedPropertyNames = &map[string]bool{}
	if len(vs.Misc) > 0 {
		vs.Misc = map[string]interface{}{}
	}
}

// SetEvaluatedKey updates the evaluation properties of the current state
func (vs *ValidationState) SetEvaluatedKey(key string) {
	(*vs.EvaluatedPropertyNames)[key] = true
	(*vs.LocalEvaluatedPropertyNames)[key] = true
}

// IsEvaluatedKey checks if the key is evaluated against the state context
func (vs *ValidationState) IsEvaluatedKey(key string) bool {
	_, ok := (*vs.EvaluatedPropertyNames)[key]
	return ok
}

// IsLocallyEvaluatedKey checks if the key is evaluated against the local state context
func (vs *ValidationState) IsLocallyEvaluatedKey(key string) bool {
	_, ok := (*vs.LocalEvaluatedPropertyNames)[key]
	return ok
}

// SetEvaluatedIndex sets the evaluation index for the current state
func (vs *ValidationState) SetEvaluatedIndex(i int) {
	vs.LastEvaluatedIndex = i
	vs.LocalLastEvaluatedIndex = i
}

// UpdateEvaluatedPropsAndItems is a utility function to join evaluated properties and set the
// current evaluation position index
func (vs *ValidationState) UpdateEvaluatedPropsAndItems(subState *ValidationState) {
	joinSets(vs.EvaluatedPropertyNames, *subState.EvaluatedPropertyNames)
	joinSets(vs.LocalEvaluatedPropertyNames, *subState.LocalEvaluatedPropertyNames)
	if subState.LastEvaluatedIndex > vs.LastEvaluatedIndex {
		vs.LastEvaluatedIndex = subState.LastEvaluatedIndex
	}
	if subState.LocalLastEvaluatedIndex > vs.LastEvaluatedIndex {
		vs.LastEvaluatedIndex = subState.LocalLastEvaluatedIndex
	}
}

func copySet(input map[string]bool) map[string]bool {
	copy := make(map[string]bool, len(input))
	for k, v := range input {
		copy[k] = v
	}
	return copy
}

func joinSets(consumer *map[string]bool, supplier map[string]bool) {
	for k, v := range supplier {
		(*consumer)[k] = v
	}
}

// AddError creates and appends a KeyError to errs of the current state
func (vs *ValidationState) AddError(data interface{}, msg string) {
	schemaDebug("[AddError] Error: %s", msg)
	instancePath := vs.InstanceLocation.String()
	if len(instancePath) == 0 {
		instancePath = "/"
	}
	*vs.Errs = append(*vs.Errs, KeyError{
		PropertyPath: instancePath,
		InvalidValue: data,
		Message:      msg,
	})
}

// AddSubErrors appends a list of KeyError to the current state
func (vs *ValidationState) AddSubErrors(errs ...KeyError) {
	for _, err := range errs {
		schemaDebug("[AddSubErrors] Error: %s", err.Message)
	}
	*vs.Errs = append(*vs.Errs, errs...)
}

// IsValid returns if the current state is valid
func (vs *ValidationState) IsValid() bool {
	if vs.Errs == nil {
		return true
	}
	return len(*vs.Errs) == 0
}

// DescendBase descends the base relative pointer relative to itself
func (vs *ValidationState) DescendBase(token ...string) {
	vs.DescendBaseFromState(vs, token...)
}

// DescendBaseFromState descends the base relative pointer relative to the provided state
func (vs *ValidationState) DescendBaseFromState(base *ValidationState, token ...string) {
	if base.BaseRelativeLocation != nil {
		newPtr := base.BaseRelativeLocation.RawDescendant(token...)
		vs.BaseRelativeLocation = &newPtr
	}
}

// DescendRelative descends the relative pointer relative to itself
func (vs *ValidationState) DescendRelative(token ...string) {
	vs.DescendRelativeFromState(vs, token...)
}

// DescendRelativeFromState descends the relative pointer relative to the provided state
func (vs *ValidationState) DescendRelativeFromState(base *ValidationState, token ...string) {
	newPtr := base.InstanceLocation.RawDescendant(token...)
	vs.RelativeLocation = &newPtr
}

// DescendInstance descends the instance pointer relative to itself
func (vs *ValidationState) DescendInstance(token ...string) {
	vs.DescendInstanceFromState(vs, token...)
}

// DescendInstanceFromState descends the instance pointer relative to the provided state
func (vs *ValidationState) DescendInstanceFromState(base *ValidationState, token ...string) {
	newPtr := base.InstanceLocation.RawDescendant(token...)
	vs.InstanceLocation = &newPtr
}


text:
'use strict';

const passport = require('passport');
const isUserAuthenticated = require('./middleware');
const localStrategy = require('./local');
const facebookStrategy = require('./facebook');
const googleStrategy = require('./google');

passport.serializeUser((user, done) => {
  const userSession = {
    iduser: user.iduser,
    email: user.email,
    name: user.name
  };
  done(null, userSession);
});

passport.deserializeUser((user, done) => {
  done(null, user);
});

module.exports = (app) => {
  app.use(passport.initialize());
  app.use(passport.session());

  passport.use('local-login', localStrategy.login);
  passport.use('local-signup', localStrategy.signup);
  passport.use('facebook', facebookStrategy.facebook);
  passport.use('google', googleStrategy.google);
  passport.isUserAuthenticated = isUserAuthenticated;
};


text:
import System.Environment
import Data.List
import Data.Array.Repa.IO.BMP
import Data.Array.Repa                hiding ((++))

greeter :: IO String
greeter = do
          putStrLn "Please specify image path"
          path <- getLine
          return path

reader :: FilePath -> IO()
reader fp = do
            putStrLn fp


text:
<?php

namespace PHPExiftool\Driver\Tag\Olympus;

use JMS\Serializer\Annotation\ExclusionPolicy;
use PHPExiftool\Driver\AbstractTag;

/**
 * @ExclusionPolicy("all")
 */
class WhiteBalanceBias extends AbstractTag
{

    protected $Id = 772;

    protected $Name = 'WhiteBalanceBias';

    protected $FullName = 'Olympus::Main';

    protected $GroupName = 'Olympus';

    protected $g0 = 'MakerNotes';

    protected $g1 = 'Olympus';

    protected $g2 = 'Camera';

    protected $Type = 'int16u';

    protected $Writable = true;

    protected $Description = 'White Balance Bias';

    protected $flag_Permanent = true;

}


text:
layout: post
title: Standart i/o İşlemlerinin Yönlendirilmesi
category: linux
tags: i/o
---

#### Standart i/o İşlemleri

Unix'ta programlar ve dosyalar, i/o işlemleri yönünden;

	  0 : stdout (çıktı almak için)
	  1 : stdin  (girdi girmek için)
	  2 : stderr (hataları görüntülemek için)

olmak üzere 3 akıntı yoluna sahiptir.
Bu 3 işlem programın veya dosyanın temel işlemleridir.

#### Standart i/o İşlemlerinin Yönlendirilmesi

Bazen programların veya dosyaların; hatalarını, çıktılarını, girdilerini
başka yerlere yönlendirerek,  işleyişini incelemek isteriz.
Örneğin, bir program da hataları bir dosyaya yönlendirmek istersek :

	program_adı 2>dosya_adı

şeklinde kullanıyoruz. Bir `c` kodunda,

	fprintf(stderr, "Hata : kaynak bulunamadı");

ifadesi çalıştığında, hatalar ekranda görüntülenmez, bunun yerine `dosya_adı` isimli dosyaya yazılır. Eğer hataları ekranda görmek istiyorsak çıktıya yönlendirmemiz gerekiyor, bunun için :

	program_adı 2>&1

hataları çıktı olarak yönlendiririz. Eğer programın çıktıları yönlendirmek istiyorsak

	program_adı 1>dosya_adı

veya

	program_adı >dosya_adı

diyerekte kullanabiliriz. Yani default değeri 1 olarak kendisi atıyor.


text:
package report.donut.gherkin.model

import report.donut.gherkin.processors._
import org.joda.time.DateTime

case class Report(projectMetadata: ProjectMetadata,
                  dashboardPage: DashboardPage,
                  featuresPage: FeaturesPage,
                  tagPage: TagPage,
                  failuresPage: FailuresPage,
                  allImages: String)

object Report {
  def apply(features: List[Feature], timestamp: DateTime = DateTime.now, projectMetadata: ProjectMetadata) = {

    val executionData = ExecutionData(features, timestamp)
    new Report(projectMetadata,
      DashboardPage(features, executionData),
      FeaturesPage(features, executionData.allFeatureMetrics),
      TagPage(features),
      FailuresPage(executionData.allFailures),
      ImageProcessor.allImages)
  }
}

/**
  * Project metadata
  */
case class ProjectMetadata(projectName: String,
                           projectVersion: String,
                           customAttributes: Map[String, String])

/**
  * Features Page
  */
case class FeaturesPage(features: List[Feature],
                        featuresMetrics: Metrics,
                        totalDuration: String)

object FeaturesPage {
  def apply(features: List[Feature], allFeatureMetrics: Metrics) = {
    new FeaturesPage(features, allFeatureMetrics, Duration.calculateTotalDurationStr(features.map(f => f.duration.duration)))
  }
}

/**
  * Tags Page
  */
case class TagPage(reportTag: List[ReportTag],
                   totalTags: Int,
                   totalTagsPassed: Int,
                   totalTagsFailed: Int,
                   chart: String)

object TagPage {
  def apply(features: List[Feature]) = {
    val tags = TagProcessor(features)
    new TagPage(tags._1, 0, 0, 0, tags._2)
  }
}

/**
  * DashboardPage
  */
case class DashboardPage(reportDashboard: ExecutionDashboard)

object DashboardPage {
  def apply(features: List[Feature], executionData: ExecutionData) = {
    new DashboardPage(ExecutionDashboard(features, executionData))
  }
}

/**
  * Failures page
  */
case class FailuresPage(scenarios: List[Scenario],
                        totalFailures: Int,
                        htmlElements: String)

object FailuresPage {
  def apply(failedScenarios: List[Scenario]) = {
    new FailuresPage(failedScenarios, failedScenarios.size, HTMLFailuresProcessor(failedScenarios))
  }
}


text:
<?xml version="1.0" encoding="UTF-8"?><project-private xmlns="http://www.netbeans.org/ns/project-private/1">
    <editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/1"/>
    <editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
    <open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
        <group>
            <file>file:/D:/Soldering%20Robot/Firmware/Temperature%20Controller.X/main.c</file>
        </group>
    </open-files>
</project-private>


text:
package de.onyxbits.dummydroid;

import java.util.Arrays;
import java.util.Date;
import java.util.TimeZone;

import com.akdeniz.googleplaycrawler.GooglePlay.AndroidBuildProto;
import com.akdeniz.googleplaycrawler.GooglePlay.AndroidCheckinProto;
import com.akdeniz.googleplaycrawler.GooglePlay.AndroidCheckinRequest;
import com.akdeniz.googleplaycrawler.GooglePlay.DeviceConfigurationProto;

/**
 * A datacapsule
 *
 * @author patrick
 *
 */
public class FormData {

	private AndroidCheckinRequest.Builder androidCheckinRequestBuilder;
	private AndroidCheckinProto.Builder androidCheckinProtoBuilder;
	private DeviceConfigurationProto.Builder deviceConfigurationProtoBuilder;
	private AndroidBuildProto.Builder androidBuildProtoBuilder;

	private String username = "";
	private String password = "";

	public FormData() {
	}

	public AndroidCheckinRequest assemble() {
		getAndroidBuildProtoBuilder();
		getAndroidCheckinProtoBuilder();
		getAndroidCheckinRequestBuilder();
		return androidCheckinRequestBuilder
				.setCheckin(androidCheckinProtoBuilder.setBuild(androidBuildProtoBuilder))
				.setDeviceConfiguration(getDeviceConfigurationProtoBuilder()).setFragment(0).build();
	}

	/**
	 * @return the androidCheckinRequestBuilder
	 */
	public AndroidCheckinRequest.Builder getAndroidCheckinRequestBuilder() {
		if (androidCheckinRequestBuilder == null) {
			String tz = TimeZone.getDefault().getID();
			androidCheckinRequestBuilder = AndroidCheckinRequest.newBuilder().setId(0).setVersion(3)
					.setTimeZone(tz);
		}
		return androidCheckinRequestBuilder;
	}

	/**
	 * @return the androidCheckinProtoBuilder
	 */
	public AndroidCheckinProto.Builder getAndroidCheckinProtoBuilder() {
		if (androidCheckinProtoBuilder == null) {
			androidCheckinProtoBuilder = AndroidCheckinProto.newBuilder();
		}
		return androidCheckinProtoBuilder;
	}

	/**
	 * @param androidCheckinRequestBuilder
	 *          the androidCheckinRequestBuilder to set
	 */
	public void setAndroidCheckinRequestBuilder(
			AndroidCheckinRequest.Builder androidCheckinRequestBuilder) {
		this.androidCheckinRequestBuilder = androidCheckinRequestBuilder;
	}

	/**
	 * @param androidCheckinProtoBuilder
	 *          the androidCheckinProtoBuilder to set
	 */
	public void setAndroidCheckinProtoBuilder(AndroidCheckinProto.Builder androidCheckinProtoBuilder) {
		this.androidCheckinProtoBuilder = androidCheckinProtoBuilder;
	}

	/**
	 * @return the deviceConfigurationProtoBuilder
	 */
	public DeviceConfigurationProto.Builder getDeviceConfigurationProtoBuilder() {
		if (deviceConfigurationProtoBuilder == null) {
			deviceConfigurationProtoBuilder = DeviceConfigurationProto
					.newBuilder()
					.setTouchScreen(3)
					.setKeyboard(1)
					.setNavigation(1)
					.setScreenLayout(2)
					.setHasHardKeyboard(false)
					.setHasFiveWayNavigation(false)
					.setScreenDensity(560)
					.setScreenWidth(1440)
					.setScreenHeight(2560)
					.setGlEsVersion(196609)
					.addAllSystemSharedLibrary(
							Arrays.asList("android.test.runner", "com.android.future.usb.accessory", "com.android.location.provider",
									"com.android.media.remotedisplay", "com.android.mediadrm.signer", "com.android.nfc_extras", "com.google.android.camera.experimental2015",
									"com.google.android.dialer.support", "com.google.android.maps", "com.google.android.media.effects",
									"com.google.widevine.software.drm", "javax.obex"))
					.addAllSystemAvailableFeature(
							Arrays.asList("android.hardware.audio.low_latency", "android.hardware.audio.output", "android.hardware.audio.pro", "android.hardware.microphone",
									"android.hardware.output", "android.hardware.bluetooth", "android.hardware.bluetooth_le", "android.hardware.camera",
									"android.hardware.camera.any", "android.hardware.camera.autofocus", "android.hardware.camera.flash", "android.hardware.camera.front",
									"android.hardware.camera.level.full", "android.hardware.camera.capability.manual_sensor", "android.hardware.camera.capability.manual_post_processing", "android.hardware.camera.capability.raw",
									"android.hardware.consumerir", "android.hardware.ethernet", "android.hardware.fingerprint", "android.hardware.location",
									"android.hardware.location.network", "android.hardware.location.gps", "android.hardware.microphone", "android.hardware.nfc",
									"android.hardware.nfc.hce", "android.hardware.sensor.accelerometer", "android.hardware.sensor.barometer", "android.hardware.sensor.compass",
									"android.hardware.sensor.gyroscope", "android.hardware.sensor.hifi_sensors", "android.hardware.sensor.light", "android.hardware.sensor.proximity",
									"android.hardware.sensor.stepcounter", "android.hardware.sensor.stepdetector", "android.hardware.screen.landscape", "android.hardware.screen.portrait",
									"android.hardware.telephony", "android.hardware.telephony.cdma", "android.hardware.telephony.gsm", "android.hardware.faketouch",
									"android.hardware.usb.host", "android.hardware.usb.accessory", "android.hardware.wifi", "android.hardware.wifi.direct",
									"android.hardware.touchscreen", "android.hardware.touchscreen.multitouch", "android.hardware.touchscreen.multitouch.distinct", "android.hardware.touchscreen.multitouch.jazzhand",
									"android.software.app_widgets", "android.software.backup", "android.software.connectionservice", "android.software.device_admin",
									"android.software.home_screen", "android.software.input_methods", "android.software.live_wallpaper", "android.software.managed_users",
									"android.software.midi", "android.software.print", "android.software.sip", "android.software.sip.voip",
									"android.software.verified_boot", "android.software.voice_recognizers", "android.software.webview", "com.google.android.feature.GOOGLE_BUILD",
									"com.google.android.feature.GOOGLE_EXPERIENCE", "com.google.android.feature.EXCHANGE_6_2", "com.nxp.mifare"))
					.addAllNativePlatform(Arrays.asList("x86_64", "x86", "arm64-v8a", "armeabi-v7a", "armeabi"))
					.addAllSystemSupportedLocale(
							Arrays.asList("af", "af_ZA", "am", "am_ET", "ar", "ar_EG", "bg", "bg_BG", "ca",
									"ca_ES", "cs", "cs_CZ", "da", "da_DK", "de", "de_AT", "de_CH", "de_DE", "de_LI",
									"el", "el_GR", "en", "en_AU", "en_CA", "en_GB", "en_NZ", "en_SG", "en_US", "es",
									"es_ES", "es_US", "fa", "fa_IR", "fi", "fi_FI", "fr", "fr_BE", "fr_CA", "fr_CH",
									"fr_FR", "hi", "hi_IN", "hr", "hr_HR", "hu", "hu_HU", "in", "in_ID", "it",
									"it_CH", "it_IT", "iw", "iw_IL", "ja", "ja_JP", "ko", "ko_KR", "lt", "lt_LT",
									"lv", "lv_LV", "ms", "ms_MY", "nb", "nb_NO", "nl", "nl_BE", "nl_NL", "pl",
									"pl_PL", "pt", "pt_BR", "pt_PT", "rm", "rm_CH", "ro", "ro_RO", "ru", "ru_RU",
									"sk", "sk_SK", "sl", "sl_SI", "sr", "sr_RS", "sv", "sv_SE", "sw", "sw_TZ", "th",
									"th_TH", "tl", "tl_PH", "tr", "tr_TR", "ug", "ug_CN", "uk", "uk_UA", "vi",
									"vi_VN", "zh_CN", "zh_TW", "zu", "zu_ZA"))
					.addAllGlExtension(
							Arrays.asList("GL_EXT_debug_marker", "GL_EXT_discard_framebuffer",
									"GL_EXT_multi_draw_arrays", "GL_EXT_shader_texture_lod",
									"GL_EXT_texture_format_BGRA8888", "GL_IMG_multisampled_render_to_texture",
									"GL_IMG_program_binary", "GL_IMG_read_format", "GL_IMG_shader_binary",
									"GL_IMG_texture_compression_pvrtc", "GL_IMG_texture_format_BGRA8888",
									"GL_IMG_texture_npot", "GL_IMG_vertex_array_object", "GL_OES_EGL_image",
									"GL_OES_EGL_image_external", "GL_OES_blend_equation_separate",
									"GL_OES_blend_func_separate", "GL_OES_blend_subtract", "GL_OES_byte_coordinates",
									"GL_OES_compressed_ETC1_RGB8_texture", "GL_OES_compressed_paletted_texture",
									"GL_OES_depth24", "GL_OES_depth_texture", "GL_OES_draw_texture",
									"GL_OES_egl_sync", "GL_OES_element_index_uint", "GL_OES_extended_matrix_palette",
									"GL_OES_fixed_point", "GL_OES_fragment_precision_high",
									"GL_OES_framebuffer_object", "GL_OES_get_program_binary", "GL_OES_mapbuffer",
									"GL_OES_matrix_get", "GL_OES_matrix_palette", "GL_OES_packed_depth_stencil",
									"GL_OES_point_size_array", "GL_OES_point_sprite", "GL_OES_query_matrix",
									"GL_OES_read_format", "GL_OES_required_internalformat", "GL_OES_rgb8_rgba8",
									"GL_OES_single_precision", "GL_OES_standard_derivatives", "GL_OES_stencil8",
									"GL_OES_stencil_wrap", "GL_OES_texture_cube_map", "GL_OES_texture_env_crossbar",
									"GL_OES_texture_float", "GL_OES_texture_half_float",
									"GL_OES_texture_mirrored_repeat", "GL_OES_vertex_array_object",
									"GL_OES_vertex_half_float"));
		}
		return deviceConfigurationProtoBuilder;
	}

	/**
	 * @param deviceConfigurationProtoBuilder
	 *          the deviceConfigurationProtoBuilder to set
	 */
	public void setDeviceConfigurationProtoBuilder(
			DeviceConfigurationProto.Builder deviceConfigurationProtoBuilder) {
		this.deviceConfigurationProtoBuilder = deviceConfigurationProtoBuilder;
	}

	/**
	 * @return the androidBuildProtoBuilder
	 */
	public AndroidBuildProto.Builder getAndroidBuildProtoBuilder() {
		if (androidBuildProtoBuilder == null) {
			androidBuildProtoBuilder = AndroidBuildProto.newBuilder().setTimestamp(
					new Date().getTime() / 1000);
		}
		return androidBuildProtoBuilder;
	}

	/**
	 * @param androidBuildProtoBuilder
	 *          the androidBuildProtoBuilder to set
	 */
	public void setAndroidBuildProtoBuilder(AndroidBuildProto.Builder androidBuildProtoBuilder) {
		this.androidBuildProtoBuilder = androidBuildProtoBuilder;
	}

	/**
	 * @return the username
	 */
	public String getUsername() {
		return username;
	}

	/**
	 * @return the password
	 */
	public String getPassword() {
		return password;
	}

	/**
	 * @param username the username to set
	 */
	public void setUsername(String username) {
		this.username = username;
	}

	/**
	 * @param password the password to set
	 */
	public void setPassword(String password) {
		this.password = password;
	}
}


text:
import fs from 'fs';
import path from 'path';
import google from 'googleapis';
import examples from '../../config/examples';
import Promise from 'bluebird';

const GA_ID = 'ga:98310771';
const EXAMPLE_QUERIES = examples.map(q => q.sort().join(','));
const AUTH_PATH = path.resolve(__dirname, '../../config/google.json');
const ENABLED = fs.existsSync(AUTH_PATH);

var jwt, analytics;

function getAnalytics() {
    if (!(jwt && analytics) && ENABLED) {
        jwt = new google.auth.JWT();
        jwt.fromJSON(require(AUTH_PATH));
        jwt = Promise.promisifyAll(
            jwt.createScoped('https://www.googleapis.com/auth/analytics.readonly')
        );
        analytics = google.analytics({ version: 'v3', auth: jwt });

        Promise.promisifyAll(analytics.data.ga);
        Promise.promisifyAll(analytics.data.realtime);
    }

    return jwt.authorizeAsync().then(() => analytics);
}

function topSearches(params) {
    return getAnalytics()
        .then(an => {
            return an.data.ga.getAsync({
                ids: GA_ID,
                'start-date': params.days + 'daysAgo',
                'end-date': 'today',
                'max-results': params.limit,
                metrics: 'ga:totalEvents',
                dimensions: 'ga:eventAction',
                sort: '-ga:totalEvents',
                filters: 'ga:eventCategory==hits',
            });
        })
        .spread(data => {
            let result = parseResponse(data);

            if (!params.examples) {
                result = result.filter(
                    r => EXAMPLE_QUERIES.indexOf(r['ga:eventAction']) === -1
                );
            }

            if (params.summary) {
                let summary = { total: 0, words: {} };

                result
                    .sort((a, b) => b['ga:totalEvents'] - a['ga:totalEvents'])
                    .forEach(r => {
                        let term = r['ga:eventAction'].toString().toLowerCase();
                        let count = r['ga:totalEvents'];

                        summary.words[term] = summary.words[term] || 0;
                        summary.words[term] += count;
                        summary.total += count;
                    });

                return { summary: summary };
            }

            return { searches: result };
        });
}

function imageErrors() {
    return getAnalytics().then(an => {
        return an.data.ga
            .getAsync({
                ids: GA_ID,
                'start-date': '30daysAgo',
                'end-date': 'today',
                'max-results': 500,
                metrics: 'ga:totalEvents',
                dimensions: 'ga:eventAction',
                sort: '-ga:totalEvents',
                filters: 'ga:eventCategory==image-error',
            })
            .spread(data => {
                return { imageErrors: parseResponse(data) };
            });
    });
}

function sources(opts) {
    return getAnalytics().then(an => {
        return an.data.ga
            .getAsync({
                ids: GA_ID,
                'start-date': opts.days + 'daysAgo',
                'end-date': 'today',
                'max-results': 500,
                dimensions: 'ga:fullReferrer,ga:source,ga:socialNetwork',
                metrics: 'ga:users,ga:sessions,ga:pageviews',
                sort: '-ga:users',
            })
            .spread(data => {
                return { sources: parseResponse(data) };
            });
    });
}

function browsers(opts) {
    return getAnalytics().then(an => {
        return an.data.ga
            .getAsync({
                ids: GA_ID,
                'start-date': opts.days + 'daysAgo',
                'end-date': 'today',
                'max-results': 500,
                dimensions: 'ga:browser,ga:operatingSystem',
                metrics: 'ga:sessions',
                sort: '-ga:sessions',
            })
            .spread(data => {
                return { browsers: parseResponse(data) };
            });
    });
}

function active() {
    return getAnalytics().then(an => {
        return an.data.realtime
            .getAsync({
                ids: GA_ID,
                dimensions: 'rt:medium,rt:city',
                metrics: 'rt:activeUsers',
            })
            .spread(data => {
                return { active: parseResponse(data) };
            });
    });
}

function parseResponse(data) {
    let headers = (data.columnHeaders || []).map(h => h.name);

    let result = (data.rows || []).map(row => {
        let d = {};

        headers.forEach((h, i) => {
            let p = row[i];

            if (typeof p === 'string' && p.match(/^[\d.]+$/)) {
                p = +p;
            }

            d[h] = p;
        });

        return d;
    });

    return result;
}

function checkEnabled(func, ...rest) {
    if (ENABLED) {
        return func(...rest);
    } else {
        return Promise.resolve({
            error: { message: 'analytics not available' },
        });
    }
}

export default {
    topSearches: checkEnabled.bind(null, topSearches),
    imageErrors: checkEnabled.bind(null, imageErrors),
    sources: checkEnabled.bind(null, sources),
    active: checkEnabled.bind(null, active),
    browsers: checkEnabled.bind(null, browsers),
};