text:
package com.example.yaoxuehua.tourismattractionsapp.parent.activity;

import android.content.pm.ActivityInfo;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;

/**
 * Created by yaoxuehua on 16-10-17.
 */

public abstract class BaseActivity extends FragmentActivity{

    protected String TAG = getClass().getSimpleName();
    private boolean destroyed = false;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
        getSetContentViewBefore();
        setContentView(getLayoutResId());
        initView();
        initExtraBundle();
        initData(savedInstanceState);
        initListener();

    }

    /**
     * 获取布局的Id
     *
     * @return社会化设计师
     */
    protected abstract int getLayoutResId();

    /**
     * 查找控件
     */
    protected abstract void initView();

    /**
     * 获取bundle数据
     */
    protected void initExtraBundle() {
    }

    /**
     * 初始化数据操作
     *
     * @param savedInstanceState
     */
    protected abstract void initData(Bundle savedInstanceState);

    /**
     * 设置监听
     */
    protected void initListener() {
    }

    public boolean isDestroyed() {
        return destroyed;
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
    }

    @Override
    public Resources getResources() {
        Resources res = super.getResources();
        Configuration config = new Configuration();
        config.setToDefaults();
        res.updateConfiguration(config, res.getDisplayMetrics());
        return res;
    }
    /**
     * 实现setContentView方法之前需要调用
     * */
    public void getSetContentViewBefore(){

    }

}

redpajama_set_name: RedPajamaGithub


text:
from oslo_log import log as logging

from trove.cluster import models
from trove.cluster.models import Cluster
from trove.cluster.tasks import ClusterTasks
from trove.cluster.views import ClusterView
from trove.common import cfg
from trove.common import exception
from trove.common import server_group as srv_grp
from trove.common.strategies.cluster import base
from trove.extensions.mgmt.clusters.views import MgmtClusterView
from trove.instance import models as inst_models
from trove.quota.quota import check_quotas
from trove.taskmanager import api as task_api
LOG = logging.getLogger(__name__)
CONF = cfg.CONF

class RedisAPIStrategy(base.BaseAPIStrategy):

    @property
    def cluster_class(self):
        return RedisCluster

    @property
    def cluster_view_class(self):
        return RedisClusterView

    @property
    def mgmt_cluster_view_class(self):
        return RedisMgmtClusterView

class RedisCluster(models.Cluster):

    @staticmethod
    def _create_instances(context, db_info, datastore, datastore_version,
                          instances, extended_properties, locality):
        redis_conf = CONF.get(datastore_version.manager)
        ephemeral_enabled = redis_conf.device_path
        volume_enabled = redis_conf.volume_support

        num_instances = len(instances)

        models.validate_instance_flavors(
            context, instances, volume_enabled, ephemeral_enabled)

        total_volume_allocation = models.get_required_volume_size(
            instances, volume_enabled)

        models.assert_homogeneous_cluster(instances)

        models.validate_instance_nics(context, instances)

        name_index = 1
        for instance in instances:
            if not instance.get('name'):
                instance['name'] = "%s-member-%s" % (db_info.name, name_index)
                name_index += 1

        # Check quotas
        quota_request = {'instances': num_instances,
                         'volumes': total_volume_allocation}
        check_quotas(context.project_id, quota_request)

        # Creating member instances
        return [inst_models.Instance.create(context,
                                            instance['name'],
                                            instance['flavor_id'],
                                            datastore_version.image_id,
                                            [], [],
                                            datastore, datastore_version,
                                            instance.get('volume_size'),
                                            None,
                                            instance.get(
                                                'availability_zone', None),
                                            instance.get('nics', None),
                                            configuration_id=None,
                                            cluster_config={
                                                "id": db_info.id,
                                                "instance_type": "member"},
                                            volume_type=instance.get(
                                                'volume_type', None),
                                            modules=instance.get('modules'),
                                            locality=locality,
                                            region_name=instance.get(
                                                'region_name')
                                            )
                for instance in instances]

    @classmethod
    def create(cls, context, name, datastore, datastore_version,
               instances, extended_properties, locality, configuration,
               image_id=None):
        LOG.debug("Initiating cluster creation.")

        if configuration:
            raise exception.ConfigurationNotSupported()

        # Updating Cluster Task

        db_info = models.DBCluster.create(
            name=name, tenant_id=context.project_id,
            datastore_version_id=datastore_version.id,
            task_status=ClusterTasks.BUILDING_INITIAL)

        cls._create_instances(context, db_info, datastore, datastore_version,
                              instances, extended_properties, locality)

        # Calling taskmanager to further proceed for cluster-configuration
        task_api.load(context, datastore_version.manager).create_cluster(
            db_info.id)

        return RedisCluster(context, db_info, datastore, datastore_version)

    def upgrade(self, datastore_version):
        self.rolling_upgrade(datastore_version)

    def grow(self, instances):
        LOG.debug("Growing cluster.")

        self.validate_cluster_available()

        context = self.context
        db_info = self.db_info
        datastore = self.ds
        datastore_version = self.ds_version

        db_info.update(task_status=ClusterTasks.GROWING_CLUSTER)

        locality = srv_grp.ServerGroup.convert_to_hint(self.server_group)
        new_instances = self._create_instances(context, db_info,
                                               datastore, datastore_version,
                                               instances, None, locality)

        task_api.load(context, datastore_version.manager).grow_cluster(
            db_info.id, [instance.id for instance in new_instances])

        return RedisCluster(context, db_info, datastore, datastore_version)

    def shrink(self, removal_ids):
        LOG.debug("Shrinking cluster %s.", self.id)

        self.validate_cluster_available()

        cluster_info = self.db_info
        cluster_info.update(task_status=ClusterTasks.SHRINKING_CLUSTER)
        try:
            removal_insts = [inst_models.Instance.load(self.context, inst_id)
                             for inst_id in removal_ids]
            node_ids = []
            error_ids = []
            for instance in removal_insts:
                node_id = Cluster.get_guest(instance).get_node_id_for_removal()
                if node_id:
                    node_ids.append(node_id)
                else:
                    error_ids.append(instance.id)
            if error_ids:
                raise exception.ClusterShrinkInstanceInUse(
                    id=error_ids,
                    reason="Nodes cannot be removed. Check slots."
                )

            all_instances = (
                inst_models.DBInstance.find_all(cluster_id=self.id,
                                                deleted=False).all())
            remain_insts = [inst_models.Instance.load(self.context, inst.id)
                            for inst in all_instances
                            if inst.id not in removal_ids]

            for inst in remain_insts:
                guest = Cluster.get_guest(inst)
                guest.remove_nodes(node_ids)
            for inst in removal_insts:
                inst.update_db(cluster_id=None)
            for inst in removal_insts:
                inst_models.Instance.delete(inst)

            return RedisCluster(self.context, cluster_info,
                                self.ds, self.ds_version)
        finally:
            cluster_info.update(task_status=ClusterTasks.NONE)

class RedisClusterView(ClusterView):

    def build_instances(self):
        return self._build_instances(['member'], ['member'])

class RedisMgmtClusterView(MgmtClusterView):

    def build_instances(self):
        return self._build_instances(['member'], ['member'])


text:
namespace blink {

using OutlinePainterTest = RenderingTest;

TEST_F(OutlinePainterTest, FocusRingOutset) {
  auto initial_style = ComputedStyle::CreateInitialStyleSingleton();
  auto style = ComputedStyle::Clone(*initial_style);
  style->SetOutlineStyle(EBorderStyle::kSolid);
  style->SetOutlineStyleIsAuto(true);
  EXPECT_EQ(2, OutlinePainter::OutlineOutsetExtent(*style));
  style->SetEffectiveZoom(4.75);
  EXPECT_EQ(10, OutlinePainter::OutlineOutsetExtent(*style));
  style->SetEffectiveZoom(10);
  EXPECT_EQ(20, OutlinePainter::OutlineOutsetExtent(*style));
}

TEST_F(OutlinePainterTest, HugeOutlineWidthOffset) {
  SetBodyInnerHTML(R"HTML(

  )HTML");
  const auto& style = GetLayoutObjectByElementId("target")->StyleRef();
  EXPECT_TRUE(style.HasOutline());
  EXPECT_EQ(LayoutUnit::Max().ToInt() * 2,
            OutlinePainter::OutlineOutsetExtent(style));
}

// Actually this is not a test for OutlinePainter itself, but it ensures
// that the style logic OutlinePainter depending on is correct.
TEST_F(OutlinePainterTest, OutlineWidthLessThanOne) {
  SetBodyInnerHTML("

");
  const auto& style = GetLayoutObjectByElementId("target")->StyleRef();
  EXPECT_TRUE(style.HasOutline());
  EXPECT_EQ(LayoutUnit(1), style.OutlineWidth());
  EXPECT_EQ(1, OutlinePainter::OutlineOutsetExtent(style));
}

TEST_F(OutlinePainterTest, IterateCollapsedPath) {
  SkPath path;
  path.moveTo(8, 12);
  path.lineTo(8, 4);
  path.lineTo(9, 4);
  path.lineTo(9, 0);
  path.lineTo(9, 0);
  path.lineTo(9, 4);
  path.lineTo(8, 4);
  path.close();
  // Collapsed contour should not cause crash and should be ignored.
  OutlinePainter::IterateRightAnglePathForTesting(
      path, base::BindRepeating(
                [](const Vector<OutlinePainter::Line>&) { NOTREACHED(); }));
}

}  // namespace blink


text:
<?php

namespace ZfbUser\Controller;

use Zend\Http\PhpEnvironment\Request;
use Zend\Http\PhpEnvironment\Response;
use Zend\Mvc\Plugin\FlashMessenger\FlashMessenger;
use Zend\Form\Form;
use Zend\Mvc\Controller\AbstractActionController;
use Zend\View\Model\JsonModel;
use Zend\View\Model\ViewModel;
use ZfbUser\Options\ModuleOptionsInterface;
use ZfbUser\Service\Exception\UserExistsException;
use ZfbUser\Service\UserService;

/**
 * Class UpdateUserController
 *
 * @method Plugin\ZfbAuthentication zfbAuthentication()
 * @method \Zend\Http\Response|array prg(string $redirect = null, bool $redirectToUrl = false)
 * @method FlashMessenger flashMessenger()
 *
 * @package ZfbUser\Controller
 */
class UpdateUserController extends AbstractActionController
{
    /**
     * @var Form
     */
    private $updateUserForm;

    /**
     * @var UserService
     */
    private $userService;

    /**
     * Параметры модуля
     *
     * @var ModuleOptionsInterface
     */
    private $moduleOptions;

    /**
     * UpdateUserController constructor.
     *
     * @param \Zend\Form\Form                         $updateUserForm
     * @param \ZfbUser\Service\UserService            $userService
     * @param \ZfbUser\Options\ModuleOptionsInterface $moduleOptions
     */
    public function __construct(Form $updateUserForm, UserService $userService, ModuleOptionsInterface $moduleOptions)
    {
        $this->updateUserForm = $updateUserForm;
        $this->userService = $userService;
        $this->moduleOptions = $moduleOptions;
    }

