text
stringlengths
1
1.05M
<reponame>hemtjanst/hemtjanst package messaging import ( "time" mq "github.com/eclipse/paho.mqtt.golang" ) // TestingMessenger is a no-op messenger useful for when running tests type TestingMessenger struct { client mq.Client Action string Topic []string Message []byte Qos int Persist bool Callback func(Message) } func NewTestingMessenger(client mq.Client) PublishSubscriber { return &TestingMessenger{client: client} } func (tm *TestingMessenger) Publish(topic string, message []byte, qos int, persist bool) { tm.Action = "publish" tm.Topic = []string{topic} tm.Message = message tm.Qos = qos tm.Persist = persist } func (tm *TestingMessenger) Subscribe(topic string, qos int, callback func(Message)) { tm.Action = "subscribe" tm.Topic = []string{topic} tm.Qos = qos tm.Callback = callback } func (tm *TestingMessenger) Unsubscribe(topics ...string) { tm.Action = "unsubscribe" tm.Topic = topics } // TestingMQTTToken can be used in place of an mq.Token. It is meant to be // used in tests type TestingMQTTToken struct { mq.Token } func (t *TestingMQTTToken) Wait() bool { return true } func (t *TestingMQTTToken) WaitTimeout(time.Duration) bool { return true } func (t *TestingMQTTToken) Error() error { return nil } type TestingMQTTClient struct { ConnectionState bool } // TestingMQTTClient can be used in place of an mq.Client. It is meant to be // used in tests func (m *TestingMQTTClient) IsConnected() bool { return m.ConnectionState } func (m *TestingMQTTClient) IsConnectionOpen() bool { return m.ConnectionState } func (m *TestingMQTTClient) Connect() mq.Token { m.ConnectionState = true return &TestingMQTTToken{} } func (m *TestingMQTTClient) Disconnect(uint) { m.ConnectionState = false } func (m *TestingMQTTClient) Publish(topic string, qos byte, retained bool, payload interface{}) mq.Token { return &TestingMQTTToken{} } func (m *TestingMQTTClient) Subscribe(topic string, qos byte, callback mq.MessageHandler) mq.Token { return &TestingMQTTToken{} } func (m *TestingMQTTClient) SubscribeMultiple(filters map[string]byte, callback mq.MessageHandler) mq.Token { return &TestingMQTTToken{} } func (m *TestingMQTTClient) Unsubscribe(topics ...string) mq.Token { return &TestingMQTTToken{} } func (m *TestingMQTTClient) AddRoute(topic string, callback mq.MessageHandler) {} func (m *TestingMQTTClient) OptionsReader() mq.ClientOptionsReader { return mq.ClientOptionsReader{} }
<gh_stars>1-10 from hashkernel.bakery import Cake, CakeRole from hashstore.bakery.lite.node import ( User, Permission, UserType, Portal, PortalHistory, VolatileTree) from sqlalchemy import or_, and_ def find_normal_user(glue_sess, user_or_email): if isinstance(user_or_email, str) and '@' in user_or_email: condition = User.email == user_or_email else: condition = User.id == Cake.ensure_it(user_or_email) return glue_sess.query(User).filter( condition, User.user_type == UserType.normal).one() def find_permissions(glue_sess, user, *acls): condition = Permission.user == user n_acls = len(acls) if n_acls > 0: from_acls = [acl.condition() for acl in acls] if n_acls == 1: condition = and_( condition, from_acls[0]) else: condition = and_( condition, or_(*from_acls)) return glue_sess.query(Permission).filter(condition).all() def resolve_cake_stack(session_factory, cake): cake_stack = [] while True: cake_loop = cake in cake_stack cake_stack.append(cake) if cake.is_immutable(): return cake_stack if cake_loop or len(cake_stack) > 10: raise AssertionError('cake loop? %r' % cake_stack) session = session_factory(cake) cake = session.query(Portal).filter(Portal.id == cake)\ .one().latest def ensure_vtree_path(session, cake_path, asof_dt, user): if cake_path is None: return parent = cake_path.parent() VT = VolatileTree parent_path = '' if parent is None else parent.path_join() path = cake_path.path_join() entry = session.query(VT) \ .filter( VT.portal_id == cake_path.root, VT.path == path, VT.end_dt == None ).one_or_none() add = entry is None if not(add) and entry.cake is not None: raise AssertionError( 'cannot overwrite %s with %s' % (CakeRole.SYNAPSE, CakeRole.NEURON)) if add: session.add(VT( portal_id=cake_path.root, path=path, parent_path=parent_path, start_by=user.id, cake=None, start_dt=asof_dt, end_dt=None )) ensure_vtree_path(session, parent, asof_dt, user) def edit_portal(glue_sess, portal, by): glue_sess.merge(portal) if portal.latest is not None: glue_sess.add(PortalHistory(portal_id=portal.id, cake=portal.latest, by=by.id)) def query_users_by_type(glue_session, user_type): return glue_session.query(User).filter( User.user_type == user_type) PERM_SORT = lambda r: (r.permission_type.name, str(r.cake))
import React from 'react'; import { Link } from 'react-router-dom'; const MainBanner = () => { return ( <div className="repair-main-banner"> <div className="container"> <div className="row align-items-center"> <div className="col-lg-6"> <div className="repair-banner-content"> <h1>Your Local Computer Repair Experts!</h1> <p> There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don't look even slightly believable. </p> <Link to="/contact"> <a className="btn btn-primary">Get Started</a> </Link> </div> </div> <div className="col-lg-6"> <div className="repair-banner-image"> <img src="/images/repair-banner-image/repair-banner-img.png" alt="image" /> <img src="/images/repair-banner-image/repair-shape1.png" className="animate__animated animate__zoomIn animate__delay-0.6s" alt="image" /> <img src="/images/repair-banner-image/repair-shape2.png" className="animate__animated animate__fadeInLeft animate__delay-0.6s" alt="image" /> <img src="/images/repair-banner-image/repair-shape-circle.png" className="rotateme" alt="image" /> </div> </div> </div> </div> </div> ); }; export default MainBanner;
#!/bin/bash set -ex IMG=${IMG:-kylemanna/openvpn} temp=$(mktemp -d) pushd $temp SERV_IP=$(ip -4 -o addr show scope global | awk '{print $4}' | sed -e 's:/.*::' | head -n1) docker run --net=none --rm -t -i -v $PWD:/etc/openvpn $IMG ovpn_genconfig -u udp://$SERV_IP docker run --net=none --rm -t -i -v $PWD:/etc/openvpn -e "EASYRSA_BATCH=1" -e "EASYRSA_REQ_CN=Travis-CI Test CA" kylemanna/openvpn ovpn_initpki nopass docker run --net=none --rm -t -i -v $PWD:/etc/openvpn $IMG ovpn_copy_server_files popd # Can't delete the temp directory as docker creates some files as root. # Just let it die with the test instance. rm -rf $temp || true
<reponame>yangc0921/ATS-based_RSA_Algorithm_ElasticOpticalNetwork_EON package eon.spectrum; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import eon.general.Constant; import eon.general.Modulation; import eon.general.RouteType; import eon.graph.RouteSearching; import eon.graph.SearchConstraint; import eon.network.Layer; import eon.network.Link; import eon.network.Node; import eon.network.Route; /** * @author vxFury * */ public class RoutingAndSpectrumAllocation { public Route RoutingAndSpectrumAllocating_FirstFit(Layer layer ,ArrayList<SlotWindow> swpList, Request request,SearchConstraint constraint, int hoplimit, Modulation modulation,RouteType routeType) { Route newroute = null; loop: for (SlotWindow currentSWP : swpList) { int startindex = currentSWP.getStartIndex(); int endindex = currentSWP.getEndIndex(); if(currentSWP.getUnshareableRouteList().size() > 0) { for (Route route : currentSWP.getUnshareableRouteList()) { for (Link link : route.getLinkList()) { if (!currentSWP.getExcludedLinkList().contains(link)) { currentSWP.getExcludedLinkList().add(link); } } } } newroute = new Route(layer,"", 0, ""); Node srcnode = request.getNodePair().getSrcNode(); Node desnode = request.getNodePair().getDesNode(); SearchConstraint pathconstraint = new SearchConstraint(layer); pathconstraint.addAllLinks(currentSWP.getExcludedLinkList()); if(constraint != null) { // 3.exclude link(s) and node(s) included in the constraint if(constraint.__getExcludedLinkList().size() != 0) { for(Link link : constraint.__getExcludedLinkList()) { if(!pathconstraint.containsLink(link)) { pathconstraint.addLink(link); } } } if(constraint.getExcludedNodeList().size() != 0) { for(Node node : constraint.getExcludedNodeList()) { if(!pathconstraint.getExcludedNodeList().contains(node)) { pathconstraint.getExcludedNodeList().add(node); } } } } RouteSearching routesearch = new RouteSearching(); routesearch.Dijkstras(srcnode, desnode, layer, newroute, pathconstraint); if(newroute.getLinkList().size() != 0) { newroute.setRouteType(routeType); newroute.setStartIndex(startindex); newroute.setSlots(endindex + 1 - startindex); newroute.setModulation(modulation); if(hoplimit <= 0) { if (newroute.getLength() < modulation.getTransDistance()) { break loop; } } else { if(newroute.getLinkList().size() <= hoplimit) { if (newroute.getLength() < modulation.getTransDistance()) { break loop; } } } newroute = null; } else { newroute = null; } } return newroute; } public Route RoutingAndSpectrumAllocating(Layer layer, Request request, RouteType routeType, Modulation modulation, SearchConstraint constraint) { Route newroute = new Route(layer,"", 0, "", routeType); Node srcNode = request.getNodePair().getSrcNode(); int slots = (int) Math.ceil(request.getRequiredRate()/modulation.getCapacity()); ArrayList<Integer> resourceListForSWP = new ArrayList<Integer>(); int size = (Constant.TotalSlotsNum >>> 5) + (((Constant.TotalSlotsNum & 0x1F) == 0) ? (0) : (1)); for(int i = 0;i < size; i ++) { Integer resource = 0x0; for(Node adjNode : srcNode.getAdjacentNodeList()) { Link link = layer.findLink(srcNode, adjNode); if(!constraint.containsLink(link)) { resource |= link.getResourceList().get(i); } } resourceListForSWP.add(i,resource); } ArrayList<AdaptiveSlotSection> atsList = getAdaptiveSlotSections(resourceListForSWP,slots); Collections.sort(atsList,new sortBySlots()); if(atsList.size() > 0) { ArrayList<SlotWindow> swpList = new ArrayList<SlotWindow>(); for(AdaptiveSlotSection ads : atsList) { SlotWindow sw = new SlotWindow("",atsList.size(),"",0,0); if(ads.getSlots() > slots) { for(int sI = ads.getStartIndex(); sI < ads.getStartIndex() + ads.getSlots() - slots + 1; sI ++) { sw.setStartIndex(sI); sw.setEndIndex(sI + slots - 1); swpList.add(sw); } } else { sw.setStartIndex(ads.getStartIndex()); sw.setEndIndex(ads.getStartIndex() + ads.getSlots() - 1); swpList.add(sw); } } newroute = RoutingAndSpectrumAllocating_FirstFit(layer, swpList, request, constraint, size, modulation, routeType); } else { newroute = null; } if(newroute.getLinkList().size() == 0) { newroute = null; } return newroute; } public int SpectrumAllocating_MinimalDiff(Request request,Route route) { int rst = -1; int slots = (int) Math.ceil(route.getRate()/route.getModulation().getCapacity()); route.setSlots(slots); ArrayList<AdaptiveSlotSection> atsList = getAvailableAdaptiveSlotSectionStrips(route,slots); Collections.sort(atsList,new sortBySlots()); if(atsList.size() > 0) { rst = 0; route.setStartIndex(atsList.get(0).getStartIndex()); } return rst; } public int SpectrumAllocating_AdvancedMinDiff(Request request,Route route, int minFragmentSize) { int rst = -1; int slots = (int) Math.ceil(route.getRate()/route.getModulation().getCapacity()); route.setSlots(slots); ArrayList<AdaptiveSlotSection> atsList = getAvailableAdaptiveSlotSectionStrips(route,slots); Collections.sort(atsList,new sortBySlots()); if(atsList.size() > 0) { rst = 0; for(AdaptiveSlotSection ss : atsList) { if(Math.abs(ss.getSlots() - slots) >= minFragmentSize) { route.setStartIndex(ss.getStartIndex()); break; } else { rst = -1; } } if(rst == -1) { rst = 0; route.setStartIndex(atsList.get(0).getStartIndex()); } } return rst; } public ArrayList<AdaptiveSlotSection> getAvailableAdaptiveSlotSectionStrips(Route route,int minimalSlots) { ArrayList<Integer> availableResourceList = new ArrayList<Integer>(); if(minimalSlots <= 0) { minimalSlots = 1; } int size = (Constant.TotalSlotsNum >>> 5) + (((Constant.TotalSlotsNum & 0x1F) == 0) ? (0) : (1)); for(int i = 0;i < size; i ++) { Integer commonResource = 0xFFFFFFFF; for(Link link : route.getLinkList()) { commonResource &= link.getResourceList().get(i); } availableResourceList.add(i,commonResource); } return getAdaptiveSlotSections(availableResourceList, minimalSlots); } // Adaptive Slot-Section(s) public ArrayList<AdaptiveSlotSection> getAdaptiveSlotSections(ArrayList<Integer> resourceList, int minimalSlots) { ArrayList<AdaptiveSlotSection> ats = new ArrayList<AdaptiveSlotSection>(); if(minimalSlots <= 0) { minimalSlots = 1; } int size = resourceList.size(),index = 0; int offset = 0, bits = 0; for(Integer resource : resourceList) { for(int i = 0; i < 32; i ++) { if((resource & 0x1) != 0) { bits ++; } else { if(bits >= minimalSlots) { ats.add(new AdaptiveSlotSection(offset - bits,bits)); } bits = 0; } resource >>>= 1; offset ++; } index ++; if((index == size) && (bits >= minimalSlots)) { ats.add(new AdaptiveSlotSection(offset - bits,bits)); } } return ats; } public static int getBitsFlanked(ArrayList<Integer> resourceList, int index, int range) { int bits = 0; if(range == 0) { return 0; } int min, max; if(range < 0) { min = Math.max(0, index + range); max = index - 1; for(int i = max;i >= min; i --) { int tmpIndex = i >>> 5; int tmpOffset = i & 0x1F; int check = 0x1 << tmpOffset; if((resourceList.get(tmpIndex) & check) != 0x0) { bits ++; } else { break; } } } else { min = index + 1; max = Math.min(Constant.TotalSlotsNum, index + range); for(int i = min;i <= max; i ++) { int tmpIndex = i >>> 5; int tmpOffset = i & 0x1F; int check = 0x1 << tmpOffset; if((resourceList.get(tmpIndex) & check) != 0x0) { bits ++; } else { break; } } } return bits; } } class sortBySlots implements Comparator<Object> { public int compare(Object obj1,Object obj2) { AdaptiveSlotSection ads1 = (AdaptiveSlotSection) obj1; AdaptiveSlotSection ads2 = (AdaptiveSlotSection) obj2; return (ads1.getSlots() - ads2.getSlots()); } }
declare module '@next/bundle-analyzer';
/* * Copyright 2018 HM Revenue & Customs * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package models.output.tc import org.joda.time.LocalDate import play.api.libs.json._ object TCCalculatorOutput { implicit val TCCalculationWrites: Writes[TCCalculatorOutput] = Json.writes[TCCalculatorOutput] } case class TCCalculatorOutput(from: LocalDate, until: LocalDate, totalAwardAmount: BigDecimal = 0.00, houseHoldAdviceAmount: BigDecimal = 0.00, taxYears: List[TaxYear] ) object TaxYear { implicit val TaxYearWrites: Writes[TaxYear] = Json.writes[TaxYear] } case class TaxYear( from: LocalDate, until: LocalDate, taxYearAwardAmount: BigDecimal = BigDecimal(0.00), taxYearAdviceAmount: BigDecimal = BigDecimal(0.00), periods: List[Period] ) object Period { implicit val ElementWrites: Writes[Period] = Json.writes[Period] } case class Period(from: LocalDate, until: LocalDate, periodNetAmount: BigDecimal = 0.00, periodAdviceAmount: BigDecimal = 0.00, elements: Elements) object Elements { implicit val ElementsWrites: Writes[Elements] = Json.writes[Elements] } case class Elements(wtcWorkElement: Element, wtcChildcareElement: Element, ctcIndividualElement: Element, ctcFamilyElement: Element) object Element { implicit val ElementWrites: Writes[Element] = Json.writes[Element] } case class Element(netAmount: BigDecimal = 0.00, maximumAmount: BigDecimal = 0.00, taperAmount: BigDecimal = 0.00)
import AsyncStorage from "@react-native-async-storage/async-storage" import {includes, pull} from "lodash" import {FAVORITE_STORAGE} from "../utils/constants" export async function getPokemonsFavoriteApi(){ try { const response = await AsyncStorage.getItem(FAVORITE_STORAGE) //return JSON.parse(response? response : "[]"); return response ? JSON.parse(response) : [] } catch (error) { throw error } } export async function addPokemonFavoriteApi(id){ try { const favorites = await getPokemonsFavoriteApi() favorites.push(id); await AsyncStorage.setItem(FAVORITE_STORAGE,JSON.stringify(favorites)) } catch (error) { throw error; } } export async function isPokemonFavoriteApi(id){ try { const response= await getPokemonsFavoriteApi() return includes(response,id); } catch (error) { throw error } } export async function removePokemonFavoriteApi(id){ try { const response= await getPokemonsFavoriteApi() const newFavorites = pull(response,id) await AsyncStorage.setItem(FAVORITE_STORAGE,JSON.stringify(newFavorites)) } catch (error) { throw error } }
<gh_stars>0 'use strict'; var directives = angular.module('haoshiyou.directives', []); directives.directive('postItem', function() { return { restrict: "A", templateUrl: 'partials/post_item.html' } });
def base64_encode(string) encoded_string = [string].pack('m') return encoded_string end
/* * Copyright (C) 2017-2017 Alibaba Group Holding Limited */ package action import ( "github.com/cppforlife/bosh-cpi-go/apiv1" "bosh-alicloud-cpi/alicloud" ) type SetDiskMetadataMethod struct { CallContext disks alicloud.DiskManager instances alicloud.InstanceManager } func NewSetDiskMetadataMethod(cc CallContext, disks alicloud.DiskManager, instances alicloud.InstanceManager) SetDiskMetadataMethod { return SetDiskMetadataMethod{cc, disks, instances} } func (a SetDiskMetadataMethod) SetDiskMetadata(diskCID apiv1.DiskCID, meta apiv1.DiskMeta) error { md, err := convertMetaData(meta) if err != nil { return a.WrapErrorf(err, "convert meta %v failed", meta) } diskCid := diskCID.AsString() tags := make(map[string]string) for k, v := range md { if k == "deployment" || k == "director" || k == "index" || k == "instance_group" || k == "job" { tk := normalizeTag(k) if tk != "" { tags[tk] = normalizeTag(v.(string)) } } } err = a.instances.AddTags(diskCid, tags) if err != nil { return a.WrapErrorf(err, "AddTags %v to %s failed", tags, diskCid) } return nil }
#!/bin/bash npm ci --no-cache && \ npm build && \ node server.js
GRPC_ENABLE_FORK_SUPPORT="1" MG_ALPHAS="localhost" IS_RETRY=False IS_LOCAL=False BUCKET_PREFIX='local-grapl' python3 ./src/analyzer-executor.py
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); let aws_keys = { s3: { region: 'us-east-2', accessKeyId: '<KEY>', secretAccessKey: '<KEY>' }, translate: { accessKeyId: '<KEY>', secretAccessKey: '<KEY>', apiVersion: '2017-07-01', region: 'us-east-2' } }; exports.default = aws_keys;
#!/bin/bash command=`basename $0` function usage { echo "" echo "USAGE: $command <bucket>" echo "" } if [ $# -ne 1 ] then usage exit fi bucket=$1 export GOOGLE_APPLICATION_CREDENTIALS=wmt-1f780b38bd7b0384e53292de20.json echo "Running Scala GoogleStorage application for '$bucket' on GCP..." scala target/scala-2.12/gcp-scala-assembly-1.0.jar $bucket
import React from 'react'; interface CrosshairLineProps { x0: number; x1: number; y0: number; y1: number; } export declare const CrosshairLine: React.MemoExoticComponent<({ x0, x1, y0, y1 }: CrosshairLineProps) => JSX.Element>; export {}; //# sourceMappingURL=CrosshairLine.d.ts.map
""" 414. Third Maximum Number https://leetcode.com/problems/third-maximum-number/ Example: Input: nums = [3,2,1] Output: 1 Explanation: The third maximum is 1. Input: nums = [1,2] Output: 2 Explanation: The third maximum does not exist, so the maximum (2) is returned instead. """ # Runtime; 48ms (88.46%) class Solution: def thirdMax(self, nums: List[int]) -> int: distinct_nums = set(nums) if len(distinct_nums) < 3: return sorted(distinct_nums, reverse=True)[0] else: return sorted(distinct_nums, reverse=True)[2]
var KlayRunner = artifacts.require('KlayRunner'); module.exports = function(deployer) { deployer.deploy(KlayRunner, 'KlayRunner', 'KLR', 'unknownhost', 100, 100000000000000000n, 5, { gas: 100000000 }) };
/* global moment:false */ import 'd2l-polymer-siren-behaviors/store/entity-store.js'; import '@brightspace-ui/core/components/button/button-subtle.js'; import { css, html, LitElement } from 'lit-element'; import { findFile, getSubmissionFiles, getSubmissions } from '../helpers/submissionsAndFilesHelpers.js'; import { LocalizeConsistentEvaluation } from '../../lang/localize-consistent-evaluation.js'; import { RtlMixin } from '@brightspace-ui/core/mixins/rtl-mixin.js'; import { selectStyles } from '@brightspace-ui/core/components/inputs/input-select-styles.js'; import { submissions } from '../controllers/constants'; export class ConsistentEvaluationLcbFileContext extends RtlMixin(LocalizeConsistentEvaluation(LitElement)) { static get properties() { return { submissionInfo: { attribute: false, type: Object }, _files: { attribute: false, type: Array }, specialAccessHref: { attribute: 'special-access-href', type: String }, _submissionLateness: { attribute: false, type: Number }, currentFileId: { type: String } }; } static get styles() { return [selectStyles, css` :host { margin-left: 0.7rem; } .d2l-input-select { max-width: 15rem; } :host([dir="rtl"]) { margin-left: 0; margin-right: 0.7rem; } .d2l-truncate { overflow: hidden; overflow-wrap: break-word; text-overflow: ellipsis; white-space: nowrap; } @media (max-width: 930px) { :host { display: none; } } ` ]; } async updated(changedProperties) { super.updated(changedProperties); if (changedProperties.has('submissionInfo')) { this._files = await getSubmissions(this.submissionInfo, this.token); } if ((changedProperties.has('currentFileId') || changedProperties.has('submissionInfo')) && this._files) { const currentFile = findFile(this.currentFileId, this._files); if (currentFile && currentFile.properties) { this._submissionLateness = currentFile.properties.latenessTimespan; } } } _onSelectChange(e) { if (e.target.value === submissions) { this.dispatchEvent(new Event('d2l-consistent-evaluation-evidence-back-to-user-submissions', { composed: true, bubbles: true })); } else { const fileId = e.target.value; this._dispatchFileSelectedEvent(fileId); } } _dispatchFileSelectedEvent(fileId) { this.dispatchEvent(new CustomEvent('d2l-consistent-evaluation-file-selected', { detail: { fileId: fileId }, composed: true, bubbles: true })); } _renderLateButton() { if (!this.currentFileId || !this._submissionLateness) { return html``; } else { return html` <d2l-button-subtle text="${moment.duration(Number(this._submissionLateness), 'seconds').humanize()} ${this.localize('late')}" icon="tier1:access-special" @click="${this._openSpecialAccessDialog}" ></d2l-button-subtle>`; } } _openSpecialAccessDialog() { const specialAccess = this.specialAccessHref; if (!specialAccess) { console.error('Consistent-Eval: Expected special access item dialog URL, but none found'); return; } const location = new D2L.LP.Web.Http.UrlLocation(specialAccess); const buttons = [ { Key: 'save', Text: this.localize('saveBtn'), ResponseType: 1, // D2L.Dialog.ResponseType.Positive IsPrimary: true, IsEnabled: true }, { Text: this.localize('cancelBtn'), ResponseType: 2, // D2L.Dialog.ResponseType.Negative IsPrimary: false, IsEnabled: true } ]; D2L.LP.Web.UI.Legacy.MasterPages.Dialog.Open( /* opener: */ this.shadowRoot.querySelector('d2l-button-subtle'), /* location: */ location, /* srcCallback: */ 'SrcCallback', /* resizeCallback: */ '', /* responseDataKey: */ 'result', /* width: */ 1920, /* height: */ 1080, /* closeText: */ this.localize('closeBtn'), /* buttons: */ buttons, /* forceTriggerOnCancel: */ false ); } _truncateFileName(fileName) { const maxFileLength = 50; if (fileName.length <= maxFileLength) { return fileName; } const ext = fileName.substring(fileName.lastIndexOf('.') + 1, fileName.length); return `${fileName.substring(0, maxFileLength)}…${ext}`; } refreshSelect() { this.shadowRoot.querySelector('select').value = this.currentFileId; } render() { if (!this._files || this._files.length === 0) { return html ``; } return html` <select class="d2l-input-select d2l-truncate" aria-label=${this.localize('userSubmissions')} @change=${this._onSelectChange}> <option label=${this.localize('userSubmissions')} value=${submissions} ?selected=${!this.currentFileId}></option> ${this._files.map(submission => html` <optgroup label=${this.localize('submissionNumber', 'number', submission.submissionNumber)}> ${getSubmissionFiles(submission).map(sf => html` <option value=${sf.properties.id} label=${this._truncateFileName(sf.properties.name)} ?selected=${sf.properties.id === this.currentFileId} class="select-option"></option> `)} </optgroup> `)}; </select> ${this._renderLateButton()} `; } } customElements.define('d2l-consistent-evaluation-lcb-file-context', ConsistentEvaluationLcbFileContext);
<gh_stars>1-10 // Code generated by volcago. DO NOT EDIT. // generated version: (devel) package model const ( LockMeta2IndexLabelTextEqual = "t4" // perfect-match of Text LockMeta2IndexLabelTextLike = "t3" // like-match of Text LockMeta2IndexLabelTextPrefix = "t1" // prefix-match of Text LockMeta2IndexLabelTextSuffix = "t2" // suffix-match of Text LockMeta2IndexLabelFlagPrefix = "f1" // prefix-match of Flag LockMeta2IndexLabelFlagSuffix = "f2" // suffix-match of Flag LockMeta2IndexLabelFlagLike = "f3" // like-match of Flag LockMeta2IndexLabelFlagEqual = "f4" // perfect-match of Flag LockMeta2IndexLabelCreatedAtPrefix = "c1" // prefix-match of CreatedAt LockMeta2IndexLabelCreatedAtSuffix = "c2" // suffix-match of CreatedAt LockMeta2IndexLabelCreatedAtLike = "c3" // like-match of CreatedAt LockMeta2IndexLabelCreatedAtEqual = "c4" // perfect-match of CreatedAt LockMeta2IndexLabelCreatedByEqual = "c8" // perfect-match of CreatedBy LockMeta2IndexLabelCreatedByLike = "c7" // like-match of CreatedBy LockMeta2IndexLabelCreatedByPrefix = "c5" // prefix-match of CreatedBy LockMeta2IndexLabelCreatedBySuffix = "c6" // suffix-match of CreatedBy LockMeta2IndexLabelUpdatedAtPrefix = "u1" // prefix-match of UpdatedAt LockMeta2IndexLabelUpdatedAtSuffix = "u2" // suffix-match of UpdatedAt LockMeta2IndexLabelUpdatedAtLike = "u3" // like-match of UpdatedAt LockMeta2IndexLabelUpdatedAtEqual = "u4" // perfect-match of UpdatedAt LockMeta2IndexLabelUpdatedByEqual = "u8" // perfect-match of UpdatedBy LockMeta2IndexLabelUpdatedByLike = "u7" // like-match of UpdatedBy LockMeta2IndexLabelUpdatedByPrefix = "u5" // prefix-match of UpdatedBy LockMeta2IndexLabelUpdatedBySuffix = "u6" // suffix-match of UpdatedBy LockMeta2IndexLabelDeletedAtPrefix = "d1" // prefix-match of DeletedAt LockMeta2IndexLabelDeletedAtSuffix = "d2" // suffix-match of DeletedAt LockMeta2IndexLabelDeletedAtLike = "d3" // like-match of DeletedAt LockMeta2IndexLabelDeletedAtEqual = "d4" // perfect-match of DeletedAt LockMeta2IndexLabelDeletedByEqual = "d8" // perfect-match of DeletedBy LockMeta2IndexLabelDeletedByLike = "d7" // like-match of DeletedBy LockMeta2IndexLabelDeletedByPrefix = "d5" // prefix-match of DeletedBy LockMeta2IndexLabelDeletedBySuffix = "d6" // suffix-match of DeletedBy LockMeta2IndexLabelVersionPrefix = "v1" // prefix-match of Version LockMeta2IndexLabelVersionSuffix = "v2" // suffix-match of Version LockMeta2IndexLabelVersionLike = "v3" // like-match of Version LockMeta2IndexLabelVersionEqual = "v4" // perfect-match of Version )
<filename>src/main/scala/codecheck/github/utils/Json4s.scala package codecheck.github.utils import org.json4s._ import org.json4s.jackson.JsonMethods._ object Json4s { implicit val formats = DefaultFormats ++ org.json4s.ext.JodaTimeSerializers.all }
#!/bin/bash os_type() { # use the OS environment variable, then bash env OSTYPE if [[ -n "$OS" ]]; then echo "$OS" elif [[ "$OSTYPE" = "darwin"* ]]; then echo "darwin" else echo "$OSTYPE" fi } target_arch() { # if ARCH environment variable is not provided, use the host architecture echo "${ARCH:-$(arch)}" } distro() { echo "${DISTRO:-""}" } _MAKEOPTS="-j$(nproc)" MAKEOPTS=${MAKEOPTS:-$_MAKEOPTS}
<filename>rm_hw/src/hardware_interface/can_bus.cpp /******************************************************************************* * BSD 3-Clause License * * Copyright (c) 2021, <NAME> * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * * Neither the name of the copyright holder nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *******************************************************************************/ // // Created by qiayuan on 12/28/20. // #include "rm_hw/hardware_interface/can_bus.h" #include <string> #include <ros/ros.h> #include <rm_common/math_utilities.h> namespace rm_hw { float int16ToFloat(unsigned short data) { if (data == 0) return 0; float* fp32; unsigned int f_int32 = ((data & 0x8000) << 16) | (((((data >> 10) & 0x1f) - 0x0f + 0x7f) & 0xff) << 23) | ((data & 0x03FF) << 13); fp32 = (float*)&f_int32; return *fp32; } CanBus::CanBus(const std::string& bus_name, CanDataPtr data_ptr) : data_ptr_(data_ptr), bus_name_(bus_name) { // Initialize device at can_device, false for no loop back. while (!socket_can_.open(bus_name, boost::bind(&CanBus::frameCallback, this, _1)) && ros::ok()) ros::Duration(.5).sleep(); ROS_INFO("Successfully connected to %s.", bus_name.c_str()); // Set up CAN package header rm_frame0_.can_id = 0x200; rm_frame0_.can_dlc = 8; rm_frame1_.can_id = 0x1FF; rm_frame1_.can_dlc = 8; } void CanBus::write() { bool has_write_frame0 = false, has_write_frame1 = false; // safety first std::fill(std::begin(rm_frame0_.data), std::end(rm_frame0_.data), 0); std::fill(std::begin(rm_frame1_.data), std::end(rm_frame1_.data), 0); for (auto& item : *data_ptr_.id2act_data_) { if (item.second.type.find("rm") != std::string::npos) { if (item.second.halted) continue; const ActCoeff& act_coeff = data_ptr_.type2act_coeffs_->find(item.second.type)->second; int id = item.first - 0x201; double cmd = minAbs(act_coeff.effort2act * item.second.exe_effort, act_coeff.max_out); // add max_range to act_data if (-1 < id && id < 4) { rm_frame0_.data[2 * id] = (uint8_t)(static_cast<int16_t>(cmd) >> 8u); rm_frame0_.data[2 * id + 1] = (uint8_t)cmd; has_write_frame0 = true; } else if (3 < id && id < 8) { rm_frame1_.data[2 * (id - 4)] = (uint8_t)(static_cast<int16_t>(cmd) >> 8u); rm_frame1_.data[2 * (id - 4) + 1] = (uint8_t)cmd; has_write_frame1 = true; } } else if (item.second.type.find("cheetah") != std::string::npos) { can_frame frame{}; const ActCoeff& act_coeff = data_ptr_.type2act_coeffs_->find(item.second.type)->second; frame.can_id = item.first; frame.can_dlc = 8; uint16_t q_des = (int)(act_coeff.pos2act * (item.second.cmd_pos - act_coeff.act2pos_offset)); uint16_t qd_des = (int)(act_coeff.vel2act * (item.second.cmd_vel - act_coeff.act2vel_offset)); uint16_t kp = 0.; uint16_t kd = 0.; uint16_t tau = (int)(act_coeff.effort2act * (item.second.exe_effort - act_coeff.act2effort_offset)); // TODO(qiayuan) add position vel and effort hardware interface for MIT Cheetah Motor, now we using it as an effort joint. frame.data[0] = q_des >> 8; frame.data[1] = q_des & 0xFF; frame.data[2] = qd_des >> 4; frame.data[3] = ((qd_des & 0xF) << 4) | (kp >> 8); frame.data[4] = kp & 0xFF; frame.data[5] = kd >> 4; frame.data[6] = ((kd & 0xF) << 4) | (tau >> 8); frame.data[7] = tau & 0xff; socket_can_.write(&frame); } } if (has_write_frame0) socket_can_.write(&rm_frame0_); if (has_write_frame1) socket_can_.write(&rm_frame1_); } void CanBus::read(ros::Time time) { std::lock_guard<std::mutex> guard(mutex_); for (const auto& frame_stamp : read_buffer_) { can_frame frame = frame_stamp.frame; // Check if robomaster motor if (data_ptr_.id2act_data_->find(frame.can_id) != data_ptr_.id2act_data_->end()) { ActData& act_data = data_ptr_.id2act_data_->find(frame.can_id)->second; const ActCoeff& act_coeff = data_ptr_.type2act_coeffs_->find(act_data.type)->second; if (act_data.type.find("rm") != std::string::npos) { act_data.q_raw = (frame.data[0] << 8u) | frame.data[1]; act_data.qd_raw = (frame.data[2] << 8u) | frame.data[3]; int16_t cur = (frame.data[4] << 8u) | frame.data[5]; act_data.temp = frame.data[6]; // TODO: Check the code blew // if (act_data.type.find("6020") != std::string::npos) // if (std::abs(q - act_data.q_last) < 3) // q = act_data.q_last; // Multiple circle if (act_data.seq != 0) { // first receive if (act_data.q_raw - act_data.q_last > 4096) act_data.q_circle--; else if (act_data.q_raw - act_data.q_last < -4096) act_data.q_circle++; } try { // Duration will be out of dual 32-bit range while motor failure act_data.frequency = 1. / (frame_stamp.stamp - act_data.stamp).toSec(); } catch (std::runtime_error& ex) { } act_data.stamp = frame_stamp.stamp; act_data.seq++; act_data.q_last = act_data.q_raw; // Converter raw CAN data to position velocity and effort. act_data.pos = act_coeff.act2pos * static_cast<double>(act_data.q_raw + 8191 * act_data.q_circle) + act_data.offset; act_data.vel = act_coeff.act2vel * static_cast<double>(act_data.qd_raw); act_data.effort = act_coeff.act2effort * static_cast<double>(cur); // Low pass filter act_data.lp_filter->input(act_data.vel); act_data.vel = act_data.lp_filter->output(); continue; } } // Check MIT Cheetah motor else if (frame.can_id == static_cast<unsigned int>(0x000)) { if (data_ptr_.id2act_data_->find(frame.data[0]) != data_ptr_.id2act_data_->end()) { ActData& act_data = data_ptr_.id2act_data_->find(frame.data[0])->second; const ActCoeff& act_coeff = data_ptr_.type2act_coeffs_->find(act_data.type)->second; if (act_data.type.find("cheetah") != std::string::npos) { // MIT Cheetah Motor act_data.q_raw = (frame.data[1] << 8) | frame.data[2]; uint16_t qd = (frame.data[3] << 4) | (frame.data[4] >> 4); uint16_t cur = ((frame.data[4] & 0xF) << 8) | frame.data[5]; // Multiple cycle // NOTE: Raw data range is -4pi~4pi if (act_data.seq != 0) { double pos_new = act_coeff.act2pos * static_cast<double>(act_data.q_raw) + act_coeff.act2pos_offset + static_cast<double>(act_data.q_circle) * 8 * M_PI + act_data.offset; if (pos_new - act_data.pos > 4 * M_PI) act_data.q_circle--; else if (pos_new - act_data.pos < -4 * M_PI) act_data.q_circle++; } try { // Duration will be out of dual 32-bit range while motor failure act_data.frequency = 1. / (frame_stamp.stamp - act_data.stamp).toSec(); } catch (std::runtime_error& ex) { } act_data.stamp = frame_stamp.stamp; act_data.seq++; act_data.pos = act_coeff.act2pos * static_cast<double>(act_data.q_raw) + act_coeff.act2pos_offset + static_cast<double>(act_data.q_circle) * 8 * M_PI + act_data.offset; // Converter raw CAN data to position velocity and effort. act_data.vel = act_coeff.act2vel * static_cast<double>(qd) + act_coeff.act2vel_offset; act_data.effort = act_coeff.act2effort * static_cast<double>(cur) + act_coeff.act2effort_offset; // Low pass filter act_data.lp_filter->input(act_data.vel); act_data.vel = act_data.lp_filter->output(); } } } // Check if IMU float imu_frame_data[4] = { 0 }; bool is_too_big = false; // int16ToFloat failed sometime for (int i = 0; i < 4; ++i) { float value = int16ToFloat((frame.data[i * 2] << 8) | frame.data[i * 2 + 1]); if (value > 1e3 || value < -1e3) is_too_big = true; else imu_frame_data[i] = value; } if (!is_too_big) { // TODO remove this ugly statement for (auto& itr : *data_ptr_.id2imu_data_) { // imu data are consisted of three frames switch (frame.can_id - static_cast<unsigned int>(itr.first)) { case 0: itr.second.linear_acc[0] = imu_frame_data[0] * 9.81; itr.second.linear_acc[1] = imu_frame_data[1] * 9.81; itr.second.linear_acc[2] = imu_frame_data[2] * 9.81; itr.second.angular_vel[0] = imu_frame_data[3] / 360. * 2. * M_PI; continue; case 1: itr.second.angular_vel[1] = imu_frame_data[0] / 360. * 2. * M_PI; itr.second.angular_vel[2] = imu_frame_data[1] / 360. * 2. * M_PI; itr.second.ori[3] = imu_frame_data[2]; // Note the quaternion order itr.second.ori[0] = imu_frame_data[3]; continue; case 2: itr.second.ori[1] = imu_frame_data[0]; itr.second.ori[2] = imu_frame_data[1]; continue; default: break; } } } if (!is_too_big && frame.can_id != 0x0) ROS_ERROR_STREAM_ONCE("Can not find defined device, id: 0x" << std::hex << frame.can_id << " on bus: " << bus_name_); } read_buffer_.clear(); } void CanBus::frameCallback(const can_frame& frame) { std::lock_guard<std::mutex> guard(mutex_); CanFrameStamp can_frame_stamp{ .frame = frame, .stamp = ros::Time::now() }; read_buffer_.push_back(can_frame_stamp); } } // namespace rm_hw
<gh_stars>100-1000 import path from "path"; import * as fs from "fs"; import { Bundler as scssBundler } from "scss-bundle"; import { Bundler as stylusBundler } from "stylus-bundle"; const __dirname = path.dirname(new URL(import.meta.url).pathname); const projectDirectory = path.resolve(__dirname, "./"); const scss = async () => { const bundler = new scssBundler(undefined, projectDirectory); const result = await bundler.bundle("./_typesettings.scss"); fs.writeFileSync("_typesettings.bundle.scss", result.bundledContent, "utf8"); }; const stylus = async () => { const bundler = new stylusBundler(undefined, projectDirectory); const result = await bundler.bundle("./_typesettings.styl"); fs.writeFileSync("_typesettings.bundle.styl", result.bundledContent, "utf8"); }; scss(); stylus();
<gh_stars>1-10 import ElementUI from 'element-ui'; import VTooltip from 'v-tooltip'; import VeeValidate from 'vee-validate'; import Vue from 'vue'; import App from './App'; import router from './router'; import store from './store'; import locale from 'element-ui/lib/locale/lang/zh-TW'; import './sass/app.sass'; import 'bootstrap'; import 'element-ui/lib/theme-chalk/index.css'; import 'handsontable/languages/zh-TW'; import 'vue2-dropzone/dist/vue2Dropzone.min.css'; import 'vue2-timepicker/dist/VueTimepicker.css'; Vue.use(VeeValidate); Vue.use(VTooltip); Vue.use(ElementUI, { locale }); Vue.config.productionTip = false; new Vue({ router, store, render: h => h(App), }).$mount('#app');
/**************************************************************************\ | | Copyright (C) 2009 <NAME> | | This program is free software: you can redistribute it and/or modify | it under the terms of the GNU General Public License as published by | the Free Software Foundation, either version 3 of the License, or | (at your option) any later version. | | This program is distributed in the hope that it will be useful, | but WITHOUT ANY WARRANTY; without even the implied warranty of | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | GNU General Public License for more details. | | You should have received a copy of the GNU General Public License | along with this program. If not, see <http://www.gnu.org/licenses/>. | \**************************************************************************/ #include <stdlib.h> #include "md5detail.hpp" namespace hashclash { #ifndef MD5DETAIL_INLINE_IMPL const uint32 md5_iv[] = { 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476 }; const uint32 md5_ac[] = { 0xd76aa478, 0xe8c7b756, 0x242070db, 0xc1bdceee, 0xf57c0faf, 0x4787c62a, 0xa8304613, 0xfd469501 , 0x698098d8, 0x8b44f7af, 0xffff5bb1, 0x895cd7be, 0x6b901122, 0xfd987193, 0xa679438e, 0x49b40821 , 0xf61e2562, 0xc040b340, 0x265e5a51, 0xe9b6c7aa, 0xd62f105d, 0x2441453 , 0xd8a1e681, 0xe7d3fbc8 , 0x21e1cde6, 0xc33707d6, 0xf4d50d87, 0x455a14ed, 0xa9e3e905, 0xfcefa3f8, 0x676f02d9, 0x8d2a4c8a , 0xfffa3942, 0x8771f681, 0x6d9d6122, 0xfde5380c, 0xa4beea44, 0x4bdecfa9, 0xf6bb4b60, 0xbebfbc70 , 0x289b7ec6, 0xeaa127fa, 0xd4ef3085, 0x4881d05 , 0xd9d4d039, 0xe6db99e5, 0x1fa27cf8, 0xc4ac5665 , 0xf4292244, 0x432aff97, 0xab9423a7, 0xfc93a039, 0x655b59c3, 0x8f0ccc92, 0xffeff47d, 0x85845dd1 , 0x6fa87e4f, 0xfe2ce6e0, 0xa3014314, 0x4e0811a1, 0xf7537e82, 0xbd3af235, 0x2ad7d2bb, 0xeb86d391 }; const unsigned md5_rc[] = { 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22 , 5, 9 , 14, 20, 5, 9 , 14, 20, 5, 9 , 14, 20, 5, 9 , 14, 20 , 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23 , 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21 }; const unsigned md5_wt[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 , 1, 6, 11, 0, 5, 10, 15, 4, 9, 14, 3, 8, 13, 2, 7, 12 , 5, 8, 11, 14, 1, 4, 7, 10, 13, 0, 3, 6, 9, 12, 15, 2 , 0, 7, 14, 5, 12, 3, 10, 1, 8, 15, 6, 13, 4, 11, 2, 9 }; #endif #define HASHCLASH_MD5COMPRESS_STEP(f, a, b, c, d, m, ac, rc) \ a += f(b, c, d) + m + ac; a = rotate_left(a,rc); a += b; void md5compress(uint32 ihv[4], const uint32 block[16]) { uint32 a = ihv[0]; uint32 b = ihv[1]; uint32 c = ihv[2]; uint32 d = ihv[3]; HASHCLASH_MD5COMPRESS_STEP(md5_ff, a, b, c, d, block[ 0], 0xd76aa478, 7); HASHCLASH_MD5COMPRESS_STEP(md5_ff, d, a, b, c, block[ 1], 0xe8c7b756, 12); HASHCLASH_MD5COMPRESS_STEP(md5_ff, c, d, a, b, block[ 2], 0x242070db, 17); HASHCLASH_MD5COMPRESS_STEP(md5_ff, b, c, d, a, block[ 3], 0xc1bdceee, 22); HASHCLASH_MD5COMPRESS_STEP(md5_ff, a, b, c, d, block[ 4], 0xf57c0faf, 7); HASHCLASH_MD5COMPRESS_STEP(md5_ff, d, a, b, c, block[ 5], 0x4787c62a, 12); HASHCLASH_MD5COMPRESS_STEP(md5_ff, c, d, a, b, block[ 6], 0xa8304613, 17); HASHCLASH_MD5COMPRESS_STEP(md5_ff, b, c, d, a, block[ 7], 0xfd469501, 22); HASHCLASH_MD5COMPRESS_STEP(md5_ff, a, b, c, d, block[ 8], 0x698098d8, 7); HASHCLASH_MD5COMPRESS_STEP(md5_ff, d, a, b, c, block[ 9], 0x8b44f7af, 12); HASHCLASH_MD5COMPRESS_STEP(md5_ff, c, d, a, b, block[10], 0xffff5bb1, 17); HASHCLASH_MD5COMPRESS_STEP(md5_ff, b, c, d, a, block[11], 0x895cd7be, 22); HASHCLASH_MD5COMPRESS_STEP(md5_ff, a, b, c, d, block[12], 0x6b901122, 7); HASHCLASH_MD5COMPRESS_STEP(md5_ff, d, a, b, c, block[13], 0xfd987193, 12); HASHCLASH_MD5COMPRESS_STEP(md5_ff, c, d, a, b, block[14], 0xa679438e, 17); HASHCLASH_MD5COMPRESS_STEP(md5_ff, b, c, d, a, block[15], 0x49b40821, 22); HASHCLASH_MD5COMPRESS_STEP(md5_gg, a, b, c, d, block[ 1], 0xf61e2562, 5); HASHCLASH_MD5COMPRESS_STEP(md5_gg, d, a, b, c, block[ 6], 0xc040b340, 9); HASHCLASH_MD5COMPRESS_STEP(md5_gg, c, d, a, b, block[11], 0x265e5a51, 14); HASHCLASH_MD5COMPRESS_STEP(md5_gg, b, c, d, a, block[ 0], 0xe9b6c7aa, 20); HASHCLASH_MD5COMPRESS_STEP(md5_gg, a, b, c, d, block[ 5], 0xd62f105d, 5); HASHCLASH_MD5COMPRESS_STEP(md5_gg, d, a, b, c, block[10], 0x02441453, 9); HASHCLASH_MD5COMPRESS_STEP(md5_gg, c, d, a, b, block[15], 0xd8a1e681, 14); HASHCLASH_MD5COMPRESS_STEP(md5_gg, b, c, d, a, block[ 4], 0xe7d3fbc8, 20); HASHCLASH_MD5COMPRESS_STEP(md5_gg, a, b, c, d, block[ 9], 0x21e1cde6, 5); HASHCLASH_MD5COMPRESS_STEP(md5_gg, d, a, b, c, block[14], 0xc33707d6, 9); HASHCLASH_MD5COMPRESS_STEP(md5_gg, c, d, a, b, block[ 3], 0xf4d50d87, 14); HASHCLASH_MD5COMPRESS_STEP(md5_gg, b, c, d, a, block[ 8], 0x455a14ed, 20); HASHCLASH_MD5COMPRESS_STEP(md5_gg, a, b, c, d, block[13], 0xa9e3e905, 5); HASHCLASH_MD5COMPRESS_STEP(md5_gg, d, a, b, c, block[ 2], 0xfcefa3f8, 9); HASHCLASH_MD5COMPRESS_STEP(md5_gg, c, d, a, b, block[ 7], 0x676f02d9, 14); HASHCLASH_MD5COMPRESS_STEP(md5_gg, b, c, d, a, block[12], 0x8d2a4c8a, 20); HASHCLASH_MD5COMPRESS_STEP(md5_hh, a, b, c, d, block[ 5], 0xfffa3942, 4); HASHCLASH_MD5COMPRESS_STEP(md5_hh, d, a, b, c, block[ 8], 0x8771f681, 11); HASHCLASH_MD5COMPRESS_STEP(md5_hh, c, d, a, b, block[11], 0x6d9d6122, 16); HASHCLASH_MD5COMPRESS_STEP(md5_hh, b, c, d, a, block[14], 0xfde5380c, 23); HASHCLASH_MD5COMPRESS_STEP(md5_hh, a, b, c, d, block[ 1], 0xa4beea44, 4); HASHCLASH_MD5COMPRESS_STEP(md5_hh, d, a, b, c, block[ 4], 0x4bdecfa9, 11); HASHCLASH_MD5COMPRESS_STEP(md5_hh, c, d, a, b, block[ 7], 0xf6bb4b60, 16); HASHCLASH_MD5COMPRESS_STEP(md5_hh, b, c, d, a, block[10], 0xbebfbc70, 23); HASHCLASH_MD5COMPRESS_STEP(md5_hh, a, b, c, d, block[13], 0x289b7ec6, 4); HASHCLASH_MD5COMPRESS_STEP(md5_hh, d, a, b, c, block[ 0], 0xeaa127fa, 11); HASHCLASH_MD5COMPRESS_STEP(md5_hh, c, d, a, b, block[ 3], 0xd4ef3085, 16); HASHCLASH_MD5COMPRESS_STEP(md5_hh, b, c, d, a, block[ 6], 0x04881d05, 23); HASHCLASH_MD5COMPRESS_STEP(md5_hh, a, b, c, d, block[ 9], 0xd9d4d039, 4); HASHCLASH_MD5COMPRESS_STEP(md5_hh, d, a, b, c, block[12], 0xe6db99e5, 11); HASHCLASH_MD5COMPRESS_STEP(md5_hh, c, d, a, b, block[15], 0x1fa27cf8, 16); HASHCLASH_MD5COMPRESS_STEP(md5_hh, b, c, d, a, block[ 2], 0xc4ac5665, 23); HASHCLASH_MD5COMPRESS_STEP(md5_ii, a, b, c, d, block[ 0], 0xf4292244, 6); HASHCLASH_MD5COMPRESS_STEP(md5_ii, d, a, b, c, block[ 7], 0x432aff97, 10); HASHCLASH_MD5COMPRESS_STEP(md5_ii, c, d, a, b, block[14], 0xab9423a7, 15); HASHCLASH_MD5COMPRESS_STEP(md5_ii, b, c, d, a, block[ 5], 0xfc93a039, 21); HASHCLASH_MD5COMPRESS_STEP(md5_ii, a, b, c, d, block[12], 0x655b59c3, 6); HASHCLASH_MD5COMPRESS_STEP(md5_ii, d, a, b, c, block[ 3], 0x8f0ccc92, 10); HASHCLASH_MD5COMPRESS_STEP(md5_ii, c, d, a, b, block[10], 0xffeff47d, 15); HASHCLASH_MD5COMPRESS_STEP(md5_ii, b, c, d, a, block[ 1], 0x85845dd1, 21); HASHCLASH_MD5COMPRESS_STEP(md5_ii, a, b, c, d, block[ 8], 0x6fa87e4f, 6); HASHCLASH_MD5COMPRESS_STEP(md5_ii, d, a, b, c, block[15], 0xfe2ce6e0, 10); HASHCLASH_MD5COMPRESS_STEP(md5_ii, c, d, a, b, block[ 6], 0xa3014314, 15); HASHCLASH_MD5COMPRESS_STEP(md5_ii, b, c, d, a, block[13], 0x4e0811a1, 21); HASHCLASH_MD5COMPRESS_STEP(md5_ii, a, b, c, d, block[ 4], 0xf7537e82, 6); HASHCLASH_MD5COMPRESS_STEP(md5_ii, d, a, b, c, block[11], 0xbd3af235, 10); HASHCLASH_MD5COMPRESS_STEP(md5_ii, c, d, a, b, block[ 2], 0x2ad7d2bb, 15); HASHCLASH_MD5COMPRESS_STEP(md5_ii, b, c, d, a, block[ 9], 0xeb86d391, 21); ihv[0] += a; ihv[1] += b; ihv[2] += c; ihv[3] += d; } } // namespace hashclash
#!/bin/sh # Helper function to add a user add_a_user() { USER=$1 PASSWORD=$2 shift; shift; # Having shifted twice, the rest is now comments ... COMMENTS=$@ echo "Adding user $USER ..." echo useradd -c "$COMMENTS" $USER echo passwd $USER $PASSWORD echo "Added user $USER ($COMMENTS) with pass $PASSWORD" } ### # Main body of script starts here ### echo "Start of script..." add_a_user bob letmein Bob Holness the presenter add_a_user fred badpassword Fred Durst the singer add_a_user bilko worsepassword Sgt. Bilko the role model echo "End of script..."
#!/bin/bash for i in $(seq 1 $NUMBER_OF_WORDS); do # x=$(curl -s https://random-word-api.herokuapp.com/word) # x="$(echo $x | sed 's/"//g' | sed 's/\[//g' | sed 's/\]//g')" WORD=$(curl -s https://random-word-api.herokuapp.com/word | jq -r '.[0]' ) echo Pushing $WORD aws dynamodb put-item --table-name $TABLE_NAME --item "{\"word\": { \"S\": \"$WORD\" } }" --region $AWS_REGION done
<gh_stars>1-10 import axios from "../axios"; interface PackageDependenciesModel { module: string; [key: string]: any; } export function queryPackageDependencies(language: string, systemId: number) { return axios<PackageDependenciesModel[]>({ baseURL: `/api/systems/${systemId}`, url: `/package/dependencies?language=${escape(language)}`, method: "GET" }); }
<filename>optimism2/ovm2/get_contracts/insert_contract_overrides.sql --Add contracts where we know their mapping, but their creator is not deterministic and the contracts are not verified. CREATE SCHEMA IF NOT EXISTS ovm2; CREATE TABLE IF NOT EXISTS ovm2.contract_overrides ( contract_address bytea NOT NULL, project_name text, contract_name text, PRIMARY KEY (contract_address) ); BEGIN; DELETE FROM ovm2.contract_overrides *; COPY ovm2.contract_overrides (contract_address,project_name,contract_name) FROM stdin; \\xc30141B657f4216252dc59Af2e7CdB9D8792e1B0 Socket Socket Registry \. COMMIT; CREATE UNIQUE INDEX CONCURRENTLY IF NOT EXISTS contract_overrides_list_addr_uniq_idx ON ovm2.contract_overrides (contract_address); CREATE UNIQUE INDEX CONCURRENTLY IF NOT EXISTS contract_overrides_list_addr_proj_uniq_idx ON ovm2.contract_overrides (contract_address,project_name); CREATE UNIQUE INDEX CONCURRENTLY IF NOT EXISTS contract_overrides_list_addr_proj_name_uniq_idx ON ovm2.contract_overrides (contract_address,project_name, contract_name);
function selcountry() { var selitem=document.getElementById('selcount').selected(); alert(selitem); }
#!/bin/bash make cuda_lodepng mkdir -p export/ bin/image_modifier_cuda grey examples/example_image1_small.png export/example_image1_small_grey.png bin/image_modifier_cuda blur examples/example_image1_small.png export/example_image1_small_blur.png bin/image_modifier_cuda hsv examples/example_image1_small.png export/example_image1_small_hsv.png
#!/bin/bash # This is a wrapper for a multiversion kafka cluster. # # VERSION=$1 SERVER_IP=$2 function echo_usage { echo "usage:" echo "./start-kafka-cluster.sh {version} [ip]" echo "" echo "example:" echo "./start-kafka-cluster.sh 0.9.0.0 192.168.2.77" echo "./start-kafka-cluster.sh 2.3.0 192.168.2.77" echo "./start-kafka-cluster.sh 2.3.0" exit 99 } which docker || { echo "please install docker. (howto in confluence)" exit 99 } which docker-compose || { echo "please install docker-compose. (howto in confluence)" exit 99 } if [[ -z "${SERVER_IP}" ]]; then SERVER_IP=$(ifconfig| grep 192.168.2 | awk '{print $2}' | cut -d ":" -f2) echo "server ip not provided, assuming ${SERVER_IP}" fi export SERVER_IP if [[ -z "${VERSION}" ]]; then echo_usage; fi if [[ ! "${VERSION}" = "0.9.0.0" ]] && [[ ! "${VERSION}" = "2.3.0" ]];then echo_usage ; fi # version 0.9.0.0 is based on single broker (zoofka) if [[ "${VERSION}" = "0.9.0.0" ]]; then . ${PWD}/zoofka2/start-kafka-broker.sh exit 0 fi # version 2.3.0 is based on docker-compose 3-brokers cluster if [[ "${VERSION}" = "2.3.0" ]]; then FILENAME="docker-compose-2.12-2.3.0.yml" echo "preparing docker-compose with: ${FILENAME}" cp ${FILENAME} docker-compose.yml sleep 3s # run cluster of 3 zookeepers and 3 kafka servers, send all logs to file make up | tee kafka-cluster-logs.log fi ## in another terminal u can filter logs to get single broker logs #. kafka-functions.sh #kafka-logs zoo1_1 #kafka-logs zoo2_1 #kafka-logs zoo2_1 # #kafka-logs kafka1_1 #kafka-logs kafka2_1 #kafka-logs kafka3_1
#!/bin/bash set -o pipefail function finish { sync_unlock.sh } if [ -z "$TRAP" ] then sync_lock.sh || exit -1 trap finish EXIT export TRAP=1 fi > errors.txt > run.log GHA2DB_PROJECT=zephyr PG_DB=zephyr GHA2DB_LOCAL=1 structure 2>>errors.txt | tee -a run.log || exit 1 ./devel/db.sh psql zephyr -c "create extension if not exists pgcrypto" || exit 1 GHA2DB_PROJECT=zephyr PG_DB=zephyr GHA2DB_LOCAL=1 gha2db 2016-05-26 0 today now "zephyrproject-rtos" 2>>errors.txt | tee -a run.log || exit 2 GHA2DB_PROJECT=zephyr PG_DB=zephyr GHA2DB_LOCAL=1 GHA2DB_MGETC=y GHA2DB_SKIPTABLE=1 GHA2DB_INDEX=1 structure 2>>errors.txt | tee -a run.log || exit 4 GHA2DB_PROJECT=zephyr PG_DB=zephyr ./shared/setup_repo_groups.sh 2>>errors.txt | tee -a run.log || exit 5 GHA2DB_PROJECT=zephyr PG_DB=zephyr ./shared/import_affs.sh 2>>errors.txt | tee -a run.log || exit 6 GHA2DB_PROJECT=zephyr PG_DB=zephyr ./shared/setup_scripts.sh 2>>errors.txt | tee -a run.log || exit 7 GHA2DB_PROJECT=zephyr PG_DB=zephyr ./shared/get_repos.sh 2>>errors.txt | tee -a run.log || exit 8 GHA2DB_PROJECT=zephyr PG_DB=zephyr GHA2DB_LOCAL=1 vars || exit 9 ./devel/ro_user_grants.sh zephyr || exit 10 ./devel/psql_user_grants.sh devstats_team zephyr || exit 11
TERMUX_PKG_HOMEPAGE=https://lxqt.github.io TERMUX_PKG_DESCRIPTION="GUI to query passwords on behalf of SSH agents" TERMUX_PKG_LICENSE="LGPL-2.1" TERMUX_PKG_MAINTAINER="Simeon Huang <symeon@librehat.com>" TERMUX_PKG_VERSION=0.17.0 TERMUX_PKG_REVISION=1 TERMUX_PKG_SRCURL="https://github.com/lxqt/lxqt-openssh-askpass/releases/download/${TERMUX_PKG_VERSION}/lxqt-openssh-askpass-${TERMUX_PKG_VERSION}.tar.xz" TERMUX_PKG_SHA256=19322332443151ceadc24f4eea12188eb7dd08c77fb0f41dcd6ee92018f2ac3d TERMUX_PKG_DEPENDS="qt5-qtbase, liblxqt" TERMUX_PKG_BUILD_DEPENDS="lxqt-build-tools, qt5-qtbase-cross-tools, qt5-qttools-cross-tools"
#!/bin/bash # # This script performs an integration test of the component, # deploying the component into the CI environment, # creating a virtualenv, installing test dependencies, # running the functional and integration tests, # then (if those pass) copying the RPM to the QA repository. # # It is intended to be run on the Jenkins server, # but can be run locally as well. # export PATH=/opt/wgen-3p/python27/bin:$PATH export PATH=/opt/wgen-3p/ruby-1.9/bin:$PATH export WORKSPACE=${WORKSPACE:-$PWD} export PIP_LOG=${PIP_LOG:-$WORKSPACE/pip.log} export QA_REPO=${QA_REPO:-/tmp} rake virtualenv:create source venv/bin/activate rake jenkins:ci_integrationtest
<reponame>c58/marsdb-react<filename>index.js var createContainer = require('./dist/createContainer').default; var DataManagerContainer = require('./dist/DataManagerContainer').default; module.exports = { __esModule: true, createContainer: createContainer, DataManagerContainer: DataManagerContainer };
import { BusinessException } from '../business-exception'; export class RequestException extends BusinessException { }
import { bot } from '@common/bot'; const { API_URL } = process.env; export const main = async () => { await bot.telegram.setWebhook(API_URL); };
<filename>src/tree/expressions/TRelationalExpression.java package tree.expressions; import tree.DefaultTreeNode; import tree.symbols.TSGeOp; import tree.symbols.TSGtOp; import tree.symbols.TSLeOp; import tree.symbols.TSLtOp; public class TRelationalExpression extends DefaultTreeNode { public TRelationalExpression(TRelationalExpression node) { super(node); } public TRelationalExpression(TShiftExpression sexpr) { addChild(sexpr); } public TRelationalExpression(TRelationalExpression rexpr, TSLtOp lt_op, TShiftExpression sexpr) { addChild(rexpr); addChild(lt_op); addChild(sexpr); } public TRelationalExpression(TRelationalExpression rexpr, TSGtOp gt_op, TShiftExpression sexpr) { addChild(rexpr); addChild(gt_op); addChild(sexpr); } public TRelationalExpression(TRelationalExpression rexpr, TSLeOp le_op, TShiftExpression sexpr) { addChild(rexpr); addChild(le_op); addChild(sexpr); } public TRelationalExpression(TRelationalExpression rexpr, TSGeOp ge_op, TShiftExpression sexpr) { addChild(rexpr); addChild(ge_op); addChild(sexpr); } public static TRelationalExpression from(TUnaryExpression uexpr) { return new TRelationalExpression(TShiftExpression.from(uexpr)); } public static TRelationalExpression from(TCastExpression cexpr) { return new TRelationalExpression(TShiftExpression.from(cexpr)); } }
<reponame>rynop/nativescript-app-templates import { Observable } from "tns-core-modules/data/observable"; import { ObservableArray } from "tns-core-modules/data/observable-array"; import { Config } from "../shared/config"; import { ObservableProperty } from "../shared/observable-property-decorator"; import { Car } from "./shared/car-model"; import { CarService } from "./shared/car-service"; /* *********************************************************** * This is the master list view model. *************************************************************/ export class CarsListViewModel extends Observable { @ObservableProperty() cars: ObservableArray<Car> = new ObservableArray<Car>([]); @ObservableProperty() isLoading: boolean = false; private _carService: CarService; constructor() { super(); this._carService = CarService.getInstance(); } load(): void { this.isLoading = true; this._carService.load() .then((cars: Array<Car>) => { this.cars = new ObservableArray(cars); this.isLoading = false; }) .catch(() => { this.isLoading = false; }); } }
<reponame>aurelmegn/boilerplate_flask (window["webpackJsonp"] = window["webpackJsonp"] || []).push([["js/app"],{ /***/ "./assets/js/index.js": /*!****************************!*\ !*** ./assets/js/index.js ***! \****************************/ /*! no static exports found */ /***/ (function(module, exports) { /***/ }) },[["./assets/js/index.js","runtime"]]]); //# sourceMappingURL=data:application/json;charset=utf-8;base64,<KEY>
<filename>java/src/main/java/ch/hslu/pcp/sw8/Exercise3.java package ch.hslu.pcp.sw8; public class Exercise3 implements TripleIntOperator{ @Override public int apply(int first, int second, int third) { return 0; } }
<reponame>ppetoumenos/election_data_gr #!/usr/bin/python # vim: set ts=4: # vim: set shiftwidth=4: # vim: set expandtab: import logging import datetime import unicodecsv as csv import codecs from crawler import Crawler import elections as el _SECONDS_PER_REQUEST = 3 #------------------------------------------------------------------------------- #---> Logging init #------------------------------------------------------------------------------- fname = 'run_{:%Y%m%d_%H%M%S}.log'.format(datetime.datetime.now()) handler = logging.FileHandler(fname, 'w', 'utf-8') handler.setFormatter(logging.Formatter('%(message)s')) # or whatever logger = logging.getLogger() logger.setLevel(logging.DEBUG) logger.addHandler(handler) #logging.basicConfig(filename=fname, level=logging.DEBUG) parties = dict() #------------------------------------------------------------------------------- #---> Helper Functions #------------------------------------------------------------------------------- def new_entry(nam, upper_id): """ Return a new dictionary for storing election results """ d = dict([ ('name', nam), ('pstation_cnt', 0), ('upper_id', upper_id), ('lower_cnt', 0), ('registered', 0), ('valid', 0), ('invalid', 0), ('blank', 0), ('results', dict())]) for idx in parties: d['results'][idx] = 0 return d def to_dict(raw_lst, lvl): """ Extract the name, id, and hierarchical information from an entry of the top-level json file and build an election results entry """ idx = int(el.get(raw_lst, lvl, 'id')) nam = el.get(raw_lst, lvl, 'name') upper_id = int(el.get(raw_lst, lvl, 'upper_id')) return idx, new_entry(nam, upper_id) def parse_base(data, lvl): """ Parse the list of entries in the top-level json file for a specific hierarchical level and return a dictionary of election result entries """ d = dict() for raw_lst in data[lvl]: idx, datum = to_dict(raw_lst, lvl) d[idx] = datum return d def check(idx, d, res, field): """ Check the correctness of a json object returned by the crawler """ if res is None: logger.warning(u'Did not get data for {0}, {1}'.format(idx, d['name'])) return False if res[field] != idx: logger.warning(u'Wrong id for {0}, {1}. Got {2}'.format(idx, d['name'], res[field])) return False return True def translate_result(result): """ Transform the raw election result returned by the crawler to our format """ d = new_entry('', -1) for key, translation in el.translations.items(): if key in result: d[translation] = result[key] if d['pstation_cnt'] == 0: d['pstation_cnt'] = 1 for res in result['party']: idx = res['PARTY_ID'] votes = res['VOTES'] d['results'][idx] = votes return d def add(d, result): """ Add the result fields to the ones of d """ for key in ['pstation_cnt', 'registered', 'valid', 'invalid', 'blank']: d[key] += result[key] for idx in d['results']: d['results'][idx] += result['results'][idx] def write_to_csv(csv_f, idx, data_lst): """ write the data to a csv file. csv_f is is the CSVWriter, idx is the id of the result to write, data_lst is a list containing the dictionaries for this and higher level """ original_idx = idx templst = [] for data in data_lst: templst.extend([idx, data[idx]['name']]) if 'upper_id' not in data[idx]: break idx = data[idx]['upper_id'] res = data_lst[0][original_idx] templst.extend([res['pstation_cnt'], res['lower_cnt'], res['registered']]) templst.extend([res['valid'], res['invalid'], res['blank']]) for party_id in parties: templst.append(res['results'][party_id]) csv_f.writerow(templst) #------------------------------------------------------------------------------- #---> Extract high level information #------------------------------------------------------------------------------- crawler = Crawler(el.election_str, _SECONDS_PER_REQUEST) # Get the file containing all the ids and names pdata = crawler.get(el.get_url('top', 0, False)) # Top level file contains information for the following levels: # 'epik' -> nationwide, top administrative level # 'snom' -> regions, second administrative level - NUTS 2 # 'ep' -> voting district, roughly similar to the pre-2011 prefectures - NUTS 3 # 'dhm' -> municipalities, third administrative level - LAU 1 # 'den' -> municipal units, roughly similar to the pre-2011 municipalities - LAU 2 # parse id and name for all parties for party_raw in el.get_parties_list(pdata): party_id = int(el.get_party_field(party_raw, 'id')) name = el.get_party_field(party_raw, 'name') parties[party_id] = {'name':name} logger.info(u'Parties info parsed successfully') # Extract the nationwide data nationwide_raw = pdata['epik'][0] _, nationwide = to_dict(nationwide_raw, 'epik') logger.info(u'Nationwide info parsed successfully') # parse the other levels districts = parse_base(pdata, 'ep') logger.info(u'District info parsed successfully') municipalities = parse_base(pdata, 'dhm') logger.info(u'Municipalities info parsed successfully') municipal_units = parse_base(pdata, 'den') logger.info(u'Municipal units info parsed successfully') #------------------------------------------------------------------------------- #---> Crawl through all the municipal units data #------------------------------------------------------------------------------- for mu_id, mu_dict in municipal_units.items(): url = el.get_url('den', mu_id, True) results = crawler.get(url) if not check(mu_id, mu_dict, results, 'DEN_ID'): continue add(mu_dict, translate_result(results)) mu_dict['lower_cnt'] = mu_dict['pstation_cnt'] logger.info(u'Parsed unit {0}, {1}'.format(mu_id, mu_dict['name'])) #------------------------------------------------------------------------------- #---> Add special polling stations and get their results #------------------------------------------------------------------------------- #2012a no special list # for each district get static # http://ekloges-prev.singularlogic.eu/v2012a/stat/ep_31.js # extract CountTmK -> ordinary pstations # extract CountTmGe0 -> all pstations located in the district # get all tm [(CountTmK - CountTmM+1, CountTmGeo] static # read their EP_ID, count them for this district, make sure DHM_ID is zero # special polling stations don't belong to any municipality or unit # add one extra "municipality" and "unit" in each district to aggregate the # special polling station results if el.has_special: # add empty entries first specials = dict() max_municipality = max([m_id for m_id in municipalities.keys()]) max_munit = max([mu_id for mu_id in municipal_units.keys()]) for district_id in districts: max_municipality += 1 max_munit += 1 name = 'special_' + str(district_id) m_dict = new_entry(name, district_id) municipalities[max_municipality] = m_dict mu_dict = new_entry(name, max_municipality) municipal_units[max_munit] = mu_dict specials[district_id] = mu_dict # find and aggregate special polling stations for district_id in districts: if el.has_special_list(): mu_dict = specials[district_id] url = el.get_url('special', district_id, False) special_lst = crawler.get(url) for special in special_lst: url = el.get_url('tm', special['TM_ID'], True) results = crawler.get(url) add(mu_dict, translate_result(results)) mu_dict['lower_cnt'] += 1 else: url = el.get_url('ep', district_id, False) district_data = crawler.get(url) start_id = district_data['CountTmK'] - district_data['CountTmM'] + 1 end_id = district_data['CountTmGeo'] + 1 for pstation_id in range(start_id, end_id): real_pstation_id = 10000 * district_id + pstation_id url = el.get_url('tm', real_pstation_id, False) results = crawler.get(url) if results['DHM_ID'] != 0: continue real_district_id = results['EP_ID'] mu_dict = specials[real_district_id] url = el.get_url('tm', real_pstation_id, True) results = crawler.get(url) add(mu_dict, translate_result(results)) mu_dict['lower_cnt'] += 1 logger.info(u'Parsed special polling stations for district {0}, {1}'.format(district_id, districts[district_id]['name'])) #------------------------------------------------------------------------------- #---> Aggregate the municipality, district, and nationwide data #------------------------------------------------------------------------------- for mu_id, mu_dict in municipal_units.items(): m_dict = municipalities[mu_dict['upper_id']] add(m_dict, mu_dict) m_dict['lower_cnt'] += 1 for m_id, m_dict in municipalities.items(): d_dict = districts[m_dict['upper_id']] add(d_dict, m_dict) d_dict['lower_cnt'] += 1 for d_id, d_dict in districts.items(): add(nationwide, d_dict) nationwide['lower_cnt'] += 1 logger.info(u'Aggregated data for municipalities and districts') #------------------------------------------------------------------------------- #---> Export CSV #------------------------------------------------------------------------------- party_header = [] for party_id in parties: party_header.append(parties[party_id]['name']) fname = el.election_str + '_municipal_units.csv' header = ['id', 'municipality unit', 'municipality id', 'municipality', 'district id', 'district', 'number of polling stations', 'number of polling stations', 'registered voters', 'valid votes', 'invalid votes', 'blank votes'] header.extend(party_header) with open(fname, 'wb') as csvfile: csvwriter = csv.writer(csvfile, delimiter='\t', encoding='utf-8') csvwriter.writerow(header) for mu_id in municipal_units: write_to_csv(csvwriter, mu_id, [municipal_units, municipalities, districts]) fname = el.election_str + '_municipalities.csv' header = ['id', 'municipality', 'district id', 'district', 'number of polling stations', 'number of municipal units', 'registered voters', 'valid votes', 'invalid votes', 'blank votes'] header.extend(party_header) with open(fname, 'wb') as csvfile: csvwriter = csv.writer(csvfile, delimiter='\t', encoding='utf-8') csvwriter.writerow(header) for m_id in municipalities: write_to_csv(csvwriter, m_id, [municipalities, districts]) fname = el.election_str + '_districts.csv' header = ['id', 'district', 'number of polling stations', 'number of municipalities', 'registered voters', 'valid votes', 'invalid votes', 'blank votes'] header.extend(party_header) with open(fname, 'wb') as csvfile: csvwriter = csv.writer(csvfile, delimiter='\t', encoding='utf-8') csvwriter.writerow(header) for d_id in districts: write_to_csv(csvwriter, d_id, [districts])
class CreditCard: total_cards_created = 0 # Class attribute to keep track of the total number of credit cards created def __init__(self, card_number, initial_balance): self.card_number = card_number self.balance = initial_balance CreditCard.total_cards_created += 1 # Increment the total_cards_created attribute def make_purchase(self, amount): if self.balance >= amount: self.balance -= amount print(f"Purchase of ${amount} made. Remaining balance: ${self.balance}") else: print("Insufficient funds for the purchase.") def check_balance(self): return self.balance def make_payment(self, amount): self.balance += amount print(f"Payment of ${amount} made. Updated balance: ${self.balance}") # Example usage card1 = CreditCard("1234 5678 9012 3456", 1000) card2 = CreditCard("9876 5432 1098 7654", 500) card1.make_purchase(300) # Output: Purchase of $300 made. Remaining balance: $700 card1.make_purchase(800) # Output: Insufficient funds for the purchase. card1.make_payment(200) # Output: Payment of $200 made. Updated balance: $900 print(card1.check_balance()) # Output: 900 print(CreditCard.total_cards_created) # Output: 2
<gh_stars>0 "use strict"; var _react = _interopRequireDefault(require("react")); var _propTypes = _interopRequireDefault(require("prop-types")); var _react2 = require("@storybook/react"); var _grommet = require("grommet"); var _themes = require("grommet/themes"); var _utils = require("grommet/utils"); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } var H = function H(_ref) { var level = _ref.level, size = _ref.size; return _react["default"].createElement(_grommet.Heading, { level: level, size: size }, "Heading " + level + " " + size); }; H.propTypes = { level: _propTypes["default"].number.isRequired, size: _propTypes["default"].string.isRequired }; var Set = function Set(_ref2) { var size = _ref2.size; return _react["default"].createElement("div", null, [1, 2, 3, 4, 5, 6].map(function (level) { return _react["default"].createElement(H, { key: level, level: level, size: size }); })); }; Set.propTypes = { size: _propTypes["default"].string.isRequired }; var All = function All() { return _react["default"].createElement(_grommet.Grommet, { theme: _themes.grommet }, _react["default"].createElement(_grommet.Grid, { columns: "large", gap: "medium" }, _react["default"].createElement(Set, { size: "medium" }), _react["default"].createElement(Set, { size: "small" }), _react["default"].createElement(Set, { size: "large" }), _react["default"].createElement(Set, { size: "xlarge" }))); }; var Color = function Color() { return _react["default"].createElement(_grommet.Grommet, { theme: _themes.grommet }, _react["default"].createElement(_grommet.Heading, { color: "accent-1" }, "Colored Heading")); }; var customlevel = (0, _utils.deepMerge)(_themes.grommet, { heading: { level: { 5: { small: { size: '12px', height: '16px' }, medium: { size: '14px', height: '18px' }, large: { size: '16px', height: '20px' } } }, extend: function extend(props) { return "color: " + props.theme.global.colors.brand; } } }); var CustomHeading = function CustomHeading() { return _react["default"].createElement(_grommet.Grommet, { theme: customlevel }, _react["default"].createElement(_grommet.Heading, { level: 5 }, "Heading level 5")); }; (0, _react2.storiesOf)('Heading', module).add('All', function () { return _react["default"].createElement(All, null); }).add('Color', function () { return _react["default"].createElement(Color, null); }).add('Custom', function () { return _react["default"].createElement(CustomHeading, null); });
#!/bin/bash #sh /home/alarm/QB_Nebulae_V2/Code/scripts/mountfs.sh rw echo "starting bootup LEDs" python2 /home/alarm/QB_Nebulae_V2/Code/nebulae/bootleds.py booting & echo "optimizing system." sh /home/alarm/QB_Nebulae_V2/Code/scripts/sys_opt.sh echo "checking for firmware update" sh /home/alarm/QB_Nebulae_V2/Code/scripts/update.sh #echo "checking for reversion file" #if [ -f /mnt/memory/revert_to_factory_firmware ] #then # sh /home/alarm/revertfactoryfw.sh #fi # Update Local Files - Config.txt (nebulae.service handled in update.) if [ -f /home/alarm/QB_Nebulae_V2/Code/localfiles/config.txt ] then echo "updating /boot/config.txt for next boot up." sudo bash -c "cat /home/alarm/QB_Nebulae_V2/Code/localfiles/config.txt > /boot/config.txt" fi #sh /home/alarm/QB_Nebulae_V2/Code/scripts/handleuserfiles.sh # Configure Audio Codec sh /home/alarm/QB_Nebulae_V2/Code/scripts/enable_inputs.sh sh /home/alarm/QB_Nebulae_V2/Code/scripts/mountfs.sh rw sudo python2 /home/alarm/QB_Nebulae_V2/Code/nebulae/check_calibration.py sh /home/alarm/QB_Nebulae_V2/Code/scripts/mountfs.sh ro sudo pkill -1 -f /home/alarm/QB_Nebulae_V2/Code/nebulae/bootleds.py echo "Running Nebulae" python2 /home/alarm/QB_Nebulae_V2/Code/nebulae/nebulae.py exit
<gh_stars>0 def payload_from_form(form, prefix='', delete=False): """ Generate a payload for a POST request based on a ModelForm """ prefix = f'{prefix}-' if prefix else '' payload = {f'{prefix}{k}': form[k].value() for k, v in form.fields.items() if form[k].value()} if getattr(form.instance, 'id'): payload['id'] = form.instance.id if delete: payload['delete'] = True return payload
<reponame>alex-scott/php-src /* +----------------------------------------------------------------------+ | PHP Version 7 | +----------------------------------------------------------------------+ | Copyright (c) The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | <EMAIL> so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Author: <NAME> <<EMAIL>> | +----------------------------------------------------------------------+ */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "php.h" #include "php_ini.h" #include "ext/standard/info.h" #include "pdo/php_pdo.h" #include "pdo/php_pdo_driver.h" #include "php_pdo_sqlite.h" #include "php_pdo_sqlite_int.h" #include "zend_exceptions.h" int _pdo_sqlite_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, const char *file, int line) /* {{{ */ { pdo_sqlite_db_handle *H = (pdo_sqlite_db_handle *)dbh->driver_data; pdo_error_type *pdo_err = stmt ? &stmt->error_code : &dbh->error_code; pdo_sqlite_error_info *einfo = &H->einfo; einfo->errcode = sqlite3_errcode(H->db); einfo->file = file; einfo->line = line; if (einfo->errcode != SQLITE_OK) { if (einfo->errmsg) { pefree(einfo->errmsg, dbh->is_persistent); } einfo->errmsg = pestrdup((char*)sqlite3_errmsg(H->db), dbh->is_persistent); } else { /* no error */ strncpy(*pdo_err, PDO_ERR_NONE, sizeof(*pdo_err)); return 0; } switch (einfo->errcode) { case SQLITE_NOTFOUND: strncpy(*pdo_err, "42S02", sizeof(*pdo_err)); break; case SQLITE_INTERRUPT: strncpy(*pdo_err, "01002", sizeof(*pdo_err)); break; case SQLITE_NOLFS: strncpy(*pdo_err, "HYC00", sizeof(*pdo_err)); break; case SQLITE_TOOBIG: strncpy(*pdo_err, "22001", sizeof(*pdo_err)); break; case SQLITE_CONSTRAINT: strncpy(*pdo_err, "23000", sizeof(*pdo_err)); break; case SQLITE_ERROR: default: strncpy(*pdo_err, "HY000", sizeof(*pdo_err)); break; } if (!dbh->methods) { zend_throw_exception_ex(php_pdo_get_exception(), einfo->errcode, "SQLSTATE[%s] [%d] %s", *pdo_err, einfo->errcode, einfo->errmsg); } return einfo->errcode; } /* }}} */ static int pdo_sqlite_fetch_error_func(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval *info) { pdo_sqlite_db_handle *H = (pdo_sqlite_db_handle *)dbh->driver_data; pdo_sqlite_error_info *einfo = &H->einfo; if (einfo->errcode) { add_next_index_long(info, einfo->errcode); add_next_index_string(info, einfo->errmsg); } return 1; } static void pdo_sqlite_cleanup_callbacks(pdo_sqlite_db_handle *H) { struct pdo_sqlite_func *func; while (H->funcs) { func = H->funcs; H->funcs = func->next; if (H->db) { /* delete the function from the handle */ sqlite3_create_function(H->db, func->funcname, func->argc, SQLITE_UTF8, func, NULL, NULL, NULL); } efree((char*)func->funcname); if (!Z_ISUNDEF(func->func)) { zval_ptr_dtor(&func->func); } if (!Z_ISUNDEF(func->step)) { zval_ptr_dtor(&func->step); } if (!Z_ISUNDEF(func->fini)) { zval_ptr_dtor(&func->fini); } efree(func); } while (H->collations) { struct pdo_sqlite_collation *collation; collation = H->collations; H->collations = collation->next; if (H->db) { /* delete the collation from the handle */ sqlite3_create_collation(H->db, collation->name, SQLITE_UTF8, collation, NULL); } efree((char*)collation->name); if (!Z_ISUNDEF(collation->callback)) { zval_ptr_dtor(&collation->callback); } efree(collation); } } static int sqlite_handle_closer(pdo_dbh_t *dbh) /* {{{ */ { pdo_sqlite_db_handle *H = (pdo_sqlite_db_handle *)dbh->driver_data; if (H) { pdo_sqlite_error_info *einfo = &H->einfo; pdo_sqlite_cleanup_callbacks(H); if (H->db) { #ifdef HAVE_SQLITE3_CLOSE_V2 sqlite3_close_v2(H->db); #else sqlite3_close(H->db); #endif H->db = NULL; } if (einfo->errmsg) { pefree(einfo->errmsg, dbh->is_persistent); einfo->errmsg = NULL; } pefree(H, dbh->is_persistent); dbh->driver_data = NULL; } return 0; } /* }}} */ static int sqlite_handle_preparer(pdo_dbh_t *dbh, const char *sql, size_t sql_len, pdo_stmt_t *stmt, zval *driver_options) { pdo_sqlite_db_handle *H = (pdo_sqlite_db_handle *)dbh->driver_data; pdo_sqlite_stmt *S = ecalloc(1, sizeof(pdo_sqlite_stmt)); int i; const char *tail; S->H = H; stmt->driver_data = S; stmt->methods = &sqlite_stmt_methods; stmt->supports_placeholders = PDO_PLACEHOLDER_POSITIONAL|PDO_PLACEHOLDER_NAMED; if (PDO_CURSOR_FWDONLY != pdo_attr_lval(driver_options, PDO_ATTR_CURSOR, PDO_CURSOR_FWDONLY)) { H->einfo.errcode = SQLITE_ERROR; pdo_sqlite_error(dbh); return 0; } i = sqlite3_prepare_v2(H->db, sql, sql_len, &S->stmt, &tail); if (i == SQLITE_OK) { return 1; } pdo_sqlite_error(dbh); return 0; } static zend_long sqlite_handle_doer(pdo_dbh_t *dbh, const char *sql, size_t sql_len) { pdo_sqlite_db_handle *H = (pdo_sqlite_db_handle *)dbh->driver_data; char *errmsg = NULL; if (sqlite3_exec(H->db, sql, NULL, NULL, &errmsg) != SQLITE_OK) { pdo_sqlite_error(dbh); if (errmsg) sqlite3_free(errmsg); return -1; } else { return sqlite3_changes(H->db); } } static char *pdo_sqlite_last_insert_id(pdo_dbh_t *dbh, const char *name, size_t *len) { pdo_sqlite_db_handle *H = (pdo_sqlite_db_handle *)dbh->driver_data; char *id; id = php_pdo_int64_to_str(sqlite3_last_insert_rowid(H->db)); *len = strlen(id); return id; } /* NB: doesn't handle binary strings... use prepared stmts for that */ static int sqlite_handle_quoter(pdo_dbh_t *dbh, const char *unquoted, size_t unquotedlen, char **quoted, size_t *quotedlen, enum pdo_param_type paramtype ) { *quoted = safe_emalloc(2, unquotedlen, 3); sqlite3_snprintf(2*unquotedlen + 3, *quoted, "'%q'", unquoted); *quotedlen = strlen(*quoted); return 1; } static int sqlite_handle_begin(pdo_dbh_t *dbh) { pdo_sqlite_db_handle *H = (pdo_sqlite_db_handle *)dbh->driver_data; char *errmsg = NULL; if (sqlite3_exec(H->db, "BEGIN", NULL, NULL, &errmsg) != SQLITE_OK) { pdo_sqlite_error(dbh); if (errmsg) sqlite3_free(errmsg); return 0; } return 1; } static int sqlite_handle_commit(pdo_dbh_t *dbh) { pdo_sqlite_db_handle *H = (pdo_sqlite_db_handle *)dbh->driver_data; char *errmsg = NULL; if (sqlite3_exec(H->db, "COMMIT", NULL, NULL, &errmsg) != SQLITE_OK) { pdo_sqlite_error(dbh); if (errmsg) sqlite3_free(errmsg); return 0; } return 1; } static int sqlite_handle_rollback(pdo_dbh_t *dbh) { pdo_sqlite_db_handle *H = (pdo_sqlite_db_handle *)dbh->driver_data; char *errmsg = NULL; if (sqlite3_exec(H->db, "ROLLBACK", NULL, NULL, &errmsg) != SQLITE_OK) { pdo_sqlite_error(dbh); if (errmsg) sqlite3_free(errmsg); return 0; } return 1; } static int pdo_sqlite_get_attribute(pdo_dbh_t *dbh, zend_long attr, zval *return_value) { switch (attr) { case PDO_ATTR_CLIENT_VERSION: case PDO_ATTR_SERVER_VERSION: ZVAL_STRING(return_value, (char *)sqlite3_libversion()); break; default: return 0; } return 1; } static int pdo_sqlite_set_attr(pdo_dbh_t *dbh, zend_long attr, zval *val) { pdo_sqlite_db_handle *H = (pdo_sqlite_db_handle *)dbh->driver_data; switch (attr) { case PDO_ATTR_TIMEOUT: sqlite3_busy_timeout(H->db, zval_get_long(val) * 1000); return 1; } return 0; } static int do_callback(struct pdo_sqlite_fci *fc, zval *cb, int argc, sqlite3_value **argv, sqlite3_context *context, int is_agg) { zval *zargs = NULL; zval retval; int i; int ret; int fake_argc; zend_reference *agg_context = NULL; if (is_agg) { is_agg = 2; } fake_argc = argc + is_agg; fc->fci.size = sizeof(fc->fci); ZVAL_COPY_VALUE(&fc->fci.function_name, cb); fc->fci.object = NULL; fc->fci.retval = &retval; fc->fci.param_count = fake_argc; /* build up the params */ if (fake_argc) { zargs = safe_emalloc(fake_argc, sizeof(zval), 0); } if (is_agg) { agg_context = (zend_reference*)sqlite3_aggregate_context(context, sizeof(zend_reference)); if (!agg_context) { ZVAL_NULL(&zargs[0]); } else { if (Z_ISUNDEF(agg_context->val)) { GC_SET_REFCOUNT(agg_context, 1); GC_TYPE_INFO(agg_context) = IS_REFERENCE; ZVAL_NULL(&agg_context->val); } ZVAL_REF(&zargs[0], agg_context); } ZVAL_LONG(&zargs[1], sqlite3_aggregate_count(context)); } for (i = 0; i < argc; i++) { /* get the value */ switch (sqlite3_value_type(argv[i])) { case SQLITE_INTEGER: ZVAL_LONG(&zargs[i + is_agg], sqlite3_value_int(argv[i])); break; case SQLITE_FLOAT: ZVAL_DOUBLE(&zargs[i + is_agg], sqlite3_value_double(argv[i])); break; case SQLITE_NULL: ZVAL_NULL(&zargs[i + is_agg]); break; case SQLITE_BLOB: case SQLITE3_TEXT: default: ZVAL_STRINGL(&zargs[i + is_agg], (char*)sqlite3_value_text(argv[i]), sqlite3_value_bytes(argv[i])); break; } } fc->fci.params = zargs; if ((ret = zend_call_function(&fc->fci, &fc->fcc)) == FAILURE) { php_error_docref(NULL, E_WARNING, "An error occurred while invoking the callback"); } /* clean up the params */ if (zargs) { for (i = is_agg; i < fake_argc; i++) { zval_ptr_dtor(&zargs[i]); } if (is_agg) { zval_ptr_dtor(&zargs[1]); } efree(zargs); } if (!is_agg || !argv) { /* only set the sqlite return value if we are a scalar function, * or if we are finalizing an aggregate */ if (!Z_ISUNDEF(retval)) { switch (Z_TYPE(retval)) { case IS_LONG: sqlite3_result_int(context, Z_LVAL(retval)); break; case IS_NULL: sqlite3_result_null(context); break; case IS_DOUBLE: sqlite3_result_double(context, Z_DVAL(retval)); break; default: if (!try_convert_to_string(&retval)) { ret = FAILURE; break; } sqlite3_result_text(context, Z_STRVAL(retval), Z_STRLEN(retval), SQLITE_TRANSIENT); break; } } else { sqlite3_result_error(context, "failed to invoke callback", 0); } if (agg_context) { zval_ptr_dtor(&agg_context->val); } } else { /* we're stepping in an aggregate; the return value goes into * the context */ if (agg_context) { zval_ptr_dtor(&agg_context->val); } if (!Z_ISUNDEF(retval)) { ZVAL_COPY_VALUE(&agg_context->val, &retval); ZVAL_UNDEF(&retval); } else { ZVAL_UNDEF(&agg_context->val); } } if (!Z_ISUNDEF(retval)) { zval_ptr_dtor(&retval); } return ret; } static void php_sqlite3_func_callback(sqlite3_context *context, int argc, sqlite3_value **argv) { struct pdo_sqlite_func *func = (struct pdo_sqlite_func*)sqlite3_user_data(context); do_callback(&func->afunc, &func->func, argc, argv, context, 0); } static void php_sqlite3_func_step_callback(sqlite3_context *context, int argc, sqlite3_value **argv) { struct pdo_sqlite_func *func = (struct pdo_sqlite_func*)sqlite3_user_data(context); do_callback(&func->astep, &func->step, argc, argv, context, 1); } static void php_sqlite3_func_final_callback(sqlite3_context *context) { struct pdo_sqlite_func *func = (struct pdo_sqlite_func*)sqlite3_user_data(context); do_callback(&func->afini, &func->fini, 0, NULL, context, 1); } static int php_sqlite3_collation_callback(void *context, int string1_len, const void *string1, int string2_len, const void *string2) { int ret; zval zargs[2]; zval retval; struct pdo_sqlite_collation *collation = (struct pdo_sqlite_collation*) context; collation->fc.fci.size = sizeof(collation->fc.fci); ZVAL_COPY_VALUE(&collation->fc.fci.function_name, &collation->callback); collation->fc.fci.object = NULL; collation->fc.fci.retval = &retval; // Prepare the arguments. ZVAL_STRINGL(&zargs[0], (char *) string1, string1_len); ZVAL_STRINGL(&zargs[1], (char *) string2, string2_len); collation->fc.fci.param_count = 2; collation->fc.fci.params = zargs; if ((ret = zend_call_function(&collation->fc.fci, &collation->fc.fcc)) == FAILURE) { php_error_docref(NULL, E_WARNING, "An error occurred while invoking the callback"); } else if (!Z_ISUNDEF(retval)) { if (Z_TYPE(retval) != IS_LONG) { convert_to_long_ex(&retval); } ret = 0; if (Z_LVAL(retval) > 0) { ret = 1; } else if (Z_LVAL(retval) < 0) { ret = -1; } zval_ptr_dtor(&retval); } zval_ptr_dtor(&zargs[0]); zval_ptr_dtor(&zargs[1]); return ret; } /* {{{ bool SQLite::sqliteCreateFunction(string name, mixed callback [, int argcount, int flags]) Registers a UDF with the sqlite db handle */ static PHP_METHOD(SQLite, sqliteCreateFunction) { struct pdo_sqlite_func *func; zval *callback; char *func_name; size_t func_name_len; zend_long argc = -1; zend_long flags = 0; pdo_dbh_t *dbh; pdo_sqlite_db_handle *H; int ret; ZEND_PARSE_PARAMETERS_START(2, 4) Z_PARAM_STRING(func_name, func_name_len) Z_PARAM_ZVAL(callback) Z_PARAM_OPTIONAL Z_PARAM_LONG(argc) Z_PARAM_LONG(flags) ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); dbh = Z_PDO_DBH_P(ZEND_THIS); PDO_CONSTRUCT_CHECK; if (!zend_is_callable(callback, 0, NULL)) { zend_string *cbname = zend_get_callable_name(callback); php_error_docref(NULL, E_WARNING, "function '%s' is not callable", ZSTR_VAL(cbname)); zend_string_release_ex(cbname, 0); RETURN_FALSE; } H = (pdo_sqlite_db_handle *)dbh->driver_data; func = (struct pdo_sqlite_func*)ecalloc(1, sizeof(*func)); ret = sqlite3_create_function(H->db, func_name, argc, flags | SQLITE_UTF8, func, php_sqlite3_func_callback, NULL, NULL); if (ret == SQLITE_OK) { func->funcname = estrdup(func_name); ZVAL_COPY(&func->func, callback); func->argc = argc; func->next = H->funcs; H->funcs = func; RETURN_TRUE; } efree(func); RETURN_FALSE; } /* }}} */ /* {{{ bool SQLite::sqliteCreateAggregate(string name, mixed step, mixed fini [, int argcount]) Registers a UDF with the sqlite db handle */ /* The step function should have the prototype: mixed step(mixed $context, int $rownumber, $value [, $value2 [, ...]]) $context will be null for the first row; on subsequent rows it will have the value that was previously returned from the step function; you should use this to maintain state for the aggregate. The fini function should have the prototype: mixed fini(mixed $context, int $rownumber) $context will hold the return value from the very last call to the step function. rownumber will hold the number of rows over which the aggregate was performed. The return value of this function will be used as the return value for this aggregate UDF. */ static PHP_METHOD(SQLite, sqliteCreateAggregate) { struct pdo_sqlite_func *func; zval *step_callback, *fini_callback; char *func_name; size_t func_name_len; zend_long argc = -1; pdo_dbh_t *dbh; pdo_sqlite_db_handle *H; int ret; ZEND_PARSE_PARAMETERS_START(3, 4) Z_PARAM_STRING(func_name, func_name_len) Z_PARAM_ZVAL(step_callback) Z_PARAM_ZVAL(fini_callback) Z_PARAM_OPTIONAL Z_PARAM_LONG(argc) ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); dbh = Z_PDO_DBH_P(ZEND_THIS); PDO_CONSTRUCT_CHECK; if (!zend_is_callable(step_callback, 0, NULL)) { zend_string *cbname = zend_get_callable_name(step_callback); php_error_docref(NULL, E_WARNING, "function '%s' is not callable", ZSTR_VAL(cbname)); zend_string_release_ex(cbname, 0); RETURN_FALSE; } if (!zend_is_callable(fini_callback, 0, NULL)) { zend_string *cbname = zend_get_callable_name(fini_callback); php_error_docref(NULL, E_WARNING, "function '%s' is not callable", ZSTR_VAL(cbname)); zend_string_release_ex(cbname, 0); RETURN_FALSE; } H = (pdo_sqlite_db_handle *)dbh->driver_data; func = (struct pdo_sqlite_func*)ecalloc(1, sizeof(*func)); ret = sqlite3_create_function(H->db, func_name, argc, SQLITE_UTF8, func, NULL, php_sqlite3_func_step_callback, php_sqlite3_func_final_callback); if (ret == SQLITE_OK) { func->funcname = estrdup(func_name); ZVAL_COPY(&func->step, step_callback); ZVAL_COPY(&func->fini, fini_callback); func->argc = argc; func->next = H->funcs; H->funcs = func; RETURN_TRUE; } efree(func); RETURN_FALSE; } /* }}} */ /* {{{ bool SQLite::sqliteCreateCollation(string name, mixed callback) Registers a collation with the sqlite db handle */ static PHP_METHOD(SQLite, sqliteCreateCollation) { struct pdo_sqlite_collation *collation; zval *callback; char *collation_name; size_t collation_name_len; pdo_dbh_t *dbh; pdo_sqlite_db_handle *H; int ret; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_STRING(collation_name, collation_name_len) Z_PARAM_ZVAL(callback) ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); dbh = Z_PDO_DBH_P(ZEND_THIS); PDO_CONSTRUCT_CHECK; if (!zend_is_callable(callback, 0, NULL)) { zend_string *cbname = zend_get_callable_name(callback); php_error_docref(NULL, E_WARNING, "function '%s' is not callable", ZSTR_VAL(cbname)); zend_string_release_ex(cbname, 0); RETURN_FALSE; } H = (pdo_sqlite_db_handle *)dbh->driver_data; collation = (struct pdo_sqlite_collation*)ecalloc(1, sizeof(*collation)); ret = sqlite3_create_collation(H->db, collation_name, SQLITE_UTF8, collation, php_sqlite3_collation_callback); if (ret == SQLITE_OK) { collation->name = estrdup(collation_name); ZVAL_COPY(&collation->callback, callback); collation->next = H->collations; H->collations = collation; RETURN_TRUE; } efree(collation); RETURN_FALSE; } /* }}} */ static const zend_function_entry dbh_methods[] = { PHP_ME(SQLite, sqliteCreateFunction, NULL, ZEND_ACC_PUBLIC) PHP_ME(SQLite, sqliteCreateAggregate, NULL, ZEND_ACC_PUBLIC) PHP_ME(SQLite, sqliteCreateCollation, NULL, ZEND_ACC_PUBLIC) PHP_FE_END }; static const zend_function_entry *get_driver_methods(pdo_dbh_t *dbh, int kind) { switch (kind) { case PDO_DBH_DRIVER_METHOD_KIND_DBH: return dbh_methods; default: return NULL; } } static void pdo_sqlite_request_shutdown(pdo_dbh_t *dbh) { pdo_sqlite_db_handle *H = (pdo_sqlite_db_handle *)dbh->driver_data; /* unregister functions, so that they don't linger for the next * request */ if (H) { pdo_sqlite_cleanup_callbacks(H); } } static const struct pdo_dbh_methods sqlite_methods = { sqlite_handle_closer, sqlite_handle_preparer, sqlite_handle_doer, sqlite_handle_quoter, sqlite_handle_begin, sqlite_handle_commit, sqlite_handle_rollback, pdo_sqlite_set_attr, pdo_sqlite_last_insert_id, pdo_sqlite_fetch_error_func, pdo_sqlite_get_attribute, NULL, /* check_liveness: not needed */ get_driver_methods, pdo_sqlite_request_shutdown, NULL }; static char *make_filename_safe(const char *filename) { if (*filename && memcmp(filename, ":memory:", sizeof(":memory:"))) { char *fullpath = expand_filepath(filename, NULL); if (!fullpath) { return NULL; } if (php_check_open_basedir(fullpath)) { efree(fullpath); return NULL; } return fullpath; } return estrdup(filename); } static int authorizer(void *autharg, int access_type, const char *arg3, const char *arg4, const char *arg5, const char *arg6) { char *filename; switch (access_type) { case SQLITE_COPY: { filename = make_filename_safe(arg4); if (!filename) { return SQLITE_DENY; } efree(filename); return SQLITE_OK; } case SQLITE_ATTACH: { filename = make_filename_safe(arg3); if (!filename) { return SQLITE_DENY; } efree(filename); return SQLITE_OK; } default: /* access allowed */ return SQLITE_OK; } } static int pdo_sqlite_handle_factory(pdo_dbh_t *dbh, zval *driver_options) /* {{{ */ { pdo_sqlite_db_handle *H; int i, ret = 0; zend_long timeout = 60, flags; char *filename; H = pecalloc(1, sizeof(pdo_sqlite_db_handle), dbh->is_persistent); H->einfo.errcode = 0; H->einfo.errmsg = NULL; dbh->driver_data = H; filename = make_filename_safe(dbh->data_source); if (!filename) { zend_throw_exception_ex(php_pdo_get_exception(), 0, "open_basedir prohibits opening %s", dbh->data_source); goto cleanup; } flags = pdo_attr_lval(driver_options, PDO_SQLITE_ATTR_OPEN_FLAGS, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE); i = sqlite3_open_v2(filename, &H->db, flags, NULL); efree(filename); if (i != SQLITE_OK) { pdo_sqlite_error(dbh); goto cleanup; } if (PG(open_basedir) && *PG(open_basedir)) { sqlite3_set_authorizer(H->db, authorizer, NULL); } if (driver_options) { timeout = pdo_attr_lval(driver_options, PDO_ATTR_TIMEOUT, timeout); } sqlite3_busy_timeout(H->db, timeout * 1000); dbh->alloc_own_columns = 1; dbh->max_escaped_char_length = 2; ret = 1; cleanup: dbh->methods = &sqlite_methods; return ret; } /* }}} */ const pdo_driver_t pdo_sqlite_driver = { PDO_DRIVER_HEADER(sqlite), pdo_sqlite_handle_factory };
<reponame>crossplatformsweden/react-native-cross-maps<filename>__mocks__/react-native-modal-datetime-picker.js const mock = { Collapsible: 'View' }; jest.mock('react-native-modal-datetime-picker', () => 'View'); export default mock.Collapsible; module.exports = mock;
#!/usr/bin/env sh ## Build npm run build npm run ebook:build ## Rename and move ebook to dist folder mv ild_docs/.vuepress/dist/ ild_docs/.vuepress/ebook/ mv ild_docs/.vuepress/ebook/ dist/ ## Create CNAME echo 'ichlernedeutsch.info' >> dist/CNAME ## Stage, commit, push to master branch and deploy to gh-pages git add . git commit -m 'UPDATE' git push -u origin master npm run deploy
<reponame>mehmetkillioglu/rclgo /* This file is part of rclgo Copyright © 2021 Technology Innovation Institute, United Arab Emirates Licensed under the Apache License, Version 2.0 (the "License"); http://www.apache.org/licenses/LICENSE-2.0 */ /* THIS FILE IS AUTOGENERATED BY 'rclgo-gen generate' */ package example_interfaces_msg import ( "unsafe" "github.com/mehmetkillioglu/rclgo/pkg/rclgo/types" "github.com/mehmetkillioglu/rclgo/pkg/rclgo/typemap" ) /* #cgo LDFLAGS: -L/opt/ros/galactic/lib -Wl,-rpath=/opt/ros/galactic/lib -lrcl -lrosidl_runtime_c -lrosidl_typesupport_c -lrcutils -lrmw_implementation #cgo LDFLAGS: -lexample_interfaces__rosidl_typesupport_c -lexample_interfaces__rosidl_generator_c #cgo CFLAGS: -I/opt/ros/galactic/include #include <rosidl_runtime_c/message_type_support_struct.h> #include <example_interfaces/msg/float64.h> */ import "C" func init() { typemap.RegisterMessage("example_interfaces/Float64", Float64TypeSupport) } // Do not create instances of this type directly. Always use NewFloat64 // function instead. type Float64 struct { Data float64 `yaml:"data"`// This is an example message of using a primitive datatype, float64.If you want to test with this that's fine, but if you are deployingit into a system you should create a semantically meaningful message type.If you want to embed it in another message, use the primitive data type instead. } // NewFloat64 creates a new Float64 with default values. func NewFloat64() *Float64 { self := Float64{} self.SetDefaults() return &self } func (t *Float64) Clone() *Float64 { c := &Float64{} c.Data = t.Data return c } func (t *Float64) CloneMsg() types.Message { return t.Clone() } func (t *Float64) SetDefaults() { t.Data = 0 } // CloneFloat64Slice clones src to dst by calling Clone for each element in // src. Panics if len(dst) < len(src). func CloneFloat64Slice(dst, src []Float64) { for i := range src { dst[i] = *src[i].Clone() } } // Modifying this variable is undefined behavior. var Float64TypeSupport types.MessageTypeSupport = _Float64TypeSupport{} type _Float64TypeSupport struct{} func (t _Float64TypeSupport) New() types.Message { return NewFloat64() } func (t _Float64TypeSupport) PrepareMemory() unsafe.Pointer { //returns *C.example_interfaces__msg__Float64 return (unsafe.Pointer)(C.example_interfaces__msg__Float64__create()) } func (t _Float64TypeSupport) ReleaseMemory(pointer_to_free unsafe.Pointer) { C.example_interfaces__msg__Float64__destroy((*C.example_interfaces__msg__Float64)(pointer_to_free)) } func (t _Float64TypeSupport) AsCStruct(dst unsafe.Pointer, msg types.Message) { m := msg.(*Float64) mem := (*C.example_interfaces__msg__Float64)(dst) mem.data = C.double(m.Data) } func (t _Float64TypeSupport) AsGoStruct(msg types.Message, ros2_message_buffer unsafe.Pointer) { m := msg.(*Float64) mem := (*C.example_interfaces__msg__Float64)(ros2_message_buffer) m.Data = float64(mem.data) } func (t _Float64TypeSupport) TypeSupport() unsafe.Pointer { return unsafe.Pointer(C.rosidl_typesupport_c__get_message_type_support_handle__example_interfaces__msg__Float64()) } type CFloat64 = C.example_interfaces__msg__Float64 type CFloat64__Sequence = C.example_interfaces__msg__Float64__Sequence func Float64__Sequence_to_Go(goSlice *[]Float64, cSlice CFloat64__Sequence) { if cSlice.size == 0 { return } *goSlice = make([]Float64, int64(cSlice.size)) for i := 0; i < int(cSlice.size); i++ { cIdx := (*C.example_interfaces__msg__Float64__Sequence)(unsafe.Pointer( uintptr(unsafe.Pointer(cSlice.data)) + (C.sizeof_struct_example_interfaces__msg__Float64 * uintptr(i)), )) Float64TypeSupport.AsGoStruct(&(*goSlice)[i], unsafe.Pointer(cIdx)) } } func Float64__Sequence_to_C(cSlice *CFloat64__Sequence, goSlice []Float64) { if len(goSlice) == 0 { return } cSlice.data = (*C.example_interfaces__msg__Float64)(C.malloc((C.size_t)(C.sizeof_struct_example_interfaces__msg__Float64 * uintptr(len(goSlice))))) cSlice.capacity = C.size_t(len(goSlice)) cSlice.size = cSlice.capacity for i, v := range goSlice { cIdx := (*C.example_interfaces__msg__Float64)(unsafe.Pointer( uintptr(unsafe.Pointer(cSlice.data)) + (C.sizeof_struct_example_interfaces__msg__Float64 * uintptr(i)), )) Float64TypeSupport.AsCStruct(unsafe.Pointer(cIdx), &v) } } func Float64__Array_to_Go(goSlice []Float64, cSlice []CFloat64) { for i := 0; i < len(cSlice); i++ { Float64TypeSupport.AsGoStruct(&goSlice[i], unsafe.Pointer(&cSlice[i])) } } func Float64__Array_to_C(cSlice []CFloat64, goSlice []Float64) { for i := 0; i < len(goSlice); i++ { Float64TypeSupport.AsCStruct(unsafe.Pointer(&cSlice[i]), &goSlice[i]) } }
#!/bin/bash # # This script runs NGINX as a reverse proxy as a docker container # It expects to find DAPR_HTTP_PORT variable, so always run via `dapr run` # echo "### API gateway nginx wrapper magic doohicky script" echo "### Dapr port is $DAPR_HTTP_PORT" echo "### Starting nginx in docker" sed -i "s/localhost:[[:digit:]]\+; #dapr/localhost:$DAPR_HTTP_PORT; #dapr/g" dapr.conf docker run --rm --network host -p 9000:9000 --mount type=bind,source=$(pwd),target=/etc/nginx/conf.d/ --name api-gateway nginx:alpine
let array = [2,9,7,8,5]; let min = Math.min(...array); console.log(min); // 2
package mezz.jei.gui.elements; import net.minecraft.client.Minecraft; public interface IMouseClickedButtonCallback { boolean mousePressed(Minecraft mc, int mouseX, int mouseY); }
<reponame>aashish24/paraview-climate-3.11.1<gh_stars>1-10 /*========================================================================= Program: ParaView Module: $RCSfile$ Copyright (c) Kitware, Inc. All rights reserved. See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notice for more information. =========================================================================*/ // .NAME vtkPiece - A handle for meta information about one streamed piece // .SECTION Description // Streaming works by driving the pipeline repeatedly over different // subsections. This class is the way to define a subsection (P/NP@R) // It is also a place to store meta-information gathered from the pipeline // about that piece. #ifndef __vtkPiece_h #define __vtkPiece_h class vtkPiece { public: vtkPiece(); ~vtkPiece(); //Description: // Pieces are identified generically by a fraction (P/NP) and a Resolution void SetPiece(int nv) { this->Piece = nv; } int GetPiece() { return this->Piece; } void SetNumPieces(int nv) { this->NumPieces = nv; } int GetNumPieces() { return this->NumPieces; } void SetResolution( double nv) { this->Resolution = nv; } double GetResolution() { return this->Resolution; } void SetProcessor(int nv) { this->Processor = nv; } int GetProcessor() { return this->Processor; } //Description: // When available, a piece's geometric bounds determines if view priority. void SetBounds(double *nv) { this->Bounds[0] = nv[0]; this->Bounds[1] = nv[1]; this->Bounds[2] = nv[2]; this->Bounds[3] = nv[3]; this->Bounds[4] = nv[4]; this->Bounds[5] = nv[5]; } double *GetBounds() { return this->Bounds; } void GetBounds(double *out) { out[0] = this->Bounds[0]; out[1] = this->Bounds[1]; out[2] = this->Bounds[2]; out[3] = this->Bounds[3]; out[4] = this->Bounds[4]; out[5] = this->Bounds[5]; } //Description: // The pipeline priority reflects how important the piece is to data processing void SetPipelinePriority(double nv) { this->PipelinePriority = nv; } double GetPipelinePriority() { return this->PipelinePriority; } //Description: // The view priority reflects how important the piece is based solely on its // position relative to the viewer void SetViewPriority(double nv) { this->ViewPriority = nv; } double GetViewPriority() { return this->ViewPriority; } //Description: // Pieces that are cached are aggregated together and then skipped individually void SetCachedPriority(double nv) { this->CachedPriority = nv; } double GetCachedPriority() { return this->CachedPriority; } //Description: // Overall priority, just Pp*PV*Pc double GetPriority() { return this->PipelinePriority * this->ViewPriority * this->CachedPriority; } //Decription: //Copies everything void CopyPiece(vtkPiece other); //Description: //Impose an ordering to for sorting bool ComparePriority(vtkPiece other) { return this->GetPriority() > other.GetPriority(); } //Description: //Another ordering for comparison bool CompareHandle(vtkPiece other) { if (Processor<other.Processor) { return true; } if (Processor>other.Processor) { return false; } if (NumPieces < other.NumPieces) { return true; } if (NumPieces > other.NumPieces) { return false; } if (Piece < other.Piece) { return true; } return false; } bool IsValid() { return Piece!=-1; } protected: int Processor; int Piece; int NumPieces; double Resolution; double Bounds[6]; double PipelinePriority; double ViewPriority; double CachedPriority; friend class vtkPieceList; private: }; #endif
import React from 'react'; import ReadChapterScreen from '../ReadChapterScreen'; export default { title: 'Screen/ReadChapter', component: ReadChapterScreen, }; // !prettier-ignore const chhands = [ { id: 358, order_number: 1, chhand_name_english: 'Dohra', chhand_type_id: 1, chapter_id: 39, created_at: '2020-11-28T03:49:36.000Z', updated_at: null, pauris: [ { id: 2034, number: 1, signature_unicode: '॥੧॥', signature_gs: ']1]', signature_english: '||1||', chhand_id: 358, chapter_id: 39, first_tuk_id: null, last_tuk_id: null, created_at: '2020-11-28T03:49:36.000Z', updated_at: null, tuks: [ { id: 7153, line_number: 1, chhand_id: 358, chhand_type_id: 1, chapter_id: 39, content_unicode: 'ਸਭਿਨਿ ਸੁਨ੍ਯੋ ਗੁਰ ਬਾਕ ਕੋ ਭਏ ਤ੍ਯਾਰ ਸਮੁਦਾਇ ।', content_gs: 'siBin sunÎo gur bwk ko Bey qÎwr smudwie [', english_translation: 'Alright listen up Singh, go and get ready.', content_transliteration_english: 'sabhin sunayo gur baak ko bhe tayaar samudhai |', first_letters: 'ਸਸਗਬਕਭਤਸ', created_at: '2020-11-28T03:49:36.000Z', updated_at: '2020-12-07T00:34:00.000Z', pauri_id: 2034, vishraams: '"[]"', thamkis: '"[]"', }, { id: 7154, line_number: 2, chhand_id: 358, chhand_type_id: 1, chapter_id: 39, content_unicode: 'ਆਯੁਧ ਗਨ ਸਿੰਘਨਿ ਧਰੇ ਹੁਇ ਸਵਧਾਨ ਤਦਾਇ', content_gs: 'AwXuD gn isMGin Dry huie svDwn qdwie', english_translation: 'The Singhs gather their belongs, until they are prepared.', content_transliteration_english: 'aayudh gan si(n)ghan dhare hui savadhaan tadhai', first_letters: 'ਆਗਸਧਹਸਤ', created_at: '2020-11-28T03:49:36.000Z', updated_at: '2020-12-07T00:34:00.000Z', pauri_id: 2034, vishraams: '[]', thamkis: '[]', }, ], }, ], chhand_type: { id: 1, chhand_name_unicode: 'ਦੋਹਰਾ', chhand_name_english: 'Dohra', chhand_name_gs: 'dohrw', created_at: '2020-09-09T03:19:22.000Z', updated_at: null, }, }, { id: 359, order_number: 2, chhand_name_english: 'Chaupai', chhand_type_id: 4, chapter_id: 39, created_at: '2020-11-28T03:49:36.000Z', updated_at: null, pauris: [ { id: 2035, number: 2, signature_unicode: '॥੨॥', signature_gs: ']2]', signature_english: '||2||', chhand_id: 359, chapter_id: 39, first_tuk_id: null, last_tuk_id: null, created_at: '2020-11-28T03:49:36.000Z', updated_at: null, tuks: [ { id: 7155, line_number: 1, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਅਪਨੇ ਅਪਨੇ ਬਂਧਿ ਬਂਧਿ ਭਾਰ ।', content_gs: 'Apny Apny bNiD bNiD Bwr [', content_transliteration_english: 'apane apane ba(n)dh ba(n)dh bhaar |', first_letters: 'ਅਅਬਬਭ', created_at: '2020-11-28T03:49:36.000Z', updated_at: '2020-12-07T00:40:36.000Z', pauri_id: 2035, vishraams: '"[]"', thamkis: '"[]"', }, { id: 7156, line_number: 2, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਸ਼ਸਤ੍ਰ ਧਰੇ ਸਿਰ ਲੀਨਸਿ ਧਾਰਿ ।', content_gs: 'SsqR Dry isr lInis Dwir [', content_transliteration_english: 'shasatr dhare sir leenas dhaar |', first_letters: 'ਸ਼ਧਸਲਧ', created_at: '2020-11-28T03:49:36.000Z', updated_at: '2020-12-07T00:40:36.000Z', pauri_id: 2035, vishraams: '[]', thamkis: '[]', }, { id: 7157, line_number: 3, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਜਿਸ ਕੋ ਸ਼ਕਤਿ ਉਠਾਵਨ ਕੇਰੀ ।', content_gs: 'ijs ko Skiq auTwvn kyrI [', content_transliteration_english: 'jis ko shakat uThaavan keree |', first_letters: 'ਜਕਸ਼ਉਕ', created_at: '2020-11-28T03:49:36.000Z', updated_at: '2020-12-07T00:40:36.000Z', pauri_id: 2035, vishraams: '"[]"', thamkis: '"[]"', }, { id: 7158, line_number: 4, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਸੋ ਤਿਨ ਸੀਸ ਧਰੀ ਤਿਸ ਬੇਰੀ', content_gs: 'so iqn sIs DrI iqs byrI', content_transliteration_english: 'so tin sees dharee tis beree', first_letters: 'ਸਤਸਧਤਬ', created_at: '2020-11-28T03:49:36.000Z', updated_at: '2020-12-07T00:40:36.000Z', pauri_id: 2035, vishraams: '"[]"', thamkis: '"[]"', }, ], }, { id: 2036, number: 3, signature_unicode: '॥੩॥', signature_gs: ']3]', signature_english: '||3||', chhand_id: 359, chapter_id: 39, first_tuk_id: null, last_tuk_id: null, created_at: '2020-11-28T03:49:36.000Z', updated_at: null, tuks: [ { id: 7159, line_number: 1, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਚਾਰ ਘਟੀ ਜਬਿ ਨਿਸਾ ਗੁਜ਼ਾਰੀ ।', content_gs: 'cwr GtI jib insw guzwrI [', content_transliteration_english: 'chaar ghaTee jab nisaa guzaaree |', first_letters: 'ਚਘਜਨਗ', created_at: '2020-11-28T03:49:36.000Z', updated_at: '2020-12-07T00:42:37.000Z', pauri_id: 2036, vishraams: '"[]"', thamkis: '"[]"', }, { id: 7160, line_number: 2, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਨੀਕੇ ਭਈ ਸਭਿਨਿ ਕੀ ਤ੍ਯਾਰੀ ।', content_gs: 'nIky BeI siBin kI qÎwrI [', content_transliteration_english: 'neeke bhiee sabhin kee tayaaree |', first_letters: 'ਨਭਸਕਤ', created_at: '2020-11-28T03:49:36.000Z', updated_at: '2020-12-07T00:42:37.000Z', pauri_id: 2036, vishraams: '"[]"', thamkis: '"[]"', }, { id: 7161, line_number: 3, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਸ਼੍ਰੀ ਮੁਖ ਤੇ ਤਬਿ ਹੁਕਮ ਬਖਾਨਾ ।', content_gs: 'sæRI muK qy qib hukm bKwnw [', content_transliteration_english: 'sree mukh te tab hukam bakhaanaa |', first_letters: 'ਸਮਤਤਹਬ', created_at: '2020-11-28T03:49:36.000Z', updated_at: '2020-12-07T00:42:37.000Z', pauri_id: 2036, vishraams: '[]', thamkis: '[]', }, { id: 7162, line_number: 4, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਕਰੈਂ ਇਕੱਤਰ੍ਰ ਬਿਹੀਰ ਪਿਆਨਾ', content_gs: 'krYN iek`qrR ibhIr ipAwnw', content_transliteration_english: "karai(n) ika'tarr biheer piaanaa", first_letters: 'ਕਇਬਪ', created_at: '2020-11-28T03:49:36.000Z', updated_at: '2020-12-07T00:42:37.000Z', pauri_id: 2036, vishraams: '[]', thamkis: '[]', }, ], }, { id: 2037, number: 4, signature_unicode: '॥੪॥', signature_gs: ']4]', signature_english: '||4||', chhand_id: 359, chapter_id: 39, first_tuk_id: null, last_tuk_id: null, created_at: '2020-11-28T03:49:36.000Z', updated_at: null, tuks: [ { id: 7163, line_number: 1, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਸੁਨਿ ਆਇਸੁ ਕੋ ਨਰ ਚਲਿ ਪਰੇ ।', content_gs: 'suin Awiesu ko nr cil pry [', content_transliteration_english: 'sun aais ko nar chal pare |', first_letters: 'ਸਆਕਨਚਪ', created_at: '2020-11-28T03:49:36.000Z', updated_at: '2020-12-07T00:43:44.000Z', pauri_id: 2037, vishraams: '"[]"', thamkis: '"[]"', }, { id: 7164, line_number: 2, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਦੁਰਗ ਵਹਿਰ ਨਿਕਸੇ ਦੁਖ ਭਰੇ ।', content_gs: 'durg vihr inksy duK Bry [', content_transliteration_english: 'dhurag vahir nikase dhukh bhare |', first_letters: 'ਦਵਨਦਭ', created_at: '2020-11-28T03:49:36.000Z', updated_at: '2020-12-07T00:43:44.000Z', pauri_id: 2037, vishraams: '"[]"', thamkis: '"[]"', }, { id: 7165, line_number: 3, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਪੂਰਬ ਦਿਸ਼ ਕੋ ਮੁਖ ਕਰਿ ਚਲੇ ।', content_gs: 'pUrb idS ko muK kir cly [', content_transliteration_english: 'poorab dhish ko mukh kar chale |', first_letters: 'ਪਦਕਮਕਚ', created_at: '2020-11-28T03:49:36.000Z', updated_at: '2020-12-07T00:43:44.000Z', pauri_id: 2037, vishraams: '"[]"', thamkis: '"[]"', }, { id: 7166, line_number: 4, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਕੋ ਅਗੈ ਕੋ ਪਾਛੈ ਮਿਲੇ', content_gs: 'ko AgY ko pwCY imly', content_transliteration_english: 'ko agai ko paachhai mile', first_letters: 'ਕਅਕਪਮ', created_at: '2020-11-28T03:49:36.000Z', updated_at: '2020-12-07T00:43:44.000Z', pauri_id: 2037, vishraams: '"[]"', thamkis: '"[]"', }, ], }, { id: 2038, number: 5, signature_unicode: '॥੫॥', signature_gs: ']5]', signature_english: '||5||', chhand_id: 359, chapter_id: 39, first_tuk_id: null, last_tuk_id: null, created_at: '2020-11-28T03:49:36.000Z', updated_at: null, tuks: [ { id: 7167, line_number: 1, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਪਹਿਰ ਨਿਸਾ ਬੀਤੀ ਜਿਸ ਕਾਲਾ ।', content_gs: 'pihr insw bIqI ijs kwlw [', content_transliteration_english: 'pahir nisaa beetee jis kaalaa |', first_letters: 'ਪਨਬਜਕ', created_at: '2020-11-28T03:49:36.000Z', updated_at: null, pauri_id: 2038, vishraams: '[]', thamkis: '[]', }, { id: 7168, line_number: 2, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਮਾਤਾ ਤ੍ਯਾਰ ਸਮਾਜ ਸੰਭਾਲਾ ।', content_gs: 'mwqw qÎwr smwj sMBwlw [', content_transliteration_english: 'maataa tayaar samaaj sa(n)bhaalaa |', first_letters: 'ਮਤਸਸ', created_at: '2020-11-28T03:49:36.000Z', updated_at: null, pauri_id: 2038, vishraams: '[]', thamkis: '[]', }, { id: 7169, line_number: 3, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਇਕ ਖੱਚਰ ਪਰ ਲਾਦੀ ਮੁਹਰੈਂ ।', content_gs: 'iek K`cr pr lwdI muhrYN [', content_transliteration_english: "eik kha'char par laadhee muharai(n) |", first_letters: 'ਇਖਪਲਮ', created_at: '2020-11-28T03:49:36.000Z', updated_at: null, pauri_id: 2038, vishraams: '[]', thamkis: '[]', }, { id: 7170, line_number: 4, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਇਕ ਦੁਇ ਦਾਸ ਚਲੇ ਕਰਿ ਮੁਹਰੈ', content_gs: 'iek duie dws cly kir muhrY', content_transliteration_english: 'eik dhui dhaas chale kar muharai', first_letters: 'ਇਦਦਚਕਮ', created_at: '2020-11-28T03:49:36.000Z', updated_at: null, pauri_id: 2038, vishraams: '[]', thamkis: '[]', }, ], }, { id: 2039, number: 6, signature_unicode: '॥੬॥', signature_gs: ']6]', signature_english: '||6||', chhand_id: 359, chapter_id: 39, first_tuk_id: null, last_tuk_id: null, created_at: '2020-11-28T03:49:36.000Z', updated_at: null, tuks: [ { id: 7171, line_number: 1, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਲਘੁ ਪੌਤ੍ਰ ਦੋਨਹੁਂ ਲੇ ਸਾਥ ।', content_gs: 'lGu pOqR donhuN ly swQ [', content_transliteration_english: 'lagh pauatr dhonahu(n) le saath |', first_letters: 'ਲਪਦਲਸ', created_at: '2020-11-28T03:49:36.000Z', updated_at: '2020-12-07T00:46:33.000Z', pauri_id: 2039, vishraams: '[]', thamkis: '[]', }, { id: 7172, line_number: 2, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਸ੍ਯੰਦਨ ਚਢਹੁ ਕਹ੍ਯੋ ਗੁਰ ਨਾਥ ।', content_gs: 'sÎMdn cFhu khÎo gur nwQ [', content_transliteration_english: 'saya(n)dhan chaddahu kahayo gur naath |', first_letters: 'ਸਚਕਗਨ', created_at: '2020-11-28T03:49:36.000Z', updated_at: '2020-12-07T00:46:33.000Z', pauri_id: 2039, vishraams: '"[]"', thamkis: '"[]"', }, { id: 7173, line_number: 3, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਪ੍ਰਥਮ ਅਪਨਿ ਤੇ ਦੁਊ ਚਢਾਏ ।', content_gs: 'pRQm Apin qy duaU cFwey [', content_transliteration_english: 'pratham apan te dhauoo chaddaae |', first_letters: 'ਪਅਤਦਚ', created_at: '2020-11-28T03:49:36.000Z', updated_at: '2020-12-07T00:46:33.000Z', pauri_id: 2039, vishraams: '[]', thamkis: '[]', }, { id: 7174, line_number: 4, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਬਹੁਤ ਚਢੀ ਮਾਤਾ ਸਹਿਸਾਏ', content_gs: 'bhuq cFI mwqw sihswey', content_transliteration_english: 'bahut chaddee maataa sahisaae', first_letters: 'ਬਚਮਸ', created_at: '2020-11-28T03:49:36.000Z', updated_at: '2020-12-07T00:46:33.000Z', pauri_id: 2039, vishraams: '"[]"', thamkis: '"[]"', }, ], }, { id: 2040, number: 7, signature_unicode: '॥੭॥', signature_gs: ']7]', signature_english: '||7||', chhand_id: 359, chapter_id: 39, first_tuk_id: null, last_tuk_id: null, created_at: '2020-11-28T03:49:36.000Z', updated_at: null, tuks: [ { id: 7175, line_number: 1, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਸਤਿਗੁਰ ਮਹਿਲ ਸੁੰਦਰੀ ਮਾਤ ।', content_gs: 'siqgur mihl suMdrI mwq [', content_transliteration_english: 'satigur mahil su(n)dharee maat |', first_letters: 'ਸਮਸਮ', created_at: '2020-11-28T03:49:36.000Z', updated_at: null, pauri_id: 2040, vishraams: '[]', thamkis: '[]', }, { id: 7176, line_number: 2, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਅਰੁ ਸਾਹਿਬ ਦੇਵੀ ਚਿਤ ਸ਼ਾਤ ।', content_gs: 'Aru swihb dyvI icq Swq [', content_transliteration_english: 'ar saahib dhevee chit shaat |', first_letters: 'ਅਸਦਚਸ਼', created_at: '2020-11-28T03:49:36.000Z', updated_at: null, pauri_id: 2040, vishraams: '[]', thamkis: '[]', }, { id: 7177, line_number: 3, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਨਮੋ ਕਰੀ ਗੁਰ ਕੌ ਕਰ ਜੋਰੇ ।', content_gs: 'nmo krI gur kO kr jory [', content_transliteration_english: 'namo karee gur kau kar jore |', first_letters: 'ਨਕਗਕਕਜ', created_at: '2020-11-28T03:49:36.000Z', updated_at: null, pauri_id: 2040, vishraams: '[]', thamkis: '[]', }, { id: 7178, line_number: 4, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਦੋਨਹੁਂ ਤਬਿ ਅਰੂਢਿ ਕਰਿ ਡੋਰੇ', content_gs: 'donhuN qib ArUiF kir fory', content_transliteration_english: 'dhonahu(n) tab aroodd kar ddore', first_letters: 'ਦਤਅਕਡ', created_at: '2020-11-28T03:49:36.000Z', updated_at: null, pauri_id: 2040, vishraams: '[]', thamkis: '[]', }, ], }, { id: 2041, number: 8, signature_unicode: '॥੮॥', signature_gs: ']8]', signature_english: '||8||', chhand_id: 359, chapter_id: 39, first_tuk_id: null, last_tuk_id: null, created_at: '2020-11-28T03:49:36.000Z', updated_at: null, tuks: [ { id: 7179, line_number: 1, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਆਇਸ ਪਾਇ ਨਿਕਸਿ ਕਰਿ ਚਾਲੀ ।', content_gs: 'Awies pwie inkis kir cwlI [', content_transliteration_english: 'aais pai nikas kar chaalee |', first_letters: 'ਆਪਨਕਚ', created_at: '2020-11-28T03:49:36.000Z', updated_at: '2020-12-07T00:49:23.000Z', pauri_id: 2041, vishraams: '"[]"', thamkis: '"[]"', }, { id: 7180, line_number: 2, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਸ਼੍ਯਾਮ ਜਾਮਨੀ ਬਹੁ ਤਮ ਵਾਲੀ ।', content_gs: 'SÎwm jwmnI bhu qm vwlI [', content_transliteration_english: 'shayaam jaamanee bahu tam vaalee |', first_letters: 'ਸ਼ਜਬਤਵ', created_at: '2020-11-28T03:49:36.000Z', updated_at: '2020-12-07T00:49:23.000Z', pauri_id: 2041, vishraams: '"[]"', thamkis: '"[]"', }, { id: 7181, line_number: 3, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਅਪਰ ਜਿ ਨਰ ਨਹਿਂ ਲਰਨੇ ਹਾਰੇ ।', content_gs: 'Apr ij nr niNh lrny hwry [', content_transliteration_english: 'apar j nar nahi(n) larane haare |', first_letters: 'ਅਜਨਨਲਹ', created_at: '2020-11-28T03:49:36.000Z', updated_at: '2020-12-07T00:49:23.000Z', pauri_id: 2041, vishraams: '"[]"', thamkis: '"[]"', }, { id: 7182, line_number: 4, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਸੋ ਮਿਲਿ ਮਿਲਿ ਕਰਿ ਵਹਿਰ ਪਧਾਰੇ', content_gs: 'so imil imil kir vihr pDwry', content_transliteration_english: 'so mil mil kar vahir padhaare', first_letters: 'ਸਮਮਕਵਪ', created_at: '2020-11-28T03:49:36.000Z', updated_at: '2020-12-07T00:49:23.000Z', pauri_id: 2041, vishraams: '"[]"', thamkis: '"[]"', }, ], }, { id: 2042, number: 9, signature_unicode: '॥੯॥', signature_gs: ']9]', signature_english: '||9||', chhand_id: 359, chapter_id: 39, first_tuk_id: null, last_tuk_id: null, created_at: '2020-11-28T03:49:36.000Z', updated_at: null, tuks: [ { id: 7183, line_number: 1, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਗਧੋ ਬਹੀਰ ਉਲਂਘਿ ਕਈ ਕੋਸ ।', content_gs: 'gDo bhIr aulNiG keI kos [', content_transliteration_english: 'gadho baheer ula(n)gh kiee kos |', first_letters: 'ਗਬਉਕਕ', created_at: '2020-11-28T03:49:36.000Z', updated_at: '2020-12-07T00:51:11.000Z', pauri_id: 2042, vishraams: '[]', thamkis: '[]', }, { id: 7184, line_number: 2, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਬੈਠੇ ਸਤਿਗੁਰ ਦੁਰਗ ਸਰੋਸ ।', content_gs: 'bYTy siqgur durg sros [', content_transliteration_english: 'baiThe satigur dhurag saros |', first_letters: 'ਬਸਦਸ', created_at: '2020-11-28T03:49:36.000Z', updated_at: '2020-12-07T00:51:11.000Z', pauri_id: 2042, vishraams: '"[]"', thamkis: '"[]"', }, { id: 7185, line_number: 3, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਸਨੇ ਸਨੇ ਸਭਿ ਕਰਿ ਕਰਿ ਤ੍ਯਾਰ ।', content_gs: 'sny sny siB kir kir qÎwr [', content_transliteration_english: 'sane sane sabh kar kar tayaar |', first_letters: 'ਸਸਸਕਕਤ', created_at: '2020-11-28T03:49:36.000Z', updated_at: '2020-12-07T00:51:11.000Z', pauri_id: 2042, vishraams: '"[]"', thamkis: '"[]"', }, { id: 7186, line_number: 4, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਚਲੇ ਲੋਕ ਸਭਿ ਪੰਥ ਮਝਾਰ', content_gs: 'cly lok siB pMQ mJwr', content_transliteration_english: 'chale lok sabh pa(n)th majhaar', first_letters: 'ਚਲਸਪਮ', created_at: '2020-11-28T03:49:36.000Z', updated_at: '2020-12-07T00:51:11.000Z', pauri_id: 2042, vishraams: '"[]"', thamkis: '"[]"', }, ], }, { id: 2043, number: 10, signature_unicode: '॥੧੦॥', signature_gs: ']10]', signature_english: '||10||', chhand_id: 359, chapter_id: 39, first_tuk_id: null, last_tuk_id: null, created_at: '2020-11-28T03:49:36.000Z', updated_at: null, tuks: [ { id: 7187, line_number: 1, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਸਾਵਧਾਨ ਜੋ ਸ਼ਸਤਰ ਸਮੇਤ ।', content_gs: 'swvDwn jo Ssqr smyq [', content_transliteration_english: 'saavadhaan jo shasatar samet |', first_letters: 'ਸਜਸ਼ਸ', created_at: '2020-11-28T03:49:36.000Z', updated_at: '2020-12-07T00:52:18.000Z', pauri_id: 2043, vishraams: '"[]"', thamkis: '"[]"', }, { id: 7188, line_number: 2, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਰਖੇ ਸਿੰਘ ਢਿਗ ਲਰਿਬੇ ਹੇਤ ।', content_gs: 'rKy isMG iFg lirby hyq [', content_transliteration_english: 'rakhe si(n)gh ddig laribe het |', first_letters: 'ਰਸਢਲਹ', created_at: '2020-11-28T03:49:36.000Z', updated_at: '2020-12-07T00:52:18.000Z', pauri_id: 2043, vishraams: '"[]"', thamkis: '"[]"', }, { id: 7189, line_number: 3, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਡੇਢਕ ਜਾਮ ਜਾਮਨੀ ਗਈ ।', content_gs: 'fyFk jwm jwmnI geI [', content_transliteration_english: 'ddeddak jaam jaamanee giee |', first_letters: 'ਡਜਜਗ', created_at: '2020-11-28T03:49:36.000Z', updated_at: '2020-12-07T00:52:18.000Z', pauri_id: 2043, vishraams: '"[]"', thamkis: '"[]"', }, { id: 7190, line_number: 4, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਤਬਿ ਸਤਿਗੁਰ ਨਿਜ ਤ੍ਯਾਰੀ ਕਈ', content_gs: 'qib siqgur inj qÎwrI keI', content_transliteration_english: 'tab satigur nij tayaaree kiee', first_letters: 'ਤਸਨਤਕ', created_at: '2020-11-28T03:49:36.000Z', updated_at: '2020-12-07T00:52:18.000Z', pauri_id: 2043, vishraams: '"[]"', thamkis: '"[]"', }, ], }, { id: 2044, number: 11, signature_unicode: '॥੧੧॥', signature_gs: ']11]', signature_english: '||11||', chhand_id: 359, chapter_id: 39, first_tuk_id: null, last_tuk_id: null, created_at: '2020-11-28T03:49:36.000Z', updated_at: null, tuks: [ { id: 7191, line_number: 1, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਨਿਕਸੇ ਪ੍ਰਥਮ ਗਏ ਤਿਸ ਜਾਇ ।', content_gs: 'inksy pRQm gey iqs jwie [', content_transliteration_english: 'nikase pratham ge tis jai |', first_letters: 'ਨਪਗਤਜ', created_at: '2020-11-28T03:49:36.000Z', updated_at: '2020-12-07T00:53:58.000Z', pauri_id: 2044, vishraams: '[]', thamkis: '[]', }, { id: 7192, line_number: 2, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਸ਼੍ਰੀ ਗੁਰ ਤੇਗ ਬਹਾਦਰ ਥਾਇ ।', content_gs: 'sæRI gur qyg bhwdr Qwie [', content_transliteration_english: 'sree gur teg bahaadhar thai |', first_letters: 'ਸਗਤਬਥ', created_at: '2020-11-28T03:49:36.000Z', updated_at: '2020-12-07T00:53:58.000Z', pauri_id: 2044, vishraams: '[]', thamkis: '[]', }, { id: 7193, line_number: 3, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਖਰੇ ਹੋਇ ਦਰਬਾਰ ਅਗਾਰੀ ।', content_gs: 'Kry hoie drbwr AgwrI [', content_transliteration_english: 'khare hoi dharabaar agaaree |', first_letters: 'ਖਹਦਅ', created_at: '2020-11-28T03:49:36.000Z', updated_at: '2020-12-07T00:53:58.000Z', pauri_id: 2044, vishraams: '"[]"', thamkis: '"[]"', }, ], }, { id: 2045, number: 12, signature_unicode: '॥੧੨॥', signature_gs: ']12]', signature_english: '||12||', chhand_id: 359, chapter_id: 39, first_tuk_id: null, last_tuk_id: null, created_at: '2020-11-28T03:49:36.000Z', updated_at: null, tuks: [ { id: 7195, line_number: 1, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਬਹੁਰੋ ਊਚੇ ਕੀਨ ਬਖਾਨ ।', content_gs: 'bhuro aUcy kIn bKwn [', content_transliteration_english: 'bahuro uooche keen bakhaan |', first_letters: 'ਬਊਕਬ', created_at: '2020-11-28T03:49:36.000Z', updated_at: '2020-12-07T00:58:26.000Z', pauri_id: 2045, vishraams: '"[]"', thamkis: '"[]"', }, { id: 7196, line_number: 2, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਹੈ ਕੋ ਸਾਧ ਰਹੈ ਇਸ ਥਾਨ ਝਾਰੂ ਦੀਪਕ ਨਿਤ ਪ੍ਰਤਿ ਕਰੈ ।', content_gs: 'hY ko swD rhY ies Qwn JwrU dIpk inq pRiq krY [', content_transliteration_english: 'hai ko saadh rahai is thaan jhaaroo dheepak nit prat karai |', first_letters: 'ਹਕਸਰਇਥਝਦਨਪਕ', created_at: '2020-11-28T03:49:36.000Z', updated_at: '2020-12-07T00:58:26.000Z', pauri_id: 2045, vishraams: '[]', thamkis: '[]', }, { id: 7197, line_number: 3, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਸ਼੍ਰੀ ਗੁਰਦੇਵ ਸੇਵ ਹਿਤ ਧਰੈ', content_gs: 'sæRI gurdyv syv ihq DrY', content_transliteration_english: 'sree gurdhev sev hit dharai', first_letters: 'ਸਗਸਹਧ', created_at: '2020-11-28T03:49:36.000Z', updated_at: '2020-12-07T00:58:26.000Z', pauri_id: 2045, vishraams: '[]', thamkis: '[]', }, ], }, { id: 2046, number: 13, signature_unicode: '॥੧੩॥', signature_gs: ']13]', signature_english: '||13||', chhand_id: 359, chapter_id: 39, first_tuk_id: null, last_tuk_id: null, created_at: '2020-11-28T03:49:36.000Z', updated_at: null, tuks: [ { id: 7198, line_number: 1, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਤੀਨ ਬਾਰਿ ਗੁਰ ਬਚਨ ਉਚਾਰਾ ।', content_gs: 'qIn bwir gur bcn aucwrw [', content_transliteration_english: 'teen baar gur bachan uchaaraa |', first_letters: 'ਤਬਗਬਉ', created_at: '2020-11-28T03:49:36.000Z', updated_at: '2020-12-07T01:14:49.000Z', pauri_id: 2046, vishraams: '"[]"', thamkis: '"[]"', }, { id: 7199, line_number: 2, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਨਹਿਂ ਕੋ ਬੋਲ੍ਯੋ ਡਰ ਉਰ ਧਾਰਾ ।', content_gs: 'niNh ko bolÎo fr aur Dwrw [', content_transliteration_english: 'nahi(n) ko bolayo ddar ur dhaaraa |', first_letters: 'ਨਕਬਡਉਧ', created_at: '2020-11-28T03:49:36.000Z', updated_at: '2020-12-07T01:14:49.000Z', pauri_id: 2046, vishraams: '"[]"', thamkis: '"[]"', }, { id: 7200, line_number: 3, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਅਚਰਜ ਸ੍ਵਾਂਗ ਬਿਸਾਲ ਅਰੰਭੇ ।', content_gs: 'Acrj sÍWg ibswl ArMBy [', content_transliteration_english: 'acharaj savaiaa(n)g bisaal ara(n)bhe |', first_letters: 'ਅਸਬਅ', created_at: '2020-11-28T03:49:36.000Z', updated_at: '2020-12-07T01:14:49.000Z', pauri_id: 2046, vishraams: '[]', thamkis: '[]', }, { id: 7201, line_number: 4, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਰਹੀ ਨ ਧੀਰਜ ਭਏ ਅਚੰਭੇ', content_gs: 'rhI n DIrj Bey AcMBy', content_transliteration_english: 'rahee na dheeraj bhe acha(n)bhe', first_letters: 'ਰਨਧਭਅ', created_at: '2020-11-28T03:49:36.000Z', updated_at: '2020-12-07T01:14:49.000Z', pauri_id: 2046, vishraams: '"[]"', thamkis: '"[]"', }, ], }, { id: 2047, number: 14, signature_unicode: '॥੧੪॥', signature_gs: ']14]', signature_english: '||14||', chhand_id: 359, chapter_id: 39, first_tuk_id: null, last_tuk_id: null, created_at: '2020-11-28T03:49:36.000Z', updated_at: null, tuks: [ { id: 7202, line_number: 1, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਇਕ ਗੁਰਬਖਸ਼ ਸਾਧ ਢਿਗ ਖਰ੍ਯੋ ।', content_gs: 'iek gurbKS swD iFg KrÎo [', content_transliteration_english: 'eik gurbakhash saadh ddig kharayo |', first_letters: 'ਇਗਸਢਖ', created_at: '2020-11-28T03:49:36.000Z', updated_at: '2020-12-07T01:15:58.000Z', pauri_id: 2047, vishraams: '"[]"', thamkis: '"[]"', }, { id: 7203, line_number: 2, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਤਿਸੈ ਬਿਲੋਕਤਿ ਬਾਕ ਉਚਰ੍ਯੋ ।', content_gs: 'iqsY iblokiq bwk aucrÎo [', content_transliteration_english: 'tisai bilokat baak ucharayo |', first_letters: 'ਤਬਬਉ', created_at: '2020-11-28T03:49:36.000Z', updated_at: '2020-12-07T01:15:58.000Z', pauri_id: 2047, vishraams: '"[]"', thamkis: '"[]"', }, { id: 7204, line_number: 3, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਬਸਹੁ ਇਹਾਂ ਤੁਮ ਸੇਵਾ ਕਰੋ ।', content_gs: 'bshu iehW qum syvw kro [', content_transliteration_english: 'basahu ihaa(n) tum sevaa karo |', first_letters: 'ਬਇਤਸਕ', created_at: '2020-11-28T03:49:36.000Z', updated_at: '2020-12-07T01:15:58.000Z', pauri_id: 2047, vishraams: '"[]"', thamkis: '"[]"', }, { id: 7205, line_number: 4, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਕਰਿ ਸੇਵਾ ਨਿਜ ਜਨਮ ਸੁਧਰੋ', content_gs: 'kir syvw inj jnm suDro', content_transliteration_english: 'kar sevaa nij janam sudharo', first_letters: 'ਕਸਨਜਸ', created_at: '2020-11-28T03:49:36.000Z', updated_at: '2020-12-07T01:15:58.000Z', pauri_id: 2047, vishraams: '"[]"', thamkis: '"[]"', }, ], }, { id: 2048, number: 15, signature_unicode: '॥੧੫॥', signature_gs: ']15]', signature_english: '||15||', chhand_id: 359, chapter_id: 39, first_tuk_id: null, last_tuk_id: null, created_at: '2020-11-28T03:49:36.000Z', updated_at: null, tuks: [ { id: 7206, line_number: 1, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਮਹਾਂਦੇਵ ਤਿਸ ਕਾ ਗੁਰ ਬੋਲਾ ।', content_gs: 'mhWdyv iqs kw gur bolw [', content_transliteration_english: 'mahaa(n)dhev tis kaa gur bolaa |', first_letters: 'ਮਤਕਗਬ', created_at: '2020-11-28T03:49:36.000Z', updated_at: '2020-12-07T01:18:03.000Z', pauri_id: 2048, vishraams: '"[]"', thamkis: '"[]"', }, { id: 7207, line_number: 2, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਖਾਇ ਕਹਾਂ ਤੇ ਰਹੈ ਅਡੋਲਾ ਮਹਾਂ ਕੁਮਤਿ ਧਰਿ ਨੀਚ ਪਹਾਰੀ ।', content_gs: 'Kwie khW qy rhY Afolw mhW kumiq Dir nIc phwrI [', content_transliteration_english: 'khai kahaa(n) te rahai addolaa mahaa(n) kumat dhar neech pahaaree |', first_letters: 'ਖਕਤਰਅਮਕਧਨਪ', created_at: '2020-11-28T03:49:36.000Z', updated_at: '2020-12-07T01:18:03.000Z', pauri_id: 2048, vishraams: '"[]"', thamkis: '"[]"', }, { id: 7208, line_number: 3, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਕਰਹਿਂ ਬੈਰ ਪਸ਼ਚਾਤ ਤੁਮਾਰੀ', content_gs: 'krihN bYr pScwq qumwrI', content_transliteration_english: 'karahi(n) bair pashachaat tumaaree', first_letters: 'ਕਬਪਤ', created_at: '2020-11-28T03:49:36.000Z', updated_at: '2020-12-07T01:18:03.000Z', pauri_id: 2048, vishraams: '"[]"', thamkis: '"[]"', }, { id: 11289, line_number: 4, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਕਰਿ ਸੇਵਾ ਨਿਜ ਜਨਮ ਸੁਧਰੋ', content_gs: 'kir syvw inj jnm suDro', content_transliteration_english: 'kar sevaa nij janam sudharo', first_letters: 'ਕਸਨਜਸ', created_at: '2020-12-07T01:18:03.000Z', updated_at: null, pauri_id: 2048, vishraams: '"[]"', thamkis: '"[]"', }, ], }, { id: 2049, number: 16, signature_unicode: '॥੧੬॥', signature_gs: ']16]', signature_english: '||16||', chhand_id: 359, chapter_id: 39, first_tuk_id: null, last_tuk_id: null, created_at: '2020-11-28T03:49:36.000Z', updated_at: null, tuks: [ { id: 7209, line_number: 1, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਭੋਜਨ ਚਹੀਐ ਨਿਤ ਪ੍ਰਤਿ ਖਾਨੇ ।', content_gs: 'Bojn chIAY inq pRiq Kwny [', content_transliteration_english: 'bhojan chaheeaai nit prat khaane |', first_letters: 'ਭਚਨਪਖ', created_at: '2020-11-28T03:49:36.000Z', updated_at: '2020-12-07T01:20:17.000Z', pauri_id: 2049, vishraams: '[]', thamkis: '[]', }, { id: 7210, line_number: 2, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਤੁਮ ਬਿਨ ਹਮ ਕੋ ਕੁਊ ਨ ਜਾਨੇ ।', content_gs: 'qum ibn hm ko kuaU n jwny [', content_transliteration_english: 'tum bin ham ko kauoo na jaane |', first_letters: 'ਤਬਹਕਕਨਜ', created_at: '2020-11-28T03:49:36.000Z', updated_at: '2020-12-07T01:20:17.000Z', pauri_id: 2049, vishraams: '"[]"', thamkis: '"[]"', }, { id: 7211, line_number: 3, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਕਹੈਂ ਕਹਾਂ ਰਾਵਰ ਸਭਿ ਜਾਨੇ ।', content_gs: 'khYN khW rwvr siB jwny [', content_transliteration_english: 'kahai(n) kahaa(n) raavar sabh jaane |', first_letters: 'ਕਕਰਸਜ', created_at: '2020-11-28T03:49:36.000Z', updated_at: '2020-12-07T01:20:17.000Z', pauri_id: 2049, vishraams: '"[]"', thamkis: '"[]"', }, { id: 7212, line_number: 4, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਸੇਵਹਿ ਨਿਤ ਕਰਿ ਦੇਹੁ ਠਿਕਾਨੇ', content_gs: 'syvih inq kir dyhu iTkwny', content_transliteration_english: 'seveh nit kar dheh Thikaane', first_letters: 'ਸਨਕਦਠ', created_at: '2020-11-28T03:49:36.000Z', updated_at: '2020-12-07T01:20:17.000Z', pauri_id: 2049, vishraams: '"[]"', thamkis: '"[]"', }, ], }, { id: 2050, number: 17, signature_unicode: '॥੧੭॥', signature_gs: ']17]', signature_english: '||17||', chhand_id: 359, chapter_id: 39, first_tuk_id: null, last_tuk_id: null, created_at: '2020-11-28T03:49:36.000Z', updated_at: null, tuks: [ { id: 7213, line_number: 1, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਸੁਨਿ ਸ਼੍ਰੀ ਮੁਖਿ ਤੇ ਤਿਸਹਿ ਉਚਾਰਾ ।', content_gs: 'suin sæRI muiK qy iqsih aucwrw [', content_transliteration_english: 'sun sree mukh te tiseh uchaaraa |', first_letters: 'ਸਸਮਤਤਉ', created_at: '2020-11-28T03:49:36.000Z', updated_at: '2020-12-07T01:22:15.000Z', pauri_id: 2050, vishraams: '[]', thamkis: '[]', }, { id: 7214, line_number: 2, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਇਹ ਸਾਚੋ ਹੈ ਗੁਰ ਦਰਬਾਰਾ ।', content_gs: 'ieh swco hY gur drbwrw [', content_transliteration_english: 'eeh saacho hai gur dharabaaraa |', first_letters: 'ਇਸਹਗਦ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-07T01:22:15.000Z', pauri_id: 2050, vishraams: '"[]"', thamkis: '"[]"', }, { id: 7215, line_number: 3, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਅੰਨ ਭਰੀ ਗਾਡੀ ਇਹ ਖਰੀ ।', content_gs: 'AMn BrI gwfI ieh KrI [', content_transliteration_english: 'a(n)n bharee gaaddee ieh kharee |', first_letters: 'ਅਭਗਇਖ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-07T01:22:15.000Z', pauri_id: 2050, vishraams: '"[]"', thamkis: '"[]"', }, { id: 7216, line_number: 4, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਸੋ ਸਂਭਾਰਿ ਰਾਖੋ ਲਿਹੁ ਧਰੀ', content_gs: 'so sNBwir rwKo ilhu DrI', content_transliteration_english: 'so sa(n)bhaar raakho lih dharee', first_letters: 'ਸਸਰਲਧ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-07T01:22:15.000Z', pauri_id: 2050, vishraams: '"[]"', thamkis: '"[]"', }, ], }, { id: 2051, number: 18, signature_unicode: '॥੧੮॥', signature_gs: ']18]', signature_english: '||18||', chhand_id: 359, chapter_id: 39, first_tuk_id: null, last_tuk_id: null, created_at: '2020-11-28T03:49:37.000Z', updated_at: null, tuks: [ { id: 7217, line_number: 1, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਸੰਧ੍ਯਾ ਸਮੈਂ ਸਦਾ ਗੁਰ ਦਰਸ਼ਨ ।', content_gs: 'sMDÎw smYN sdw gur drSn [', content_transliteration_english: 'sa(n)dhayaa samai(n) sadhaa gur dharashan |', first_letters: 'ਸਸਸਗਦ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-07T01:24:06.000Z', pauri_id: 2051, vishraams: '"[]"', thamkis: '"[]"', }, { id: 7218, line_number: 2, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਬਰਤਹਿ ਵਿਚ ਦਿਵਾਨ ਕੇ ਪਰਸਨ ।', content_gs: 'brqih ivc idvwn ky prsn [', content_transliteration_english: 'barateh vich dhivaan ke parasan |', first_letters: 'ਬਵਦਕਪ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-07T01:24:06.000Z', pauri_id: 2051, vishraams: '"[]"', thamkis: '"[]"', }, { id: 7219, line_number: 3, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਕਿਸ ਪ੍ਰਕਾਰ ਹਵੈ ਕਮੀ ਨ ਕਾਈ ।', content_gs: 'iks pRkwr hvY kmI n kweI [', content_transliteration_english: 'kis prakaar havai kamee na kaiee |', first_letters: 'ਕਪਹਕਨਕ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-07T01:24:06.000Z', pauri_id: 2051, vishraams: '[]', thamkis: '[]', }, { id: 7220, line_number: 4, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਨਿਸ ਦਿਨ ਹਮ ਤੁਮ ਹੋਹਿਂ ਸਹਾਈ', content_gs: 'ins idn hm qum hoihN shweI', content_transliteration_english: 'nis dhin ham tum hohi(n) sahaiee', first_letters: 'ਨਦਹਤਹਸ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-07T01:24:06.000Z', pauri_id: 2051, vishraams: '"[]"', thamkis: '"[]"', }, ], }, { id: 2052, number: 19, signature_unicode: '॥੧੯॥', signature_gs: ']19]', signature_english: '||19||', chhand_id: 359, chapter_id: 39, first_tuk_id: null, last_tuk_id: null, created_at: '2020-11-28T03:49:37.000Z', updated_at: null, tuks: [ { id: 7221, line_number: 1, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਨਹਿਂ ਕਿਮ ਗ਼ਮੀ ਕਰਹੁ ਮਨ ਮਾਂਹੀ ।', content_gs: 'niNh ikm ZmI krhu mn mWhI [', content_transliteration_english: 'nahi(n) kim g(h)mee karahu man maa(n)hee |', first_letters: 'ਨਕਗ਼ਕਮਮ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-07T01:25:21.000Z', pauri_id: 2052, vishraams: '"[]"', thamkis: '"[]"', }, { id: 7222, line_number: 2, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਇਸ ਥਲ ਕਮੀ ਹੋਇ ਕਿਮ ਨਾਂਹੀ ।', content_gs: 'ies Ql kmI hoie ikm nWhI [', content_transliteration_english: 'eis thal kamee hoi kim naa(n)hee |', first_letters: 'ਇਥਕਹਕਨ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-07T01:25:21.000Z', pauri_id: 2052, vishraams: '"[]"', thamkis: '"[]"', }, { id: 7223, line_number: 3, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਇੱਤ੍ਯਾਦਿਕ ਕਹਿ ਧੀਰਜ ਦੀਨੀ ।', content_gs: 'ie`qÎwidk kih DIrj dInI [', content_transliteration_english: "ei'tayaadhik keh dheeraj dheenee |", first_letters: 'ਇਕਧਦ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-07T01:25:21.000Z', pauri_id: 2052, vishraams: '"[]"', thamkis: '"[]"', }, { id: 7224, line_number: 4, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਤਬਿ ਤਿਨ ਸੁਨਿ ਪਦ ਬੰਦਨ ਕੀਨੀ', content_gs: 'qib iqn suin pd bMdn kInI', content_transliteration_english: 'tab tin sun padh ba(n)dhan keenee', first_letters: 'ਤਤਸਪਬਕ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-07T01:25:21.000Z', pauri_id: 2052, vishraams: '"[]"', thamkis: '"[]"', }, ], }, { id: 2053, number: 20, signature_unicode: '॥੨੦॥', signature_gs: ']20]', signature_english: '||20||', chhand_id: 359, chapter_id: 39, first_tuk_id: null, last_tuk_id: null, created_at: '2020-11-28T03:49:37.000Z', updated_at: null, tuks: [ { id: 7225, line_number: 1, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਰਹ੍ਯੋ ਧੀਰ ਧਰਿ ਗੁਰ ਬਚ ਮਾਨੇ ।', content_gs: 'rhÎo DIr Dir gur bc mwny [', content_transliteration_english: 'rahayo dheer dhar gur bach maane |', first_letters: 'ਰਧਧਗਬਮ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-07T01:31:06.000Z', pauri_id: 2053, vishraams: '"[]"', thamkis: '"[]"', }, { id: 7226, line_number: 2, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਪ੍ਰਭੂ ਪ੍ਰਕਰਮਾ ਕਰਤਿ ਪਧਾਨੇ ।', content_gs: 'pRBU pRkrmw kriq pDwny [', content_transliteration_english: 'prabhoo prakaramaa karat padhaane |', first_letters: 'ਪਪਕਪ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-07T01:31:06.000Z', pauri_id: 2053, vishraams: '[]', thamkis: '[]', }, { id: 7227, line_number: 3, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਸਜ੍ਯੋ ਤੁਰੰਗਮ ਤਤਛਿਨ ਆਯੋ ।', content_gs: 'sjÎo qurMgm qqiCn AwXo [', content_transliteration_english: 'sajayo tura(n)gam tatachhin aayo |', first_letters: 'ਸਤਤਆ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-07T01:31:06.000Z', pauri_id: 2053, vishraams: '[]', thamkis: '[]', }, { id: 7228, line_number: 4, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਭਏ ਅਰੂਢਨ ਚਲਨੋ ਭਾਯੋ', content_gs: 'Bey ArUFn clno BwXo', content_transliteration_english: 'bhe arooddan chalano bhaayo', first_letters: 'ਭਅਚਭ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-07T01:31:06.000Z', pauri_id: 2053, vishraams: '[]', thamkis: '[]', }, ], }, { id: 2054, number: 21, signature_unicode: '॥੨੧॥', signature_gs: ']21]', signature_english: '||21||', chhand_id: 359, chapter_id: 39, first_tuk_id: null, last_tuk_id: null, created_at: '2020-11-28T03:49:37.000Z', updated_at: null, tuks: [ { id: 7229, line_number: 1, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਦ੍ਯਾ ਸਿੰਘ ਆਲਮ ਸਿੰਘ ਸਾਥ ।', content_gs: 'dÎw isMG Awlm isMG swQ [', content_transliteration_english: 'dhayaa si(n)gh aalam si(n)gh saath |', first_letters: 'ਦਸਆਸਸ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T01:17:39.000Z', pauri_id: 2054, vishraams: '"[]"', thamkis: '"[]"', }, { id: 7230, line_number: 2, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਉਦੈ ਸਿੰਘ ਆਗੈ ਚਲਿ ਨਾਥ ।', content_gs: 'audY isMG AwgY cil nwQ [', content_transliteration_english: 'audhai si(n)gh aagai chal naath |', first_letters: 'ਉਸਆਚਨ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T01:17:39.000Z', pauri_id: 2054, vishraams: '"[]"', thamkis: '"[]"', }, { id: 7231, line_number: 3, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਮੁਕਤੇ ਸਿੰਘ ਬਾਮ ਦਿਸ਼ਿ ਚਲੇ ।', content_gs: 'mukqy isMG bwm idiS cly [', content_transliteration_english: 'mukate si(n)gh baam dhish chale |', first_letters: 'ਮਸਬਦਚ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T01:17:39.000Z', pauri_id: 2054, vishraams: '"[]"', thamkis: '"[]"', }, { id: 7232, line_number: 4, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਮੁਹਕਮ ਸਿੰਘ ਸਾਹਿਬ ਸਿੰਘ ਭਲੇ', content_gs: 'muhkm isMG swihb isMG Bly', content_transliteration_english: 'muhakam si(n)gh saahib si(n)gh bhale', first_letters: 'ਮਸਸਸਭ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T01:17:39.000Z', pauri_id: 2054, vishraams: '"[]"', thamkis: '"[]"', }, ], }, { id: 2055, number: 22, signature_unicode: '॥੨੨॥', signature_gs: ']22]', signature_english: '||22||', chhand_id: 359, chapter_id: 39, first_tuk_id: null, last_tuk_id: null, created_at: '2020-11-28T03:49:37.000Z', updated_at: null, tuks: [ { id: 7233, line_number: 1, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਪ੍ਰਭੁ ਕੇ ਦਾਹਨ ਪਾਸੇ ਹੋਇ ।', content_gs: 'pRBu ky dwhn pwsy hoie [', content_transliteration_english: 'prabh ke dhaahan paase hoi |', first_letters: 'ਪਕਦਪਹ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T01:21:33.000Z', pauri_id: 2055, vishraams: '[]', thamkis: '[]', }, { id: 7234, line_number: 2, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਪੀਛੇ ਚਲੇ ਸਿੰਘ ਸਭਿ ਕੋਇ ।', content_gs: 'pICy cly isMG siB koie [', content_transliteration_english: 'peechhe chale si(n)gh sabh koi |', first_letters: 'ਪਚਸਸਕ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T01:21:33.000Z', pauri_id: 2055, vishraams: '"[]"', thamkis: '"[]"', }, { id: 7235, line_number: 3, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਸਤਿਗੁਰ ਕੋ ਲੇ ਬੀਚ ਪਯਾਨੇ ।', content_gs: 'siqgur ko ly bIc pXwny [', content_transliteration_english: 'satigur ko le beech payaane |', first_letters: 'ਸਕਲਬਪ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T01:21:33.000Z', pauri_id: 2055, vishraams: '[]', thamkis: '[]', }, { id: 7236, line_number: 4, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਚਢ੍ਯੋ ਅਜੀਤ ਸਿੰਘ ਧਨੁ ਪਾਨੇ', content_gs: 'cFÎo AjIq isMG Dnu pwny', content_transliteration_english: 'chaddayo ajeet si(n)gh dhan paane', first_letters: 'ਚਅਸਧਪ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T01:21:33.000Z', pauri_id: 2055, vishraams: '"[]"', thamkis: '"[]"', }, ], }, { id: 2056, number: 23, signature_unicode: '॥੨੩॥', signature_gs: ']23]', signature_english: '||23||', chhand_id: 359, chapter_id: 39, first_tuk_id: null, last_tuk_id: null, created_at: '2020-11-28T03:49:37.000Z', updated_at: null, tuks: [ { id: 7237, line_number: 1, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਜ਼ੋਰਾਵਰ ਸਿੰਘ ਦੂਸਰ ਨੰਦ ।', content_gs: 'zorwvr isMG dUsr nMd [', content_transliteration_english: 'zoraavar si(n)gh dhoosar na(n)dh |', first_letters: 'ਜ਼ਸਦਨ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T01:22:54.000Z', pauri_id: 2056, vishraams: '[]', thamkis: '[]', }, { id: 7238, line_number: 2, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਚਲੇ ਪਿਤਾ ਪਸ਼ਚਾਤ ਅਮੰਦ ।', content_gs: 'cly ipqw pScwq AmMd [', content_transliteration_english: 'chale pitaa pashachaat ama(n)dh |', first_letters: 'ਚਪਪਅ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T01:22:54.000Z', pauri_id: 2056, vishraams: '"[]"', thamkis: '"[]"', }, { id: 7239, line_number: 3, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਹਿੰਮਤ ਸਿੰਘ ਆਦਿਕ ਸਿਖ ਘਨੇ ।', content_gs: 'ihMmq isMG Awidk isK Gny [', content_transliteration_english: 'hi(n)mat si(n)gh aadhik sikh ghane |', first_letters: 'ਹਸਆਸਘ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T01:22:54.000Z', pauri_id: 2056, vishraams: '"[]"', thamkis: '"[]"', }, { id: 7240, line_number: 4, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਧਨੁਖ ਤੁਫੰਗ ਅੰਗ ਧਰਿ ਬਨੇ', content_gs: 'DnuK quPMg AMg Dir bny', content_transliteration_english: 'dhanukh tufa(n)g a(n)g dhar bane', first_letters: 'ਧਤਅਧਬ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T01:22:54.000Z', pauri_id: 2056, vishraams: '"[]"', thamkis: '"[]"', }, ], }, { id: 2057, number: 24, signature_unicode: '॥੨੪॥', signature_gs: ']24]', signature_english: '||24||', chhand_id: 359, chapter_id: 39, first_tuk_id: null, last_tuk_id: null, created_at: '2020-11-28T03:49:37.000Z', updated_at: null, tuks: [ { id: 7241, line_number: 1, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਤੋੜੇ ਸੁਲਗਤਿ ਕਸੇ ਦੁਗਾੜੇ ।', content_gs: 'qoVy sulgiq ksy dugwVy [', content_transliteration_english: 'toRe sulagat kase dhugaaRe |', first_letters: 'ਤਸਕਦ', created_at: '2020-11-28T03:49:37.000Z', updated_at: null, pauri_id: 2057, vishraams: '[]', thamkis: '[]', }, { id: 7242, line_number: 2, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਜੜੇ ਕਲਾ ਪਰ ਮੋੜਤਿ ਝਾੜੇ ।', content_gs: 'jVy klw pr moViq JwVy [', content_transliteration_english: 'jaRe kalaa par moRat jhaaRe |', first_letters: 'ਜਕਪਮਝ', created_at: '2020-11-28T03:49:37.000Z', updated_at: null, pauri_id: 2057, vishraams: '[]', thamkis: '[]', }, { id: 7243, line_number: 3, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਲਈ ਬਰੂਦ ਜਮਾਇ ਪਲੀਤੇ ।', content_gs: 'leI brUd jmwie plIqy [', content_transliteration_english: 'liee baroodh jamai paleete |', first_letters: 'ਲਬਜਪ', created_at: '2020-11-28T03:49:37.000Z', updated_at: null, pauri_id: 2057, vishraams: '[]', thamkis: '[]', }, { id: 7244, line_number: 4, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਕਿਨ ਸਰਪੋਸ ਉਘਾੜਨਿ ਕੀਤੇ', content_gs: 'ikn srpos auGwVin kIqy', content_transliteration_english: 'kin sarapos ughaaRan keete', first_letters: 'ਕਸਉਕ', created_at: '2020-11-28T03:49:37.000Z', updated_at: null, pauri_id: 2057, vishraams: '[]', thamkis: '[]', }, ], }, { id: 2058, number: 25, signature_unicode: '॥੨੫॥', signature_gs: ']25]', signature_english: '||25||', chhand_id: 359, chapter_id: 39, first_tuk_id: null, last_tuk_id: null, created_at: '2020-11-28T03:49:37.000Z', updated_at: null, tuks: [ { id: 7245, line_number: 1, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਕੇਤਿਕ ਖਚਰਨਿ ਤੀਰਨ ਭਾਰ ।', content_gs: 'kyiqk Kcrin qIrn Bwr [', content_transliteration_english: 'ketik khacharan teeran bhaar |', first_letters: 'ਕਖਤਭ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T01:25:05.000Z', pauri_id: 2058, vishraams: '"[]"', thamkis: '"[]"', }, { id: 7246, line_number: 2, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਲਾਦ ਲਈ ਚਾਲੀ ਪ੍ਰਭੁ ਲਾਰ ।', content_gs: 'lwd leI cwlI pRBu lwr [', content_transliteration_english: 'laadh liee chaalee prabh laar |', first_letters: 'ਲਲਚਪਲ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T01:25:05.000Z', pauri_id: 2058, vishraams: '[]', thamkis: '[]', }, { id: 7247, line_number: 3, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਫਨੀਅਰ ਸੇ ਖਪਰੇ ਖਰ ਖਰੇ ।', content_gs: 'PnIAr sy Kpry Kr Kry [', content_transliteration_english: 'faneear se khapare khar khare |', first_letters: 'ਫਸਖਖਖ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T01:25:05.000Z', pauri_id: 2058, vishraams: '"[]"', thamkis: '"[]"', }, { id: 7248, line_number: 4, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਸੇਲੇ ਤੋਮਰ ਸਾਂਗਨਿ ਧਰੇ', content_gs: 'syly qomr sWgin Dry', content_transliteration_english: 'sele tomar saa(n)gan dhare', first_letters: 'ਸਤਸਧ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T01:25:05.000Z', pauri_id: 2058, vishraams: '"[]"', thamkis: '"[]"', }, ], }, { id: 2059, number: 26, signature_unicode: '॥੨੬॥', signature_gs: ']26]', signature_english: '||26||', chhand_id: 359, chapter_id: 39, first_tuk_id: null, last_tuk_id: null, created_at: '2020-11-28T03:49:37.000Z', updated_at: null, tuks: [ { id: 7249, line_number: 1, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਸਨੇ ਸਨੇ ਗਮਨਹਿਂ ਮਗ ਬੀਚ ।', content_gs: 'sny sny gmnihN mg bIc [', content_transliteration_english: 'sane sane gamanahi(n) mag beech |', first_letters: 'ਸਸਗਮਬ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T01:27:07.000Z', pauri_id: 2059, vishraams: '"[]"', thamkis: '"[]"', }, { id: 7250, line_number: 2, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਦੂਰ ਖਰੇ ਪਿਖਿ ਊਚ ਰੁ ਨੀਚ ।', content_gs: 'dUr Kry ipiK aUc ru nIc [', content_transliteration_english: 'dhoor khare pikh uooch r neech |', first_letters: 'ਦਖਪਊਰਨ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T01:27:07.000Z', pauri_id: 2059, vishraams: '"[]"', thamkis: '"[]"', }, { id: 7251, line_number: 3, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਕੇਤਿਕ ਕੋਸ ਪ੍ਰਭੂ ਪ੍ਰਸਥਾਨੇ ।', content_gs: 'kyiqk kos pRBU pRsQwny [', content_transliteration_english: 'ketik kos prabhoo prasathaane |', first_letters: 'ਕਕਪਪ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T01:27:07.000Z', pauri_id: 2059, vishraams: '[]', thamkis: '[]', }, { id: 7252, line_number: 4, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਅੰਧ ਭਏ ਰਿਪੁ ਨਾਂਹਿ ਨ ਜਾਨੇ', content_gs: 'AMD Bey irpu nWih n jwny', content_transliteration_english: 'a(n)dh bhe rip naa(n)h na jaane', first_letters: 'ਅਭਰਨਨਜ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T01:27:07.000Z', pauri_id: 2059, vishraams: '"[]"', thamkis: '"[]"', }, ], }, { id: 2060, number: 27, signature_unicode: '॥੨੭॥', signature_gs: ']27]', signature_english: '||27||', chhand_id: 359, chapter_id: 39, first_tuk_id: null, last_tuk_id: null, created_at: '2020-11-28T03:49:37.000Z', updated_at: null, tuks: [ { id: 7253, line_number: 1, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਕਰਹਿਂ ਪ੍ਰਤੀਖਨ ਨਿਕਸਹਿਂ ਜਬੈ ।', content_gs: 'krihN pRqIKn inksihN jbY [', content_transliteration_english: 'karahi(n) prateekhan nikasahi(n) jabai |', first_letters: 'ਕਪਨਜ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T01:28:41.000Z', pauri_id: 2060, vishraams: '[]', thamkis: '[]', }, { id: 7254, line_number: 2, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਘੇਰਿ ਗੁਰੂ ਕੋ ਗਹਿ ਲਿਹੁ ਤਬੈ ।', content_gs: 'Gyir gurU ko gih ilhu qbY [', content_transliteration_english: 'gher guroo ko geh lih tabai |', first_letters: 'ਘਗਕਗਲਤ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T01:28:41.000Z', pauri_id: 2060, vishraams: '"[]"', thamkis: '"[]"', }, { id: 7255, line_number: 3, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਰਾਮ ਘਨੌਲੇ ਲਗਿ ਚਲਿ ਆਏ ।', content_gs: 'rwm GnOly lig cil Awey [', content_transliteration_english: 'raam ghanauale lag chal aae |', first_letters: 'ਰਘਲਚਆ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T01:28:41.000Z', pauri_id: 2060, vishraams: '"[]"', thamkis: '"[]"', }, { id: 7256, line_number: 4, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਸਿੰਘ ਪੰਚ ਸੈ ਗੋਲ ਬਨਾਏ', content_gs: 'isMG pMc sY gol bnwey', content_transliteration_english: 'si(n)gh pa(n)ch sai gol banaae', first_letters: 'ਸਪਸਗਬ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T01:28:41.000Z', pauri_id: 2060, vishraams: '"[]"', thamkis: '"[]"', }, ], }, { id: 2061, number: 28, signature_unicode: '॥੨੮॥', signature_gs: ']28]', signature_english: '||28||', chhand_id: 359, chapter_id: 39, first_tuk_id: null, last_tuk_id: null, created_at: '2020-11-28T03:49:37.000Z', updated_at: null, tuks: [ { id: 7257, line_number: 1, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਦੁਰਜਨ ਖਰੇ ਰਹੇ ਪਸ਼ਚਾਤੀ ।', content_gs: 'durjn Kry rhy pScwqI [', content_transliteration_english: 'dhurajan khare rahe pashachaatee |', first_letters: 'ਦਖਰਪ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T01:29:30.000Z', pauri_id: 2061, vishraams: '"[]"', thamkis: '"[]"', }, { id: 7258, line_number: 2, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਕਰਿ ਅਨੁਮਾਨ ਸਕਲ ਸੁਧਿ ਜਾਤੀ ।', content_gs: 'kir Anumwn skl suiD jwqI [', content_transliteration_english: 'kar anumaan sakal sudh jaatee |', first_letters: 'ਕਅਸਸਜ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T01:29:30.000Z', pauri_id: 2061, vishraams: '"[]"', thamkis: '"[]"', }, { id: 7259, line_number: 3, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਗੁਰੂ ਦੁਰਗ ਮਹਿਂ ਅਬਿ ਥਿਰ ਨਾਂਹੀ ।', content_gs: 'gurU durg mihN Aib iQr nWhI [', content_transliteration_english: 'guroo dhurag mahi(n) ab thir naa(n)hee |', first_letters: 'ਗਦਮਅਥਨ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T01:29:30.000Z', pauri_id: 2061, vishraams: '"[]"', thamkis: '"[]"', }, { id: 7260, line_number: 4, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਰੌਰਾ ਨਹਿਂ ਲਖੀਅਤਿ ਦਿਸ਼ ਤਾਂਹੀ', content_gs: 'rOrw nihN lKIAiq idS qWhI', content_transliteration_english: 'rauaraa nahi(n) lakheeat dhish taa(n)hee', first_letters: 'ਰਨਲਦਤ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T01:29:30.000Z', pauri_id: 2061, vishraams: '"[]"', thamkis: '"[]"', }, ], }, { id: 2062, number: 29, signature_unicode: '॥੨੯॥', signature_gs: ']29]', signature_english: '||29||', chhand_id: 359, chapter_id: 39, first_tuk_id: null, last_tuk_id: null, created_at: '2020-11-28T03:49:37.000Z', updated_at: null, tuks: [ { id: 7261, line_number: 1, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਜਾਨ੍ਯੋਂ ਪਰੈ ਅਗਾਰੀ ਗਏ ।', content_gs: 'jwnÎoN prY AgwrI gey [', content_transliteration_english: 'jaanayo(n) parai agaaree ge |', first_letters: 'ਜਪਅਗ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T01:30:09.000Z', pauri_id: 2062, vishraams: '"[]"', thamkis: '"[]"', }, { id: 7262, line_number: 2, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਮਾਰਗ ਦੂਰ ਉਲਘਤਿ ਭਏ ।', content_gs: 'mwrg dUr aulGiq Bey [', content_transliteration_english: 'maarag dhoor ulaghat bhe |', first_letters: 'ਮਦਉਭ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T01:30:09.000Z', pauri_id: 2062, vishraams: '"[]"', thamkis: '"[]"', }, { id: 7263, line_number: 3, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਇਮ ਲਖਿ ਕਰਿ ਅਸਵਾਰ ਧਵਾਏ ।', content_gs: 'iem liK kir Asvwr Dvwey [', content_transliteration_english: 'eim lakh kar asavaar dhavaae |', first_letters: 'ਇਲਕਅਧ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T01:30:09.000Z', pauri_id: 2062, vishraams: '"[]"', thamkis: '"[]"', }, { id: 7264, line_number: 4, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਸੂਨ ਪਰ੍ਯੋ ਗਢ ਦੇਖ੍ਯੋ ਜਾਏ', content_gs: 'sUn prÎo gF dyKÎo jwey', content_transliteration_english: 'soon parayo gadd dhekhayo jaae', first_letters: 'ਸਪਗਦਜ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T01:30:09.000Z', pauri_id: 2062, vishraams: '"[]"', thamkis: '"[]"', }, ], }, { id: 2063, number: 30, signature_unicode: '॥੩੦॥', signature_gs: ']30]', signature_english: '||30||', chhand_id: 359, chapter_id: 39, first_tuk_id: null, last_tuk_id: null, created_at: '2020-11-28T03:49:37.000Z', updated_at: null, tuks: [ { id: 7265, line_number: 1, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਤਬਿ ਖ੍ਵਾਜਾ ਮਰਦੂਦ ਗ਼ੁਲਾਮ ।', content_gs: 'qib KÍwjw mrdUd Zulwm [', content_transliteration_english: 'tab khavaiaajaa maradhoodh g(h)ulaam |', first_letters: 'ਤਖਮਗ਼', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T01:31:27.000Z', pauri_id: 2063, vishraams: '[]', thamkis: '[]', }, { id: 7266, line_number: 2, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਰਿਸਿ ਬੋਲ੍ਯੋ ਦਲ ਸੰਗ ਤਮਾਮ ।', content_gs: 'iris bolÎo dl sMg qmwm [', content_transliteration_english: 'ris bolayo dhal sa(n)g tamaam |', first_letters: 'ਰਬਦਸਤ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T01:31:27.000Z', pauri_id: 2063, vishraams: '"[]"', thamkis: '"[]"', }, { id: 7267, line_number: 3, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਘੇਰਹੁ ਅੱਗ੍ਰ ਜਾਇ ਕਰਿ ਐਸੇ ।', content_gs: 'Gyrhu A`gR jwie kir AYsy [', content_transliteration_english: "gherahu a'gr jai kar aaise |", first_letters: 'ਘਅਜਕਐ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T01:31:27.000Z', pauri_id: 2063, vishraams: '[]', thamkis: '[]', }, { id: 7268, line_number: 4, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਜਿਸ ਤੇ ਨਿਕਸਿ ਜਾਇ ਨਹਿਂ ਕੈਸੇ', content_gs: 'ijs qy inkis jwie nihN kYsy', content_transliteration_english: 'jis te nikas jai nahi(n) kaise', first_letters: 'ਜਤਨਜਨਕ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T01:31:27.000Z', pauri_id: 2063, vishraams: '"[]"', thamkis: '"[]"', }, ], }, { id: 2064, number: 31, signature_unicode: '॥੩੧॥', signature_gs: ']31]', signature_english: '||31||', chhand_id: 359, chapter_id: 39, first_tuk_id: null, last_tuk_id: null, created_at: '2020-11-28T03:49:37.000Z', updated_at: null, tuks: [ { id: 7269, line_number: 1, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਜਥੇਦਾਰ ਸਰਦਾਰ ਘਨੇਰੇ ।', content_gs: 'jQydwr srdwr Gnyry [', content_transliteration_english: 'jathedhaar saradhaar ghanere |', first_letters: 'ਜਸਘ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T01:34:40.000Z', pauri_id: 2064, vishraams: '"[]"', thamkis: '"[]"', }, { id: 7270, line_number: 2, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਕਰਿ ਕਰਿ ਕ੍ਰੁੱਧਤਿ ਸਗਰੇ ਪ੍ਰਰੇ ।', content_gs: 'kir kir kRü`Diq sgry pRry [', content_transliteration_english: "kar kar kru'dhat sagare prare |", first_letters: 'ਕਕਕਸਪ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T01:34:40.000Z', pauri_id: 2064, vishraams: '[]', thamkis: '[]', }, { id: 7271, line_number: 3, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਭੀਮਚੰਦ ਕੋ ਭਾਖਿ ਪਠਾਯੋ ।', content_gs: 'BImcMd ko BwiK pTwXo [', content_transliteration_english: 'bheemacha(n)dh ko bhaakh paThaayo |', first_letters: 'ਭਕਭਪ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T01:34:40.000Z', pauri_id: 2064, vishraams: '[]', thamkis: '[]', }, { id: 7272, line_number: 4, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਤੈਂ ਅਪਨੋ ਦਲ ਕ੍ਯੋਂ ਅਟਕਾਯੋ', content_gs: 'qYN Apno dl kÎoN AtkwXo', content_transliteration_english: 'tai(n) apano dhal kayo(n) aTakaayo', first_letters: 'ਤਅਦਕਅ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T01:34:40.000Z', pauri_id: 2064, vishraams: '[]', thamkis: '[]', }, ], }, { id: 2065, number: 32, signature_unicode: '॥੩੨॥', signature_gs: ']32]', signature_english: '||32||', chhand_id: 359, chapter_id: 39, first_tuk_id: null, last_tuk_id: null, created_at: '2020-11-28T03:49:37.000Z', updated_at: null, tuks: [ { id: 7273, line_number: 1, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਪ੍ਰੇਰਹੁ ਸਭਿ ਪਰਬਤ ਕੀ ਸੈਨਾ ।', content_gs: 'pRyrhu siB prbq kI sYnw [', content_transliteration_english: 'prerahu sabh parabat kee sainaa |', first_letters: 'ਪਸਪਕਸ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T01:47:56.000Z', pauri_id: 2065, vishraams: '[]', thamkis: '[]', }, { id: 7274, line_number: 2, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਘੇਰਹਿ ਜਾਇ ਗਹੈ ਪਿਖਿ ਨੈਨਾ ।', content_gs: 'Gyrih jwie ghY ipiK nYnw [', content_transliteration_english: 'ghereh jai gahai pikh nainaa |', first_letters: 'ਘਜਗਪਨ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T01:47:56.000Z', pauri_id: 2065, vishraams: '"[]"', thamkis: '"[]"', }, { id: 7275, line_number: 3, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਖਾਨ ਵਜੀਦ ਸਿਰ੍ੰਦੀ ਧਾ੍ਯੋ ।', content_gs: 'Kwn vjId isrHMdI DwÎo [', content_transliteration_english: 'khaan vajeedh siradhee dhaayo |', first_letters: 'ਖਵਸਧ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T01:47:56.000Z', pauri_id: 2065, vishraams: '[]', thamkis: '[]', }, { id: 7276, line_number: 4, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਲਾਖਹੁਂ ਲਸ਼ਕਰ ਲੇ ਉਮਡਾ੍ਯੋ', content_gs: 'lwKhuN lSkr ly aumfwÎo', content_transliteration_english: 'laakhahu(n) lashakar le umaddaayo', first_letters: 'ਲਲਲਉ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T01:47:56.000Z', pauri_id: 2065, vishraams: '"[]"', thamkis: '"[]"', }, ], }, { id: 2066, number: 33, signature_unicode: '॥੩੩॥', signature_gs: ']33]', signature_english: '||33||', chhand_id: 359, chapter_id: 39, first_tuk_id: null, last_tuk_id: null, created_at: '2020-11-28T03:49:37.000Z', updated_at: null, tuks: [ { id: 7277, line_number: 1, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਜ਼ੇਰਦਸਤ ਸੂਬਾ ਲਵਪੁਰਿ ਕੋ ।', content_gs: 'zyrdsq sUbw lvpuir ko [', content_transliteration_english: 'zeradhasat soobaa lavapur ko |', first_letters: 'ਜ਼ਸਲਕ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T01:49:59.000Z', pauri_id: 2066, vishraams: '"[]"', thamkis: '"[]"', }, { id: 7278, line_number: 2, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਦੌਰ ਚਲ੍ਯੋ ਪਕਰਨਿ ਸ਼੍ਰੀ ਗੁਰ ਕੋ ।', content_gs: 'dOr clÎo pkrin sæRI gur ko [', content_transliteration_english: 'dhauar chalayo pakaran sree gur ko |', first_letters: 'ਦਚਪਸਗਕ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T01:49:59.000Z', pauri_id: 2066, vishraams: '[]', thamkis: '[]', }, { id: 7279, line_number: 3, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਬੇਸ਼ੁਮਾਰ ਜਿਮ ਨਿਸ ਅੰਧ੍ਯਾਰੀ ।', content_gs: 'bySumwr ijm ins AMDÎwrI [', content_transliteration_english: 'beshumaar jim nis a(n)dhayaaree |', first_letters: 'ਬਜਨਅ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T01:49:59.000Z', pauri_id: 2066, vishraams: '"[]"', thamkis: '"[]"', }, { id: 7280, line_number: 4, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਸੈਨਾ ਉਮਡੀ ਸਭਿ ਇਕਵਾਰੀ', content_gs: 'sYnw aumfI siB iekvwrI', content_transliteration_english: 'sainaa umaddee sabh ikavaaree', first_letters: 'ਸਉਸਇ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T01:49:59.000Z', pauri_id: 2066, vishraams: '"[]"', thamkis: '"[]"', }, ], }, { id: 2067, number: 34, signature_unicode: '॥੩੪॥', signature_gs: ']34]', signature_english: '||34||', chhand_id: 359, chapter_id: 39, first_tuk_id: null, last_tuk_id: null, created_at: '2020-11-28T03:49:37.000Z', updated_at: null, tuks: [ { id: 7281, line_number: 1, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਗੁਰ ਸੂਰਜ ਕੋ ਪਕਰਨ ਹੇਤ ।', content_gs: 'gur sUrj ko pkrn hyq [', content_transliteration_english: 'gur sooraj ko pakaran het |', first_letters: 'ਗਸਕਪਹ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T01:54:58.000Z', pauri_id: 2067, vishraams: '"[]"', thamkis: '"[]"', }, { id: 7282, line_number: 2, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਗਹਿ ਗਹਿ ਆਯੁਧ ਉਮਡੇ ਖੇਤ ।', content_gs: 'gih gih AwXuD aumfy Kyq [', content_transliteration_english: 'geh geh aayudh umadde khet |', first_letters: 'ਗਗਆਉਖ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T01:54:58.000Z', pauri_id: 2067, vishraams: '[]', thamkis: '[]', }, { id: 7283, line_number: 3, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਕੋ ਆਗੈ ਕੋਊ ਪਸ਼ਚਾਤ ।', content_gs: 'ko AwgY koaU pScwq [', content_transliteration_english: 'ko aagai kouoo pashachaat |', first_letters: 'ਕਆਕਪ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T01:54:58.000Z', pauri_id: 2067, vishraams: '"[]"', thamkis: '"[]"', }, { id: 7284, line_number: 4, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਦੌਰਤਿ ਜਾਤਿ ਗਿਰੈ ਕੋ ਖਾਤ', content_gs: 'dOriq jwiq igrY ko Kwq', content_transliteration_english: 'dhauarat jaat girai ko khaat', first_letters: 'ਦਜਗਕਖ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T01:54:58.000Z', pauri_id: 2067, vishraams: '"[]"', thamkis: '"[]"', }, ], }, { id: 2068, number: 35, signature_unicode: '॥੩੫॥', signature_gs: ']35]', signature_english: '||35||', chhand_id: 359, chapter_id: 39, first_tuk_id: null, last_tuk_id: null, created_at: '2020-11-28T03:49:37.000Z', updated_at: null, tuks: [ { id: 7285, line_number: 1, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਕਿਤਿਕ ਪਰਸਪਰ ਲਗਹਿਂ ਧਕੇਲੇ ।', content_gs: 'ikiqk prspr lgihN Dkyly [', content_transliteration_english: 'kitik parasapar lagahi(n) dhakele |', first_letters: 'ਕਪਲਧ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T02:15:34.000Z', pauri_id: 2068, vishraams: '"[]"', thamkis: '"[]"', }, { id: 7286, line_number: 2, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਬਾਜੀ ਲਰਤਿ ਸਊਰਨਿ ਮੇਲੇ ।', content_gs: 'bwjI lriq saUrin myly [', content_transliteration_english: 'baajee larat suooran mele |', first_letters: 'ਬਲਸਮ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T02:15:34.000Z', pauri_id: 2068, vishraams: '"[]"', thamkis: '"[]"', }, { id: 7287, line_number: 3, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਕਰਿ ਤੂਰਨਤਾ ਪਹੁਂਚੇ ਆਇ ।', content_gs: 'kir qUrnqw phuNcy Awie [', content_transliteration_english: 'kar tooranataa pahu(n)che aai |', first_letters: 'ਕਤਪਆ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T02:15:34.000Z', pauri_id: 2068, vishraams: '"[]"', thamkis: '"[]"', }, { id: 7288, line_number: 4, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਸਿੰਘਨ ਕੋ ਪੀਛੇ ਜਹਿਂ ਜਾਇ', content_gs: 'isMGn ko pICy jihN jwie', content_transliteration_english: 'si(n)ghan ko peechhe jahi(n) jai', first_letters: 'ਸਕਪਜਜ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T02:15:34.000Z', pauri_id: 2068, vishraams: '"[]"', thamkis: '"[]"', }, ], }, { id: 2069, number: 36, signature_unicode: '॥੩੬॥', signature_gs: ']36]', signature_english: '||36||', chhand_id: 359, chapter_id: 39, first_tuk_id: null, last_tuk_id: null, created_at: '2020-11-28T03:49:37.000Z', updated_at: null, tuks: [ { id: 7289, line_number: 1, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਸੁਨਿ ਕੈ ਸ਼ਬਦ ਹਟਾਵਨ ਕਰੇ ।', content_gs: 'suin kY Sbd htwvn kry [', content_transliteration_english: 'sun kai shabadh haTaavan kare |', first_letters: 'ਸਕਸ਼ਹਕ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T02:18:04.000Z', pauri_id: 2069, vishraams: '"[]"', thamkis: '"[]"', }, { id: 7290, line_number: 2, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਕੌਨ ਅਹੋ ਤੁਮ ਰਹੀਅਹਿ ਖਰੇ ਦੁਇ ਦਿਸ਼ ਦੁਸ਼ਮਨ ਜਾਨੇ ਗਏ ।', content_gs: 'kOn Aho qum rhIAih Kry diue idS duSmn jwny gey [', content_transliteration_english: "kauan aho tum rahe'eeh khare dhui dhish dhushaman jaane ge |", first_letters: 'ਕਅਤਰਖਦਦਦਜਗ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T02:18:04.000Z', pauri_id: 2069, vishraams: '"[]"', thamkis: '"[]"', }, { id: 7291, line_number: 3, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਸ਼ਸਤ੍ਰਰਨਿ ਗਹਿ ਸੁਚੇਤ ਸਭਿ ਭਏ', content_gs: 'SsqRrin gih sucyq siB Bey', content_transliteration_english: 'shasatraran geh suchet sabh bhe', first_letters: 'ਸ਼ਗਸਸਭ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T02:18:04.000Z', pauri_id: 2069, vishraams: '[]', thamkis: '[]', }, ], }, { id: 2070, number: 37, signature_unicode: '॥੩੭॥', signature_gs: ']37]', signature_english: '||37||', chhand_id: 359, chapter_id: 39, first_tuk_id: null, last_tuk_id: null, created_at: '2020-11-28T03:49:37.000Z', updated_at: null, tuks: [ { id: 7292, line_number: 1, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਜ੍ਵਾਲਾ ਬਮਣੀ ਦੁਸ਼ਟਨਿ ਦਮਣੀ ।', content_gs: 'jÍwlw bmxI duStin dmxI [', content_transliteration_english: 'javaiaalaa bamanee dhushaTan dhamanee |', first_letters: 'ਜਬਦਦ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T02:19:20.000Z', pauri_id: 2070, vishraams: '[]', thamkis: '[]', }, { id: 7293, line_number: 2, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਛੁਟਨਿ ਲਗੀ ਸਨਮੁਖ ਰਿਪੁ ਸ਼ਮਣੀ ।', content_gs: 'Cutin lgI snmuK irpu SmxI [', content_transliteration_english: 'chhuTan lagee sanamukh rip shamanee |', first_letters: 'ਛਲਸਰਸ਼', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T02:19:20.000Z', pauri_id: 2070, vishraams: '"[]"', thamkis: '"[]"', }, { id: 7294, line_number: 3, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਦਗ਼ਾ ਕਰ੍ਯੋ ਮਿਲਿ ਤੁਰਕ ਪਹਾਰੀ ।', content_gs: 'dZw krÎo imil qurk phwrI [', content_transliteration_english: 'dhag(h)aa karayo mil turak pahaaree |', first_letters: 'ਦਕਮਤਪ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T02:19:20.000Z', pauri_id: 2070, vishraams: '"[]"', thamkis: '"[]"', }, { id: 7295, line_number: 4, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਤਬਿ ਜਾਨੀ ਸਿੰਘਨਿ ਸੁਧਿ ਸਾਰੀ', content_gs: 'qib jwnI isMGin suiD swrI', content_transliteration_english: 'tab jaanee si(n)ghan sudh saaree', first_letters: 'ਤਜਸਸਸ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T02:19:20.000Z', pauri_id: 2070, vishraams: '"[]"', thamkis: '"[]"', }, ], }, { id: 2071, number: 38, signature_unicode: '॥੩੮॥', signature_gs: ']38]', signature_english: '||38||', chhand_id: 359, chapter_id: 39, first_tuk_id: null, last_tuk_id: null, created_at: '2020-11-28T03:49:37.000Z', updated_at: null, tuks: [ { id: 7296, line_number: 1, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਇਸੀ ਹੇਤੁ ਸਤਿਗੁਰੂ ਹਟਾਵਤਿ ।', content_gs: 'iesI hyqu siqgurU htwviq [', content_transliteration_english: 'eisee het satiguroo haTaavat |', first_letters: 'ਇਹਸਹ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T02:20:16.000Z', pauri_id: 2071, vishraams: '"[]"', thamkis: '"[]"', }, { id: 7297, line_number: 2, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਸਮੁਝਿ ਸਿੰਘ ਸਭਿ ਚਿਤ ਪਛੁਤਾਵਤਿ ।', content_gs: 'smuiJ isMG siB icq pCuqwviq [', content_transliteration_english: 'samujh si(n)gh sabh chit pachhutaavat |', first_letters: 'ਸਸਸਚਪ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T02:20:16.000Z', pauri_id: 2071, vishraams: '"[]"', thamkis: '"[]"', }, { id: 7298, line_number: 3, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਅਬਿ ਕ੍ਯਾ ਹੋਇ ਛੋਰਿ ਗਢ ਧਾਏ ।', content_gs: 'Aib kÎw hoie Coir gF Dwey [', content_transliteration_english: 'ab kayaa hoi chhor gadd dhaae |', first_letters: 'ਅਕਹਛਗਧ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T02:20:16.000Z', pauri_id: 2071, vishraams: '"[]"', thamkis: '"[]"', }, { id: 7299, line_number: 4, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਲਰਿਬੇ ਸਨਮੁਖ ਹੀ ਬਨਿ ਆਏ', content_gs: 'lirby snmuK hI bin Awey', content_transliteration_english: 'laribe sanamukh hee ban aae', first_letters: 'ਲਸਹਬਆ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T02:20:16.000Z', pauri_id: 2071, vishraams: '"[]"', thamkis: '"[]"', }, ], }, { id: 2072, number: 39, signature_unicode: '॥੩੯॥', signature_gs: ']39]', signature_english: '||39||', chhand_id: 359, chapter_id: 39, first_tuk_id: null, last_tuk_id: null, created_at: '2020-11-28T03:49:37.000Z', updated_at: null, tuks: [ { id: 7300, line_number: 1, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਸ਼੍ਰੀ ਗੁਰ ਕਿਤਿਕ ਦੂਰ ਚਲਿ ਆਗੇ ।', content_gs: 'sæRI gur ikiqk dUr cil Awgy [', content_transliteration_english: 'sree gur kitik dhoor chal aage |', first_letters: 'ਸਗਕਦਚਆ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T02:22:52.000Z', pauri_id: 2072, vishraams: '[]', thamkis: '[]', }, { id: 7301, line_number: 2, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਖਰੇ ਅਜੀਤ ਸਿੰਘ ਰਿਸ ਜਾਗੇ ।', content_gs: 'Kry AjIq isMG irs jwgy [', content_transliteration_english: 'khare ajeet si(n)gh ris jaage |', first_letters: 'ਖਅਸਰਜ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T02:22:52.000Z', pauri_id: 2072, vishraams: '"[]"', thamkis: '"[]"', }, { id: 7302, line_number: 3, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਤੁਰਕਨਿ ਅਨੀ ਕਿ ਮੁਗ਼ਲ ਪਠਾਨਾ ।', content_gs: 'qurkin AnI ik muZl pTwnw [', content_transliteration_english: 'turakan anee k mug(h)l paThaanaa |', first_letters: 'ਤਅਕਮਪ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T02:22:52.000Z', pauri_id: 2072, vishraams: '"[]"', thamkis: '"[]"', }, { id: 7303, line_number: 4, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਘਿਰੇ ਆਨਿ ਕਰਿ ਆਯੁਧ ਪਾਨਾ', content_gs: 'iGry Awin kir AwXuD pwnw', content_transliteration_english: 'ghire aan kar aayudh paanaa', first_letters: 'ਘਆਕਆਪ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T02:22:52.000Z', pauri_id: 2072, vishraams: '[]', thamkis: '[]', }, ], }, { id: 2073, number: 40, signature_unicode: '॥੪੦॥', signature_gs: ']40]', signature_english: '||40||', chhand_id: 359, chapter_id: 39, first_tuk_id: null, last_tuk_id: null, created_at: '2020-11-28T03:49:37.000Z', updated_at: null, tuks: [ { id: 7304, line_number: 1, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਛੁਟੇ ਤੜਾਭੜ ਤੁਪਕ ਤੜਾਕੇ ।', content_gs: 'Cuty qVwBV qupk qVwky [', content_transliteration_english: 'chhuTe taRaabhaR tupak taRaake |', first_letters: 'ਛਤਤਤ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T02:24:31.000Z', pauri_id: 2073, vishraams: '"[]"', thamkis: '"[]"', }, { id: 7305, line_number: 2, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਮਿਲੇ ਬੀਰ ਢਿਗ ਅਧਿਕ ਲੜਾਕੇ ।', content_gs: 'imly bIr iFg AiDk lVwky [', content_transliteration_english: 'mile beer ddig adhik laRaake |', first_letters: 'ਮਬਢਅਲ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T02:24:31.000Z', pauri_id: 2073, vishraams: '"[]"', thamkis: '"[]"', }, { id: 7306, line_number: 3, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਸ਼੍ਯਾਮ ਤਿਮਰ ਮਹਿਂ ਧੁਖੇ ਪਲੀਤੇ ।', content_gs: 'SÎwm iqmr mihN DuKy plIqy [', content_transliteration_english: 'shayaam timar mahi(n) dhukhe paleete |', first_letters: 'ਸ਼ਤਮਧਪ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T02:24:31.000Z', pauri_id: 2073, vishraams: '"[]"', thamkis: '"[]"', }, { id: 7307, line_number: 4, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਚਮਕਹਿਂ ਬਹੁ ਪ੍ਰਕਾਸ਼ ਕੌ ਕੀਤੇ', content_gs: 'cmkihN bhu pRkwS kO kIqy', content_transliteration_english: 'chamakahi(n) bahu prakaash kau keete', first_letters: 'ਚਬਪਕਕ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T02:24:31.000Z', pauri_id: 2073, vishraams: '[]', thamkis: '[]', }, ], }, { id: 2074, number: 41, signature_unicode: '॥੪੧॥', signature_gs: ']41]', signature_english: '||41||', chhand_id: 359, chapter_id: 39, first_tuk_id: null, last_tuk_id: null, created_at: '2020-11-28T03:49:37.000Z', updated_at: null, tuks: [ { id: 7308, line_number: 1, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਜਿਮ ਖੱਦ੍ਯੋਤਨਿ ਕੋ ਸਮੁਦਾਈ ।', content_gs: 'ijm K`dÎoqin ko smudweI [', content_transliteration_english: "jim kha'dhayotan ko samudhaiee |", first_letters: 'ਜਖਕਸ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T02:25:06.000Z', pauri_id: 2074, vishraams: '"[]"', thamkis: '"[]"', }, { id: 7309, line_number: 2, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਚਮਕਤਿ ਹੈ ਇਸ ਬਿਧਿ ਦਮਕਾਈ ।', content_gs: 'cmkiq hY ies ibiD dmkweI [', content_transliteration_english: 'chamakat hai is bidh dhamakaiee |', first_letters: 'ਚਹਇਬਦ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T02:25:06.000Z', pauri_id: 2074, vishraams: '"[]"', thamkis: '"[]"', }, { id: 7310, line_number: 3, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਸ਼ਬਦ ਹੋਤਿ ਜਿਮ ਗਾਜਤਿ ਗਾਜ ।', content_gs: 'Sbd hoiq ijm gwjiq gwj [', content_transliteration_english: 'shabadh hot jim gaajat gaaj |', first_letters: 'ਸ਼ਹਜਗਗ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T02:25:06.000Z', pauri_id: 2074, vishraams: '"[]"', thamkis: '"[]"', }, { id: 7311, line_number: 4, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਸੈਲ ਟੋਲ ਪਰ ਭਟ ਤਰੁ ਸਾਜ', content_gs: 'sYl tol pr Bt qru swj', content_transliteration_english: 'sail Tol par bhaT tar saaj', first_letters: 'ਸਟਪਭਤਸ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T02:25:06.000Z', pauri_id: 2074, vishraams: '"[]"', thamkis: '"[]"', }, ], }, { id: 2075, number: 42, signature_unicode: '॥੪੨॥', signature_gs: ']42]', signature_english: '||42||', chhand_id: 359, chapter_id: 39, first_tuk_id: null, last_tuk_id: null, created_at: '2020-11-28T03:49:37.000Z', updated_at: null, tuks: [ { id: 7312, line_number: 1, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਦੂਰ ਦੂਰ ਲਗਿ ਸ਼ਬਦ ਸੁਨਤੇ ।', content_gs: 'dUr dUr lig Sbd sunqy [', content_transliteration_english: 'dhoor dhoor lag shabadh sunate |', first_letters: 'ਦਦਲਸ਼ਸ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T21:33:12.000Z', pauri_id: 2075, vishraams: '"[]"', thamkis: '"[]"', }, { id: 7313, line_number: 2, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਗੁਲਕਾ ਸ਼ੂਕਤਿ ਛੁਟੈਂ ਤੁਰੰਤੇ ।', content_gs: 'gulkw SUkiq CutYN qurMqy [', content_transliteration_english: 'gulakaa shookat chhuTai(n) tura(n)te |', first_letters: 'ਗਸ਼ਛਤ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T21:33:12.000Z', pauri_id: 2075, vishraams: '"[]"', thamkis: '"[]"', }, { id: 7314, line_number: 3, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਚਮੂੰ ਤੁਰਕ ਕੀ ਚੜਿਹ ਕਰਿ ਆਈ ।', content_gs: 'cmUM qurk kI ciVh kir AweI [', content_transliteration_english: 'chamoo(n) turak kee chaReh kar aaiee |', first_letters: 'ਚਤਕਚਕਆ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T21:33:12.000Z', pauri_id: 2075, vishraams: '"[]"', thamkis: '"[]"', }, { id: 7315, line_number: 4, chhand_id: 359, chhand_type_id: 4, chapter_id: 39, content_unicode: 'ਤ੍ਰਰਾਸਹਿਂ ਦੂਰ ਦੂਰ ਥਿਰਤਾਈ', content_gs: 'qRrwsihN dUr dUr iQrqweI', content_transliteration_english: 'traraasahi(n) dhoor dhoor thirataiee', first_letters: 'ਤਦਦਥ', created_at: '2020-11-28T03:49:37.000Z', updated_at: '2020-12-09T21:33:12.000Z', pauri_id: 2075, vishraams: '[]', thamkis: '[]', }, ], }, ], chhand_type: { id: 4, chhand_name_unicode: 'ਚੌਪਈ', chhand_name_english: 'Chaupai', chhand_name_gs: 'cOpeI', created_at: '2020-09-24T01:06:53.000Z', updated_at: null, }, }, ]; const chapter31 = { id: 1, number: 31, gurmukhiScript: 'AnMdpur CoVnw', translationName: 'Leaving Anandpur', }; export const ReadChapter31 = () => ( <> <ReadChapterScreen chhands={chhands} chapter={chapter31} /> </> );
<gh_stars>100-1000 /*********************************************************************************************************************** * OpenStudio(R), Copyright (c) 2008-2021, Alliance for Sustainable Energy, LLC, and other contributors. All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the * following conditions are met: * * (1) Redistributions of source code must retain the above copyright notice, this list of conditions and the following * disclaimer. * * (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided with the distribution. * * (3) Neither the name of the copyright holder nor the names of any contributors may be used to endorse or promote products * derived from this software without specific prior written permission from the respective party. * * (4) Other than as required in clauses (1) and (2), distributions in any form of modifications or other derivative works * may not use the "OpenStudio" trademark, "OS", "os", or any other confusingly similar designation without specific prior * written permission from Alliance for Sustainable Energy, LLC. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE UNITED STATES GOVERNMENT, OR THE UNITED * STATES DEPARTMENT OF ENERGY, NOR ANY OF THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ***********************************************************************************************************************/ #include "ZoneVentilationDesignFlowRate.hpp" #include "ZoneVentilationDesignFlowRate_Impl.hpp" #include "Schedule.hpp" #include "Schedule_Impl.hpp" #include "ThermalZone.hpp" #include "ThermalZone_Impl.hpp" #include "Model.hpp" #include "ZoneHVACEquipmentList.hpp" #include "ZoneHVACEquipmentList_Impl.hpp" #include "ScheduleTypeLimits.hpp" #include "ScheduleTypeRegistry.hpp" #include <utilities/idd/IddFactory.hxx> #include <utilities/idd/IddEnums.hxx> #include <utilities/idd/OS_ZoneVentilation_DesignFlowRate_FieldEnums.hxx> #include "../utilities/units/Unit.hpp" #include "../utilities/core/Assert.hpp" namespace openstudio { namespace model { namespace detail { ZoneVentilationDesignFlowRate_Impl::ZoneVentilationDesignFlowRate_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle) : ZoneHVACComponent_Impl(idfObject, model, keepHandle) { OS_ASSERT(idfObject.iddObject().type() == ZoneVentilationDesignFlowRate::iddObjectType()); } ZoneVentilationDesignFlowRate_Impl::ZoneVentilationDesignFlowRate_Impl(const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, bool keepHandle) : ZoneHVACComponent_Impl(other, model, keepHandle) { OS_ASSERT(other.iddObject().type() == ZoneVentilationDesignFlowRate::iddObjectType()); } ZoneVentilationDesignFlowRate_Impl::ZoneVentilationDesignFlowRate_Impl(const ZoneVentilationDesignFlowRate_Impl& other, Model_Impl* model, bool keepHandle) : ZoneHVACComponent_Impl(other, model, keepHandle) {} const std::vector<std::string>& ZoneVentilationDesignFlowRate_Impl::outputVariableNames() const { static const std::vector<std::string> result; // Not appropriate: all variables reported at the zone level //result.push_back("Zone Ventilation Sensible Heat Loss Energy"); //result.push_back("Zone Ventilation Sensible Heat Gain Energy"); //result.push_back("Zone Ventilation Latent Heat Loss Energy"); //result.push_back("Zone Ventilation Latent Heat Gain Energy"); //result.push_back("Zone Ventilation Total Heat Loss Energy"); //result.push_back("Zone Ventilation Total Heat Gain Energy"); //result.push_back("Zone Ventilation Current Density Volume Flow Rate"); //result.push_back("Zone Ventilation Standard Density Volume Flow Rate"); //result.push_back("Zone Ventilation Current Density Volume"); //result.push_back("Zone Ventilation Standard Density Volume"); //result.push_back("Zone Ventilation Mass"); //result.push_back("Zone Ventilation Mass Flow Rate"); //result.push_back("Zone Ventilation Air Change Rate"); //result.push_back("Zone Ventilation Fan Electricity Energy"); //result.push_back("Zone Ventilation Air Inlet Temperature"); return result; } IddObjectType ZoneVentilationDesignFlowRate_Impl::iddObjectType() const { return ZoneVentilationDesignFlowRate::iddObjectType(); } std::vector<ScheduleTypeKey> ZoneVentilationDesignFlowRate_Impl::getScheduleTypeKeys(const Schedule& schedule) const { std::vector<ScheduleTypeKey> result; UnsignedVector fieldIndices = getSourceIndices(schedule.handle()); UnsignedVector::const_iterator b(fieldIndices.begin()), e(fieldIndices.end()); if (std::find(b, e, OS_ZoneVentilation_DesignFlowRateFields::ScheduleName) != e) { result.push_back(ScheduleTypeKey("ZoneVentilationDesignFlowRate", "Zone Ventilation Design Flow Rate")); } if (std::find(b, e, OS_ZoneVentilation_DesignFlowRateFields::MinimumIndoorTemperatureScheduleName) != e) { result.push_back(ScheduleTypeKey("ZoneVentilationDesignFlowRate", "Minimum Indoor Temperature")); } if (std::find(b, e, OS_ZoneVentilation_DesignFlowRateFields::MaximumIndoorTemperatureScheduleName) != e) { result.push_back(ScheduleTypeKey("ZoneVentilationDesignFlowRate", "Maximum Indoor Temperature")); } if (std::find(b, e, OS_ZoneVentilation_DesignFlowRateFields::DeltaTemperatureScheduleName) != e) { result.push_back(ScheduleTypeKey("ZoneVentilationDesignFlowRate", "Delta Temperature")); } if (std::find(b, e, OS_ZoneVentilation_DesignFlowRateFields::MinimumOutdoorTemperatureScheduleName) != e) { result.push_back(ScheduleTypeKey("ZoneVentilationDesignFlowRate", "Minimum Outdoor Temperature")); } if (std::find(b, e, OS_ZoneVentilation_DesignFlowRateFields::MaximumOutdoorTemperatureScheduleName) != e) { result.push_back(ScheduleTypeKey("ZoneVentilationDesignFlowRate", "Maximum Outdoor Temperature")); } return result; } Schedule ZoneVentilationDesignFlowRate_Impl::schedule() const { boost::optional<Schedule> value = optionalSchedule(); if (!value) { LOG_AND_THROW(briefDescription() << " does not have an Schedule attached."); } return value.get(); } std::string ZoneVentilationDesignFlowRate_Impl::designFlowRateCalculationMethod() const { boost::optional<std::string> value = getString(OS_ZoneVentilation_DesignFlowRateFields::DesignFlowRateCalculationMethod, true); OS_ASSERT(value); return value.get(); } double ZoneVentilationDesignFlowRate_Impl::designFlowRate() const { boost::optional<double> value = getDouble(OS_ZoneVentilation_DesignFlowRateFields::DesignFlowRate, true); OS_ASSERT(value); return value.get(); } double ZoneVentilationDesignFlowRate_Impl::flowRateperZoneFloorArea() const { boost::optional<double> value = getDouble(OS_ZoneVentilation_DesignFlowRateFields::FlowRateperZoneFloorArea, true); OS_ASSERT(value); return value.get(); } double ZoneVentilationDesignFlowRate_Impl::flowRateperPerson() const { auto value = getDouble(OS_ZoneVentilation_DesignFlowRateFields::FlowRateperPerson, true); OS_ASSERT(value); return value.get(); } double ZoneVentilationDesignFlowRate_Impl::airChangesperHour() const { boost::optional<double> value = getDouble(OS_ZoneVentilation_DesignFlowRateFields::AirChangesperHour, true); OS_ASSERT(value); return value.get(); } std::string ZoneVentilationDesignFlowRate_Impl::ventilationType() const { boost::optional<std::string> value = getString(OS_ZoneVentilation_DesignFlowRateFields::VentilationType, true); OS_ASSERT(value); return value.get(); } double ZoneVentilationDesignFlowRate_Impl::fanPressureRise() const { boost::optional<double> value = getDouble(OS_ZoneVentilation_DesignFlowRateFields::FanPressureRise, true); OS_ASSERT(value); return value.get(); } double ZoneVentilationDesignFlowRate_Impl::fanTotalEfficiency() const { boost::optional<double> value = getDouble(OS_ZoneVentilation_DesignFlowRateFields::FanTotalEfficiency, true); OS_ASSERT(value); return value.get(); } double ZoneVentilationDesignFlowRate_Impl::constantTermCoefficient() const { boost::optional<double> value = getDouble(OS_ZoneVentilation_DesignFlowRateFields::ConstantTermCoefficient, true); OS_ASSERT(value); return value.get(); } double ZoneVentilationDesignFlowRate_Impl::temperatureTermCoefficient() const { boost::optional<double> value = getDouble(OS_ZoneVentilation_DesignFlowRateFields::TemperatureTermCoefficient, true); OS_ASSERT(value); return value.get(); } double ZoneVentilationDesignFlowRate_Impl::velocityTermCoefficient() const { boost::optional<double> value = getDouble(OS_ZoneVentilation_DesignFlowRateFields::VelocityTermCoefficient, true); OS_ASSERT(value); return value.get(); } double ZoneVentilationDesignFlowRate_Impl::velocitySquaredTermCoefficient() const { boost::optional<double> value = getDouble(OS_ZoneVentilation_DesignFlowRateFields::VelocitySquaredTermCoefficient, true); OS_ASSERT(value); return value.get(); } double ZoneVentilationDesignFlowRate_Impl::minimumIndoorTemperature() const { boost::optional<double> value = getDouble(OS_ZoneVentilation_DesignFlowRateFields::MinimumIndoorTemperature, true); OS_ASSERT(value); return value.get(); } boost::optional<Schedule> ZoneVentilationDesignFlowRate_Impl::minimumIndoorTemperatureSchedule() const { return getObject<ModelObject>().getModelObjectTarget<Schedule>(OS_ZoneVentilation_DesignFlowRateFields::MinimumIndoorTemperatureScheduleName); } double ZoneVentilationDesignFlowRate_Impl::maximumIndoorTemperature() const { boost::optional<double> value = getDouble(OS_ZoneVentilation_DesignFlowRateFields::MaximumIndoorTemperature, true); OS_ASSERT(value); return value.get(); } boost::optional<Schedule> ZoneVentilationDesignFlowRate_Impl::maximumIndoorTemperatureSchedule() const { return getObject<ModelObject>().getModelObjectTarget<Schedule>(OS_ZoneVentilation_DesignFlowRateFields::MaximumIndoorTemperatureScheduleName); } double ZoneVentilationDesignFlowRate_Impl::deltaTemperature() const { boost::optional<double> value = getDouble(OS_ZoneVentilation_DesignFlowRateFields::DeltaTemperature, true); OS_ASSERT(value); return value.get(); } boost::optional<Schedule> ZoneVentilationDesignFlowRate_Impl::deltaTemperatureSchedule() const { return getObject<ModelObject>().getModelObjectTarget<Schedule>(OS_ZoneVentilation_DesignFlowRateFields::DeltaTemperatureScheduleName); } double ZoneVentilationDesignFlowRate_Impl::minimumOutdoorTemperature() const { boost::optional<double> value = getDouble(OS_ZoneVentilation_DesignFlowRateFields::MinimumOutdoorTemperature, true); OS_ASSERT(value); return value.get(); } boost::optional<Schedule> ZoneVentilationDesignFlowRate_Impl::minimumOutdoorTemperatureSchedule() const { return getObject<ModelObject>().getModelObjectTarget<Schedule>(OS_ZoneVentilation_DesignFlowRateFields::MinimumOutdoorTemperatureScheduleName); } double ZoneVentilationDesignFlowRate_Impl::maximumOutdoorTemperature() const { boost::optional<double> value = getDouble(OS_ZoneVentilation_DesignFlowRateFields::MaximumOutdoorTemperature, true); OS_ASSERT(value); return value.get(); } boost::optional<Schedule> ZoneVentilationDesignFlowRate_Impl::maximumOutdoorTemperatureSchedule() const { return getObject<ModelObject>().getModelObjectTarget<Schedule>(OS_ZoneVentilation_DesignFlowRateFields::MaximumOutdoorTemperatureScheduleName); } double ZoneVentilationDesignFlowRate_Impl::maximumWindSpeed() const { boost::optional<double> value = getDouble(OS_ZoneVentilation_DesignFlowRateFields::MaximumWindSpeed, true); OS_ASSERT(value); return value.get(); } bool ZoneVentilationDesignFlowRate_Impl::setSchedule(Schedule& schedule) { bool result = ModelObject_Impl::setSchedule(OS_ZoneVentilation_DesignFlowRateFields::ScheduleName, "ZoneVentilationDesignFlowRate", "Zone Ventilation Design Flow Rate", schedule); return result; } bool ZoneVentilationDesignFlowRate_Impl::setDesignFlowRateCalculationMethod(std::string designFlowRateCalculationMethod) { LOG(Warn, "ZoneVentilationDesignFlowRate::setDesignFlowRateCalculationMethod has been deprecated and will be removed in a future release, the design " "flow rate calculation method is set during the call to setDesignFlowRate, setFlowRateperZoneFloorArea, setAirChangesperHour, etc"); bool result = setString(OS_ZoneVentilation_DesignFlowRateFields::DesignFlowRateCalculationMethod, designFlowRateCalculationMethod); return result; } bool ZoneVentilationDesignFlowRate_Impl::setDesignFlowRate(double designFlowRate) { bool result = true; if (designFlowRate < 0) { result = false; } else { // This is the only case where it could really fail, if the user passed NaN/Inf result = setDouble(OS_ZoneVentilation_DesignFlowRateFields::DesignFlowRate, designFlowRate); if (result) { result = setString(OS_ZoneVentilation_DesignFlowRateFields::DesignFlowRateCalculationMethod, "Flow/Zone"); OS_ASSERT(result); result = setDouble(OS_ZoneVentilation_DesignFlowRateFields::FlowRateperZoneFloorArea, 0.0); OS_ASSERT(result); result = setDouble(OS_ZoneVentilation_DesignFlowRateFields::FlowRateperPerson, 0.0); OS_ASSERT(result); result = setDouble(OS_ZoneVentilation_DesignFlowRateFields::AirChangesperHour, 0.0); OS_ASSERT(result); } } return result; } bool ZoneVentilationDesignFlowRate_Impl::setFlowRateperZoneFloorArea(double flowRateperZoneFloorArea) { bool result = true; if (flowRateperZoneFloorArea < 0) { result = false; } else { result = setDouble(OS_ZoneVentilation_DesignFlowRateFields::FlowRateperZoneFloorArea, flowRateperZoneFloorArea); if (result) { result = setString(OS_ZoneVentilation_DesignFlowRateFields::DesignFlowRateCalculationMethod, "Flow/Area"); OS_ASSERT(result); result = setDouble(OS_ZoneVentilation_DesignFlowRateFields::DesignFlowRate, 0.0); OS_ASSERT(result); result = setDouble(OS_ZoneVentilation_DesignFlowRateFields::FlowRateperPerson, 0.0); OS_ASSERT(result); result = setDouble(OS_ZoneVentilation_DesignFlowRateFields::AirChangesperHour, 0.0); OS_ASSERT(result); } } return result; } bool ZoneVentilationDesignFlowRate_Impl::setFlowRateperPerson(double flowRateperPerson) { bool result = true; if (flowRateperPerson < 0) { result = false; } else { result = setDouble(OS_ZoneVentilation_DesignFlowRateFields::FlowRateperPerson, flowRateperPerson); if (result) { result = setString(OS_ZoneVentilation_DesignFlowRateFields::DesignFlowRateCalculationMethod, "Flow/Person"); OS_ASSERT(result); result = setDouble(OS_ZoneVentilation_DesignFlowRateFields::DesignFlowRate, 0.0); OS_ASSERT(result); result = setDouble(OS_ZoneVentilation_DesignFlowRateFields::FlowRateperZoneFloorArea, 0.0); OS_ASSERT(result); result = setDouble(OS_ZoneVentilation_DesignFlowRateFields::AirChangesperHour, 0.0); OS_ASSERT(result); } } return result; } bool ZoneVentilationDesignFlowRate_Impl::setAirChangesperHour(double airChangesperHour) { bool result = true; if (airChangesperHour < 0) { result = false; } else { result = setDouble(OS_ZoneVentilation_DesignFlowRateFields::AirChangesperHour, airChangesperHour); if (result) { result = setString(OS_ZoneVentilation_DesignFlowRateFields::DesignFlowRateCalculationMethod, "AirChanges/Hour"); OS_ASSERT(result); result = setDouble(OS_ZoneVentilation_DesignFlowRateFields::DesignFlowRate, 0.0); OS_ASSERT(result); result = setDouble(OS_ZoneVentilation_DesignFlowRateFields::FlowRateperZoneFloorArea, 0.0); OS_ASSERT(result); result = setDouble(OS_ZoneVentilation_DesignFlowRateFields::FlowRateperPerson, 0.0); OS_ASSERT(result); } } return result; } bool ZoneVentilationDesignFlowRate_Impl::setVentilationType(std::string ventilationType) { bool result = setString(OS_ZoneVentilation_DesignFlowRateFields::VentilationType, ventilationType); return result; } bool ZoneVentilationDesignFlowRate_Impl::setFanPressureRise(double fanPressureRise) { bool result = setDouble(OS_ZoneVentilation_DesignFlowRateFields::FanPressureRise, fanPressureRise); return result; } bool ZoneVentilationDesignFlowRate_Impl::setFanTotalEfficiency(double fanTotalEfficiency) { bool result = setDouble(OS_ZoneVentilation_DesignFlowRateFields::FanTotalEfficiency, fanTotalEfficiency); return result; } bool ZoneVentilationDesignFlowRate_Impl::setConstantTermCoefficient(double constantTermCoefficient) { bool result = setDouble(OS_ZoneVentilation_DesignFlowRateFields::ConstantTermCoefficient, constantTermCoefficient); OS_ASSERT(result); return result; } bool ZoneVentilationDesignFlowRate_Impl::setTemperatureTermCoefficient(double temperatureTermCoefficient) { bool result = setDouble(OS_ZoneVentilation_DesignFlowRateFields::TemperatureTermCoefficient, temperatureTermCoefficient); OS_ASSERT(result); return result; } bool ZoneVentilationDesignFlowRate_Impl::setVelocityTermCoefficient(double velocityTermCoefficient) { bool result = setDouble(OS_ZoneVentilation_DesignFlowRateFields::VelocityTermCoefficient, velocityTermCoefficient); OS_ASSERT(result); return result; } bool ZoneVentilationDesignFlowRate_Impl::setVelocitySquaredTermCoefficient(double velocitySquaredTermCoefficient) { bool result = setDouble(OS_ZoneVentilation_DesignFlowRateFields::VelocitySquaredTermCoefficient, velocitySquaredTermCoefficient); OS_ASSERT(result); return result; } bool ZoneVentilationDesignFlowRate_Impl::setMinimumIndoorTemperature(double minimumIndoorTemperature) { bool result = setDouble(OS_ZoneVentilation_DesignFlowRateFields::MinimumIndoorTemperature, minimumIndoorTemperature); return result; } bool ZoneVentilationDesignFlowRate_Impl::setMinimumIndoorTemperatureSchedule(Schedule& schedule) { bool result = ModelObject_Impl::setSchedule(OS_ZoneVentilation_DesignFlowRateFields::MinimumIndoorTemperatureScheduleName, "ZoneVentilationDesignFlowRate", "Minimum Indoor Temperature", schedule); return result; } void ZoneVentilationDesignFlowRate_Impl::resetMinimumIndoorTemperatureSchedule() { bool result = setString(OS_ZoneVentilation_DesignFlowRateFields::MinimumIndoorTemperatureScheduleName, ""); OS_ASSERT(result); } bool ZoneVentilationDesignFlowRate_Impl::setMaximumIndoorTemperature(double maximumIndoorTemperature) { bool result = setDouble(OS_ZoneVentilation_DesignFlowRateFields::MaximumIndoorTemperature, maximumIndoorTemperature); return result; } bool ZoneVentilationDesignFlowRate_Impl::setMaximumIndoorTemperatureSchedule(Schedule& schedule) { bool result = ModelObject_Impl::setSchedule(OS_ZoneVentilation_DesignFlowRateFields::MaximumIndoorTemperatureScheduleName, "ZoneVentilationDesignFlowRate", "Maximum Indoor Temperature", schedule); return result; } void ZoneVentilationDesignFlowRate_Impl::resetMaximumIndoorTemperatureSchedule() { bool result = setString(OS_ZoneVentilation_DesignFlowRateFields::MaximumIndoorTemperatureScheduleName, ""); OS_ASSERT(result); } bool ZoneVentilationDesignFlowRate_Impl::setDeltaTemperature(double deltaTemperature) { bool result = setDouble(OS_ZoneVentilation_DesignFlowRateFields::DeltaTemperature, deltaTemperature); return result; } bool ZoneVentilationDesignFlowRate_Impl::setDeltaTemperatureSchedule(Schedule& schedule) { bool result = ModelObject_Impl::setSchedule(OS_ZoneVentilation_DesignFlowRateFields::DeltaTemperatureScheduleName, "ZoneVentilationDesignFlowRate", "Delta Temperature", schedule); return result; } void ZoneVentilationDesignFlowRate_Impl::resetDeltaTemperatureSchedule() { bool result = setString(OS_ZoneVentilation_DesignFlowRateFields::DeltaTemperatureScheduleName, ""); OS_ASSERT(result); } bool ZoneVentilationDesignFlowRate_Impl::setMinimumOutdoorTemperature(double minimumOutdoorTemperature) { bool result = setDouble(OS_ZoneVentilation_DesignFlowRateFields::MinimumOutdoorTemperature, minimumOutdoorTemperature); return result; } bool ZoneVentilationDesignFlowRate_Impl::setMinimumOutdoorTemperatureSchedule(Schedule& schedule) { bool result = ModelObject_Impl::setSchedule(OS_ZoneVentilation_DesignFlowRateFields::MinimumOutdoorTemperatureScheduleName, "ZoneVentilationDesignFlowRate", "Minimum Outdoor Temperature", schedule); return result; } void ZoneVentilationDesignFlowRate_Impl::resetMinimumOutdoorTemperatureSchedule() { bool result = setString(OS_ZoneVentilation_DesignFlowRateFields::MinimumOutdoorTemperatureScheduleName, ""); OS_ASSERT(result); } bool ZoneVentilationDesignFlowRate_Impl::setMaximumOutdoorTemperature(double maximumOutdoorTemperature) { bool result = setDouble(OS_ZoneVentilation_DesignFlowRateFields::MaximumOutdoorTemperature, maximumOutdoorTemperature); return result; } bool ZoneVentilationDesignFlowRate_Impl::setMaximumOutdoorTemperatureSchedule(Schedule& schedule) { bool result = ModelObject_Impl::setSchedule(OS_ZoneVentilation_DesignFlowRateFields::MaximumOutdoorTemperatureScheduleName, "ZoneVentilationDesignFlowRate", "Maximum Outdoor Temperature", schedule); return result; } void ZoneVentilationDesignFlowRate_Impl::resetMaximumOutdoorTemperatureSchedule() { bool result = setString(OS_ZoneVentilation_DesignFlowRateFields::MaximumOutdoorTemperatureScheduleName, ""); OS_ASSERT(result); } bool ZoneVentilationDesignFlowRate_Impl::setMaximumWindSpeed(double maximumWindSpeed) { bool result = setDouble(OS_ZoneVentilation_DesignFlowRateFields::MaximumWindSpeed, maximumWindSpeed); return result; } boost::optional<Schedule> ZoneVentilationDesignFlowRate_Impl::optionalSchedule() const { return getObject<ModelObject>().getModelObjectTarget<Schedule>(OS_ZoneVentilation_DesignFlowRateFields::ScheduleName); } unsigned ZoneVentilationDesignFlowRate_Impl::inletPort() const { return 0; // this object has no inlet or outlet node } unsigned ZoneVentilationDesignFlowRate_Impl::outletPort() const { return 0; // this object has no inlet or outlet node } boost::optional<ThermalZone> ZoneVentilationDesignFlowRate_Impl::thermalZone() const { ModelObject thisObject = this->getObject<ModelObject>(); std::vector<ThermalZone> thermalZones = this->model().getConcreteModelObjects<ThermalZone>(); for (const auto& thermalZone : thermalZones) { std::vector<ModelObject> equipment = thermalZone.equipment(); if (std::find(equipment.begin(), equipment.end(), thisObject) != equipment.end()) { return thermalZone; } } return boost::none; } bool ZoneVentilationDesignFlowRate_Impl::addToThermalZone(ThermalZone& thermalZone) { Model m = this->model(); if (thermalZone.model() != m) { return false; } if (thermalZone.isPlenum()) { return false; } removeFromThermalZone(); thermalZone.addEquipment(this->getObject<ZoneHVACComponent>()); return true; } void ZoneVentilationDesignFlowRate_Impl::removeFromThermalZone() { if (boost::optional<ThermalZone> thermalZone = this->thermalZone()) { thermalZone->removeEquipment(this->getObject<ZoneHVACComponent>()); } } std::vector<EMSActuatorNames> ZoneVentilationDesignFlowRate_Impl::emsActuatorNames() const { std::vector<EMSActuatorNames> actuators{{"Zone Ventilation", "Air Exchange Flow Rate"}}; return actuators; } std::vector<std::string> ZoneVentilationDesignFlowRate_Impl::emsInternalVariableNames() const { std::vector<std::string> types; return types; } } // namespace detail ZoneVentilationDesignFlowRate::ZoneVentilationDesignFlowRate(const Model& model) : ZoneHVACComponent(ZoneVentilationDesignFlowRate::iddObjectType(), model) { OS_ASSERT(getImpl<detail::ZoneVentilationDesignFlowRate_Impl>()); { auto schedule = model.alwaysOnDiscreteSchedule(); setSchedule(schedule); } // This automatically switches the Calculation Method to "AirChanges/Hour" setAirChangesperHour(5.0); setVentilationType("Natural"); setFanPressureRise(0.0); setFanTotalEfficiency(1.0); setConstantTermCoefficient(0.6060000); setTemperatureTermCoefficient(0.03636); setVelocityTermCoefficient(0.1177); setVelocitySquaredTermCoefficient(0); setMinimumIndoorTemperature(18.0); setMaximumIndoorTemperature(100.0); setDeltaTemperature(1.0); setMinimumOutdoorTemperature(-100.0); setMaximumOutdoorTemperature(100.0); setMaximumWindSpeed(40.0); } IddObjectType ZoneVentilationDesignFlowRate::iddObjectType() { return IddObjectType(IddObjectType::OS_ZoneVentilation_DesignFlowRate); } std::vector<std::string> ZoneVentilationDesignFlowRate::designFlowRateCalculationMethodValues() { return getIddKeyNames(IddFactory::instance().getObject(iddObjectType()).get(), OS_ZoneVentilation_DesignFlowRateFields::DesignFlowRateCalculationMethod); } std::vector<std::string> ZoneVentilationDesignFlowRate::ventilationTypeValues() { return getIddKeyNames(IddFactory::instance().getObject(iddObjectType()).get(), OS_ZoneVentilation_DesignFlowRateFields::VentilationType); } Schedule ZoneVentilationDesignFlowRate::schedule() const { return getImpl<detail::ZoneVentilationDesignFlowRate_Impl>()->schedule(); } std::string ZoneVentilationDesignFlowRate::designFlowRateCalculationMethod() const { return getImpl<detail::ZoneVentilationDesignFlowRate_Impl>()->designFlowRateCalculationMethod(); } double ZoneVentilationDesignFlowRate::designFlowRate() const { return getImpl<detail::ZoneVentilationDesignFlowRate_Impl>()->designFlowRate(); } double ZoneVentilationDesignFlowRate::flowRateperZoneFloorArea() const { return getImpl<detail::ZoneVentilationDesignFlowRate_Impl>()->flowRateperZoneFloorArea(); } double ZoneVentilationDesignFlowRate::flowRateperPerson() const { return getImpl<detail::ZoneVentilationDesignFlowRate_Impl>()->flowRateperPerson(); } double ZoneVentilationDesignFlowRate::airChangesperHour() const { return getImpl<detail::ZoneVentilationDesignFlowRate_Impl>()->airChangesperHour(); } std::string ZoneVentilationDesignFlowRate::ventilationType() const { return getImpl<detail::ZoneVentilationDesignFlowRate_Impl>()->ventilationType(); } double ZoneVentilationDesignFlowRate::fanPressureRise() const { return getImpl<detail::ZoneVentilationDesignFlowRate_Impl>()->fanPressureRise(); } double ZoneVentilationDesignFlowRate::fanTotalEfficiency() const { return getImpl<detail::ZoneVentilationDesignFlowRate_Impl>()->fanTotalEfficiency(); } double ZoneVentilationDesignFlowRate::constantTermCoefficient() const { return getImpl<detail::ZoneVentilationDesignFlowRate_Impl>()->constantTermCoefficient(); } double ZoneVentilationDesignFlowRate::temperatureTermCoefficient() const { return getImpl<detail::ZoneVentilationDesignFlowRate_Impl>()->temperatureTermCoefficient(); } double ZoneVentilationDesignFlowRate::velocityTermCoefficient() const { return getImpl<detail::ZoneVentilationDesignFlowRate_Impl>()->velocityTermCoefficient(); } double ZoneVentilationDesignFlowRate::velocitySquaredTermCoefficient() const { return getImpl<detail::ZoneVentilationDesignFlowRate_Impl>()->velocitySquaredTermCoefficient(); } double ZoneVentilationDesignFlowRate::minimumIndoorTemperature() const { return getImpl<detail::ZoneVentilationDesignFlowRate_Impl>()->minimumIndoorTemperature(); } boost::optional<Schedule> ZoneVentilationDesignFlowRate::minimumIndoorTemperatureSchedule() const { return getImpl<detail::ZoneVentilationDesignFlowRate_Impl>()->minimumIndoorTemperatureSchedule(); } double ZoneVentilationDesignFlowRate::maximumIndoorTemperature() const { return getImpl<detail::ZoneVentilationDesignFlowRate_Impl>()->maximumIndoorTemperature(); } boost::optional<Schedule> ZoneVentilationDesignFlowRate::maximumIndoorTemperatureSchedule() const { return getImpl<detail::ZoneVentilationDesignFlowRate_Impl>()->maximumIndoorTemperatureSchedule(); } double ZoneVentilationDesignFlowRate::deltaTemperature() const { return getImpl<detail::ZoneVentilationDesignFlowRate_Impl>()->deltaTemperature(); } boost::optional<Schedule> ZoneVentilationDesignFlowRate::deltaTemperatureSchedule() const { return getImpl<detail::ZoneVentilationDesignFlowRate_Impl>()->deltaTemperatureSchedule(); } double ZoneVentilationDesignFlowRate::minimumOutdoorTemperature() const { return getImpl<detail::ZoneVentilationDesignFlowRate_Impl>()->minimumOutdoorTemperature(); } boost::optional<Schedule> ZoneVentilationDesignFlowRate::minimumOutdoorTemperatureSchedule() const { return getImpl<detail::ZoneVentilationDesignFlowRate_Impl>()->minimumOutdoorTemperatureSchedule(); } double ZoneVentilationDesignFlowRate::maximumOutdoorTemperature() const { return getImpl<detail::ZoneVentilationDesignFlowRate_Impl>()->maximumOutdoorTemperature(); } boost::optional<Schedule> ZoneVentilationDesignFlowRate::maximumOutdoorTemperatureSchedule() const { return getImpl<detail::ZoneVentilationDesignFlowRate_Impl>()->maximumOutdoorTemperatureSchedule(); } double ZoneVentilationDesignFlowRate::maximumWindSpeed() const { return getImpl<detail::ZoneVentilationDesignFlowRate_Impl>()->maximumWindSpeed(); } bool ZoneVentilationDesignFlowRate::setSchedule(Schedule& schedule) { return getImpl<detail::ZoneVentilationDesignFlowRate_Impl>()->setSchedule(schedule); } bool ZoneVentilationDesignFlowRate::setDesignFlowRateCalculationMethod(std::string designFlowRateCalculationMethod) { return getImpl<detail::ZoneVentilationDesignFlowRate_Impl>()->setDesignFlowRateCalculationMethod(designFlowRateCalculationMethod); } bool ZoneVentilationDesignFlowRate::setDesignFlowRate(double designFlowRate) { return getImpl<detail::ZoneVentilationDesignFlowRate_Impl>()->setDesignFlowRate(designFlowRate); } bool ZoneVentilationDesignFlowRate::setFlowRateperZoneFloorArea(double flowRateperZoneFloorArea) { return getImpl<detail::ZoneVentilationDesignFlowRate_Impl>()->setFlowRateperZoneFloorArea(flowRateperZoneFloorArea); } bool ZoneVentilationDesignFlowRate::setFlowRateperPerson(double flowRateperPerson) { return getImpl<detail::ZoneVentilationDesignFlowRate_Impl>()->setFlowRateperPerson(flowRateperPerson); } bool ZoneVentilationDesignFlowRate::setAirChangesperHour(double airChangesperHour) { return getImpl<detail::ZoneVentilationDesignFlowRate_Impl>()->setAirChangesperHour(airChangesperHour); } bool ZoneVentilationDesignFlowRate::setVentilationType(std::string ventilationType) { return getImpl<detail::ZoneVentilationDesignFlowRate_Impl>()->setVentilationType(ventilationType); } bool ZoneVentilationDesignFlowRate::setFanPressureRise(double fanPressureRise) { return getImpl<detail::ZoneVentilationDesignFlowRate_Impl>()->setFanPressureRise(fanPressureRise); } bool ZoneVentilationDesignFlowRate::setFanTotalEfficiency(double fanTotalEfficiency) { return getImpl<detail::ZoneVentilationDesignFlowRate_Impl>()->setFanTotalEfficiency(fanTotalEfficiency); } bool ZoneVentilationDesignFlowRate::setConstantTermCoefficient(double constantTermCoefficient) { return getImpl<detail::ZoneVentilationDesignFlowRate_Impl>()->setConstantTermCoefficient(constantTermCoefficient); } bool ZoneVentilationDesignFlowRate::setTemperatureTermCoefficient(double temperatureTermCoefficient) { return getImpl<detail::ZoneVentilationDesignFlowRate_Impl>()->setTemperatureTermCoefficient(temperatureTermCoefficient); } bool ZoneVentilationDesignFlowRate::setVelocityTermCoefficient(double velocityTermCoefficient) { return getImpl<detail::ZoneVentilationDesignFlowRate_Impl>()->setVelocityTermCoefficient(velocityTermCoefficient); } bool ZoneVentilationDesignFlowRate::setVelocitySquaredTermCoefficient(double velocitySquaredTermCoefficient) { return getImpl<detail::ZoneVentilationDesignFlowRate_Impl>()->setVelocitySquaredTermCoefficient(velocitySquaredTermCoefficient); } bool ZoneVentilationDesignFlowRate::setMinimumIndoorTemperature(double minimumIndoorTemperature) { return getImpl<detail::ZoneVentilationDesignFlowRate_Impl>()->setMinimumIndoorTemperature(minimumIndoorTemperature); } bool ZoneVentilationDesignFlowRate::setMinimumIndoorTemperatureSchedule(Schedule& schedule) { return getImpl<detail::ZoneVentilationDesignFlowRate_Impl>()->setMinimumIndoorTemperatureSchedule(schedule); } void ZoneVentilationDesignFlowRate::resetMinimumIndoorTemperatureSchedule() { getImpl<detail::ZoneVentilationDesignFlowRate_Impl>()->resetMinimumIndoorTemperatureSchedule(); } bool ZoneVentilationDesignFlowRate::setMaximumIndoorTemperature(double maximumIndoorTemperature) { return getImpl<detail::ZoneVentilationDesignFlowRate_Impl>()->setMaximumIndoorTemperature(maximumIndoorTemperature); } bool ZoneVentilationDesignFlowRate::setMaximumIndoorTemperatureSchedule(Schedule& schedule) { return getImpl<detail::ZoneVentilationDesignFlowRate_Impl>()->setMaximumIndoorTemperatureSchedule(schedule); } void ZoneVentilationDesignFlowRate::resetMaximumIndoorTemperatureSchedule() { getImpl<detail::ZoneVentilationDesignFlowRate_Impl>()->resetMaximumIndoorTemperatureSchedule(); } bool ZoneVentilationDesignFlowRate::setDeltaTemperature(double deltaTemperature) { return getImpl<detail::ZoneVentilationDesignFlowRate_Impl>()->setDeltaTemperature(deltaTemperature); } bool ZoneVentilationDesignFlowRate::setDeltaTemperatureSchedule(Schedule& schedule) { return getImpl<detail::ZoneVentilationDesignFlowRate_Impl>()->setDeltaTemperatureSchedule(schedule); } void ZoneVentilationDesignFlowRate::resetDeltaTemperatureSchedule() { getImpl<detail::ZoneVentilationDesignFlowRate_Impl>()->resetDeltaTemperatureSchedule(); } bool ZoneVentilationDesignFlowRate::setMinimumOutdoorTemperature(double minimumOutdoorTemperature) { return getImpl<detail::ZoneVentilationDesignFlowRate_Impl>()->setMinimumOutdoorTemperature(minimumOutdoorTemperature); } bool ZoneVentilationDesignFlowRate::setMinimumOutdoorTemperatureSchedule(Schedule& schedule) { return getImpl<detail::ZoneVentilationDesignFlowRate_Impl>()->setMinimumOutdoorTemperatureSchedule(schedule); } void ZoneVentilationDesignFlowRate::resetMinimumOutdoorTemperatureSchedule() { getImpl<detail::ZoneVentilationDesignFlowRate_Impl>()->resetMinimumOutdoorTemperatureSchedule(); } bool ZoneVentilationDesignFlowRate::setMaximumOutdoorTemperature(double maximumOutdoorTemperature) { return getImpl<detail::ZoneVentilationDesignFlowRate_Impl>()->setMaximumOutdoorTemperature(maximumOutdoorTemperature); } bool ZoneVentilationDesignFlowRate::setMaximumOutdoorTemperatureSchedule(Schedule& schedule) { return getImpl<detail::ZoneVentilationDesignFlowRate_Impl>()->setMaximumOutdoorTemperatureSchedule(schedule); } void ZoneVentilationDesignFlowRate::resetMaximumOutdoorTemperatureSchedule() { getImpl<detail::ZoneVentilationDesignFlowRate_Impl>()->resetMaximumOutdoorTemperatureSchedule(); } bool ZoneVentilationDesignFlowRate::setMaximumWindSpeed(double maximumWindSpeed) { return getImpl<detail::ZoneVentilationDesignFlowRate_Impl>()->setMaximumWindSpeed(maximumWindSpeed); } /// @cond ZoneVentilationDesignFlowRate::ZoneVentilationDesignFlowRate(std::shared_ptr<detail::ZoneVentilationDesignFlowRate_Impl> impl) : ZoneHVACComponent(std::move(impl)) {} /// @endcond } // namespace model } // namespace openstudio
edit_distance = len(word_a) + len(word_b) - 2 * len(set(word_a).intersection(set(word_b)))
#!/usr/bin/env bash ghr_version="0.13.0" # NOTE: This release will generate a new release on the installers # repository which in turn triggers a full package build target_owner="hashicorp" target_repository="vagrant-builders" csource="${BASH_SOURCE[0]}" while [ -h "$csource" ] ; do csource="$(readlink "$csource")"; done root="$( cd -P "$( dirname "$csource" )/../" && pwd )" . "${root}/.ci/init.sh" pushd "${root}" > "${output}" # Install ghr wrap curl -Lso /tmp/ghr.tgz "https://github.com/tcnksm/ghr/releases/download/v${ghr_version}/ghr_v${ghr_version}_linux_amd64.tar.gz" \ "Failed to download ghr utility" wrap tar -C /tmp/ -xf /tmp/ghr.tgz \ "Failed to unpack ghr archive" wrap mv "/tmp/ghr_v${ghr_version}_linux_amd64/ghr" "${root}/.ci/" \ "Failed to install ghr utility" # Build our gem wrap gem build *.gemspec \ "Failed to build Vagrant RubyGem" # Get the path of our new gem g=(vagrant*.gem) gem=$(printf "%s" "${g}") # Determine the version of the release vagrant_version="$(gem specification "${gem}" version)" vagrant_version="${vagrant_version##*version: }" # We want to release into the builders repository so # update the repository variable with the desired destination repo_owner="${target_owner}" repo_name="${target_repository}" full_sha="main" export GITHUB_TOKEN="${HASHIBOT_TOKEN}" if [ "${tag}" = "" ]; then echo "Generating Vagrant RubyGem pre-release... " version="v${vagrant_version}+${short_sha}" prerelease "${version}" "${gem}" else # Validate this is a proper release version valid_release_version "${vagrant_version}" if [ $? -ne 0 ]; then fail "Invalid version format for Vagrant release: ${vagrant_version}" fi echo "Generating Vagrant RubyGem release... " version="v${vagrant_version}" release "${version}" "${gem}" fi slack -m "New Vagrant installers release triggered: *${version}*"
package implementation; import java.io.BufferedReader; import java.io.InputStreamReader; public class Boj4948 { public static final String NEW_LINE = "\n"; public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb = new StringBuilder(); LOOP: while(true) { int N = Integer.parseInt(br.readLine()); if(N == 0){ break LOOP; } boolean[] arr = new boolean[(2 * N) + 1]; for(int i = N + 1; i <= 2 * N; i++){ arr[i] = true; } for(int i = 2; i <= 2 * N; i++){ for(int j = i*2; j <= 2 * N; j+=i) arr[j] = false; } int cnt = 0; for(int i = N+1; i <= 2 * N; i++){ if(arr[i]){ cnt++; } } sb.append(cnt).append(NEW_LINE); } System.out.println(sb.toString()); } }
package create import ( "fmt" "io" "github.com/spf13/cobra" kapi "k8s.io/kubernetes/pkg/apis/core" "k8s.io/kubernetes/pkg/kubectl/cmd/templates" kcmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" "k8s.io/kubernetes/pkg/kubectl/genericclioptions" routev1 "github.com/openshift/api/route/v1" cmdutil "github.com/openshift/origin/pkg/cmd/util" "github.com/openshift/origin/pkg/cmd/util/route" routeapi "github.com/openshift/origin/pkg/route/apis/route" routeclientinternal "github.com/openshift/origin/pkg/route/generated/internalclientset" fileutil "github.com/openshift/origin/pkg/util/file" ) var ( routeLong = templates.LongDesc(` Expose containers externally via secured routes Three types of secured routes are supported: edge, passthrough, and reencrypt. If you wish to create unsecured routes, see "%[1]s expose -h"`) ) // NewCmdCreateRoute is a macro command to create a secured route. func NewCmdCreateRoute(fullName string, f kcmdutil.Factory, out, errOut io.Writer) *cobra.Command { cmd := &cobra.Command{ Use: "route", Short: "Expose containers externally via secured routes", Long: fmt.Sprintf(routeLong, fullName), Run: kcmdutil.DefaultSubCommandRun(errOut), } cmd.AddCommand(NewCmdCreateEdgeRoute(fullName, f, out)) cmd.AddCommand(NewCmdCreatePassthroughRoute(fullName, f, out)) cmd.AddCommand(NewCmdCreateReencryptRoute(fullName, f, out)) return cmd } var ( edgeRouteLong = templates.LongDesc(` Create a route that uses edge TLS termination Specify the service (either just its name or using type/name syntax) that the generated route should expose via the --service flag.`) edgeRouteExample = templates.Examples(` # Create an edge route named "my-route" that exposes frontend service. %[1]s create route edge my-route --service=frontend # Create an edge route that exposes the frontend service and specify a path. # If the route name is omitted, the service name will be re-used. %[1]s create route edge --service=frontend --path /assets`) ) // NewCmdCreateEdgeRoute is a macro command to create an edge route. func NewCmdCreateEdgeRoute(fullName string, f kcmdutil.Factory, out io.Writer) *cobra.Command { cmd := &cobra.Command{ Use: "edge [NAME] --service=SERVICE", Short: "Create a route that uses edge TLS termination", Long: edgeRouteLong, Example: fmt.Sprintf(edgeRouteExample, fullName), Run: func(cmd *cobra.Command, args []string) { err := CreateEdgeRoute(f, out, cmd, args) kcmdutil.CheckErr(err) }, } kcmdutil.AddValidateFlags(cmd) kcmdutil.AddPrinterFlags(cmd) kcmdutil.AddDryRunFlag(cmd) cmd.Flags().String("hostname", "", "Set a hostname for the new route") cmd.Flags().String("port", "", "Name of the service port or number of the container port the route will route traffic to") cmd.Flags().String("insecure-policy", "", "Set an insecure policy for the new route") cmd.Flags().String("service", "", "Name of the service that the new route is exposing") cmd.MarkFlagRequired("service") cmd.Flags().String("path", "", "Path that the router watches to route traffic to the service.") cmd.Flags().String("cert", "", "Path to a certificate file.") cmd.MarkFlagFilename("cert") cmd.Flags().String("key", "", "Path to a key file.") cmd.MarkFlagFilename("key") cmd.Flags().String("ca-cert", "", "Path to a CA certificate file.") cmd.MarkFlagFilename("ca-cert") cmd.Flags().String("wildcard-policy", "", "Sets the WilcardPolicy for the hostname, the default is \"None\". valid values are \"None\" and \"Subdomain\"") return cmd } // CreateEdgeRoute implements the behavior to run the create edge route command. func CreateEdgeRoute(f kcmdutil.Factory, out io.Writer, cmd *cobra.Command, args []string) error { kc, err := f.ClientSet() if err != nil { return err } clientConfig, err := f.ToRESTConfig() if err != nil { return err } routeClient, err := routeclientinternal.NewForConfig(clientConfig) if err != nil { return err } ns, _, err := f.ToRawKubeConfigLoader().Namespace() if err != nil { return err } serviceName, err := resolveServiceName(f, kcmdutil.GetFlagString(cmd, "service")) if err != nil { return err } routeName, err := resolveRouteName(args) if err != nil { return err } route, err := route.UnsecuredRoute(kc, ns, routeName, serviceName, kcmdutil.GetFlagString(cmd, "port"), false) if err != nil { return err } wildcardpolicy := kcmdutil.GetFlagString(cmd, "wildcard-policy") if len(wildcardpolicy) > 0 { route.Spec.WildcardPolicy = routeapi.WildcardPolicyType(wildcardpolicy) } route.Spec.Host = kcmdutil.GetFlagString(cmd, "hostname") route.Spec.Path = kcmdutil.GetFlagString(cmd, "path") route.Spec.TLS = new(routeapi.TLSConfig) route.Spec.TLS.Termination = routeapi.TLSTerminationEdge cert, err := fileutil.LoadData(kcmdutil.GetFlagString(cmd, "cert")) if err != nil { return err } route.Spec.TLS.Certificate = string(cert) key, err := fileutil.LoadData(kcmdutil.GetFlagString(cmd, "key")) if err != nil { return err } route.Spec.TLS.Key = string(key) caCert, err := fileutil.LoadData(kcmdutil.GetFlagString(cmd, "ca-cert")) if err != nil { return err } route.Spec.TLS.CACertificate = string(caCert) insecurePolicy := kcmdutil.GetFlagString(cmd, "insecure-policy") if len(insecurePolicy) > 0 { route.Spec.TLS.InsecureEdgeTerminationPolicy = routeapi.InsecureEdgeTerminationPolicyType(insecurePolicy) } dryRun := kcmdutil.GetFlagBool(cmd, "dry-run") actualRoute := route if !dryRun { actualRoute, err = routeClient.Route().Routes(ns).Create(route) if err != nil { return err } } actualRoute.SetGroupVersionKind(routev1.SchemeGroupVersion.WithKind("Route")) shortOutput := kcmdutil.GetFlagString(cmd, "output") == "name" if !shortOutput && kcmdutil.GetFlagString(cmd, "output") != "" { kcmdutil.PrintObject(cmd, actualRoute, out) } else { kcmdutil.PrintSuccess(shortOutput, out, actualRoute, dryRun, "created") } return nil } var ( passthroughRouteLong = templates.LongDesc(` Create a route that uses passthrough TLS termination Specify the service (either just its name or using type/name syntax) that the generated route should expose via the --service flag.`) passthroughRouteExample = templates.Examples(` # Create a passthrough route named "my-route" that exposes the frontend service. %[1]s create route passthrough my-route --service=frontend # Create a passthrough route that exposes the frontend service and specify # a hostname. If the route name is omitted, the service name will be re-used. %[1]s create route passthrough --service=frontend --hostname=www.example.com`) ) // NewCmdCreatePassthroughRoute is a macro command to create a passthrough route. func NewCmdCreatePassthroughRoute(fullName string, f kcmdutil.Factory, out io.Writer) *cobra.Command { cmd := &cobra.Command{ Use: "passthrough [NAME] --service=SERVICE", Short: "Create a route that uses passthrough TLS termination", Long: passthroughRouteLong, Example: fmt.Sprintf(passthroughRouteExample, fullName), Run: func(cmd *cobra.Command, args []string) { err := CreatePassthroughRoute(f, out, cmd, args) kcmdutil.CheckErr(err) }, } kcmdutil.AddValidateFlags(cmd) kcmdutil.AddPrinterFlags(cmd) kcmdutil.AddDryRunFlag(cmd) cmd.Flags().String("hostname", "", "Set a hostname for the new route") cmd.Flags().String("port", "", "Name of the service port or number of the container port the route will route traffic to") cmd.Flags().String("insecure-policy", "", "Set an insecure policy for the new route") cmd.Flags().String("service", "", "Name of the service that the new route is exposing") cmd.MarkFlagRequired("service") cmd.Flags().String("wildcard-policy", "", "Sets the WilcardPolicy for the hostname, the default is \"None\". valid values are \"None\" and \"Subdomain\"") return cmd } // CreatePassthroughRoute implements the behavior to run the create passthrough route command. func CreatePassthroughRoute(f kcmdutil.Factory, out io.Writer, cmd *cobra.Command, args []string) error { kc, err := f.ClientSet() if err != nil { return err } clientConfig, err := f.ToRESTConfig() if err != nil { return err } routeClient, err := routeclientinternal.NewForConfig(clientConfig) if err != nil { return err } ns, _, err := f.ToRawKubeConfigLoader().Namespace() if err != nil { return err } serviceName, err := resolveServiceName(f, kcmdutil.GetFlagString(cmd, "service")) if err != nil { return err } routeName, err := resolveRouteName(args) if err != nil { return err } route, err := route.UnsecuredRoute(kc, ns, routeName, serviceName, kcmdutil.GetFlagString(cmd, "port"), false) if err != nil { return err } wildcardpolicy := kcmdutil.GetFlagString(cmd, "wildcard-policy") if len(wildcardpolicy) > 0 { route.Spec.WildcardPolicy = routeapi.WildcardPolicyType(wildcardpolicy) } route.Spec.Host = kcmdutil.GetFlagString(cmd, "hostname") route.Spec.TLS = new(routeapi.TLSConfig) route.Spec.TLS.Termination = routeapi.TLSTerminationPassthrough insecurePolicy := kcmdutil.GetFlagString(cmd, "insecure-policy") if len(insecurePolicy) > 0 { route.Spec.TLS.InsecureEdgeTerminationPolicy = routeapi.InsecureEdgeTerminationPolicyType(insecurePolicy) } dryRun := kcmdutil.GetFlagBool(cmd, "dry-run") actualRoute := route if !dryRun { actualRoute, err = routeClient.Route().Routes(ns).Create(route) if err != nil { return err } } actualRoute.SetGroupVersionKind(routev1.SchemeGroupVersion.WithKind("Route")) shortOutput := kcmdutil.GetFlagString(cmd, "output") == "name" if !shortOutput && kcmdutil.GetFlagString(cmd, "output") != "" { kcmdutil.PrintObject(cmd, actualRoute, out) } else { kcmdutil.PrintSuccess(shortOutput, out, actualRoute, dryRun, "created") } return nil } var ( reencryptRouteLong = templates.LongDesc(` Create a route that uses reencrypt TLS termination Specify the service (either just its name or using type/name syntax) that the generated route should expose via the --service flag. A destination CA certificate is needed for reencrypt routes, specify one with the --dest-ca-cert flag.`) reencryptRouteExample = templates.Examples(` # Create a route named "my-route" that exposes the frontend service. %[1]s create route reencrypt my-route --service=frontend --dest-ca-cert cert.cert # Create a reencrypt route that exposes the frontend service and re-use # the service name as the route name. %[1]s create route reencrypt --service=frontend --dest-ca-cert cert.cert`) ) // NewCmdCreateReencryptRoute is a macro command to create a reencrypt route. func NewCmdCreateReencryptRoute(fullName string, f kcmdutil.Factory, out io.Writer) *cobra.Command { printFlags := genericclioptions.NewPrintFlags("created") cmd := &cobra.Command{ Use: "reencrypt [NAME] --dest-ca-cert=FILENAME --service=SERVICE", Short: "Create a route that uses reencrypt TLS termination", Long: reencryptRouteLong, Example: fmt.Sprintf(reencryptRouteExample, fullName), Run: func(cmd *cobra.Command, args []string) { err := CreateReencryptRoute(printFlags, f, out, cmd, args) kcmdutil.CheckErr(err) }, } printFlags.AddFlags(cmd) kcmdutil.AddValidateFlags(cmd) kcmdutil.AddDryRunFlag(cmd) cmd.Flags().String("hostname", "", "Set a hostname for the new route") cmd.Flags().String("port", "", "Name of the service port or number of the container port the route will route traffic to") cmd.Flags().String("insecure-policy", "", "Set an insecure policy for the new route") cmd.Flags().String("service", "", "Name of the service that the new route is exposing") cmd.MarkFlagRequired("service") cmd.Flags().String("path", "", "Path that the router watches to route traffic to the service.") cmd.Flags().String("cert", "", "Path to a certificate file.") cmd.MarkFlagFilename("cert") cmd.Flags().String("key", "", "Path to a key file.") cmd.MarkFlagFilename("key") cmd.Flags().String("ca-cert", "", "Path to a CA certificate file.") cmd.MarkFlagFilename("ca-cert") cmd.Flags().String("dest-ca-cert", "", "Path to a CA certificate file, used for securing the connection from the router to the destination.") cmd.MarkFlagFilename("dest-ca-cert") cmd.Flags().String("wildcard-policy", "", "Sets the WildcardPolicy for the hostname, the default is \"None\". valid values are \"None\" and \"Subdomain\"") return cmd } // CreateReencryptRoute implements the behavior to run the create reencrypt route command. func CreateReencryptRoute(printFlags *genericclioptions.PrintFlags, f kcmdutil.Factory, out io.Writer, cmd *cobra.Command, args []string) error { kc, err := f.ClientSet() if err != nil { return err } clientConfig, err := f.ToRESTConfig() if err != nil { return err } routeClient, err := routeclientinternal.NewForConfig(clientConfig) if err != nil { return err } ns, _, err := f.ToRawKubeConfigLoader().Namespace() if err != nil { return err } serviceName, err := resolveServiceName(f, kcmdutil.GetFlagString(cmd, "service")) if err != nil { return err } routeName, err := resolveRouteName(args) if err != nil { return err } route, err := route.UnsecuredRoute(kc, ns, routeName, serviceName, kcmdutil.GetFlagString(cmd, "port"), false) if err != nil { return err } wildcardpolicy := kcmdutil.GetFlagString(cmd, "wildcard-policy") if len(wildcardpolicy) > 0 { route.Spec.WildcardPolicy = routeapi.WildcardPolicyType(wildcardpolicy) } route.Spec.Host = kcmdutil.GetFlagString(cmd, "hostname") route.Spec.Path = kcmdutil.GetFlagString(cmd, "path") route.Spec.TLS = new(routeapi.TLSConfig) route.Spec.TLS.Termination = routeapi.TLSTerminationReencrypt cert, err := fileutil.LoadData(kcmdutil.GetFlagString(cmd, "cert")) if err != nil { return err } route.Spec.TLS.Certificate = string(cert) key, err := fileutil.LoadData(kcmdutil.GetFlagString(cmd, "key")) if err != nil { return err } route.Spec.TLS.Key = string(key) caCert, err := fileutil.LoadData(kcmdutil.GetFlagString(cmd, "ca-cert")) if err != nil { return err } route.Spec.TLS.CACertificate = string(caCert) destCACert, err := fileutil.LoadData(kcmdutil.GetFlagString(cmd, "dest-ca-cert")) if err != nil { return err } route.Spec.TLS.DestinationCACertificate = string(destCACert) insecurePolicy := kcmdutil.GetFlagString(cmd, "insecure-policy") if len(insecurePolicy) > 0 { route.Spec.TLS.InsecureEdgeTerminationPolicy = routeapi.InsecureEdgeTerminationPolicyType(insecurePolicy) } dryRun := kcmdutil.GetFlagBool(cmd, "dry-run") if dryRun { printFlags.Complete("%s (dry run)") } printer, err := printFlags.ToPrinter() if err != nil { return err } actualRoute := route if !dryRun { actualRoute, err = routeClient.Route().Routes(ns).Create(route) if err != nil { return err } } actualRoute.SetGroupVersionKind(routev1.SchemeGroupVersion.WithKind("Route")) return printer.PrintObj(actualRoute, out) } func resolveServiceName(f kcmdutil.Factory, resource string) (string, error) { if len(resource) == 0 { return "", fmt.Errorf("you need to provide a service name via --service") } mapper, err := f.ToRESTMapper() if err != nil { return "", err } rType, name, err := cmdutil.ResolveResource(kapi.Resource("services"), resource, mapper) if err != nil { return "", err } if rType != kapi.Resource("services") { return "", fmt.Errorf("cannot expose %v as routes", rType) } return name, nil } func resolveRouteName(args []string) (string, error) { switch len(args) { case 0: case 1: return args[0], nil default: return "", fmt.Errorf("multiple names provided. Please specify at most one") } return "", nil }
class UserManagementSystem: def __init__(self): self.userslist = [] def imprimirUsuarios(self): for user in self.userslist: user.muestra() def deleteUser(self, name): users_to_remove = [user for user in self.userslist if user.getName() == name] for user in users_to_remove: self.userslist.remove(user)
from django.db import models from django.utils import timezone from django.utils.translation import gettext_lazy from .abstract_is_candidate import AbstractIsCandidate from .abstract_is_examiner import AbstractIsExaminer from .basenode import BaseNode from .custom_db_fields import ShortNameField, LongNameField from devilry.devilry_account.models import User, SubjectPermissionGroup, PeriodPermissionGroup from devilry.utils import devilry_djangoaggregate_functions from .model_utils import Etag class SubjectQuerySet(models.QuerySet): def filter_user_is_admin(self, user): """ Filter the queryset to only include :class:`.Subject` objects where the given ``user`` is in a :class:`.devilry.devilry_account.models.SubjectPermissionGroup`. Args: user: A User object. """ if user.is_superuser: return self.all() else: subjectids_where_is_admin_queryset = SubjectPermissionGroup.objects \ .filter(permissiongroup__users=user).values_list('subject_id', flat=True) return self.filter(id__in=subjectids_where_is_admin_queryset) def __get_subjectids_where_user_is_periodadmin(self, user): subjectids_where_is_periodadmin_queryset = PeriodPermissionGroup.objects \ .filter(models.Q(permissiongroup__users=user))\ .values_list('period__parentnode_id', flat=True)\ .distinct() return subjectids_where_is_periodadmin_queryset def filter_user_is_admin_for_any_periods_within_subject(self, user): """ Filter the queryset to only include :class:`.Subject` objects where the given ``user`` is in a :class:`.devilry.devilry_account.models.PeriodPermissionGroup` for a period within a subject. Args: user: A User object. """ if user.is_superuser: return self.all() else: queryset = (self.filter_user_is_admin(user) | self.filter(id__in=self.__get_subjectids_where_user_is_periodadmin(user=user))) return queryset.distinct() def annotate_with_has_active_period(self): """ Annotate with ``has_active_period`` - ``True`` if the subject contains any active periods. """ now = timezone.now() whenquery = models.Q(periods__start_time__lt=now, periods__end_time__gt=now) return self.annotate( has_active_period=devilry_djangoaggregate_functions.BooleanCount( models.Case( models.When(whenquery, then=1)) ) ) def prefetch_active_period_objects(self): """ Prefetch active periods in the ``active_period_objects`` attribute. The ``active_period_objects`` attribute is a ``list`` of :class:`devilry.apps.core.models.Period` objects ordered by ``start_time`` in ascending order. Examples: Make a queryset using with active peridods prefetched:: from devilry.apps.core.models import Period queryset = Period.objects.prefetch_active_period_objects() Work with the queryset:: for period in queryset.first().active_period_objects: print(period.short_name) Get the last active period for a subject (see :meth:`.Subject.last_active_period`):: last_active_period = queryset.first().last_active_period """ from devilry.apps.core.models import Period return self.prefetch_related( models.Prefetch('periods', queryset=Period.objects.filter_active().order_by('start_time'), to_attr='active_period_objects')) class Subject(models.Model, BaseNode, AbstractIsExaminer, AbstractIsCandidate, Etag): """ .. attribute:: short_name A django.db.models.SlugField_ with max 20 characters. Only numbers, letters, '_' and '-'. Unlike all other children of :class:`BaseNode`, Subject.short_name is **unique**. This is mainly to avoid the overhead of having to recurse all the way to the top of the node hierarchy for every unique path. .. attribute:: periods A set of :class:`periods <devilry.apps.core.models.Period>` for this subject. .. attribute:: etag A DateTimeField containing the etag for this object. """ objects = SubjectQuerySet.as_manager() class Meta: app_label = 'core' ordering = ['short_name'] verbose_name = gettext_lazy('course') verbose_name_plural = gettext_lazy('courses') short_name = ShortNameField(unique=True) long_name = LongNameField() admins = models.ManyToManyField(User, blank=True) etag = models.DateTimeField(auto_now_add=True) def get_path(self): """ Only returns :attr:`short_name` for subject since it is guaranteed to be unique. """ return self.short_name def __str__(self): return self.get_path() @property def last_active_period(self): """ Get the last active :class:`devilry.apps.core.models.Period`. Only works if the queryset used to fetch the Subject is uses :meth:`.SubjectQuerySet.prefetch_active_periodobjects` """ if not hasattr(self, 'active_period_objects'): raise AttributeError('The last_active_period property requires ' 'SubjectQuerySet.prefetch_active_period_objects()') if self.active_period_objects: return self.active_period_objects[-1] else: return None
function network_device_ip_address() { ifconfig $1 | grep "inet " | cut -f 2 -d " " }
$(document).ready(function(){ $(".button a").click(function(){ $(".overlay").fadeToggle(0); $(this).toggleClass('btn-open').toggleClass('btn-close'); $('.btn-open').click(function(){ $('.click-overlay').addClass('body-overlay'); $('body').addClass('noscroll'); }); $('.btn-close').click(function(){ $('.click-overlay').removeClass('body-overlay'); $('body').removeClass('noscroll'); }); }); $('.btn-open').click(function(){ $('.click-overlay').addClass('body-overlay'); $('body').addClass('noscroll'); }); }); $('.overlay').on('click', function(){ $(".overlay").fadeToggle(0); $(".button a").toggleClass('btn-open').toggleClass('btn-close'); open = false; }); /*calculator*/ $(document).ready(function(){ $('.calculator img').click(function(){ $('.home-calculator').addClass('calculator-open'); }); $('#close').click(function(){ $('.home-calculator').removeClass('calculator-open'); }); $('.container').click(function(){ $('.home-calculator').removeClass('calculator-open'); }); }); /*calculator*/ /* multitab */ $(document).ready(function(){ $('.nav-tabs a').click(function(){ $(this).tab('show'); }); }); /*multitabe*/ $(document).ready(function(){ var offset = $('.header').offset(); $(window).scroll(function(){ $('.header').addClass('fixed'); if($(document).scrollTop() < 50){ $('.header').removeClass('fixed'); } }); }); $(document).ready(function(){ $('#myCarousel').carousel({ interval:84000000 }); var clickEvent = false; $('#myCarousel').on('click','.nav a',function(){ clickEvent = true; $('.nav li').removeClass('active'); $(this).parent().addClass('active'); }).on('slid.bs.carousel',function(e){ if(!clickEvent) { var count = $('.nav').children().length -1; var current = $('.nav li.active'); current.removeClass('active').next().addClass('active'); var id = parseInt(current.data('slide-to')); if(count == id) { $('.nav li').first().addClass('active'); } } clickEvent = false; }); }); /* how it works*/ $(document).ready(function(){ $('.slider-amount').jRange({ from: 100, to: 5000, step: 100, scale: [100,'','','','','','','','',1000,'','','','','','','','','',2000,'','','','','','','','','',3000,'','','','','','','','','',4000,'','','','','','','','','',5000], showScale: true, format: '%s', width: 450, showLables:true }); $('.slider-days').jRange({ from: 7, to: 30, step: 1, scale: [7,'','','','','','',14,'','','','','','',21,'','','','','','','','',30], showScale: true, format: '%s', width: 450, showLables:true }); var amount = parseInt($("#slider-amount").val(), 10); var days = parseInt($("#slider-days").val(), 10); var day = 0; var total_amount = 0; $('#slider-amount').on('change',function(){ amount = parseInt($( "#slider-amount" ).val(), 10); statement(); }); $('#slider-days').on('change',function(){ days = parseInt($( "#slider-days" ).val(), 10); statement(); }); var statement = function(){ if(days==7){ day = 1; total(); $("#amount").text(amount); $("#interest").text((amount * days * 0.002).toFixed(2)); } else if(days>=8 && days<=14){ day = 2; total(); $("#amount").text(amount); $("#interest").text(((amount * 7 * 0.002) + (amount * (days-7) * 0.004)).toFixed(2)); } else if(days>=15 && days<=21){ day = 3; total(); $("#amount").text(amount); $("#interest").text(((amount * 7 * 0.002) + (amount * 7 * 0.004) + (amount * (days-14) * 0.006)).toFixed(2)); } else if(days>=22 && days<=30){ day = 4; total(); $("#amount").text(amount); $("#interest").text(((amount * 7 * 0.002) + (amount * 7 * 0.004) + (amount * 7 * 0.006) + (amount * (days-21) * 0.008 )).toFixed(2)); } else{ total(); } } var total = function(){ switch(day){ case 1: total_amount = amount * days * 0.002 + amount; $("#total_amount").text(total_amount); break; case 2: total_amount = (amount * 7 * 0.002) + (amount * (days-7) * 0.004) + amount; $("#total_amount").text(total_amount); break; case 3: total_amount = (amount * 7 * 0.002) + (amount * 7 * 0.004) + (amount * (days-14) * 0.006)+amount; $("#total_amount").text(total_amount); break; case 4: total_amount = (amount * 7 * 0.002) + (amount * 7 * 0.004) + (amount * 7 * 0.006) + (amount * (days-21) * 0.008 )+ amount; $("#total_amount").text(total_amount); break; } } statement(); }); /* how it works*/ /* home-calculator*/ /*home-calculator*/ /* frequently asked questions */ $(document).ready(function(){ $('.nav-tabs-dropdown').each(function(i, elm) { $(elm).text($(elm).next('ul').find('li.active a').text()); }); $('.nav-tabs-dropdown').on('click', function(e) { e.preventDefault(); $(e.target).toggleClass('open').next('ul').slideToggle(); }); $('#nav-tabs-wrapper a[data-toggle="tab"]').on('click', function(e) { e.preventDefault(); $(e.target).closest('ul').hide().prev('a').removeClass('open').text($(this).text()); }); // $("#faq-page .nav-tabs li.active").css("border-right","0px !important;"); }); /* frequently asked questions */
import boto3 # Create an EC2 client ec2 = boto3.client("ec2", region_name="YOUR_REGION") # Create an EC2 instance ec2.run_instances( ImageId="ami-xxxxxxx", InstanceType="t2.micro", MinCount=1, MaxCount=1, KeyName="YOUR_KEY", SecurityGroupIds=["YOUR_SECURITY_GROUP_ID"], OperatingSystem="Red Hat" )
docker run --name cassandra-node-2 -d \ -e CASSANDRA_CLUSTER_NAME="Oauth-cluster" \ -e CASSANDRA_CLUSTER_TOKENS="8" \ -e CASSANDRA_CLUSTER_DC="dc1" \ -e CASSANDRA_RACK="rack2" \ -e CASSANDRA_ENPOINT_SNITCH="GossipingPropertyFileSnitch" \ -e CASSANDRA_SEEDS="$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' cassandra-node-1)" \ -e CASSANDRA_BROADCAST_ADDRESS=127.0.0.1 \ -v /Users/pkoolwijk/go/src/github.com/appletouch/bookstore-oauth-api/cassandraDB/data/node-2:/var/lib/cassandra/data \ cassandra:3.11.6
package com.alibaba.spring.boot.rsocket.demo; import com.alibaba.user.AccountService; import com.alibaba.rsocket.invocation.RSocketRemoteServiceBuilder; import com.alibaba.rsocket.loadbalance.LoadBalancedRSocket; import com.alibaba.rsocket.metadata.RSocketMimeType; import com.alibaba.rsocket.upstream.UpstreamManager; import com.alibaba.spring.boot.rsocket.hessian.HessianDecoder; import com.alibaba.spring.boot.rsocket.hessian.HessianEncoder; import com.alibaba.user.Rx3UserService; import com.alibaba.user.RxUserService; import com.alibaba.user.UserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.core.ReactiveAdapterRegistry; import org.springframework.messaging.rsocket.RSocketRequester; import org.springframework.messaging.rsocket.RSocketStrategies; import org.springframework.util.MimeType; import javax.annotation.PostConstruct; /** * Service consumer configuration * * @author leijuan */ @Configuration public class ServiceConsumeConfiguration { @Autowired private ReactiveAdapterRegistry reactiveAdapterRegistry; @PostConstruct public void init() { new RxJava3Registrar().registerAdapters(reactiveAdapterRegistry); } @Bean public UserService userService(UpstreamManager upstreamManager) { return RSocketRemoteServiceBuilder .client(UserService.class) //.sticky(true) .upstreamManager(upstreamManager) //.endpoint("ip:192.168.1.2") //for testing .build(); } @Bean public UserServiceExtra userServiceExtra(UpstreamManager upstreamManager) { return RSocketRemoteServiceBuilder .client(UserServiceExtra.class) .service(UserService.class.getCanonicalName()) .upstreamManager(upstreamManager) .acceptEncodingType(RSocketMimeType.Json) .build(); } @Bean public RxUserService rxUserService(UpstreamManager upstreamManager) { return RSocketRemoteServiceBuilder .client(RxUserService.class) .encodingType(RSocketMimeType.CBOR) .upstreamManager(upstreamManager) .build(); } @Bean public Rx3UserService rx3UserService(UpstreamManager upstreamManager) { return RSocketRemoteServiceBuilder .client(Rx3UserService.class) .upstreamManager(upstreamManager) .build(); } @Bean public AccountService accountService(UpstreamManager upstreamManager) { return RSocketRemoteServiceBuilder .client(AccountService.class) .encodingType(RSocketMimeType.Protobuf) .upstreamManager(upstreamManager) .build(); } @Bean public RSocketRequester rsocketRequester(UpstreamManager upstreamManager) { LoadBalancedRSocket loadBalancedRSocket = upstreamManager.findBroker().getLoadBalancedRSocket(); RSocketStrategies rSocketStrategies = RSocketStrategies.builder() .encoder(new HessianEncoder()) .decoder(new HessianDecoder()) .build(); return RSocketRequester.wrap(loadBalancedRSocket, MimeType.valueOf("application/x-hessian"), MimeType.valueOf("message/x.rsocket.composite-metadata.v0"), rSocketStrategies); } }
class ItemCatalogue(): def __init__(self): self.items = {} def add(self, item_name, item_details): self.items[item_name] = item_details def update(self, item_name, item_details): self.items[item_name] = item_details def delete(self, item_name): del self.items[item_name] def search(self, item_name): if item_name in self.items: return self.items[item_name] else: return None
<reponame>akokhanovskyi/kaa /* * Copyright 2014-2016 CyberVision, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.kaaproject.kaa.server.common.dao.service; import java.text.ParseException; import org.apache.commons.codec.binary.Base64; import org.apache.commons.lang.StringUtils; import org.kaaproject.avro.ui.shared.Base64Utils; import org.kaaproject.kaa.common.dto.*; import org.kaaproject.kaa.server.common.dao.EndpointService; import org.kaaproject.kaa.server.common.dao.HistoryService; import org.kaaproject.kaa.server.common.dao.ProfileService; import org.kaaproject.kaa.server.common.dao.ServerProfileService; import org.kaaproject.kaa.server.common.dao.exception.DatabaseProcessingException; import org.kaaproject.kaa.server.common.dao.exception.IncorrectParameterException; import org.kaaproject.kaa.server.common.dao.exception.NotFoundException; import org.kaaproject.kaa.server.common.dao.exception.UpdateStatusConflictException; import org.kaaproject.kaa.server.common.dao.impl.EndpointGroupDao; import org.kaaproject.kaa.server.common.dao.impl.EndpointProfileDao; import org.kaaproject.kaa.server.common.dao.impl.ProfileFilterDao; import org.kaaproject.kaa.server.common.dao.impl.ProfileSchemaDao; import org.kaaproject.kaa.server.common.dao.model.EndpointProfile; import org.kaaproject.kaa.server.common.dao.model.sql.EndpointGroup; import org.kaaproject.kaa.server.common.dao.model.sql.EndpointProfileSchema; import org.kaaproject.kaa.server.common.dao.model.sql.ProfileFilter; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.HashSet; import java.util.List; import static org.apache.commons.lang.StringUtils.isBlank; import static org.apache.commons.lang.StringUtils.isNotBlank; import static org.kaaproject.kaa.common.dto.UpdateStatus.ACTIVE; import static org.kaaproject.kaa.common.dto.UpdateStatus.INACTIVE; import static org.kaaproject.kaa.server.common.dao.impl.DaoUtil.convertDtoList; import static org.kaaproject.kaa.server.common.dao.impl.DaoUtil.getDto; import static org.kaaproject.kaa.server.common.dao.service.Validator.isValidId; import static org.kaaproject.kaa.server.common.dao.service.Validator.validateId; import static org.kaaproject.kaa.server.common.dao.service.Validator.validateSqlId; @Service @Transactional public class ProfileServiceImpl implements ProfileService { private static final Logger LOG = LoggerFactory.getLogger(ProfileServiceImpl.class); @Autowired private ProfileSchemaDao<EndpointProfileSchema> profileSchemaDao; @Autowired private ProfileFilterDao<ProfileFilter> profileFilterDao; @Autowired private EndpointGroupDao<EndpointGroup> endpointGroupDao; @Autowired private HistoryService historyService; @Autowired private ServerProfileService serverProfileService; @Autowired private EndpointService endpointService; private EndpointProfileDao<EndpointProfile> endpointProfileDao; public void setEndpointProfileDao(EndpointProfileDao<EndpointProfile> endpointProfileDao) { this.endpointProfileDao = endpointProfileDao; } @Override public List<EndpointProfileSchemaDto> findProfileSchemasByAppId(String applicationId) { validateSqlId(applicationId, "Can't find profile schema. Invalid application id: " + applicationId); return convertDtoList(profileSchemaDao.findByApplicationId(applicationId)); } @Override public List<VersionDto> findProfileSchemaVersionsByAppId(String applicationId) { validateSqlId(applicationId, "Can't find profile schemas. Invalid application id: " + applicationId); List<EndpointProfileSchema> endpointProfileSchemas = profileSchemaDao.findByApplicationId(applicationId); List<VersionDto> schemas = new ArrayList<>(); for (EndpointProfileSchema endpointProfileSchema : endpointProfileSchemas) { schemas.add(endpointProfileSchema.toVersionDto()); } return schemas; } @Override public EndpointProfileSchemaDto findProfileSchemaById(String id) { validateSqlId(id, "Can't find profile schema. Invalid profile schema id: " + id); return getDto(profileSchemaDao.findById(id)); } @Override public EndpointProfileSchemaDto saveProfileSchema(EndpointProfileSchemaDto profileSchemaDto) { if (profileSchemaDto == null) { throw new IncorrectParameterException("Can't save profile schema. Invalid profile schema object."); } String appId = profileSchemaDto.getApplicationId(); if (isNotBlank(appId)) { String id = profileSchemaDto.getId(); if (StringUtils.isBlank(id)) { EndpointProfileSchema endpointProfileSchema = profileSchemaDao.findLatestByAppId(appId); int version = -1; if (endpointProfileSchema != null) { version = endpointProfileSchema.getVersion(); } profileSchemaDto.setId(null); profileSchemaDto.setVersion(++version); profileSchemaDto.setCreatedTime(System.currentTimeMillis()); } else { EndpointProfileSchemaDto oldProfileSchemaDto = getDto(profileSchemaDao.findById(id)); if (oldProfileSchemaDto != null) { oldProfileSchemaDto.editFields(profileSchemaDto); profileSchemaDto = oldProfileSchemaDto; return getDto(profileSchemaDao.save(new EndpointProfileSchema(profileSchemaDto))); } else { LOG.error("Can't find profile schema with given id [{}].", id); throw new IncorrectParameterException("Invalid profile schema id: " + id); } } return getDto(profileSchemaDao.save(new EndpointProfileSchema(profileSchemaDto))); } else { throw new IncorrectParameterException("Invalid profile schema object. Incorrect application id" + appId); } } @Override public void removeProfileSchemasByAppId(String applicationId) { validateSqlId(applicationId, "Can't remove profile schema. Invalid application id: " + applicationId); List<EndpointProfileSchema> schemas = profileSchemaDao.findByApplicationId(applicationId); if (schemas != null && !schemas.isEmpty()) { LOG.debug("Remove profile shemas by application id {}", applicationId); for (EndpointProfileSchema schema : schemas) { removeProfileSchemaById(schema.getId().toString()); } } } @Override public void removeProfileSchemaById(String id) { validateSqlId(id, "Can't remove profile schema. Invalid profile schema id: " + id); profileSchemaDao.removeById(id); LOG.debug("Removed profile schema [{}] with filters.", id); } @Override public Collection<ProfileFilterRecordDto> findAllProfileFilterRecordsByEndpointGroupId(String endpointGroupId, boolean includeDeprecated) { Collection<ProfileFilterDto> profileFilters = convertDtoList(profileFilterDao.findActualByEndpointGroupId(endpointGroupId)); List<ProfileFilterRecordDto> records = ProfileFilterRecordDto.convertToProfileFilterRecords(profileFilters); if (includeDeprecated) { List<ProfileVersionPairDto> versions = findVacantSchemasByEndpointGroupId(endpointGroupId); for (ProfileVersionPairDto version : versions) { ProfileFilterDto deprecatedProfileFilter = getDto(profileFilterDao.findLatestDeprecated( version.getEndpointProfileSchemaid(), version.getServerProfileSchemaid(), endpointGroupId)); if (deprecatedProfileFilter != null) { ProfileFilterRecordDto record = new ProfileFilterRecordDto(); record.setActiveStructureDto(deprecatedProfileFilter); records.add(record); } } } Collections.sort(records); return records; } @Override public ProfileFilterRecordDto findProfileFilterRecordBySchemaIdAndEndpointGroupId(String endpointProfileSchemaId, String serverProfileSchemaId, String endpointGroupId) { validateFilterSchemaIds(endpointProfileSchemaId, serverProfileSchemaId); ProfileFilterRecordDto record = new ProfileFilterRecordDto(); Collection<ProfileFilterDto> profileFilters = convertDtoList(profileFilterDao.findActualBySchemaIdAndGroupId(endpointProfileSchemaId, serverProfileSchemaId, endpointGroupId)); if (profileFilters != null) { for (ProfileFilterDto profileFilter : profileFilters) { if (profileFilter.getStatus() == UpdateStatus.ACTIVE) { record.setActiveStructureDto(profileFilter); } else if (profileFilter.getStatus() == UpdateStatus.INACTIVE) { record.setInactiveStructureDto(profileFilter); } } } if (!record.hasActive()) { ProfileFilterDto deprecatedProfileFilter = getDto(profileFilterDao.findLatestDeprecated(endpointProfileSchemaId, serverProfileSchemaId, endpointGroupId)); if (deprecatedProfileFilter != null) { record.setActiveStructureDto(deprecatedProfileFilter); } } if (record.isEmpty()) { LOG.debug("Can't find related profile filter record for endpoint schema {}, server schema {} and group {}.", endpointProfileSchemaId, serverProfileSchemaId, endpointGroupId); throw new NotFoundException("Profile filter record not found, endpointProfileSchemaId: " + endpointProfileSchemaId + ", serverProfileSchemaId: " + serverProfileSchemaId + " endpointGroupId: " + endpointGroupId); } return record; } @Override public List<ProfileVersionPairDto> findVacantSchemasByEndpointGroupId(String endpointGroupId) { validateSqlId(endpointGroupId, "Can't find vacant schemas. Invalid endpoint group id: " + endpointGroupId); EndpointGroup group = endpointGroupDao.findById(endpointGroupId); List<ProfileFilter> profileFilters = profileFilterDao.findActualByEndpointGroupId(endpointGroupId); String appId = group.getApplicationId(); List<ServerProfileSchemaDto> serverSchemas = serverProfileService.findServerProfileSchemasByAppId(appId); Collections.sort(serverSchemas); List<EndpointProfileSchemaDto> endpointProfileSchemas = findProfileSchemasByAppId(appId); Collections.sort(endpointProfileSchemas); Collection<ProfileVersionPairDto> pairVersionSet = new HashSet<>(); for (int i = 0; i < endpointProfileSchemas.size(); i++) { EndpointProfileSchemaDto endSchema = endpointProfileSchemas.get(i); for (ServerProfileSchemaDto serverSchema : serverSchemas) { if (i == 0) { pairVersionSet.add(new ProfileVersionPairDto(serverSchema.getId(), serverSchema.getVersion())); } pairVersionSet.add(new ProfileVersionPairDto(endSchema.getId(), endSchema.getVersion(), serverSchema.getId(), serverSchema.getVersion())); } pairVersionSet.add(new ProfileVersionPairDto(endSchema.getVersion(), endSchema.getId())); } for (ProfileFilter pf : profileFilters) { pairVersionSet.remove(new ProfileVersionPairDto(pf.getEndpointProfileSchemaId(), pf.getEndpointProfileSchemaVersion(), pf.getServerProfileSchemaId(), pf.getServerProfileSchemaVersion())); } return new ArrayList<>(pairVersionSet); } @Override public ProfileFilterDto findProfileFilterById(String id) { validateSqlId(id, "Can't find profile filter. Invalid profile filter id: " + id); return getDto(profileFilterDao.findById(id)); } @Override public ProfileFilterDto saveProfileFilter(ProfileFilterDto profileFilterDto) { validateFilter(profileFilterDto); String id = profileFilterDto.getId(); if (isNotBlank(id)) { ProfileFilterDto oldProfileFilter = findProfileFilterById(id); if (oldProfileFilter != null && oldProfileFilter.getStatus() != INACTIVE) { throw new UpdateStatusConflictException("Can't update profile filter, invalid old profile filter with id " + id); } } else { String endProfSchemaId = profileFilterDto.getEndpointProfileSchemaId(); String srvProfSchemaId = profileFilterDto.getServerProfileSchemaId(); String groupId = profileFilterDto.getEndpointGroupId(); EndpointGroup group = endpointGroupDao.findById(groupId); if (group.getWeight() == 0) { throw new UpdateStatusConflictException("Add profile filter to default group is forbidden!"); } EndpointProfileSchemaDto endpointProfileSchemaDto = null; if (endProfSchemaId != null) { endpointProfileSchemaDto = findProfileSchemaById(endProfSchemaId); if (endpointProfileSchemaDto == null) { throw new IncorrectParameterException("Can't update profile filter, endpoint profile schema not found!"); } } ServerProfileSchemaDto serverProfileSchemaDto = null; if (srvProfSchemaId != null) { serverProfileSchemaDto = serverProfileService.findServerProfileSchema(srvProfSchemaId); if (serverProfileSchemaDto == null) { throw new IncorrectParameterException("Can't update profile filter, server profile schema not found!"); } } if (endpointProfileSchemaDto != null || serverProfileSchemaDto != null) { ProfileFilter inactiveFilter = profileFilterDao.findInactiveFilter(endProfSchemaId, srvProfSchemaId, groupId); ProfileFilter latestFilter = profileFilterDao.findLatestFilter(endProfSchemaId, srvProfSchemaId, groupId); if (inactiveFilter != null) { profileFilterDto.setId(inactiveFilter.getId().toString()); profileFilterDto.setSequenceNumber(inactiveFilter.getSequenceNumber()); } else if (latestFilter != null) { profileFilterDto.setSequenceNumber(latestFilter.getSequenceNumber()); } if (endpointProfileSchemaDto != null) { profileFilterDto.setApplicationId(endpointProfileSchemaDto.getApplicationId()); } else { profileFilterDto.setApplicationId(serverProfileSchemaDto.getApplicationId()); } profileFilterDto.setCreatedTime(System.currentTimeMillis()); } else { throw new IncorrectParameterException("Can't update profile filter, profile schemas not set!"); } } profileFilterDto.setStatus(UpdateStatus.INACTIVE); profileFilterDto.setLastModifyTime(System.currentTimeMillis()); return getDto(profileFilterDao.save(new ProfileFilter(profileFilterDto))); } @Override public ChangeProfileFilterNotification activateProfileFilter(String id, String activatedUsername) { ChangeProfileFilterNotification profileNotification; ProfileFilterDto profileFilter; validateSqlId(id, "Can't activate profile filter. Invalid profile filter id: " + id); ProfileFilter oldProfileFilter = profileFilterDao.findById(id); if (oldProfileFilter != null) { UpdateStatus status = oldProfileFilter.getStatus(); if (status != null && status == INACTIVE) { String endProfSchemaId = oldProfileFilter.getEndpointProfileSchemaId(); String srvProfSchemaId = oldProfileFilter.getServerProfileSchemaId(); String groupId = oldProfileFilter.getGroupId(); if (groupId != null) { profileFilterDao.deactivateOldFilter(endProfSchemaId, srvProfSchemaId, groupId, activatedUsername); } else { throw new DatabaseProcessingException("Incorrect old profile filters. Profile schema id is empty."); } profileFilter = getDto(profileFilterDao.activate(id, activatedUsername)); if (profileFilter != null) { HistoryDto history = addHistory(profileFilter, ChangeType.ADD_PROF); ChangeNotificationDto changeNotificationDto = createNotification(profileFilter, history); profileNotification = new ChangeProfileFilterNotification(); profileNotification.setProfileFilterDto(profileFilter); profileNotification.setChangeNotificationDto(changeNotificationDto); } else { throw new DatabaseProcessingException("Can't activate profile filter."); } } else { throw new UpdateStatusConflictException("Incorrect status for activating profile filter " + status); } } else { throw new IncorrectParameterException("Can't find profile filter with id " + id); } return profileNotification; } @Override public ChangeProfileFilterNotification deactivateProfileFilter(String id, String deactivatedUsername) { ChangeProfileFilterNotification profileNotification; validateSqlId(id, "Incorrect profile filter id. Can't deactivate profile filter with id " + id); ProfileFilter oldProfileFilter = profileFilterDao.findById(id); if (oldProfileFilter != null) { UpdateStatus status = oldProfileFilter.getStatus(); String oid = oldProfileFilter.getGroupId(); if (oid != null) { EndpointGroup group = endpointGroupDao.findById(oid); if (group != null && group.getWeight() == 0) { throw new IncorrectParameterException("Can't deactivate default profile filter"); } } if (status != null && status == ACTIVE) { ProfileFilterDto profileFilterDto = getDto(profileFilterDao.deactivate(id, deactivatedUsername)); HistoryDto historyDto = addHistory(profileFilterDto, ChangeType.REMOVE_PROF); ChangeNotificationDto changeNotificationDto = createNotification(profileFilterDto, historyDto); profileNotification = new ChangeProfileFilterNotification(); profileNotification.setProfileFilterDto(profileFilterDto); profileNotification.setChangeNotificationDto(changeNotificationDto); } else { throw new UpdateStatusConflictException("Incorrect status for activating profile filter " + status); } } else { throw new IncorrectParameterException("Can't find profile filter with id " + id); } return profileNotification; } @Override public ChangeProfileFilterNotification deleteProfileFilterRecord(String endpointProfileSchemaId, String serverProfileSchemaId, String groupId, String deactivatedUsername) { validateFilterSchemaIds(endpointProfileSchemaId, serverProfileSchemaId); validateSqlId(groupId, "Incorrect group id " + groupId + "."); ChangeProfileFilterNotification profileNotification = null; ProfileFilterDto profileFilterDto = getDto(profileFilterDao.deactivateOldFilter(endpointProfileSchemaId, serverProfileSchemaId, groupId, deactivatedUsername)); if (profileFilterDto != null) { HistoryDto historyDto = addHistory(profileFilterDto, ChangeType.REMOVE_PROF); ChangeNotificationDto changeNotificationDto = createNotification(profileFilterDto, historyDto); profileNotification = new ChangeProfileFilterNotification(); profileNotification.setProfileFilterDto(profileFilterDto); profileNotification.setChangeNotificationDto(changeNotificationDto); } ProfileFilter profileFilter = profileFilterDao.findInactiveFilter(endpointProfileSchemaId, serverProfileSchemaId, groupId); if (profileFilter != null) { profileFilterDao.removeById(profileFilter.getId().toString()); } return profileNotification; } private ChangeNotificationDto createNotification(ProfileFilterDto profileFilter, HistoryDto historyDto) { LOG.debug("Create notification after profile filter update."); ChangeNotificationDto changeNotificationDto = null; if (historyDto != null) { changeNotificationDto = new ChangeNotificationDto(); changeNotificationDto.setAppId(profileFilter.getApplicationId()); changeNotificationDto.setAppSeqNumber(historyDto.getSequenceNumber()); String endpointGroupId = profileFilter.getEndpointGroupId(); if (isValidId(endpointGroupId)) { EndpointGroup group = endpointGroupDao.findById(endpointGroupId); if (group != null) { changeNotificationDto.setGroupId(group.getId().toString()); changeNotificationDto.setGroupSeqNumber(group.getSequenceNumber()); } else { LOG.debug("Can't find endpoint group by id [{}].", endpointGroupId); } } else { LOG.debug("Incorrect endpoint group id [{}].", endpointGroupId); } } else { LOG.debug("Can't save history information."); } return changeNotificationDto; } @Override public List<ProfileFilterDto> findProfileFiltersByAppIdAndVersionsCombination(String appId, int endpointSchemaVersion, int serverSchemaVersion) { validateId(appId, "Can't find profile filter. Invalid application id: " + appId); return convertDtoList(profileFilterDao.findByAppIdAndSchemaVersionsCombination(appId, endpointSchemaVersion, serverSchemaVersion)); } @Override public EndpointProfileSchemaDto findProfileSchemaByAppIdAndVersion(String appId, int schemaVersion) { validateId(appId, "Can't find profile schema. Invalid application id: " + appId); return getDto(profileSchemaDao.findByAppIdAndVersion(appId, schemaVersion)); } @Override public ProfileFilterDto findLatestFilterBySchemaIdsAndGroupId(String endpointProfileSchemaId, String serverProfileSchemaId, String groupId) { validateFilterSchemaIds(endpointProfileSchemaId, serverProfileSchemaId); validateId(groupId, "Can't find profile filter. Invalid group id: " + groupId); return getDto(profileFilterDao.findLatestFilter(endpointProfileSchemaId, serverProfileSchemaId, groupId)); } @Override public EndpointProfileDto findEndpointProfileByEndpointKeyHash(String endpointKeyHash) { byte[] hash= Base64.decodeBase64(endpointKeyHash); EndpointProfileDto endpointProfile = endpointService.findEndpointProfileByKeyHash(hash); return endpointProfile; } private HistoryDto addHistory(ProfileFilterDto dto, ChangeType type) { LOG.debug("Add history information about profile filter update with change type {} ", type); HistoryDto history = new HistoryDto(); history.setApplicationId(dto.getApplicationId()); ChangeDto change = new ChangeDto(); change.setProfileFilterId(dto.getId()); change.setProfileFilterId(dto.getId()); change.setEndpointGroupId(dto.getEndpointGroupId()); change.setType(type); history.setChange(change); return historyService.saveHistory(history); } private void validateFilterSchemaIds(String endpointProfileSchemaId, String serverProfileSchemaId) { if (isBlank(endpointProfileSchemaId) && isBlank(serverProfileSchemaId)) { throw new IncorrectParameterException("Both profile schema ids can't be empty"); } } private void validateFilter(ProfileFilterDto dto) { if (dto == null) { throw new IncorrectParameterException("Can't save profile filter. Incorrect object."); } if (dto.getEndpointProfileSchemaId() == null && dto.getServerProfileSchemaId() == null) { throw new IncorrectParameterException("Profile Filter object invalid. Both schemas are empty."); } if (StringUtils.isBlank(dto.getEndpointGroupId())) { throw new IncorrectParameterException("Profile Filter object invalid. Endpoint Group id invalid:" + dto.getEndpointGroupId()); } } }
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ltr = void 0; var ltr = { "viewBox": "0 0 16 16", "children": [{ "name": "path", "attribs": { "fill": "#000000", "d": "M8 0c-2.209 0-4 1.791-4 4s1.791 4 4 4v8h2v-14h2v14h2v-14h2v-2h-8zM0 11l4-4-4-4z" } }] }; exports.ltr = ltr;
<filename>src/test/java/ed/biodare2/backend/features/rhythmicity/RhythmicityResultsExporterTest.java<gh_stars>0 /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package ed.biodare2.backend.features.rhythmicity; import ed.biodare.jobcentre2.dom.JobResults; import ed.biodare.jobcentre2.dom.State; import ed.biodare.jobcentre2.dom.TSResult; import ed.biodare.rhythm.ejtk.BD2eJTKRes; import static ed.biodare2.backend.repo.isa_dom.DomRepoTestBuilder.makeBD2EJTKResults; import static ed.biodare2.backend.repo.isa_dom.DomRepoTestBuilder.makeDataTraces; import static ed.biodare2.backend.repo.isa_dom.DomRepoTestBuilder.makeRhythmicityJobSummary; import ed.biodare2.backend.repo.isa_dom.dataimport.DataTrace; import ed.biodare2.backend.repo.isa_dom.exp.ExperimentalAssay; import ed.biodare2.backend.repo.isa_dom.rhythmicity.RhythmicityJobSummary; import ed.biodare2.backend.util.TableBuilder; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.time.LocalDateTime; import java.util.List; import java.util.Map; import java.util.UUID; import java.util.stream.Collectors; import org.junit.Before; import org.junit.Test; import static org.junit.Assert.*; import org.junit.Rule; import org.junit.rules.TemporaryFolder; import static org.mockito.Mockito.*; /** * * @author <NAME> <<EMAIL>> */ public class RhythmicityResultsExporterTest { @Rule public TemporaryFolder testFolder = new TemporaryFolder(); public RhythmicityResultsExporterTest() { } RhythmicityResultsExporter instance; @Before public void setUp() { instance = new RhythmicityResultsExporter(); } @Test public void serializeJobPrintsJobAndExperimentDetails() { ExperimentalAssay exp = mock(ExperimentalAssay.class); when(exp.getId()).thenReturn(5670L); when(exp.getName()).thenReturn("exp name"); RhythmicityJobSummary job = makeRhythmicityJobSummary(UUID.randomUUID(), 5670L); job.jobStatus.state = State.SUCCESS; job.jobStatus.completed = LocalDateTime.now(); TableBuilder tb = instance.serializeJob(exp, job); String txt = tb.toString(); assertTrue(txt.contains("5670")); assertTrue(txt.contains("exp name")); assertTrue(txt.contains(job.jobId.toString())); assertTrue(txt.contains("BD2EJTK")); assertTrue(txt.contains("BD2_CLASSIC")); } @Test public void serlializeResutlsPrintsResultsAndLabels() { List<DataTrace> traces = makeDataTraces(1,2); traces.get(0).details.dataLabel = "first"; traces.get(1).details.dataLabel = "second"; Map<Long,DataTrace> orgData = traces.stream().collect(Collectors.toMap( dt -> dt.dataId, dt -> dt)); JobResults<TSResult<BD2eJTKRes>> results = makeBD2EJTKResults(UUID.randomUUID(), 123, 1, 2); results.results.get(0).result.empP = 3.14567; TableBuilder tb = instance.serializeResults(results, orgData); String content = tb.toString(); assertTrue(content.contains("first")); assertTrue(content.contains("second")); assertTrue(content.contains("3.14567")); } @Test public void exportSavesToFile() throws IOException { Path file = testFolder.newFile().toPath(); ExperimentalAssay exp = mock(ExperimentalAssay.class); when(exp.getId()).thenReturn(5670L); when(exp.getName()).thenReturn("exp name"); RhythmicityJobSummary job = makeRhythmicityJobSummary(UUID.randomUUID(), 5670L); job.jobStatus.state = State.SUCCESS; job.jobStatus.completed = LocalDateTime.now(); List<DataTrace> traces = makeDataTraces(1,2); traces.get(0).details.dataLabel = "first"; traces.get(1).details.dataLabel = "second"; Map<Long,DataTrace> orgData = traces.stream().collect(Collectors.toMap( dt -> dt.dataId, dt -> dt)); JobResults<TSResult<BD2eJTKRes>> results = makeBD2EJTKResults(UUID.randomUUID(), 123, 1, 2); results.results.get(0).result.empP = 3.14567; instance.exportJob(exp, job, results, orgData, file); assertTrue(Files.isRegularFile(file)); assertTrue(Files.size(file) > 10); } }
//Dijkstra's Algorithm : O(ElogV) //Min-priority Queue implemented using min-heap. #include <stdio.h> #include <string.h> #include <stdlib.h> #define inf ((int)(1e9)) #define N 1000 typedef struct graph_adj_list { int node; int weight; struct graph_adj_list *next; }node; typedef struct pair { int weight; int node; }pair; node *adj[N] = {NULL}; pair min_heap[N]; int edges, nodes, pos; int visited[N], dis[N]; void swap(int i, int j) { int t1, t2; t1 = min_heap[i].weight; t2 = min_heap[i].node; min_heap[i].weight = min_heap[j].weight; min_heap[i].node = min_heap[j].node; min_heap[j].weight = t1; min_heap[j].node = t2; } void priority_enqueue(int w, int node) { int temp; min_heap[++pos].weight = w; min_heap[pos].node = node; temp = pos; while(temp>1) { if(min_heap[temp].weight < min_heap[temp/2].weight) swap(temp, temp/2); temp/=2; } } void min_heapify() { int t1, t2; t1 = 1; while(t1<=pos) { if(min_heap[t1*2].weight < min_heap[t1*2 +1].weight) t2 = t1*2; else t2 = t1*2 +1; if(min_heap[t1].weight > min_heap[t2].weight) { swap(t1, t2); t1 = t2; } else break; } } pair priority_dequeue() { min_heap[0].weight = min_heap[1].weight; min_heap[0].node = min_heap[1].node; min_heap[1].weight = min_heap[pos].weight; min_heap[1].node = min_heap[pos].node; min_heap[pos].weight = inf; min_heap[pos].node = inf; pos--; min_heapify(); return min_heap[0]; } int isempty() { if(pos == 0) return 1; return 0; } void clear() { int i; for(i=0; i<N; i++) { min_heap[i].weight = inf; min_heap[i].node = inf; visited[i] = 0; dis[i] = inf; } pos = 0; } void dijkstra() { int i, x, w; pair p; node *temp; clear(); dis[0] = 0; priority_enqueue(0, 0); //arbitraray weight -> 0, Source vertex - 0 while(!isempty()) { p = priority_dequeue(); x = p.node; w = p.weight; if(visited[x]) continue; visited[x] = 1; temp = adj[x]; while(temp != NULL) { if(dis[temp->node] > dis[x] + temp->weight) { dis[temp->node] = dis[x] + temp->weight; priority_enqueue(dis[temp->node], temp->node); } temp = temp->next; } } } int main() { int i, min_cost, x, y, w; node *temp; printf("Enter number of nodes and edges : "); scanf("%d%d", &nodes, &edges); printf("\nEnter the pair of edges(undirected) with thier weights (i, j, w) where 0<=i,j<n\n"); for(i=0; i<edges; i++) { scanf("%d%d%d", &x, &y, &w); temp = (node *)malloc(sizeof(node)); temp->node = y; temp->weight = w; temp->next = adj[x]; adj[x] = temp; temp = (node *)malloc(sizeof(node)); temp->node = x; temp->weight = w; temp->next = adj[y]; adj[y] = temp; } dijkstra(); printf("\nMinimum distance from sorce vertex(0) for node 0 to %d are\n", nodes-1); for(i=0; i<nodes; i++) printf("%d ", dis[i]); printf("\n\n"); } /* Test Case 1: 5 5 0 1 5 0 2 2 2 3 1 0 3 6 2 4 5 Output: 0 5 2 3 7 x-------------x Test Case 2: 7 7 0 1 1 0 2 4 1 3 6 2 4 5 3 5 1 4 5 1 5 6 1 Output: 0 1 4 7 9 8 9 */
#!/usr/bin/env bats load jboss-kie-wildfly-common export JBOSS_HOME=$BATS_TMPDIR/jboss_home mkdir -p $JBOSS_HOME/standalone/configuration mkdir -p $JBOSS_HOME/bin/launch cp $BATS_TEST_DIRNAME/../../../tests/bats/common/launch-common.sh $JBOSS_HOME/bin/launch touch $JBOSS_HOME/bin/launch/logging.sh export CONFIG_FILE=$JBOSS_HOME/standalone/configuration/standalone-openshift.xml source $BATS_TEST_DIRNAME/../../added/launch/jboss-kie-wildfly-security.sh setup() { cp $BATS_TEST_DIRNAME/resources/application-properties.xml $CONFIG_FILE run unset_kie_security_env } @test "leave application users and roles alone when properties are not provided" { run set_application_users_config [ "$status" -eq 0 ] run set_application_roles_config [ "$status" -eq 0 ] assert_xml $CONFIG_FILE $BATS_TEST_DIRNAME/resources/application-properties.xml } @test "replace application users and roles when properties are provided" { APPLICATION_USERS_PROPERTIES="${BATS_TMPDIR}/opt/kie/data/configuration/application-users.properties" APPLICATION_ROLES_PROPERTIES="${BATS_TMPDIR}/opt/kie/data/configuration/application-roles.properties" run set_application_users_config [ "$status" -eq 0 ] run set_application_roles_config [ "$status" -eq 0 ] assert_xml $CONFIG_FILE $BATS_TEST_DIRNAME/expectations/application-properties-replaced.xml grep '^\#\$REALM_NAME=ApplicationRealm\$' "${APPLICATION_USERS_PROPERTIES}" > /dev/null 2>&1 [ "$status" -eq 0 ] }
#--timeout=900 PREPS='copyOnly' STEPS=( 'splCompile' 'submitJob' 'checkJobNo' 'waitForFinAndHealth' 'cancelJobAndLog' 'checkTuples' 'linewisePatternMatchInterceptAndSuccess data/WindowMarker "true" "{seq_=199,typ_=\"w\",avroMessage=}"' 'linewisePatternMatchInterceptAndSuccess data/FinalMarker "" "{seq_=200,typ_=\"f\",avroMessage=}"' 'checkContent' ) FINS='cancelJobAndLog' checkTuples() { local i j for ((i=0; i<100; i++)); do j=$((i*2)) linewisePatternMatchInterceptAndSuccess data/Tuples "true" "{seq_=$j,typ_=\"t\",avroMessage*" done return 0 } checkContent() { if ! jq --version; then printError "Json tool jq not available" return 0 fi local i local reference actval for ((i=0; i<100; i++)); do java -jar "$TTRO_inputDir/../avro-tools-1.9.1.jar" 'tojson' "data/AvroFile_$i" > "data/CompFile_$i" reference="$(jq '.username' "data/JsonFile_$i")" actval="$(jq '.username' "data/CompFile_$i")" if [[ $actval == $reference ]]; then echo "Matching username $i: $actval" else setFailure "Difference in username file data/CompFile_$i" break fi reference="$(jq '.tweet' "data/JsonFile_$i")" actval="$(jq '.tweet' "data/CompFile_$i")" if [[ $actval == $reference ]]; then echo "Matching tweet $i: $actval" else setFailure "Difference in tweet file data/CompFile_$i" break fi reference="$(jq '.tweettime' "data/JsonFile_$i")" actval="$(jq '.tweettime' "data/CompFile_$i")" if [[ $actval == $reference ]]; then echo "Matching tweettime $i: $actval" else setFailure "Difference in tweettime file data/CompFile_$i" break fi done return 0 }
(function() { 'use strict'; angular .module('sentryApp') .controller('BotDeleteController',BotDeleteController); BotDeleteController.$inject = ['$uibModalInstance', 'entity', 'Bot']; function BotDeleteController($uibModalInstance, entity, Bot) { var vm = this; vm.bot = entity; vm.clear = clear; vm.confirmDelete = confirmDelete; function clear () { $uibModalInstance.dismiss('cancel'); } function confirmDelete (id) { Bot.delete({id: id}, function () { $uibModalInstance.close(true); }); } } })();
#!/bin/sh # # Copyright 2019 PingCAP, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # See the License for the specific language governing permissions and # limitations under the License. set -eu DB="$TEST_NAME" run_sql "CREATE DATABASE $DB;" run_sql "CREATE TABLE $DB.usertable1 ( \ YCSB_KEY varchar(64) NOT NULL, \ FIELD0 varchar(1) DEFAULT NULL, \ PRIMARY KEY (YCSB_KEY) \ ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;" run_sql "INSERT INTO $DB.usertable1 VALUES (\"a\", \"b\");" run_sql "INSERT INTO $DB.usertable1 VALUES (\"aa\", \"b\");" # backup table echo "backup start..." run_br --pd $PD_ADDR backup table --db $DB --table usertable1 -s "local://$TEST_DIR/$DB" --ratelimit 5 --concurrency 4 # Test validate decode run_br validate decode -s "local://$TEST_DIR/$DB" # should generate backupmeta.json if [ ! -f "$TEST_DIR/$DB/backupmeta.json" ]; then echo "TEST: [$TEST_NAME] failed!" exit 1 fi # Test validate encode run_br validate encode -s "local://$TEST_DIR/$DB" # should generate backupmeta_from_json if [ ! -f "$TEST_DIR/$DB/backupmeta_from_json" ]; then echo "TEST: [$TEST_NAME] failed!" exit 1 fi DIFF=$(diff $TEST_DIR/$DB/backupmeta_from_json $TEST_DIR/$DB/backupmeta) if [ "$DIFF" != "" ] then echo "TEST: [$TEST_NAME] failed!" exit 1 fi run_sql "DROP DATABASE $DB;"
/** * Flym * <p/> * Copyright (c) 2012-2015 <NAME> * <p/> * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 2 of the License, or * (at your option) any later version. * <p/> * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * <p/> * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package yali.org.adapter; import android.content.Context; import android.database.Cursor; import android.graphics.Bitmap; import android.graphics.Color; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.ImageView; import android.widget.TextView; import java.util.LinkedHashMap; import java.util.Map; import yali.org.MainApplication; import yali.org.R; import yali.org.provider.FeedData; import yali.org.utils.StringUtils; import yali.org.utils.UiUtils; public class DrawerAdapter extends BaseAdapter { private static final int POS_ID = 0; private static final int POS_URL = 1; private static final int POS_NAME = 2; private static final int POS_IS_GROUP = 2; private static final int POS_ICON = 4; private static final int POS_LAST_UPDATE = 5; private static final int POS_ERROR = 6; private static final int POS_UNREAD = 7; private static final int NORMAL_TEXT_COLOR = Color.parseColor("#EEEEEE"); private static final int GROUP_TEXT_COLOR = Color.parseColor("#BBBBBB"); private static final String COLON = MainApplication.getContext().getString(R.string.colon); private static final int CACHE_MAX_ENTRIES = 100; private final Map<Long, String> mFormattedDateCache = new LinkedHashMap<Long, String>(CACHE_MAX_ENTRIES + 1, .75F, true) { @Override public boolean removeEldestEntry(Entry<Long, String> eldest) { return size() > CACHE_MAX_ENTRIES; } }; private final Context mContext; private Cursor mFeedsCursor; private int mAllUnreadNumber, mFavoritesNumber; public DrawerAdapter(Context context, Cursor feedCursor) { mContext = context; mFeedsCursor = feedCursor; updateNumbers(); } public void setCursor(Cursor feedCursor) { mFeedsCursor = feedCursor; updateNumbers(); notifyDataSetChanged(); } public View getView(int position, View convertView, ViewGroup parent) { if (convertView == null) { LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); convertView = inflater.inflate(R.layout.item_drawer_list, parent, false); ViewHolder holder = new ViewHolder(); holder.iconView = (ImageView) convertView.findViewById(android.R.id.icon); holder.titleTxt = (TextView) convertView.findViewById(android.R.id.text1); //holder.stateTxt = (TextView) convertView.findViewById(android.R.id.text2); //holder.unreadTxt = (TextView) convertView.findViewById(R.id.unread_count); holder.separator = convertView.findViewById(R.id.separator); convertView.setTag(R.id.holder, holder); } ViewHolder holder = (ViewHolder) convertView.getTag(R.id.holder); // default init holder.iconView.setImageDrawable(null); holder.titleTxt.setText(""); holder.titleTxt.setTextColor(NORMAL_TEXT_COLOR); holder.titleTxt.setAllCaps(false); //holder.stateTxt.setVisibility(View.GONE); //holder.unreadTxt.setText(""); convertView.setPadding(0, 0, 0, 0); holder.separator.setVisibility(View.GONE); if (position == 0 || position == 1/* || position == 2*/) { switch (position) { /* case 0: *//* holder.titleTxt.setText(R.string.unread_entries); holder.iconView.setImageResource(R.drawable.ic_statusbar_rss); if (mAllUnreadNumber != 0) { //holder.unreadTxt.setText(String.valueOf(mAllUnreadNumber)); }*//* break;*/ case 0: holder.titleTxt.setText(R.string.all_entries); holder.iconView.setImageResource(R.drawable.ic_statusbar_rss); break; case 1: holder.titleTxt.setText(R.string.favorites); holder.iconView.setImageResource(R.drawable.rating_important); if (mFavoritesNumber != 0) { //holder.unreadTxt.setText(String.valueOf(mFavoritesNumber)); } break; } } if (mFeedsCursor != null && mFeedsCursor.moveToPosition(position - 2)) { holder.titleTxt.setText((mFeedsCursor.isNull(POS_NAME) ? mFeedsCursor.getString(POS_URL) : mFeedsCursor.getString(POS_NAME))); if (mFeedsCursor.getInt(POS_IS_GROUP) == 1) { holder.titleTxt.setTextColor(GROUP_TEXT_COLOR); holder.titleTxt.setAllCaps(true); holder.separator.setVisibility(View.VISIBLE); } else { //holder.stateTxt.setVisibility(View.VISIBLE); if (mFeedsCursor.isNull(POS_ERROR)) { long timestamp = mFeedsCursor.getLong(POS_LAST_UPDATE); // Date formatting is expensive, look at the cache String formattedDate = mFormattedDateCache.get(timestamp); if (formattedDate == null) { formattedDate = mContext.getString(R.string.update) + COLON; if (timestamp == 0) { formattedDate += mContext.getString(R.string.never); } else { formattedDate += StringUtils.getDateTimeString(timestamp); } mFormattedDateCache.put(timestamp, formattedDate); } // holder.stateTxt.setText(formattedDate); } else { //holder.stateTxt.setText(new StringBuilder(mContext.getString(R.string.error)).append(COLON).append(mFeedsCursor.getString(POS_ERROR))); } final long feedId = mFeedsCursor.getLong(POS_ID); Bitmap bitmap = UiUtils.getFaviconBitmap(feedId, mFeedsCursor, POS_ICON); if (bitmap != null) { holder.iconView.setImageBitmap(bitmap); } else { holder.iconView.setImageResource(R.mipmap.ic_launcher); } int unread = mFeedsCursor.getInt(POS_UNREAD); if (unread != 0) { //holder.unreadTxt.setText(String.valueOf(unread)); } } } return convertView; } @Override public int getCount() { if (mFeedsCursor != null) { return mFeedsCursor.getCount() + 2; } return 0; } @Override public Object getItem(int position) { return null; } @Override public long getItemId(int position) { if (mFeedsCursor != null && mFeedsCursor.moveToPosition(position - 2)) { return mFeedsCursor.getLong(POS_ID); } return -1; } public byte[] getItemIcon(int position) { if (mFeedsCursor != null && mFeedsCursor.moveToPosition(position - 2)) { return mFeedsCursor.getBlob(POS_ICON); } return null; } public String getItemName(int position) { if (mFeedsCursor != null && mFeedsCursor.moveToPosition(position - 2)) { return mFeedsCursor.isNull(POS_NAME) ? mFeedsCursor.getString(POS_URL) : mFeedsCursor.getString(POS_NAME); } return null; } public boolean isItemAGroup(int position) { return mFeedsCursor != null && mFeedsCursor.moveToPosition(position - 2) && mFeedsCursor.getInt(POS_IS_GROUP) == 1; } private void updateNumbers() { mAllUnreadNumber = mFavoritesNumber = 0; // Gets the numbers of entries (should be in a thread, but it's way easier like this and it shouldn't be so slow) Cursor numbers = mContext.getContentResolver().query(FeedData.EntryColumns.CONTENT_URI, new String[]{/*FeedData.ALL_UNREAD_NUMBER, */FeedData.FAVORITES_NUMBER}, null, null, null); if (numbers != null) { if (numbers.moveToFirst()) { //mAllUnreadNumber = numbers.getInt(0); mFavoritesNumber = numbers.getInt(0); } numbers.close(); } } private static class ViewHolder { public ImageView iconView; public TextView titleTxt; //public TextView stateTxt; //public TextView unreadTxt; public View separator; } }
<reponame>doorbash/android-useful-modules<gh_stars>1-10 package ir.doorbash.licensechecker.util.lock; import android.content.Context; import android.os.PowerManager; import android.util.Log; import ir.doorbash.licensechecker.util.LogUtil; /** * Created by <NAME> on 3/16/16. */ public class CheckPowerLock { public static final String WAKE_LOG_TAG = "LC_CHECK"; private static PowerManager.WakeLock mWakeLock; public static void acquire(Context c) { Log.i(LogUtil.TAG, WAKE_LOG_TAG + " powerlock acquired!"); try { if (mWakeLock == null) { PowerManager pm = (PowerManager) c.getSystemService(Context.POWER_SERVICE); mWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, WAKE_LOG_TAG); } mWakeLock.acquire(); } catch (Exception e) { } } public static void release() { Log.i(LogUtil.TAG, WAKE_LOG_TAG + " powerlock released!"); try { if (mWakeLock != null) { mWakeLock.release(); } } catch (Exception e) { } } }
<filename>src/app/app.routing.ts import { NgModule } from '@angular/core'; import { CommonModule, } from '@angular/common'; import { BrowserModule } from '@angular/platform-browser'; import { Routes, RouterModule } from '@angular/router'; import { HomeComponent } from './home/home.component'; import { ProfileComponent } from './profile/profile.component'; import { SignupComponent } from './signup/signup.component'; import { LandingComponent } from './landing/landing.component'; import { PricingComponent } from './pricing/pricing.component'; import { LoginComponent } from './login/login.component'; import { TestComponent } from './test/test.component'; import { CheckoutComponent } from './checkout/checkout.component'; import { PrivacyComponent } from './privacy/privacy.component'; import { TermsAndConditionsComponent } from './terms-and-conditions/terms-and-conditions.component'; import { AboutUsComponent } from './about-us/about-us.component'; const routes: Routes = [ { path: 'home', component: HomeComponent }, { path: 'user-profile', component: ProfileComponent }, { path: 'pricing', component: PricingComponent }, { path: 'signup', component: SignupComponent }, { path: 'landing', component: LandingComponent }, { path: 'login', component: LoginComponent }, { path: 'test', component: TestComponent }, { path: 'checkout', component: CheckoutComponent }, { path: 'privacy', component: PrivacyComponent }, { path: 'termsAndConditions', component: TermsAndConditionsComponent}, { path: 'aboutUs', component: AboutUsComponent}, { path: '', redirectTo: 'home', pathMatch: 'full' } ]; @NgModule({ imports: [ CommonModule, BrowserModule, RouterModule.forRoot(routes) ], exports: [ ], }) export class AppRoutingModule { }
package be.kwakeroni.evelyn.test; import be.kwakeroni.evelyn.model.Event; import be.kwakeroni.evelyn.storage.Storage; import java.time.LocalDateTime; import java.util.Arrays; import java.util.stream.Stream; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; public final class TestModel { public static final String STORAGE_SOURCE = "TestModel$Storage"; private TestModel() { } public static Storage asStorage(String... contents) { return asStorage(null, contents); } public static Storage asStorage(SilentCloseable resource, String... contents) { Storage storage = mock(Storage.class); when(storage.getReference()).thenReturn(STORAGE_SOURCE); when(storage.read(any())).thenAnswer(no -> Arrays.stream(contents) .onClose(() -> { if (resource != null) { resource.close(); } })); return storage; } public static Storage asStorage(String version, String name, Event... events) { return asStorage(Stream.concat( Stream.of("!evelyn-db", "!version=" + version, "!name=" + name, "!data"), Stream.of(events).map(TestModel::toStorageLine) ).toArray(String[]::new)); } private static String toStorageLine(Event event) { return String.format(" %s|%s|%s|%s|%s", event.getTime(), event.getObjectId(), event.getUser(), event.getOperation(), event.getData()); } public static Event event(String objectId) { return event("anonymous", objectId, "INSERT", "abc", LocalDateTime.now()); } public static Event event(String user, String objectId, String operation, String data, LocalDateTime time) { return new Event() { @Override public LocalDateTime getTime() { return time; } @Override public String getObjectId() { return objectId; } @Override public String getUser() { return user; } @Override public String getOperation() { return operation; } @Override public String getData() { return data; } @Override public String toString() { return "event{" + "objectId='" + objectId + '\'' + ", operation='" + operation + '\'' + ", data='" + data + '\'' + '}'; } }; } }
from typing import List import numpy as np def clip_to_range(arr: List[float], min_val: float, max_val: float) -> List[float]: return np.clip(arr, min_val, max_val).tolist() # Test the function arr = [1, 5, 10, 15, 20] min_val = 5 max_val = 15 print(clip_to_range(arr, min_val, max_val)) # Output: [5, 5, 10, 15, 15]
<filename>routes/index.js var express = require('express'); var router = express.Router(); var mysql = require('mysql'); /* GET home page. */ router.get('/', function(req, res, next) { var newstype = req.query.newstype; var connection = mysql.createConnection({ host: "localhost", user: "root", password: "", database: "baidunews", dateStrings: true }); // console.log("newstype:" + newstype); connection.connect(); if (typeof newstype != "undefined") { connection.query("SELECT `newsType_id` FROM `newsType` WHERE `newsType_name`=?", [newstype], function(err, rows) { rows.forEach(function(value, index) { newstype = value["newsType_id"]; }); console.log(newstype); // 第二次查询要放在回调中(回调是异步的) connection.query("SELECT * FROM news WHERE newstype=? AND newsstatus=1", [newstype], function(err, rows) { if (err) throw err; // xss转义 rows.forEach(function(value, index) { value["newstitle"] = htmlspecialchars(value["newstitle"]); value["newssrc"] = htmlspecialchars(value["newssrc"]); value["newstype"] = htmlspecialchars(value["newstype"]); value["newspath"] = htmlspecialchars(value["newspath"]); }); res.json(rows); // 关闭数据库连接(放在回调中) connection.end(); }); }); } else { connection.query("SELECT * FROM newstype", function(err2, rows2) { connection.query("SELECT * FROM news WHERE newsstatus=1", function(err1, rows1) { rows1.forEach(function(value1,index1){ // value["newstype"]=?; newstype=value1["newstype"]; rows2.forEach(function(value2,index2){ if(value2["newsType_id"]==newstype){ newstype=value2["newsType_name"]; } }); value1["newstype"]=htmlspecialchars(newstype); value1["newstitle"] = htmlspecialchars(value1["newstitle"]); value1["newssrc"] = htmlspecialchars(value1["newssrc"]); value1["newspath"] = htmlspecialchars(value1["newspath"]); }); res.json(rows1); connection.end(); }); }); } // console.log(req); // res.json({ // success:"成功" // }); }); module.exports = router; function htmlspecialchars(str) { var s = ""; if (str.length == 0) return ""; for (var i = 0; i < str.length; i++) { switch (str.substr(i, 1)) { case "<": s += "&lt;"; break; case ">": s += "&gt;"; break; case "&": s += "&amp;"; break; case " ": if (str.substr(i + 1, 1) == " ") { s += " &nbsp;"; i++; } else s += " "; break; case "\"": s += "&quot;"; break; case "\n": s += "<br>"; break; default: s += str.substr(i, 1); break; } } return s; }
<gh_stars>1-10 /** * Copyright (c) 2017-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ const fs = require('fs-extra'); const path = require('path'); const {idx} = require('../utils'); /** * Check that item contains only allowed keys * * @param {Object} item * @param {Array<string>} keys */ function assertItem(item, keys) { const unknownKeys = Object.keys(item).filter( key => !keys.includes(key) && key !== 'type', ); if (unknownKeys.length) { throw new Error( `Unknown sidebar item keys: ${unknownKeys}. Item: ${JSON.stringify( item, )}`, ); } } /** * Normalizes recursively category and all its children. Ensures, that at the end * each item will be an object with the corresponding type * * @param {Array<Object>} category * @param {number} [level=0] * * @return {Array<Object>} */ function normalizeCategory(category, level = 0) { if (level === 2) { throw new Error( `Can not process ${ category.label } category. Categories can be nested only one level deep.`, ); } assertItem(category, ['items', 'label']); if (!Array.isArray(category.items)) { throw new Error( `Error loading ${category.label} category. Category items must be array.`, ); } const items = category.items.map(item => { switch (item.type) { case 'category': return normalizeCategory(item, level + 1); case 'link': assertItem(item, ['href', 'label']); break; case 'ref': assertItem(item, ['id', 'label']); break; default: if (typeof item === 'string') { return { type: 'doc', id: item, }; } if (item.type !== 'doc') { throw new Error(`Unknown sidebar item type: ${item.type}`); } assertItem(item, ['id', 'label']); break; } return item; }); return {...category, items}; } /** * Converts sidebars object to mapping to arrays of sidebar item objects * * @param {{[key: string]: Object}} sidebars * * @return {{[key: string]: Array<Object>}} */ function normalizeSidebar(sidebars) { return Object.entries(sidebars).reduce((acc, [sidebarId, sidebar]) => { let normalizedSidebar = sidebar; if (!Array.isArray(sidebar)) { // convert sidebar to a more generic structure normalizedSidebar = Object.entries(sidebar).map(([label, items]) => ({ type: 'category', label, items, })); } acc[sidebarId] = normalizedSidebar.map(item => normalizeCategory(item)); return acc; }, {}); } module.exports = function loadSidebars({siteDir, env}, deleteCache = true) { let allSidebars = {}; // current sidebars const sidebarsJSONFile = path.join(siteDir, 'sidebars.json'); if (deleteCache) { delete require.cache[sidebarsJSONFile]; } if (fs.existsSync(sidebarsJSONFile)) { allSidebars = require(sidebarsJSONFile); // eslint-disable-line } // versioned sidebars if (idx(env, ['versioning', 'enabled'])) { const versions = idx(env, ['versioning', 'versions']); if (Array.isArray(versions)) { versions.forEach(version => { const versionedSidebarsJSONFile = path.join( siteDir, 'versioned_sidebars', `version-${version}-sidebars.json`, ); if (fs.existsSync(versionedSidebarsJSONFile)) { const sidebar = require(versionedSidebarsJSONFile); // eslint-disable-line Object.assign(allSidebars, sidebar); } else { const missingFile = path.relative(siteDir, versionedSidebarsJSONFile); throw new Error(`Failed to load ${missingFile}. It does not exist.`); } }); } } return normalizeSidebar(allSidebars); };
def validateRoleTypeLocation(modelXbrl, modelObject, parentModelObject, xmlDocument): if modelObject.isMislocated: error_message = _("Schema file link:roleType may only be located at path //xs:schema/xs:annotation/xs:appinfo but was found at %(elementPath)s") modelXbrl.error("xbrl.5.1.3.roleTypeLocation", error_message, modelObject=modelObject, elementPath=xmlDocument.getpath(parentModelObject)) roleURI = modelObject.roleURI if roleURI not in modelXbrl.roleTypes: modelXbrl.roleTypes[roleURI] = [modelObject] else: modelXbrl.roleTypes[roleURI].append(modelObject)
import Phone from '@/util/phone' test('isMobile', () => { expect(Phone.isMobile(13800138000)).toBeTruthy() expect(Phone.isMobile('13800138000')).toBeTruthy() }) test('getPurePhone and beautifyPhone', () => { expect(Phone.getPurePhone(13800138000123)).toBe('13800138000') expect(Phone.getPurePhone('1380a0138000123c')).toBe('13800138000') expect(checkPurePhoneError).toThrow() expect(Phone.beautifyPhone(13800138000)).toBe('138 0013 8000') expect(Phone.beautifyPhone('13800138000')).toBe('138 0013 8000') expect(Phone.beautifyPhone('1380')).toBe('138 0') expect(Phone.beautifyPhone('1380abc1384')).toBe('138 0138 4') expect(Phone.beautifyPhone('ab1380abc1384')).toBe('138 0138 4') }) test('mosaic phone', () => { expect(Phone.mosaic('13800138000')).toBe('138****8000') expect(Phone.mosaic('ab1380abc1384')).toBe('138****4') expect(Phone.mosaic('13800138000', '-')).toBe('138----8000') expect(Phone.mosaic('13800138000', 123)).not.toBe('138----8000') expect(Phone.mosaic('13800138000', '-')).toBe('138----8000') expect(Phone.mosaic('13800138000', '-', 4, 7)).toBe('1380---8000') expect(Phone.mosaic('13800138000', '-', 4, 4)).not.toBe('1380***38000') expect(Phone.mosaic('')).not.toBe('1380***38000') expect(Phone.mosaic(undefined)).not.toBe('1380***38000') expect(checkMosaicPhone).toThrow('mosaicEnd must bigger than mosaicStart') expect(checkMosaicPhoneError).toThrow() }) function checkMosaicPhone () { return Phone.mosaic('13800138000', '-', 7, 4) } function checkPurePhoneError () { return Phone.getPurePhone({ a: 13800138000 }) } function checkMosaicPhoneError () { return Phone.mosaic('13800138000', '-', '4', 4) }
<filename>node_modules/@reactivex/rxjs/dist/es6/operator/windowTime.js import { Subscriber } from '../Subscriber'; import { Subject } from '../Subject'; import { async } from '../scheduler/async'; /** * Branch out the source Observable values as a nested Observable periodically * in time. * * <span class="informal">It's like {@link bufferTime}, but emits a nested * Observable instead of an array.</span> * * <img src="./img/windowTime.png" width="100%"> * * Returns an Observable that emits windows of items it collects from the source * Observable. The output Observable starts a new window periodically, as * determined by the `windowCreationInterval` argument. It emits each window * after a fixed timespan, specified by the `windowTimeSpan` argument. When the * source Observable completes or encounters an error, the output Observable * emits the current window and propagates the notification from the source * Observable. If `windowCreationInterval` is not provided, the output * Observable starts a new window when the previous window of duration * `windowTimeSpan` completes. * * @example <caption>In every window of 1 second each, emit at most 2 click events</caption> * var clicks = Rx.Observable.fromEvent(document, 'click'); * var result = clicks.windowTime(1000) * .map(win => win.take(2)) // each window has at most 2 emissions * .mergeAll(); // flatten the Observable-of-Observables * result.subscribe(x => console.log(x)); * * @example <caption>Every 5 seconds start a window 1 second long, and emit at most 2 click events per window</caption> * var clicks = Rx.Observable.fromEvent(document, 'click'); * var result = clicks.windowTime(1000, 5000) * .map(win => win.take(2)) // each window has at most 2 emissions * .mergeAll(); // flatten the Observable-of-Observables * result.subscribe(x => console.log(x)); * * @see {@link window} * @see {@link windowCount} * @see {@link windowToggle} * @see {@link windowWhen} * @see {@link bufferTime} * * @param {number} windowTimeSpan The amount of time to fill each window. * @param {number} [windowCreationInterval] The interval at which to start new * windows. * @param {Scheduler} [scheduler=async] The scheduler on which to schedule the * intervals that determine window boundaries. * @return {Observable<Observable<T>>} An observable of windows, which in turn * are Observables. * @method windowTime * @owner Observable */ export function windowTime(windowTimeSpan, windowCreationInterval = null, scheduler = async) { return this.lift(new WindowTimeOperator(windowTimeSpan, windowCreationInterval, scheduler)); } class WindowTimeOperator { constructor(windowTimeSpan, windowCreationInterval, scheduler) { this.windowTimeSpan = windowTimeSpan; this.windowCreationInterval = windowCreationInterval; this.scheduler = scheduler; } call(subscriber, source) { return source._subscribe(new WindowTimeSubscriber(subscriber, this.windowTimeSpan, this.windowCreationInterval, this.scheduler)); } } /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ class WindowTimeSubscriber extends Subscriber { constructor(destination, windowTimeSpan, windowCreationInterval, scheduler) { super(destination); this.destination = destination; this.windowTimeSpan = windowTimeSpan; this.windowCreationInterval = windowCreationInterval; this.scheduler = scheduler; this.windows = []; if (windowCreationInterval !== null && windowCreationInterval >= 0) { let window = this.openWindow(); const closeState = { subscriber: this, window, context: null }; const creationState = { windowTimeSpan, windowCreationInterval, subscriber: this, scheduler }; this.add(scheduler.schedule(dispatchWindowClose, windowTimeSpan, closeState)); this.add(scheduler.schedule(dispatchWindowCreation, windowCreationInterval, creationState)); } else { let window = this.openWindow(); const timeSpanOnlyState = { subscriber: this, window, windowTimeSpan }; this.add(scheduler.schedule(dispatchWindowTimeSpanOnly, windowTimeSpan, timeSpanOnlyState)); } } _next(value) { const windows = this.windows; const len = windows.length; for (let i = 0; i < len; i++) { const window = windows[i]; if (!window.isUnsubscribed) { window.next(value); } } } _error(err) { const windows = this.windows; while (windows.length > 0) { windows.shift().error(err); } this.destination.error(err); } _complete() { const windows = this.windows; while (windows.length > 0) { const window = windows.shift(); if (!window.isUnsubscribed) { window.complete(); } } this.destination.complete(); } openWindow() { const window = new Subject(); this.windows.push(window); const destination = this.destination; destination.add(window); destination.next(window); return window; } closeWindow(window) { window.complete(); const windows = this.windows; windows.splice(windows.indexOf(window), 1); } } function dispatchWindowTimeSpanOnly(state) { const { subscriber, windowTimeSpan, window } = state; if (window) { window.complete(); } state.window = subscriber.openWindow(); this.schedule(state, windowTimeSpan); } function dispatchWindowCreation(state) { let { windowTimeSpan, subscriber, scheduler, windowCreationInterval } = state; let window = subscriber.openWindow(); let action = this; let context = { action, subscription: null }; const timeSpanState = { subscriber, window, context }; context.subscription = scheduler.schedule(dispatchWindowClose, windowTimeSpan, timeSpanState); action.add(context.subscription); action.schedule(state, windowCreationInterval); } function dispatchWindowClose(arg) { const { subscriber, window, context } = arg; if (context && context.action && context.subscription) { context.action.remove(context.subscription); } subscriber.closeWindow(window); } //# sourceMappingURL=windowTime.js.map
<gh_stars>0 /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package clock.controller; import clock.controller.ScheduleDate.DayOfWeek; import java.io.UnsupportedEncodingException; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.logging.Level; import java.util.logging.Logger; /** * * @author joshualange */ public class ClockProtocolCoder implements ClockDataListener { private ClockConnection theConnection; private ScheduleEventListener theScheduleListener; private DateTimeListener theDateListener; public ClockConnection getTheConnection() { return theConnection; } public void setTheConnection(ClockConnection theConnection) { this.theConnection = theConnection; } public ScheduleEventListener getTheScheduleListener() { return theScheduleListener; } public void setTheScheduleListener(ScheduleEventListener theScheduleListener) { this.theScheduleListener = theScheduleListener; } public DateTimeListener getTheDateListener() { return theDateListener; } public void setTheDateListener(DateTimeListener theDateListener) { this.theDateListener = theDateListener; } private ClockProtocolCoder() { } public ClockProtocolCoder(ClockConnection theConnection) { this.theConnection = theConnection; if (theConnection != null) { theConnection.setReadHandler(this); } } public void setClockConnection(ClockConnection theConnection) { this.theConnection = theConnection; } public boolean requestCurrentDateFromClock() { //U=0x55 //8=0x38 return this.sendClockMessage((byte) 0x55, (byte) 0x38, null); } public boolean setCurrentDateOnClock(Date theDate) { try { byte[] messageData; SimpleDateFormat sdf = new SimpleDateFormat("yyMMddHHmmss"); messageData = sdf.format(theDate).getBytes("US-ASCII"); //U=0x55 //1=0x31 return this.sendClockMessage((byte) 0x55, (byte) 0x31, messageData); } catch (UnsupportedEncodingException ex) { Logger.getLogger(ClockProtocolCoder.class.getName()).log(Level.SEVERE, null, ex); return false; } } public boolean requestCurrentOffsetFromClock(int systemNumber) { switch (systemNumber) { case 1: //U=0x55 //B=0x42 return this.sendClockMessage((byte) 0x55, (byte) 0x42, null); case 2: //U=0x55 //C=0x43 return this.sendClockMessage((byte) 0x55, (byte) 0x43, null); default: return false; } } public boolean setClockOffset(int systemNumber, Date offset) { try { byte[] messageData; SimpleDateFormat sdf = new SimpleDateFormat("yyMMddHHmmss"); messageData = sdf.format(offset).getBytes("US-ASCII"); switch (systemNumber) { case 1: //U=0x55 //2=0x32 return this.sendClockMessage((byte) 0x55, (byte) 0x32, messageData); case 2: //U=0x55 //3=0x33 return this.sendClockMessage((byte) 0x55, (byte) 0x33, messageData); default: return false; } } catch (UnsupportedEncodingException ex) { Logger.getLogger(ClockProtocolCoder.class.getName()).log(Level.SEVERE, null, ex); return false; } } public boolean requestFirstScheduleProgramFromClock() { //W=0x57 //0=0x30 return this.sendClockMessage((byte) 0x57, (byte) 0x30, null); } public boolean requestNextScheduleProgramFromClock() { //W=0x57 //N=0x4E return this.sendClockMessage((byte) 0x57, (byte) 0x4E, null); } public boolean deleteAllSchedulePrograms() { //W=0x57 //D=0x44 return this.sendClockMessage((byte) 0x57, (byte) 0x44, null); } public boolean sendScheduleProgram(int id, int hour, int minute, DayOfWeek dayOfWeek, int bellNumber, int bellDuration) { byte[] programData = new byte[18]; byte dayNum; //program ID not used //explicitly ignore by clock per documentation programData[0] = 0x30; programData[1] = 0x30; programData[2] = 0x30; programData[3] = 0x30; //Program schedule settings - constant programData[4] = 0x38; programData[5] = 0x30; programData[6] = 0x30; //bell output number programData[7] = getASCIIHexBytes(bellNumber, 1)[0]; //bell duration bellDuration = (bellDuration > 255) ? 255 : (bellDuration < 0) ? 0 : bellDuration; byte[] bellDurationBytes = getASCIIHexBytes(bellDuration, 2); programData[8] = bellDurationBytes[0]; programData[9] = bellDurationBytes[1]; //day of week bitmask switch (dayOfWeek) { case SATURDAY_AND_SUNDAY: //0300 programData[10] = 0x30; programData[11] = 0x33; dayNum = 0; break; case MONDAY: //4001 programData[10] = 0x34; programData[11] = 0x30; dayNum = 1; break; case TUESDAY: //2002 programData[10] = 0x32; programData[11] = 0x30; dayNum = 2; break; case WEDNESDAY: //1003 programData[10] = 0x31; programData[11] = 0x30; dayNum = 3; break; case THURSDAY: //0804 programData[10] = 0x30; programData[11] = 0x38; dayNum = 4; break; case FRIDAY: //0405 programData[10] = 0x30; programData[11] = 0x34; dayNum = 5; break; case SATURDAY: //0206 programData[10] = 0x30; programData[11] = 0x32; dayNum = 6; break; case SUNDAY: //0107 programData[10] = 0x30; programData[11] = 0x31; dayNum = 7; break; case MONDAY_FRIDAY: //7C08 programData[10] = 0x37; programData[11] = 0x43; dayNum = 8; break; case ALL_THE_DAYS: //7F09 programData[10] = 0x37; programData[11] = 0x46; dayNum = 9; break; default: return false; } //day of week number byte[] dayOfWeekBytes = getASCIIHexBytes(dayNum, 2); programData[12] = dayOfWeekBytes[0]; programData[13] = dayOfWeekBytes[1]; //hour byte[] hourBytes = getASCIIHexBytes(hour, 2); programData[14] = hourBytes[0]; programData[15] = hourBytes[1]; //minute byte[] minuteBytes = getASCIIHexBytes(minute, 2); programData[16] = minuteBytes[0]; programData[17] = minuteBytes[1]; //W=0x57 //w=0x57 return this.sendClockMessage((byte) 0x57, (byte) 0x57, programData); } //must be an array of 8 or fewer boolean values public boolean setOutputs(boolean[] outputs) { byte[] messageData = new byte[16]; int outputsInfo = 0x00; for (int i = 0; i < outputs.length; i++) { if (outputs[i]) { int tmp = 1 << (7 - i); outputsInfo |= tmp; } } byte[] outputBytes = getASCIIHexBytes(outputsInfo, 2); messageData[0] = outputBytes[0]; messageData[1] = outputBytes[1]; for (int i = 2; i < messageData.length; i++) { messageData[i] = 0x30; } //R=0x52 //1=0x31 return this.sendClockMessage((byte) 0x52, (byte) 0x31, messageData); } @Override public void dataReceived(byte[] data) { //sanity checks if (data.length < 7) { return; } if (data[0] != 0x02) { return; } if (verifyChecksum(data)) { //switch on field 3 (RT byte) switch (data[3]) { case 0x44://D=Display switch (data[4]) {//Switch on RTM Byte case 0x31://1=Display Contents //message contains display contents break; default: //any other messages shouldn't happen //return silently return; } break; case 0x52://R=Outputs switch (data[4]) {//Switch on RTM Byte case 0x31://1=Output Status //message contains output status break; default: //any other messages shouldn't happen //return silently return; } break; case 0x55://U=Time, impulse time if (theDateListener != null) { switch (data[4]) {//switch on RTM Byte case 0x31://1=System Time Date theDate = parseClockDate(data); theDateListener.clockDateReceived(theDate); break; case 0x32://2=Impulse 1 Time Date theDate2 = parseClockDate(data); theDateListener.clockOffsetReceived(1, theDate2); break; case 0x33://3=Impulse 2 Time Date theDate3 = parseClockDate(data); theDateListener.clockOffsetReceived(2, theDate3); break; default: //any other messages shouldn't happen //return silently return; } } break; case 0x57://W=Week/Day Programs if (theScheduleListener != null) { switch (data[4]) { case 0x39://9=Last Program Requested theScheduleListener.lastEventReceived(); break; case 0x57://W=Program Received int id = parseID(data); ScheduleDate theDate = parseDate(data); theScheduleListener.eventReceived(id, theDate); break; default: //any other messages shouldn't happen //return silently return; } } break; default: throw new AssertionError(); } } } //returns true if the checksum is valid public boolean verifyChecksum(byte[] data) { //skip the checksum byte when verifying int newck, oldck; newck = generateChecksum(data, data.length - 1); oldck = data[data.length - 1]; System.out.println("Got Checksum: " + oldck + " Expected Checksum: " + newck); return newck == oldck; } public byte generateChecksum(byte[] data) { return generateChecksum(data, data.length); } public byte generateChecksum(byte[] data, int length) { byte checksum = 0; if (length > data.length) { length = data.length; } for (int i = 1; i < length; i++) { checksum = (byte) (data[i] ^ checksum); } return checksum; } private boolean sendClockMessage(byte RT, byte RTM, byte[] messageData) { if (theConnection != null && theConnection.isConnected()) { int totalMessageLength; if (messageData == null) { totalMessageLength = 7; } else { totalMessageLength = messageData.length + 7; } byte dataToSend[] = new byte[totalMessageLength]; dataToSend[0] = 0x02; dataToSend[1] = 0x41; dataToSend[2] = 0x41; dataToSend[3] = RT; dataToSend[4] = RTM; if (messageData != null) { System.arraycopy(messageData, 0, dataToSend, 5, messageData.length); } dataToSend[dataToSend.length - 2] = 0x03; dataToSend[dataToSend.length - 1] = generateChecksum(dataToSend, dataToSend.length - 1);//fixme return theConnection.writeBytes(dataToSend); } return false; } //converts a number to the equivalent number in ASCII as hexadecimal private byte[] getASCIIHexBytes(int number, int length) { try { byte[] result = new byte[length]; String s = Integer.toHexString(number).toUpperCase(); byte[] hexFormatTmp = s.getBytes("US-ASCII"); if (hexFormatTmp.length >= length) { return hexFormatTmp; } System.arraycopy(hexFormatTmp, 0, result, length - hexFormatTmp.length, hexFormatTmp.length); for (int i = 0; i < (length - hexFormatTmp.length); i++) { result[i] = 0x30; } return result; } catch (UnsupportedEncodingException ex) { return null; } } private ScheduleDate parseDate(byte[] data) { //sanity checks if (data.length > 7) { if (data[3] == 0x57) {//W char[] dateStringArray = new char[14]; //manually copy part of the array //bytes 9-22 are date string for (int i = 0; i < 14; i++) { dateStringArray[i] = (char) data[i + 9]; } String dateString = String.copyValueOf(dateStringArray); int outNum = Integer.parseInt(dateString.substring(3, 4), 16);//output number int length = Integer.parseInt(dateString.substring(4, 6), 16); int hour = Integer.parseInt(dateString.substring(10, 12), 16); int minute = Integer.parseInt(dateString.substring(12, 14), 16); DayOfWeek weekday; String ds = dateString.substring(6, 10); weekday = ScheduleDate.dayOfWeekForString(ds); return new ScheduleDate(outNum, length, weekday, hour, minute); } } return null; } private Date parseClockDate(byte[] data) { if (data.length > 7) { if (data[3] == 0x55) { try { //U SimpleDateFormat sdf = new SimpleDateFormat("yyMMddHHmmss"); char[] textString = new char[12]; for (int i = 5; i < 17; i++) { textString[i - 5] = (char) data[i]; } String dateString = String.copyValueOf(textString); System.out.println(dateString); Date dd = sdf.parse(dateString); return dd; } catch (ParseException ex) { Logger.getLogger(ClockProtocolCoder.class.getName()).log(Level.SEVERE, null, ex); } } } return null; } private int parseID(byte[] data) { //bytes 5,6,7,8 are ID in Decimal ASCII char[] id = new char[4]; for (int i = 0; i < 4; i++) { id[i] = (char) data[i + 5]; } String idStr = String.valueOf(id); return Integer.parseInt(idStr); } }
#!/bin/bash # This script parses in the command line parameters from runCust, # maps them to the correct command line parameters for DispNet training script and launches that task # The last line of runCust should be: bash $CONFIG_FILE --data-dir $DATA_DIR --log-dir $LOG_DIR # Parse the command line parameters # that runCust will give out DATA_DIR=NONE LOG_DIR=NONE CONFIG_DIR=NONE MODEL_DIR=NONE # Parsing command line arguments: while [[ $# > 0 ]] do key="$1" case $key in -h|--help) echo "Usage: run_dispnet_training_philly.sh [run_options]" echo "Options:" echo " -d|--data-dir <path> - directory path to input data (default NONE)" echo " -l|--log-dir <path> - directory path to save the log files (default NONE)" echo " -p|--config-file-dir <path> - directory path to config file directory (default NONE)" echo " -m|--model-dir <path> - directory path to output model file (default NONE)" exit 1 ;; -d|--data-dir) DATA_DIR="$2" shift # pass argument ;; -p|--config-file-dir) CONFIG_DIR="$2" shift # pass argument ;; -m|--model-dir) MODEL_DIR="$2" shift # pass argument ;; -l|--log-dir) LOG_DIR="$2" shift ;; *) echo Unkown option $key ;; esac shift # past argument or value done # Prints out the arguments that were passed into the script echo "DATA_DIR=$DATA_DIR" echo "LOG_DIR=$LOG_DIR" echo "CONFIG_DIR=$CONFIG_DIR" echo "MODEL_DIR=$MODEL_DIR" # Run training on philly # Add the root folder of the code to the PYTHONPATH export PYTHONPATH=$PYTHONPATH:$CONFIG_DIR # Run the actual job python $CONFIG_DIR/examples/AnytimeNetwork/densenet-ann.py \ --data_dir=$DATA_DIR \ --log_dir=$LOG_DIR \ --model_dir=$MODEL_DIR \ --load=${MODEL_DIR}/checkpoint \ --densenet_version=loglog -n=12 -g=32 -s=6 --ds_name=cifar100 --batch_size=32 --nr_gpu=2 --reduction_ratio=1 -f=10 --opt_at=-1 --samloss=6 --log_dense_base=2.0 --transition_batch_size=1 --growth_rate_multiplier=1 --bottleneck_width=4.0 --b_type=bottleneck
import React from 'react'; import { render } from 'react-native-testing-library'; import { RootToaster } from '../RootToaster'; jest.useFakeTimers(); describe('RootToaster', () => { it('renders correctly', () => { const component = render( <RootToaster visible defaultDuration={3000} defaultMessage="Error" /> ); expect(component).toMatchSnapshot(); }); });
import { UsersModule } from "../modules/users.module." import { CatsModule } from "../modules/cats.module" import { TagsModule } from "../modules/tags.module" import { PostsModule } from "../modules/posts.module" import { CategorysModule } from "../modules/cate.module" export { UsersModule, CatsModule, TagsModule, PostsModule, CategorysModule }
import { Component } from '@angular/core'; @Component({ selector: 'horz-buttons-scroll-demo', template: ` <div> <h3> Horizontal Buttons Scroll <small> <a href="https://github.com/swimlane/ngx-datatable/blob/master/demo/basic/scrolling.component.ts" target="_blank" > Source </a> </small> </h3> <div style='float:left;width:75%'> <ngx-datatable class="material" [rows]="rows" columnMode="force" [headerHeight]="50" [footerHeight]="0" [rowHeight]="50" [scrollbarV]="true" [scrollbarH]="true"> <ngx-datatable-column *ngFor="let col of columns" [name]="col.name" [prop]="col.prop"> </ngx-datatable-column> </ngx-datatable> </div> <div class='selected-column'> <h4>Available Columns</h4> <ul> <li *ngFor='let col of allColumns'> <input type='checkbox' [id]="col.name" (click)='toggle(col)' [checked]='isChecked(col)' /> <label [attr.for]="col.name">{{col.name}}</label> </li> </ul> </div> </div> ` }) export class HorzButtonsScroll { rows = []; allColumns = [ { name: 'Name', prop: 'name' }, { name: 'Gender', prop: 'gender' }, { name: 'Age', prop: 'age' }, { name: 'City', prop: 'address.city' }, { name: 'State', prop: 'address.state' }, ]; columns = [ { name: 'Name', prop: 'name' }, { name: 'Gender', prop: 'gender' }, { name: 'Age', prop: 'age' }, { name: 'City', prop: 'address.city' }, { name: 'State', prop: 'address.state' }, ]; constructor() { this.fetch((data) => { this.rows = data; }); } toggle(col) { const isChecked = this.isChecked(col); if(isChecked) { this.columns = this.columns.filter(c => { return c.name !== col.name; }); } else { this.columns = [...this.columns, col]; } } fetch(cb) { const req = new XMLHttpRequest(); req.open('GET', `assets/data/100k.json`); req.onload = () => { cb(JSON.parse(req.response)); }; req.send(); } private isChecked(col) { return this.columns.find(c => { return c.name === col.name; }); } }
import pandas as pd import numpy as np import sklearn from sklearn.linear_model import LinearRegression # Load the data data = pd.read_csv('stock_data.csv') # Separate the independent variables X = data.drop(['Date', 'Close'], axis=1).values y = data['Close'].values # Split the data into training and test sets X_train, X_test, y_train, y_test = sklearn.model_selection.train_test_split(X, y, test_size=0.2, random_state=0) # Fit the model regressor = LinearRegression() regressor.fit(X_train, y_train) # Make predictions y_pred = regressor.predict(X_test) # Calculate accuracy accuracy = sklearn.metrics.r2_score(y_test, y_pred) # Print accuracy print('Accuracy:', accuracy)
<filename>node_modules/@babylonjs/loaders/glTF/glTFFileLoader.d.ts import * as GLTF2 from "babylonjs-gltf2interface"; import { Nullable } from "@babylonjs/core/types"; import { Observable } from "@babylonjs/core/Misc/observable"; import { Camera } from "@babylonjs/core/Cameras/camera"; import { BaseTexture } from "@babylonjs/core/Materials/Textures/baseTexture"; import { Material } from "@babylonjs/core/Materials/material"; import { AbstractMesh } from "@babylonjs/core/Meshes/abstractMesh"; import { ISceneLoaderPluginFactory, ISceneLoaderPlugin, ISceneLoaderPluginAsync, ISceneLoaderProgressEvent, ISceneLoaderPluginExtensions, ISceneLoaderAsyncResult } from "@babylonjs/core/Loading/sceneLoader"; import { AssetContainer } from "@babylonjs/core/assetContainer"; import { Scene, IDisposable } from "@babylonjs/core/scene"; import { WebRequest } from "@babylonjs/core/Misc/webRequest"; import { IFileRequest } from "@babylonjs/core/Misc/fileRequest"; import { IDataBuffer } from '@babylonjs/core/Misc/dataReader'; import { RequestFileError } from '@babylonjs/core/Misc/fileTools'; /** * Mode that determines the coordinate system to use. */ export declare enum GLTFLoaderCoordinateSystemMode { /** * Automatically convert the glTF right-handed data to the appropriate system based on the current coordinate system mode of the scene. */ AUTO = 0, /** * Sets the useRightHandedSystem flag on the scene. */ FORCE_RIGHT_HANDED = 1 } /** * Mode that determines what animations will start. */ export declare enum GLTFLoaderAnimationStartMode { /** * No animation will start. */ NONE = 0, /** * The first animation will start. */ FIRST = 1, /** * All animations will start. */ ALL = 2 } /** * Interface that contains the data for the glTF asset. */ export interface IGLTFLoaderData { /** * The object that represents the glTF JSON. */ json: Object; /** * The BIN chunk of a binary glTF. */ bin: Nullable<IDataBuffer>; } /** * Interface for extending the loader. */ export interface IGLTFLoaderExtension { /** * The name of this extension. */ readonly name: string; /** * Defines whether this extension is enabled. */ enabled: boolean; /** * Defines the order of this extension. * The loader sorts the extensions using these values when loading. */ order?: number; } /** * Loader state. */ export declare enum GLTFLoaderState { /** * The asset is loading. */ LOADING = 0, /** * The asset is ready for rendering. */ READY = 1, /** * The asset is completely loaded. */ COMPLETE = 2 } /** @hidden */ export interface IGLTFLoader extends IDisposable { readonly state: Nullable<GLTFLoaderState>; importMeshAsync: (meshesNames: any, scene: Scene, forAssetContainer: boolean, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName?: string) => Promise<ISceneLoaderAsyncResult>; loadAsync: (scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName?: string) => Promise<void>; } /** * File loader for loading glTF files into a scene. */ export declare class GLTFFileLoader implements IDisposable, ISceneLoaderPluginAsync, ISceneLoaderPluginFactory { /** @hidden */ static _CreateGLTF1Loader: (parent: GLTFFileLoader) => IGLTFLoader; /** @hidden */ static _CreateGLTF2Loader: (parent: GLTFFileLoader) => IGLTFLoader; /** * Raised when the asset has been parsed */ onParsedObservable: Observable<IGLTFLoaderData>; private _onParsedObserver; /** * Raised when the asset has been parsed */ set onParsed(callback: (loaderData: IGLTFLoaderData) => void); /** * Set this property to false to disable incremental loading which delays the loader from calling the success callback until after loading the meshes and shaders. * Textures always loads asynchronously. For example, the success callback can compute the bounding information of the loaded meshes when incremental loading is disabled. * Defaults to true. * @hidden */ static IncrementalLoading: boolean; /** * Set this property to true in order to work with homogeneous coordinates, available with some converters and exporters. * Defaults to false. See https://en.wikipedia.org/wiki/Homogeneous_coordinates. * @hidden */ static HomogeneousCoordinates: boolean; /** * The coordinate system mode. Defaults to AUTO. */ coordinateSystemMode: GLTFLoaderCoordinateSystemMode; /** * The animation start mode. Defaults to FIRST. */ animationStartMode: GLTFLoaderAnimationStartMode; /** * Defines if the loader should compile materials before raising the success callback. Defaults to false. */ compileMaterials: boolean; /** * Defines if the loader should also compile materials with clip planes. Defaults to false. */ useClipPlane: boolean; /** * Defines if the loader should compile shadow generators before raising the success callback. Defaults to false. */ compileShadowGenerators: boolean; /** * Defines if the Alpha blended materials are only applied as coverage. * If false, (default) The luminance of each pixel will reduce its opacity to simulate the behaviour of most physical materials. * If true, no extra effects are applied to transparent pixels. */ transparencyAsCoverage: boolean; /** * Defines if the loader should use range requests when load binary glTF files from HTTP. * Enabling will disable offline support and glTF validator. * Defaults to false. */ useRangeRequests: boolean; /** * Defines if the loader should create instances when multiple glTF nodes point to the same glTF mesh. Defaults to true. */ createInstances: boolean; /** * Defines if the loader should always compute the bounding boxes of meshes and not use the min/max values from the position accessor. Defaults to false. */ alwaysComputeBoundingBox: boolean; /** * If true, load all materials defined in the file, even if not used by any mesh. Defaults to false. */ loadAllMaterials: boolean; /** * Function called before loading a url referenced by the asset. */ preprocessUrlAsync: (url: string) => Promise<string>; /** * Observable raised when the loader creates a mesh after parsing the glTF properties of the mesh. * Note that the observable is raised as soon as the mesh object is created, meaning some data may not have been setup yet for this mesh (vertex data, morph targets, material, ...) */ readonly onMeshLoadedObservable: Observable<AbstractMesh>; private _onMeshLoadedObserver; /** * Callback raised when the loader creates a mesh after parsing the glTF properties of the mesh. * Note that the callback is called as soon as the mesh object is created, meaning some data may not have been setup yet for this mesh (vertex data, morph targets, material, ...) */ set onMeshLoaded(callback: (mesh: AbstractMesh) => void); /** * Observable raised when the loader creates a texture after parsing the glTF properties of the texture. */ readonly onTextureLoadedObservable: Observable<BaseTexture>; private _onTextureLoadedObserver; /** * Callback raised when the loader creates a texture after parsing the glTF properties of the texture. */ set onTextureLoaded(callback: (texture: BaseTexture) => void); /** * Observable raised when the loader creates a material after parsing the glTF properties of the material. */ readonly onMaterialLoadedObservable: Observable<Material>; private _onMaterialLoadedObserver; /** * Callback raised when the loader creates a material after parsing the glTF properties of the material. */ set onMaterialLoaded(callback: (material: Material) => void); /** * Observable raised when the loader creates a camera after parsing the glTF properties of the camera. */ readonly onCameraLoadedObservable: Observable<Camera>; private _onCameraLoadedObserver; /** * Callback raised when the loader creates a camera after parsing the glTF properties of the camera. */ set onCameraLoaded(callback: (camera: Camera) => void); /** * Observable raised when the asset is completely loaded, immediately before the loader is disposed. * For assets with LODs, raised when all of the LODs are complete. * For assets without LODs, raised when the model is complete, immediately after the loader resolves the returned promise. */ readonly onCompleteObservable: Observable<void>; private _onCompleteObserver; /** * Callback raised when the asset is completely loaded, immediately before the loader is disposed. * For assets with LODs, raised when all of the LODs are complete. * For assets without LODs, raised when the model is complete, immediately after the loader resolves the returned promise. */ set onComplete(callback: () => void); /** * Observable raised when an error occurs. */ readonly onErrorObservable: Observable<any>; private _onErrorObserver; /** * Callback raised when an error occurs. */ set onError(callback: (reason: any) => void); /** * Observable raised after the loader is disposed. */ readonly onDisposeObservable: Observable<void>; private _onDisposeObserver; /** * Callback raised after the loader is disposed. */ set onDispose(callback: () => void); /** * Observable raised after a loader extension is created. * Set additional options for a loader extension in this event. */ readonly onExtensionLoadedObservable: Observable<IGLTFLoaderExtension>; private _onExtensionLoadedObserver; /** * Callback raised after a loader extension is created. */ set onExtensionLoaded(callback: (extension: IGLTFLoaderExtension) => void); /** * Defines if the loader logging is enabled. */ get loggingEnabled(): boolean; set loggingEnabled(value: boolean); /** * Defines if the loader should capture performance counters. */ get capturePerformanceCounters(): boolean; set capturePerformanceCounters(value: boolean); /** * Defines if the loader should validate the asset. */ validate: boolean; /** * Observable raised after validation when validate is set to true. The event data is the result of the validation. */ readonly onValidatedObservable: Observable<GLTF2.IGLTFValidationResults>; private _onValidatedObserver; /** * Callback raised after a loader extension is created. */ set onValidated(callback: (results: GLTF2.IGLTFValidationResults) => void); private _loader; private _progressCallback?; private _requests; private static magicBase64Encoded; /** * Name of the loader ("gltf") */ name: string; /** @hidden */ extensions: ISceneLoaderPluginExtensions; /** * Disposes the loader, releases resources during load, and cancels any outstanding requests. */ dispose(): void; /** @hidden */ requestFile(scene: Scene, url: string, onSuccess: (data: any, request?: WebRequest) => void, onProgress?: (ev: ISceneLoaderProgressEvent) => void, useArrayBuffer?: boolean, onError?: (error: any) => void): IFileRequest; /** @hidden */ readFile(scene: Scene, file: File, onSuccess: (data: any) => void, onProgress?: (ev: ISceneLoaderProgressEvent) => any, useArrayBuffer?: boolean, onError?: (error: any) => void): IFileRequest; /** @hidden */ importMeshAsync(meshesNames: any, scene: Scene, data: any, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName?: string): Promise<ISceneLoaderAsyncResult>; /** @hidden */ loadAsync(scene: Scene, data: any, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName?: string): Promise<void>; /** @hidden */ loadAssetContainerAsync(scene: Scene, data: any, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName?: string): Promise<AssetContainer>; /** @hidden */ canDirectLoad(data: string): boolean; /** @hidden */ directLoad(scene: Scene, data: string): Promise<any>; /** * The callback that allows custom handling of the root url based on the response url. * @param rootUrl the original root url * @param responseURL the response url if available * @returns the new root url */ rewriteRootURL?(rootUrl: string, responseURL?: string): string; /** @hidden */ createPlugin(): ISceneLoaderPlugin | ISceneLoaderPluginAsync; /** * The loader state or null if the loader is not active. */ get loaderState(): Nullable<GLTFLoaderState>; /** * Returns a promise that resolves when the asset is completely loaded. * @returns a promise that resolves when the asset is completely loaded. */ whenCompleteAsync(): Promise<void>; /** @hidden */ _loadFile(url: string, scene: Scene, onSuccess: (data: string | ArrayBuffer) => void, useArrayBuffer?: boolean, onError?: (request?: WebRequest) => void): IFileRequest; /** @hidden */ _requestFile(url: string, scene: Scene, onSuccess: (data: string | ArrayBuffer, request?: WebRequest) => void, useArrayBuffer?: boolean, onError?: (error: RequestFileError) => void, onOpened?: (request: WebRequest) => void): IFileRequest; private _onProgress; private _validate; private _getLoader; private _parseJson; private _unpackBinaryAsync; private _unpackBinaryV1Async; private _unpackBinaryV2Async; private static _parseVersion; private static _compareVersion; private static readonly _logSpaces; private _logIndentLevel; private _loggingEnabled; /** @hidden */ _log: (message: string) => void; /** @hidden */ _logOpen(message: string): void; /** @hidden */ _logClose(): void; private _logEnabled; private _logDisabled; private _capturePerformanceCounters; /** @hidden */ _startPerformanceCounter: (counterName: string) => void; /** @hidden */ _endPerformanceCounter: (counterName: string) => void; private _startPerformanceCounterEnabled; private _startPerformanceCounterDisabled; private _endPerformanceCounterEnabled; private _endPerformanceCounterDisabled; }
import numpy as np import cv2 class ImageProcessor: def apply_shadow_mask(image, blur_width, intensity, ellipse): shadow_mask = np.zeros(image.shape[:2], dtype=np.uint8) shadow_mask.fill(const.WHITE) shadow_mask = cv2.ellipse(shadow_mask, ellipse, const.BLACK, -1) blurred_image = cv2.GaussianBlur(image, (blur_width, blur_width), 0) shadowed_image = cv2.addWeighted(blurred_image, 1 - intensity, image, intensity, 0) final_image = cv2.bitwise_and(shadowed_image, shadowed_image, mask=shadow_mask) return final_image def __get_multiple_ellipses(image): h, w = image.shape[:2] num_ellipses = np.random.randint(3, 6) # Randomly choose the number of ellipses ellipses = [] for _ in range(num_ellipses): center = (int(w * np.random.uniform()), int(h * np.random.uniform())) random_h = np.random.uniform() * h ellipse = (center, (int(w * 0.2), int(random_h)), np.random.uniform(0, 360), 0, 360, const.WHITE) ellipses.append(ellipse) return ellipses # Example usage input_image = cv2.imread('input_image.jpg') blur_width = 5 intensity = 0.5 ellipses = ImageProcessor.__get_multiple_ellipses(input_image) processed_image = ImageProcessor.apply_shadow_mask(input_image, blur_width, intensity, ellipses) cv2.imshow('Processed Image', processed_image) cv2.waitKey(0) cv2.destroyAllWindows()
# Python program to generate # n random numbers within a given range import random # Function to generate random numbers def random_numbers(rangeStart, rangeEnd, numberOfNumbers): res = [] for j in range(numberOfNumbers): res.append(random.randint(rangeStart, rangeEnd)) return res # Driver Code rangeStart = -10 rangeEnd = 10 numberOfNumbers = 20 print(random_numbers(rangeStart, rangeEnd, numberOfNumbers))
""" Convert english text to Morse code """ MORSE_CODE_DICT = { 'A':'.-', 'B':'-...', 'C':'-.-.', 'D':'-..', 'E':'.', 'F':'..-.', 'G':'--.', 'H':'....', 'I':'..', 'J':'.---', 'K':'-.-', 'L':'.-..', 'M':'--', 'N':'-.', 'O':'---', 'P':'.--.', 'Q':'--.-', 'R':'.-.', 'S':'...', 'T':'-', 'U':'..-', 'V':'...-', 'W':'.--', 'X':'-..-', 'Y':'-.--', 'Z':'--..', '1':'.----', '2':'..---', '3':'...--', '4':'....-', '5':'.....', '6':'-....', '7':'--...', '8':'---..', '9':'----.', '0':'-----', ', ':'--..--', '.':'.-.-.-', '?':'..--..', '/':'-..-.', '-':'-....-', '(':'-.--.', ')':'-.--.-', ' ':'|'} def english_to_morse_code(string): morse_code = "" for word in string.upper().split(): for char in word: morse_code += MORSE_CODE_DICT[char] + " " morse_code += " " return morse_code if __name__ == '__main__': print(english_to_morse_code('Hello World'))
<gh_stars>1000+ from os import environ as env from twilio.rest import Client # Twilio Config ACCOUNT_SID = env.get("ACCOUNT_SID") AUTH_TOKEN = env.get("AUTH_TOKEN") FROM_NUMBER = env.get("FROM_NUMBER") TO_NUMBER = env.get("TO_NUMBER") # create a twilio client using account_sid and auth token tw_client = Client(ACCOUNT_SID, AUTH_TOKEN) def send(payload_params=None): """send sms to the specified number""" msg = tw_client.messages.create( from_=FROM_NUMBER, body=payload_params["msg"], to=TO_NUMBER ) if msg.sid: return msg
package main import ( "errors" "fmt" "io" "log" "os" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/s3" "github.com/aws/aws-sdk-go/service/s3/s3manager" ) func uploadObject(bucket, region, key, filename string) error { if bucket == "" || region == "" || key == "" || filename == "" { return errors.New("bucket, key and file name required") } file, err := os.Open(filename) if err != nil { exitErrorf("Unable to open file %q, %v", err) } defer file.Close() // Initialize a session in us-west-2 that the SDK will use to load // credentials from the shared credentials file ~/.aws/credentials. sess, err := session.NewSession(&aws.Config{ Region: aws.String(region)}, ) // Setup the S3 Upload Manager. Also see the SDK doc for the Upload Manager // for more information on configuring part size, and concurrency. // // http://docs.aws.amazon.com/sdk-for-go/api/service/s3/s3manager/#NewUploader uploader := s3manager.NewUploader(sess) // Upload the file's body to S3 bucket as an object with the key being the // same as the filename. _, err = uploader.Upload(&s3manager.UploadInput{ Bucket: aws.String(bucket), // Can also use the `filepath` standard library package to modify the // filename as need for an S3 object key. Such as turning absolute path // to a relative path. Key: aws.String(key), // The file to be uploaded. io.ReadSeeker is preferred as the Uploader // will be able to optimize memory when uploading large content. io.Reader // is supported, but will require buffering of the reader's bytes for // each part. Body: file, }) if err != nil { errMsg := fmt.Sprintf("Unable to upload [%q] %q to %q, %v", key, filename, bucket, err) return errors.New(errMsg) } log.Printf("Successfully uploaded [%q] %q to %q", key, filename, bucket) return nil } func listBucket(region string) { // Initialize a session in us-west-1 that the SDK will use to load // credentials from the shared credentials file ~/.aws/credentials. sess, err := session.NewSession(&aws.Config{ Region: aws.String(region)}, ) check(err) // Create S3 service client svc := s3.New(sess) result, err := svc.ListBuckets(nil) if err != nil { exitErrorf("Unable to list buckets, %v", err) } fmt.Println("Buckets:") for _, b := range result.Buckets { fmt.Printf("* %s created on %s\n", aws.StringValue(b.Name), aws.TimeValue(b.CreationDate)) } } func listObject(bucket, region string, verbose bool) []string { // Initialize a session in us-west-2 that the SDK will use to load // credentials from the shared credentials file ~/.aws/credentials. sess, err := session.NewSession(&aws.Config{ Region: aws.String(region)}, ) check(err) // Create S3 service client svc := s3.New(sess) // Get the list of items var objKeys []string query := &s3.ListObjectsV2Input{ Bucket: &bucket, } for { resp, err := svc.ListObjectsV2(query) if err != nil { exitErrorf("Unable to list items in bucket %q, %v", bucket, err) } for _, item := range resp.Contents { if verbose { fmt.Println("Name: ", *item.Key) fmt.Println("Last modified:", *item.LastModified) fmt.Println("Size: ", *item.Size) fmt.Println("Storage class:", *item.StorageClass) fmt.Println("") } objKeys = append(objKeys, *item.Key) } // Fetch the next chunk. query.ContinuationToken = resp.NextContinuationToken if *resp.IsTruncated == false { break } } fmt.Println("Found", len(objKeys), "items in bucket", bucket) fmt.Println("") return objKeys } func isFileFoundInObjStorage(sha256 string) bool { // Initialize a session in us-west-2 that the SDK will use to load // credentials from the shared credentials file ~/.aws/credentials. sess, _ := session.NewSession(&aws.Config{ Region: aws.String(region)}, ) // Create S3 service client svc := s3.New(sess) _, err := svc.HeadObject(&s3.HeadObjectInput{ Bucket: aws.String(bucket), Key: aws.String(sha256), }) if err != nil { if awsErr, ok := err.(awserr.Error); ok { if awsErr.Code() != "NotFound" { log.Printf("svc.HeadObject failed with: %v", err) } } return false } return true } func downloadObject(bucket, region, key string, w io.WriterAt) error { // Initialize a session in us-west-2 that the SDK will use to load // credentials from the shared credentials file ~/.aws/credentials. sess, err := session.NewSession(&aws.Config{ Region: aws.String(region)}, ) if err != nil { return err } downloader := s3manager.NewDownloader(sess) _, err = downloader.Download(w, &s3.GetObjectInput{ Bucket: aws.String(bucket), Key: aws.String(key), }) return err }