text:
module LinuxAdmin
  class Hardware
    def total_cores
      File.readlines("/proc/cpuinfo").count { |line| line =~ /^processor\s+:\s+\d+/ }
    end
  end
end

redpajama_set_name: RedPajamaGithub


text:
#include "modules/prediction/common/prediction_gflags.h"

#include <cmath>

DEFINE_double(double_precision, 1e-6, "precision of double");

// prediction trajectory and dynamic model
DEFINE_double(prediction_trajectory_time_length, 8.0,
              "Time length of predicted trajectory (in seconds)");
DEFINE_double(prediction_trajectory_time_resolution, 0.1,
              "Time resolution of predicted trajectory (in seconds");
DEFINE_double(min_prediction_trajectory_spatial_length, 100.0,
              "Minimal spatial length of predicted trajectory");
DEFINE_bool(enable_trajectory_validation_check, false,
            "If check the validity of prediction trajectory.");
DEFINE_bool(enable_tracking_adaptation, false,
            "If enable prediction tracking adaptation");

DEFINE_double(vehicle_max_linear_acc, 4.0,
              "Upper bound of vehicle linear acceleration");
DEFINE_double(vehicle_min_linear_acc, -4.0,
              "Lower bound of vehicle linear deceleration");
DEFINE_double(vehicle_max_speed, 35.0, "Max speed of vehicle");

// Tracking Adaptation
DEFINE_double(max_tracking_time, 0.5,
              "Max tracking time for disappear obstacles");
DEFINE_double(max_tracking_dist, 3.0,
              "Max tracking distance for disappear obstacles");

// Map
DEFINE_double(lane_search_radius, 3.0, "Search radius for a candidate lane");
DEFINE_double(lane_search_radius_in_junction, 15.0,
              "Search radius for a candidate lane");
DEFINE_double(junction_search_radius, 1.0, "Search radius for a junction");
DEFINE_double(pedestrian_nearby_lane_search_radius, 5.0,
              "Radius to determine if pedestrian-like obstacle is near lane.");
DEFINE_int32(road_graph_max_search_horizon, 20,
             "Maximal search depth for building road graph");

// Semantic Map
DEFINE_double(base_image_half_range, 100.0, "The half range of base image.");
DEFINE_bool(img_show_semantic_map, false, "If show the image of semantic map.");

// Scenario
DEFINE_double(junction_distance_threshold, 10.0,
              "Distance threshold "
              "to junction to consider as junction scenario");
DEFINE_bool(enable_all_junction, false,
            "If consider all junction with junction_mlp_model.");
DEFINE_double(caution_search_distance_ahead, 50.0,
              "The distance ahead to search caution-level obstacles");
DEFINE_double(caution_search_distance_backward, 50.0,
              "The distance backward to search caution-level obstacles");
DEFINE_double(caution_search_distance_backward_for_merge, 60.0,
              "The distance backward to search caution-lebel obstacles "
              "in the case of merging");
DEFINE_double(caution_search_distance_backward_for_overlap, 30.0,
              "The distance backward to search caution-lebel obstacles "
              "in the case of overlap");
DEFINE_double(caution_pedestrian_approach_time, 3.0,
              "The time for a pedestrian to approach adc trajectory");

// Obstacle features
DEFINE_int32(ego_vehicle_id, -1, "The obstacle ID of the ego vehicle.");
DEFINE_double(scan_length, 80.0, "The length of the obstacles scan area");
DEFINE_double(scan_width, 12.0, "The width of the obstacles scan area");
DEFINE_double(back_dist_ignore_ped, -2.0,
              "Backward distance to ignore pedestrians.");
DEFINE_uint64(cruise_historical_frame_length, 5,
              "The number of historical frames of the obstacle"
              "that the cruise model will look at.");
DEFINE_bool(enable_kf_tracking, false, "Use measurements with KF tracking");

DEFINE_double(max_angle_diff_to_adjust_velocity, M_PI / 6.0,
              "The maximal angle diff to adjust velocity heading.");
DEFINE_double(q_var, 0.01, "Processing noise covariance");
DEFINE_double(r_var, 0.25, "Measurement noise covariance");
DEFINE_double(p_var, 0.1, "Error covariance");
DEFINE_double(go_approach_rate, 0.995,
              "The rate to approach to the reference line of going straight");
DEFINE_double(cutin_approach_rate, 0.95,
              "The rate to approach to the reference line of cutin");

DEFINE_int32(min_still_obstacle_history_length, 4,
             "Min # historical frames for still obstacles");
DEFINE_int32(max_still_obstacle_history_length, 10,
             "Min # historical frames for still obstacles");
DEFINE_double(still_obstacle_speed_threshold, 0.99,
              "Speed threshold for still obstacles");
DEFINE_double(still_pedestrian_speed_threshold, 0.2,
              "Speed threshold for still pedestrians");
DEFINE_double(still_unknown_speed_threshold, 0.5,
              "Speed threshold for still unknown obstacles");
DEFINE_double(still_obstacle_position_std, 0.5,
              "Position standard deviation for still obstacles");
DEFINE_double(still_pedestrian_position_std, 0.5,
              "Position standard deviation for still pedestrians");