    /**
     * @return array|\Zend\Http\Response|\Zend\View\Model\ViewModel
     */
    public function indexAction()
    {
        if (!$this->zfbAuthentication()->hasIdentity()) {
            return $this->redirect()->toRoute('zfbuser/authentication');
        }

        $id = intval($this->params()->fromRoute('id', 0));
        $user = $this->userService->getAuthAdapter()->getRepository()->getUserById($id);

        if ($user == null) {
            return $this->notFoundAction();
        }

        $viewModel = new ViewModel([
            'form'    => $this->updateUserForm,
            'message' => null
        ]);

        /** @var \Zend\Http\PhpEnvironment\Request $request */
        $request = $this->getRequest();
        $url = $request->getRequestUri();
        $this->updateUserForm->setAttribute('action', $url);

        // Pass in the route/url you want to redirect to after the POST
        $prg = $this->prg($url, true);
        if ($prg instanceof \Zend\Http\PhpEnvironment\Response) {
            // Returned a response to redirect us.
            return $prg;
        }
        if ($prg === false) {
            // This wasn't a POST request, but there were no params in the flash
            // messenger; this is probably the first time the form was loaded.

            $this->updateUserForm->setData($user->getArrayCopy());

            return $viewModel;
        }

        // $prg is an array containing the POST params from the previous request

        $this->updateUserForm->setData($prg);
        if (!$this->updateUserForm->isValid()) {
            return $viewModel;
        }
        $data = $this->updateUserForm->getData();

        try {
            $user = $this->userService->saveUser($user, $data);
            $viewModel->setVariable('message', 'User ' . $user->getIdentity() . 'successfully updated!');
        } catch (UserExistsException | \Exception $ex) {
            $viewModel->setVariable('hasError', true);
            $viewModel->setVariable('message', $ex->getMessage());
        }

        return $viewModel;
    }

    /**
     * @return \Zend\Http\PhpEnvironment\Response|\Zend\View\Model\JsonModel
     */
    public function apiIndexAction()
    {
        /** @var Request $request */
        $request = $this->getRequest();

        /** @var Response $response */
        $response = $this->getResponse();
        if (!$request->isPost()) {
            $response->setStatusCode(Response::STATUS_CODE_405);

            return $response;
        }

        if (!$this->zfbAuthentication()->hasIdentity()) {
            $response->setStatusCode(Response::STATUS_CODE_403);

            return $response;
        }

        $id = intval($this->params()->fromRoute('id', 0));
        $user = $this->userService->getAuthAdapter()->getRepository()->getUserById($id);
        if ($user == null) {
            $response->setStatusCode(Response::STATUS_CODE_404);

            return $response;
        }

        $jsonModel = new JsonModel(['success' => false]);

        $post = $request->getPost();
        $this->updateUserForm->setData($post);
        if (!$this->updateUserForm->isValid()) {
            $jsonModel->setVariable('formErrors', $this->updateUserForm->getMessages());

            return $jsonModel;
        }
        $data = $this->updateUserForm->getData();

        try {
            $user = $this->userService->saveUser($user, $data);

            $jsonModel->setVariable('success', true);
            $jsonModel->setVariable('user', $user);
        } catch (\Exception $ex) {
            $jsonModel->setVariable('hasError', true);
            $jsonModel->setVariable('message', $ex->getMessage());
        }

        return $jsonModel;
    }
}


text:
@interface DBMessagingLoadEarlierMessagesHeaderView ()

@property (nonatomic) UILabel *loadMoreLabel;
@property (nonatomic) UIActivityIndicatorView *activityIndicator;

@end

@implementation DBMessagingLoadEarlierMessagesHeaderView

+ (NSString *)viewReuseIdentifier {
    return NSStringFromClass([self class]);
}

+ (CGFloat)heightForHeader
{
    return 30.0f;
}

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {

        [self setBackgroundColor:[UIColor lightGrayColor]];

        _loadMoreLabel = [[UILabel alloc] init];
        [_loadMoreLabel setTextAlignment:NSTextAlignmentCenter];
        [_loadMoreLabel setNumberOfLines:1];
        [_loadMoreLabel setText:@"Load older messages"];
        [_loadMoreLabel setTextColor:[UIColor whiteColor]];
        [self addSubview:_loadMoreLabel];
    }
    return self;
}

- (void)startAnimating
{
    [self.activityIndicator startAnimating];
}

- (void)stopAnimating
{
    [self.activityIndicator stopAnimating];
}

@end


text:
package com.temperance2015.myweather.receiver;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

/**
 * Created by Isabel on 2015/10/13.
 */
public class AutoUpdateReceiver extends BroadcastReceiver {

    @Override
    public void onReceive(Context context,Intent intent){
        Intent i = new Intent(context,AutoUpdateReceiver.class);
        context.startService(i);
    }
}


text:
<?php
/**
 * subscribe/unsubscribe user with selected news
 *
 * @param $customer_id
 * @param $profile
 * @return bool|null
 */
function cw_vertical_response_on_profile_modify($customer_id, $profile) {
	if (!isset($profile['mailing_list'])) return true;
	if ($customer_id) {
		$userinfo = cw_call('cw_user_get_info', array($customer_id, 1));
	} else {
		return null;
	}

	global $config;

	$vertical_response_data = cw_session_register('vertical_response_data');
	$vertical_response_email = trim($config[vertical_response_addon_name]['vertical_response_email']);
	$vertical_response_password = trim($config[vertical_response_addon_name]['vertical_response_password']);

	try {
		$clear_data = false;
		$delete_list_id = $vertical_response_data['user_lists'];

		foreach ($profile['mailing_list'] as $lid => $v) {
			if (strpos($lid, 'vr_') !== false) {
				$list_id = str_replace('vr_', '', $lid);
				// if select new email list, then add user to list
				if (!in_array($list_id, $vertical_response_data['user_lists'])) {
					if (empty($sid)) {
						$vr = new SoapClient(vertical_response_wsdl,
							array (
								'connection_timeout' => 5,
							)
						);
						$sid = $vr->login(
							array(
								'username' => "$vertical_response_email",
								'password' => "$vertical_response_password",
								'session_duration_minutes' => vertical_response_ses_time
							)
						);
					}
					// add user to list
					$vr->addListMember(
						array(
							'session_id'  => $sid,
							'list_member' => array(
								'list_id'     => $list_id,
								'member_data' => array(
									array('name' => 'email_address', 'value' => $userinfo['email']),
									array('name' => 'first_name', 'value' => $userinfo['main_address']['firstname']),
									array('name' => 'last_name', 'value' => $userinfo['main_address']['lastname']),
								),
							),
						)
					);
					$clear_data = true;
				} else {// else list still select and don't need to delete them
					$delete_list_id = array_diff($delete_list_id, array($list_id));
				}
			}
		}

		if (count($delete_list_id)) {
			foreach ($delete_list_id as $list_id) {
				if (empty($sid)) {
					$vr = new SoapClient(vertical_response_wsdl,
						array (
							'connection_timeout' => 5,
						)
					);
					$sid = $vr->login(
						array(
							'username' => "$vertical_response_email",
							'password' => "$vertical_response_password",
							'session_duration_minutes' => vertical_response_ses_time
						)
					);
				}
				// delete user from list
				$vr->deleteListMember(
					array(
						'session_id' => $sid,
						'list_member' => array(
							'list_id' => $list_id,
							'member_data' => array(
								array(
									'name' => 'hash',
									'value' => $vertical_response_data['hash'],
								),
							),
						),
					)
				);
			}
			$clear_data = true;
		}

		if ($clear_data) {
			cw_session_unregister('vertical_response_data');
		}
	} catch (SoapFault $exception) {
		//exit ('fault: "' . $exception->faultcode . '" - ' . $exception->faultstring . "\n");
	}
}

/**
 * get mail lists by customer
 *
 * @param $customer_id
 * @return null
 */
function cw_vertical_response_get_newslists_by_customer($customer_id) {
	global $config;

	$return = cw_get_return();

	if ($customer_id) {
		$userinfo = cw_call('cw_user_get_info', array($customer_id, 0));
	} else {
		return $return;
	}

	$vertical_response_data = &cw_session_register('vertical_response_data', array());
	// clear data after day
	if (isset($vertical_response_data['time']) && $vertical_response_data['time'] + SECONDS_PER_DAY < cw_core_get_time()) {
		$vertical_response_data = array();
	}

	if (isset($vertical_response_data['lists']) && !empty($vertical_response_data['lists'])) {
		foreach ($vertical_response_data['lists'] as $list) {
			if ($list->status == 'active') {
				$return['vr_' . $list->id] = array(
					'list_id' 	=> 'vr_' . $list->id,
					'name' 		=> $list->name,
					'descr' 	=> $list->name,
					'direct' 	=> in_array($list->id, is_array($vertical_response_data['user_lists'])?$vertical_response_data['user_lists']:array()) ? 1 : 0,
				);
			}
		}
	} else {
		$vertical_response_email = trim($config[vertical_response_addon_name]['vertical_response_email']);
		$vertical_response_password = trim($config[vertical_response_addon_name]['vertical_response_password']);

		try {
			$vertical_response_data['time'] = cw_core_get_time();	// lifetime

			$vr = new SoapClient(vertical_response_wsdl,
				array (
					'connection_timeout' => 5,
				)
			);

			$sid = $vr->login(
				array(
					'username' => "$vertical_response_email",
					'password' => "$vertical_response_password",
					'session_duration_minutes' => vertical_response_ses_time
				)
			);

			// get all lists
			$lists = $vr->enumerateLists( array(
				'session_id'         => $sid,
				'type'               => 'email',
				'include_field_info' => false,
				'limit'              => 20,
			));

			$vertical_response_data['lists'] = $lists;

			if (!empty($lists) && count($lists)) {
				foreach ($lists as $list) {
					if ($list->status == 'active') {
						// find lists with user with email $userinfo['email']
						$list_members = $vr->searchListMembers(array(
							'session_id'  => $sid,
							'field_name'  => 'email_address',
							'field_value' => $userinfo['email'],
							'list_id'     => $list->id,
							'max_records' => 1
						));

						if (!empty($list_members) && count($list_members)) {
							$vertical_response_data['user_lists'][] = $list_members[0]->list_id;
							$vertical_response_data['user_lists'] = array_unique($vertical_response_data['user_lists']);

							if (empty($vertical_response_data['hash'])) {
								foreach ($list_members[0]->member_data as $data) {
									if ($data->name == 'hash') {
										$vertical_response_data['hash'] = $data->value;
										break;
									}
								}
							}
						}

						$return['vr_' . $list->id] = array(
							'list_id' 	=> 'vr_' . $list->id,
							'name' 		=> $list->name,
							'descr' 	=> $list->name,
							'direct' 	=> !empty($list_members) ? 1 : 0,
						);
					}
				}
			}
		} catch (SoapFault $exception) {
			//exit ('fault: "' . $exception->faultcode . '" - ' . $exception->faultstring . "\n");
			return $return;
		}
	}

	return $return;
}

/**
 * get mail lists
 *
 * @return array|null
 */
function cw_vertical_response_get_newslists() {
	global $config;

	$return = cw_get_return();
	$vertical_response_data = cw_session_register('vertical_response_data');

	if (isset($vertical_response_data['lists']) && !empty($vertical_response_data['lists'])) {
		foreach ($vertical_response_data['lists'] as $list) {
			if ($list->status == 'active') {
				$return[] = array(
					'id' 		=> $list->id,
					'list_id' 	=> 'vr_' . $list->id,
					'name' 		=> $list->name,
					'descr' 	=> $list->name
				);
			}
		}
	} else {
		$vertical_response_email = trim($config[vertical_response_addon_name]['vertical_response_email']);
		$vertical_response_password = trim($config[vertical_response_addon_name]['vertical_response_password']);

		try {
			$vr = new SoapClient(vertical_response_wsdl,
				array (
					'connection_timeout' => 5,
				)
			);

			$sid = $vr->login(
				array(
					'username' => "$vertical_response_email",
					'password' => "$vertical_response_password",
					'session_duration_minutes' => vertical_response_ses_time
				)
			);

			// get all lists
			$lists = $vr->enumerateLists( array(
				'session_id'         => $sid,
				'type'               => 'email',
				'include_field_info' => false,
				'limit'              => 20,
			));

			if (!empty($lists) && count($lists)) {
				foreach ($lists as $list) {
					if ($list->status == 'active') {
						$return[] = array(
							'id' 		=> $list->id,
							'list_id' 	=> 'vr_' . $list->id,
							'name' 		=> $list->name,
							'descr' 	=> $list->name
						);
					}
				}
			}
		} catch (SoapFault $exception) {
			//exit ('fault: "' . $exception->faultcode . '" - ' . $exception->faultstring . "\n");
		}
	}

	return $return;
}

