An admin action for marking several cages as inactive.
		
        This action sets the selected cages as Active=False and Death=today.
        This admin action also shows as the output the number of mice sacrificed.
964630
def mark_deactivated(self,request,queryset):
        """"""
        rows_updated = queryset.update(Active=False, End=datetime.date.today() )
        if rows_updated == 1:
            message_bit = "1 cage was"
        else:
            message_bit = "%s cages were" % rows_updated
        self.message_user(request, "%s successfully marked as deactivated." % message_bit)
47764
public void setActiveEditor(IAction action, IEditorPart targetEditor)
	{
		if (targetEditor instanceof VdmEditor)
		{
			setEditor((VdmEditor) targetEditor);
		} else
		{
			setEditor(null);
		}
	}
266783
def active_inactive(self):
        """"""
        active_indices = []
        inactive_indices = []
        for index, active in enumerate(self.active):
            if active:
                active_indices.append(index)
            else:
                inactive_indices.append(index)
        return active_indices, inactive_indices
10126
public function isAdminActive(AdminInterface $admin, $adminCode = '')
    {
        $active = false;
        if ($adminCode == $admin->getCode()) {
            $active = true;
        }

        if (method_exists($admin, 'getSubNavLinks')) {
            foreach ($admin->getSubNavLinks() as $value) {
                if ($value instanceof AdminInterface) {
                    if ($value->getCode() == $adminCode) {
                        $active = true;
                    }
                }
            }
        }

        return $active;
    }
1137251
@Override
    public void isLeader() {
        LOG.warn("Server instance with server id {} is elected as leader", serverId);
        serviceState.becomingActive();
        try {
            for (ActiveStateChangeHandler handler : activeStateChangeHandlers) {
                handler.instanceIsActive();
            }
            activeInstanceState.update(serverId);
            serviceState.setActive();
        } catch (Exception e) {
            LOG.error("Got exception while activating", e);
            notLeader();
            rejoinElection();
        }
    }
445363
protected function addActions ()
    {
        add_action(Hooks::ADMIN_MENU, array($this, 'addPage'));
        if ($this->currentlyOnPage()) {
            add_action(Hooks::ADMIN_INIT, [$this, 'adminInit']);
        }
    }
742193
public boolean tryMarkSlotActive(JobID jobId, AllocationID allocationId) {
		TaskSlot taskSlot = getTaskSlot(allocationId);

		if (taskSlot != null && taskSlot.isAllocated(jobId, allocationId)) {
			return taskSlot.markActive();
		} else {
			return false;
		}
	}