DEFINE_double(still_unknown_position_std, 0.5,
              "Position standard deviation for still unknown obstacles");
DEFINE_double(slow_obstacle_speed_threshold, 2.0,
              "Speed threshold for slow obstacles");
DEFINE_double(max_history_time, 7.0, "Obstacles' maximal historical time.");
DEFINE_double(target_lane_gap, 2.0, "Gap between two lane points.");
DEFINE_double(dense_lane_gap, 0.2,
              "Gap between two adjacent lane points"
              " for constructing dense lane graph.");
DEFINE_int32(max_num_current_lane, 2, "Max number to search current lanes");
DEFINE_int32(max_num_nearby_lane, 2, "Max number to search nearby lanes");
DEFINE_double(max_lane_angle_diff, M_PI / 3.0,
              "Max angle difference for a candidate lane");
DEFINE_int32(max_num_current_lane_in_junction, 3,
             "Max number to search current lanes");
DEFINE_int32(max_num_nearby_lane_in_junction, 2,
             "Max number to search nearby lanes");
DEFINE_double(max_lane_angle_diff_in_junction, M_PI / 4.0,
              "Max angle difference for a candidate lane");
DEFINE_double(coeff_mul_sigma, 2.0, "coefficient multiply standard deviation");
DEFINE_double(pedestrian_max_speed, 10.0, "speed upper bound for pedestrian");
DEFINE_double(pedestrian_max_acc, 2.0, "maximum pedestrian acceleration");
DEFINE_double(still_speed, 0.01, "speed considered to be still");
DEFINE_string(evaluator_vehicle_mlp_file,
              "/apollo/modules/prediction/data/mlp_vehicle_model.bin",
              "mlp model file for vehicle evaluator");
DEFINE_string(evaluator_vehicle_rnn_file,
              "/apollo/modules/prediction/data/rnn_vehicle_model.bin",
              "rnn model file for vehicle evaluator");
DEFINE_string(torch_vehicle_junction_mlp_file,
              "/apollo/modules/prediction/data/junction_mlp_vehicle_model.pt",
              "Vehicle junction MLP model file");
DEFINE_string(torch_vehicle_junction_map_file,
              "/apollo/modules/prediction/data/junction_map_vehicle_model.pt",
              "Vehicle junction map model file");
DEFINE_string(torch_vehicle_cruise_go_file,
              "/apollo/modules/prediction/data/cruise_go_vehicle_model.pt",
              "Vehicle cruise go model file");
DEFINE_string(torch_vehicle_cruise_cutin_file,
              "/apollo/modules/prediction/data/cruise_cutin_vehicle_model.pt",
              "Vehicle cruise cutin model file");
DEFINE_string(torch_vehicle_lane_scanning_file,
              "/apollo/modules/prediction/data/lane_scanning_vehicle_model.pt",
              "Vehicle lane scanning model file");
DEFINE_string(torch_pedestrian_interaction_position_embedding_file,
              "/apollo/modules/prediction/data/"
              "pedestrian_interaction_position_embedding.pt",
              "pedestrian interaction position embedding");
DEFINE_string(torch_pedestrian_interaction_social_embedding_file,
              "/apollo/modules/prediction/data/"
              "pedestrian_interaction_social_embedding.pt",
              "pedestrian interaction social embedding");
DEFINE_string(torch_pedestrian_interaction_single_lstm_file,
              "/apollo/modules/prediction/data/"
              "pedestrian_interaction_single_lstm.pt",
              "pedestrian interaction single lstm");
DEFINE_string(torch_pedestrian_interaction_prediction_layer_file,
              "/apollo/modules/prediction/data/"
              "pedestrian_interaction_prediction_layer.pt",
              "pedestrian interaction prediction layer");
DEFINE_string(torch_lane_aggregating_obstacle_encoding_file,
              "/apollo/modules/prediction/data/"
              "traced_online_obs_enc.pt",
              "lane aggregating obstacle encoding layer");
DEFINE_string(torch_lane_aggregating_lane_encoding_file,
              "/apollo/modules/prediction/data/"
              "traced_online_lane_enc.pt",
              "lane aggregating lane encoding layer");
DEFINE_string(torch_lane_aggregating_prediction_layer_file,
              "/apollo/modules/prediction/data/"
              "traced_online_pred_layer.pt",
              "lane aggregating prediction layer");
DEFINE_int32(max_num_obstacles, 300,
             "maximal number of obstacles stored in obstacles container.");
DEFINE_double(valid_position_diff_threshold, 0.5,
              "threshold of valid position difference");
DEFINE_double(valid_position_diff_rate_threshold, 0.075,
              "threshold of valid position difference rate");
DEFINE_double(split_rate, 0.5, "obstacle split rate for adjusting velocity");
DEFINE_double(rnn_min_lane_relatice_s, 5.0,
              "Minimal relative s for RNN model.");
DEFINE_bool(adjust_velocity_by_obstacle_heading, false,
            "Use obstacle heading for velocity.");
DEFINE_bool(adjust_velocity_by_position_shift, false,
            "adjust velocity heading to lane heading");