/**
 * get mail lists
 *
 * @return array|null
 */
function cw_vertical_response_get_lists() {
	global $config;

	$vertical_response_data = &cw_session_register('vertical_response_data');
	// clear data after day
	if (isset($vertical_response_data['time']) && $vertical_response_data['time'] + SECONDS_PER_DAY < cw_core_get_time()) {
		$vertical_response_data = array();
	}
	$result = array();

	if (isset($vertical_response_data['lists']) && !empty($vertical_response_data['lists'])) {
		foreach ($vertical_response_data['lists'] as $list) {
			if ($list->status == 'active') {
				$result[] = array(
					'list_id' 	=> $list->id,
					'name' 		=> $list->name,
					'descr' 	=> $list->name
				);
			}
		}
	} else {
		$vertical_response_email = trim($config[vertical_response_addon_name]['vertical_response_email']);
		$vertical_response_password = trim($config[vertical_response_addon_name]['vertical_response_password']);

		try {
			$vertical_response_data['time'] = cw_core_get_time();	// lifetime

			$vr = new SoapClient(vertical_response_wsdl,
				array (
					'connection_timeout' => 5,
				)
			);

			$sid = $vr->login(
				array(
					'username' => "$vertical_response_email",
					'password' => "$vertical_response_password",
					'session_duration_minutes' => vertical_response_ses_time
				)
			);

			// get all lists
			$lists = $vr->enumerateLists( array(
				'session_id'         => $sid,
				'type'               => 'email',
				'include_field_info' => false,
				'limit'              => 20,
			));

			$vertical_response_data['lists'] = $lists;

			if (!empty($lists) && count($lists)) {
				foreach ($lists as $list) {
					if ($list->status == 'active') {
						$result[] = array(
							'list_id' 	=> $list->id,
							'name' 		=> $list->name,
							'descr' 	=> $list->name
						);
					}
				}
			}
		} catch (SoapFault $exception) {
			//exit ('fault: "' . $exception->faultcode . '" - ' . $exception->faultstring . "\n");
		}
	}

	return $result;
}

/**
 * delete profile
 *
 * @param $profile_id
 */
function cw_vertical_response_profile_delete($profile_id) {
	global $tables;

	if (!empty($profile_id) && is_numeric($profile_id)) {
		db_query("DELETE FROM $tables[recurring_list_update] WHERE id = '$profile_id'");
	}
}

/**
 * get saved search
 *
 * @return array
 */