1315026
def MGMT_ACTIVE_SET(self, sAddr='', xCommissioningSessionId=None, listActiveTimestamp=None, listChannelMask=None, xExtendedPanId=None,
                        sNetworkName=None, sPSKc=None, listSecurityPolicy=None, xChannel=None, sMeshLocalPrefix=None, xMasterKey=None,
                        xPanId=None, xTmfPort=None, xSteeringData=None, xBorderRouterLocator=None, BogusTLV=None, xDelayTimer=None):
        
        print '%s call MGMT_ACTIVE_SET' % self.port
        try:
            cmd = 'dataset mgmtsetcommand active'

            if listActiveTimestamp != None:
                cmd += ' activetimestamp '
                cmd += str(listActiveTimestamp[0])

            if xExtendedPanId != None:
                cmd += ' extpanid '
                xpanid = self.__convertLongToString(xExtendedPanId)

                if len(xpanid) < 16:
                    xpanid = xpanid.zfill(16)

                cmd += xpanid

            if sNetworkName != None:
                cmd += ' networkname '
                cmd += str(sNetworkName)

            if xChannel != None:
                cmd += ' channel '
                cmd += str(xChannel)

            if sMeshLocalPrefix != None:
                cmd += ' localprefix '
                cmd += str(sMeshLocalPrefix)

            if xMasterKey != None:
                cmd += ' masterkey '
                key = self.__convertLongToString(xMasterKey)

                if len(key) < 32:
                    key = key.zfill(32)

                cmd += key

            if xPanId != None:
                cmd += ' panid '
                cmd += str(xPanId)

            if listChannelMask != None:
                cmd += ' channelmask '
                cmd += '0x' + self.__convertLongToString(self.__convertChannelMask(listChannelMask))

            if sPSKc != None or listSecurityPolicy != None or \
               xCommissioningSessionId != None or xTmfPort != None or xSteeringData != None or xBorderRouterLocator != None or \
               BogusTLV != None:
                cmd += ' binary '

            if sPSKc != None:
                cmd += '0410'
                stretchedPskc = Thread_PBKDF2.get(sPSKc,ModuleHelper.Default_XpanId,ModuleHelper.Default_NwkName)
                pskc = hex(stretchedPskc).rstrip('L').lstrip('0x')

                if len(pskc) < 32:
                    pskc = pskc.zfill(32)

                cmd += pskc

            if listSecurityPolicy != None:
                cmd += '0c03'

                rotationTime = 0
                policyBits = 0

                # previous passing way listSecurityPolicy=[True, True, 3600, False, False, True]
                if (len(listSecurityPolicy) == 6):
                    rotationTime = listSecurityPolicy[2]

                    # the last three reserved bits must be 1
                    policyBits = 0b00000111

                    if listSecurityPolicy[0]:
                        policyBits = policyBits | 0b10000000
                    if listSecurityPolicy[1]:
                        policyBits = policyBits | 0b01000000
                    if listSecurityPolicy[3]:
                        policyBits = policyBits | 0b00100000
                    if listSecurityPolicy[4]:
                        policyBits = policyBits | 0b00010000
                    if listSecurityPolicy[5]:
                        policyBits = policyBits | 0b00001000
                else:
                    # new passing way listSecurityPolicy=[3600, 0b11001111]
                    rotationTime = listSecurityPolicy[0]
                    policyBits = listSecurityPolicy[1]

                policy = str(hex(rotationTime))[2:]

                if len(policy) < 4:
                    policy = policy.zfill(4)

                cmd += policy

                cmd += str(hex(policyBits))[2:]

            if xCommissioningSessionId != None:
                cmd += '0b02'
                sessionid = str(hex(xCommissioningSessionId))[2:]

                if len(sessionid) < 4:
                    sessionid = sessionid.zfill(4)

                cmd += sessionid

            if xBorderRouterLocator != None:
                cmd += '0902'
                locator = str(hex(xBorderRouterLocator))[2:]

                if len(locator) < 4:
                    locator = locator.zfill(4)

                cmd += locator

            if xSteeringData != None:
                steeringData = self.__convertLongToString(xSteeringData)
                cmd += '08' + str(len(steeringData)/2).zfill(2)
                cmd += steeringData

            if BogusTLV != None:
                cmd += "8202aa55"

            print cmd

            return self.__sendCommand(cmd)[0] == 'Done'

        except Exception, e:
            ModuleHelper.WriteIntoDebugLogger("MGMT_ACTIVE_SET() Error: " + str(e))
178747
def select_action(self, **kwargs):
        
        setattr(self.inner_policy, self.attr, self.get_current_value())
        return self.inner_policy.select_action(**kwargs)
995126
protected function checkInactive()
    {
        if ($this->user->status_id !== Status::INACTIVE) {
            return true;
        }

        return $this->addAction('Activate', 'check-square-o', $this->makeRoute('activate', 0));
    }
97763
def actions(self):
        
        actions = []
        do = actions.append

        # determine the number of colors
        colors = self.colors

        # rows and colors
        movements = (
            MoveCarriageToTheRight(KnitCarriage()),
            MoveCarriageToTheLeft(KnitCarriage()))
        rows = self._rows
        first_needles = self._get_row_needles(0)

        # handle switches
        if len(colors) == 1:
            actions.extend([
                SwitchOffMachine(),
                SwitchCarriageToModeNl()])
        else:
            actions.extend([
                SwitchCarriageToModeKc(),
                SwitchOnMachine()])

        # move needles
        do(MoveNeedlesIntoPosition("B", first_needles))
        do(MoveCarriageOverLeftHallSensor())

        # use colors
        if len(colors) == 1:
            do(PutColorInNutA(colors[0]))
        if len(colors) == 2:
            do(PutColorInNutA(colors[0]))
            do(PutColorInNutB(colors[1]))

        # knit
        for index, row in enumerate(rows):
            do(movements[index & 1])
        return actions