DEFINE_bool(adjust_vehicle_heading_by_lane, true,
            "adjust vehicle heading by lane");
DEFINE_double(heading_filter_param, 0.98, "heading filter parameter");
DEFINE_uint64(max_num_lane_point, 20,
              "The maximal number of lane points to store");
DEFINE_double(distance_threshold_to_junction_exit, 1.0,
              "Threshold of distance to junction exit");
DEFINE_double(angle_threshold_to_junction_exit, M_PI * 0.25,
              "Threshold of angle to junction exit");
DEFINE_uint32(sample_size_for_average_lane_curvature, 10,
              "The sample size to compute average lane curvature");

// Validation checker
DEFINE_double(centripetal_acc_coeff, 0.5,
              "Coefficient of centripetal acceleration probability");

// Junction Scenario
DEFINE_uint32(junction_historical_frame_length, 5,
              "The number of historical frames of the obstacle"
              "that the junction model will look at.");
DEFINE_double(junction_exit_lane_threshold, 0.1,
              "If a lane extends out of the junction by this value,"
              "consider it as an exit_lane.");
DEFINE_double(distance_beyond_junction, 0.5,
              "If the obstacle is in junction more than this threshold,"
              "consider it in junction.");
DEFINE_double(defualt_junction_range, 10.0,
              "Default value for the range of a junction.");
DEFINE_double(distance_to_slow_down_at_stop_sign, 80.0,
              "The distance to slow down at stop sign");

// Evaluator
DEFINE_double(time_to_center_if_not_reach, 10.0,
              "Default value of time to lane center of not reach.");
DEFINE_double(default_s_if_no_obstacle_in_lane_sequence, 1000.0,
              "The default s value if no obstacle in the lane sequence.");
DEFINE_double(default_l_if_no_obstacle_in_lane_sequence, 10.0,
              "The default l value if no obstacle in the lane sequence.");
DEFINE_bool(enable_semantic_map, false, "If enable semantic map on prediction");

// Obstacle trajectory
DEFINE_bool(enable_cruise_regression, false,
            "If enable using regression in cruise model");
DEFINE_double(lane_sequence_threshold_cruise, 0.5,
              "Threshold for trimming lane sequence trajectories in cruise");
DEFINE_double(lane_sequence_threshold_junction, 0.5,
              "Threshold for trimming lane sequence trajectories in junction");
DEFINE_double(lane_change_dist, 10.0, "Lane change distance with ADC");
DEFINE_bool(enable_lane_sequence_acc, false,
            "If use acceleration in lane sequence.");
DEFINE_bool(enable_trim_prediction_trajectory, true,
            "If trim the prediction trajectory to avoid crossing"
            "protected adc planning trajectory.");
DEFINE_double(adc_trajectory_search_length, 10.0,
              "How far to search junction along adc planning trajectory");
DEFINE_double(virtual_lane_radius, 2.0, "Radius to search virtual lanes");
DEFINE_double(default_lateral_approach_speed, 0.5,
              "Default lateral speed approaching to center of lane");
DEFINE_double(centripedal_acc_threshold, 2.0,
              "Threshold of centripedal acceleration.");

// move sequence prediction
DEFINE_double(time_upper_bound_to_lane_center, 6.0,
              "Upper bound of time to get to the lane center");
DEFINE_double(time_lower_bound_to_lane_center, 1.0,
              "Lower bound of time to get to the lane center");
DEFINE_double(sample_time_gap, 0.5,
              "Gap of time to sample time to get to the lane center");
DEFINE_double(cost_alpha, 100.0,
              "The coefficient of lateral acceleration in cost function");
DEFINE_double(default_time_to_lat_end_state, 5.0,
              "The default time to lane center");
DEFINE_double(turning_curvature_lower_bound, 0.02,
              "The curvature lower bound of turning lane");
DEFINE_double(turning_curvature_upper_bound, 0.14,
              "The curvature upper bound of turning lane");
DEFINE_double(speed_at_lower_curvature, 8.5,
              "The speed at turning lane with lower bound curvature");
DEFINE_double(speed_at_upper_curvature, 3.0,
              "The speed at turning lane with upper bound curvature");
DEFINE_double(cost_function_alpha, 0.25,
              "alpha of the cost function for best trajectory selection,"
              "alpha weighs the influence by max lateral acceleration"
              "and that by the total time. The larger alpha gets, the"
              "more cost function values trajectory with shorter times,"
              "and vice versa.");
DEFINE_double(cost_function_sigma, 5.0,
              "This is the sigma for the bell curve that is used by"
              "the cost function in move-sequence-trajectory-predictor."
              "The bell curve has its average equal to the time to cross"
              "lane predicted by the model.");
DEFINE_bool(use_bell_curve_for_cost_function, false,
            "Whether to use bell curve for the cost function or not.");

// interaction predictor
DEFINE_double(collision_cost_time_resolution, 1.0,
              "The time resolution used to compute the collision cost");
DEFINE_double(longitudinal_acceleration_cost_weight, 0.2,
              "The weight of longitudinal acceleration cost");
DEFINE_double(centripedal_acceleration_cost_weight, 0.1,
              "The weight of the cost related to centripedal acceleration");