function cw_vertical_response_get_saved_search() {
	global $tables;

	$result = cw_query("
		SELECT ss_id, name FROM $tables[saved_search] WHERE type = 'C' ORDER BY name
	");

	$return = array();
	if (!empty($result)) {
		foreach ($result as $r) {
			$return[] = array(
				'id' => $r['ss_id'],
				'name' => $r['name']
			);
		}
	}

	return $return;
}

/**
 * get recurring list profiles
 *
 * @return array
 */
function cw_vertical_response_get_recurring_list_profiles() {
	global $tables;

	$result = cw_query("
		SELECT r.*, s.name as saved_search
		FROM $tables[recurring_list_update] r
		LEFT JOIN $tables[saved_search] s ON r.saved_search_id = s.ss_id
		WHERE s.type = 'C'
	");

	return $result;
}

/**
 * update list by cron daily
 *
 * @param $time
 */
function cw_vertical_response_daily_list_update($time) {
	global $tables, $config;

	// find active profiles
	$result = cw_query("
		SELECT r.list_id, s.sql_query
		FROM $tables[recurring_list_update] r
		LEFT JOIN $tables[saved_search] s ON r.saved_search_id = s.ss_id
		WHERE r.active = 1 AND s.type = 'C'
	");

	if (!empty($result)) {
		foreach ($result as $value) {
			if (!empty($value['sql_query'])) {
				// find customers by saved query
				$customers = cw_query($value['sql_query']);

				$customer_emails = array();
				if ($customers) {
					foreach ($customers as $customer) {
						// if user is active
						if ($customer['status'] == 'Y') {
							$customer_emails[] = $customer['email'];
						}
					}

					// if emails is not empty
					if (!empty($customer_emails) && !empty($value['list_id'])) {
						$vertical_response_email = trim($config[vertical_response_addon_name]['vertical_response_email']);
						$vertical_response_password = trim($config[vertical_response_addon_name]['vertical_response_password']);

						try {
							$vr = new SoapClient(vertical_response_wsdl,
								array (
									'connection_timeout' => 5,
								)
							);

							$sid = $vr->login(
								array(
									'username' => "$vertical_response_email",
									'password' => "$vertical_response_password",
									'session_duration_minutes' => vertical_response_ses_time
								)
							);

							// get all users from list
							$members_list = $vr->downloadList(array(
								'session_id' => $sid,
								'list_id' => $value['list_id'],
								'delimiter' => 'csv',
								'fields_to_include' => array('email_address')
							));

							if (
								isset($members_list->contents->location)
								&& ($handle = fopen($members_list->contents->location, "r")) !== FALSE
							) {
								$row = 1;
								$members_list_emails = array();
								while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
									// if it's not header line
									if ($row != 1) {
										$members_list_emails[] = $data[0];
									}
									$row++;
								}
								fclose($handle);

								// if need add some users
								if (array_diff($customer_emails, $members_list_emails)) {
									foreach ($customers as $customer) {
										// if user is active
										if (
											$customer['status'] == 'Y'
											&& in_array($customer['email'], $customer_emails)
										) {
											// add user to list
											$vr->addListMember(
												array(
													'session_id'  => $sid,
													'list_member' => array(
														'list_id'     => $value['list_id'],
														'member_data' => array(
															array('name' => 'email_address', 'value' => $customer['email']),
															array('name' => 'first_name', 'value' => $customer['firstname']),
															array('name' => 'last_name', 'value' => $customer['lastname']),
														),
													),
												)
											);
										}
									}
								}
							}
						} catch (SoapFault $exception) {
							//exit ('fault: "' . $exception->faultcode . '" - ' . $exception->faultstring . "\n");
						}
					}
				}
			}
		}
	}
}

/**
 * edit list
 *
 * @param $list_id
 * @param $name
 * @return bool
 */
function cw_vertical_response_edit_list($list_id, $name) {
	global $config;

	$vertical_response_email = trim($config[vertical_response_addon_name]['vertical_response_email']);
	$vertical_response_password = trim($config[vertical_response_addon_name]['vertical_response_password']);
	$return = $list_id;

	try {
		$vr = new SoapClient(vertical_response_wsdl,
			array (
				'connection_timeout' => 5,
			)
		);

		$sid = $vr->login(
			array(
				'username' => "$vertical_response_email",
				'password' => "$vertical_response_password",
				'session_duration_minutes' => vertical_response_ses_time
			)
		);

		if (empty($list_id)) {
			$return = $vr->createList(array(
				'session_id' => $sid,
				'name' 		 => $name,
				'type'		 => 'email',
			));
		} else {
			$vr->editListAttribute(array(
				'session_id'      => $sid,
				'list_id'         => $list_id,
				'attribute_name'  => 'name',
				'attribute_value' => $name,
			));
		}
	} catch (SoapFault $exception) {
		//exit ('fault: "' . $exception->faultcode . '" - ' . $exception->faultstring . "\n");
		return false;
	}

	return $return;
}

/**
 * delete list
 *
 * @param $list_id
 * @return bool
 */
function cw_vertical_response_delete_list($list_id) {
	global $config;

	$vertical_response_email = trim($config[vertical_response_addon_name]['vertical_response_email']);
	$vertical_response_password = trim($config[vertical_response_addon_name]['vertical_response_password']);

	try {
		$vr = new SoapClient(vertical_response_wsdl,
			array (
				'connection_timeout' => 5,
			)
		);

		$sid = $vr->login(
			array(
				'username' => "$vertical_response_email",
				'password' => "$vertical_response_password",
				'session_duration_minutes' => vertical_response_ses_time
			)
		);

		$vr->deleteList(array(
			'session_id' => $sid,
			'list_id'    => $list_id,
		));
	} catch (SoapFault $exception) {
		//exit ('fault: "' . $exception->faultcode . '" - ' . $exception->faultstring . "\n");
		return false;
	}

	return true;
}

/**
 * add subcriber
 *
 * @param $list_id
 * @param $email
 * @return bool
 */
function cw_vertical_response_add_subcriber($list_id, $email) {
	global $config;

	$vertical_response_email = trim($config[vertical_response_addon_name]['vertical_response_email']);
	$vertical_response_password = trim($config[vertical_response_addon_name]['vertical_response_password']);

	try {
		$vr = new SoapClient(vertical_response_wsdl,
			array (
				'connection_timeout' => 5,
			)
		);

		$sid = $vr->login(
			array(
				'username' => "$vertical_response_email",
				'password' => "$vertical_response_password",
				'session_duration_minutes' => vertical_response_ses_time
			)
		);

		$r=$vr->addListMember(
			array(
				'session_id'  => $sid,
				'list_member' => array(
					'list_id'     => $list_id,
					'member_data' => array(
						array('name' => 'email_address', 'value' => $email),
					),
				),
			)
		);
	} catch (SoapFault $exception) {
		//exit ('fault: "' . $exception->faultcode . '" - ' . $exception->faultstring . "\n");
		return false;
	}

	return true;
}

/**
 * delete subcriber
 *
 * @param $list_id
 * @param $email
 * @return bool
 */
function cw_vertical_response_delete_subcriber($list_id, $email) {
	global $config;

	$vertical_response_email = trim($config[vertical_response_addon_name]['vertical_response_email']);
	$vertical_response_password = trim($config[vertical_response_addon_name]['vertical_response_password']);

	try {
		$vr = new SoapClient(vertical_response_wsdl,
			array (
				'connection_timeout' => 5,
			)
		);

		$sid = $vr->login(
			array(
				'username' => "$vertical_response_email",
				'password' => "$vertical_response_password",
				'session_duration_minutes' => vertical_response_ses_time
			)
		);

		$list_members = $vr->searchListMembers(array(
			'session_id'  => $sid,
			'field_name'  => 'email_address',
			'field_value' => $email,
			'list_id'     => $list_id,
			'max_records' => 1
		));

		if (!empty($list_members) && count($list_members)) {
			$hash = "";
			foreach ($list_members[0]->member_data as $data) {
				if ($data->name == 'hash') {
					$hash = $data->value;
					break;
				}
			}
			$vr->deleteListMember(
				array(
					'session_id' => $sid,
					'list_member' => array(
						'list_id' => $list_id,
						'member_data' => array(
							array(
								'name' => 'hash',
								'value' => $hash,
							),
						),
					),
				)
			);
		}
	} catch (SoapFault $exception) {
		//exit ('fault: "' . $exception->faultcode . '" - ' . $exception->faultstring . "\n");
		return false;
	}

	return true;
}

/**
 * get subscribers
 *
 * @param $list_id
 * @return array
 */
function cw_vertical_response_get_subscribers($list_id) {
	global $config;

	$vertical_response_email = trim($config[vertical_response_addon_name]['vertical_response_email']);
	$vertical_response_password = trim($config[vertical_response_addon_name]['vertical_response_password']);

	$subscribers = array();

	try {
		$vr = new SoapClient(vertical_response_wsdl,
			array (
				'connection_timeout' => 5,
			)
		);

		$sid = $vr->login(
			array(
				'username' => "$vertical_response_email",
				'password' => "$vertical_response_password",
				'session_duration_minutes' => vertical_response_ses_time
			)
		);

		$lists = $vr->downloadList(array(
			'session_id' => $sid,
			'list_id' => $list_id,
			'delimiter' => 'csv',
			'fields_to_include' => array('email_address', 'create_date'),
		));

		if (!empty($lists)) {
			$content = file_get_contents($lists->contents->location);
			$rows = str_getcsv($content, "\n");
			if ($rows) {
				unset($rows[0]);
				foreach ($rows as $row) {
					$list = str_getcsv($row, ",");
					$datetime = date_create_from_format('Y-m-d H:i:s', $list[1]);
					$timestamp = date_timestamp_get($datetime);
					$subscribers[] = array(
						'email' => $list[0],
						'create_date' => $timestamp,
						'optin_status' => $list[2]
					);
				}
			}
		}
	} catch (SoapFault $exception) {
		//exit ('fault: "' . $exception->faultcode . '" - ' . $exception->faultstring . "\n");
	}

	return $subscribers;
}

/**
 * get message
 *
 * @param $list_id
 * @param $message_id
 * @return array
 */
function cw_vertical_response_get_message($list_id, $message_id) {
	global $config;

	$vertical_response_email = trim($config[vertical_response_addon_name]['vertical_response_email']);
	$vertical_response_password = trim($config[vertical_response_addon_name]['vertical_response_password']);

	try {
		$vr = new SoapClient(vertical_response_wsdl,
			array (
				'connection_timeout' => 5,
			)
		);

		$sid = $vr->login(
			array(
				'username' => "$vertical_response_email",
				'password' => "$vertical_response_password",
				'session_duration_minutes' => vertical_response_ses_time
			)
		);

		$params = array(
			'session_id'      => $sid,
			'statuses'        => array('active'),
			'limit'           => 20,
			'include_content' => true,
			'include_lists'   => true
		);
		if ($message_id) {
			$params['campaign_ids'] = array($message_id);
		}
		$messages = $vr->enumerateEmailCampaigns($params);

		if (!empty($messages)) {
			$data = array();
			foreach ($messages as $message) {
				if ($message->lists && is_array($message->lists)) {
					foreach ($message->lists as $list) {
						if ($list->id == $list_id && $message->contents) {
							$data['news_id'] = $message->id;
							foreach ($message->contents as $content) {
								if ($content->type == "subject") {
									$data['subject'] = $content->copy;
								}
								if ($content->type == "freeform_html") {
									$data['body'] = $content->copy;
								}
							}
							return $data;
						}
					}
				}
			}
		}
	} catch (SoapFault $exception) {
		//exit ('fault: "' . $exception->faultcode . '" - ' . $exception->faultstring . "\n");
		return array();
	}

	return array();
}

/**
 * edit message
 *
 * @param $list_id
 * @param $message_id
 * @param $content
 * @param $subject
 * @return bool
 */
function cw_vertical_response_edit_message($list_id, $message_id, $content, $subject) {
	global $config;

	$vertical_response_email = trim($config[vertical_response_addon_name]['vertical_response_email']);
	$vertical_response_password = trim($config[vertical_response_addon_name]['vertical_response_password']);
	$mid = $message_id;

	try {
		$vr = new SoapClient(vertical_response_wsdl,
			array (
				'connection_timeout' => 5,
			)
		);

		$sid = $vr->login(
			array(
				'username' => "$vertical_response_email",
				'password' => "$vertical_response_password",
				'session_duration_minutes' => vertical_response_ses_time
			)
		);

		// check if email exist on VR
		$data = cw_vertical_response_get_message($list_id, $message_id);
		if (!isset($data['news_id'])) {
			$mid = 0;
		}

		if ($mid) {
			// edit message
			$vr->updateEmailContents(array(
				'session_id'    => $sid,
				'email_id'      => $mid,
				'freeform_html' => $content,
				'freeform_text' => trim($config['Company']['company_name']) . " message"
			));
		} else {
			// create a message
			$message = array(
				'name'          	=> "Email #" . cw_core_get_time(),
				'email_type'    	=> "canvas",
				'from_label'    	=> $config['Company']['company_name'],
				'reply_to_email'    => $config['Company']['site_administrator'],
				'freeform_html'		=> $content,
				'freeform_text' 	=> trim($config['Company']['company_name']) . " message",
				'subject' 			=> $subject . " (#" . cw_core_get_time() . ")",
				'hosted_email'		=> true,
			);
			$mid = $vr->createEmail(
				array(
					'session_id' => $sid,
					'email' => $message
				)
			);
			// attaches the list you made above to the campaign you just created
			$vr->setCampaignLists(
				array(
					'session_id' => $sid,
					'campaign_id' => $mid,
					'list_ids' => array($list_id)
				)
			);
		}
	} catch (SoapFault $exception) {
		// exit ('fault: "' . $exception->faultcode . '" - ' . $exception->faultstring . "\n");
		return false;
	}

	return $mid;
}

/**
 * Update emails for saved_search list by cron
 */
function cw_vertical_response_emails_update() {
	global $tables;

	$log = array();

	$lists = cw_query("
		SELECT list_id, salesman_customer_id FROM $tables[newslists]
		WHERE avail = 1 AND show_as_news = 2 AND salesman_customer_id <> 0
	");
	if ($lists) {
		foreach ($lists as $list) {
			$list_id = $list['list_id'];

                        $log[$list_id]['list_id']=$list_id;

			db_query("DELETE FROM $tables[newslist_subscription] WHERE list_id = '$list_id'");
			// search subscribers
			$saved_search = $list['salesman_customer_id'];	// salesman_customer_id is saved search id
			$sql_query = cw_query_first_cell("
				SELECT sql_query FROM $tables[saved_search] WHERE ss_id = '$saved_search'
			");
			$exist_cw = array();	// emails from saved_search
			if ($sql_query) {
				$results = cw_query($sql_query);
				if ($results) {
					$data = array();
					foreach ($results as $result) {
						$count = cw_query_first_cell("
							SELECT COUNT(*) FROM $tables[newslist_subscription]
							WHERE list_id='$list_id' AND email='" . $result['email'] . "'
						");
						if ($count < 1 && !cw_is_anonymous($result['email']) && filter_var($result['email'], FILTER_VALIDATE_EMAIL)) {
							$exist_cw[] = $result['email'];

							$data['list_id'] 	= $list_id;
							$data['email'] 		= addslashes($result['email']);
							$data['since_date'] = cw_core_get_time();
							cw_array2insert('newslist_subscription', $data);
						}
					}
				}
			}

			// synchronize emails
			// get emails from vr
			$exist_vr = array();
			$subscribers = cw_vertical_response_get_subscribers($list_id);
			if ($subscribers) {
				foreach ($subscribers as $subscriber) {
					$exist_vr[] = $subscriber['email'];
				}
			}
			$exist_cw = array_map('strtolower',$exist_cw);
			$exist_vr = array_map('strtolower',$exist_vr);
			// need add
			$need_add = array_diff($exist_cw, $exist_vr);
			$ii=1;
			if ($need_add) {
				foreach ($need_add as $email) {
//					echo ($ii++).': + '.$email."\n";
                                        $log[$list_id]['add'][] = $email;
					cw_vertical_response_add_subcriber($list_id, $email);
					if ($ii>20) break;
				}
			}
			// need delete
			$need_delete = array_diff($exist_vr, $exist_cw);
			$ii=1;
			if ($need_delete) {
				foreach ($need_delete as $email) {
//                                        echo ($ii++).': - '.$email."\n";
					$log[$list_id]['delete'][] = $email;
					cw_vertical_response_delete_subcriber($list_id, $email);
                                        if ($ii>20) break;
				}
			}
		}
	}
	return $log;
}


text:
package org.apache.reef.tests.multipleEventHandlerInstances;

import org.apache.reef.client.DriverConfiguration;
import org.apache.reef.client.DriverLauncher;
import org.apache.reef.client.LauncherStatus;
import org.apache.reef.runtime.local.client.LocalRuntimeConfiguration;
import org.apache.reef.tang.Configuration;
import org.apache.reef.tang.exceptions.BindException;
import org.apache.reef.tang.exceptions.InjectionException;
import org.apache.reef.util.EnvironmentUtils;
import org.junit.Assert;
import org.junit.Test;

import java.util.logging.Logger;

/**
 *
 */
public class Client {
  private static final Logger LOG = Logger.getLogger(Client.class.getName());

  /**
   * Number of milliseconds to wait for the job to complete.
   */
  private static final int JOB_TIMEOUT = 300000; // 10 sec.

  public static LauncherStatus runReefJob(final Configuration runtimeConf, final int timeOut)
      throws BindException, InjectionException {

    final Configuration driverConf = DriverConfiguration.CONF
        .set(DriverConfiguration.GLOBAL_LIBRARIES, EnvironmentUtils.getClassLocation(StartHandler.class))
        .set(DriverConfiguration.DRIVER_IDENTIFIER, "MultipleHandlerInstances")
        .set(DriverConfiguration.ON_DRIVER_STARTED, StartHandler.class)
        .set(DriverConfiguration.ON_EVALUATOR_ALLOCATED, AllocatedEvaluatorHandler.class)
        .set(DriverConfiguration.ON_CONTEXT_ACTIVE, ActiveContextHandler.class)
        .set(DriverConfiguration.ON_TASK_RUNNING, RunningTaskHandler.class)
        .set(DriverConfiguration.ON_TASK_COMPLETED, CompletedTaskHandler.class)
        .set(DriverConfiguration.ON_CONTEXT_CLOSED, ClosedContextHandler.class)
        .set(DriverConfiguration.ON_EVALUATOR_COMPLETED, CompletedEvaluatorHandler.class)
        .build();

    return DriverLauncher.getLauncher(runtimeConf).run(driverConf, timeOut);
  }

  /**
   * @param args command line parameters.
   * @throws BindException      configuration error.
   * @throws InjectionException configuration error.
   */
  @Test
  public void testMultipleInstances() throws BindException, InjectionException {
    final Configuration runtimeConfiguration = LocalRuntimeConfiguration.CONF
        .set(LocalRuntimeConfiguration.MAX_NUMBER_OF_EVALUATORS, 2)
        .build();
    final LauncherStatus status = runReefJob(runtimeConfiguration, JOB_TIMEOUT);
    Assert.assertTrue("Reef Job MultipleHandlerInstances failed: " + status, status.isSuccess());
  }
}


text:
package com.openchronicles.feedreader;

import java.util.ArrayList;

import org.ujoframework.UjoProperty;
import org.ujoframework.extensions.ListProperty;
import org.ujoframework.implementation.map.MapUjo;
import org.ujoframework.core.annot.XmlAttribute;

/**
 * This class represents the root element of the Atom 1.0 specification.
 * @author Carlos David González Abraham
 */
public class AtomFeed extends MapUjo {
    /* attributes */
    @XmlAttribute
    public static final UjoProperty<AtomFeed,String>        XMLNS
        = newProperty("xmlns",     "");

    /* properties */
    public static final UjoProperty<AtomFeed,AtomId>        ID
        = newProperty("id",        AtomId.class);
    public static final UjoProperty<AtomFeed,AtomGenerator> GENERATOR
        = newProperty("generator", AtomGenerator.class);
    public static final UjoProperty<AtomFeed,AtomTitle>     TITLE
        = newProperty("title",     AtomTitle.class);
    public static final UjoProperty<AtomFeed,AtomUpdated>   UPDATED
        = newProperty("updated",   AtomUpdated.class);

    /* collections */
    public static final ListProperty<AtomFeed,AtomAuthor>   AUTHORS
        = newPropertyList("author", AtomAuthor.class);
    public static final ListProperty<AtomFeed,AtomLink>     LINKS
        = newPropertyList("link",   AtomLink.class);
    public static final ListProperty<AtomFeed,AtomEntry>    ENTRIES
        = newPropertyList("entry",  AtomEntry.class);
}


text:
@interface TSFilter ()
@property (nonatomic) FilterType filterType;
@property (nonatomic) NSArray *predicates;
@property (nonatomic) LogicGateType logicGateType;
@end

@implementation TSFilter

+ (instancetype)filterWithType:(FilterType)type {
    return [[self alloc] initWithType:type predicates:nil logicGateType:OR];
}

+ (instancetype)filterWithType:(FilterType)type predicate:(TSSizePredicate *)predicate {
    return [[self alloc] initWithType:type predicates:@[predicate] logicGateType:OR];
}

+ (instancetype)filterWithType:(FilterType)type predicates:(NSArray *)predicates logicGateType:(LogicGateType)logicGateType {
    return [[self alloc] initWithType:type predicates:predicates logicGateType:logicGateType];
}

- (instancetype)initWithType:(FilterType)type predicates:(NSArray *)predicates logicGateType:(LogicGateType)logicGateType {
    self = [super init];
    if (self) {
        _filterType = type;
        _predicates = predicates;
        _logicGateType = logicGateType;
    }
    return self;
}

- (BOOL)isSizeMatch:(CGSize)size {
    BOOL match = NO;

    if (_predicates) {
        NSMutableArray *results = [NSMutableArray array];
        for (TSSizePredicate *descriptor in _predicates) {
            BOOL result = [descriptor isSizeMatch:size];
            [results addObject:@(result)];
        }

        if (_logicGateType == OR) {
            for (NSNumber *resultObject in results) {
                if ([resultObject boolValue]) {
                    match = YES;
                    break;
                }
            }
        } else if (_logicGateType == AND) {
            match = YES;
            for (NSNumber *resultObject in results) {
                if (![resultObject boolValue]) {
                    match = NO;
                    break;
                }
            }
        }
    } else {
        match = YES;
    }

    return match;
}

@end

@implementation TSFilter (AssetsLibrary)

- (ALAssetsFilter *)assetsFilter {
    ALAssetsFilter *filter = nil;
    switch (_filterType) {
        case FilterTypePhoto:
            filter = [ALAssetsFilter allPhotos];
            break;

        case FilterTypeVideo:
            filter = [ALAssetsFilter allVideos];
            break;

        case FilterTypeAll:
            filter = [ALAssetsFilter allAssets];
            break;
    }

    return filter;
}

@end


text:
<!DOCTYPE html>

  <link href="http://gmpg.org/xfn/11" rel="profile">
  <meta http-equiv="content-type" content="text/html; charset=utf-8">

  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1">

  <title>

      404: Page not found · Movence

  </title>

  <link rel="stylesheet" href="/public/css/poole.css">
  <link rel="stylesheet" href="/public/css/syntax.css">

  <link rel="apple-touch-icon-precomposed" sizes="144x144" href="/public/apple-touch-icon-144-precomposed.png">
  <link rel="shortcut icon" href="/public/favicon.ico">

  <link rel="alternate" type="application/rss+xml" title="RSS" href="/atom.xml">

          Movence
          Hyunsoo Kim

            About

            Archive

            Feed

404: Something is missing.

Sorry, URL is not right or it's pointing to something that doesn't exist. Head back home to try finding it again.

  Please enable JavaScript to view the comments powered by Disqus.

comments powered by Disqus

          © 2014. All rights reserved.


text:
shared_examples_for "stage_parent_tree" do
  describe "admin/shared/pipeline_tree" do

    describe "expand-collapse behaviour" do
      it "render the tree view for a pipeline on pipeline general tab" do
        in_params(:stage_parent => @stage_parent)
        in_params(:current_tab=>"tasks")

        render :partial => "admin/shared/pipeline_tree.html", :locals=> {:scope=> {:pipeline => @pipeline, :stage_parent => @stage_parent}}

        response.body.should have_tag("ul.pipeline") do
          with_tag("li.collapsable") do
            with_tag("a[href='#{@stage_parent_edit_path}']", "pipeline")
            with_tag("ul.stages") do
              with_tag("li.expandable") do
                with_tag("li a[href='#{admin_stage_edit_path(:stage_parent => @stage_parent, :pipeline_name => "pipeline", :stage_name => "stage1", :current_tab => "settings")}']", "stage1")
                with_tag("ul.jobs.hidden") do
                  with_tag("li a[href='#{admin_tasks_listing_path(:pipeline_name => "pipeline", :stage_name => "stage1", :job_name => "dev", :current_tab=>"tasks")}']", "dev")
                end
              end
            end
          end
        end
      end

      it "render the tree view for a stage" do
        in_params(:stage_parent => @stage_parent, :pipeline_name => "pipeline", :stage_name => "stage2")

        render :partial => "admin/shared/pipeline_tree.html", :locals=> {:scope=> {:pipeline => @pipeline, :stage_parent => @stage_parent}}

        response.body.should have_tag("ul.pipeline") do
          with_tag("li.collapsable") do
            with_tag("a[href='#{@stage_parent_edit_path}']", "pipeline")
            with_tag("ul.stages") do
              with_tag("li.expandable") do
                with_tag("li a[href='#{admin_stage_edit_path(:stage_parent => @stage_parent, :pipeline_name => "pipeline", :stage_name => "stage1", :current_tab => "settings")}']", "stage1")
                with_tag("ul.jobs.hidden")
              end
              with_tag("li.expandable") do
                with_tag("li a[href='#{admin_stage_edit_path(:stage_parent => @stage_parent, :pipeline_name => "pipeline", :stage_name => "stage3", :current_tab => "settings" )}']", "stage3")
                with_tag("ul.jobs.hidden")
              end
              with_tag("li.collapsable") do
                with_tag("li a[href='#{admin_stage_edit_path(:stage_parent => @stage_parent, :pipeline_name => "pipeline", :stage_name => "stage2", :current_tab => "settings")}']", "stage2")
                with_tag("ul.jobs")
                without_tag("ul.jobs.hidden")
              end
            end
          end
        end
      end
    end

    describe "selection of the current config" do

      it "should render the tree view with a stage selected" do
        pipeline = PipelineConfigMother.createPipelineConfigWithStages("pipeline", ["stage1", "stage2"].to_java(java.lang.String))

        in_params(:stage_parent => @stage_parent, :pipeline_name => "pipeline", :stage_name => "stage2")
        render :partial => "admin/shared/pipeline_tree.html", :locals=> {:scope=> {:pipeline => pipeline, :stage_parent => @stage_parent}}

        response.body.should have_tag("ul.pipeline") do
          with_tag("li") do
            with_tag("a[href='#{@stage_parent_edit_path}'][class=?]", "parent_selected")
            with_tag("ul.stages") do
              with_tag("li") do
                with_tag("li a[href='#{admin_stage_edit_path(:stage_parent => @stage_parent, :pipeline_name => "pipeline", :stage_name => "stage1", :current_tab => "settings")}'][class=?]", "")
                with_tag("li a[href='#{admin_stage_edit_path(:stage_parent => @stage_parent, :pipeline_name => "pipeline", :stage_name => "stage2", :current_tab => "settings")}'][class=?]", "selected") do
                  without_tag("li a[class='selected']") #make sure no job is selected
                end
              end
            end
          end
        end
      end

      it "should retain previously selected tab when navigating from stage to stage" do
        pipeline = PipelineConfigMother.createPipelineConfigWithStages("pipeline", ["stage1", "stage2"].to_java(java.lang.String))

        # Previously on a stage with Permissions tab highlighted
        in_params(:stage_parent => @stage_parent, :pipeline_name => "pipeline", :stage_name => "stage2", :current_tab => "permissions")
        render :partial => "admin/shared/pipeline_tree.html", :locals=> {:scope=> {:pipeline => pipeline, :stage_parent => @stage_parent}}

        response.body.should have_tag("ul.pipeline") do
          with_tag("ul.stages") do
            with_tag("li") do
              with_tag("li a[href='#{admin_stage_edit_path(:stage_parent => @stage_parent, :pipeline_name => "pipeline", :stage_name => "stage1", :current_tab => "permissions")}'][class=?]", "")
              with_tag("li a[href='#{admin_stage_edit_path(:stage_parent => @stage_parent, :pipeline_name => "pipeline", :stage_name => "stage2", :current_tab => "permissions")}'][class=?]", "selected")
            end
          end
        end
      end

      it "should retain 'jobs' tab selection when navigating from stage to stage" do
        pipeline = PipelineConfigMother.createPipelineConfigWithStages("pipeline", ["stage1", "stage2"].to_java(java.lang.String))

        # Previously on a stage with Permissions tab highlighted
        in_params(:stage_parent => @stage_parent, :pipeline_name => "pipeline", :stage_name => "stage2", :current_tab => "jobs")
        render :partial => "admin/shared/pipeline_tree.html", :locals=> {:scope=> {:pipeline => pipeline, :stage_parent => @stage_parent}}

        response.body.should have_tag("ul.pipeline") do
          with_tag("ul.stages") do
            with_tag("li") do
              with_tag("li a[href='#{admin_job_listing_path(:stage_parent => @stage_parent, :pipeline_name => "pipeline", :stage_name => "stage1", :current_tab => "jobs")}'][class=?]", "")
              with_tag("li a[href='#{admin_job_listing_path(:stage_parent => @stage_parent, :pipeline_name => "pipeline", :stage_name => "stage2", :current_tab => "jobs")}'][class=?]", "selected")
            end
          end
        end
      end

      it "should render the tree view with a job selected" do
        in_params(:stage_parent => @stage_parent, :pipeline_name => "pipeline", :stage_name => "stage2", :job_name => "dev", :stage_parent => @stage_parent, :current_tab=>"tasks")
        render :partial => "admin/shared/pipeline_tree.html", :locals=> {:scope=> {:pipeline => @pipeline, :stage_parent => @stage_parent}}

        response.body.should have_tag("ul.pipeline") do
          with_tag("li") do
            with_tag("a[href='#{@stage_parent_edit_path}'][class=?]", "parent_selected")
            with_tag("ul.stages") do
              with_tag("li") do
                with_tag("li") do
                  with_tag("a[href='#{admin_stage_edit_path(:stage_parent => @stage_parent, :pipeline_name => "pipeline", :stage_name => "stage1", :current_tab => "settings")}'][class=?]", "")
                  with_tag("ul.jobs.hidden") do
                    with_tag("li a[class=''][href='#{admin_tasks_listing_path(:pipeline_name => "pipeline", :stage_name => "stage1", :job_name => "dev", :current_tab=>"tasks")}']", "dev")
                  end
                end
                with_tag("li") do
                  with_tag("a[href='#{admin_stage_edit_path(:stage_parent => @stage_parent, :pipeline_name => "pipeline", :stage_name => "stage2", :current_tab => "settings")}'][class=?]", "parent_selected")
                  with_tag("ul.jobs") do
                    with_tag("li a[href='#{admin_tasks_listing_path(:pipeline_name => "pipeline", :stage_name => "stage2", :job_name => "dev", :current_tab=>"tasks")}'][class='selected']", "dev")
                  end
                end
              end
            end
          end
        end
      end

      it "should retain the tab selection when moving from job to job" do
        in_params(:stage_parent => @stage_parent, :pipeline_name => "pipeline", :stage_name => "stage2", :job_name => "dev", :stage_parent => @stage_parent, :current_tab=>"artifacts")
        render :partial => "admin/shared/pipeline_tree.html", :locals=> {:scope=> {:pipeline => @pipeline, :stage_parent => @stage_parent}}

        response.body.should have_tag("ul.pipeline") do
          with_tag("ul.jobs.hidden") do
            with_tag("li a[class=''][href='#{admin_job_edit_path(:pipeline_name => "pipeline", :stage_name => "stage1", :job_name => "dev", :current_tab=>"artifacts")}']", "dev")
          end
        end
        with_tag("li") do
          with_tag("ul.jobs") do
            with_tag("li a[href='#{admin_job_edit_path(:pipeline_name => "pipeline", :stage_name => "stage2", :job_name => "dev", :current_tab=>"artifacts")}'][class='selected']", "dev")
          end
        end
      end

      it "should render the tree view with a pipeline selected" do
        in_params(:stage_parent => @stage_parent, :pipeline_name => "pipeline", :current_tab=>"tasks")
        render :partial => "admin/shared/pipeline_tree.html", :locals=> {:scope=> {:pipeline => @pipeline, :stage_parent => @stage_parent}}

        response.body.should have_tag("ul.pipeline") do
          with_tag("li") do
            with_tag("a[href='#{@stage_parent_edit_path}'][class=?]", "selected")
            with_tag("ul.stages") do
              with_tag("li") do
                with_tag("li a[href='#{admin_stage_edit_path(:stage_parent => @stage_parent, :pipeline_name => "pipeline", :stage_name => "stage1", :current_tab => "settings")}'][class=?]", "")
                with_tag("li a[href='#{admin_stage_edit_path(:stage_parent => @stage_parent, :pipeline_name => "pipeline", :stage_name => "stage2", :current_tab => "settings")}'][class=?]", "")
              end
            end
          end
        end
      end
    end

    it "render the tree view for a job" do
      in_params(:stage_parent => @stage_parent, :pipeline_name => "pipeline", :stage_name => "stage2", :job_name => "dev", :stage_parent => @stage_parent)

      render :partial => "admin/shared/pipeline_tree.html", :locals=> {:scope=> {:pipeline => @pipeline, :stage_parent => @stage_parent}}

      response.body.should have_tag("ul.pipeline") do
        with_tag("li.collapsable") do
          with_tag("a[href='#{@stage_parent_edit_path}']", "pipeline")
          with_tag("ul.stages") do
            with_tag("li.expandable") do
              with_tag("li a[href='#{admin_stage_edit_path(:stage_parent => @stage_parent, :pipeline_name => "pipeline", :stage_name => "stage1", :current_tab => "settings")}']", "stage1")
              with_tag("ul.jobs.hidden")
            end
            with_tag("li.expandable") do
              with_tag("li a[href='#{admin_stage_edit_path(:stage_parent => @stage_parent, :pipeline_name => "pipeline", :stage_name => "stage3", :current_tab => "settings")}']", "stage3")
              with_tag("ul.jobs.hidden")
            end
            with_tag("li.collapsable") do
              with_tag("li a[href='#{admin_stage_edit_path(:stage_parent => @stage_parent, :pipeline_name => "pipeline", :stage_name => "stage2", :current_tab => "settings")}']", "stage2")
              with_tag("ul.jobs")
              without_tag("ul.jobs.hidden")
              with_tag("ul.jobs") do
                with_tag("li a[href='#{admin_tasks_listing_path(:pipeline_name => "pipeline", :stage_name => "stage2", :job_name => "dev", :current_tab=>"tasks")}']", "dev")
              end
            end
          end
        end
      end
    end
  end
end


text:
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <stdlib.h>
#include <string>
#include <vector>
#include <linux/limits.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <signal.h>
#include "rshell.h"
#include <pwd.h>
using namespace std;

int main (int argc, char** argv)
{
	currstate.sa_handler = handle;
	if (-1 == sigaction(SIGINT, &currstate, NULL))
	{
		perror("sigaction-SIGINT failed");
		exit(1);
	}
	if (-1 == sigaction(SIGTSTP, &currstate, NULL))
	{
		perror("sigaction-SIGTSTP failed");
		exit(1);
	}

	cout << "Welcome to Rshell!" << endl;

	while (true)
	{
		signalfound = false;
		vector<string> paths = getpaths();
		/*
		for (unsigned i=0; i < paths.size(); i++)
		{
			cout << "paths.at(" << i << ") = " << paths.at(i) << endl;
		}
		*/
		//get home directory
		const char *homedir;
		if ((homedir=getenv("HOME")) == NULL)
		{
			homedir = getpwuid(getuid()) ->pw_dir;
			if (homedir == NULL)
			{
				perror("get home directory failed");
				exit(1);
			}
		}
		printprompt(homedir);
		string rawinput;
		getinput(rawinput);
		if (signalfound == true) continue;
		vector<string> cmds;
		if (!rawinput.empty())
		{
			string parsedinput = parseinput(rawinput);
			//bool will store syntax error
			bool synerror = makecmds(parsedinput, cmds);
			/*
			for (unsigned i =0; i<cmds.size(); i++)
			{
				cout << i << " " << cmds.at(i) << endl;
			}
			*/
			int pcount = pipecount(parsedinput);
			if (synerror != true)	synerror = execcmds(cmds, pcount, paths);
			if (synerror == true)	printf("Syntax error.\n");
		}
	}
	return 0;
}


text:
package monadasync

import java.util
import java.util.concurrent._

import com.twitter.util.Future
import com.twitter.util._

import scalaz._
import scalaz.syntax.all._

package object twitter {
  implicit object FutureMonad extends MonadError[Lambda[(?, α) => Future[α]], Throwable]
      with MonadPlus[Future] with Monad[Future] with Comonad[Future]
      with Nondeterminism[Future] with Zip[Future] with Catchable[Future]
      with MonadAsync[Future] with Traverse[Future] {
    import Future._

    override def raiseError[A](e: Throwable): Future[A] =
      exception(e)

    override def handleError[A](fa: Future[A])(f: Throwable => Future[A]): Future[A] =
      fa rescue { case t => f(t) }

    override def bind[A, B](fa: Future[A])(f: A => Future[B]): Future[B] =
      fa flatMap f

    override def point[A](a: => A): Future[A] =
      delay(a)

    override def map[A, B](fa: Future[A])(f: A => B): Future[B] =
      fa map f

    override def ap[A, B](fa: => Future[A])(f: => Future[A => B]): Future[B] =
      (f join fa) map { case (f1, a1) => f1(a1) }

    override def copoint[A](p: Future[A]): A =
      Await.result(p)

    override def cobind[A, B](fa: Future[A])(f: Future[A] => B): Future[B] =
      Future(f(fa))

    override def empty[A]: Future[A] =
      raiseError(new Try.PredicateDoesNotObtain)

    override def plus[A](fa: Future[A], fb: => Future[A]): Future[A] =
      fa rescue { case _ => fb }

    override def filter[A](fa: Future[A])(f: A => Boolean): Future[A] =
      fa filter f

    override def chooseAny[A](head: Future[A], tail: Seq[Future[A]]): Future[(A, Seq[Future[A]])] =
      select(head +: tail) flatMap {
        case (either, residuals) => const(either) map { (_, residuals) }
      }

    override def gather[A](fs: Seq[Future[A]]): Future[List[A]] =
      collect(fs) map { _.toList }

    override def zip[A, B](a: => Future[A], b: => Future[B]): Future[(A, B)] =
      a join b

    override def attempt[A](fa: Future[A]): Future[Throwable \/ A] =
      fa transform {
        case Return(a) => now(a.right)
        case Throw(t) => now(t.left[A])
      }

    override def fail[A](e: Throwable): Future[A] =
      raiseError(e)

    /**
     * @return an F whose value will be set from an asynchronous computation, via callback.
     */
    override def async[A](listen: Callback[A]): Future[A] =
      new Promise[A] <| { p => delay(listen(p.setValue)) }

    override def async[A](pool: Executor)(a: => A): Future[A] =
      pool match {
        case es: ExecutorService => FuturePool.interruptible(es).apply(a)
        case e => FuturePool.interruptible(ExecutorServiceFromExecutor(e)).apply(a)
      }

    private case class ExecutorServiceFromExecutor(e: Executor) extends AbstractExecutorService {
      override def shutdown(): Unit = ()
      override def isTerminated: Boolean = false
      override def awaitTermination(timeout: Long, unit: TimeUnit): Boolean = false
      override def shutdownNow(): util.List[Runnable] = util.Collections.emptyList()
      override def isShutdown: Boolean = false
      override def execute(command: Runnable): Unit = e.execute(command)
    }

    override def now[A](a: A): Future[A] =
      value(a)

    override def delay[A](a: => A): Future[A] =
      value(()) map { _ => a }

    override def suspend[A](a: => Future[A]): Future[A] =
      value(()) flatMap { _ => a }

    override def traverseImpl[G[_]: Applicative, A, B](fa: Future[A])(f: A => G[B]): G[Future[B]] =
      copoint(fa map f) map value
  }

  def monadState[S]: MonadState[Lambda[(?, α) => Future[α]], Option[S]] =
    new MonadState[Lambda[(?, α) => Future[α]], Option[S]] {
      val local = new Local[S]

      override def init: Future[Option[S]] =
        point(local())

      override def get: Future[Option[S]] = init

      override def put(s: Option[S]): Future[Unit] =
        point(local.set(s))

      override def modify(f: Option[S] => Option[S]): Future[Unit] =
        point(local.set(f(local())))

      override def gets[A](f: Option[S] => A): Future[A] =
        point(f(local()))

      override def point[A](a: => A): Future[A] =
        FutureMonad.point(a)

      override def bind[A, B](fa: Future[A])(f: A => Future[B]): Future[B] =
        FutureMonad.bind(fa)(f)
    }

  /**
   * Future ~> F
   * Caution: The F will most likely start computing immediately
   */
  implicit class TwitterFutureAsync[A](val f: Future[A]) extends AnyVal {
    def liftAsync[F[_]](implicit MA: MonadAsync[F], M: Monad[F], C: Catchable[F]): F[A] = {
      MA.async(f.callback).unattempt
    }
    def callback: Callback[Throwable \/ A] = { cb =>
      f.respond {
        case Return(a) => cb(\/-(a))
        case Throw(t) => cb(-\/(t))
      }
      ()
    }
  }
  implicit def twitterFutureTransformation[F[_]](implicit MA: MonadAsync[F], M: Monad[F], C: Catchable[F]): Future ~> F =
    new (Future ~> F) {
      def apply[A](f: Future[A]): F[A] = f.liftAsync[F]
    }
}


text:
<?php

namespace Circle314\Component\Data\Persistence\Operation\Response\Database\Native;

use Circle314\Component\Data\Persistence\Operation\Response\Database\AbstractDatabaseResponse;

class NativeDatabaseResponse extends AbstractDatabaseResponse
{

}


text:
package org.apache.hbase.archetypes.exemplars.shaded_client;

import java.io.IOException;
import java.util.Map.Entry;
import java.util.NavigableMap;
import org.apache.hadoop.hbase.HColumnDescriptor;
import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.hbase.NamespaceDescriptor;
import org.apache.hadoop.hbase.NamespaceNotFoundException;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.Admin;
import org.apache.hadoop.hbase.client.Connection;
import org.apache.hadoop.hbase.client.ConnectionFactory;
import org.apache.hadoop.hbase.client.Delete;
import org.apache.hadoop.hbase.client.Get;
import org.apache.hadoop.hbase.client.Put;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.client.Table;
import org.apache.hadoop.hbase.util.Bytes;

/**
 * Successful running of this application requires access to an active instance
 * of HBase. For install instructions for a standalone instance of HBase, please
 * refer to https://hbase.apache.org/book.html#quickstart
 */
public final class HelloHBase {

  protected static final String MY_NAMESPACE_NAME = "myTestNamespace";
  static final TableName MY_TABLE_NAME = TableName.valueOf("myTestTable");
  static final byte[] MY_COLUMN_FAMILY_NAME = Bytes.toBytes("cf");
  static final byte[] MY_FIRST_COLUMN_QUALIFIER
          = Bytes.toBytes("myFirstColumn");
  static final byte[] MY_SECOND_COLUMN_QUALIFIER
          = Bytes.toBytes("mySecondColumn");
  static final byte[] MY_ROW_ID = Bytes.toBytes("rowId01");

  // Private constructor included here to avoid checkstyle warnings
  private HelloHBase() {
  }

  public static void main(final String[] args) throws IOException {
    final boolean deleteAllAtEOJ = true;

    /**
     * ConnectionFactory#createConnection() automatically looks for
     * hbase-site.xml (HBase configuration parameters) on the system's
     * CLASSPATH, to enable creation of Connection to HBase via ZooKeeper.
     */
    try (Connection connection = ConnectionFactory.createConnection();
        Admin admin = connection.getAdmin()) {
      admin.getClusterMetrics(); // assure connection successfully established
      System.out.println("\n*** Hello HBase! -- Connection has been "
              + "established via ZooKeeper!!\n");

      createNamespaceAndTable(admin);

      System.out.println("Getting a Table object for [" + MY_TABLE_NAME
              + "] with which to perform CRUD operations in HBase.");
      try (Table table = connection.getTable(MY_TABLE_NAME)) {

        putRowToTable(table);
        getAndPrintRowContents(table);

        if (deleteAllAtEOJ) {
          deleteRow(table);
        }
      }

      if (deleteAllAtEOJ) {
        deleteNamespaceAndTable(admin);
      }
    }
  }

  /**
   * Invokes Admin#createNamespace and Admin#createTable to create a namespace
   * with a table that has one column-family.
   *
   * @param admin Standard Admin object
   * @throws IOException If IO problem encountered
   */
  static void createNamespaceAndTable(final Admin admin) throws IOException {

    if (!namespaceExists(admin, MY_NAMESPACE_NAME)) {
      System.out.println("Creating Namespace [" + MY_NAMESPACE_NAME + "].");

      admin.createNamespace(NamespaceDescriptor
              .create(MY_NAMESPACE_NAME).build());
    }
    if (!admin.tableExists(MY_TABLE_NAME)) {
      System.out.println("Creating Table [" + MY_TABLE_NAME.getNameAsString()
              + "], with one Column Family ["
              + Bytes.toString(MY_COLUMN_FAMILY_NAME) + "].");

      admin.createTable(new HTableDescriptor(MY_TABLE_NAME)
              .addFamily(new HColumnDescriptor(MY_COLUMN_FAMILY_NAME)));
    }
  }

  /**
   * Invokes Table#put to store a row (with two new columns created 'on the
   * fly') into the table.
   *
   * @param table Standard Table object (used for CRUD operations).
   * @throws IOException If IO problem encountered
   */
  static void putRowToTable(final Table table) throws IOException {

    table.put(new Put(MY_ROW_ID).addColumn(MY_COLUMN_FAMILY_NAME,
            MY_FIRST_COLUMN_QUALIFIER,
            Bytes.toBytes("Hello")).addColumn(MY_COLUMN_FAMILY_NAME,
                    MY_SECOND_COLUMN_QUALIFIER,
                    Bytes.toBytes("World!")));

    System.out.println("Row [" + Bytes.toString(MY_ROW_ID)
            + "] was put into Table ["
            + table.getName().getNameAsString() + "] in HBase;\n"
            + "  the row's two columns (created 'on the fly') are: ["
            + Bytes.toString(MY_COLUMN_FAMILY_NAME) + ":"
            + Bytes.toString(MY_FIRST_COLUMN_QUALIFIER)
            + "] and [" + Bytes.toString(MY_COLUMN_FAMILY_NAME) + ":"
            + Bytes.toString(MY_SECOND_COLUMN_QUALIFIER) + "]");
  }

  /**
   * Invokes Table#get and prints out the contents of the retrieved row.
   *
   * @param table Standard Table object
   * @throws IOException If IO problem encountered
   */
  static void getAndPrintRowContents(final Table table) throws IOException {

    Result row = table.get(new Get(MY_ROW_ID));

    System.out.println("Row [" + Bytes.toString(row.getRow())
            + "] was retrieved from Table ["
            + table.getName().getNameAsString()
            + "] in HBase, with the following content:");

    for (Entry<byte[], NavigableMap<byte[], byte[]>> colFamilyEntry
            : row.getNoVersionMap().entrySet()) {
      String columnFamilyName = Bytes.toString(colFamilyEntry.getKey());

      System.out.println("  Columns in Column Family [" + columnFamilyName
              + "]:");

      for (Entry<byte[], byte[]> columnNameAndValueMap
              : colFamilyEntry.getValue().entrySet()) {

        System.out.println("    Value of Column [" + columnFamilyName + ":"
                + Bytes.toString(columnNameAndValueMap.getKey()) + "] == "
                + Bytes.toString(columnNameAndValueMap.getValue()));
      }
    }
  }

  /**
   * Checks to see whether a namespace exists.
   *
   * @param admin Standard Admin object
   * @param namespaceName Name of namespace
   * @return true If namespace exists
   * @throws IOException If IO problem encountered
   */
  static boolean namespaceExists(final Admin admin, final String namespaceName)
          throws IOException {
    try {
      admin.getNamespaceDescriptor(namespaceName);
    } catch (NamespaceNotFoundException e) {
      return false;
    }
    return true;
  }

  /**
   * Invokes Table#delete to delete test data (i.e. the row)
   *
   * @param table Standard Table object
   * @throws IOException If IO problem is encountered
   */
  static void deleteRow(final Table table) throws IOException {
    System.out.println("Deleting row [" + Bytes.toString(MY_ROW_ID)
            + "] from Table ["
            + table.getName().getNameAsString() + "].");
    table.delete(new Delete(MY_ROW_ID));
  }

  /**
   * Invokes Admin#disableTable, Admin#deleteTable, and Admin#deleteNamespace to
   * disable/delete Table and delete Namespace.
   *
   * @param admin Standard Admin object
   * @throws IOException If IO problem is encountered
   */
  static void deleteNamespaceAndTable(final Admin admin) throws IOException {
    if (admin.tableExists(MY_TABLE_NAME)) {
      System.out.println("Disabling/deleting Table ["
              + MY_TABLE_NAME.getNameAsString() + "].");
      admin.disableTable(MY_TABLE_NAME); // Disable a table before deleting it.
      admin.deleteTable(MY_TABLE_NAME);
    }
    if (namespaceExists(admin, MY_NAMESPACE_NAME)) {
      System.out.println("Deleting Namespace [" + MY_NAMESPACE_NAME + "].");
      admin.deleteNamespace(MY_NAMESPACE_NAME);
    }
  }
}


text:
namespace TestCases.HSSF.UserModel
{
    using System;
    using System.Reflection;
    using NUnit.Framework;
    using NPOI.HSSF.Model;
    using NPOI.HSSF.Record;
    using NPOI.HSSF.UserModel;
    using NPOI.SS.Formula;
    using NPOI.SS.Formula.PTG;
    using NPOI.SS.UserModel;
    using NPOI.SS.Util;
    using TestCases.SS.UserModel;

    /**
     * Tests various functionality having to do with {@link NPOI.SS.usermodel.Name}.
     *
     * @author Andrew C. Oliver (acoliver at apache dot org)
     * @author ROMANL
     * @author Danny Mui (danny at muibros.com)
     * @author Amol S. Deshmukh < amol at ap ache dot org >
     */
    [TestFixture]
    public class TestHSSFName : BaseTestNamedRange
    {
        public TestHSSFName()
            : base(HSSFITestDataProvider.Instance)
        {

        }

        /**
         * For manipulating the internals of {@link HSSFName} during Testing.

         * Some Tests need a {@link NameRecord} with unusual state, not normally producible by POI.
         * This method achieves the aims at low cost without augmenting the POI usermodel api.
         * @return a reference to the wrapped {@link NameRecord}
         */
        public static NameRecord GetNameRecord(IName definedName)
        {

            FieldInfo f;
            f = typeof(HSSFName).GetField("_definedNameRec",BindingFlags.Instance|BindingFlags.NonPublic);
            //f.SetAccessible(true);
            return (NameRecord)f.GetValue(definedName);
        }

        [Test]
        public void TestRepeatingRowsAndColumsNames()
        {
            // First Test that Setting RR&C for same sheet more than once only Creates a
            // single  Print_Titles built-in record
            HSSFWorkbook wb = new HSSFWorkbook();
            HSSFSheet sheet = (HSSFSheet)wb.CreateSheet("FirstSheet");

            // set repeating rows and columns twice for the first sheet
            CellRangeAddress cra = CellRangeAddress.ValueOf("A1:A3");
            for (int i = 0; i < 2; i++)
            {
                sheet.RepeatingColumns = (cra);
                sheet.RepeatingRows = (cra);
                sheet.CreateFreezePane(0, 3);
            }
            Assert.AreEqual(1, wb.NumberOfNames);
            IName nr1 = wb.GetNameAt(0);

            Assert.AreEqual("Print_Titles", nr1.NameName);
            // TODO - full column references not rendering properly, absolute markers not present either
            // assertEquals("FirstSheet!$A:$A,FirstSheet!$1:$3", nr1.getRefersToFormula());
            Assert.AreEqual("FirstSheet!A:A,FirstSheet!$A$1:$IV$3", nr1.RefersToFormula);

            // Save and re-open
            HSSFWorkbook nwb = HSSFTestDataSamples.WriteOutAndReadBack(wb);

            Assert.AreEqual(1, nwb.NumberOfNames);
            nr1 = nwb.GetNameAt(0);

            Assert.AreEqual("Print_Titles", nr1.NameName);
            Assert.AreEqual("FirstSheet!A:A,FirstSheet!$A$1:$IV$3", nr1.RefersToFormula);

            // check that Setting RR&C on a second sheet causes a new Print_Titles built-in
            // name to be Created
            sheet = (HSSFSheet)nwb.CreateSheet("SecondSheet");
            cra = CellRangeAddress.ValueOf("B1:C1");
            sheet.RepeatingColumns = (cra);
            sheet.RepeatingRows = (cra);

            Assert.AreEqual(2, nwb.NumberOfNames);
            IName nr2 = nwb.GetNameAt(1);

            Assert.AreEqual("Print_Titles", nr2.NameName);
            Assert.AreEqual("SecondSheet!B:C,SecondSheet!$A$1:$IV$1", nr2.RefersToFormula);
        }
        [Test]
        public void TestNamedRange()
        {
            HSSFWorkbook wb = HSSFTestDataSamples.OpenSampleWorkbook("Simple.xls");

            //Creating new Named Range
            IName newNamedRange = wb.CreateName();

            //Getting Sheet Name for the reference
            String sheetName = wb.GetSheetName(0);

            //Setting its name
            newNamedRange.NameName = "RangeTest";
            //Setting its reference
            newNamedRange.RefersToFormula = sheetName + "!$D$4:$E$8";

            //Getting NAmed Range
            IName namedRange1 = wb.GetNameAt(0);
            //Getting it sheet name
            sheetName = namedRange1.SheetName;
            Assert.IsNotNull(sheetName);

            // sanity check
            SanityChecker c = new SanityChecker();
            c.CheckHSSFWorkbook(wb);

            wb = HSSFTestDataSamples.WriteOutAndReadBack(wb);
            IName nm = wb.GetNameAt(wb.GetNameIndex("RangeTest"));
            Assert.IsTrue("RangeTest".Equals(nm.NameName), "Name is " + nm.NameName);
            Assert.AreEqual(wb.GetSheetName(0) + "!$D$4:$E$8", nm.RefersToFormula);
        }

        /**
         * Reads an excel file already Containing a named range.
         *

         * Addresses Bug #9632
         */
        [Test]
        public void TestNamedRead()
        {
            HSSFWorkbook wb = HSSFTestDataSamples.OpenSampleWorkbook("namedinput.xls");

            //Get index of the named range with the name = "NamedRangeName" , which was defined in input.xls as A1:D10
            int NamedRangeIndex = wb.GetNameIndex("NamedRangeName");

            //Getting NAmed Range
            IName namedRange1 = wb.GetNameAt(NamedRangeIndex);
            String sheetName = wb.GetSheetName(0);

            //Getting its reference
            String reference = namedRange1.RefersToFormula;

            Assert.AreEqual(sheetName + "!$A$1:$D$10", reference);

            IName namedRange2 = wb.GetNameAt(1);

            Assert.AreEqual(sheetName + "!$D$17:$G$27", namedRange2.RefersToFormula);
            Assert.AreEqual("SecondNamedRange", namedRange2.NameName);
        }

        /**
         * Reads an excel file already Containing a named range and updates it
         *

         * Addresses Bug #16411
         */
        [Test]
        public void TestNamedReadModify()
        {
            HSSFWorkbook wb = HSSFTestDataSamples.OpenSampleWorkbook("namedinput.xls");

            IName name = wb.GetNameAt(0);
            String sheetName = wb.GetSheetName(0);

            Assert.AreEqual(sheetName + "!$A$1:$D$10", name.RefersToFormula);

            name = wb.GetNameAt(1);
            String newReference = sheetName + "!$A$1:$C$36";

            name.RefersToFormula = newReference;
            Assert.AreEqual(newReference, name.RefersToFormula);
        }

        /**
         * Test to see if the print area can be retrieved from an excel Created file
         */
        [Test]
        public void TestPrintAreaFileRead()
        {
            HSSFWorkbook workbook = HSSFTestDataSamples.OpenSampleWorkbook("SimpleWithPrintArea.xls");

            String sheetName = workbook.GetSheetName(0);
            String reference = sheetName + "!$A$1:$C$5";

            Assert.AreEqual(reference, workbook.GetPrintArea(0));
        }

        [Test]
        public void TestDeletedReference()
        {
            HSSFWorkbook wb = HSSFTestDataSamples.OpenSampleWorkbook("24207.xls");
            Assert.AreEqual(2, wb.NumberOfNames);

            IName name1 = wb.GetNameAt(0);
            Assert.AreEqual("a", name1.NameName);
            Assert.AreEqual("Sheet1!$A$1", name1.RefersToFormula);
            new AreaReference(name1.RefersToFormula);
            Assert.IsTrue(true, "Successfully constructed first reference");

            IName name2 = wb.GetNameAt(1);
            Assert.AreEqual("b", name2.NameName);
            Assert.AreEqual("Sheet1!#REF!", name2.RefersToFormula);
            Assert.IsTrue(name2.IsDeleted);
            try
            {
                new AreaReference(name2.RefersToFormula);
                Assert.Fail("attempt to supply an invalid reference to AreaReference constructor results in exception");
            }
            catch (ArgumentException)
            { // TODO - use a different exception for this condition
                // expected during successful Test
            }
        }

        /**
         * When Setting A1 type of references with HSSFName.SetRefersToFormula
         * must set the type of operands to Ptg.CLASS_REF,
         * otherwise Created named don't appear in the drop-down to the left of formula bar in Excel
         */
        [Test]
        public void TestTypeOfRootPtg()
        {
            HSSFWorkbook wb = new HSSFWorkbook();
            wb.CreateSheet("CSCO");

            Ptg[] ptgs = HSSFFormulaParser.Parse("CSCO!$E$71", wb, FormulaType.NamedRange, 0);
            foreach (Ptg ptg in ptgs)
            {
                Assert.AreEqual('R', ptg.RVAType);
            }
        }
    }
}


text:
SYNONYM

#### According to
Index Fungorum

#### Published in
null

#### Original name
Valsa bloxami Cooke

### Remarks
null


text:
$(document).ready(function() {
	//selectedAPI = $("#apiSelect").val();
	loadAPIComboValue();
	populateBlacklistData();

    $("#apiSelect").click(function() {
		//loadAPIComboValue();
		populateBlacklistData();
	});

	$("#view").click(function() {
		populateBlacklistData();
	});

	$("#add-blacklist").click(function() {
		addNewToBlacklist();
	});
});

function populateBlacklistData() {
	var api = $("#apiSelect").val();

	if(api == null){
		return;
	}

	jagg.post("/site/blocks/apiwise-blacklist/ajax/apiwise-blacklist.jag", {
		action : "getBlacklistByAPI",
		api : api
	}, function(result) {
		if (!result.error) {
			var blacklist = result.blacklist;

			var tbody = document.getElementById("billingBody");
			tbody.innerHTML = "";

			var blacklistHeader = document.getElementById("blacklist-header");
			blacklistHeader.innerHTML = "
Blacklisted subscribers ("
					+ $("#apiSelect").val() + ")
";

			for (var i = 0; i < blacklist.length; i++) {

				var subscriber = blacklist[i];

				var row = document.createElement("tr");
				row.setAttribute("style","background-color: #f5f5f5;");
				var cell0 = document.createElement("td");
				cell0.innerHTML = subscriber;
				row.appendChild(cell0);

				var cell1 = document.createElement("td");
				//cell1.innerHTML = "
Remove
";
				//cell1.innerHTML = "
Remove
";
				cell1.innerHTML = "";

				row.appendChild(cell1);

				tbody.appendChild(row);
			}
		} else {
			jagg.message({
				content : result.message,
				type : "error"
			});
		}
	}, "json");
};

function addNewToBlacklist() {

	var api = $("#apiSelect").val();
	//var subscriberList = prompt("Please enter subscriber number", "Separated by comma");
	var subscriberList = $("#subscriber_black_list").val();
	jagg.post("/site/blocks/apiwise-blacklist/ajax/apiwise-blacklist.jag", {
		action : "addNewToBlacklist",
		api : api,
		subscriberList : subscriberList
	}, function(result) {
		if (!result.error && result.code == 1) {
			populateBlacklistData($("#apiSelect").val());
		} else {
			jagg.message({
				content : result.message,
				type : "error"
			});
		}
	}, "json");
};

function removeFromBlacklist(subscriber) {
	var api = $("#apiSelect").val();
	console.info("subscriber: " + subscriber);
	jagg.post("/site/blocks/apiwise-blacklist/ajax/apiwise-blacklist.jag", {
		action : "removeFromBlacklist",
		api : api,
		subscriber : subscriber
	}, function(result) {
		if (!result.error && result.code == 1) {
			populateBlacklistData($("#apiSelect").val());
		} else {
			jagg.message({
				content : result.message,
				type : "error"
			});
		}
	}, "json");
};

function loadAPIComboValue() {

	jagg.post("/site/blocks/apiwise-blacklist/ajax/apiwise-blacklist.jag", {
		action : "apis"
	}, function(result) {
			var apiSelect = $("#apiSelect");
			apiSelect.html("");
			//alert(result);
			var tempValue = null;
			for (var prop in result) {

	    		var apiArray = result[prop].split(':');
	    		//alert(apiArray[0]);

	    		if(tempValue == null){
	    			tempValue = apiArray[3];
	    		}

	    		apiSelect.append($("<option></option>")
	    	         .attr("value",apiArray[3])
	    	         .text(apiArray[1] + " - " + apiArray[2] + "  Provided by " + apiArray[0]));
	    		//alert(result.code[prop]);
	    	}

	    	populateBlacklistData();
	}, "json");

	$('#apiSelect').val(9);
};


text:
class CommunitiesController < ApplicationController
  decorates_assigned :communities

  def index
    authorize(sample_community)
    @communities = Utils::CommunitySummarizer.new.communities(policy_scope(Community))
  end

  private

  def sample_community
    Community.new
  end
end


text:
"""
GeoRef
Python Offline Georeferencer
by Karim Bahgat, 2014

Unfinished alpha version
"""

from helpers import timetaker,messages
from downloader import *
from datamanager import *

# FOR ADVANCED INSPIRATION AND ALGORITHM,
# SEE: https://github.com/mapbox/carmen/tree/master/test

#INTERNAL USE ONLY
class Geocoder:
    """
    The class that does the geocoding behind the scene

    IDEA: make geocoding condition a simple str expression for exec()...
    """
    def __init__(self):
        pass
    def add_match_condition(self):
        pass
    def find_match(self):
        #load and open country lookup table
        #loop through country table
        #   compare each record with the queried names/match conditions
        #   create match dictionary if match above threshold
        #return all match dictionaries
        pass

#USER FUNCTIONS
def geocode(city=None, adm1=None, adm2=None, adm3=None, admx=None, country=None):
    """
    Should return a dictionary with matched city,adm,country,shapetype,point/polygon coordinates,match similarity etc.
    """
    names = city,adm1,adm2,adm3,admx,country
    geocoder = Geocoder()
    for name in names:
        geocoder.add_match_condition(name)
    results = geocoder.find_match()
    return results

if __name__ == "__main__":
    #Download("gadm", downpath="C:/Users/BIGKIMO/Desktop/GADM_dl")
    pass


text:
var http=require('http');
http.createServer(function(req,res)
{
res.writeHead(200);
res.end('hello world');
} ) .listen(3000);
console.log('Server started on port 3000');


text:
package org.apache.activemq.artemis.tests.integration.mqtt5.spec;

import org.apache.activemq.artemis.tests.integration.mqtt5.MQTT5TestSupport;
import org.jboss.logging.Logger;
import org.junit.Ignore;

/**
 * Fulfilled by client or Netty codec (i.e. not explicitly tested here):
 *
 * [MQTT-1.5.4-1] The character data in a UTF-8 Encoded String MUST be well-formed UTF-8 as defined by the Unicode specification [Unicode] and restated in RFC 3629 [RFC3629]. In particular, the character data MUST NOT include encodings of code points between U+D800 and U+DFFF.
 * [MQTT-1.5.4-2] A UTF-8 Encoded String MUST NOT include an encoding of the null character U+0000.
 * [MQTT-1.5.4-3] A UTF-8 encoded sequence 0xEF 0xBB 0xBF is always interpreted as U+FEFF ("ZERO WIDTH NO-BREAK SPACE") wherever it appears in a string and MUST NOT be skipped over or stripped off by a packet receiver.
 * [MQTT-1.5.5-1] The encoded value MUST use the minimum number of bytes necessary to represent the value.
 * [MQTT-1.5.7-1] Both strings MUST comply with the requirements for UTF-8 Encoded Strings.
 */

@Ignore
public class DataFormatTests extends MQTT5TestSupport {

   private static final Logger log = Logger.getLogger(DataFormatTests.class);

   public DataFormatTests(String protocol) {
      super(protocol);
   }
}


text:
import { ComponentFixture, async } from '@angular/core/testing';
import { TestUtils } from '../../test';

import { EditGoalPage } from './edit-goal';

let fixture: ComponentFixture < EditGoalPage > = null;
let instance: any = null;

describe('Page: EditGoalPage', () => {

    beforeEach(async(() => TestUtils.beforeEachCompiler([EditGoalPage]).then(compiled => {
        fixture = compiled.fixture;
        instance = compiled.instance;
        fixture.detectChanges();
    })));

    afterEach(() => {
        fixture.destroy();
    });

    it('initialises', () => {
        expect(instance).toBeTruthy();
    });
});