453817
def setActiveState(self, active):
        
        st = DISABLED
        if active: st = NORMAL
        self.entry.configure(state=st)
        self.inputLabel.configure(state=st)
        self.promptLabel.configure(state=st)
566714
public function adminEnqueue()
    {
        wp_enqueue_script('mod-latest-taxonomy', MODULARITY_URL . '/dist/js/Posts/assets/mod-posts-taxonomy.js',
            array(), '1.0.0', true);

        add_action('admin_head', function () {
            global $post;
            global $archive;

            $id = isset($post->ID) ? $post->ID : "'" . $archive . "'";
            if (empty($id)) {
                return;
            }

            echo '<script>var modularity_current_post_id = ' . $id . ';</script>';
        });
    }
128182
@Override
  public void doAsActiveServer() {
    try {
      LOG.info("As active master, init timestamp from ZooKeeper");
      chronosImplement.initTimestamp();
    } catch (Exception e) {
      LOG.fatal("Exception to init timestamp from ZooKeeper, exit immediately");
      System.exit(0);
    }
    
    chronosServerWatcher.setBeenActiveMaster(true);

    LOG.info("Start to accept thrift request");
    startThriftServer();
  }
1089153
def set_active(self, active):
        """"""
        url = CONST.AUTOMATION_EDIT_URL
        url = url.replace(
            '$AUTOMATIONID$', self.automation_id)

        self._automation['is_active'] = str(int(active))

        response = self._abode.send_request(
            method="put", url=url, data=self._automation)

        response_object = json.loads(response.text)

        if isinstance(response_object, (tuple, list)):
            response_object = response_object[0]

        if (str(response_object['id']) != str(self._automation['id']) or
                response_object['is_active'] != self._automation['is_active']):
            raise AbodeException((ERROR.INVALID_AUTOMATION_EDIT_RESPONSE))

        self.update(response_object)

        return True
889349
def active(display_progress=False):
    '''
    
    '''
    ret = {}
    client = salt.client.get_local_client(__opts__['conf_file'])
    try:
        active_ = client.cmd('*', 'saltutil.running', timeout=__opts__['timeout'])
    except SaltClientError as client_error:
        print(client_error)
        return ret

    if display_progress:
        __jid_event__.fire_event({
            'message': 'Attempting to contact minions: {0}'.format(list(active_.keys()))
            }, 'progress')
    for minion, data in six.iteritems(active_):
        if display_progress:
            __jid_event__.fire_event({'message': 'Received reply from minion {0}'.format(minion)}, 'progress')
        if not isinstance(data, list):
            continue
        for job in data:
            if not job['jid'] in ret:
                ret[job['jid']] = _format_jid_instance(job['jid'], job)
                ret[job['jid']].update({'Running': [{minion: job.get('pid', None)}], 'Returned': []})
            else:
                ret[job['jid']]['Running'].append({minion: job['pid']})

    mminion = salt.minion.MasterMinion(__opts__)
    for jid in ret:
        returner = _get_returner((__opts__['ext_job_cache'], __opts__['master_job_cache']))
        data = mminion.returners['{0}.get_jid'.format(returner)](jid)
        if data:
            for minion in data:
                if minion not in ret[jid]['Returned']:
                    ret[jid]['Returned'].append(minion)

    return ret
689946
public function actionAdmin()
	{
		$model=new Post('search');
		if(isset($_GET['Post']))
			$model->attributes=$_GET['Post'];
		$this->render('admin',array(
			'model'=>$model,
		));
	}