DEFINE_double(collision_cost_weight, 1.0,
              "The weight of the cost related to collision");
DEFINE_double(collision_cost_exp_coefficient, 1.0,
              "The coefficient in the collision exponential cost function");
DEFINE_double(likelihood_exp_coefficient, 1.0,
              "The coefficient in the likelihood exponential function");

DEFINE_double(lane_distance_threshold, 3.0,
              "The threshold for distance to ego/neighbor lane "
              "in feature extraction");

DEFINE_double(lane_angle_difference_threshold, M_PI * 0.25,
              "The threshold for distance to ego/neighbor lane "
              "in feature extraction");

// Trajectory evaluation
DEFINE_double(distance_threshold_on_lane, 1.5,
              "The threshold of distance in on-lane situation");


text:
package com.epam.ta.reportportal;

import com.epam.ta.reportportal.commons.ReportPortalUser;
import com.epam.ta.reportportal.entity.project.ProjectRole;
import com.epam.ta.reportportal.entity.user.UserRole;
import com.google.common.collect.Sets;
import org.assertj.core.util.Maps;
import org.springframework.security.core.authority.SimpleGrantedAuthority;

/**
 * @author Ihar Kahadouski
 */
public class ReportPortalUserUtil {

	public static final String TEST_PROJECT_NAME = "test_project";

	private ReportPortalUserUtil() {
		//static only
	}

	public static ReportPortalUser getRpUser(String login, UserRole userRole, ProjectRole projectRole, Long projectId) {
		return ReportPortalUser.userBuilder()
				.withUserName(login)
				.withPassword("test")
				.withAuthorities(Sets.newHashSet(new SimpleGrantedAuthority(userRole.getAuthority())))
				.withUserId(1L)
				.withEmail("test@email.com")
				.withUserRole(userRole)
				.withProjectDetails(Maps.newHashMap("test_project",
						new ReportPortalUser.ProjectDetails(projectId, TEST_PROJECT_NAME, projectRole)
				))
				.build();
	}
}


text:
<?php
namespace App\Controller;
use Cake\Mailer\Email;
use App\Controller\AppController;
use Cake\Datasource\ConnectionManager;
use Cake\Utility\Text;
use Cake\Routing\Router;
/**
 * Users Controller
 *
 * @property \App\Model\Table\UsersTable $Users
 */
class UsersController extends AppController
{

	public function initialize()
	{
	    parent::initialize();

	    //$this->Auth->allow(['add','adminlogin']);
	    $this->Auth->allow();
	}

    /**
     * Index method
     *
     * @return \Cake\Network\Response|null
     */
    public function index()
    {
    	$this->viewBuilder()->layout('admin');
        $this->paginate = [
        'contain' => ['Groups'] ];
        $users = $this->paginate($this->Users);
		$page = (isset($this->request->query['page'])) ? $this->request->query['page'] : 0;
        $this->set(compact('page'));
        $this->set(compact('users'));
        $this->set('_serialize', ['users']);
    }

 public function organizerindex()
    {
    	$this->viewBuilder()->layout('admin');
        $this->paginate = [
            'contain' => ['Groups']
        ];
       // $user = $this->Users->find('all',['limit' => 200, 'conditions' => array('group_id' => 2 )]);
        $users = $this->paginate($this->Users->find('all',['limit' => 200, 'conditions' => array('group_id' => 2 )]));
        $page = (isset($this->request->query['page'])) ? $this->request->query['page'] : 0;
        $this->set(compact('page'));
        $this->set(compact('users'));
        $this->set('_serialize', ['users']);

    	//$groups = $this->Users->Groups->find('list', ['limit' => 200,'conditions' => array('id' => 2)]);
    }
 public function adminmanager()
    {
        $this->viewBuilder()->layout('admin');
        $this->paginate = [
            'contain' => ['Groups']
        ];
       // $user = $this->Users->find('all',['limit' => 200, 'conditions' => array('group_id' => 2 )]);
        $users = $this->paginate($this->Users->find('all',['limit' => 200, 'conditions' => array('group_id' => 5 )]));
         $page = (isset($this->request->query['page'])) ? $this->request->query['page'] : 0;
        $this->set(compact('page'));
        $this->set(compact('users'));
        $this->set('_serialize', ['users']);

    	//$groups = $this->Users->Groups->find('list', ['limit' => 200,'conditions' => array('id' => 2)]);
    }
 public function emanagerindex()
    {
    	$this->viewBuilder()->layout('admin');
        $this->paginate = [
            'contain' => ['Groups']
        ];
       // $user = $this->Users->find('all',['limit' => 200, 'conditions' => array('group_id' => 2 )]);
        $users = $this->paginate($this->Users->find('all',['limit' => 200, 'conditions' => array('group_id' => 6 )]));
         $page = (isset($this->request->query['page'])) ? $this->request->query['page'] : 0;
        $this->set(compact('page'));
        $this->set(compact('users'));
        $this->set('_serialize', ['users']);

    	//$groups = $this->Users->Groups->find('list', ['limit' => 200,'conditions' => array('id' => 2)]);
    }

	public function userlist()
    {
    	$this->viewBuilder()->layout('admin');
        $this->paginate = [
            'contain' => ['Groups']
        ];
       // $user = $this->Users->find('all',['limit' => 200, 'conditions' => array('group_id' => 2 )]);
 $this->paginate['order'] = array('Users.created' => 'desc');
        $users = $this->paginate($this->Users->find('all',['limit' => 200, 'conditions' => array('group_id' => 1 )]));
         $page = (isset($this->request->query['page'])) ? $this->request->query['page'] : 0;
        $this->set(compact('page'));
       // $this->set('count',$this->Users->getCount($users));
            $this->set(compact('users'));
        $this->set('_serialize', ['users']);

    	//$groups = $this->Users->Groups->find('list', ['limit' => 200,'conditions' => array('id' => 2)]);
    }

    /**
     * View method
     *
     * @param string|null $id User id.
     * @return \Cake\Network\Response|null
     * @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
     */
    public function view($id = null)
    {
       $this->viewBuilder()->layout('admin');
        $user = $this->Users->get($id, [
            'contain' => ['Groups']
        ]);

        $this->set('user', $user);
        $this->set('_serialize', ['user']);
    }

    /**
     * Add method
     *
     * @return \Cake\Network\Response|void Redirects on successful add, renders view otherwise.
     */
    public function add()
    {
    	$activation_key = Text::uuid();
		$this->viewBuilder()->layout('admin_login');
        $user = $this->Users->newEntity();
        if ($this->request->is('post')) {
        	//$this->request->data['activation_key'] = $activation_key = String::uuid();
        	$this->request->data['group_id'] = 1;
        	$this->request->data['activation_key'] = $activation_key;
        	$user = $this->Users->patchEntity($user, $this->request->data);

        	$this->loadModel('UserProfile');
            $userProfile = $this->UserProfile->newEntity();

            if ($this->Users->save($user)) {
            	$userProfile = $this->UserProfile->patchEntity($userProfile, $this->request->data);
            	$userProfile['fullname'] = $this->request->data['fullname'];
            	$userProfile['user_id'] = $user->id;
            	$this->UserProfile->save($userProfile);

				$email = new Email();
                $email->transport('gmail');
				//$email->setHelpers(['Html','Text']);
                $subject = "Your Activation link";
                $name = $this->request->data['fullname'];
                $to = trim($this->request->data['email']);
                $activationUrl = Router::url(['controller' => 'users', 'action' => 'activate/' . $activation_key, '_full' => true ]);
                // Always try to write clean code, so that you can read it :) :
    			$email->template('cssignupemail','cs-email');
                $email->emailFormat('html');
    			$email->to($to);
    			$email->cc('admin@chennaismile.com');
    			$email->subject($subject);
    			$email->from('admin@chennaismile.com');
    			$email->viewVars(['name' => $name, 'activationUrl' => $activationUrl]);
    			$email->send();

                $this->Flash->success(__('Account activation link has been sent to you. Please check your mail'));
                //return $this->redirect(['action' => 'login']);
                return $this->redirect(['controller' => 'Events','action' => 'index']);
            } else {
                $this->Flash->error(__('The user could not be saved. Please, try again.'));
            }
        }
        $groups = $this->Users->Groups->find('list', ['limit' => 200,'conditions' => array('role' => 'Users')]);
        $this->set(compact('user', 'groups'));
        $this->set('_serialize', ['user']);
    }

    /**
     * Edit method
     *
     * @param string|null $id User id.
     * @return \Cake\Network\Response|void Redirects on successful edit, renders view otherwise.
     * @throws \Cake\Network\Exception\NotFoundException When record not found.
     */
    public function edit($id = null)

    {
    	 $this->viewBuilder()->layout('admin');
        $user = $this->Users->get($id, [
            'contain' => []
        ]);
        if ($this->request->is(['patch', 'post', 'put'])) {
            $user = $this->Users->patchEntity($user, $this->request->data);
            if ($this->Users->save($user)) {
                $this->Flash->success(__('The user has been saved.'));

                return $this->redirect(['action' => 'index']);
            } else {
                $this->Flash->error(__('The user could not be saved. Please, try again.'));
            }
        }
        $groups = $this->Users->Groups->find('list', ['limit' => 200]);
        $this->set(compact('user', 'groups'));
        $this->set('_serialize', ['user']);
    }

    /**
     * Delete method
     *
     * @param string|null $id User id.
     * @return \Cake\Network\Response|null Redirects to index.
     * @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
     */
    public function delete($id = null)
    {
        $this->request->allowMethod(['post', 'delete']);
        $user = $this->Users->get($id);
        if ($this->Users->updateAll(['active' => '2'], ['id' => $id])) {
            $this->Flash->success(__('The user has been deleted.'));
        } else {
            $this->Flash->error(__('The user could not be deleted. Please, try again.'));
        }

        return $this->redirect(['action' => 'index']);
    }

	public function login() {

		$this->viewBuilder()->layout('signin');
	    if ($this->request->is('post')) {
	        $user = $this->Auth->identify();
			if ($user && $user['Active'] != False) {
	            $this->Auth->setUser($user);
	            return $this->redirect($this->Auth->redirectUrl());
	        }else{
	        	$this->Flash->error(__('Username or Password is wrong! Please try again'));
	        	return $this->redirect(['controller' => 'Events','action' => 'index']);
	        }
	        // $this->Flash->error(__('Username or Password is wrong! Please try again'));
	    }
/*	    $activation_key = Text::uuid();
	    $user = $this->Users->newEntity();
        if ($this->request->is('post')) {
        	//$this->request->data['activation_key'] = $activation_key = String::uuid();
        	$this->request->data['group_id'] = 1;
        	$this->request->data['activation_key'] = $activation_key;
        	$user = $this->Users->patchEntity($user, $this->request->data);

            if ($this->Users->save($user)) {

            	$email = new Email();
        		$email->transport('gmail');
        		$subject = "Account Activation link send on your email";
            	$name = $this->request->data['fullname'];
			    $to = trim($this->request->data['email']);
			    $email->emailFormat('html');
			    $email->from('admin@chennaismile.com');
			    $email->to($to);
			    $email->cc('admin@chennaismile.com');
			    $email->subject($subject);
                $email ->setTemplate('cs-signup-email')
                        ->setLayout('cs-email')
                        ->setEmailFormat('html')
                         ->send();

				$activationUrl = Router::url(['controller' => 'users', 'action' => 'activate/' . $activation_key, '_full' => true ]);
			    // Always try to write clean code, so that you can read it :) :
			    // $message ="";
			    // $message = "Dear " . $name . ",

";
			    // $message .= "Your account has been created successfully by Administrator.
";
               	//$message .= "Activate your account by clicking on the below url:
";
			    // $message .= "$activationUrl

";
			    // $message .= "
Thanks,
Support Team";
			    $email->send();

                $this->Flash->success(__('The user has been saved.'));
                return $this->redirect(['action' => 'login']);
            } else {
                $this->Flash->error(__('The user could not be saved. Please, try again.'));
            }
        }
        $groups = $this->Users->Groups->find('list', ['limit' => 200,'conditions' => array('role' => 'Users')]);
        $this->set(compact('user', 'groups'));
        $this->set('_serialize', ['user']);*/

		/*if(!empty($this->request->data))
		{

			if(empty($this->request->data['email']))
			{
				$this->Flash->error(__('Please Provide Your Email Adress that You used to Register with Us'));
			}
			else
			{
				$email_inp=$this->request->data['email'];
				$fu=$this->Users->find('all',array('conditions'=>array('email'=>$email_inp)));
				$fu = $fu->first();
				if(!empty($fu))
				{
					if($fu['Active'] == true)
					{
						$key = Text::uuid();
						$url = Router::url(['controller' => 'users', 'action' => 'reset/' . $key, '_full' => true ]);
						$ms=$url;
						$ms=wordwrap($ms,1000);
						$fu['activation_key']= Text::uuid();
						$user_id = $fu['id'];
						$status = $this->Users->updateAll(['activation_key' => $key], ['id' => $user_id]);
						if($status){
							//============Email================//
							$email = new Email();
			        		$email->transport('gmail');
			        		$email->template('default');
			        		$subject = "Reset Your http://chennaismile.com/ Password";
			            	$name = $fu['fullname'];
						    $to = trim($this->request->data['email']);
						    $email->emailFormat('html');
						    $email->from('admin@chennaismile.com');
						    $email->to($to);
						    $email->cc('admin@chennaismile.com');
						    $email->subject($subject);

						    // Always try to write clean code, so that you can read it :) :
						    $message = "Dear " . $name . ",

";
						    $message .= "
Click on the link below to Reset Your Password

";
						    $message .= "$ms

";
						    $message .= "
Thanks,
Support Team";
						    $email->send($message);

			                $this->Flash->success(__('Check Your Email To Reset your password.'));
			                return $this->redirect(['action' => 'login']);
							//============EndEmail=============//
						}
						else{
							$this->Flash->success(__("Error Generating Reset link"));
						}
					}
					else
					{
						$this->Flash->success(__('This Account is not Active yet.Check Your mail to activate it'));
					}
				}
				else
				{
					$this->Flash->success(__('Email does Not Exist'));
				}
			}
		}*/

		$groups = $this->Users->Groups->find('list', ['limit' => 200,'conditions' => array('role' => 'Users')]);
        $this->set(compact('groups'));

	}

	public function adminlogin() {

        $this->viewBuilder()->layout('admin_login');
        if ($this->request->is('post')) {
            $user = $this->Auth->identify();
       if ($user && $user['group_id'] != 1 ) {
                $this->Auth->setUser($user);
                if($this->request->session()->read('Activate') == 1)
                {
		return $this->redirect(array('controller' => 'AdminDashBoard', 'action' => 'index'));

                }
                else
                {

                    return $this->redirect(array('controller' => 'AdminDashBoard', 'action' => 'index'));
                }
            }
            $this->Flash->error(__('Your username or password was incorrect.'));
        }
    }

	public function logout() {
		$this->Auth->logout();
	    // $this->Flash->success(__('Good-Bye'));
	    $this->redirect($this->Auth->logout());
	}
public function adminlogout() {
        $this->Auth->logout();
        // $this->Flash->success(__('Good-Bye'));
        $this->redirect(array('controller' => 'Users', 'action' => 'adminlogin'));
    }

	function activate($activation_key)
	{
		$this->autoRender = false;
        $query = $this->Users->find('all', array('conditions' => array('activation_key' => $activation_key,
                'active' => 0
			)
		));
		$userData = $query->first();
		if(isset($userData))
		{
			if ($userData['active'] == false)
            {
                $activeStatus = 1;

            }
			$status = $this->Users->updateAll(['active' => $activeStatus], ['id' => $userData['id']]);
			if ($status)
			{
				$email = new Email();
        		$email->transport('gmail');
        		$email->template('welcome','cs-email');
        		$subject = "Welcome to chennaismile";
            	$email->emailFormat('html');
			    $email->from('admin@chennaismile.com');
			    $to = $userData['email'];
			    $email->to($to);
			    $email->subject($subject);
				// $activationUrl = Router::url(['controller' => 'events', 'action' => 'activate/' . $new_id, '_full' => true ]);
			    $email->viewVars(['name' => $userData['fullname']]);
			    $email->send();
				$this->Flash->success(__('Status updated successfully'));
				$this->redirect(array('controller' => 'Events', 'action' => 'index'));
			}
			else
			{
				$this->Flash->error(__('Something went wrong, please try again.'));
				$this->redirect(array('controller' => 'Events', 'action' => 'index'));
			}
			$this->redirect(array('controller' => 'Events', 'action' => 'index'));
		}
	}

	function forgetpassword()
	{
		$this->viewBuilder()->layout('signin');
		//debug($this->request->data); exit(0);
		if(!empty($this->request->data))
		{

			if(empty($this->request->data['email']))
			{
				$this->Flash->error(__('Please Provide Your Email Adress that You used to Register with Us'));
			}
			else
			{
				$email_inp=$this->request->data['email'];
				$fu=$this->Users->find('all',array('conditions'=>array('email'=>$email_inp)));
				$fu = $fu->first();
				if(isset($fu))
				{
					if($fu['Active'] == true)
					{
						$key = Text::uuid();
						$url = Router::url(['controller' => 'users', 'action' => 'reset/' . $key, '_full' => true ]);
						$ms=$url;
						$ms=wordwrap($ms,1000);
						$fu['activation_key']= Text::uuid();
						$user_id = $fu['id'];
			$status = $this->Users->updateAll(['activation_key' => $key,'Active' => '0'], ['id' => $user_id]);
						if($status){
							//============Email================//
							$email = new Email();
			        		$email->transport('gmail');
			        		$email->template('csforgotpassword','cs-email');
			        		$subject = "Reset Your http://chennaismile.com/ Password";
						    $to = trim($this->request->data['email']);
						    $email->emailFormat('html');
						    $email->from('admin@chennaismile.com');
						    $email->to($to);
						    $email->cc('admin@chennaismile.com');
						    $email->subject($subject);
							$email->viewVars(['url' => $url]);
						    $email->send();

			                $this->Flash->success(__('Email has been sent to reset your password'));
			                return $this->redirect(['controller' => 'events','action' => 'index']);
							//============EndEmail=============//
						}
						else{
							$this->Flash->success(__("Error Generating Reset link"));
						}
					}
					else
					{
						$this->Flash->success(__('This Account is not Active yet.Check Your mail to activate it'));
					}
				}
				else
				{
					$this->Flash->success(__('Email does Not Exist'));
				}
			}
		}
	}

	function reset($token=null)
	{
		$this->viewBuilder()->layout('signin');

		if(!empty($token)){
			$u=$this->Users->find('all',array('conditions'=>array('activation_key'=>$token)));
			$u = $u->first();
			$user = $this->Users->newEntity();
			if($u){
				$user_id=$u['id'];
				if(!empty($this->request->data['password'])){
					$activation_key = Text::uuid();
					$u['activation_key'] = $activation_key;
					$u['password'] = $this->request->data['password'];
					$u['Active'] = '1';
					$user = $u;
					$user = $this->Users->patchEntity($user, $this->request->data);
					if($this->Users->save($user))
					{
						$this->Flash->success(__('Password changed successfully'));
						$this->redirect(array('controller'=>'events','action'=>'index'));
					}
				}
			}
			else
			{
				$this->Flash->success(__('Token Corrupted,,Please Retry.the reset link work only for once.'));
			}
		}
 		else
		{
			$this->redirect('/');
		}
	}

	function changepassword($token=null)
	{
		if ($this->request->is('post'))
		{

			$user = $this->Users->get($this->request->data['user_id']);
			if(!empty($this->request->data['password'])){
				$user = $this->Users->patchEntity($user, $this->request->data);
				if($this->Users->save($user))
				{
					$this->Flash->success(__('Password Has been Updated'));
					$this->redirect(array('controller'=>'users','action'=>'login'));
				}
			}
			else
			{
				$this->Flash->success(__('Token Corrupted,,Please Retry.the reset link work only for once.'));
			}
		}
 		else
		{
			$this->redirect('/');
		}
	}

	public function isemailexist()
    {
    	$conn = ConnectionManager::get('default');
    	$request = $this->request->data;
    	$email = $request['email'];
    	$response = "";

    	$query = "SELECT id From users WHERE 1 AND email = '".$email."'";
        $stmt = $conn->execute($query);
        $results = $stmt->fetchAll();

    	if(empty($results)){
    		$response['code'] = true;
    	}
    	else {
    		$response['code'] = false;
    	}
		echo json_encode($response);
    	exit;
    }

    public function adminadd()
    {
    	$activation_key = Text::uuid();
        $this->viewBuilder()->layout('admin_login');
        $user = $this->Users->newEntity();
        if ($this->request->is('post')) {
            //$this->request->data['activation_key'] = $activation_key = String::uuid();
            //$this->request->data['group_id'] = 4;
            $this->request->data['activation_key'] = $activation_key;
            $this->request->data['Active'] = '0';
            $user = $this->Users->patchEntity($user, $this->request->data);

            $this->loadModel('UserProfile');
            $userProfile = $this->UserProfile->newEntity();

            if ($this->Users->save($user)) {
                $email = new Email();
                $email->transport('gmail');
                $email->template('adminsignupinfo','cs-email');
                $subject = "New Signup in Adminpanel";
                $email->emailFormat('html');
                $email->from('admin@chennaismile.com');
                $email->to('roslin.albert@gmail.com');
                //$to = $userData['email'];
                //$email->to($to);
                $email->subject($subject);
                // $activationUrl = Router::url(['controller' => 'events', 'action' => 'activate/' . $new_id, '_full' => true ]);
                //$email->viewVars(['name' => $userData['fullname']]);
                $email->send();
                $this->Flash->success(__('The User has been saved, kindly wait for an activate from the admin.'));

               // $this->Flash->success(__('The user has been saved!..'));
                return $this->redirect(['action' => 'adminlogin']);

            } else {
                $this->Flash->error(__('The user could not be saved. Please, try again.'));
            }
        }
        $groups = $this->Users->Groups->find('list', ['limit' => 200,'conditions' => array('role' => 'Admin')]);
        $this->set(compact('user', 'groups'));
        $this->set('_serialize', ['user']);
    }
  /**
     * Activate method
     *
     * @param string|null $id Banner id.
     * @return \Cake\Network\Response|void Redirects on successful edit, renders view otherwise.
     * @throws \Cake\Network\Exception\NotFoundException When record not found.
     */
    public function activateindividual($id = null)
    {

        $this->request->allowMethod(['post', 'activate']);
         $user = $this->Users->get($id, [
            'contain' => []
        ]);
       // $users = $this->Users->get($id);
        if ($this->Users->updateAll(['active' => '1'], ['id' => $id])) {
            //Send eamil to user
                    $email = new Email();
                    $email->transport('gmail');
                // Always try to write clean code, so that you can read it :) :
                     $email->template('useractivated','cs-email');
                        $name = $user['fullname'];
                        $users_email = $user['email'];
                        $email->emailFormat('html');
                        $email->from('admin@chennaismile.com');
                        $email->to($users_email);
                        $email->cc('admin@chennaismile.com');
                        $activationUrl = Router::url(['controller' => 'Users', 'action' => 'adminlogin', '_full' => true ]);
                        $email->viewVars(['name' => $name, 'URL' => $activationUrl]);
                        $subject = "User Activated";
                        $email->subject($subject);
                        $email->send();
                        $this->Flash->success(__('The User has been Activated.'));
                    }
                    else
                    {
                        $this->Flash->error(__('The User could not be Activated. Please, try again.'));
                    }
        //     $this->Flash->success(__('The User has been Activated.'));
        // } else {
        //     $this->Flash->error(__('The User could not be Activated. Please, try again.'));
        // }
        return $this->redirect(['action' => 'index']);

}
    /**
     * Deactivate method
     *
     * @param string|null $id Banner id.
     * @return \Cake\Network\Response|void Redirects on successful edit, renders view otherwise.
     * @throws \Cake\Network\Exception\NotFoundException When record not found.
     */
    public function deactivateindividual($id = null)
    {

        $this->request->allowMethod(['post', 'deactivate']);
        $user = $this->Users->get($id);
        if ($this->Users->updateAll(['active' => '2'], ['id' => $id])) {
            $this->Flash->success(__('The User has been Dectivated.'));
        } else {
            $this->Flash->error(__('The User could not be Deactivated. Please, try again.'));
        }

        return $this->redirect(['action' => 'index']);

    }

}


text:
import * as R from 'ramda'
import NEW_ORDER from './new_order'

export default R.merge(NEW_ORDER, {
  bill_address: null,
  ship_address: null,
  line_items: [],
  payments: [],
  shipments: [],
  adjustments: [],
  credit_cards: [],
  permissions: { can_update: true }
})


text:
#import <DVTFoundation/DVTTeamOperationBase.h>

@interface DVTListDevicesOperation : DVTTeamOperationBase
{
}

+ (id)_operationWithSingleTeamToken:(id)arg1 andPlatform:(id)arg2;

@end