repo_name
stringlengths
6
101
path
stringlengths
4
300
text
stringlengths
7
1.31M
crazywolf132/SpaceGame
main/src/com/spacegame/game/projectile/ProjectileBody.java
package com.spacegame.game.projectile; import com.badlogic.gdx.math.Vector2; import com.spacegame.game.SolGame; import com.spacegame.game.ship.SolShip; public interface ProjectileBody { void update(SolGame game); Vector2 getPos(); Vector2 getSpd(); void receiveForce(Vector2 force, SolGame game, boolean acc); void onRemove(SolGame game); float getAngle(); void changeAngle(float diff); float getDesiredAngle(SolShip ne); }
navikt/sendsoknad
web/src/test/java/no/nav/sbl/dialogarena/config/ApplicationContextTest.java
package no.nav.sbl.dialogarena.config; import com.github.tomakehurst.wiremock.WireMockServer; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.mock.jndi.SimpleNamingContextBuilder; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.web.WebAppConfiguration; import javax.naming.NamingException; import javax.sql.DataSource; import java.io.IOException; import java.io.InputStream; import java.util.Map; import java.util.Properties; import static com.github.tomakehurst.wiremock.client.WireMock.*; import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig; import static java.lang.System.setProperty; import static no.nav.modig.core.context.ModigSecurityConstants.SYSTEMUSER_PASSWORD; import static no.nav.modig.core.context.ModigSecurityConstants.SYSTEMUSER_USERNAME; import static org.mockito.Mockito.mock; @WebAppConfiguration @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = {SoknadinnsendingConfig.class}) public class ApplicationContextTest { private static final String ENVIRONMENT_PROPERTIES = "/environment-test.properties"; private static final String URL = "/soknadsveiviserproxy/skjemautlisting/"; private static WireMockServer wireMockServer = new WireMockServer(wireMockConfig().dynamicPort().dynamicHttpsPort()); @BeforeClass public static void beforeClass() throws NamingException { loadAndSetProperties(); initializeSanityMock(); setProperty("environment.sanitytestport", "" + wireMockServer.port()); setProperty("environment.istest", "true"); String value = System.getProperty("user.home") + "dummypath"; setProperty("sendsoknad.datadir", value); setProperty("folder.bilstonad.path", value); setProperty("folder.sendsoknad.path", value); setProperty("folder.soknad-aap-utland.path", value); setProperty("folder.soknadaap.path", value); setProperty("folder.refusjondagligreise.path", value); setProperty("folder.tilleggsstonader.path", value); setProperty("folder.tiltakspenger.path", value); setProperty("no.nav.modig.security.sts.url", "dummyvalue"); setProperty(SYSTEMUSER_USERNAME, "dummyvalue"); setProperty(SYSTEMUSER_PASSWORD, ""); SimpleNamingContextBuilder builder = new SimpleNamingContextBuilder(); builder.bind("jdbc/SoknadInnsendingDS", mock(DataSource.class)); builder.activate(); } @Test public void shouldSetupAppContext() {} @AfterClass public static void afterClass() { wireMockServer.stop(); } private static void loadAndSetProperties() { Properties properties = new Properties(); try (InputStream inputStream = Properties.class.getResourceAsStream(ENVIRONMENT_PROPERTIES)) { properties.load(inputStream); } catch (IOException e) { throw new RuntimeException(e); } for (Map.Entry<Object, Object> entry : properties.entrySet()) { setProperty((String) entry.getKey(), (String) entry.getValue()); } } private static void initializeSanityMock() { wireMockServer.stubFor(get(urlEqualTo(URL)) .withHeader("Accept", equalTo("application/json, application/*+json")) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "application/json") .withBody("{\"Skjemaer\":[]}"))); wireMockServer.start(); } }
HuttonICS/germinate-scan
app/src/main/java/uk/ac/hutton/android/germinatescan/database/DatabaseObject.java
<filename>app/src/main/java/uk/ac/hutton/android/germinatescan/database/DatabaseObject.java /* * Copyright 2018 Information and Computational Sciences, * The James Hutton Institute. * * 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 uk.ac.hutton.android.germinatescan.database; import java.io.Serializable; import java.util.Date; public abstract class DatabaseObject implements Serializable { public static final String FIELD_ID = "id"; public static final String FIELD_CREATED_ON = "created_on"; public static final String FIELD_UPDATED_ON = "updated_on"; protected Long id; protected Date createdOn = new Date(System.currentTimeMillis()); protected Date updatedOn = new Date(System.currentTimeMillis()); ; public DatabaseObject() { } public DatabaseObject(Long id) { this.id = id; } public DatabaseObject(Long id, Date createdOn, Date updatedOn) { this.id = id; this.createdOn = createdOn; this.updatedOn = updatedOn; } public Long getId() { return this.id; } public DatabaseObject setId(Long id) { this.id = id; return this; } public Date getCreatedOn() { return this.createdOn; } public DatabaseObject setCreatedOn(Date createdOn) { this.createdOn = createdOn; return this; } public Date getUpdatedOn() { return this.updatedOn; } public DatabaseObject setUpdatedOn(Date updatedOn) { this.updatedOn = updatedOn; return this; } public boolean hasId() { return id != null && id != -1L; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; DatabaseObject that = (DatabaseObject) o; return id != null ? id.equals(that.id) : that.id == null; } @Override public int hashCode() { return id != null ? id.hashCode() : 0; } public String toString() { return "DatabaseObject{id=" + this.id + ", createdOn=" + this.createdOn + ", updatedOn=" + this.updatedOn + '}'; } }
BrandnerKasper/Eternal
Eternal/src/Eternal/NativeScripts/ScriptHandler.h
#pragma once #include "Eternal/Scene/ScriptableEntity.h" #include "Player.h" #include "Rotater.h" #include "Deathbox.h" #include "MoveableXPlatform.h" #include "SceneCameraController.h" #include "MoveableDeathbox.h" #include "MoveableYPlatform.h" #include "JumpWallR.h" #include "JumpWallL.h" #include "BackgroundMusic.h" #include "PressStart.h" #include "Load1_1.h" #include "LoadEndScreen.h" #include "CloseApp.h" namespace Eternal { enum class Scripts { EPlayer = 0, ERotater = 1, EDeathbox = 2, EMoveableXPlatform = 3, ESceneCameraController = 4, EMoveableDeathbox = 5, EMoveableYPlatform = 6, EJumpWallR = 7, EJumpWallL = 8, EBackgroundMusic = 9, EPressStart = 10, ELoad1_1 = 11, ELoadEndScreen = 12, ECloseApp = 13 }; class ScriptHandler { public: static SharedPtr<ScriptableEntity> GetScript(Scripts script) { switch (script) { case Scripts::EPlayer: return CreateSharedPtr<Player>(); break; case Scripts::ERotater: return CreateSharedPtr<Rotater>(); break; case Scripts::EDeathbox: return CreateSharedPtr<Deathbox>(); break; case Scripts::EMoveableXPlatform: return CreateSharedPtr<MoveableXPlatform>(); break; case Scripts::ESceneCameraController: return CreateSharedPtr<SceneCameraController>(); break; case Scripts::EMoveableDeathbox: return CreateSharedPtr<MoveableDeathbox>(); break; case Scripts::EMoveableYPlatform: return CreateSharedPtr<MoveableYPlatform>(); break; case Scripts::EJumpWallR: return CreateSharedPtr<JumpWallR>(); break; case Scripts::EJumpWallL: return CreateSharedPtr<JumpWallL>(); break; case Scripts::EBackgroundMusic: return CreateSharedPtr<BackgroundMusic>(); break; case Scripts::EPressStart: return CreateSharedPtr<PressStart>(); break; case Scripts::ELoad1_1: return CreateSharedPtr<Load1_1>(); break; case Scripts::ECloseApp: return CreateSharedPtr<CloseApp>(); break; case Scripts::ELoadEndScreen: return CreateSharedPtr<LoadEndScreen>(); break; default: return nullptr; } } static Scripts GetScriptNumber(std::string scriptname) { if (scriptname._Equal("Player.h")) return Scripts::EPlayer; if (scriptname._Equal("Rotater.h")) return Scripts::ERotater; if (scriptname._Equal("Deathbox.h")) return Scripts::EDeathbox; if (scriptname._Equal("MoveableXPlatform.h")) return Scripts::EMoveableXPlatform; if (scriptname._Equal("SceneCameraController.h")) return Scripts::ESceneCameraController; if (scriptname._Equal("MoveableDeathbox.h")) return Scripts::EMoveableDeathbox; if (scriptname._Equal("MoveableYPlatform.h")) return Scripts::EMoveableYPlatform; if (scriptname._Equal("JumpWallR.h")) return Scripts::EJumpWallR; if (scriptname._Equal("JumpWallL.h")) return Scripts::EJumpWallL; if (scriptname._Equal("BackgroundMusic.h")) return Scripts::EBackgroundMusic; if (scriptname._Equal("PressStart.h")) return Scripts::EPressStart; if (scriptname._Equal("Load1_1.h")) return Scripts::ELoad1_1; if (scriptname._Equal("CloseApp.h")) return Scripts::ECloseApp; if (scriptname._Equal("LoadEndScreen.h")) return Scripts::ELoadEndScreen; ET_CORE_ASSERT(false, "Script not initialized!"); } }; }
josephcsible/CyclopsCore
src/main/java/org/cyclops/cyclopscore/recipe/custom/api/IRecipe.java
package org.cyclops.cyclopscore.recipe.custom.api; /** * Interface for recipes that can be registered with {@link ISuperRecipeRegistry}. * * @author immortaleeb * @param <I> The type of the recipe input of all recipes associated with the machine. * @param <O> The type of the recipe output of all recipes associated with the machine. * @param <P> The type of the recipe properties of all recipes associated with the machine. */ public interface IRecipe<I extends IRecipeInput, O extends IRecipeOutput, P extends IRecipeProperties> { /** * Returns the input for this recipe. * @return The input for this recipe. */ public I getInput(); /** * Returns additional properties for this recipe that do not belong to the input or output. * Example could be the processing duration, power requirements, etc... * @return Additional properties for this recipe. */ public P getProperties(); /** * Returns the output for this recipe. * @return Returns the output for this recipe. */ public O getOutput(); /** * Returns a unique name for this recipe. * @return The unique name for this recipe. */ public String getNamedId(); }
cliff363825/TwentyFour
01_Language/01_Functions/python/array_reduce.py
<reponame>cliff363825/TwentyFour<filename>01_Language/01_Functions/python/array_reduce.py # coding: utf-8 import functools def array_reduce(arr, cb, *args): if len(args) > 0: return functools.reduce(cb, arr, args[0]) else: return functools.reduce(cb, arr) if __name__ == '__main__': l = [1, 2, 3, 4, 5] print(array_reduce(l, lambda x, y: x + y)) print(array_reduce(l, lambda x, y: x * y, 10)) print(array_reduce([], lambda x, y: x + y, "No data to reduce"))
ucd-library/rp-ucd-client
client/public/src/stores/SocketStore.js
<reponame>ucd-library/rp-ucd-client import {BaseStore} from '@ucd-lib/cork-app-utils'; class SocketStore extends BaseStore { constructor() { super(); this.data = { socketLastMessage: null, }; this.events = { SOCKET_MESSAGE: 'socket-message' }; } /** * @method setSocketMessageLoaded * @description sets the state for the loaded socket * * @param {Object} payload */ setSocketMessageLoaded(payload){ this._setSocketMessageState(payload); } // /** // * @method setSocketError // * @description sets the state for the error socket // * // * @param {String} id socket // * @param {Status} error status // */ // setSocketError(id, error){ // this._setSocketState({ // state: this.STATE.ERROR, // id, error // }); // } /** * @method _setSocketMessageState * @description sets the state for socket * * @param {State} state socket */ _setSocketMessageState(state){ this.data.socketLastMessage = state; this.emit(this.events.SOCKET_MESSAGE, state); } } const store = new SocketStore(); export default store;
sirmarcel/cmlk
cmlkit/regression/qmml/kernel_functions.py
"""Kernel functions as implemented by qmmlpack. A kernelf function, or kernelf for short is *not* the same as a kernel in all cases. In `cmlkit` terminology, the kernel is the whole procedure of computing distances between two systems. So for global representations, the kernelf is often the kernel, but when atomic representations are used, we typically compute a kernel function between these representations individually and combine the result into an overall kernel. This is really just a thin translation layer that makes the qmmlpack callables de/serisalisable in the `cmlkit` way. There is no getattr magic because it doesn't seem needed. """ from cmlkit.engine import Component, _from_config from cmlkit.utility import import_qmmlpack def get_kernelf(config, context={}): """Get a kernel function.""" return _from_config(config, classes=classes, context=context) def get_raw_kernelf(name): """Get the raw callable for a kernel function.""" # this is in anticipation of having to write "tune" KRR classes return kernelfs[name] class Kernelf(Component): """Base class for kernel functions.""" def __init__(self, ls, context={}): super().__init__(context=context) self.ls = ls def __call__(self, x, z=None, diagonal=False, distance=False): qmmlpack = import_qmmlpack("use cmlkit.regression.qmml") kernelf = getattr(qmmlpack, kernelfs[self.kind]) return kernelf(x=x, z=z, theta=self.ls, diagonal=diagonal) def _get_config(self): return {"ls": self.ls} class KernelfGaussian(Kernelf): """Gaussian Kernel Function. Gaussian kernel k(x,z) = exp(-||x-z||^2/2s^2). For further information, see qmmlpack docs. Attributes: ls: length scale (s in formula) """ kind = "gaussian" class KernelfLaplacian(Kernelf): """Laplacian Kernel Function. Laplacian kernel k(x,z) = exp(-||x-z||_1/s). For further information, see qmmlpack docs. Attributes: ls: length scale (s in formula) """ kind = "laplacian" class KernelfLinear(Kernelf): """Linear Kernel Function. Linear kernel k(x,z) = <x,z> """ kind = "linear" def __init__(self, context={}): super().__init__(ls=None, context=context) def _get_config(self): return {} kernelfs = { "gaussian": "kernel_gaussian", "laplacian": "kernel_laplacian", "linear": "kernel_linear", } classes = { "gaussian": KernelfGaussian, "laplacian": KernelfLaplacian, "linear": KernelfLinear, }
tumbleDryCode/evenflow
browser/njfbrowser/spreadsheet/SmartAddRows.java
<gh_stars>0 package njfbrowser.spreadsheet; import njfbrowser.main.adminApp; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; public class SmartAddRows extends JDialog implements ActionListener { public class SmartAddRowsWinListener extends WindowAdapter { public void windowClosing(WindowEvent windowevent) { dispose(); } public SmartAddRowsWinListener() { } } public SmartAddRows(adminApp admnaap) { super(admnaap, " Add Rows", false); parent = admnaap; getContentPane().setLayout(new BorderLayout()); numrows = new JTextField("10"); JLabel numrowsLabel = new JLabel(" Add "); JLabel therowsLabel = new JLabel(" Rows "); JPanel inputpan = new JPanel(new GridLayout(0, 3)); inputpan.add(numrowsLabel); inputpan.add(numrows); inputpan.add(therowsLabel); okido = new JButton("Add"); okido.setBackground(new Color(225, 180, 180)); okido.setForeground(new Color(0, 0, 180)); nogo = new JButton("Cancel"); nogo.setBackground(new Color(225, 180, 180)); nogo.setForeground(new Color(0, 0, 180)); JPanel btnpan = new JPanel(new GridLayout(0, 2)); btnpan.add(okido); btnpan.add(nogo); JPanel mainpanel = new JPanel(new BorderLayout()); mainpanel.add("Center", inputpan); mainpanel.add("South", btnpan); getContentPane().add(mainpanel, "Center"); addWindowListener(new SmartAddRowsWinListener()); okido.addActionListener(this); nogo.addActionListener(this); numrows.addActionListener(this); pack(); setResizable(false); setForeground(new Color(0, 0, 120)); setLocation(220, 220); show(); // setred(); } public static void main(String args[]) { } public void actionPerformed(ActionEvent actionevent) { Object obj = actionevent.getSource(); if (obj == okido) { pumprowstoP(); } if (obj == nogo) { dispose(); } if (obj == numrows) { pumprowstoP(); } } public void pumprowstoP() { int ii = 0; try { ii = Integer.parseInt(numrows.getText()); } catch (Exception e) { parent.setQstatus(e.toString(), false); return; } setVisible(false); parent.addSmartRows(ii); } JButton okido; JButton nogo; adminApp parent; JTextField numrows; }
TheDude86/NovaCraft
novacraft-plugin-suite/src/main/java/io/novacraft/randomtp/command/RandomTPCommandManager.java
package io.novacraft.randomtp.command; import io.novacraft.core.CommandManager; import io.novacraft.randomtp.RandomTPModel; import org.bukkit.plugin.java.JavaPlugin; public class RandomTPCommandManager extends CommandManager<RandomTPModel> { public RandomTPCommandManager(RandomTPModel randomTPModel) { super(randomTPModel); } @Override public void addCommands(JavaPlugin plugin) { super.addCommands(plugin); bindCommand("rtp", new WarpCommand(model)); } }
skyer83/laud
src/main/java/com/jfinal/club/my/like/LikeMessageLogService.java
<gh_stars>0 /** * 请勿将俱乐部专享资源复制给其他人,保护知识产权即是保护我们所在的行业,进而保护我们自己的利益 * 即便是公司的同事,也请尊重 JFinal 作者的努力与付出,不要复制给同事 * * 如果你尚未加入俱乐部,请立即删除该项目,或者现在加入俱乐部:http://jfinal.com/club * * 俱乐部将提供 jfinal-club 项目文档与设计资源、专用 QQ 群,以及作者在俱乐部定期的分享与答疑, * 价值远比仅仅拥有 jfinal club 项目源代码要大得多 * * JFinal 俱乐部是五年以来首次寻求外部资源的尝试,以便于有资源创建更加 * 高品质的产品与服务,为大家带来更大的价值,所以请大家多多支持,不要将 * 首次的尝试扼杀在了摇篮之中 */ package com.jfinal.club.my.like; import com.jfinal.kit.LogKit; import com.jfinal.plugin.activerecord.Db; import com.jfinal.plugin.activerecord.Record; import com.jfinal.club.common.account.AccountService; import com.jfinal.club.common.model.Account; import com.jfinal.club.my.message.MessageService; import java.util.Date; import java.util.HashMap; import java.util.Map; /** * 点赞消息业务 * 当某位用户第一次对某个资源点赞成功后要向资源所有者发送系统消息 * 发完消息以后需要向 like_message_log 中写入记录 * 由于点赞可以是一个反复操作,为了避免多次发送系统消息引入此表 */ public class LikeMessageLogService { public static final LikeMessageLogService me = new LikeMessageLogService(); // 用于标识各种 refType 类型 public static final int REF_TYPE_PROJECT = 1; // public static final int REF_TYPE_PROJECT_REPLY = 2; // 暂时不用 public static final int REF_TYPE_SHARE = 3; // public static final int REF_TYPE_SHARE_REPLY = 4; // 暂时不用 public static final int REF_TYPE_FEEDBACK = 5; // public static final int REF_TYPE_FEEDBACK_REPLY = 6; // 暂时不用 @SuppressWarnings("serial") private static Map<String, Integer> map = new HashMap<String, Integer>(){{ put("project", REF_TYPE_PROJECT); // put("project_reply", REF_TYPE_PROJECT_REPLY); // 暂时不用 put("share", REF_TYPE_SHARE); // put("share_reply", REF_TYPE_SHARE_REPLY); // 暂时不用 put("feedback", REF_TYPE_FEEDBACK); // put("feedback_reply", REF_TYPE_FEEDBACK_REPLY); // 暂时不用 }}; public void sendSystemMessage(int myId, int userId, String refType, int refId) { try { doSendSystemMessage(myId, userId, refType, refId); } catch (Exception e) { LogKit.error(e.getMessage(), e); } } // TODO 考虑在单独的线程中调用,或者做成异步任务调度形式,提升性能 private void doSendSystemMessage(int myId, int userId, String tableName, int refId) { String sql = "select accountId from like_message_log where accountId=? and refType=? and refId=?"; Integer refType = getRefTypeValue(tableName); // 当 like_message_log 没有对应的记录时,才去发私信,否则证明已经发过私信 if (Db.queryInt(sql, myId, refType, refId) == null) { Record r = new Record() .set("accountId", myId) .set("refType", refType) .set("refId", refId) .set("createAt", new Date()); Db.save("like_message_log", r); saveSystemMessage(myId, userId, tableName, refType, refId); } } private void saveSystemMessage(int myId, int userId, String tableName, int refType, int refId) { Record ref = Db.findFirst("select id, title, likeCount from " + tableName + " where id=? limit 1", refId); // 被引用的资源存在时才去发私信,资源可能随时会被删除 if (ref == null) { return ; } Account my = AccountService.me.getById(myId); String msg = "@" + my.getNickName() + " 刚刚赞了你的"; if (refType == REF_TYPE_PROJECT) { msg = msg + "项目:<a href='/project/" + ref.getInt("id") +"' target='_blank'>" + ref.getStr("title"); } else if (refType == REF_TYPE_SHARE) { msg = msg + "分享:<a href='/share/" + ref.getInt("id") +"' target='_blank'>" + ref.getStr("title"); } else if (refType == REF_TYPE_FEEDBACK) { msg = msg + "反馈:<a href='/feedback/" + ref.getInt("id") +"' target='_blank'>" + ref.getStr("title"); } else { throw new RuntimeException("refType 不正确,请告知管理员"); } msg = msg + "</a>,目前被赞次数为:" + ref.getInt("likeCount"); MessageService.me.sendSystemMessage(myId, userId, msg); } private Integer getRefTypeValue(String tableName) { Integer refType = map.get(tableName); if (refType == null) { throw new IllegalArgumentException("tableName 不正确"); } return refType; } }
ScriptBox99/microsoft-hermes-windows
test/node-hermes/console-assert.js
<reponame>ScriptBox99/microsoft-hermes-windows<gh_stars>1-10 /** * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * @format */ // RUN: %node-hermes %s 2>&1 | %FileCheck --match-full-lines %s // REQUIRES: node-hermes print('Console assert functionality'); // CHECK-LABEL: Console assert functionality console.assert(true, 'does nothing'); console.assert(false, 'Whoops %s work', 'didn\'t'); // CHECK-NEXT: Assertion failed: Whoops didn't work console.assert(); // CHECK-NEXT: Assertion failed
CarlosManias/SocialSDK
osgi/com.ibm.sbt.web.resources/resources/js/sdk/sbt/connections/controls/forums/nls/ForumGridRenderer.js
<gh_stars>0 /* * � Copyright IBM Corp. 2013 * * 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. */ dojo.provide("sbt.connections.controls.forums.nls.ForumGridRenderer"); // NLS_CHARSET=UTF-8 define('sbt/connections/controls/forums/nls/ForumGridRenderer',[],{ root: { forums: "Forums", forum: "Forum", threads: "Topics", latestPost: "Latest Post", goToForum: "Go To The Forum", viewProfile: "View Profile", replies: "Replies", topics: "Topic", topic: "Topic", author: "Author", date: "Date", back:"Back", noResults: "There are no results", feed : "Feed for these Forums" } });
pixelass/styled-suitcss
.prettierrc.js
module.exports = { arrowParens: "avoid", bracketSpacing: false, jsxBracketSameLine: true, parser: "typescript", printWidth: 80, requirePragma: false, semi: true, singleQuote: false, tabWidth: 4, trailingComma: "none", useTabs: true };
crackersamdjam/DMOJ-Solutions
COCI/coci09c1p1.cpp
<gh_stars>0 #include <bits/stdc++.h> #define sc(x) do{while((x=getchar())<'0'); for(x-='0'; '0'<=(_=getchar()); x=(x<<3)+(x<<1)+_-'0');}while(0) char _; using namespace std; int arr[8],pre,cur; int main(){ sc(pre); sc(cur); arr[1] = cur; if(cur > pre){ for(int i = 2; i < 8; i++){ sc(arr[i]); if(arr[i] < arr[i-1]){ printf("mixed"); return 0; } } printf("ascending"); }else{ for(int i = 2; i < 8; i++){ sc(arr[i]); if(arr[i] > arr[i-1]){ printf("mixed"); return 0; } } printf("descending"); } return 0; }
azchatlanin/FTXUI
src/ftxui/dom/flexbox.cpp
#include <stddef.h> // for size_t #include <algorithm> // for min, max #include <memory> // for __shared_ptr_access, shared_ptr, allocator_traits<>::value_type, make_shared #include <utility> // for move, swap #include <vector> // for vector #include "ftxui/dom/elements.hpp" // for Element, Elements, flexbox, hflow, vflow #include "ftxui/dom/flexbox_config.hpp" // for FlexboxConfig, FlexboxConfig::Direction, FlexboxConfig::Direction::Column, FlexboxConfig::AlignContent, FlexboxConfig::Direction::ColumnInversed, FlexboxConfig::Direction::Row, FlexboxConfig::JustifyContent, FlexboxConfig::Wrap, FlexboxConfig::AlignContent::FlexStart, FlexboxConfig::Direction::RowInversed, FlexboxConfig::JustifyContent::FlexStart, FlexboxConfig::Wrap::Wrap #include "ftxui/dom/flexbox_helper.hpp" // for Block, Global, Compute #include "ftxui/dom/node.hpp" // for Node, Elements, Node::Status #include "ftxui/dom/requirement.hpp" // for Requirement #include "ftxui/screen/box.hpp" // for Box namespace ftxui { namespace { void Normalize(FlexboxConfig::Direction& direction) { switch (direction) { case FlexboxConfig::Direction::Row: case FlexboxConfig::Direction::RowInversed: { direction = FlexboxConfig::Direction::Row; } break; case FlexboxConfig::Direction::Column: case FlexboxConfig::Direction::ColumnInversed: { direction = FlexboxConfig::Direction::Column; } break; } } void Normalize(FlexboxConfig::AlignContent& align_content) { align_content = FlexboxConfig::AlignContent::FlexStart; } void Normalize(FlexboxConfig::JustifyContent& justify_content) { justify_content = FlexboxConfig::JustifyContent::FlexStart; } void Normalize(FlexboxConfig::Wrap& wrap) { wrap = FlexboxConfig::Wrap::Wrap; } FlexboxConfig Normalize(FlexboxConfig config) { Normalize(config.direction); Normalize(config.wrap); Normalize(config.justify_content); Normalize(config.align_content); return config; } class Flexbox : public Node { public: Flexbox(Elements children, FlexboxConfig config) : Node(std::move(children)), config_(config), config_normalized_(Normalize(config)) { requirement_.flex_grow_x = 1; requirement_.flex_grow_y = 0; if (IsColumnOriented()) std::swap(requirement_.flex_grow_x, requirement_.flex_grow_y); } bool IsColumnOriented() { return config_.direction == FlexboxConfig::Direction::Column || config_.direction == FlexboxConfig::Direction::ColumnInversed; } void Layout(flexbox_helper::Global& global, bool compute_requirement = false) { for (auto& child : children_) { flexbox_helper::Block block; block.min_size_x = child->requirement().min_x; block.min_size_y = child->requirement().min_y; if (!compute_requirement) { block.flex_grow_x = child->requirement().flex_grow_x; block.flex_grow_y = child->requirement().flex_grow_y; block.flex_shrink_x = child->requirement().flex_shrink_x; block.flex_shrink_y = child->requirement().flex_shrink_y; } global.blocks.push_back(block); } flexbox_helper::Compute(global); } void ComputeRequirement() override { for (auto& child : children_) child->ComputeRequirement(); flexbox_helper::Global global; global.config = config_normalized_; if (IsColumnOriented()) { global.size_x = 100000; global.size_y = asked_; } else { global.size_x = asked_; global.size_y = 100000; } Layout(global, true); if (global.blocks.size() == 0) { requirement_.min_x = 0; requirement_.min_y = 0; return; } Box box; box.x_min = global.blocks[0].x; box.y_min = global.blocks[0].y; box.x_max = global.blocks[0].x + global.blocks[0].dim_x; box.y_max = global.blocks[0].y + global.blocks[0].dim_y; for (auto& b : global.blocks) { box.x_min = std::min(box.x_min, b.x); box.y_min = std::min(box.y_min, b.y); box.x_max = std::max(box.x_max, b.x + b.dim_x); box.y_max = std::max(box.y_max, b.y + b.dim_y); } requirement_.min_x = box.x_max - box.x_min; requirement_.min_y = box.y_max - box.y_min; } void SetBox(Box box) override { Node::SetBox(box); asked_ = std::min(asked_, IsColumnOriented() ? box.y_max - box.y_min + 1 : box.x_max - box.x_min + 1); flexbox_helper::Global global; global.config = config_; global.size_x = box.x_max - box.x_min + 1; global.size_y = box.y_max - box.y_min + 1; Layout(global); need_iteration_ = false; for (size_t i = 0; i < children_.size(); ++i) { auto& child = children_[i]; auto& b = global.blocks[i]; Box children_box; children_box.x_min = box.x_min + b.x; children_box.y_min = box.y_min + b.y; children_box.x_max = box.x_min + b.x + b.dim_x - 1; children_box.y_max = box.y_min + b.y + b.dim_y - 1; Box intersection = Box::Intersection(children_box, box); child->SetBox(intersection); need_iteration_ |= (intersection != children_box); } } void Check(Status* status) override { for (auto& child : children_) child->Check(status); if (status->iteration == 0) { asked_ = 6000; need_iteration_ = true; } status->need_iteration |= need_iteration_; } int asked_ = 6000; bool need_iteration_ = true; const FlexboxConfig config_; const FlexboxConfig config_normalized_; }; } // namespace /// @brief A container displaying elements on row/columns and capable of /// wrapping on the next column/row when full. /// @param children The elements in the container /// @param config The option /// @return The container. /// /// #### Example /// /// ```cpp /// flexbox({ /// text("element 1"), /// text("element 2"), /// text("element 3"), /// }, FlexboxConfig() // .Set(FlexboxConfig::Direction::Column) // .Set(FlexboxConfig::Wrap::WrapInversed) // .SetGapMainAxis(1) // .SetGapCrossAxis(1) // ) /// ``` Element flexbox(Elements children, FlexboxConfig config) { return std::make_shared<Flexbox>(std::move(children), std::move(config)); } /// @brief A container displaying elements in rows from left to right. When /// filled, it starts on a new row below. /// @param children The elements in the container /// @return The container. /// /// #### Example /// /// ```cpp /// hflow({ /// text("element 1"), /// text("element 2"), /// text("element 3"), /// }); /// ``` Element hflow(Elements children) { return flexbox(std::move(children), FlexboxConfig()); } /// @brief A container displaying elements in rows from top to bottom. When /// filled, it starts on a new columns on the right. /// filled, it starts on a new row. /// is full, it starts a new row. /// @param children The elements in the container /// @return The container. /// /// #### Example /// /// ```cpp /// vflow({ /// text("element 1"), /// text("element 2"), /// text("element 3"), /// }); /// ``` Element vflow(Elements children) { return flexbox(std::move(children), FlexboxConfig().Set(FlexboxConfig::Direction::Column)); } } // namespace ftxui // Copyright 2020 <NAME>. All rights reserved. // Use of this source code is governed by the MIT license that can be found in // the LICENSE file.
AnthonyM/service-fabric
src/prod/src/Reliability/Failover/ra/Test.Utility.cpp
<filename>src/prod/src/Reliability/Failover/ra/Test.Utility.cpp // ------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License (MIT). See License.txt in the repo root for license information. // ------------------------------------------------------------ #include "stdafx.h" using namespace std; using namespace Common; using namespace Federation; using namespace Reliability; using namespace Reliability::ReconfigurationAgentComponent; using namespace ReliabilityUnitTest; using namespace ServiceModel; using namespace Transport; using namespace ReliabilityUnitTest::StateManagement; void ReliabilityUnitTest::BusyWaitUntil( std::function<bool ()> processor, DWORD pollTimeoutInMs, DWORD waitTimeoutInMs) { DateTime start = DateTime::Now(); for(;;) { if (processor()) { return; } else if ((Common::DateTime::Now() - start) > Common::TimeSpan::FromMilliseconds(waitTimeoutInMs)) { VERIFY_FAIL(L"validation timed out"); } else { Sleep(pollTimeoutInMs); } } } void ReliabilityUnitTest::VerifyWithinConfidenceInterval( double expected, double actual, double lowerBoundMultiplier, double upperBoundMultiplier ) { wstring text = L"VerifyWithinConfidenceInterval: " + wformatString(expected * lowerBoundMultiplier) + L" <= " + wformatString(actual) + L" <= " + wformatString(expected * upperBoundMultiplier); TestLog::WriteInfo(text); VERIFY_IS_TRUE(expected * lowerBoundMultiplier <= actual); VERIFY_IS_TRUE(actual <= expected * upperBoundMultiplier); } wstring ReliabilityUnitTest::GetRandomString(wstring const & prefix, Random& random) { wchar_t charTable[] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'}; // The simplest random string algorithm ever // Good enough for our tests int length = random.Next(1, 20); wstring rv; for(int i = 0; i < length; i++) { int index = random.Next(ARRAYSIZE(charTable)); rv += charTable[index]; } if (!prefix.empty()) { return prefix + L"_" + rv; } else { return rv; } }
fforw/pixgame
src/util/intersection.js
<filename>src/util/intersection.js // Given three colinear points p, q, r, the function checks if // point q lies on line segment 'pr' function onSegment(px, py, qx, qy, rx, ry) { return qx < Math.max(px, rx) && qx > Math.min(px, rx) && qy < Math.max(py, ry) && qy > Math.min(py, ry); } // To find orientation of ordered triplet (p, q, r). // The function returns following values // 0 --> p, q and r are colinear // 1 --> Clockwise // 2 --> Counterclockwise function orientation(px, py, qx, qy, rx, ry) { // See https://www.geeksforgeeks.org/orientation-3-ordered-points/ // for details of below formula. const val = (qy - py) * (rx - qx) - (qx - px) * (ry - qy); return Math.sign(val); } /** * Returns true if the given line-segments x1,y1 -> x2,y2 and x3,y3 -> x4,y4 intersect, but *not* when the lines * share an start or end point. * * @param {Number} x1 x-coordinate 1 * @param {Number} y1 y-coordinate 1 * @param {Number} x2 x-coordinate 2 * @param {Number} y2 y-coordinate 2 * @param {Number} x3 x-coordinate 3 * @param {Number} y3 y-coordinate 3 * @param {Number} x4 x-coordinate 4 * @param {Number} y4 y-coordinate 4 * @return {boolean} */ export function linesCross(x1, y1, x2, y2, x3, y3, x4, y4) { if ( (x1 === x2 && y1 === y2) || (x1 === x3 && y1 === y3) || (x1 === x4 && y1 === y4) || (x2 === x3 && y2 === y3) || (x2 === x4 && y2 === y4) || (x3 === x4 && y3 === y4) ) { return false; } // Find the four orientations needed for general and // special cases const o1 = orientation(x1, y1, x2, y2, x3, y3); const o2 = orientation(x1, y1, x2, y2, x4, y4); const o3 = orientation(x3, y3, x4, y4, x1, y1); const o4 = orientation(x3, y3, x4, y4, x2, y2); // General case if (o1 !== o2 && o3 !== o4) { return true; } // Special Cases if (o1 === 0 && onSegment(x1, y1, x3, y3, x2, y2)) { return true; } if (o2 === 0 && onSegment(x1, y1, x4, y4, x2, y2)) { return true; } if (o3 === 0 && onSegment(x3, y3, x1, y1, x4, y4)) { return true; } if (o4 === 0 && onSegment(x3, y3, x2, y2, x4, y4)) { return true; } return false; // Doesn't fall in any of the above cases } export function isClockwise(vertices, offsetA, offsetB, offsetC) { let sum = 0; let prevX = vertices[offsetC]; let prevY = vertices[offsetC + 1]; let currX = vertices[offsetA]; let currY = vertices[offsetA + 1]; sum += (currX - prevX) * (currY + prevY); prevX = currX; prevY = currY; currX = vertices[offsetB]; currY = vertices[offsetB + 1]; sum += (currX - prevX) * (currY + prevY); prevX = currX; prevY = currY; currX = vertices[offsetC]; currY = vertices[offsetC + 1]; sum += (currX - prevX) * (currY + prevY); return sum > 0 } // console.log(linesCross( // 0,0,100,100, // 0,100, 100,0 // )) // console.log(linesCross( // 0,0,100,100, // 10,0,110,100, // )) // console.log(linesCross( // 0,0,100,100, // 100,100,200,200, // )) // console.log(linesCross( // 0,0,100,100, // 0,0,200,300, // ))
yunionio/mcclient_nodejs
mcclient/subcmds/shells.js
const misc = require("../misc"); module.exports = [ { cmd: 'region-list', args: [ ], help: 'List regions', func: function(cli, args) { let regions = cli.token.getRegions(); let data = []; for(let i = 0; i < regions.length; i ++) { data.push({name: regions[i]}) } misc.printList(data); }, }, ];
Havoc-OS/androidprebuilts_go_linux-x86
src/net/interface_bsd_test.go
<reponame>Havoc-OS/androidprebuilts_go_linux-x86<filename>src/net/interface_bsd_test.go<gh_stars>100-1000 // Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // +build darwin dragonfly freebsd netbsd openbsd package net import ( "errors" "fmt" "os/exec" "runtime" ) func (ti *testInterface) setBroadcast(vid int) error { if runtime.GOOS == "openbsd" { ti.name = fmt.Sprintf("vether%d", vid) } else { ti.name = fmt.Sprintf("vlan%d", vid) } xname, err := exec.LookPath("ifconfig") if err != nil { return err } ti.setupCmds = append(ti.setupCmds, &exec.Cmd{ Path: xname, Args: []string{"ifconfig", ti.name, "create"}, }) ti.teardownCmds = append(ti.teardownCmds, &exec.Cmd{ Path: xname, Args: []string{"ifconfig", ti.name, "destroy"}, }) return nil } func (ti *testInterface) setPointToPoint(suffix int) error { ti.name = fmt.Sprintf("gif%d", suffix) xname, err := exec.LookPath("ifconfig") if err != nil { return err } ti.setupCmds = append(ti.setupCmds, &exec.Cmd{ Path: xname, Args: []string{"ifconfig", ti.name, "create"}, }) ti.setupCmds = append(ti.setupCmds, &exec.Cmd{ Path: xname, Args: []string{"ifconfig", ti.name, "inet", ti.local, ti.remote}, }) ti.teardownCmds = append(ti.teardownCmds, &exec.Cmd{ Path: xname, Args: []string{"ifconfig", ti.name, "destroy"}, }) return nil } func (ti *testInterface) setLinkLocal(suffix int) error { return errors.New("not yet implemented for BSD") }
RanerL/analyzer
tests/juliet/testcases/CWE773_Missing_Reference_to_Active_File_Descriptor_or_Handle/CWE773_Missing_Reference_to_Active_File_Descriptor_or_Handle__fopen_73b.cpp
<filename>tests/juliet/testcases/CWE773_Missing_Reference_to_Active_File_Descriptor_or_Handle/CWE773_Missing_Reference_to_Active_File_Descriptor_or_Handle__fopen_73b.cpp /* TEMPLATE GENERATED TESTCASE FILE Filename: CWE773_Missing_Reference_to_Active_File_Descriptor_or_Handle__fopen_73b.cpp Label Definition File: CWE773_Missing_Reference_to_Active_File_Descriptor_or_Handle__fopen.label.xml Template File: source-sinks-73b.tmpl.cpp */ /* * @description * CWE: 773 Missing Reference to Active File Descriptor or Handle * BadSource: Create a file handle using fopen() * Sinks: * GoodSink: Close the file handle before reusing it * BadSink : Reassign the file handle before closing it * Flow Variant: 73 Data flow: data passed in a list from one function to another in different source files * * */ #include "std_testcase.h" #include <list> using namespace std; namespace CWE773_Missing_Reference_to_Active_File_Descriptor_or_Handle__fopen_73 { #ifndef OMITBAD void badSink(list<FILE *> dataList) { /* copy data out of dataList */ FILE * data = dataList.back(); /* FLAW: Point data to another file handle without closing the handle from the source */ data = fopen("BadSink_fopen.txt", "w+"); /* avoid incidental for not closing the file handle */ if (data != NULL) { fclose(data); } } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodB2G uses the BadSource with the GoodSink */ void goodB2GSink(list<FILE *> dataList) { FILE * data = dataList.back(); /* FIX: Close the file from the source before pointing data to a new file handle */ if (data != NULL) { fclose(data); } data = fopen("GoodSink_fopen.txt", "w+"); /* avoid incidental for not closing the file handle */ if (data != NULL) { fclose(data); } } #endif /* OMITGOOD */ } /* close namespace */
awslabs/smithy-ruby
hearth/lib/hearth/query/param_matcher.rb
# frozen_string_literal: true require 'rspec/expectations' # Provides an rspec matcher for CGI.parse to check Float precision. # @api private RSpec::Matchers.define :match_query_params do |expected| match do |actual| return true if actual == expected return false unless actual.instance_of?(expected.class) expect(actual.keys.length).to eq(expected.keys.length) expect(actual.values.length).to eq(expected.values.length) expected.each do |ek, e| expect(actual.keys).to include(ek) a = actual[ek] expect(e.length).to eq(a.length) a.zip(e).each do |a0, e0| # Timestamps can have optional precision. if (float = Float(a0) rescue false) expect(float).to eq(e0.to_f) else expect(a0).to eq(e0) end end end end diffable end
nabemon/dreamkast
app/models/sponsor_attachment_miro.rb
<gh_stars>0 class SponsorAttachmentMiro < SponsorAttachment end
sthundat/kie-wb-common
kie-wb-common-cli/kie-wb-common-cli-tools/kie-wb-common-cli-forms-migration/src/test/java/org/kie/workbench/common/forms/migration/tool/pipelines/basic/FormDefinitionGeneratorForDataObjectsWithErrorsTest.java
/* * Copyright 2018 Red Hat, Inc. and/or its affiliates. * * 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.kie.workbench.common.forms.migration.tool.pipelines.basic; import java.util.ArrayList; import java.util.List; import org.assertj.core.api.Assertions; import org.junit.Test; import org.junit.runner.RunWith; import org.kie.workbench.common.forms.migration.legacy.model.Form; import org.kie.workbench.common.forms.migration.tool.FormMigrationSummary; import org.kie.workbench.common.forms.migration.tool.Resource; import org.kie.workbench.common.forms.migration.tool.pipelines.MigrationContext; import org.kie.workbench.common.migration.cli.RealSystemAccess; import org.mockito.Mock; import org.mockito.junit.MockitoJUnitRunner; import org.uberfire.backend.vfs.Path; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNull; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; @RunWith(MockitoJUnitRunner.Silent.class) public class FormDefinitionGeneratorForDataObjectsWithErrorsTest extends AbstractFormDefinitionGeneratorTest { private static final String USER_BASIC_TYPE_DATA_HOLDER_FORM = "user_with_basic_dataHolder.form"; private static final String USER_MULTIPLE_DATA_HOLDERS_FORM = "user_with_multiple_dataHolders.form"; private static final String USER_NO_DATA_HOLDERS_FORM = "user_without_dataHolders.form"; @Mock private Path basicDataHolderPath; @Mock private Path noDataHoldersPath; @Mock private Path multipleDataHoldersPath; private Form basicDataHolderForm; private Form noDataHoldersForm; private Form multipleDataHoldersForm; @Override protected void doInit() throws Exception { List<FormMigrationSummary> summaries = new ArrayList<>(); initForm(form -> basicDataHolderForm = form, DATAOBJECTS_RESOURCES, USER_BASIC_TYPE_DATA_HOLDER_FORM, basicDataHolderPath); summaries.add(new FormMigrationSummary(new Resource<>(basicDataHolderForm, basicDataHolderPath))); initForm(form -> noDataHoldersForm = form, DATAOBJECTS_RESOURCES, USER_NO_DATA_HOLDERS_FORM, noDataHoldersPath); summaries.add(new FormMigrationSummary(new Resource<>(noDataHoldersForm, noDataHoldersPath))); initForm(form -> multipleDataHoldersForm = form, DATAOBJECTS_RESOURCES, USER_MULTIPLE_DATA_HOLDERS_FORM, multipleDataHoldersPath); summaries.add(new FormMigrationSummary(new Resource<>(multipleDataHoldersForm, multipleDataHoldersPath))); context = new MigrationContext(workspaceProject, weldContainer, formsMigrationServicesCDIWrapper, new RealSystemAccess(), summaries, migrationServicesCDIWrapper); } @Test public void testMigration() { generator.execute(context); Assertions.assertThat(context.getSummaries()) .isNotEmpty() .hasSize(3); Assertions.assertThat(context.getExtraSummaries()) .isEmpty(); verify(migrationServicesCDIWrapper, never()).write(any(Path.class), anyString(), anyString()); context.getSummaries().forEach(summary -> { assertFalse(summary.getResult().isSuccess()); assertNull(summary.getNewForm()); }); } }
getdunne/Voxvu
VolParamsDlg.h
#pragma once class VolParamsDlg : public CDialog { // Construction public: VolParamsDlg(CWnd* pParent = NULL); // standard constructor // Dialog Data enum { IDD = IDD_VOLDLG }; UINT m_width; UINT m_height; UINT m_depth; double m_voxWidth; double m_voxHeight; double m_voxDepth; // Overrides protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support // Implementation protected: // Generated message map functions DECLARE_MESSAGE_MAP() };
jsun999/ml-blog
src/main/java/site/jsun999/common/utils/ParamUtil.java
<reponame>jsun999/ml-blog<gh_stars>0 package site.jsun999.common.utils; import site.jsun999.common.constant.ParamConstant; import site.jsun999.component.CommonMap; import site.jsun999.web.context.SpringContext; import org.springframework.util.StringUtils; public class ParamUtil { public static boolean checkParameter(int type) { CommonMap commonMap = SpringContext.getBeanByName("commonMap"); if (type == ParamConstant.QINIU) {// 七牛云 if (StringUtils.isEmpty(commonMap.get("qn_accessKey")) || StringUtils.isEmpty(commonMap.get("qn_secretKey")) || StringUtils.isEmpty(commonMap.get("qn_bucket"))) { return false; } } else if (type == ParamConstant.CHANGYAN) {// 畅言 if (StringUtils.isEmpty("changyan_app_id") || StringUtils.isEmpty("changyan_app_key")) { return false; } } else if (type == ParamConstant.GEETEST) {// 极验 if (StringUtils.isEmpty("geetest_id") || StringUtils.isEmpty("geetest_key")) { return false; } } return true; } }
mjirik/lisa
lisa/pklz_info.py
#! /usr/bin/python # -*- coding: utf-8 -*- import sys import os.path path_to_script = os.path.dirname(os.path.abspath(__file__)) sys.path.append(os.path.join(path_to_script, "../src/")) sys.path.append(os.path.join(path_to_script, "../extern/pyseg_base/src")) sys.path.append(os.path.join(path_to_script, "../extern/sed3/")) #sys.path.append(os.path.join(path_to_script, "../extern/")) #import featurevector import argparse from loguru import logger # logger = logging.getLogger() import misc import sed3 def main(): # logger = logging.getLogger() logger.setLevel(logging.WARNING) ch = logging.StreamHandler() logger.addHandler(ch) #logger.debug('input params') data3d_a_path = None # os.path.join(path_to_script, '../../../data/medical/data_orig/sliver07/training-part1/liver-orig001.mhd') data3d_b_path = None #os.path.join(path_to_script, '../../../data/medical/data_orig/sliver07/training-part1/liver-seg001.mhd') parser = argparse.ArgumentParser( description='Information about pkl/pklz file') parser.add_argument('pklzFile', help='path to data' ) args = parser.parse_args() data = misc.obj_from_file(args.pklzFile, 'pickle') print(data) try: pyed = sed3.sed3(data['data3d'], contour=data['segmentation']) pyed.show() except: try: pyed = sed3.sed3(data['data3d']) pyed.show() except: print("Problem with visualization") if __name__ == "__main__": main()
blogmitnik/rails2_code
vendor/plugins/localization/lib/localization.rb
module Localization mattr_accessor :lang @@l10s = { :default => {} } @@lang = :default def self._(string_to_localize, *args) translated = @@l10s[@@lang][string_to_localize] || string_to_localize return translated.call(*args).to_s if translated.is_a? Proc if translated.is_a? Array translated = if translated.size == 3 translated[args[0]==0 ? 0 : (args[0]>1 ? 2 : 1)] else translated[args[0]>1 ? 1 : 0] end end sprintf translated, *args end def self.define(lang = :default) @@l10s[lang] ||= {} yield @@l10s[lang] end def self.load Dir.glob("#{RAILS_ROOT}/lang/*.rb"){ |t| require t } Dir.glob("#{RAILS_ROOT}/lang/custom/*.rb"){ |t| require t } end # Generates a best-estimate l10n file from all views by # collecting calls to _() -- note: use the generated file only # as a start (this method is only guesstimating) def self.generate_l10n_file "Localization.define('en_US') do |l|\n" << Dir.glob("#{RAILS_ROOT}/app/views/**/*.rhtml").collect do |f| ["# #{f}"] << File.read(f).scan(/<%.*[^\w]_\s*[\"\'](.*?)[\"\']/) end.uniq.flatten.collect do |g| g.starts_with?('#') ? "\n #{g}" : " l.store '#{g}', '#{g}'" end.uniq.join("\n") << "\nend" end end class Object def _(*args); Localization._(*args); end end
ham0215/rails_api_base
app/models/skill.rb
<gh_stars>0 # frozen_string_literal: true class Skill < ApplicationRecord belongs_to :profile end
tsani/goto
programs/valid/switch (3).go
package main; func main(){ switch x := 1; x{ case 1: case 2: x++; case 3,4: default: } switch { case true: case false: default: println("Hello World!"); } }
Llamadmiral/Advent_Of_Code_2017
Year2016/src/com/aoc/days2016/day10/Operation.java
package com.aoc.days2016.day10; /** * @author maczaka. */ public class Operation { private int lowTo; private int highTo; private int giver; private boolean lowToOutput = false; private boolean highToOutput = false; Operation(final String[] input) { giver = Integer.parseInt(input[1]); lowToOutput = "output".equals(input[5]); lowTo = Integer.parseInt(input[6]); highToOutput = "output".equals(input[10]); highTo = Integer.parseInt(input[11]); } int getLowTo() { return lowTo; } int getHighTo() { return highTo; } int getGiver() { return giver; } boolean isLowToOutput() { return lowToOutput; } boolean isHighToOutput() { return highToOutput; } }
rd2281136306/pinpoint
web/src/test/java/com/navercorp/pinpoint/web/service/map/processor/RpcCallProcessorTest.java
/* * Copyright 2017 NAVER Corp. * * 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 com.navercorp.pinpoint.web.service.map.processor; import com.google.common.collect.Sets; import com.navercorp.pinpoint.common.trace.ServiceType; import com.navercorp.pinpoint.web.applicationmap.rawdata.LinkData; import com.navercorp.pinpoint.web.applicationmap.rawdata.LinkDataMap; import com.navercorp.pinpoint.web.dao.HostApplicationMapDao; import com.navercorp.pinpoint.web.service.map.AcceptApplication; import com.navercorp.pinpoint.web.service.map.VirtualLinkMarker; import com.navercorp.pinpoint.web.vo.Application; import com.navercorp.pinpoint.web.vo.LinkKey; import com.navercorp.pinpoint.web.vo.Range; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.junit.MockitoJUnitRunner; import java.util.Collections; import java.util.Set; import static com.navercorp.pinpoint.common.trace.ServiceTypeFactory.of; import static com.navercorp.pinpoint.common.trace.ServiceTypeProperty.ALIAS; import static com.navercorp.pinpoint.common.trace.ServiceTypeProperty.RECORD_STATISTICS; import static com.navercorp.pinpoint.common.trace.ServiceTypeProperty.TERMINAL; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; /** * @author <NAME> */ @RunWith(MockitoJUnitRunner.class) public class RpcCallProcessorTest { private final Range testRange = new Range(System.currentTimeMillis(), System.currentTimeMillis()); @Mock private HostApplicationMapDao hostApplicationMapDao; @Test public void nonRpcClientOrQueueCallsShouldNotBeReplaced() { // Given ServiceType nonRpcClientOrQueueServiceType = mock(ServiceType.class); when(nonRpcClientOrQueueServiceType.isRpcClient()).thenReturn(false); when(nonRpcClientOrQueueServiceType.isQueue()).thenReturn(false); Application fromApplication = new Application("WAS", ServiceType.TEST_STAND_ALONE); Application toApplication = new Application("NON_RPC_OR_QUEUE", nonRpcClientOrQueueServiceType); LinkDataMap linkDataMap = new LinkDataMap(); linkDataMap.addLinkData(new LinkData(fromApplication, toApplication)); // When VirtualLinkMarker virtualLinkMarker = new VirtualLinkMarker(); RpcCallProcessor rpcCallProcessor = new RpcCallProcessor(hostApplicationMapDao, virtualLinkMarker); LinkDataMap replacedLinkDataMap = rpcCallProcessor.processLinkDataMap(linkDataMap, testRange); // Then LinkKey linkKey = new LinkKey(fromApplication, toApplication); Assert.assertNotNull(replacedLinkDataMap.getLinkData(linkKey)); Assert.assertEquals(linkDataMap.size(), replacedLinkDataMap.size()); Assert.assertTrue(virtualLinkMarker.getVirtualLinkData().isEmpty()); } @Test public void oneAcceptApplication() { // Given ServiceType rpcClientServiceType = mock(ServiceType.class); when(rpcClientServiceType.isRpcClient()).thenReturn(true); String rpcUri = "accept.host/foo"; Application fromApplication = new Application("WAS", ServiceType.TEST_STAND_ALONE); Application toApplication = new Application(rpcUri, rpcClientServiceType); LinkDataMap linkDataMap = new LinkDataMap(); linkDataMap.addLinkData(new LinkData(fromApplication, toApplication)); Application expectedToApplication = new Application("ACCEPT_WAS", ServiceType.TEST_STAND_ALONE); when(hostApplicationMapDao.findAcceptApplicationName(fromApplication, testRange)) .thenReturn(Sets.newHashSet(new AcceptApplication(rpcUri, expectedToApplication))); // When VirtualLinkMarker virtualLinkMarker = new VirtualLinkMarker(); RpcCallProcessor rpcCallProcessor = new RpcCallProcessor(hostApplicationMapDao, virtualLinkMarker); LinkDataMap replacedLinkDataMap = rpcCallProcessor.processLinkDataMap(linkDataMap, testRange); // Then LinkKey originalLinkKey = new LinkKey(fromApplication, toApplication); Assert.assertNull(replacedLinkDataMap.getLinkData(originalLinkKey)); LinkKey replacedLinkKey = new LinkKey(fromApplication, expectedToApplication); LinkData replacedLinkData = replacedLinkDataMap.getLinkData(replacedLinkKey); Assert.assertNotNull(replacedLinkData); Assert.assertEquals(fromApplication, replacedLinkData.getFromApplication()); Assert.assertEquals(expectedToApplication, replacedLinkData.getToApplication()); Assert.assertTrue(virtualLinkMarker.getVirtualLinkData().isEmpty()); } @Test public void multipleAcceptApplications() { // Given ServiceType rpcClientServiceType = mock(ServiceType.class); when(rpcClientServiceType.isRpcClient()).thenReturn(true); String rpcUri = "accept.host/foo"; Application fromApplication = new Application("WAS", ServiceType.TEST_STAND_ALONE); Application toApplication = new Application(rpcUri, rpcClientServiceType); LinkDataMap linkDataMap = new LinkDataMap(); linkDataMap.addLinkData(new LinkData(fromApplication, toApplication)); Application expectedToApplication1 = new Application("ACCEPT_WAS1", ServiceType.TEST_STAND_ALONE); Application expectedToApplication2 = new Application("ACCEPT_WAS2", ServiceType.TEST_STAND_ALONE); when(hostApplicationMapDao.findAcceptApplicationName(fromApplication, testRange)) .thenReturn(Sets.newHashSet( new AcceptApplication(rpcUri, expectedToApplication1), new AcceptApplication(rpcUri, expectedToApplication2))); // When VirtualLinkMarker virtualLinkMarker = new VirtualLinkMarker(); RpcCallProcessor rpcCallProcessor = new RpcCallProcessor(hostApplicationMapDao, virtualLinkMarker); LinkDataMap replacedLinkDataMap = rpcCallProcessor.processLinkDataMap(linkDataMap, testRange); // Then LinkKey originalLinkKey = new LinkKey(fromApplication, toApplication); Assert.assertNull(replacedLinkDataMap.getLinkData(originalLinkKey)); LinkKey replacedLinkKey1 = new LinkKey(fromApplication, expectedToApplication1); LinkData replacedLinkData1 = replacedLinkDataMap.getLinkData(replacedLinkKey1); Assert.assertNotNull(replacedLinkData1); Assert.assertEquals(fromApplication, replacedLinkData1.getFromApplication()); Assert.assertEquals(expectedToApplication1, replacedLinkData1.getToApplication()); LinkKey replacedLinkKey2 = new LinkKey(fromApplication, expectedToApplication2); LinkData replacedLinkData2 = replacedLinkDataMap.getLinkData(replacedLinkKey2); Assert.assertNotNull(replacedLinkData2); Assert.assertEquals(fromApplication, replacedLinkData2.getFromApplication()); Assert.assertEquals(expectedToApplication2, replacedLinkData2.getToApplication()); Set<LinkData> virtualLinkDatas = virtualLinkMarker.getVirtualLinkData(); Assert.assertTrue(virtualLinkDatas.contains(replacedLinkData1)); Assert.assertTrue(virtualLinkDatas.contains(replacedLinkData2)); } @Test public void rpcWithoutAcceptApplication_shouldBeReplacedToUnknown() { // Given ServiceType rpcClientServiceType = mock(ServiceType.class); when(rpcClientServiceType.isRpcClient()).thenReturn(true); String rpcUri = "accept.host/foo"; Application fromApplication = new Application("WAS", ServiceType.TEST_STAND_ALONE); Application toApplication = new Application(rpcUri, rpcClientServiceType); Application expectedToApplication = new Application(rpcUri, ServiceType.UNKNOWN); LinkDataMap linkDataMap = new LinkDataMap(); linkDataMap.addLinkData(new LinkData(fromApplication, toApplication)); when(hostApplicationMapDao.findAcceptApplicationName(fromApplication, testRange)).thenReturn(Collections.emptySet()); // When VirtualLinkMarker virtualLinkMarker = new VirtualLinkMarker(); RpcCallProcessor rpcCallProcessor = new RpcCallProcessor(hostApplicationMapDao, virtualLinkMarker); LinkDataMap replacedLinkDataMap = rpcCallProcessor.processLinkDataMap(linkDataMap, testRange); // Then LinkKey originalLinkKey = new LinkKey(fromApplication, toApplication); Assert.assertNull(replacedLinkDataMap.getLinkData(originalLinkKey)); LinkKey replacedLinkKey = new LinkKey(fromApplication, expectedToApplication); LinkData replacedLinkData = replacedLinkDataMap.getLinkData(replacedLinkKey); Assert.assertEquals(fromApplication, replacedLinkData.getFromApplication()); Assert.assertEquals(expectedToApplication, replacedLinkData.getToApplication()); Assert.assertTrue(virtualLinkMarker.getVirtualLinkData().isEmpty()); } @Test public void queueWithoutAcceptApplication_shouldNotReplace() { // Given ServiceType queueServiceType = mock(ServiceType.class); when(queueServiceType.isRpcClient()).thenReturn(false); when(queueServiceType.isQueue()).thenReturn(true); String queueName = "TestQueue"; Application fromApplication = new Application("WAS", ServiceType.TEST_STAND_ALONE); Application toApplication = new Application(queueName, queueServiceType); LinkDataMap linkDataMap = new LinkDataMap(); linkDataMap.addLinkData(new LinkData(fromApplication, toApplication)); when(hostApplicationMapDao.findAcceptApplicationName(fromApplication, testRange)).thenReturn(Collections.emptySet()); // When VirtualLinkMarker virtualLinkMarker = new VirtualLinkMarker(); RpcCallProcessor rpcCallProcessor = new RpcCallProcessor(hostApplicationMapDao, virtualLinkMarker); LinkDataMap replacedLinkDataMap = rpcCallProcessor.processLinkDataMap(linkDataMap, testRange); // Then LinkKey linkKey = new LinkKey(fromApplication, toApplication); LinkData linkData = replacedLinkDataMap.getLinkData(linkKey); Assert.assertEquals(fromApplication, linkData.getFromApplication()); Assert.assertEquals(toApplication, linkData.getToApplication()); Assert.assertTrue(virtualLinkMarker.getVirtualLinkData().isEmpty()); } @Test public void multipleAcceptApplications_with_AliasAndOriginal() { ServiceType AliasServiceType = of(1008, "TEST_ALIAS_CLIENT", ALIAS); ServiceType ServerServiceType = of(1009, "TEST_ALIAS_SERVER", RECORD_STATISTICS, TERMINAL); // Given ServiceType rpcClientServiceType = mock(ServiceType.class); when(rpcClientServiceType.isRpcClient()).thenReturn(true); String rpcUri = "accept.host/foo"; Application fromApplication = new Application("WAS", ServiceType.TEST_STAND_ALONE); Application toApplication = new Application(rpcUri, rpcClientServiceType); LinkDataMap linkDataMap = new LinkDataMap(); linkDataMap.addLinkData(new LinkData(fromApplication, toApplication)); Application expectedToApplication1 = new Application("AliasClient", AliasServiceType); Application expectedToApplication2 = new Application("AliasServer", ServerServiceType); when(hostApplicationMapDao.findAcceptApplicationName(fromApplication, testRange)) .thenReturn(Sets.newHashSet( new AcceptApplication(rpcUri, expectedToApplication1), new AcceptApplication(rpcUri, expectedToApplication2))); // When VirtualLinkMarker virtualLinkMarker = new VirtualLinkMarker(); RpcCallProcessor rpcCallProcessor = new RpcCallProcessor(hostApplicationMapDao, virtualLinkMarker); LinkDataMap replacedLinkDataMap = rpcCallProcessor.processLinkDataMap(linkDataMap, testRange); // Then LinkKey originalLinkKey = new LinkKey(fromApplication, toApplication); Assert.assertNull(replacedLinkDataMap.getLinkData(originalLinkKey)); LinkKey replacedLinkKey2 = new LinkKey(fromApplication, expectedToApplication2); LinkData replacedLinkData2 = replacedLinkDataMap.getLinkData(replacedLinkKey2); Assert.assertNotNull(replacedLinkData2); Assert.assertEquals(fromApplication, replacedLinkData2.getFromApplication()); Assert.assertEquals(expectedToApplication2, replacedLinkData2.getToApplication()); } }
YaoApp/gou
dsl/workshop/config.go
<reponame>YaoApp/gou<filename>dsl/workshop/config.go<gh_stars>10-100 package workshop import ( "errors" "fmt" "os" "path/filepath" "strings" jsoniter "github.com/json-iterator/go" "github.com/yaoapp/gou/dsl/u" ) // GetConfig get the workshop config func GetConfig() (Config, error) { root, err := ConfigRoot() if err != nil { return nil, err } file := filepath.Join(root, "workshop.yao") exists, _ := u.FileExists(file) if !exists { return Config{}, nil } data, err := u.FileGetJSON(file) if err != nil { return nil, err } cfg := Config{} err = jsoniter.Unmarshal(data, &cfg) if err != nil { return nil, err } err = cfg.github() if err != nil { return nil, err } return cfg, nil } // LocalRoot get the root path in the local disk // the default is: ~/yao/ func LocalRoot() (string, error) { root := os.Getenv(RootEnvName) if root == "" { home, err := os.UserHomeDir() if err != nil { return "", err } root = filepath.Join(home, "yao") } return root, nil } // Root get the workshop root in the local disk func Root() (string, error) { root, err := LocalRoot() if err != nil { return "", err } return filepath.Join(root, "workshop"), nil } // ConfigRoot get the workshop root in the local disk func ConfigRoot() (string, error) { root, err := LocalRoot() if err != nil { return "", err } return filepath.Join(root, "config"), nil } // Setup github config func (cfg Config) github() error { if _, has := cfg["github.com"]; !has { return nil } if _, has := cfg["github.com"]["token"]; !has { return nil } token, ok := cfg["github.com"]["token"].(string) if !ok { return fmt.Errorf("token should be a filepath, but got %v", token) } if strings.HasPrefix(token, "~") { home, err := os.UserHomeDir() if err != nil { return err } token = fmt.Sprintf("%s%s", home, strings.TrimLeft(token, "~")) } file, err := filepath.Abs(token) if err != nil { return err } info, err := os.Stat(file) if errors.Is(err, os.ErrNotExist) { return fmt.Errorf("the token file does not found. %v", token) } if err != nil { return err } mode := info.Mode().String() if mode != "-r--------" && mode != "-rw-------" { return fmt.Errorf("the token file can be read by other users. \ntry: chmod 600 %v", token) } content, err := os.ReadFile(file) if err != nil { return err } if len(content) == 0 { return fmt.Errorf("the token %s is empty", token) } token = strings.Trim(string(content), "\n") cfg["github.com"]["token"] = token return nil }
cy15196/xxxxRsmTest
TopTestWidgets/privateSource/qbarlegendmarker.cpp
/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt Charts module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:GPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms ** and conditions see https://www.qt.io/terms-conditions. For further ** information use the contact form at https://www.qt.io/contact-us. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3 or (at your option) any later version ** approved by the KDE Free Qt Foundation. The licenses are as published by ** the Free Software Foundation and appearing in the file LICENSE.GPL3 ** included in the packaging of this file. Please review the following ** information to ensure the GNU General Public License requirements will ** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #include <QtCharts/QBarLegendMarker> #include <private/qbarlegendmarker_p.h> #include <QtCharts/QAbstractBarSeries> #include <QtCharts/QBarSet> QT_CHARTS_BEGIN_NAMESPACE ///*! // \class QBarLegendMarker // \inmodule Qt Charts // \brief The QBarLegendMarker class is a legend marker for a bar series. // A bar legend marker is related to QAbstractBarSeries derived classes. With a bar series, // each marker is related to one QBarSet. // \sa QLegend, QAbstractBarSeries, QBarSet //*/ ///*! // \fn virtual LegendMarkerType QBarLegendMarker::type() // \reimp //*/ ///*! // \internal // Constructor //*/ //QBarLegendMarker::QBarLegendMarker(QAbstractBarSeries *series, QBarSet *barset, QLegend *legend, QObject *parent) : // QLegendMarker(*new QBarLegendMarkerPrivate(this,series,barset,legend), parent) //{ // d_ptr->updated(); //} ///*! // Removes the legend marker for a bar set. //*/ //QBarLegendMarker::~QBarLegendMarker() //{ //} ///*! // \internal //*/ //QBarLegendMarker::QBarLegendMarker(QBarLegendMarkerPrivate &d, QObject *parent) : // QLegendMarker(d, parent) //{ //} ///*! // \reimp //*/ //QAbstractBarSeries *QBarLegendMarker::series() //{ // Q_D(QBarLegendMarker); // return d->m_series; //} ///*! // Returns the bar set related to the marker. //*/ //QBarSet* QBarLegendMarker::barset() //{ // Q_D(QBarLegendMarker); // return d->m_barset; //} //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// QBarLegendMarkerPrivate::QBarLegendMarkerPrivate(QBarLegendMarker *q, QAbstractBarSeries *series, QBarSet *barset, QLegend *legend) : QLegendMarkerPrivate(q,legend), q_ptr(q), m_series(series), m_barset(barset) { QObject::connect(m_barset, SIGNAL(penChanged()), this, SLOT(updated())); QObject::connect(m_barset, SIGNAL(labelChanged()), this, SLOT(updated())); QObject::connect(m_barset, SIGNAL(brushChanged()), this, SLOT(updated())); } QBarLegendMarkerPrivate::~QBarLegendMarkerPrivate() { } QAbstractBarSeries* QBarLegendMarkerPrivate::series() { return m_series; } QObject* QBarLegendMarkerPrivate::relatedObject() { return m_barset; } void QBarLegendMarkerPrivate::updated() { bool labelChanged = false; bool brushChanged = false; bool penChanged = false; if (!m_customPen && (m_item->pen() != m_barset->pen())) { m_item->setPen(m_barset->pen()); penChanged = true; } if (!m_customBrush && (m_item->brush() != m_barset->brush())) { m_item->setBrush(m_barset->brush()); brushChanged = true; } if (!m_customLabel && (m_item->label() != m_barset->label())) { m_item->setLabel(m_barset->label()); labelChanged = true; } invalidateLegend(); if (labelChanged) emit q_ptr->labelChanged(); if (brushChanged) emit q_ptr->brushChanged(); if (penChanged) emit q_ptr->penChanged(); } //#include "moc_qbarlegendmarker.cpp" #include "moc_qbarlegendmarker_p.cpp" QT_CHARTS_END_NAMESPACE
tinyzimmer/android-farm-operator
pkg/resources/stf/traefik.go
package stf import ( "bytes" "fmt" "strconv" androidv1alpha1 "github.com/tinyzimmer/android-farm-operator/pkg/apis/android/v1alpha1" "github.com/tinyzimmer/android-farm-operator/pkg/util" "github.com/tinyzimmer/android-farm-operator/pkg/util/builders" // traefikv1 "github.com/containous/traefik/v2/pkg/provider/kubernetes/crd/traefik/v1alpha1" "github.com/go-logr/logr" cm "github.com/jetstack/cert-manager/pkg/apis/certmanager/v1alpha3" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "sigs.k8s.io/controller-runtime/pkg/client" ) func (r *STFReconciler) reconcileIngress(reqLogger logr.Logger, instance *androidv1alpha1.AndroidFarm) error { if instance.STFConfig().GetIssuerReference() != nil { cert := newCertificateForCR(instance) if err := util.ReconcileCertificate(reqLogger, r.client, cert, true); err != nil { return err } } if instance.STFConfig().UseIngressRouteCRD() { // WIP return nil } return reconcileIngressDeployment(reqLogger, r.client, instance) } func reconcileIngressDeployment(reqLogger logr.Logger, c client.Client, instance *androidv1alpha1.AndroidFarm) error { var static bytes.Buffer if err := traefikStaticConfigTmpl.Execute(&static, map[string]interface{}{ "UseSSL": instance.STFConfig().TLSEnabled() && !instance.STFConfig().UseExternalTLS(), "Services": calculateServiceDefinitions(instance), "AccessLog": instance.STFConfig().TraefikAccessLogsEnabled(), "Backtick": "`", }); err != nil { return err } var dynamic bytes.Buffer if err := traefikDynamicConfigTmpl.Execute(&dynamic, map[string]interface{}{ "UseSSL": instance.STFConfig().TLSEnabled() && !instance.STFConfig().UseExternalTLS(), "UseSelfSigned": instance.TLSSecret() == "", "Services": calculateServiceDefinitions(instance), "Proxies": caclculateProxyDefinitions(instance), "DashboardEnabled": instance.STFConfig().TraefikDashboardEnabled(), "DashboardWhitelist": instance.STFConfig().TraefikDashboardWhitelistString(), "DashboardRule": fmt.Sprintf("Host(`%s`)", instance.STFConfig().TraefikDashboardHost()), "Backtick": "`", }); err != nil { return err } builder := builders.NewDeploymentBuilder(reqLogger, instance, "traefik"). WithImage(instance.STFConfig().TraefikImage()). WithReplicas(instance.STFConfig().TraefikReplicas()). WithFile("config.toml", static.String()). WithFile("routes/stf.toml", dynamic.String()). WithCommand([]string{"traefik"}). WithArgs([]string{ "--configfile", "/etc/configmap/config.toml", }). WithPodSecurityContext(instance.STFConfig().PodSecurityContext()). WithServiceAnnotations(instance.STFConfig().TraefikServiceAnnotations()). WithPort("stf-internal", 8880) if instance.STFConfig().TLSEnabled() { if instance.STFConfig().UseExternalTLS() { builder = builder.WithPort("web", 8088). WithServiceMap(instance.STFConfig().TraefikServiceType(), []map[string]int32{{"web": 80}}) } else { builder = builder.WithPort("websecure", 8443). WithServiceMap(instance.STFConfig().TraefikServiceType(), []map[string]int32{{"websecure": 443}}) } if !instance.STFConfig().UseExternalTLS() && instance.TLSSecret() != "" { builder = builder.WithVolumes( []corev1.Volume{ { Name: "tls", VolumeSource: corev1.VolumeSource{ Secret: &corev1.SecretVolumeSource{ SecretName: instance.TLSSecret(), }, }, }, }, []corev1.VolumeMount{ { Name: "tls", MountPath: "/etc/traefik/ssl", }, }, ) } } else { builder = builder.WithPort("web", 8088). WithServiceMap(instance.STFConfig().TraefikServiceType(), []map[string]int32{{"web": 80}}) } for _, group := range instance.DeviceGroups() { if !group.UseClusterLocalADB() { // Provider ADB Ports for _, svc := range calculateProviderSvcDefinitions(instance, group, true) { for svcName, svcAttrs := range svc { port, _ := strconv.Atoi(svcAttrs.Port) if len(svcName) > 15 { svcName = svcName[len(svcName)-15:] } builder = builder.WithPort(svcName, int32(port)) } } } } return builder.Reconcile(c) } func newCertificateForCR(instance *androidv1alpha1.AndroidFarm) *cm.Certificate { dnsNames := []string{instance.STFConfig().GetAppHostname()} if instance.STFConfig().TraefikDashboardEnabled() { dnsNames = append(dnsNames, instance.STFConfig().TraefikDashboardHost()) } return &cm.Certificate{ ObjectMeta: metav1.ObjectMeta{ Name: instance.STFConfig().GetAppHostname(), Namespace: instance.STFConfig().GetNamespace(), Labels: instance.STFComponentLabels("ingress"), OwnerReferences: instance.OwnerReferences(), }, Spec: cm.CertificateSpec{ DNSNames: dnsNames, SecretName: instance.TLSSecret(), KeySize: 4096, IssuerRef: *instance.STFConfig().GetIssuerReference(), }, } } // func buildIngressRoute(instance *androidv1alpha1.AndroidFarm) *traefikv1.IngressRoute { // ingressRoute := &traefikv1.IngressRoute{ // ObjectMeta: metav1.ObjectMeta{ // Name: fmt.Sprintf("%s-ingress", instance.STFNamePrefix()), // Namespace: instance.STFConfig().GetNamespace(), // Labels: instance.STFComponentLabels("ingress"), // OwnerReferences: instance.OwnerReferences(), // }, // Spec: traefikv1.IngressRouteSpec{ // EntryPoints: []string{instance.STFConfig().GetHTTPScheme()}, // Routes: make([]traefikv1.Route, 0), // }, // } // if instance.STFConfig().TLSEnabled() { // ingressRoute.Spec.TLS = &traefikv1.TLS{ // SecretName: instance.TLSSecret(), // } // } // // return ingressRoute // }
thavlik/iridium
Source/Common/WindowHelper.h
<gh_stars>1-10 #pragma once #include <windows.h> class WindowHelper { public: WindowHelper(const char* title, int w, int h, int x, int y); ~WindowHelper(); void ProcessMessages(); bool Escape() const { return _escape; } HWND Handle() const { return _hwnd; } unsigned Width() const { return _width; } unsigned Height() const { return _height; } private: bool _escape; HWND _hwnd; unsigned _width; unsigned _height; };
abrams27/mimuw
sem4/so/zadania/zad5/minix_source/usr/src/minix/fs/iso9660fs/utility.c
<filename>sem4/so/zadania/zad5/minix_source/usr/src/minix/fs/iso9660fs/utility.c #include "inc.h" #include <sys/stat.h> #include <string.h> #include <minix/com.h> #include <minix/callnr.h> #include <minix/vfsif.h> /*===========================================================================* * do_noop * *===========================================================================*/ int do_noop(void) { /* Do not do anything. */ return(OK); } /*===========================================================================* * no_sys * *===========================================================================*/ int no_sys(void) { /* Somebody has used an illegal system call number */ return(EINVAL); }
gottaegbert/penter
library/lib_study/36_filesys_fileinput.py
<filename>library/lib_study/36_filesys_fileinput.py # _*_ coding:utf-8 _*_ import fileinput # 默认控制台输入 # for line in fileinput.input(): # print(line) # UnicodeDecodeError: 'gbk' codec can't decode byte 0xae in position 50: illegal multibyte sequence # openhook=fileinput.hook_encoded('utf-8') with fileinput.input(files=('36_filesys_fileinput.py', '35_filesys_os.path.py'), openhook=fileinput.hook_encoded('utf-8')) as f: for line in f: print(fileinput.filename()) print(str(fileinput.lineno()) + ":"+line)
SierraSoftworks/heimdall
internal/pkg/sequence_set/memory_test.go
<reponame>SierraSoftworks/heimdall package set import ( "testing" . "github.com/smartystreets/goconvey/convey" ) func TestSequenceSet(t *testing.T) { Convey("SequenceSet", t, func() { s := NewMemorySet() So(s, ShouldNotBeNil) has, err := s.Has("test") So(has, ShouldBeFalse) So(err, ShouldBeNil) So(s.Add("test", 1), ShouldBeNil) has, err = s.Has("test") So(has, ShouldBeTrue) So(err, ShouldBeNil) So(s.Add("test", 3), ShouldBeNil) has, err = s.Has("test") So(has, ShouldBeTrue) So(err, ShouldBeNil) So(s.Remove("test", 2), ShouldBeNil) has, err = s.Has("test") So(has, ShouldBeTrue) So(err, ShouldBeNil) So(s.Remove("test", 4), ShouldBeNil) has, err = s.Has("test") So(has, ShouldBeFalse) So(err, ShouldBeNil) So(s.Add("test", 5), ShouldBeNil) has, err = s.Has("test") So(has, ShouldBeTrue) So(err, ShouldBeNil) }) }
LaudateCorpus1/oci-go-sdk
mysql/channel_source_mysql.go
// Copyright (c) 2016, 2018, 2022, Oracle and/or its affiliates. All rights reserved. // This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. // Code generated. DO NOT EDIT. // MySQL Database Service API // // The API for the MySQL Database Service // package mysql import ( "encoding/json" "fmt" "github.com/oracle/oci-go-sdk/v58/common" "strings" ) // ChannelSourceMysql Core properties of a Mysql Channel source. type ChannelSourceMysql struct { // The network address of the MySQL instance. Hostname *string `mandatory:"true" json:"hostname"` // The port the source MySQL instance listens on. Port *int `mandatory:"true" json:"port"` // The name of the replication user on the source MySQL instance. // The username has a maximum length of 96 characters. For more information, // please see the MySQL documentation (https://dev.mysql.com/doc/refman/8.0/en/change-master-to.html) Username *string `mandatory:"true" json:"username"` SslCaCertificate CaCertificate `mandatory:"false" json:"sslCaCertificate"` // The SSL mode of the Channel. SslMode ChannelSourceMysqlSslModeEnum `mandatory:"true" json:"sslMode"` } func (m ChannelSourceMysql) String() string { return common.PointerString(m) } // ValidateEnumValue returns an error when providing an unsupported enum value // This function is being called during constructing API request process // Not recommended for calling this function directly func (m ChannelSourceMysql) ValidateEnumValue() (bool, error) { errMessage := []string{} if _, ok := GetMappingChannelSourceMysqlSslModeEnum(string(m.SslMode)); !ok && m.SslMode != "" { errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for SslMode: %s. Supported values are: %s.", m.SslMode, strings.Join(GetChannelSourceMysqlSslModeEnumStringValues(), ","))) } if len(errMessage) > 0 { return true, fmt.Errorf(strings.Join(errMessage, "\n")) } return false, nil } // MarshalJSON marshals to json representation func (m ChannelSourceMysql) MarshalJSON() (buff []byte, e error) { type MarshalTypeChannelSourceMysql ChannelSourceMysql s := struct { DiscriminatorParam string `json:"sourceType"` MarshalTypeChannelSourceMysql }{ "MYSQL", (MarshalTypeChannelSourceMysql)(m), } return json.Marshal(&s) } // UnmarshalJSON unmarshals from json func (m *ChannelSourceMysql) UnmarshalJSON(data []byte) (e error) { model := struct { SslCaCertificate cacertificate `json:"sslCaCertificate"` Hostname *string `json:"hostname"` Port *int `json:"port"` Username *string `json:"username"` SslMode ChannelSourceMysqlSslModeEnum `json:"sslMode"` }{} e = json.Unmarshal(data, &model) if e != nil { return } var nn interface{} nn, e = model.SslCaCertificate.UnmarshalPolymorphicJSON(model.SslCaCertificate.JsonData) if e != nil { return } if nn != nil { m.SslCaCertificate = nn.(CaCertificate) } else { m.SslCaCertificate = nil } m.Hostname = model.Hostname m.Port = model.Port m.Username = model.Username m.SslMode = model.SslMode return } // ChannelSourceMysqlSslModeEnum Enum with underlying type: string type ChannelSourceMysqlSslModeEnum string // Set of constants representing the allowable values for ChannelSourceMysqlSslModeEnum const ( ChannelSourceMysqlSslModeVerifyIdentity ChannelSourceMysqlSslModeEnum = "VERIFY_IDENTITY" ChannelSourceMysqlSslModeVerifyCa ChannelSourceMysqlSslModeEnum = "VERIFY_CA" ChannelSourceMysqlSslModeRequired ChannelSourceMysqlSslModeEnum = "REQUIRED" ChannelSourceMysqlSslModeDisabled ChannelSourceMysqlSslModeEnum = "DISABLED" ) var mappingChannelSourceMysqlSslModeEnum = map[string]ChannelSourceMysqlSslModeEnum{ "VERIFY_IDENTITY": ChannelSourceMysqlSslModeVerifyIdentity, "VERIFY_CA": ChannelSourceMysqlSslModeVerifyCa, "REQUIRED": ChannelSourceMysqlSslModeRequired, "DISABLED": ChannelSourceMysqlSslModeDisabled, } // GetChannelSourceMysqlSslModeEnumValues Enumerates the set of values for ChannelSourceMysqlSslModeEnum func GetChannelSourceMysqlSslModeEnumValues() []ChannelSourceMysqlSslModeEnum { values := make([]ChannelSourceMysqlSslModeEnum, 0) for _, v := range mappingChannelSourceMysqlSslModeEnum { values = append(values, v) } return values } // GetChannelSourceMysqlSslModeEnumStringValues Enumerates the set of values in String for ChannelSourceMysqlSslModeEnum func GetChannelSourceMysqlSslModeEnumStringValues() []string { return []string{ "VERIFY_IDENTITY", "VERIFY_CA", "REQUIRED", "DISABLED", } } // GetMappingChannelSourceMysqlSslModeEnum performs case Insensitive comparison on enum value and return the desired enum func GetMappingChannelSourceMysqlSslModeEnum(val string) (ChannelSourceMysqlSslModeEnum, bool) { mappingChannelSourceMysqlSslModeEnumIgnoreCase := make(map[string]ChannelSourceMysqlSslModeEnum) for k, v := range mappingChannelSourceMysqlSslModeEnum { mappingChannelSourceMysqlSslModeEnumIgnoreCase[strings.ToLower(k)] = v } enum, ok := mappingChannelSourceMysqlSslModeEnumIgnoreCase[strings.ToLower(val)] return enum, ok }
code-dot-org/code-dot-org
dashboard/lib/services/i18n/curriculum_sync_utils/render_translations.rb
<filename>dashboard/lib/services/i18n/curriculum_sync_utils/render_translations.rb require 'active_support/concern' module Services module I18n module CurriculumSyncUtils module RenderTranslations extend ActiveSupport::Concern class_methods do # Helper method for retrieving I18N strings generated by # CurriculumSyncUtils::SyncOut. Specifically, the logic in this # method is a reflection of the CrowdinSerializer indexing logic # (default to using `object.key` as the key, but support overriding # that for specific models), as well as the SyncOut reorganization # logic (strings are organized by model type, then by model # identifier, then by property name). # # Will default to the relevant English string when appropriate. def get_localized_property(object, property_name, key=nil) key = object.key if key.blank? unlocalized_property = object.send(property_name) return unlocalized_property if ::I18n.locale == ::I18n.default_locale return ::I18n.t( property_name, scope: [:data, object.model_name.plural, key], default: unlocalized_property, smart: true ) end end end end end end
tiefenauer/ip7-python
src/classifier/jobtitle/jobtitle_classifier_fts.py
import math from src.classifier.jobtitle.jobtitle_classifier import JobtitleClassifier from src.classifier.jobtitle.jobtitle_features_fts import JobtitleFtsFeatures from src.util.html_util import calculate_tag_weight from src.classifier.rule_based_classifier import RuleBasedClassifier from src.importer.known_job_variants import KnownJobVariants from src.util.jobtitle_util import count_variant def count_job_in_tags(tags, job_name_variants): return sum(count_job(tag, job_name_variants) for tag in tags) def count_job(tag, job_name_variants): return sum(count for (variant, count) in count_variants(tag.getText(), job_name_variants)) def count_variants(text, variants): """counts all occurrences of the job variants in a text string""" for variant in (variant for variant in variants if variant in text): count = count_variant(variant, text) if count > 0: yield (variant, count) known_job_variants = KnownJobVariants() def calculate_highest_tag(tags, variants): highest_tag = None min_weight = math.inf for variant in variants: for tag_index, tag in enumerate(tag for tag in tags if variant in tag.getText()): tag_weight = calculate_tag_weight(tag.name) if tag_weight < min_weight: min_weight = tag_weight highest_tag = tag return highest_tag def calculate_first_tag(tags, variants): for variant in variants: for tag_index, tag in enumerate(tags): if variant in tag.getText(): return tag_index class FeatureBasedJobtitleFtsClassifier(RuleBasedClassifier, JobtitleClassifier): """Predict a jobtitle by performing a full text search (FTS) on the processed data. The text of the processed data is searched for occurrences of known job names, including variants (such as male/female form, hyphenated forms etc...). The found results are then weighted according to the following criteria: - what HTML tag does the result appear in (h1 tags are considered more important than h2 tags and so on) - How often does the job title (including variants) appear in the DOM? Higher occurrence means higher probability that the result is the actual job title of the vacancy - in how many variants does the job title appear? """ def predict_class(self, tags): tags = list(tags) features_list = [] for job_name, variants in known_job_variants: job_name_count = count_job_in_tags(tags, variants) if job_name_count > 0: highest_tag = calculate_highest_tag(tags, variants) first_tag_index = calculate_first_tag(tags, variants) features = JobtitleFtsFeatures(job_name, highest_tag.name, first_tag_index, job_name_count) features_list.append(features) features_list = sorted(features_list) if len(features_list) > 0: best_match = sorted(features_list)[0] return best_match.job_name return None def title(self): return 'Jobtitle Classifier: FTS (html-tag-based)' def label(self): return 'jobtitle-fts-html-tags'
heeroluo/just4
packages/dom/dist/internal/dom-traversal.js
import { mergeArray } from "@just4/util/array"; import { isNode, ifIsHTMLElement, uniqueSort } from "./dom-base"; import { matchesSelector } from "../selector"; export function selfAndDescendants(ctx) { if (!ctx) { return []; } const node = ctx; if (node.nodeType !== 1 && node.nodeType !== 9 && node.nodeType !== 11) { return [ node ]; } const elem = node; return mergeArray([ elem ], elem.querySelectorAll("*")); } function filterBySelector(elems, selector) { return selector ? elems.filter((function(elem) { return matchesSelector(elem, selector); })) : elems; } function sortAndFilter(elems, position, selector) { if (!elems.length) { return elems; } uniqueSort(elems); if (position === "parentNode" || position === "previousElementSibling") { elems.reverse(); } return filterBySelector(elems, selector); } export function findElementsUntil(ctxNodes, position, until, filter) { let canMatch; if (typeof until === "string") { canMatch = function(elem) { return matchesSelector(elem, until); }; } else if (isNode(until)) { canMatch = function(elem) { return elem === until; }; } else if (Array.isArray(until)) { canMatch = function(elem) { return until.indexOf(elem) !== -1; }; } const result = []; ifIsHTMLElement(ctxNodes, (function(elem) { while (elem = elem[position]) { if (!canMatch || !canMatch(elem)) { result.push(elem); } else { break; } } })); return sortAndFilter(result, position, filter); } export function findElements(ctxNodes, position, filter, onlyFirst) { const result = []; ifIsHTMLElement(ctxNodes, (function(elem) { while (elem = elem[position]) { result.push(elem); if (onlyFirst) { break; } } })); return sortAndFilter(result, position, filter); } export function getChildren(ctxNodes, selector) { const result = []; ifIsHTMLElement(ctxNodes, (function(ctxElem) { let child = ctxElem.firstElementChild; while (child) { result.push(child); child = child.nextElementSibling; } })); uniqueSort(result); return filterBySelector(result, selector); } export function getSiblings(ctxNodes, selector) { const result = []; ifIsHTMLElement(ctxNodes, (function(elem) { let sibling = elem; while (sibling = sibling.previousElementSibling) { result.push(sibling); } sibling = elem; while (sibling = sibling.nextElementSibling) { result.push(sibling); } })); return filterBySelector(uniqueSort(result), selector); } export function getIndex(node) { const result = ifIsHTMLElement(node, (function(elem) { const parent = elem.parentElement; if (parent) { let child = parent.lastElementChild; let result = parent.childElementCount - 1; while (child && child !== elem) { result--; child = child.previousElementSibling; } return result; } })); return result == null ? -1 : result; }
fossabot/me-1
packages/printables/src/lib/assemblePrintable.js
<gh_stars>1-10 import path from "path"; export const assemblePrintable = printableBuilder => filePath => { const requiredFile = require(filePath); const printableJson = requiredFile.default || requiredFile; return printableBuilder(printableJson, path.basename(filePath, path.extname(filePath))); }; export default assemblePrintable;
Neyzoter/aiot
iov/src/main/java/cn/neyzoter/aiot/iov/biz/service/kafka/constant/KafkaTopic.java
package cn.neyzoter.aiot.iov.biz.service.kafka.constant; import org.apache.kafka.clients.admin.NewTopic; import org.springframework.context.annotation.Bean; import org.springframework.stereotype.Component; /** * kafka topic * @author <NAME> * @date 2020-2-8 */ @Component public class KafkaTopic { public final static String TOPIC_VEHICLE_HTTP_PACKET_NAME = "VehicleHttpPack"; @Bean /** * automatically add topics to the broker */ public NewTopic topicVehicleHttpPack () { // return new NewTopic(KafkaTopic.TOPIC_VEHICLE_HTTP_PACKET_NAME,3,(short)2); return new NewTopic(KafkaTopic.TOPIC_VEHICLE_HTTP_PACKET_NAME,1,(short)1); } }
ScalablyTyped/SlinkyTyped
m/microsoft-graph/src/main/scala/typingsSlinky/microsoftGraph/mod/Planner.scala
<gh_stars>10-100 package typingsSlinky.microsoftGraph.mod import org.scalablytyped.runtime.StObject import scala.scalajs.js import scala.scalajs.js.`|` import scala.scalajs.js.annotation.{JSGlobalScope, JSGlobal, JSImport, JSName, JSBracketAccess} @js.native trait Planner extends Entity { // Read-only. Nullable. Returns a collection of the specified buckets var buckets: js.UndefOr[NullableOption[js.Array[PlannerBucket]]] = js.native // Read-only. Nullable. Returns a collection of the specified plans var plans: js.UndefOr[NullableOption[js.Array[PlannerPlan]]] = js.native // Read-only. Nullable. Returns a collection of the specified tasks var tasks: js.UndefOr[NullableOption[js.Array[PlannerTask]]] = js.native } object Planner { @scala.inline def apply(): Planner = { val __obj = js.Dynamic.literal() __obj.asInstanceOf[Planner] } @scala.inline implicit class PlannerMutableBuilder[Self <: Planner] (val x: Self) extends AnyVal { @scala.inline def setBuckets(value: NullableOption[js.Array[PlannerBucket]]): Self = StObject.set(x, "buckets", value.asInstanceOf[js.Any]) @scala.inline def setBucketsNull: Self = StObject.set(x, "buckets", null) @scala.inline def setBucketsUndefined: Self = StObject.set(x, "buckets", js.undefined) @scala.inline def setBucketsVarargs(value: PlannerBucket*): Self = StObject.set(x, "buckets", js.Array(value :_*)) @scala.inline def setPlans(value: NullableOption[js.Array[PlannerPlan]]): Self = StObject.set(x, "plans", value.asInstanceOf[js.Any]) @scala.inline def setPlansNull: Self = StObject.set(x, "plans", null) @scala.inline def setPlansUndefined: Self = StObject.set(x, "plans", js.undefined) @scala.inline def setPlansVarargs(value: PlannerPlan*): Self = StObject.set(x, "plans", js.Array(value :_*)) @scala.inline def setTasks(value: NullableOption[js.Array[PlannerTask]]): Self = StObject.set(x, "tasks", value.asInstanceOf[js.Any]) @scala.inline def setTasksNull: Self = StObject.set(x, "tasks", null) @scala.inline def setTasksUndefined: Self = StObject.set(x, "tasks", js.undefined) @scala.inline def setTasksVarargs(value: PlannerTask*): Self = StObject.set(x, "tasks", js.Array(value :_*)) } }
MatsuiLin101/aprp
src/apps/comments/utils.py
<filename>src/apps/comments/utils.py def upload_location(instance, filename): model = instance.__class__ last_obj = model.objects.order_by("id").last() if last_obj: new_id = last_obj.id + 1 else: new_id = 1 return "comment/%s/%s" % (new_id, filename)
SergeyKashulin/nicescript
test/box.spec.js
<reponame>SergeyKashulin/nicescript let nice = require('../index.js')(); let chai = require('chai'); chai.use(require('chai-spies')); let expect = chai.expect; const { Box, is } = nice; describe("Box", function() { it("simple", function(){ let s = Box(); expect(is.Box(s)).to.equal(true); expect(s()).to.equal(nice.PENDING); expect(s(15)).to.equal(s); expect(s()).to.equal(15); }); it("default value", function(){ let s = Box(13); expect(is.Box(s)).to.equal(true); expect(s()).to.equal(13); expect(s(15)).to.equal(s); expect(s()).to.equal(15); }); it("listen", function(){ let a = Box(); let spy = chai.spy(); a.listen(v => spy(v)); expect(spy).to.not.have.been.called(); a(6); expect(spy).to.have.been.called.with(6); expect(a()).to.equal(6); }); it("listenDiff", function(){ let a = Box(); let spy = chai.spy(); a.listenDiff(v => spy(v)); expect(spy).to.not.have.been.called(); a(6); expect(spy).to.have.been.called.with({ add:6, del:nice.PENDING }); a(7); expect(spy).to.have.been.called.with({ add:7, del:6 }); }); it("listen 2 targets", function(){ let a = Box(); let spy1 = chai.spy(); let spy2 = chai.spy(); a.listen(v => spy1(v)); a.listen(spy2); expect(spy1).to.not.have.been.called(); expect(spy2).to.not.have.been.called(); a(6); expect(spy1).to.have.been.called.once.with(6); expect(spy2).to.have.been.called.once.with(6); expect(a()).to.equal(6); }); it("listenOnce on resolved", function(){ let a = Box(1); let spy = chai.spy(); a.listenOnce(v => spy(v)); expect(spy).to.have.been.called.once(); a(6); expect(spy).to.have.been.called.once.with(1); expect(a()).to.equal(6); }); it("listenOnce", function(){ let a = Box(); let spy = chai.spy(); a.listenOnce(v => spy(v)); expect(spy).to.not.have.been.called(); a(5); expect(spy).to.have.been.called.once(); a(6); expect(spy).to.have.been.called.once.with(5); expect(a()).to.equal(6); }); it("unsubscribe", function(){ let spy = chai.spy(); let a = Box(5); a.listen(spy); expect(spy).to.have.been.called.once(); a.unsubscribe(spy); a(2); expect(spy).to.have.been.called.once(); }); it("unsubscribe chain", function(){ let spy = chai.spy(); let a = Box(); let b = Box.use(a); let c = Box.use(b); expect(a._subscribers.length).to.equal(0); c.listen(spy); expect(b._subscribers.length).to.equal(1); expect(a._subscribers.length).to.equal(1); a(1); c.unsubscribe(spy); expect(b._subscribers.length).to.equal(0); expect(a._subscribers.length).to.equal(0); a(2); }); it("transaction", function(){ let a = Box(); let spy = chai.spy(); a.listen(spy); a.transaction(() => a(5)(6)); expect(spy).to.have.been.called.once(); expect(a()).to.equal(6); }); it("transactionRollback", function(){ let a = Box(4); let spy = chai.spy(); a.listen(spy); a.transactionStart(); a(5); expect(a()).to.equal(5); a.transactionRollback(); expect(spy).to.have.been.called.once(); expect(a()).to.equal(4); }); it("lock", function(){ let a = Box(5); a.lock(); expect(() => a(6)).to.throw(); expect(a()).to.equal(5); a.unlock(); expect(() => a(7)).not.to.throw(); expect(a()).to.equal(7); }); it("inputs", function(){ let square = Box() .Number('x', 5) .Number('y') .by((x, y) => x * y); let res; square.listen(v => res = v); expect(res).to.equal(undefined); square.y(5); expect(res).to.equal(25); square.x(10).y(2); expect(square.x()).to.equal(10); expect(res).to.equal(20); }); it("follow Box input", function(){ let square = Box() .Number('x', 5) .Number('y', 5) .by((x, y) => x * y); let a = Box(2); let b = Box(0); let res; square.listen(v => res = v); expect(res).to.equal(25); square.x.follow(a); expect(res).to.equal(10); a(3); expect(res).to.equal(15); square.x.follow(b); expect(res).to.equal(0); a(4); expect(res).to.equal(0); }); it("named input chain", function(){ let b = Box(); let b2 = Box.use(b).by(n => n * 2); let square = Box() .Number('x', 5) .by(x => x * x); square.x(b2); b(3); expect(square()).to.equal(36); }); it("resolve children 1", function(done){ nice.resolveChildren(nice.Array(1, 2), function (v) { expect(v()).to.deep.equal([1, 2]); done(); }); }); it("resolve children 2", function(done){ let a = Box(2); let b = Box.async(z => setTimeout(() => z(nice.Array(3, c)), 1)); let c = Box.async(z => setTimeout(() => z(4), 1)); nice.resolveChildren(nice.Array(1, a, b), function (v) { expect(v()).to.deep.equal([1, 2, [3, 4]]); done(); }); }); it("resolve children 3", function(done){ nice.resolveChildren({}, function (v) { expect(v).to.deep.equal({}); done(); }); }); it("values's transformation", function(){ let a = Box(2); let b = a.pow(2); expect(b._type).to.equal(Box); expect(b()()).to.equal(4); a(3); expect(b()()).to.equal(9); }); it("values's action", function(){ let a = Box(nice(2)); expect(a.negate()).to.equal(a); expect(a()()).to.equal(-2); }); it("single time", function(){ let f = z => { spy(); return 15; }; let spy = chai.spy(); let v = Box.by(f); expect(v()).to.equal(15); expect(spy).to.have.been.called.once(); }); it("use", function(){ let spy = chai.spy(); let a = Box(); let a2 = Box.use(a).by(a => a * 2); a2.listen(spy); expect(spy).not.to.have.been.called(); a(5); expect(spy).to.have.been.called.once.with(10); expect(a2()).to.equal(10); }); it("async", function(done){ Box .async(z => z.timeout(() => z(5), 1)) .listen(v => { expect(v).to.equal(5); done(); }); }); it("basic sync chain", function(){ let a = Box(9); let a2 = Box.use(a).by( v => v * 2 ); let spy = chai.spy(); a2.listen(spy); expect(spy).to.have.been.called.once().with(18); expect(a2()).to.equal(18); }); it("follow Promise", function(done){ let p = new Promise((resolve, reject) => resolve(3)); let b = Box.follow(p); b.listen(v => { expect(v).to.equal(3); expect(b()).to.equal(3); done(); }); }); it("get Promise", function(done){ let b = Box(); let p = b.getPromise(); p.then(v => { expect(v).to.equal(3); done(); }); b(3); }); it("Promise input", done => { let p = new Promise((resolve, reject) => resolve(3)); let b = Box.use(p).by( v => v * 2 ); b.listen(v => { expect(v).to.equal(6); expect(b()).to.equal(6); done(); }); }); });
kabellrics/tp-noderest
app/swagger/schemas/users.schemas.js
export const Token = { type: 'object', properties: { token: { type: 'string' } } }; export const User = { type: 'object', properties: { id: { type: 'integer', format: 'int64' }, firstname: { type: 'string' }, lastname: { type: 'string' }, email: { type: 'string' }, roles: { type: 'string' } } }; export const UserToCreate = { type: 'object', properties: { firstname: { type: 'string' }, lastname: { type: 'string' }, email: { type: 'string' }, password: { type: 'string' }, roles: { type: 'string' } } }; export const UserInformations = { type: 'object', properties: { id: { type: 'integer', format: 'int64' }, firstname: { type: 'string' }, lastname: { type: 'string' }, email: { type: 'string' } } }; export const UserPassword = { type: 'object', properties: { id: { type: 'integer', format: 'int64' }, password: { type: 'string' }, oldPassword: { type: 'string' } } };
fedlearn-jdt/fedlearn-core
core/src/main/java/com/jdt/fedlearn/core/App.java
<gh_stars>10-100 /* Copyright 2020 The FedLearn Authors. All Rights Reserved. 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 com.jdt.fedlearn.core; import org.apache.commons.cli.*; import java.util.Arrays; /** * 主函数,支持通过直接运行jar包进行模拟多方建模,ID对齐等过程 * 可以通过指定参数文件运行, * 也可以通过命令指定参数 * 还可以交互式运行 */ public class App { private static final String help = "usage help"; public static void main(String[] args) { //参数解析 CommandLineParser commandLineParser = new DefaultParser(); Options OPTIONS = new Options(); // help OPTIONS.addOption(Option.builder("h").longOpt("help").type(String.class).desc(help).build()); // config OPTIONS.addOption(Option.builder("c").longOpt("config").type(String.class).desc("location of the config file").build()); //当config加载或者解析报错时,直接打印报错信息,并退出 try { CommandLine commandLine = commandLineParser.parse(OPTIONS, args); System.out.println(Arrays.toString(commandLine.getArgs())); System.out.println(Arrays.toString(Arrays.stream(commandLine.getOptions()).map(Option::getLongOpt).toArray())); final boolean h = commandLine.getArgList().contains("h"); System.out.println("h: " + h); String configPath = commandLine.getOptionValue("config", ""); System.out.println("received:" + configPath); } catch (ParseException e) { System.out.println("config initial error:" + e.getMessage()); System.exit(-1); } } }
hamzaPixl/intnewscr
server/domain/models/errors/ApiError.js
class ApiError extends Error { constructor(message, error) { super(message || 'API error', error); this.name = 'ApiError'; return this; } } module.exports = ApiError;
palak-egov/DIGIT-UKD
municipal-services/noc-services/src/main/java/org/egov/noc/util/NOCConstants.java
<reponame>palak-egov/DIGIT-UKD package org.egov.noc.util; import org.springframework.stereotype.Component; @Component public class NOCConstants { public static final String SEARCH_MODULE = "rainmaker-nocsrv"; public static final String NOC_MODULE = "NOC"; public static final String NOC_TYPE = "NocType"; // mdms path codes public static final String NOC_JSONPATH_CODE = "$.MdmsRes.NOC"; // error constants public static final String INVALID_TENANT_ID_MDMS_KEY = "INVALID TENANTID"; public static final String INVALID_TENANT_ID_MDMS_MSG = "No data found for this tenentID"; public static final String APPROVED_STATE = "APPROVED"; public static final String AUTOAPPROVED_STATE = "AUTO_APPROVED"; public static final String ACTION_APPROVE = "APPROVE"; public static final String ACTION_AUTO_APPROVE="AUTO_APPROVE"; public static final String MODE = "mode"; public static final String ONLINE_MODE = "online"; public static final String OFFLINE_MODE = "offline"; public static final String ONLINE_WF = "onlineWF"; public static final String OFFLINE_WF = "offlineWF"; public static final String ACTION_REJECT = "REJECT"; public static final String WORKFLOWCODE = "workflowCode"; public static final String NOCTYPE_JSONPATH_CODE = "$.MdmsRes.NOC.NocType"; public static final String NOC_DOC_TYPE_MAPPING = "DocumentTypeMapping"; public static final String DOCUMENT_TYPE = "DocumentType"; public static final String COMMON_MASTERS_MODULE = "common-masters"; public static final String COMMON_MASTER_JSONPATH_CODE = "$.MdmsRes.common-masters"; public static final String CREATED_STATUS = "CREATED"; public static final String ACTION_VOID = "VOID"; public static final String VOIDED_STATUS = "VOIDED"; public static final String ACTION_INITIATE = "INITIATE"; public static final String INITIATED_TIME = "SubmittedOn"; //sms notification public static final String ACTION_STATUS_CREATED = "null_CREATED"; public static final String ACTION_STATUS_INITIATED = "INITIATE_INPROGRESS"; public static final String ACTION_STATUS_REJECTED = "REJECT_REJECTED"; public static final String ACTION_STATUS_APPROVED = "APPROVE_APPROVED"; public static final String FIRE_NOC_TYPE = "FIRE_NOC"; public static final String AIRPORT_NOC_TYPE = "AIRPORT_AUTHORITY"; }
CognitiveScale/cortex-cli
src/client/experiments.js
<filename>src/client/experiments.js /* * Copyright 2020 Cognitive Scale, Inc. All Rights Reserved. * * 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. */ const fs = require('fs'); const stream = require('stream'); const { promisify } = require('util'); const pipeline = promisify(stream.pipeline); const debug = require('debug')('cortex:cli'); const { got } = require('./apiutils'); const { constructError, getUserAgent, checkProject } = require('../commands/utils'); const Content = require('./content'); module.exports = class Experiments { constructor(cortexUrl) { this.cortexUrl = cortexUrl; this.endpoint = (projectId) => `${cortexUrl}/fabric/v4/projects/${projectId}/experiments`; } listExperiments(projectId, modelId, token) { checkProject(projectId); const endpoint = `${this.endpoint(projectId)}?${modelId ? `modelId=${modelId}` : ''}`; debug('listExperiments() => %s', endpoint); return got .get(endpoint, { headers: { Authorization: `Bearer ${token}` }, 'user-agent': getUserAgent(), }).json() .then((result) => ({ success: true, result })) .catch((err) => constructError(err)); } describeExperiment(projectId, token, name) { checkProject(projectId); const endpoint = `${this.endpoint(projectId)}/${encodeURIComponent(name)}`; debug('describeExperiment(%s) => %s', name, endpoint); return got .get(endpoint, { headers: { Authorization: `Bearer ${token}` }, 'user-agent': getUserAgent(), }).json() .then((result) => ({ success: true, result })) .catch((err) => constructError(err)); } deleteExperiment(projectId, token, name) { checkProject(projectId); const endpoint = `${this.endpoint(projectId)}/${encodeURIComponent(name)}`; debug('deleteExperiment(%s) => %s', name, endpoint); return got .delete(endpoint, { headers: { Authorization: `Bearer ${token}` }, 'user-agent': getUserAgent(), }).json() .then((result) => ({ success: true, result })) .catch((err) => constructError(err)); } listRuns(projectId, token, experimentName, filter, limit, sort) { checkProject(projectId); const endpoint = `${this.endpoint(projectId)}/${encodeURIComponent(experimentName)}/runs`; debug('listRuns(%s) => %s', experimentName, endpoint); const query = {}; if (filter) query.filter = filter; if (limit) query.limit = limit; if (sort) query.sort = sort; return got .get(endpoint, { headers: { Authorization: `Bearer ${token}` }, 'user-agent': getUserAgent(), searchParams: query, }).json() .then((result) => ({ success: true, result })) .catch((err) => constructError(err)); } describeRun(projectId, token, experimentName, runId) { checkProject(projectId); const endpoint = `${this.endpoint(projectId)}/${encodeURIComponent(experimentName)}/runs/${runId}`; debug('describeRun(%s) => %s', runId, endpoint); return got .get(endpoint, { headers: { Authorization: `Bearer ${token}` }, 'user-agent': getUserAgent(), }).json() .then((result) => ({ success: true, result })) .catch((err) => constructError(err)); } deleteRun(projectId, token, experimentName, runId) { checkProject(projectId); const endpoint = `${this.endpoint(projectId)}/${encodeURIComponent(experimentName)}/runs/${runId}`; debug('deleteRun(%s, %s) => %s', experimentName, runId, endpoint); return got .delete(endpoint, { headers: { Authorization: `Bearer ${token}` }, 'user-agent': getUserAgent(), }).json() .then((result) => ({ success: true, result })) .catch((err) => constructError(err)); } _artifactKey(experimentName, runId, artifact) { return `experiments/${experimentName}/${runId}/artifacts/${artifact}`; } // eslint-disable-next-line no-unused-vars async downloadArtifact(projectId, token, experimentName, runId, artifactName, showProgress = false) { checkProject(projectId); try { // Check if run exists.. await this.describeRun(projectId, token, experimentName, runId); // just generate the key and avoid hop to managed content.. const key = this._artifactKey(experimentName, runId, artifactName); const cont = new Content(this.cortexUrl); return cont.downloadContent(projectId, token, key, showProgress); } catch (err) { return constructError(err); } } saveExperiment(projectId, token, experimentObj) { checkProject(projectId); const endpoint = `${this.endpoint(projectId)}`; debug('saveExperiment(%s) => %s', experimentObj.name, endpoint); return got .post(endpoint, { headers: { Authorization: `Bearer ${token}` }, 'user-agent': getUserAgent(), json: experimentObj, }).json() .then((result) => ({ success: true, result })) .catch((err) => constructError(err)); } createRun(projectId, token, runObj) { checkProject(projectId); const endpoint = `${this.endpoint(projectId)}/${encodeURIComponent(runObj.experimentName)}/runs`; debug('createRun(%s) => %s', runObj.experimentName, endpoint); return got .post(endpoint, { headers: { Authorization: `Bearer ${token}` }, 'user-agent': getUserAgent(), json: runObj, }).json() .then((result) => ({ success: true, result })) .catch((err) => constructError(err)); } async uploadArtifact(projectId, token, experimentName, runId, content, artifact, contentType = 'application/octet-stream') { checkProject(projectId); const endpoint = `${this.endpoint(projectId)}/${encodeURIComponent(experimentName)}/runs/${encodeURIComponent(runId)}/artifacts/${artifact}`; debug('uploadArtifact(%s, %s) => %s', artifact, content, endpoint); try { const message = await pipeline( fs.createReadStream(content), got.stream.put(endpoint, { headers: { Authorization: `Bearer ${token}`, 'Content-Type': contentType, }, 'user-agent': getUserAgent(), }), ); return { success: true, message }; } catch (err) { return constructError(err); } } };
Guardwu2015/w-leetcode
math/3sum-closest/threeSumClosest.js
<reponame>Guardwu2015/w-leetcode<filename>math/3sum-closest/threeSumClosest.js /** * 思路:双指针 * @param {number[]} nums * @param {number} target * @return {number} */ const threeSumClosest = function (nums, target) { nums.sort((a, b) => a - b) const n = nums.length; let best = Number.MAX_SAFE_INTEGER for (let i = 0; i < n; ++i) { if (i > 0 && nums[i] === nums[i - 1]) { continue } let j = i + 1, k = n - 1 while (j < k) { const sum = nums[i] + nums[j] + nums[k]; if (sum == target) { return target } if (Math.abs(sum - target) < Math.abs(best - target)) { best = sum } if (sum > target) { let k0 = k - 1 while (j < k0 && nums[k0] === nums[k]) { --k0 } k = k0 } else { let j0 = j + 1 while (j0 < k && nums[j0] === nums[j]) { ++j0 } j = j0 } } } return best } export default threeSumClosest
cellog/unlock
paywall/src/components/interface/GlobalErrorConsumer.js
import React from 'react' import PropTypes from 'prop-types' import { GlobalErrorContext } from '../../utils/GlobalErrorProvider' import { mapErrorToComponent } from '../creator/FatalError' const Consumer = GlobalErrorContext.Consumer export const displayError = (error, errorMetadata, children) => { if (error) { const Error = mapErrorToComponent(error, errorMetadata) return <React.Fragment>{Error}</React.Fragment> // note: this is different from the main repo } return <React.Fragment>{children}</React.Fragment> } export default function GlobalErrorConsumer({ displayError, children }) { return ( <Consumer> {({ error, errorMetadata }) => { return displayError(error, errorMetadata, children) }} </Consumer> ) } GlobalErrorConsumer.propTypes = { children: PropTypes.node.isRequired, displayError: PropTypes.func, } GlobalErrorConsumer.defaultProps = { displayError, }
shengren/magma-1.6.1
testing/testing_sgeqrf_batched.cpp
<reponame>shengren/magma-1.6.1<gh_stars>0 /* -- MAGMA (version 1.6.1) -- Univ. of Tennessee, Knoxville Univ. of California, Berkeley Univ. of Colorado, Denver @date January 2015 @author <NAME> @author <NAME> @generated from testing_zgeqrf_batched.cpp normal z -> s, Fri Jan 30 19:00:26 2015 */ // includes, system #include <stdlib.h> #include <stdio.h> #include <string.h> #include <math.h> // includes, project #include "flops.h" #include "magma.h" #include "magma_lapack.h" #include "testings.h" #include "batched_kernel_param.h" void get_QR_error(magma_int_t M, magma_int_t N, magma_int_t min_mn, float *h_R, float *h_A, magma_int_t lda, float *tau, float *Q, magma_int_t ldq, float *R, magma_int_t ldr, float *h_work, magma_int_t lwork, float *work, float *error, float *error2) { /* h_R:input the factorized matrix by lapack QR, h_A:input the original matrix copy tau: input */ const float d_neg_one = MAGMA_D_NEG_ONE; const float d_one = MAGMA_D_ONE; const float c_neg_one = MAGMA_S_NEG_ONE; const float c_one = MAGMA_S_ONE; const float c_zero = MAGMA_S_ZERO; float Anorm; magma_int_t info; // generate M by K matrix Q, where K = min(M,N) lapackf77_slacpy( "Lower", &M, &min_mn, h_R, &lda, Q, &ldq ); lapackf77_sorgqr( &M, &min_mn, &min_mn, Q, &ldq, tau, h_work, &lwork, &info ); assert( info == 0 ); // copy K by N matrix R lapackf77_slaset( "Lower", &min_mn, &N, &c_zero, &c_zero, R, &ldr ); lapackf77_slacpy( "Upper", &min_mn, &N, h_R, &lda, R, &ldr ); // error = || R - Q^H*A || / (N * ||A||) blasf77_sgemm( "Conj", "NoTrans", &min_mn, &N, &M, &c_neg_one, Q, &ldq, h_A, &lda, &c_one, R, &ldr ); Anorm = lapackf77_slange( "1", &M, &N, h_A, &lda, work ); *error = lapackf77_slange( "1", &min_mn, &N, R, &ldr, work ); if ( N > 0 && Anorm > 0 ) *error /= (N*Anorm); // set R = I (K by K identity), then R = I - Q^H*Q // error = || I - Q^H*Q || / N lapackf77_slaset( "Upper", &min_mn, &min_mn, &c_zero, &c_one, R, &ldr ); blasf77_ssyrk( "Upper", "Conj", &min_mn, &M, &d_neg_one, Q, &ldq, &d_one, R, &ldr ); *error2 = lapackf77_slansy( "1", "Upper", &min_mn, R, &ldr, work ); if ( N > 0 ) *error2 /= N; } /* //////////////////////////////////////////////////////////////////////////// -- Testing sgeqrf_batched */ int main( int argc, char** argv) { TESTING_INIT(); real_Double_t gflops, magma_perf, magma_time, cublas_perf, cublas_time, cpu_perf, cpu_time; float magma_error=0.0, cublas_error=0.0, magma_error2=0.0, cublas_error2=0.0, error, error2; float *h_A, *h_R, *h_Amagma, *tau, *h_work, tmp[1]; float *d_A, *dtau_magma, *dtau_cublas; float **dA_array = NULL; float **dtau_array = NULL; magma_int_t *dinfo_magma, *dinfo_cublas; magma_int_t M, N, lda, ldda, lwork, n2, info, min_mn; magma_int_t ione = 1; magma_int_t ISEED[4] = {0,0,0,1}; magma_int_t status = 0; magma_int_t batchCount = 1; magma_int_t column; magma_opts opts; parse_opts( argc, argv, &opts ); batchCount = opts.batchcount ; float tol = opts.tolerance * lapackf77_slamch("E"); magma_queue_t stream[2]; magma_queue_create( &stream[0] ); magma_queue_create( &stream[1] ); printf(" M N CPU GFlop/s (sec) GPU GFlop/s (sec) |R - Q^H*A| |I - Q^H*Q|\n"); printf("BatchCount M N MAGMA GFlop/s (ms) CUBLAS GFlop/s (ms) CPU GFlop/s (ms) |R - Q^H*A|_mag |I - Q^H*Q|_mag |R - Q^H*A|_cub |I - Q^H*Q|_cub \n"); printf("============================================================================================================================================================= \n"); for( int itest = 0; itest < opts.ntest; ++itest ) { for( int iter = 0; iter < opts.niter; ++iter ) { M = opts.msize[itest]; N = opts.nsize[itest]; min_mn = min(M, N); lda = M; n2 = lda*N * batchCount; ldda = M; ldda = ((M+31)/32)*32; gflops = (FLOPS_SGEQRF( M, N ) + FLOPS_SGEQRT( M, N )) / 1e9 * batchCount; /* Allocate memory for the matrix */ TESTING_MALLOC_CPU( tau, float, min_mn * batchCount ); TESTING_MALLOC_CPU( h_A, float, n2 ); TESTING_MALLOC_CPU( h_Amagma, float, n2 ); TESTING_MALLOC_PIN( h_R, float, n2 ); TESTING_MALLOC_DEV( d_A, float, ldda*N * batchCount ); TESTING_MALLOC_DEV( dtau_magma, float, min_mn * batchCount); TESTING_MALLOC_DEV( dtau_cublas, float, min_mn * batchCount); TESTING_MALLOC_DEV( dinfo_magma, magma_int_t, batchCount); TESTING_MALLOC_DEV( dinfo_cublas, magma_int_t, batchCount); magma_malloc((void**)&dA_array, batchCount * sizeof(*dA_array)); magma_malloc((void**)&dtau_array, batchCount * sizeof(*dtau_array)); // to determine the size of lwork lwork = -1; lapackf77_sgeqrf(&M, &N, NULL, &M, NULL, tmp, &lwork, &info); lwork = (magma_int_t)MAGMA_S_REAL( tmp[0] ); lwork = max(lwork, N*N); TESTING_MALLOC_CPU( h_work, float, lwork * batchCount); column = N * batchCount; /* Initialize the matrix */ lapackf77_slarnv( &ione, ISEED, &n2, h_A ); lapackf77_slacpy( MagmaUpperLowerStr, &M, &column, h_A, &lda, h_R, &lda ); /* ==================================================================== Performs operation using MAGMA =================================================================== */ magma_ssetmatrix( M, column, h_R, lda, d_A, ldda ); sset_pointer(dA_array, d_A, 1, 0, 0, ldda*N, batchCount, magma_stream); sset_pointer(dtau_array, dtau_magma, 1, 0, 0, min_mn, batchCount, magma_stream); magma_time = magma_sync_wtime(0); info = magma_sgeqrf_batched(M, N, dA_array, ldda, dtau_array, dinfo_magma, batchCount, magma_stream); magma_time = magma_sync_wtime(0) - magma_time; magma_perf = gflops / magma_time; magma_sgetmatrix( M, column, d_A, ldda, h_Amagma, lda); if (info != 0) printf("magma_sgeqrf_batched returned error %d: %s.\n", (int) info, magma_strerror( info )); /* ==================================================================== Performs operation using CUBLAS =================================================================== */ /* This routine is only available from CUBLAS v6.5 */ magma_ssetmatrix( M, column, h_R, lda, d_A, ldda ); sset_pointer(dA_array, d_A, 1, 0, 0, ldda*N, batchCount, magma_stream); sset_pointer(dtau_array, dtau_cublas, 1, 0, 0, min_mn, batchCount, magma_stream); cublas_time = magma_sync_wtime(0); int cublas_info; // int, not magma_int_t cublasSgeqrfBatched(opts.handle, M, N, dA_array, ldda, dtau_array, &cublas_info, batchCount); cublas_time = magma_sync_wtime(0) - cublas_time; cublas_perf = gflops / cublas_time; if (cublas_info != 0) printf("cublasSgeqrfBatched returned error %d: %s.\n", (int) cublas_info, magma_strerror( cublas_info )); /* ===================================================================== Performs operation using LAPACK =================================================================== */ if ( opts.check ) { cpu_time = magma_wtime(); for(int i=0; i<batchCount; i++) { lapackf77_sgeqrf(&M, &N, h_A + i*lda*N, &lda, tau + i*min_mn, h_work + i * lwork, &lwork, &info); /* lapackf77_slarft( MagmaForwardStr, MagmaColumnwiseStr, &M, &N, h_A + i*lda*N, &lda, tau + i*min_mn, h_work + i * lwork, &N); */ } cpu_time = magma_wtime() - cpu_time; cpu_perf = gflops / cpu_time; if (info != 0) printf("lapackf77_sgeqrf returned error %d: %s.\n", (int) info, magma_strerror( info )); /* ===================================================================== Check the MAGMA CUBLAS result compared to LAPACK =================================================================== */ magma_int_t ldq = M; magma_int_t ldr = min_mn; float *Q, *R; float *work; TESTING_MALLOC_CPU( Q, float, ldq*min_mn ); // M by K TESTING_MALLOC_CPU( R, float, ldr*N ); // K by N TESTING_MALLOC_CPU( work, float, min_mn ); /* check magma result */ magma_sgetvector(min_mn*batchCount, dtau_magma, 1, tau, 1); for(int i=0; i<batchCount; i++) { get_QR_error(M, N, min_mn, h_Amagma + i*lda*N, h_R + i*lda*N, lda, tau + i*min_mn, Q, ldq, R, ldr, h_work, lwork, work, &error, &error2); if ( isnan(error) || isinf(error) ) { magma_error = error; break; } magma_error = max(fabs(error),magma_error); magma_error2 = max(fabs(error2),magma_error2); } /* check cublas result */ magma_sgetvector(min_mn*batchCount, dtau_magma, 1, tau, 1); magma_sgetmatrix( M, column, d_A, ldda, h_A, lda); for(int i=0; i<batchCount; i++) { get_QR_error(M, N, min_mn, h_A + i*lda*N, h_R + i*lda*N, lda, tau + i*min_mn, Q, ldq, R, ldr, h_work, lwork, work, &error, &error2); if ( isnan(error) || isinf(error) ) { cublas_error = error; break; } cublas_error = max(fabs(error),cublas_error); cublas_error2 = max(fabs(error2),cublas_error2); } TESTING_FREE_CPU( Q ); Q = NULL; TESTING_FREE_CPU( R ); R = NULL; TESTING_FREE_CPU( work ); work = NULL; bool okay_mag = (magma_error < tol && magma_error2 < tol); bool okay_cub = (cublas_error < tol && cublas_error2 < tol); status += ! okay_mag; printf("%5d %5d %5d %7.2f (%7.2f) %7.2f (%7.2f) %7.2f (%7.2f) %15.2e %15.2e %15.2e %15.2e %s %s \n", (int)batchCount, (int) M, (int) N, magma_perf, 1000.*magma_time, cublas_perf, 1000.*cublas_time, cpu_perf, 1000.*cpu_time, magma_error, magma_error2, cublas_error, cublas_error2, (okay_mag ? "ok" : "failed"), " " ); status += ! (magma_error < tol); } else { printf("%5d %5d %5d %7.2f (%7.2f) %7.2f (%7.2f) --- ( --- ) --- \n", (int)batchCount, (int) M, (int) N, magma_perf, 1000.*magma_time, cublas_perf, 1000.*cublas_time); } TESTING_FREE_CPU( tau ); TESTING_FREE_CPU( h_A ); TESTING_FREE_CPU( h_Amagma); TESTING_FREE_CPU( h_work ); TESTING_FREE_PIN( h_R ); TESTING_FREE_DEV( d_A ); TESTING_FREE_DEV( dtau_magma ); TESTING_FREE_DEV( dtau_cublas ); TESTING_FREE_DEV( dinfo_magma ); TESTING_FREE_DEV( dinfo_cublas ); TESTING_FREE_DEV( dA_array ); TESTING_FREE_DEV( dtau_array ); fflush( stdout ); } if ( opts.niter > 1 ) { printf( "\n" ); } } magma_queue_destroy( stream[0] ); magma_queue_destroy( stream[1] ); TESTING_FINALIZE(); return status; }
Kisensum/dnp3
dotnet/bindings/CLRAdapter/src/SessionAcceptorAdapter.cpp
<filename>dotnet/bindings/CLRAdapter/src/SessionAcceptorAdapter.cpp #include "SessionAcceptorAdapter.h" #include "Conversions.h" #include "SOEHandlerAdapter.h" #include "MasterApplicationAdapter.h" #include "MasterSessionAdapter.h" namespace Automatak { namespace DNP3 { namespace Adapter { SessionAcceptorAdapter::SessionAcceptorAdapter(asiodnp3::ISessionAcceptor& proxy) : proxy(&proxy) {} IMasterSession^ SessionAcceptorAdapter::AcceptSession( System::String^ loggerid, ISOEHandler^ SOEHandler, IMasterApplication^ application, MasterStackConfig^ config ) { auto id = Conversions::ConvertString(loggerid); auto mconfig = Conversions::ConvertConfig(config); auto handler = std::shared_ptr<SOEHandlerAdapter>(new SOEHandlerAdapter(SOEHandler)); auto app = std::shared_ptr<MasterApplicationAdapter<opendnp3::IMasterApplication>>( new MasterApplicationAdapter<opendnp3::IMasterApplication>(application) ); auto session = proxy->AcceptSession(id, handler, app, mconfig); if (!session) { return nullptr; } return gcnew MasterSessionAdapter(session); } }}}
lshowbiz/agnt_ht
src/web/com/joymain/jecs/bd/webapp/action/JbdYdRebateAllotFiController.java
package com.joymain.jecs.bd.webapp.action; import java.util.ArrayList; import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.mvc.Controller; import yspay.util.StringUtil; import com.joymain.jecs.bd.model.JbdYdRebateList; import com.joymain.jecs.bd.service.JbdYdRebateListManager; import com.joymain.jecs.sys.model.SysUser; import com.joymain.jecs.util.data.CommonRecord; import com.joymain.jecs.util.data.Pager; import com.joymain.jecs.util.web.RequestUtil; import com.joymain.jecs.webapp.action.BaseController; import com.joymain.jecs.webapp.util.SessionLogin; public class JbdYdRebateAllotFiController extends BaseController implements Controller{ private final Log log = LogFactory.getLog(JbdYdRebateAllotFiController.class); private JbdYdRebateListManager jbdYdRebateListManager = null; public void setJbdYdRebateListManager( JbdYdRebateListManager jbdYdRebateListManager) { this.jbdYdRebateListManager = jbdYdRebateListManager; } public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception { if (log.isDebugEnabled()) { log.debug("entering 'handleRequest' method..."); } String companyCode=""; final SysUser defSysUser = SessionLogin.getLoginUser(request); if("C".equals(defSysUser.getUserType())){ companyCode=defSysUser.getCompanyCode(); if("AA".equals(defSysUser.getCompanyCode())){ companyCode = request.getParameter("company"); } } CommonRecord crm=RequestUtil.toCommonRecord(request); Pager pager = new Pager("JbdJdRecordAllotFiListTable",request, 0); crm.addField("freezeStatus", "0"); crm.addField("sendStatus", "0"); String userCode = request.getParameter("userCode"); String startCalcTime = request.getParameter("startCalcTime"); String endCalcTime = request.getParameter("endCalcTime"); List errorList=new ArrayList(); List jbdJdRecordLists =new ArrayList(); if ("post".equalsIgnoreCase(request.getMethod()) &&"jbdYdRebateAllotFiAll".equals(request.getParameter("strAction"))) { jbdJdRecordLists = jbdYdRebateListManager.getJbdYdRebateListsByCrm(crm, pager); for (int i = 0; i < jbdJdRecordLists.size(); i++) { JbdYdRebateList jbdYdRebateList=(JbdYdRebateList) jbdJdRecordLists.get(i); String id=jbdYdRebateList.getId().toString(); jbdYdRebateListManager.saveInJdFiBook(defSysUser, id); } this.saveMessage(request, "执行完成"); } if((!StringUtil.isEmpty(userCode))||(!StringUtil.isEmpty(startCalcTime))||(!StringUtil.isEmpty(endCalcTime))){ jbdJdRecordLists = jbdYdRebateListManager.getJbdYdRebateListsByCrm(crm, pager); } request.setAttribute("JbdYdRebateListAllotFiListTable_totalRows", pager.getTotalObjects()); return new ModelAndView("bd/jbdYdRebateAllotFi", "jbdYdRebateLists", jbdJdRecordLists); } }
dcat52/interop
server/auvsi_suas/models/stationary_obstacle_test.py
<filename>server/auvsi_suas/models/stationary_obstacle_test.py """Tests for the stationary_obstacle module.""" from auvsi_suas.models.aerial_position import AerialPosition from auvsi_suas.models.gps_position import GpsPosition from auvsi_suas.models.stationary_obstacle import StationaryObstacle from auvsi_suas.models.uas_telemetry import UasTelemetry from django.contrib.auth.models import User from django.test import TestCase from auvsi_suas.models import distance from datetime import timedelta class TestStationaryObstacleModel(TestCase): """Tests the StationaryObstacle model.""" def setUp(self): self.user = User.objects.create_user('testuser', '<EMAIL>', 'testpass') self.user.save() def test_unicode(self): """Tests the unicode method executes.""" pos = GpsPosition(latitude=100, longitude=200) pos.save() obst = StationaryObstacle( gps_position=pos, cylinder_radius=10, cylinder_height=100) obst.save() self.assertTrue(obst.__unicode__()) def create_uas_logs(self, user, entries): """Create a list of uas telemetry logs. Args: user: User to create logs for. entries: List of (lat, lon, alt) tuples for each entry. Returns: List of UasTelemetry objects """ ret = [] for i in range(len(entries)): lat, lon, alt = entries[i] pos = GpsPosition() pos.latitude = lat pos.longitude = lon pos.save() apos = AerialPosition() apos.altitude_msl = alt apos.gps_position = pos apos.save() log = UasTelemetry() log.user = user log.uas_position = apos log.uas_heading = 0 if i > 0: log.timetamp = ret[i - 1].timestamp + timedelta(seconds=1) log.save() ret.append(log) return ret def test_contains_pos(self): """Tests the inside obstacle method.""" # (lat, lon, rad, height) TESTDATA_STATOBST_CONTAINSPOS_OBJ = (-76, 38, 100, 200) # (lat, lon, alt) TESTDATA_STATOBST_CONTAINSPOS_INSIDE = [ (-76, 38, 0), (-76, 38, -1), (-76, 38, 200), (-76.0002, 38, 100), (-76, 38.0003, 100) ] # yapf: disable TESTDATA_STATOBST_CONTAINSPOS_OUTSIDE = [ (-76, 38, 201), (-76.0003, 38, 100), (-76, 38.004, 100) ] # yapf: disable # Form the test obstacle pos = GpsPosition( latitude=TESTDATA_STATOBST_CONTAINSPOS_OBJ[0], longitude=TESTDATA_STATOBST_CONTAINSPOS_OBJ[1]) pos.save() obst = StationaryObstacle( gps_position=pos, cylinder_radius=TESTDATA_STATOBST_CONTAINSPOS_OBJ[2], cylinder_height=TESTDATA_STATOBST_CONTAINSPOS_OBJ[3]) # Run test points against obstacle test_data = [(TESTDATA_STATOBST_CONTAINSPOS_INSIDE, True), (TESTDATA_STATOBST_CONTAINSPOS_OUTSIDE, False)] for (cur_data, cur_contains) in test_data: for (lat, lon, alt) in cur_data: pos = GpsPosition(latitude=lat, longitude=lon) pos.save() apos = AerialPosition(gps_position=pos, altitude_msl=alt) self.assertEqual(obst.contains_pos(apos), cur_contains) def test_evaluate_collision_with_uas(self): """Tests the collision with UAS method.""" TESTDATA_STATOBST_EVALCOLLISION = ( # Cylinder position (-76, 38, 100, 100), # Inside positions [(-76, 38, 50), (-76, 38, 0), (-76, 38, 100), (-76.0001, 38.0001, 0), (-76.0001, 38.0001, 100)], # Outside positions [(-76.001, 38, 50), (-76, 38.002, 150), (-76, 38, 150), (-76, 38, 101)] ) # yapf: disable (cyl_details, inside_pos, outside_pos) = TESTDATA_STATOBST_EVALCOLLISION (cyl_lat, cyl_lon, cyl_height, cyl_rad) = cyl_details gpos = GpsPosition(latitude=cyl_lat, longitude=cyl_lon) gpos.save() obst = StationaryObstacle( gps_position=gpos, cylinder_radius=cyl_rad, cylinder_height=cyl_height) obst.save() inside_logs = [] outside_logs = [] logs_to_create = [(inside_pos, inside_logs), (outside_pos, outside_logs)] for (positions, log_list) in logs_to_create: log_list += self.create_uas_logs(self.user, positions) # Assert collisions correctly evaluated collisions = [(inside_logs, True), (outside_logs, False)] for (log_list, inside) in collisions: self.assertEqual( obst.evaluate_collision_with_uas(log_list), inside) for log in log_list: self.assertEqual( obst.evaluate_collision_with_uas([log]), inside) # Regression test past failed case. pos = GpsPosition(latitude=45.4342114, longitude=-71.8538153) pos.save() obst = StationaryObstacle( gps_position=pos, cylinder_radius=10.0, cylinder_height=1300.0) logs = self.create_uas_logs(self.user, [ (45.433839, -71.8523434, 770.013137988), (45.4338393, -71.8523446, 769.881926415), ]) self.assertFalse(obst.evaluate_collision_with_uas(logs)) def test_json(self): """Tests the JSON serialization method.""" TEST_LAT = 100.10 TEST_LONG = 200.20 TEST_RADIUS = 150.50 TEST_HEIGHT = 75.30 gpos = GpsPosition(latitude=TEST_LAT, longitude=TEST_LONG) gpos.save() obstacle = StationaryObstacle( gps_position=gpos, cylinder_radius=TEST_RADIUS, cylinder_height=TEST_HEIGHT) json_data = obstacle.json() self.assertTrue('latitude' in json_data) self.assertEqual(json_data['latitude'], TEST_LAT) self.assertTrue('longitude' in json_data) self.assertEqual(json_data['longitude'], TEST_LONG) self.assertTrue('cylinder_radius' in json_data) self.assertEqual(json_data['cylinder_radius'], TEST_RADIUS) self.assertTrue('cylinder_height' in json_data) self.assertEqual(json_data['cylinder_height'], TEST_HEIGHT)
ironMann/ucx
src/uct/rocm/ipc/rocm_ipc_iface.c
/* * Copyright (C) Advanced Micro Devices, Inc. 2019. ALL RIGHTS RESERVED. * Copyright (C) Mellanox Technologies Ltd. 2020. ALL RIGHTS RESERVED. * See file LICENSE for terms. */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "rocm_ipc_iface.h" #include "rocm_ipc_md.h" #include "rocm_ipc_ep.h" #include <uct/rocm/base/rocm_base.h> #include <ucs/arch/cpu.h> #include <ucs/type/class.h> #include <ucs/sys/string.h> static ucs_config_field_t uct_rocm_ipc_iface_config_table[] = { {"", "", NULL, ucs_offsetof(uct_rocm_ipc_iface_config_t, super), UCS_CONFIG_TYPE_TABLE(uct_iface_config_table)}, {NULL} }; static uint64_t uct_rocm_ipc_iface_node_guid(uct_base_iface_t *iface) { return ucs_machine_guid() * ucs_string_to_id(iface->md->component->name); } ucs_status_t uct_rocm_ipc_iface_get_device_address(uct_iface_t *tl_iface, uct_device_addr_t *addr) { uct_base_iface_t *iface = ucs_derived_of(tl_iface, uct_base_iface_t); *(uint64_t*)addr = uct_rocm_ipc_iface_node_guid(iface); return UCS_OK; } static ucs_status_t uct_rocm_ipc_iface_get_address(uct_iface_h tl_iface, uct_iface_addr_t *iface_addr) { *(pid_t*)iface_addr = getpid(); return UCS_OK; } static int uct_rocm_ipc_iface_is_reachable(const uct_iface_h tl_iface, const uct_device_addr_t *dev_addr, const uct_iface_addr_t *iface_addr) { uct_rocm_ipc_iface_t *iface = ucs_derived_of(tl_iface, uct_rocm_ipc_iface_t); return ((uct_rocm_ipc_iface_node_guid(&iface->super) == *((const uint64_t *)dev_addr)) && ((getpid() != *(pid_t *)iface_addr))); } static ucs_status_t uct_rocm_ipc_iface_query(uct_iface_h tl_iface, uct_iface_attr_t *iface_attr) { uct_rocm_ipc_iface_t *iface = ucs_derived_of(tl_iface, uct_rocm_ipc_iface_t); uct_base_iface_query(&iface->super, iface_attr); iface_attr->cap.put.min_zcopy = 0; iface_attr->cap.put.max_zcopy = SIZE_MAX; iface_attr->cap.put.opt_zcopy_align = sizeof(uint32_t); iface_attr->cap.put.align_mtu = iface_attr->cap.put.opt_zcopy_align; iface_attr->cap.put.max_iov = 1; iface_attr->cap.get.min_zcopy = 0; iface_attr->cap.get.max_zcopy = SIZE_MAX; iface_attr->cap.get.opt_zcopy_align = sizeof(uint32_t); iface_attr->cap.get.align_mtu = iface_attr->cap.get.opt_zcopy_align; iface_attr->cap.get.max_iov = 1; iface_attr->iface_addr_len = sizeof(pid_t); iface_attr->device_addr_len = sizeof(uint64_t); iface_attr->ep_addr_len = 0; iface_attr->max_conn_priv = 0; iface_attr->cap.flags = UCT_IFACE_FLAG_GET_ZCOPY | UCT_IFACE_FLAG_PUT_ZCOPY | UCT_IFACE_FLAG_PENDING | UCT_IFACE_FLAG_CONNECT_TO_IFACE; /* TODO: get accurate info */ iface_attr->latency = ucs_linear_func_make(80e-9, 0); iface_attr->bandwidth.dedicated = 10.0 * UCS_GBYTE; /* 10 GB */ iface_attr->bandwidth.shared = 0; iface_attr->overhead = 0.4e-6; /* 0.4 us */ return UCS_OK; } static UCS_CLASS_DECLARE_DELETE_FUNC(uct_rocm_ipc_iface_t, uct_iface_t); static ucs_status_t uct_rocm_ipc_iface_flush(uct_iface_h tl_iface, unsigned flags, uct_completion_t *comp) { uct_rocm_ipc_iface_t *iface = ucs_derived_of(tl_iface, uct_rocm_ipc_iface_t); if (comp != NULL) { return UCS_ERR_UNSUPPORTED; } if (ucs_queue_is_empty(&iface->signal_queue)) { UCT_TL_IFACE_STAT_FLUSH(ucs_derived_of(tl_iface, uct_base_iface_t)); return UCS_OK; } UCT_TL_IFACE_STAT_FLUSH_WAIT(ucs_derived_of(tl_iface, uct_base_iface_t)); return UCS_INPROGRESS; } static unsigned uct_rocm_ipc_iface_progress(uct_iface_h tl_iface) { uct_rocm_ipc_iface_t *iface = ucs_derived_of(tl_iface, uct_rocm_ipc_iface_t); static const unsigned max_signals = 16; unsigned count = 0; uct_rocm_ipc_signal_desc_t *rocm_ipc_signal; ucs_queue_iter_t iter; ucs_queue_for_each_safe(rocm_ipc_signal, iter, &iface->signal_queue, queue) { if (hsa_signal_load_scacquire(rocm_ipc_signal->signal) != 0) { continue; } ucs_queue_del_iter(&iface->signal_queue, iter); if (rocm_ipc_signal->comp != NULL) { uct_invoke_completion(rocm_ipc_signal->comp, UCS_OK); } ucs_trace_poll("ROCM_IPC Signal Done :%p", rocm_ipc_signal); ucs_mpool_put(rocm_ipc_signal); count++; if (count >= max_signals) { break; } } return count; } static uct_iface_ops_t uct_rocm_ipc_iface_ops = { .ep_put_zcopy = uct_rocm_ipc_ep_put_zcopy, .ep_get_zcopy = uct_rocm_ipc_ep_get_zcopy, .ep_pending_add = ucs_empty_function_return_busy, .ep_pending_purge = ucs_empty_function, .ep_flush = uct_base_ep_flush, .ep_fence = uct_base_ep_fence, .ep_create = UCS_CLASS_NEW_FUNC_NAME(uct_rocm_ipc_ep_t), .ep_destroy = UCS_CLASS_DELETE_FUNC_NAME(uct_rocm_ipc_ep_t), .iface_flush = uct_rocm_ipc_iface_flush, .iface_fence = uct_base_iface_fence, .iface_progress_enable = uct_base_iface_progress_enable, .iface_progress_disable = uct_base_iface_progress_disable, .iface_progress = uct_rocm_ipc_iface_progress, .iface_close = UCS_CLASS_DELETE_FUNC_NAME(uct_rocm_ipc_iface_t), .iface_query = uct_rocm_ipc_iface_query, .iface_get_address = uct_rocm_ipc_iface_get_address, .iface_get_device_address = uct_rocm_ipc_iface_get_device_address, .iface_is_reachable = uct_rocm_ipc_iface_is_reachable }; static void uct_rocm_ipc_signal_desc_init(ucs_mpool_t *mp, void *obj, void *chunk) { uct_rocm_ipc_signal_desc_t *base = (uct_rocm_ipc_signal_desc_t *)obj; hsa_status_t status; memset(base, 0, sizeof(*base)); status = hsa_signal_create(1, 0, NULL, &base->signal); if (status != HSA_STATUS_SUCCESS) { ucs_fatal("fail to create signal"); } } static void uct_rocm_ipc_signal_desc_cleanup(ucs_mpool_t *mp, void *obj) { uct_rocm_ipc_signal_desc_t *base = (uct_rocm_ipc_signal_desc_t *)obj; hsa_status_t status; status = hsa_signal_destroy(base->signal); if (status != HSA_STATUS_SUCCESS) { ucs_fatal("fail to destroy signal"); } } static ucs_mpool_ops_t uct_rocm_ipc_signal_desc_mpool_ops = { .chunk_alloc = ucs_mpool_chunk_malloc, .chunk_release = ucs_mpool_chunk_free, .obj_init = uct_rocm_ipc_signal_desc_init, .obj_cleanup = uct_rocm_ipc_signal_desc_cleanup, }; static UCS_CLASS_INIT_FUNC(uct_rocm_ipc_iface_t, uct_md_h md, uct_worker_h worker, const uct_iface_params_t *params, const uct_iface_config_t *tl_config) { ucs_status_t status; UCS_CLASS_CALL_SUPER_INIT(uct_base_iface_t, &uct_rocm_ipc_iface_ops, md, worker, params, tl_config UCS_STATS_ARG(params->stats_root) UCS_STATS_ARG(UCT_ROCM_IPC_TL_NAME)); status = ucs_mpool_init(&self->signal_pool, 0, sizeof(uct_rocm_ipc_signal_desc_t), 0, UCS_SYS_CACHE_LINE_SIZE, 128, 1024, &uct_rocm_ipc_signal_desc_mpool_ops, "ROCM_IPC signal objects"); if (status != UCS_OK) { ucs_error("rocm/ipc signal mpool creation failed"); return status; } ucs_queue_head_init(&self->signal_queue); return UCS_OK; } static UCS_CLASS_CLEANUP_FUNC(uct_rocm_ipc_iface_t) { uct_base_iface_progress_disable(&self->super.super, UCT_PROGRESS_SEND | UCT_PROGRESS_RECV); ucs_mpool_cleanup(&self->signal_pool, 1); } UCS_CLASS_DEFINE(uct_rocm_ipc_iface_t, uct_base_iface_t); static UCS_CLASS_DEFINE_NEW_FUNC(uct_rocm_ipc_iface_t, uct_iface_t, uct_md_h, uct_worker_h, const uct_iface_params_t*, const uct_iface_config_t *); static UCS_CLASS_DEFINE_DELETE_FUNC(uct_rocm_ipc_iface_t, uct_iface_t); UCT_TL_DEFINE(&uct_rocm_ipc_component, rocm_ipc, uct_rocm_base_query_devices, uct_rocm_ipc_iface_t, "ROCM_IPC_", uct_rocm_ipc_iface_config_table, uct_rocm_ipc_iface_config_t);
conormuldoon/unison
back-end/src/main/java/eu/acclimatize/unison/result/CloudinessResult.java
package eu.acclimatize.unison.result; import java.io.PrintWriter; import java.util.Date; import com.fasterxml.jackson.annotation.JsonProperty; import eu.acclimatize.unison.Constant; import eu.acclimatize.unison.HarmonieItem; import eu.acclimatize.unison.csvcontroller.CSVHeaderItem; /** * A Jackson and CSV annotated class that is used to store a result row from a * cloudiness data query. * */ public class CloudinessResult implements HarmonieItem { @CSVHeaderItem(Constant.FROM_HOUR) @JsonProperty private Date date; @CSVHeaderItem("Cloudiness " + Constant.PERCENTAGE_SYMBOL) @JsonProperty private double cloudiness; /** * Creates and instance of CloudinessResult. * * @param date The hour from which the results relates. * @param cloudiness The percentage of cloudiness. */ public CloudinessResult(Date date, double cloudiness) { this.date = date; this.cloudiness = cloudiness; } @Override public void printItem(PrintWriter pw) { pw.println(date.toString() + ',' + cloudiness + ','); } }
dagn/mailserv
admin/lib/ntp.rb
require 'timeout' class Ntp < ActiveRecord::BaseWithoutTable column :name_1, :string column :name_2, :string column :name_3, :string column :enabled, :boolean def after_initialize i = 0 Sudo.read("/etc/ntpd.conf").each do |line| case when line =~ /server (.*)/ add_server $1, i += 1 when line =~ /servers (.*)/ add_server $1, i += 1 end end self.enabled = false Sudo.read("/etc/rc.conf.local").each do |line| case when line =~ /ntpd_flags=\"(\"|\s*\-)/ self.enabled = true end end end def add_server(name, number) case number when 1 self.name_1 = name when 2 self.name_2 = name when 3 self.name_3 = name end end def save out = "" out += (is_pool?(name_1) ? "servers" : "server") + " #{name_1}\n" unless name_1.blank? out += (is_pool?(name_2) ? "servers" : "server") + " #{name_2}\n" unless name_2.blank? out += (is_pool?(name_3) ? "servers" : "server") + " #{name_3}\n" unless name_3.blank? Sudo.write("/etc/ntpd.conf", out, :mode => 644) out = "" ntp_is_set = false rc_conf_local = Sudo.read("/etc/rc.conf.local").each do |line| if line =~ /^ntpd_flags/ out += "ntpd_flags=\"-s\"\n" if enabled ntp_is_set = true elsif line =~ /^\s*$/ next else out += line.strip + "\n" end end unless ntp_is_set out += "ntpd_flags=\"-s\"" if enabled end Sudo.write("/etc/rc.conf.local", out) if %x{uname -s}.strip == "OpenBSD" Sudo.exec "pkill ntpd" Sudo.exec "/usr/sbin/ntpd" if enabled end true end def self.test(ntpserver) return nil if ntpserver.blank? begin Timeout::timeout(3) do sock = UDPSocket.new sock.connect(ntpserver, "ntp") client_time_send = Time.new.to_i client_localtime = client_time_send client_adj_localtime = client_localtime + 2208988800 client_frac_localtime = frac2bin(client_adj_localtime) ntp_msg = (['00011011']+Array.new(12, 0)+[client_localtime, client_frac_localtime.to_s]).pack("B8 C3 N10 B32") sock.print ntp_msg sock.flush data = sock.recvfrom(960)[0] true end rescue Timeout::Error false rescue false end end private def self.frac2bin(frac) bin = '' while ( bin.length < 32 ) bin += ( frac * 2 ).to_i.to_s frac = ( frac * 2 ) - ( frac * 2 ).to_i end return bin end def is_pool?(address) return nil if address.blank? begin Timeout::timeout(3) do Resolv::DNS.new.getaddresses(address).count > 1 end rescue Timeout::Error false rescue false end end end
alexcurylo/twlib
projects/Xcode4/TabBar/config/TWProjectPrefix.h
// // TWProjectPrefix.h // // Copyright 2011 Trollwerks Inc. All rights reserved. // #import <Availability.h> #import <TargetConditionals.h> // define our own TWTARGET_SDK_[IPHONE|MAC] and TWTARGET_RT_[DEVICE|SIMULATOR] #if TARGET_OS_IPHONE #define TWTARGET_SDK_IPHONE 1 #if TARGET_IPHONE_SIMULATOR #define TWTARGET_RT_SIMULATOR 1 #else #define TWTARGET_RT_DEVICE 1 #endif //TARGET_IPHONE_SIMULATOR #else #define TWTARGET_SDK_MAC 1 #endif //TARGET_OS_IPHONE #import "TWDebugging.h" #ifdef __OBJC__ #import <Foundation/Foundation.h> #import <UIKit/UIKit.h> #endif //__OBJC__
OnamOfficial/build
cmd/buildlet/buildlet_unix.go
<filename>cmd/buildlet/buildlet_unix.go // Copyright 2016 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // +build linux // (We only care about Linux on GKE for now) package main import ( "log" "os" "os/exec" "os/signal" "syscall" ) func init() { registerSignal = registerSignalUnix setWorkdirToTmpfs = setWorkdirToTmpfsLinux } func registerSignalUnix(c chan<- os.Signal) { signal.Notify(c, syscall.SIGINT, syscall.SIGTERM) } func setWorkdirToTmpfsLinux() { const dir = "/workdir" var st syscall.Statfs_t const TMPFS_MAGIC = 0x01021994 // from statfs(2) if syscall.Statfs(dir, &st) != nil || st.Type != TMPFS_MAGIC { return } log.Printf("detected tmpfs %s", dir) const ST_NOEXEC = syscall.MS_NOEXEC // golang.org/issue/25341 if st.Flags&ST_NOEXEC != 0 { log.Printf("tmpfs %s is noexec; remounting", dir) out, err := exec.Command("mount", "-o", "remount,exec", dir).CombinedOutput() if err != nil { log.Printf("error remounting tmpfs %s as exec: %v, %s", dir, err, out) return } // Check that it worked: st = syscall.Statfs_t{} if err := syscall.Statfs(dir, &st); err != nil { log.Printf("second stat of %s failed after remount: %v", dir, err) return } if st.Flags&ST_NOEXEC != 0 { log.Printf("remount of %s failed; still marked noexec", dir) return } log.Printf("remounted tmpfs %s to remove noexec", dir) } *workDir = dir log.Printf("using tmpfs %s as workdir.", dir) }
19920625lsg/liuyubobobo-algorithms
Part2BasicGraph/src/main/java/Chapter04DFSInAction/Section4To5SingleSourcePath/GraphDFSSingleSourcePath.java
<gh_stars>100-1000 /*********************************************************** * @Description : 深度优先遍历(支持连通图和非连通图) * @author : 梁山广(<NAME>) * @date : 2019-08-06 23:20 * @email : <EMAIL> ***********************************************************/ package Chapter04DFSInAction.Section4To5SingleSourcePath; import Chapter02GraphExpress.Graph; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; public class GraphDFSSingleSourcePath { private Graph graph; /** * 存储顶点是否被访问的数组 */ private boolean[] visited; /** * 图进行深度优先遍历的起点 */ private int source; /** * 基于每个访问的顶点的上一个访问顶点 */ private int[] pre; /** * 存放图的深度优先遍历的结果 */ private List<Integer> orderList = new ArrayList<>(); public GraphDFSSingleSourcePath(Graph graph, int source) { // 验证起点是否在合理范围 graph.validateVertex(source); this.graph = graph; this.source = source; // 初始化访问数组,用图的顶点个数来访问 this.visited = new boolean[graph.V()]; this.pre = new int[graph.V()]; // pre数组全部初始化为-1 Arrays.fill(this.pre, -1); // 因为单源路径问题是和连通分量无关的,只需要在source所在的联通分量内找到target的路径,所以不需要考虑所有的联通分量,即dfs()要用最早没有考虑连通分量的那版 // 第一次进入时源头source的parent设置为了自己,实际设置成任何值都是可以的,我们在path函数中找到source就行了,并没有涉及source的父节点 dfs(source, source); } public Iterable<Integer> getOrderList() { return orderList; } /** * 判断图的遍历起点是否和target点连通,实际只需要看下visit[v]是否为true即可,为true表示在一个连通分量上,肯定是连通地 * * @param target 目标定点索引 * @return 判断图的遍历起点是否和target点连通 */ public boolean isSourceConnectedTo(int target) { graph.validateVertex(target); return visited[target]; } /** * 找到起点source到目标定点target的路径 * * @param target 目标定点 * @return 可迭代的对象,一般是集合,用于存储source到target的完整路径 */ public Iterable<Integer> path(int target) { List<Integer> pathList = new ArrayList<>(); // source到target有路径才进行路径查找 if (isSourceConnectedTo(target)) { // 用pre数组从target一直找到source点,记录下中间经过的所有点,就是要求的单源路径 int current = target; while (current != source) { pathList.add(current); // 不断向前找元素 current = pre[current]; } // 起点要加上 pathList.add(source); // 因为是从source到target的路径,所以要逆序下 Collections.reverse(pathList); return pathList; } else { // 没有路径就直接返回空集合 return pathList; } } /** * 记录每个顶点的前面一个被访问的顶点即parent的DFS实现 * * @param v 当前顶点 * @param parent v的前面一个被访问的节点 */ private void dfs(int v, int parent) { visited[v] = true; orderList.add(v); // 记录每个定点的上一个访问节点 pre[v] = parent; for (Integer w : graph.adj(v)) { if (!visited[w]) { // w点没被访问的话就递归接着访问 dfs(w, v); } } } }
levilucio/SyVOLT
UMLRT2Kiltera_MM/Properties/from_MPS/HPP4_IsolatedLHS.py
from core.himesis import Himesis, HimesisPreConditionPatternLHS import uuid class HPP4_IsolatedLHS(HimesisPreConditionPatternLHS): def __init__(self): """ Creates the himesis graph representing the AToM3 model HPP4_IsolatedLHS """ # Flag this instance as compiled now self.is_compiled = True super(HPP4_IsolatedLHS, self).__init__(name='HPP4_IsolatedLHS', num_nodes=0, edges=[]) # Add the edges self.add_edges([]) # Set the graph attributes self["mm__"] = ['MT_pre__FamiliesToPersonsMM', 'MoTifRule'] self["MT_constraint__"] = """return True""" self["name"] = """""" self["GUID__"] = uuid.uuid3(uuid.NAMESPACE_DNS,'HPP4_IsolatedLHS') self["equations"] = [] # Set the node attributes # match class State(0.33.m.0State) node self.add_node() self.vs[0]["MT_pre__attr1"] = """return True""" self.vs[0]["MT_label__"] = """1""" self.vs[0]["mm__"] = """MT_pre__State""" self.vs[0]["GUID__"] = uuid.uuid3(uuid.NAMESPACE_DNS,'0.33.m.0State') # match class ExitPoint(0.33.m.1ExitPoint) node self.add_node() self.vs[1]["MT_pre__attr1"] = """return True""" self.vs[1]["MT_label__"] = """2""" self.vs[1]["mm__"] = """MT_pre__ExitPoint""" self.vs[1]["GUID__"] = uuid.uuid3(uuid.NAMESPACE_DNS,'0.33.m.1ExitPoint') # match class Transition(0.33.m.2Transition) node self.add_node() self.vs[2]["MT_pre__attr1"] = """return True""" self.vs[2]["MT_label__"] = """3""" self.vs[2]["mm__"] = """MT_pre__Transition""" self.vs[2]["GUID__"] = uuid.uuid3(uuid.NAMESPACE_DNS,'0.33.m.2Transition') # match class OUT2(0.33.m.3OUT2) node self.add_node() self.vs[3]["MT_pre__attr1"] = """return True""" self.vs[3]["MT_label__"] = """4""" self.vs[3]["mm__"] = """MT_pre__OUT2""" self.vs[3]["GUID__"] = uuid.uuid3(uuid.NAMESPACE_DNS,'0.33.m.3OUT2') # define evaluation methods for each apply class. def eval_attr11(self, attr_value, this): return True def eval_attr12(self, attr_value, this): return True def eval_attr13(self, attr_value, this): return True def eval_attr14(self, attr_value, this): return True def constraint(self, PreNode, graph): return True
XHao/lindb
sql/stmt/expr_test.go
package stmt import ( "testing" "github.com/stretchr/testify/assert" "github.com/lindb/lindb/aggregation/function" ) func TestExpr_Rewrite(t *testing.T) { assert.Equal(t, "f", (&SelectItem{Expr: &FieldExpr{Name: "f"}}).Rewrite()) assert.Equal(t, "1.90", (&SelectItem{Expr: &NumberLiteral{Val: 1.9}}).Rewrite()) assert.Equal(t, "f as f1", (&SelectItem{Expr: &FieldExpr{Name: "f"}, Alias: "f1"}).Rewrite()) assert.Equal(t, "f", (&FieldExpr{Name: "f"}).Rewrite()) assert.Equal(t, "sum(f)", (&CallExpr{FuncType: function.Sum, Params: []Expr{&FieldExpr{Name: "f"}}}).Rewrite()) assert.Equal(t, "sum()", (&CallExpr{FuncType: function.Sum}).Rewrite()) assert.Equal(t, "(sum(f)+a)", (&ParenExpr{ Expr: &BinaryExpr{ Left: &CallExpr{FuncType: function.Sum, Params: []Expr{&FieldExpr{Name: "f"}}}, Operator: ADD, Right: &FieldExpr{Name: "a"}, }}).Rewrite()) assert.Equal(t, "sum(f)+a", (&BinaryExpr{ Left: &CallExpr{FuncType: function.Sum, Params: []Expr{&FieldExpr{Name: "f"}}}, Operator: ADD, Right: &FieldExpr{Name: "a"}, }).Rewrite()) assert.Equal(t, "not tagKey=tagValue", (&NotExpr{ Expr: &EqualsExpr{Key: "tagKey", Value: "tagValue"}, }).Rewrite()) assert.Equal(t, "tagKey=tagValue", (&EqualsExpr{Key: "tagKey", Value: "tagValue"}).Rewrite()) assert.Equal(t, "tagKey like tagValue", (&LikeExpr{Key: "tagKey", Value: "tagValue"}).Rewrite()) assert.Equal(t, "tagKey in (a,b,c)", (&InExpr{Key: "tagKey", Values: []string{"a", "b", "c"}}).Rewrite()) assert.Equal(t, "tagKey in ()", (&InExpr{Key: "tagKey"}).Rewrite()) assert.Equal(t, "tagKey=~Regexp", (&RegexExpr{Key: "tagKey", Regexp: "Regexp"}).Rewrite()) } func TestTagFilter(t *testing.T) { assert.Equal(t, "tagKey", (&EqualsExpr{Key: "tagKey", Value: "tagValue"}).TagKey()) assert.Equal(t, "tagKey", (&LikeExpr{Key: "tagKey", Value: "tagValue"}).TagKey()) assert.Equal(t, "tagKey", (&InExpr{Key: "tagKey", Values: []string{"a", "b", "c"}}).TagKey()) assert.Equal(t, "tagKey", (&RegexExpr{Key: "tagKey", Regexp: "Regexp"}).TagKey()) } func TestExpr_Marshal_Fail(t *testing.T) { data := Marshal(nil) assert.Nil(t, data) } func TestExpr_Unmarshal_Fail(t *testing.T) { _, err := Unmarshal([]byte{1, 2, 3}) assert.NotNil(t, err) _, err = Unmarshal([]byte("{\"type\":\"unknown\"}")) assert.NotNil(t, err) _, err = unmarshal(&exprData{Type: "test", Expr: []byte{1, 2, 3}}, &EqualsExpr{}) assert.NotNil(t, err) _, err = unmarshalCall([]byte{1, 2, 3}) assert.NotNil(t, err) _, err = unmarshalCall([]byte("{\"type\":\"call\",\"params\":[\"213\"]}")) assert.NotNil(t, err) _, err = Unmarshal([]byte("{\"type\":\"paren\",\"expr\":[\"213\"]}")) assert.NotNil(t, err) _, err = Unmarshal([]byte("{\"type\":\"number\",\"expr\":{\"val\":\"sf\"}}")) assert.NotNil(t, err) _, err = Unmarshal([]byte("{\"type\":\"not\",\"expr\":[\"213\"]}")) assert.NotNil(t, err) _, err = unmarshalSelectItem([]byte("324")) assert.NotNil(t, err) _, err = unmarshalSelectItem([]byte("{\"type\":\"selectItem\",\"expr\":[\"213\"]}")) assert.NotNil(t, err) _, err = unmarshalBinary([]byte("123")) assert.NotNil(t, err) _, err = unmarshalBinary([]byte("{\"type\":\"binary\",\"left\":\"123\"}")) assert.NotNil(t, err) _, err = unmarshalBinary([]byte("{\"type\":\"binary\",\"left\":{\"type\":\"field\",\"expr\":{\"name\":\"f\"}}," + "\"right\":\"123\"}")) assert.NotNil(t, err) } func TestRegexExpr_Marshal(t *testing.T) { expr := &RegexExpr{Key: "tagKey", Regexp: "Regexp"} data := Marshal(expr) exprData, _ := Unmarshal(data) e := exprData.(*RegexExpr) assert.Equal(t, *expr, *e) } func TestLikeExpr_Marshal(t *testing.T) { expr := &LikeExpr{Key: "tagKey", Value: "tagValue"} data := Marshal(expr) exprData, _ := Unmarshal(data) e := exprData.(*LikeExpr) assert.Equal(t, *expr, *e) } func TestInExpr_Marshal(t *testing.T) { expr := &InExpr{Key: "tagKey"} data := Marshal(expr) exprData, _ := Unmarshal(data) e := exprData.(*InExpr) assert.Equal(t, *expr, *e) expr = &InExpr{Key: "tagKey", Values: []string{"a", "b", "c"}} data = Marshal(expr) exprData, _ = Unmarshal(data) e = exprData.(*InExpr) assert.Equal(t, *expr, *e) } func TestEqualsExpr_Marshal(t *testing.T) { expr := &EqualsExpr{Key: "tagKey", Value: "tagValue"} data := Marshal(expr) exprData, _ := Unmarshal(data) e := exprData.(*EqualsExpr) assert.Equal(t, *expr, *e) } func TestNotExpr_Marshal(t *testing.T) { expr := &NotExpr{ Expr: &EqualsExpr{Key: "tagKey", Value: "tagValue"}, } data := Marshal(expr) exprData, _ := Unmarshal(data) e := exprData.(*NotExpr) assert.Equal(t, *expr, *e) } func TestNumberLiteral_Marshal(t *testing.T) { expr := &SelectItem{Expr: &NumberLiteral{Val: 19.0}} data := Marshal(expr) exprData, err := Unmarshal(data) assert.NoError(t, err) e := exprData.(*SelectItem) assert.Equal(t, *expr, *e) } func TestSelectItem_Marshal(t *testing.T) { expr := &SelectItem{Expr: &FieldExpr{Name: "f"}, Alias: "f1"} data := Marshal(expr) exprData, err := Unmarshal(data) if err != nil { t.Fatal(err) } e := exprData.(*SelectItem) assert.Equal(t, *expr, *e) } func TestCallExpr_Marshal(t *testing.T) { expr := &CallExpr{FuncType: function.Sum, Params: []Expr{&FieldExpr{Name: "f"}}} data := Marshal(expr) exprData, err := Unmarshal(data) if err != nil { t.Fatal(err) } e := exprData.(*CallExpr) assert.Equal(t, *expr, *e) } func TestParenExpr_Marshal(t *testing.T) { expr := &ParenExpr{ Expr: &BinaryExpr{ Left: &CallExpr{FuncType: function.Sum, Params: []Expr{&FieldExpr{Name: "f"}}}, Operator: ADD, Right: &FieldExpr{Name: "a"}, }} data := Marshal(expr) exprData, err := Unmarshal(data) if err != nil { t.Fatal(err) } e := exprData.(*ParenExpr) assert.Equal(t, *expr, *e) } func TestBinaryExpr_Marshal(t *testing.T) { expr := &BinaryExpr{ Left: &CallExpr{FuncType: function.Sum, Params: []Expr{&FieldExpr{Name: "f"}}}, Operator: ADD, Right: &FieldExpr{Name: "a"}, } data := Marshal(expr) exprData, _ := Unmarshal(data) e := exprData.(*BinaryExpr) assert.Equal(t, *expr, *e) }
ExtPoint/core-uploader
webpack.js
const webpackEasy = require('webpack-easy'); webpackEasy .entry( webpackEasy.isProduction() ? {'dist/fileup-core': './src/index.js'} : {'assets/bundle-index': './tests/web/index.js'} ) .output({ path: `${__dirname}/`, filename: '[name].js', }) .serverConfig({ contentBase: './tests/web', });
FreeSlave/resolve
examples/shopping-list-tutorial/lesson-7/client/containers/Header.js
<filename>examples/shopping-list-tutorial/lesson-7/client/containers/Header.js import React from 'react' import { connectStaticBasedUrls } from 'resolve-redux' import { Navbar } from 'react-bootstrap' import { Helmet } from 'react-helmet' import Image from './Image' const Header = ({ title, name, css, favicon }) => { const stylesheetLinks = css.map((href) => ({ rel: 'stylesheet', href })) const faviconLink = { rel: 'icon', type: 'image/png', href: favicon } const links = [...stylesheetLinks, faviconLink] const meta = { name: 'viewport', content: 'width=device-width, initial-scale=1', } return ( <div> <Helmet title={title} link={links} meta={[meta]} /> <Navbar> <Navbar.Text> <Navbar.Link href="/"> <Image src="/resolve-logo.png" /> {name} </Navbar.Link> </Navbar.Text> <Navbar.Collapse> <Navbar.Text pullRight> <Navbar.Link href="https://facebook.com/resolvejs/"> <Image src="/fb-logo.png" /> </Navbar.Link> </Navbar.Text> <Navbar.Text pullRight> <Navbar.Link href="https://twitter.com/resolvejs"> <Image src="/twitter-logo.png" /> </Navbar.Link> </Navbar.Text> <Navbar.Text pullRight> <Navbar.Link href="https://github.com/reimagined/resolve"> <Image src="/github-logo.png" /> </Navbar.Link> </Navbar.Text> </Navbar.Collapse> </Navbar> </div> ) } export default connectStaticBasedUrls(['css', 'favicon'])(Header)
RogerJFX/IntelliSearch
src/test/scala/de/crazything/app/entity/SocialPerson.scala
<filename>src/test/scala/de/crazything/app/entity/SocialPerson.scala package de.crazything.app.entity import de.crazything.search.entity.PkDataSet import play.api.libs.json.{Json, OFormat} case class SocialPerson(id: Int, firstName: String, lastName: String, facebookId: Option[String] = None, twitterId: Option[String] = None) extends PkDataSet[Int](id) object SocialPerson { implicit def format: OFormat[SocialPerson] = Json.format[SocialPerson] }
mehmetpekdemir/Todo-App
backend/src/main/java/com/mehmetpekdemir/todoapp/infra/common/validator/UniqueUsernameValidator.java
<reponame>mehmetpekdemir/Todo-App package com.mehmetpekdemir.todoapp.infra.common.validator; import com.mehmetpekdemir.todoapp.infra.adapters.user.jpa.repository.UserJpaRepository; import lombok.RequiredArgsConstructor; import javax.validation.ConstraintValidator; import javax.validation.ConstraintValidatorContext; /** * @author <NAME> * @since 1.0 */ @RequiredArgsConstructor public class UniqueUsernameValidator implements ConstraintValidator<UniqueUsername, String> { private final UserJpaRepository userJpaRepository; @Override public boolean isValid(String username, ConstraintValidatorContext context) { return !userJpaRepository.existsUserByUsername(username); } }
tobywinter/jackal
lib/hash-data.js
'use strict' const crypto = require('crypto') const hashData = (object) => { const hash = crypto.createHash('sha256') hash.update(object) return hash.digest('hex') } module.exports = hashData
pureklkl/opentelemetry-collector
pdata/internal/timestamp_test.go
// Copyright The OpenTelemetry Authors // // 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 internal import ( "testing" "time" "github.com/stretchr/testify/assert" ) func TestUnixNanosConverters(t *testing.T) { t1 := time.Date(2020, 03, 24, 1, 13, 23, 789, time.UTC) tun := Timestamp(t1.UnixNano()) assert.EqualValues(t, uint64(1585012403000000789), tun) assert.EqualValues(t, tun, NewTimestampFromTime(t1)) assert.EqualValues(t, t1, NewTimestampFromTime(t1).AsTime()) assert.Equal(t, "2020-03-24 01:13:23.000000789 +0000 UTC", t1.String()) } func TestZeroTimestamp(t *testing.T) { assert.Equal(t, time.Unix(0, 0).UTC(), Timestamp(0).AsTime()) assert.Zero(t, NewTimestampFromTime(time.Unix(0, 0).UTC())) assert.Equal(t, "1970-01-01 00:00:00 +0000 UTC", Timestamp(0).String()) }
schhx/acm
src/org/schhx/acm/leetcode/AddTwoNumbers_2.java
package org.schhx.acm.leetcode; /** * https://leetcode-cn.com/problems/add-two-numbers/ * * @author shanchao * @date 2019-05-05 */ public class AddTwoNumbers_2 { public ListNode addTwoNumbers(ListNode l1, ListNode l2) { ListNode dummy = new ListNode(-1); ListNode head = dummy; int add = 0; while (l1 != null && l2 != null) { int sum = l1.val + l2.val + add; int val = sum % 10; add = sum - val; dummy.next = new ListNode(val); l1 = l1.next; l2 = l2.next; dummy = dummy.next; } return head.next; } private static class ListNode { int val; ListNode next; ListNode(int x) { val = x; } } }
MangoPlex/Minecraft-Projects
LostTale/src/main/java/xyz/studiomango/losttale/hardcoded/items/icy/IceShard.java
<filename>LostTale/src/main/java/xyz/studiomango/losttale/hardcoded/items/icy/IceShard.java package xyz.studiomango.losttale.hardcoded.items.icy; import org.bukkit.Material; import org.bukkit.enchantments.Enchantment; import org.bukkit.inventory.ItemFlag; import xyz.studiomango.losttale.core.global.Rarity; import xyz.studiomango.losttale.core.items.CustomItem; import xyz.studiomango.losttale.core.items.CustomItemData; public class IceShard extends CustomItem { public static final IceShard ITEM = new IceShard(); public IceShard() { super("ICE_SHARD", Material.PRISMARINE_SHARD, "Ice Shard", Rarity.RARE, new String[] { "A shard of coldness..." }); } @Override public void applyDataOnNewItem(CustomItemData data) { data.getMeta().addItemFlags(ItemFlag.HIDE_ENCHANTS); data.getMeta().addEnchant(Enchantment.ARROW_DAMAGE, 0, true); } }
litiian/asyncstudy
OPMS_v3-dev3.1/apps/document_management/migrations/0002_auto_20180726_1034.py
# Generated by Django 2.0.6 on 2018-07-26 10:34 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('document_management', '0001_initial'), ] operations = [ migrations.AlterField( model_name='document', name='belong', field=models.PositiveSmallIntegerField(choices=[(1, '文档'), (2, 'Shell脚本'), (3, 'Python脚本')], verbose_name='隶属'), ), ]
mk2510/jointGraphMatchingAndClustering
code/lib/text/tokenise.cpp
#include "mex.h" #include "string.h" #define MAX_LEN 100000 #define MAX_NUM_TOKEN 10000 /* * function tokens = tokenise(s, delim) * * History * create - <NAME>, 08-15-2009 * modify - <NAME>, 08-15-2009 */ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) { // s char s[MAX_LEN]; mxGetString(prhs[0], s, MAX_LEN); // delim char delim[MAX_LEN]; mxGetString(prhs[1], delim, MAX_LEN); // tokens storage char* tokens[MAX_NUM_TOKEN]; int m = 0; // main part char *token; token = strtok(s, delim); while (token != NULL) { tokens[m++] = token; token = strtok(NULL, delim); } // tokens plhs[0] = mxCreateCellMatrix(1, m); for (int i = 0; i < m; ++i) { mxSetCell(plhs[0], i, mxCreateString(tokens[i])); } }
smeng9/KrisLibrary
math/BlockTridiagonalMatrix.cpp
#include <KrisLibrary/Logger.h> #include "BlockTridiagonalMatrix.h" #include "LUDecomposition.h" #include <errors.h> using namespace Math; using namespace std; BlockTridiagonalMatrix::BlockTridiagonalMatrix() {} BlockTridiagonalMatrix::BlockTridiagonalMatrix(int nBlock) { resize(nBlock); } BlockTridiagonalMatrix::BlockTridiagonalMatrix(int nBlock,int nMat) { resize(nBlock,nMat); } BlockTridiagonalMatrix::BlockTridiagonalMatrix(int nBlock,int nMat,Real initVal) { resize(nBlock,nMat,initVal); } int BlockTridiagonalMatrix::numTotalRows() const { int m=0; for(size_t i=0;i<diagonal.size();i++) m += diagonal[i].m; return m; } int BlockTridiagonalMatrix::numTotalCols() const { int n=0; for(size_t i=0;i<diagonal.size();i++) n += diagonal[i].n; return n; } void BlockTridiagonalMatrix::resize(int nBlock) { diagonal.resize(nBlock); upperDiagonal.resize(nBlock-1); lowerDiagonal.resize(nBlock-1); } void BlockTridiagonalMatrix::resize(int nBlock,int nMat) { resize(nBlock); for(size_t i=0;i<diagonal.size();i++) diagonal[i].resize(nMat,nMat); for(size_t i=0;i<upperDiagonal.size();i++) { upperDiagonal[i].resize(nMat,nMat); lowerDiagonal[i].resize(nMat,nMat); } } void BlockTridiagonalMatrix::resize(int nBlock,int nMat,Real initVal) { resize(nBlock); for(size_t i=0;i<diagonal.size();i++) diagonal[i].resize(nMat,nMat,initVal); for(size_t i=0;i<upperDiagonal.size();i++) { upperDiagonal[i].resize(nMat,nMat,initVal); lowerDiagonal[i].resize(nMat,nMat,initVal); } } void BlockTridiagonalMatrix::resizeSimilar(const MyT& m) { Assert(m.isValid()); if(!m.isEmpty()) { int nMat = m.diagonal[0].m; resize((int)m.diagonal.size(),nMat); } else clear(); } void BlockTridiagonalMatrix::clear() { diagonal.clear(); upperDiagonal.clear(); lowerDiagonal.clear(); } Matrix& BlockTridiagonalMatrix::operator()(int i,int j) { if(i==j) return diagonal[i]; if(i==j-1) return upperDiagonal[i]; if(i-1==j) return lowerDiagonal[j]; AssertNotReached(); return diagonal[0]; } const Matrix& BlockTridiagonalMatrix::operator()(int i,int j) const { if(i==j) return diagonal[i]; if(i==j-1) return upperDiagonal[i]; if(i-1==j) return lowerDiagonal[j]; AssertNotReached(); return diagonal[0]; } void BlockTridiagonalMatrix::add(const MyT& a,const MyT& b) { Assert(a.hasDims(b)); resizeSimilar(a); for(size_t i=0;i<diagonal.size();i++) diagonal[i].add(a.diagonal[i],b.diagonal[i]); for(size_t i=0;i<upperDiagonal.size();i++) { upperDiagonal[i].add(a.upperDiagonal[i],b.upperDiagonal[i]); lowerDiagonal[i].add(a.lowerDiagonal[i],b.lowerDiagonal[i]); } } void BlockTridiagonalMatrix::sub(const MyT& a,const MyT& b) { Assert(a.hasDims(b)); resizeSimilar(a); for(size_t i=0;i<diagonal.size();i++) diagonal[i].sub(a.diagonal[i],b.diagonal[i]); for(size_t i=0;i<upperDiagonal.size();i++) { upperDiagonal[i].sub(a.upperDiagonal[i],b.upperDiagonal[i]); lowerDiagonal[i].sub(a.lowerDiagonal[i],b.lowerDiagonal[i]); } } void BlockTridiagonalMatrix::mul(const MyT& a,Real c) { resizeSimilar(a); for(size_t i=0;i<diagonal.size();i++) diagonal[i].mul(a.diagonal[i],c); for(size_t i=0;i<upperDiagonal.size();i++) { upperDiagonal[i].mul(a.upperDiagonal[i],c); lowerDiagonal[i].mul(a.lowerDiagonal[i],c); } } void BlockTridiagonalMatrix::div(const MyT& a,Real c) { resizeSimilar(a); for(size_t i=0;i<diagonal.size();i++) diagonal[i].div(a.diagonal[i],c); for(size_t i=0;i<upperDiagonal.size();i++) { upperDiagonal[i].div(a.upperDiagonal[i],c); lowerDiagonal[i].div(a.lowerDiagonal[i],c); } } void BlockTridiagonalMatrix::inc(const MyT& a) { Assert(hasDims(a)); for(size_t i=0;i<diagonal.size();i++) diagonal[i] += a.diagonal[i]; for(size_t i=0;i<upperDiagonal.size();i++) { upperDiagonal[i] += a.upperDiagonal[i]; lowerDiagonal[i] += a.lowerDiagonal[i]; } } void BlockTridiagonalMatrix::dec(const MyT& a) { Assert(hasDims(a)); for(size_t i=0;i<diagonal.size();i++) diagonal[i] -= a.diagonal[i]; for(size_t i=0;i<upperDiagonal.size();i++) { upperDiagonal[i] -= a.upperDiagonal[i]; lowerDiagonal[i] -= a.lowerDiagonal[i]; } } void BlockTridiagonalMatrix::madd(const MyT& a,Real c) { Assert(hasDims(a)); for(size_t i=0;i<diagonal.size();i++) diagonal[i].madd(a.diagonal[i],c); for(size_t i=0;i<upperDiagonal.size();i++) { upperDiagonal[i].madd(a.upperDiagonal[i],c); lowerDiagonal[i].madd(a.lowerDiagonal[i],c); } } void BlockTridiagonalMatrix::mul(const BlockVector& a,BlockVector& x) const { Assert(a.numBlocks() == numBlockRows()); x.resize(numBlockCols()); for(size_t i=0;i<diagonal.size();i++) { diagonal[i].mul(a[i],x[i]); if(i>=1) lowerDiagonal[i-1].madd(a[i-1],x[i]); if(i+1<diagonal.size()) upperDiagonal[i].madd(a[i+1],x[i]); } } void BlockTridiagonalMatrix::mulTranspose(const BlockVector& a,BlockVector& x) const { Assert(a.numBlocks() == numBlockCols()); x.resize(numBlockRows()); for(size_t i=0;i<diagonal.size();i++) { diagonal[i].mulTranspose(a[i],x[i]); if(i>=1) upperDiagonal[i-1].maddTranspose(a[i-1],x[i]); if(i+1<diagonal.size()) lowerDiagonal[i].maddTranspose(a[i+1],x[i]); } } void BlockTridiagonalMatrix::madd(const BlockVector& a,BlockVector& x) const { Assert(a.numBlocks() == numBlockRows()); Assert(x.numBlocks() == numBlockCols()); for(size_t i=0;i<diagonal.size();i++) { diagonal[i].madd(a[i],x[i]); if(i>=1) lowerDiagonal[i-1].madd(a[i-1],x[i]); if(i+1<diagonal.size()) upperDiagonal[i].madd(a[i+1],x[i]); } } void BlockTridiagonalMatrix::maddTranspose(const BlockVector& a,BlockVector& x) const { Assert(a.numBlocks() == numBlockCols()); Assert(x.numBlocks() == numBlockRows()); for(size_t i=0;i<diagonal.size();i++) { diagonal[i].maddTranspose(a[i],x[i]); if(i>=1) upperDiagonal[i-1].maddTranspose(a[i-1],x[i]); if(i+1<diagonal.size()) lowerDiagonal[i].maddTranspose(a[i+1],x[i]); } } void BlockTridiagonalMatrix::setZero() { for(size_t i=0;i<diagonal.size();i++) diagonal[i].setZero(); for(size_t i=0;i<upperDiagonal.size();i++) { upperDiagonal[i].setZero(); lowerDiagonal[i].setZero(); } } void BlockTridiagonalMatrix::set(Real c) { for(size_t i=0;i<diagonal.size();i++) diagonal[i].set(c); for(size_t i=0;i<upperDiagonal.size();i++) { upperDiagonal[i].set(c); lowerDiagonal[i].set(c); } } void BlockTridiagonalMatrix::setIdentity() { for(size_t i=0;i<diagonal.size();i++) diagonal[i].setIdentity(); for(size_t i=0;i<upperDiagonal.size();i++) { upperDiagonal[i].setZero(); lowerDiagonal[i].setZero(); } } void BlockTridiagonalMatrix::setTranspose(const MyT& m) { resizeSimilar(m); for(size_t i=0;i<diagonal.size();i++) diagonal[i].setTranspose(m.diagonal[i]); for(size_t i=0;i<upperDiagonal.size();i++) { upperDiagonal[i].setTranspose(m.lowerDiagonal[i]); lowerDiagonal[i].setTranspose(m.upperDiagonal[i]); } } bool BlockTridiagonalMatrix::solveInverse_LU(const BlockVector& b,BlockVector& x) const { Assert(b.numBlocks() == numBlockRows()); x.resize(numBlockCols()); Matrix mtemp,mtemp2; Vector vtemp,vtemp2; vector<Matrix> Binv (diagonal.size()); LUDecomposition<Real> lud; //backsub for(size_t i=0;i<diagonal.size();i++) { if(i == 0) { if(!lud.set(diagonal[i])) { LOG4CXX_INFO(KrisLibrary::logger(),"diagonal block "<<i); return false; } lud.getInverse(Binv[i]); //solve z[i] in x[i] Binv[i].mul(b[i],x[i]); } else { //Bi = Aii - Ai,i-1*Bi-1*Ai-1,i mtemp.mul(Binv[i-1],lowerDiagonal[i-1]); mtemp2.mul(upperDiagonal[i-1],mtemp); mtemp.sub(diagonal[i],mtemp2); if(!lud.set(mtemp)) { LOG4CXX_INFO(KrisLibrary::logger(),"diagonal block "<<i); return false; } lud.getInverse(Binv[i]); //solve z[i] in x[i] lowerDiagonal[i-1].mul(x[i-1],vtemp2); vtemp.sub(b[i],vtemp2); Binv[i].mul(vtemp,x[i]); } } //forward sub (x[n-1] already solved) for(int i=(int)diagonal.size()-2;i>=0;i--) { //x[i] = x[i]-Binv[i]*upperDiagonal[i]*x[i+1]; upperDiagonal[i].mul(x[i+1],vtemp); Binv[i].mul(vtemp,vtemp2); x[i] -= vtemp2; } return true; } bool BlockTridiagonalMatrix::solveInverse_Cholesky(const BlockVector& b,BlockVector& v) const { AssertNotReached(); return false; } void BlockTridiagonalMatrix::inplaceTranspose() { for(size_t i=0;i<diagonal.size();i++) diagonal[i].inplaceTranspose(); Matrix temp; for(size_t i=0;i<upperDiagonal.size();i++) { temp.setTranspose(upperDiagonal[i]); upperDiagonal[i].setTranspose(lowerDiagonal[i]); lowerDiagonal[i] = temp; } } void BlockTridiagonalMatrix::getMatrix(Matrix& mat) const { int m=numTotalRows(),n=numTotalCols(); mat.resize(m,n,Zero); int mcur=0,ncur=0; for(size_t i=0;i<diagonal.size();i++) { mat.copySubMatrix(mcur,ncur,diagonal[i]); if(i+1<diagonal.size()) mat.copySubMatrix(mcur,ncur+diagonal[i].n,upperDiagonal[i]); if(i>0) mat.copySubMatrix(mcur,ncur-lowerDiagonal[i].n,lowerDiagonal[i-1]); mcur += diagonal[i].m; ncur += diagonal[i].n; } } bool BlockTridiagonalMatrix::isValid() const { if(diagonal.empty() && upperDiagonal.empty() && lowerDiagonal.empty()) return true; if(upperDiagonal.size()+1 != diagonal.size()) return false; if(lowerDiagonal.size()+1 != diagonal.size()) return false; int nmat = diagonal[0].m; for(size_t i=0;i<diagonal.size();i++) if(!diagonal[i].hasDims(nmat,nmat)) return false; for(size_t i=0;i<upperDiagonal.size();i++) { if(!upperDiagonal[i].hasDims(nmat,nmat)) return false; if(!lowerDiagonal[i].hasDims(nmat,nmat)) return false; } return true; } bool BlockTridiagonalMatrix::hasDims(const MyT& m) const { Assert(isValid()); Assert(m.isValid()); if(m.isEmpty() && isEmpty()) return true; if(m.diagonal.size() != diagonal.size()) return false; if(m.diagonal[0].m != diagonal[0].m) return false; return true; } bool BlockTridiagonalMatrix::hasDims(int nBlock,int nMat) const { Assert(isValid()); if(isEmpty()) return (nBlock==0); if((int)diagonal.size() != nBlock) return false; return (diagonal[0].m == nMat); }
manifestinteractive/weather-bar-api
app/seeders/20180108000330-owm-city-list-seeder.js
<filename>app/seeders/20180108000330-owm-city-list-seeder.js module.exports = { up: function (queryInterface) { return queryInterface.bulkInsert("owm_city_list", [{ owm_city_id: "4156947", owm_city_name: "<NAME>", owm_latitude: "26.700621", owm_longitude: "-80.164772", owm_country: "US", locality_short: "Royal Palm Beach", locality_long: "Royal Palm Beach", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Palm Beach County", admin_level_2_long: "Palm Beach County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4156959", owm_city_name: "Goldenrod", owm_latitude: "28.610279", owm_longitude: "-81.288681", owm_country: "US", locality_short: "Winter Park", locality_long: "Winter Park", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Orange County", admin_level_2_long: "Orange County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4156975", owm_city_name: "Gonzalez", owm_latitude: "30.581579", owm_longitude: "-87.291359", owm_country: "US", locality_short: "Cantonment", locality_long: "Cantonment", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Escambia County", admin_level_2_long: "Escambia County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4157092", owm_city_name: "Gotha", owm_latitude: "28.527781", owm_longitude: "-81.523132", owm_country: "US", locality_short: "Gotha", locality_long: "Gotha", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Orange County", admin_level_2_long: "Orange County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4157095", owm_city_name: "Goulding", owm_latitude: "30.44298", owm_longitude: "-87.222473", owm_country: "US", locality_short: "Pensacola", locality_long: "Pensacola", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Escambia County", admin_level_2_long: "Escambia County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4157097", owm_city_name: "Goulds", owm_latitude: "25.562611", owm_longitude: "-80.382278", owm_country: "US", locality_short: "Goulds", locality_long: "Goulds", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Miami-Dade County", admin_level_2_long: "Miami-Dade County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4157427", owm_city_name: "Green Cove Springs", owm_latitude: "29.991911", owm_longitude: "-81.678146", owm_country: "US", locality_short: "Green Cove Springs", locality_long: "Green Cove Springs", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Clay County", admin_level_2_long: "Clay County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4157605", owm_city_name: "Groveland", owm_latitude: "28.55805", owm_longitude: "-81.851189", owm_country: "US", locality_short: "Groveland", locality_long: "Groveland", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Lake County", admin_level_2_long: "Lake County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4157634", owm_city_name: "Gulf Breeze", owm_latitude: "30.35714", owm_longitude: "-87.163857", owm_country: "US", locality_short: "Gulf Breeze", locality_long: "Gulf Breeze", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Santa Rosa County", admin_level_2_long: "Santa Rosa County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4157657", owm_city_name: "<NAME>", owm_latitude: "27.25173", owm_longitude: "-82.514709", owm_country: "US", locality_short: "Sarasota", locality_long: "Sarasota", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Sarasota County", admin_level_2_long: "Sarasota County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4157687", owm_city_name: "Gulfport", owm_latitude: "27.74836", owm_longitude: "-82.70343", owm_country: "US", locality_short: "Gulfport", locality_long: "Gulfport", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Pinellas County", admin_level_2_long: "Pinellas County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4157981", owm_city_name: "Hamptons at Boca Raton", owm_latitude: "26.38258", owm_longitude: "-80.185883", owm_country: "US", locality_short: "Boca Raton", locality_long: "Boca Raton", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Palm Beach County", admin_level_2_long: "Palm Beach County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4158032", owm_city_name: "Harbor Bluffs", owm_latitude: "27.90947", owm_longitude: "-82.827599", owm_country: "US", locality_short: "Largo", locality_long: "Largo", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Pinellas County", admin_level_2_long: "Pinellas County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4158060", owm_city_name: "Harbour Heights", owm_latitude: "26.990891", owm_longitude: "-82.002312", owm_country: "US", locality_short: "Punta Gorda", locality_long: "Punta Gorda", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Charlotte County", admin_level_2_long: "Charlotte County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4158091", owm_city_name: "Harlem", owm_latitude: "26.73757", owm_longitude: "-80.950897", owm_country: "US", locality_short: "Clewiston", locality_long: "Clewiston", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Hendry County", admin_level_2_long: "Hendry County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4158094", owm_city_name: "<NAME>", owm_latitude: "26.51619", owm_longitude: "-81.927872", owm_country: "US", locality_short: "Fort Myers", locality_long: "Fort Myers", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Lee County", admin_level_2_long: "Lee County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4158296", owm_city_name: "Heathrow", owm_latitude: "28.76333", owm_longitude: "-81.372238", owm_country: "US", locality_short: "Heathrow", locality_long: "Heathrow", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Seminole County", admin_level_2_long: "Seminole County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4158445", owm_city_name: "Hernando", owm_latitude: "28.899981", owm_longitude: "-82.374542", owm_country: "US", locality_short: "Hernando", locality_long: "Hernando", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Citrus County", admin_level_2_long: "Citrus County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4158446", owm_city_name: "<NAME>", owm_latitude: "28.46944", owm_longitude: "-82.659271", owm_country: "US", locality_short: "Hernando Beach", locality_long: "Hernando Beach", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Hernando County", admin_level_2_long: "Hernando County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4158591", owm_city_name: "High Point", owm_latitude: "26.46591", owm_longitude: "-80.128098", owm_country: "US", locality_short: "Delray Beach", locality_long: "Delray Beach", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Palm Beach County", admin_level_2_long: "Palm Beach County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4158595", owm_city_name: "High Springs", owm_latitude: "29.82691", owm_longitude: "-82.596779", owm_country: "US", locality_short: "High Springs", locality_long: "High Springs", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Alachua County", admin_level_2_long: "Alachua County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4158599", owm_city_name: "Highland Beach", owm_latitude: "26.399521", owm_longitude: "-80.065598", owm_country: "US", locality_short: "Highland Beach", locality_long: "Highland Beach", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Palm Beach County", admin_level_2_long: "Palm Beach County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4158604", owm_city_name: "Highland City", owm_latitude: "27.9653", owm_longitude: "-81.877861", owm_country: "US", locality_short: "Highland City", locality_long: "Highland City", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Polk County", admin_level_2_long: "Polk County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4158668", owm_city_name: "Hill n Dale", owm_latitude: "28.51972", owm_longitude: "-82.299263", owm_country: "US", locality_short: "Brooksville", locality_long: "Brooksville", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Hernando County", admin_level_2_long: "Hernando County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4158693", owm_city_name: "Hilliard", owm_latitude: "30.691071", owm_longitude: "-81.917328", owm_country: "US", locality_short: "Hilliard", locality_long: "Hilliard", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Nassau County", admin_level_2_long: "Nassau County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4158758", owm_city_name: "<NAME>", owm_latitude: "27.0595", owm_longitude: "-80.136429", owm_country: "US", locality_short: "Hobe Sound", locality_long: "Hobe Sound", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Martin County", admin_level_2_long: "Martin County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4158844", owm_city_name: "Hold<NAME>", owm_latitude: "28.49667", owm_longitude: "-81.387848", owm_country: "US", locality_short: "Orlando", locality_long: "Orlando", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Orange County", admin_level_2_long: "Orange County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4158914", owm_city_name: "<NAME>", owm_latitude: "29.243589", owm_longitude: "-81.03756", owm_country: "US", locality_short: "Daytona Beach", locality_long: "Daytona Beach", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Volusia County", admin_level_2_long: "Volusia County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4158966", owm_city_name: "Holmes Beach", owm_latitude: "27.495319", owm_longitude: "-82.71093", owm_country: "US", locality_short: "Holmes Beach", locality_long: "Holmes Beach", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Manatee County", admin_level_2_long: "Manatee County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4159071", owm_city_name: "Homosassa", owm_latitude: "28.78137", owm_longitude: "-82.615097", owm_country: "US", locality_short: "Homosassa", locality_long: "Homosassa", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Citrus County", admin_level_2_long: "Citrus County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4159077", owm_city_name: "Homosassa Springs", owm_latitude: "28.803591", owm_longitude: "-82.575928", owm_country: "US", locality_short: "Homosassa Springs", locality_long: "Homosassa Springs", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Citrus County", admin_level_2_long: "Citrus County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4159335", owm_city_name: "Hudson", owm_latitude: "28.36445", owm_longitude: "-82.693428", owm_country: "US", locality_short: "Hudson", locality_long: "Hudson", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Pasco County", admin_level_2_long: "Pasco County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4159416", owm_city_name: "Hunters Creek", owm_latitude: "28.360559", owm_longitude: "-81.422287", owm_country: "US", locality_short: "Orlando", locality_long: "Orlando", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Orange County", admin_level_2_long: "Orange County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4159484", owm_city_name: "Hypoluxo", owm_latitude: "26.56646", owm_longitude: "-80.053368", owm_country: "US", locality_short: "Hypoluxo", locality_long: "Hypoluxo", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Palm Beach County", admin_level_2_long: "Palm Beach County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4159575", owm_city_name: "Indialantic", owm_latitude: "28.08946", owm_longitude: "-80.565613", owm_country: "US", locality_short: "Indialantic", locality_long: "Indialantic", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Brevard County", admin_level_2_long: "Brevard County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4159608", owm_city_name: "Indian Harbour Beach", owm_latitude: "28.148899", owm_longitude: "-80.588387", owm_country: "US", locality_short: "Indian Harbour Beach", locality_long: "Indian Harbour Beach", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Brevard County", admin_level_2_long: "Brevard County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4159659", owm_city_name: "Indian River Estates", owm_latitude: "27.364491", owm_longitude: "-80.309769", owm_country: "US", locality_short: "Fort Pierce", locality_long: "Fort Pierce", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "St Lucie County", admin_level_2_long: "St. Lucie County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4159672", owm_city_name: "Indian River Shores", owm_latitude: "27.7167", owm_longitude: "-80.384216", owm_country: "US", locality_short: "Vero Beach", locality_long: "Vero Beach", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Indian River County", admin_level_2_long: "Indian River County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4159675", owm_city_name: "Indian Rocks Beach", owm_latitude: "27.875299", owm_longitude: "-82.851219", owm_country: "US", locality_short: "Indian Rocks Beach", locality_long: "Indian Rocks Beach", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Pinellas County", admin_level_2_long: "Pinellas County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4159687", owm_city_name: "Indiantown", owm_latitude: "27.027281", owm_longitude: "-80.485611", owm_country: "US", locality_short: "Indiantown", locality_long: "Indiantown", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Martin County", admin_level_2_long: "Martin County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4159786", owm_city_name: "Inverness", owm_latitude: "28.835819", owm_longitude: "-82.330368", owm_country: "US", locality_short: "Inverness", locality_long: "Inverness", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Citrus County", admin_level_2_long: "Citrus County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4159796", owm_city_name: "Inwood", owm_latitude: "28.03697", owm_longitude: "-81.765083", owm_country: "US", locality_short: "Winter Haven", locality_long: "Winter Haven", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Polk County", admin_level_2_long: "Polk County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4159839", owm_city_name: "Islamorada", owm_latitude: "24.924299", owm_longitude: "-80.627838", owm_country: "US", locality_short: "Islamorada", locality_long: "Islamorada", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Monroe County", admin_level_2_long: "Monroe County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4160086", owm_city_name: "<NAME>", owm_latitude: "28.01474", owm_longitude: "-81.771751", owm_country: "US", locality_short: "Winter Haven", locality_long: "Winter Haven", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Polk County", admin_level_2_long: "Polk County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4160102", owm_city_name: "Jasper", owm_latitude: "30.51827", owm_longitude: "-82.948189", owm_country: "US", locality_short: "Jasper", locality_long: "Jasper", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Hamilton County", admin_level_2_long: "Hamilton County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4160171", owm_city_name: "<NAME>", owm_latitude: "27.25449", owm_longitude: "-80.229767", owm_country: "US", locality_short: "<NAME>ach", locality_long: "Jensen Beach", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Martin County", admin_level_2_long: "Martin County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4160570", owm_city_name: "<NAME>", owm_latitude: "28.072241", owm_longitude: "-80.680061", owm_country: "US", locality_short: "Melbourne", locality_long: "Melbourne", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Brevard County", admin_level_2_long: "Brevard County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4160604", owm_city_name: "<NAME>", owm_latitude: "26.87978", owm_longitude: "-80.053368", owm_country: "US", locality_short: "North Palm Beach", locality_long: "North Palm Beach", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Palm Beach County", admin_level_2_long: "Palm Beach County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4160651", owm_city_name: "Kathleen", owm_latitude: "28.12085", owm_longitude: "-82.02314", owm_country: "US", locality_short: "Lakeland", locality_long: "Lakeland", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Polk County", admin_level_2_long: "Polk County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4160749", owm_city_name: "Kenneth City", owm_latitude: "27.81558", owm_longitude: "-82.7201", owm_country: "US", locality_short: "Kenneth City", locality_long: "Kenneth City", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Pinellas County", admin_level_2_long: "Pinellas County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4160752", owm_city_name: "Kensington Park", owm_latitude: "27.359489", owm_longitude: "-82.49649", owm_country: "US", locality_short: "Sarasota", locality_long: "Sarasota", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Sarasota County", admin_level_2_long: "Sarasota County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4160789", owm_city_name: "Key Biscayne", owm_latitude: "25.69371", owm_longitude: "-80.162819", owm_country: "US", locality_short: "Key Biscayne", locality_long: "Key Biscayne", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Miami-Dade County", admin_level_2_long: "Miami-Dade County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4160795", owm_city_name: "Key Largo", owm_latitude: "25.086519", owm_longitude: "-80.447281", owm_country: "US", locality_short: "Key Largo", locality_long: "Key Largo", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Monroe County", admin_level_2_long: "Monroe County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4160932", owm_city_name: "Kings Point", owm_latitude: "26.445351", owm_longitude: "-80.139771", owm_country: "US", locality_short: "Delray Beach", locality_long: "Delray Beach", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Palm Beach County", admin_level_2_long: "Palm Beach County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4161075", owm_city_name: "LaBelle", owm_latitude: "26.76173", owm_longitude: "-81.438408", owm_country: "US", locality_short: "LaBelle", locality_long: "LaBelle", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Hendry County", admin_level_2_long: "Hendry County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4161118", owm_city_name: "Lady Lake", owm_latitude: "28.91749", owm_longitude: "-81.922859", owm_country: "US", locality_short: "Lady Lake", locality_long: "Lady Lake", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Lake County", admin_level_2_long: "Lake County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4161141", owm_city_name: "Laguna Beach", owm_latitude: "30.239651", owm_longitude: "-85.924103", owm_country: "US", locality_short: "Panama City Beach", locality_long: "Panama City Beach", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Bay County", admin_level_2_long: "Bay County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4161150", owm_city_name: "Lake Alfred", owm_latitude: "28.091961", owm_longitude: "-81.723412", owm_country: "US", locality_short: "Lake Alfred", locality_long: "Lake Alfred", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Polk County", admin_level_2_long: "Polk County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4161161", owm_city_name: "Lake Belvedere Estates", owm_latitude: "26.68923", owm_longitude: "-80.133377", owm_country: "US", locality_short: "West Palm Beach", locality_long: "West Palm Beach", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Palm Beach County", admin_level_2_long: "Palm Beach County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4161187", owm_city_name: "Lake City", owm_latitude: "30.18968", owm_longitude: "-82.63929", owm_country: "US", locality_short: "Lake City", locality_long: "Lake City", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Columbia County", admin_level_2_long: "Columbia County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4161195", owm_city_name: "Lake Clarke Shores", owm_latitude: "26.64534", owm_longitude: "-80.075882", owm_country: "US", locality_short: "West Palm Beach", locality_long: "West Palm Beach", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Palm Beach County", admin_level_2_long: "Palm Beach County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4161228", owm_city_name: "Lake Forest", owm_latitude: "25.977591", owm_longitude: "-80.183098", owm_country: "US", locality_short: "West Park", locality_long: "West Park", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Broward County", admin_level_2_long: "Broward County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4161254", owm_city_name: "Lake Helen", owm_latitude: "28.98082", owm_longitude: "-81.233391", owm_country: "US", locality_short: "Lake Helen", locality_long: "Lake Helen", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Volusia County", admin_level_2_long: "Volusia County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4161296", owm_city_name: "Lake Lorraine", owm_latitude: "30.441589", owm_longitude: "-86.565231", owm_country: "US", locality_short: "Shalimar", locality_long: "Shalimar", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Okaloosa County", admin_level_2_long: "Okaloosa County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4161298", owm_city_name: "Lake Lucerne", owm_latitude: "25.96509", owm_longitude: "-80.24144", owm_country: "US", locality_short: "Miami Gardens", locality_long: "Miami Gardens", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Miami-Dade County", admin_level_2_long: "Miami-Dade County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4161327", owm_city_name: "Lake Panasoffkee", owm_latitude: "28.755819", owm_longitude: "-82.09481", owm_country: "US", locality_short: "Lake Panasoffkee", locality_long: "Lake Panasoffkee", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Sumter County", admin_level_2_long: "Sumter County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4161334", owm_city_name: "Lake Park", owm_latitude: "26.800341", owm_longitude: "-80.066429", owm_country: "US", locality_short: "Lake Park", locality_long: "Lake Park", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Palm Beach County", admin_level_2_long: "Palm Beach County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4161344", owm_city_name: "Lake Placid", owm_latitude: "27.2931", owm_longitude: "-81.362846", owm_country: "US", locality_short: "Lake Placid", locality_long: "Lake Placid", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Highlands County", admin_level_2_long: "Highlands County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4161352", owm_city_name: "Lake Sarasota", owm_latitude: "27.292549", owm_longitude: "-82.437599", owm_country: "US", locality_short: "Sarasota", locality_long: "Sarasota", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Sarasota County", admin_level_2_long: "Sarasota County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4161373", owm_city_name: "Lake Mary", owm_latitude: "28.758881", owm_longitude: "-81.317841", owm_country: "US", locality_short: "Lake Mary", locality_long: "Lake Mary", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Seminole County", admin_level_2_long: "Seminole County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4161400", owm_city_name: "Lake Wales", owm_latitude: "27.901409", owm_longitude: "-81.585907", owm_country: "US", locality_short: "Lake Wales", locality_long: "Lake Wales", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Polk County", admin_level_2_long: "Polk County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4161444", owm_city_name: "Lakeland Highlands", owm_latitude: "27.959749", owm_longitude: "-81.950081", owm_country: "US", locality_short: "Lakeland", locality_long: "Lakeland", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Polk County", admin_level_2_long: "Polk County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4161460", owm_city_name: "Lakes by the Bay", owm_latitude: "25.57233", owm_longitude: "-80.325333", owm_country: "US", locality_short: "Cutler Bay", locality_long: "Cutler Bay", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Miami-Dade County", admin_level_2_long: "Miami-Dade County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4161474", owm_city_name: "Lakeside Green", owm_latitude: "26.739229", owm_longitude: "-80.114487", owm_country: "US", locality_short: "West Palm Beach", locality_long: "West Palm Beach", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Palm Beach County", admin_level_2_long: "Palm Beach County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4161510", owm_city_name: "Lakewood Park", owm_latitude: "27.543091", owm_longitude: "-80.402267", owm_country: "US", locality_short: "Fort Pierce", locality_long: "Fort Pierce", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "St Lucie County", admin_level_2_long: "St. Lucie County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4161571", owm_city_name: "Lantana", owm_latitude: "26.58674", owm_longitude: "-80.051987", owm_country: "US", locality_short: "Lantana", locality_long: "Lantana", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Palm Beach County", admin_level_2_long: "Palm Beach County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4161624", owm_city_name: "Lauderdale-by-the-Sea", owm_latitude: "26.19203", owm_longitude: "-80.096428", owm_country: "US", locality_short: "Lauderdale-By-The-Sea", locality_long: "Lauderdale-by-the-Sea", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Broward County", admin_level_2_long: "Broward County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4161659", owm_city_name: "Laurel", owm_latitude: "27.14378", owm_longitude: "-82.461578", owm_country: "US", locality_short: "Nokomis", locality_long: "Nokomis", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Sarasota County", admin_level_2_long: "Sarasota County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4161733", owm_city_name: "Lecanto", owm_latitude: "28.85165", owm_longitude: "-82.487602", owm_country: "US", locality_short: "Lecanto", locality_long: "Lecanto", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Citrus County", admin_level_2_long: "Citrus County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4161807", owm_city_name: "Lely", owm_latitude: "26.100651", owm_longitude: "-81.728416", owm_country: "US", locality_short: "Naples", locality_long: "Naples", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Collier County", admin_level_2_long: "Collier County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4161810", owm_city_name: "<NAME>", owm_latitude: "26.080931", owm_longitude: "-81.697861", owm_country: "US", locality_short: "Naples", locality_long: "Naples", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Collier County", admin_level_2_long: "Collier County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4161957", owm_city_name: "Lighthouse Point", owm_latitude: "26.27564", owm_longitude: "-80.087273", owm_country: "US", locality_short: "Lighthouse Point", locality_long: "Lighthouse Point", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Broward County", admin_level_2_long: "Broward County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4162461", owm_city_name: "Live Oak", owm_latitude: "30.29495", owm_longitude: "-82.984016", owm_country: "US", locality_short: "Live Oak", locality_long: "Live Oak", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Suwannee County", admin_level_2_long: "Suwannee County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4162532", owm_city_name: "Lochmoor Waterway Estates", owm_latitude: "26.644239", owm_longitude: "-81.909813", owm_country: "US", locality_short: "North Fort Myers", locality_long: "North Fort Myers", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Lee County", admin_level_2_long: "Lee County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4162539", owm_city_name: "Lockhart", owm_latitude: "28.61944", owm_longitude: "-81.442574", owm_country: "US", locality_short: "Lockhart", locality_long: "Lockhart", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Orange County", admin_level_2_long: "Orange County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4162776", owm_city_name: "Longboat Key", owm_latitude: "27.41254", owm_longitude: "-82.658989", owm_country: "US", locality_short: "Longboat Key", locality_long: "Longboat Key", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Manatee County", admin_level_2_long: "Manatee County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4162783", owm_city_name: "Longwood", owm_latitude: "28.703051", owm_longitude: "-81.338402", owm_country: "US", locality_short: "Longwood", locality_long: "Longwood", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Seminole County", admin_level_2_long: "Seminole County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4162856", owm_city_name: "Loughman", owm_latitude: "28.241961", owm_longitude: "-81.566742", owm_country: "US", locality_short: "Davenport", locality_long: "Davenport", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Polk County", admin_level_2_long: "Polk County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4162911", owm_city_name: "Lower Grand Lagoon", owm_latitude: "30.144091", owm_longitude: "-85.750763", owm_country: "US", locality_short: "Panama City Beach", locality_long: "Panama City Beach", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Bay County", admin_level_2_long: "Bay County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4162948", owm_city_name: "Loxahatchee Groves", owm_latitude: "26.68368", owm_longitude: "-80.27977", owm_country: "US", locality_short: "Loxahatchee", locality_long: "Loxahatchee", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Palm Beach County", admin_level_2_long: "Palm Beach County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4163083", owm_city_name: "Macclenny", owm_latitude: "30.282181", owm_longitude: "-82.122063", owm_country: "US", locality_short: "Macclenny", locality_long: "Macclenny", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Baker County", admin_level_2_long: "Baker County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4163129", owm_city_name: "<NAME>", owm_latitude: "27.79808", owm_longitude: "-82.797318", owm_country: "US", locality_short: "<NAME>", locality_long: "<NAME>", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Pinellas County", admin_level_2_long: "Pinellas County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4163140", owm_city_name: "Madison", owm_latitude: "30.469379", owm_longitude: "-83.412933", owm_country: "US", locality_short: "Madison", locality_long: "Madison", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Madison County", admin_level_2_long: "Madison County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4163232", owm_city_name: "Malabar", owm_latitude: "28.00363", owm_longitude: "-80.565613", owm_country: "US", locality_short: "Malabar", locality_long: "Malabar", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Brevard County", admin_level_2_long: "Brevard County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4163248", owm_city_name: "Malone", owm_latitude: "30.957689", owm_longitude: "-85.162148", owm_country: "US", locality_short: "Malone", locality_long: "Malone", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Jackson County", admin_level_2_long: "Jackson County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4163296", owm_city_name: "<NAME>", owm_latitude: "29.51302", owm_longitude: "-82.914291", owm_country: "US", locality_short: "Chiefland", locality_long: "Chiefland", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Levy County", admin_level_2_long: "Levy County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4163318", owm_city_name: "Mango", owm_latitude: "27.97974", owm_longitude: "-82.30648", owm_country: "US", locality_short: "Seffner", locality_long: "Seffner", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Hillsborough County", admin_level_2_long: "Hillsborough County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4163379", owm_city_name: "Marathon", owm_latitude: "24.713751", owm_longitude: "-81.090347", owm_country: "US", locality_short: "Marathon", locality_long: "Marathon", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Monroe County", admin_level_2_long: "Monroe County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4163384", owm_city_name: "Marco", owm_latitude: "25.972601", owm_longitude: "-81.728981", owm_country: "US", locality_short: "Marco Island", locality_long: "Marco Island", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Collier County", admin_level_2_long: "Collier County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4163428", owm_city_name: "Marianna", owm_latitude: "30.774361", owm_longitude: "-85.226868", owm_country: "US", locality_short: "Marianna", locality_long: "Marianna", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Jackson County", admin_level_2_long: "Jackson County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4163599", owm_city_name: "<NAME>", owm_latitude: "30.40992", owm_longitude: "-86.66301", owm_country: "US", locality_short: "<NAME>", locality_long: "<NAME>", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Okaloosa County", admin_level_2_long: "Okaloosa County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4163635", owm_city_name: "Mascotte", owm_latitude: "28.578329", owm_longitude: "-81.886749", owm_country: "US", locality_short: "Mascotte", locality_long: "Mascotte", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Lake County", admin_level_2_long: "Lake County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4163833", owm_city_name: "McGregor", owm_latitude: "26.560909", owm_longitude: "-81.914528", owm_country: "US", locality_short: "Fort Myers", locality_long: "Fort Myers", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Lee County", admin_level_2_long: "Lee County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4163954", owm_city_name: "Medulla", owm_latitude: "27.9678", owm_longitude: "-81.973419", owm_country: "US", locality_short: "Lakeland", locality_long: "Lakeland", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Polk County", admin_level_2_long: "Polk County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4163972", owm_city_name: "Melbourne Beach", owm_latitude: "28.06835", owm_longitude: "-80.560333", owm_country: "US", locality_short: "Melbourne Beach", locality_long: "Melbourne Beach", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Brevard County", admin_level_2_long: "Brevard County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4163994", owm_city_name: "Melrose Park", owm_latitude: "26.11342", owm_longitude: "-80.193382", owm_country: "US", locality_short: "Fort Lauderdale", locality_long: "Fort Lauderdale", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Broward County", admin_level_2_long: "Broward County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4164047", owm_city_name: "Memphis", owm_latitude: "27.53587", owm_longitude: "-82.561211", owm_country: "US", locality_short: "Palmetto", locality_long: "Palmetto", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Manatee County", admin_level_2_long: "Manatee County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4164166", owm_city_name: "Miami Gardens", owm_latitude: "25.979811", owm_longitude: "-80.202553", owm_country: "US", locality_short: "West Park", locality_long: "West Park", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Broward County", admin_level_2_long: "Broward County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4164211", owm_city_name: "Miami Shores", owm_latitude: "25.86315", owm_longitude: "-80.192833", owm_country: "US", locality_short: "Miami Shores", locality_long: "Miami Shores", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Miami-Dade County", admin_level_2_long: "Miami-Dade County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4164223", owm_city_name: "Miami Springs", owm_latitude: "25.822321", owm_longitude: "-80.289497", owm_country: "US", locality_short: "Miami Springs", locality_long: "Miami Springs", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Miami-Dade County", admin_level_2_long: "Miami-Dade County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4164253", owm_city_name: "Micco", owm_latitude: "27.880581", owm_longitude: "-80.500328", owm_country: "US", locality_short: "Micco", locality_long: "Micco", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Brevard County", admin_level_2_long: "Brevard County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4164343", owm_city_name: "Midway", owm_latitude: "30.49548", owm_longitude: "-84.454353", owm_country: "US", locality_short: "Midway", locality_long: "Midway", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Gadsden County", admin_level_2_long: "Gadsden County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4164387", owm_city_name: "Middleburg", owm_latitude: "30.06885", owm_longitude: "-81.860382", owm_country: "US", locality_short: "Middleburg", locality_long: "Middleburg", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Clay County", admin_level_2_long: "Clay County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4164547", owm_city_name: "Milton", owm_latitude: "30.63241", owm_longitude: "-87.039688", owm_country: "US", locality_short: "Milton", locality_long: "Milton", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Santa Rosa County", admin_level_2_long: "Santa Rosa County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4164554", owm_city_name: "Mims", owm_latitude: "28.66527", owm_longitude: "-80.84478", owm_country: "US", locality_short: "Mims", locality_long: "Mims", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Brevard County", admin_level_2_long: "Brevard County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4164575", owm_city_name: "Minneola", owm_latitude: "28.57444", owm_longitude: "-81.746193", owm_country: "US", locality_short: "Minneola", locality_long: "Minneola", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Lake County", admin_level_2_long: "Lake County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4164602", owm_city_name: "<NAME>", owm_latitude: "30.374371", owm_longitude: "-86.358559", owm_country: "US", locality_short: "Miramar Beach", locality_long: "Miramar Beach", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Walton County", admin_level_2_long: "Walton County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4164632", owm_city_name: "Mission Bay", owm_latitude: "26.370081", owm_longitude: "-80.20977", owm_country: "US", locality_short: "Boca Raton", locality_long: "Boca Raton", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Palm Beach County", admin_level_2_long: "Palm Beach County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4164803", owm_city_name: "Monticello", owm_latitude: "30.5452", owm_longitude: "-83.870163", owm_country: "US", locality_short: "Monticello", locality_long: "Monticello", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Jefferson County", admin_level_2_long: "Jefferson County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4165069", owm_city_name: "Mount Dora", owm_latitude: "28.80249", owm_longitude: "-81.644524", owm_country: "US", locality_short: "Mt Dora", locality_long: "Mount Dora", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Lake County", admin_level_2_long: "Lake County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4165218", owm_city_name: "Mount Plymouth", owm_latitude: "28.80805", owm_longitude: "-81.533127", owm_country: "US", locality_short: "Mt Plymouth", locality_long: "Mount Plymouth", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Lake County", admin_level_2_long: "Lake County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4165419", owm_city_name: "Mulberry", owm_latitude: "27.8953", owm_longitude: "-81.973419", owm_country: "US", locality_short: "Mulberry", locality_long: "Mulberry", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Polk County", admin_level_2_long: "Polk County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4165574", owm_city_name: "Naples Manor", owm_latitude: "26.088699", owm_longitude: "-81.726196", owm_country: "US", locality_short: "Naples", locality_long: "Naples", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Collier County", admin_level_2_long: "Collier County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4165576", owm_city_name: "Naples Park", owm_latitude: "26.261749", owm_longitude: "-81.80925", owm_country: "US", locality_short: "Naples", locality_long: "Naples", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Collier County", admin_level_2_long: "Collier County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4165580", owm_city_name: "Naranja", owm_latitude: "25.51816", owm_longitude: "-80.422829", owm_country: "US", locality_short: "Naranja", locality_long: "Naranja", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Miami-Dade County", admin_level_2_long: "Miami-Dade County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4165695", owm_city_name: "Neptune Beach", owm_latitude: "30.311911", owm_longitude: "-81.396469", owm_country: "US", locality_short: "Neptune Beach", locality_long: "Neptune Beach", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Duval County", admin_level_2_long: "Duval County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4165869", owm_city_name: "New Port Richey", owm_latitude: "28.244181", owm_longitude: "-82.719269", owm_country: "US", locality_short: "New Port Richey", locality_long: "New Port Richey", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Pasco County", admin_level_2_long: "Pasco County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4165961", owm_city_name: "Newberry", owm_latitude: "29.646351", owm_longitude: "-82.606499", owm_country: "US", locality_short: "Newberry", locality_long: "Newberry", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Alachua County", admin_level_2_long: "Alachua County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4165995", owm_city_name: "Niceville", owm_latitude: "30.516859", owm_longitude: "-86.48217", owm_country: "US", locality_short: "Niceville", locality_long: "Niceville", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Okaloosa County", admin_level_2_long: "Okaloosa County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4166047", owm_city_name: "Nocatee", owm_latitude: "27.16033", owm_longitude: "-81.882309", owm_country: "US", locality_short: "Arcadia", locality_long: "Arcadia", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Desoto County", admin_level_2_long: "DeSoto County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4166049", owm_city_name: "Nokomis", owm_latitude: "27.119221", owm_longitude: "-82.44426", owm_country: "US", locality_short: "Nokomis", locality_long: "Nokomis", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Sarasota County", admin_level_2_long: "Sarasota County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4166096", owm_city_name: "North Andrews Gardens", owm_latitude: "26.191469", owm_longitude: "-80.144211", owm_country: "US", locality_short: "Fort Lauderdale", locality_long: "Fort Lauderdale", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Broward County", admin_level_2_long: "Broward County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4166105", owm_city_name: "North Bay Village", owm_latitude: "25.84621", owm_longitude: "-80.153938", owm_country: "US", locality_short: "North Bay Village", locality_long: "North Bay Village", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Miami-Dade County", admin_level_2_long: "Miami-Dade County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4166124", owm_city_name: "North Brooksville", owm_latitude: "28.57305", owm_longitude: "-82.40815", owm_country: "US", locality_short: "Brooksville", locality_long: "Brooksville", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Hernando County", admin_level_2_long: "Hernando County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4166253", owm_city_name: "North Palm Beach", owm_latitude: "26.81756", owm_longitude: "-80.081993", owm_country: "US", locality_short: "Palm Beach Gardens", locality_long: "Palm Beach Gardens", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Palm Beach County", admin_level_2_long: "Palm Beach County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4166293", owm_city_name: "North River Shores", owm_latitude: "27.21755", owm_longitude: "-80.269768", owm_country: "US", locality_short: "Stuart", locality_long: "Stuart", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Martin County", admin_level_2_long: "Martin County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4166298", owm_city_name: "North Sarasota", owm_latitude: "27.37393", owm_longitude: "-82.518433", owm_country: "US", locality_short: "Sarasota", locality_long: "Sarasota", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Sarasota County", admin_level_2_long: "Sarasota County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4166628", owm_city_name: "Oakland", owm_latitude: "28.555", owm_longitude: "-81.633133", owm_country: "US", locality_short: "Oakland", locality_long: "Oakland", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Orange County", admin_level_2_long: "Orange County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4166723", owm_city_name: "Ocean City", owm_latitude: "30.441031", owm_longitude: "-86.613564", owm_country: "US", locality_short: "Fort Walton Beach", locality_long: "Fort Walton Beach", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Okaloosa County", admin_level_2_long: "Okaloosa County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4166787", owm_city_name: "Odessa", owm_latitude: "28.193899", owm_longitude: "-82.591759", owm_country: "US", locality_short: "Odessa", locality_long: "Odessa", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Pasco County", admin_level_2_long: "Pasco County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4166822", owm_city_name: "Okeechobee", owm_latitude: "27.243931", owm_longitude: "-80.829781", owm_country: "US", locality_short: "Okeechobee", locality_long: "Okeechobee", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Okeechobee County", admin_level_2_long: "Okeechobee County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4166936", owm_city_name: "Oldsmar", owm_latitude: "28.03418", owm_longitude: "-82.6651", owm_country: "US", locality_short: "Oldsmar", locality_long: "Oldsmar", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Pinellas County", admin_level_2_long: "Pinellas County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4166943", owm_city_name: "Olga", owm_latitude: "26.71896", owm_longitude: "-81.712303", owm_country: "US", locality_short: "Fort Myers", locality_long: "Fort Myers", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Lee County", admin_level_2_long: "Lee County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4166979", owm_city_name: "Olympia Heights", owm_latitude: "25.72677", owm_longitude: "-80.355331", owm_country: "US", locality_short: "Olympia Heights", locality_long: "Olympia Heights", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Miami-Dade County", admin_level_2_long: "Miami-Dade County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4167055", owm_city_name: "Orange City", owm_latitude: "28.948879", owm_longitude: "-81.298668", owm_country: "US", locality_short: "Orange City", locality_long: "Orange City", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Volusia County", admin_level_2_long: "Volusia County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4167102", owm_city_name: "Orange Park", owm_latitude: "30.166071", owm_longitude: "-81.706482", owm_country: "US", locality_short: "Orange Park", locality_long: "Orange Park", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Clay County", admin_level_2_long: "Clay County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4167127", owm_city_name: "Orangetree", owm_latitude: "26.29286", owm_longitude: "-81.588417", owm_country: "US", locality_short: "Naples", locality_long: "Naples", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Collier County", admin_level_2_long: "Collier County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4167176", owm_city_name: "Orlovista", owm_latitude: "28.53834", owm_longitude: "-81.46035", owm_country: "US", locality_short: "Orlando", locality_long: "Orlando", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Orange County", admin_level_2_long: "Orange County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4167190", owm_city_name: "Ormond-by-the-Sea", owm_latitude: "29.34914", owm_longitude: "-81.066452", owm_country: "US", locality_short: "Ormond Beach", locality_long: "Ormond Beach", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Volusia County", admin_level_2_long: "Volusia County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4167245", owm_city_name: "Osprey", owm_latitude: "27.196159", owm_longitude: "-82.490372", owm_country: "US", locality_short: "Osprey", locality_long: "Osprey", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Sarasota County", admin_level_2_long: "Sarasota County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4167473", owm_city_name: "Pahokee", owm_latitude: "26.820061", owm_longitude: "-80.665337", owm_country: "US", locality_short: "Pahokee", locality_long: "Pahokee", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Palm Beach County", admin_level_2_long: "Palm Beach County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4167482", owm_city_name: "Palatka", owm_latitude: "29.648581", owm_longitude: "-81.637581", owm_country: "US", locality_short: "Palatka", locality_long: "Palatka", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Putnam County", admin_level_2_long: "Putnam County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4167505", owm_city_name: "Palm Beach", owm_latitude: "26.70562", owm_longitude: "-80.03643", owm_country: "US", locality_short: "Palm Beach", locality_long: "Palm Beach", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Palm Beach County", admin_level_2_long: "Palm Beach County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4167594", owm_city_name: "Palm Springs North", owm_latitude: "25.935101", owm_longitude: "-80.333832", owm_country: "US", locality_short: "Hialeah", locality_long: "Hialeah", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Miami-Dade County", admin_level_2_long: "Miami-Dade County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4167632", owm_city_name: "Palmetto", owm_latitude: "27.521429", owm_longitude: "-82.572319", owm_country: "US", locality_short: "Palmetto", locality_long: "Palmetto", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Manatee County", admin_level_2_long: "Manatee County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4167647", owm_city_name: "Palmetto Estates", owm_latitude: "25.62149", owm_longitude: "-80.362", owm_country: "US", locality_short: "Miami", locality_long: "Miami", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Miami-Dade County", admin_level_2_long: "Miami-Dade County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4167695", owm_city_name: "Panama City Beach", owm_latitude: "30.17659", owm_longitude: "-85.805489", owm_country: "US", locality_short: "Panama City Beach", locality_long: "Panama City Beach", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Bay County", admin_level_2_long: "Bay County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4167797", owm_city_name: "Parker", owm_latitude: "30.131041", owm_longitude: "-85.603256", owm_country: "US", locality_short: "Panama City", locality_long: "Panama City", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Bay County", admin_level_2_long: "Bay County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4168062", owm_city_name: "Pebble Creek", owm_latitude: "28.14835", owm_longitude: "-82.34565", owm_country: "US", locality_short: "Tampa", locality_long: "Tampa", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Hillsborough County", admin_level_2_long: "Hillsborough County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4168095", owm_city_name: "Pelican Bay", owm_latitude: "26.231199", owm_longitude: "-81.805641", owm_country: "US", locality_short: "Naples", locality_long: "Naples", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Collier County", admin_level_2_long: "Collier County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4168138", owm_city_name: "Pembroke Park", owm_latitude: "25.987869", owm_longitude: "-80.174767", owm_country: "US", locality_short: "Hallandale Beach", locality_long: "Hallandale Beach", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Broward County", admin_level_2_long: "Broward County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4168244", owm_city_name: "Perry", owm_latitude: "30.117439", owm_longitude: "-83.58181", owm_country: "US", locality_short: "Perry", locality_long: "Perry", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Taylor County", admin_level_2_long: "Taylor County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4168418", owm_city_name: "Pine Castle", owm_latitude: "28.471951", owm_longitude: "-81.367851", owm_country: "US", locality_short: "Pine Castle", locality_long: "Pine Castle", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Orange County", admin_level_2_long: "Orange County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4168506", owm_city_name: "Pine Island Ridge", owm_latitude: "26.09481", owm_longitude: "-80.273941", owm_country: "US", locality_short: "Davie", locality_long: "Davie", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Broward County", admin_level_2_long: "Broward County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4168556", owm_city_name: "<NAME>", owm_latitude: "26.572849", owm_longitude: "-81.878143", owm_country: "US", locality_short: "Fort Myers", locality_long: "Fort Myers", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Lee County", admin_level_2_long: "Lee County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4168563", owm_city_name: "<NAME>", owm_latitude: "28.938311", owm_longitude: "-82.473427", owm_country: "US", locality_short: "Beverly Hills", locality_long: "Beverly Hills", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Citrus County", admin_level_2_long: "Citrus County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4168564", owm_city_name: "Pine Ridge", owm_latitude: "26.23064", owm_longitude: "-81.795921", owm_country: "US", locality_short: "Naples", locality_long: "Naples", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Collier County", admin_level_2_long: "Collier County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4168761", owm_city_name: "Placid Lakes", owm_latitude: "27.24144", owm_longitude: "-81.407021", owm_country: "US", locality_short: "Lake Placid", locality_long: "Lake Placid", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Highlands County", admin_level_2_long: "Highlands County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4168784", owm_city_name: "Plantation", owm_latitude: "27.06811", owm_longitude: "-82.372871", owm_country: "US", locality_short: "Venice", locality_long: "Venice", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Sarasota County", admin_level_2_long: "Sarasota County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4169018", owm_city_name: "Pompano Beach Highlands", owm_latitude: "26.28286", owm_longitude: "-80.106987", owm_country: "US", locality_short: "Pompano Beach", locality_long: "Pompano Beach", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Broward County", admin_level_2_long: "Broward County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4169033", owm_city_name: "Ponce Inlet", owm_latitude: "29.096371", owm_longitude: "-80.936996", owm_country: "US", locality_short: "Ponce Inlet", locality_long: "Ponce Inlet", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Volusia County", admin_level_2_long: "Volusia County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4169144", owm_city_name: "Port LaBelle", owm_latitude: "26.756451", owm_longitude: "-81.405083", owm_country: "US", locality_short: "LaBelle", locality_long: "LaBelle", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Hendry County", admin_level_2_long: "Hendry County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4169160", owm_city_name: "Port Richey", owm_latitude: "28.271681", owm_longitude: "-82.719551", owm_country: "US", locality_short: "Port Richey", locality_long: "Port Richey", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Pasco County", admin_level_2_long: "Pasco County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4169166", owm_city_name: "Port Saint Joe", owm_latitude: "29.81188", owm_longitude: "-85.302971", owm_country: "US", locality_short: "Port St Joe", locality_long: "Port Saint Joe", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Gulf County", admin_level_2_long: "Gulf County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4169170", owm_city_name: "Port Saint John", owm_latitude: "28.47695", owm_longitude: "-80.788673", owm_country: "US", locality_short: "Cocoa", locality_long: "Cocoa", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Brevard County", admin_level_2_long: "Brevard County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4169176", owm_city_name: "Port Salerno", owm_latitude: "27.14422", owm_longitude: "-80.2006", owm_country: "US", locality_short: "Stuart", locality_long: "Stuart", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Martin County", admin_level_2_long: "Martin County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4169378", owm_city_name: "Progress Village", owm_latitude: "27.900299", owm_longitude: "-82.36454", owm_country: "US", locality_short: "Tampa", locality_long: "Tampa", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Hillsborough County", admin_level_2_long: "Hillsborough County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4169510", owm_city_name: "Quincy", owm_latitude: "30.587139", owm_longitude: "-84.583252", owm_country: "US", locality_short: "Quincy", locality_long: "Quincy", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Gadsden County", admin_level_2_long: "Gadsden County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4169811", owm_city_name: "Redington Shores", owm_latitude: "27.826139", owm_longitude: "-82.828987", owm_country: "US", locality_short: "Redington Shores", locality_long: "Redington Shores", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Pinellas County", admin_level_2_long: "Pinellas County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4170000", owm_city_name: "Richmond Heights", owm_latitude: "25.631491", owm_longitude: "-80.368942", owm_country: "US", locality_short: "Miami", locality_long: "Miami", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Miami-Dade County", admin_level_2_long: "Miami-Dade County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4170014", owm_city_name: "Ridge Manor", owm_latitude: "28.5075", owm_longitude: "-82.170357", owm_country: "US", locality_short: "Ridge Manor", locality_long: "Ridge Manor", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Hernando County", admin_level_2_long: "Hernando County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4170018", owm_city_name: "Ridge Wood Heights", owm_latitude: "27.28727", owm_longitude: "-82.513153", owm_country: "US", locality_short: "Sarasota", locality_long: "Sarasota", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Sarasota County", admin_level_2_long: "Sarasota County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4170019", owm_city_name: "Ridgecrest", owm_latitude: "27.89724", owm_longitude: "-82.803436", owm_country: "US", locality_short: "Seminole", locality_long: "Seminole", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Pinellas County", admin_level_2_long: "Pinellas County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4170092", owm_city_name: "River Park", owm_latitude: "27.314211", owm_longitude: "-80.347267", owm_country: "US", locality_short: "Port St Lucie", locality_long: "Port St. Lucie", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "St Lucie County", admin_level_2_long: "St. Lucie County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4170301", owm_city_name: "Rock Island", owm_latitude: "26.15509", owm_longitude: "-80.176987", owm_country: "US", locality_short: "Fort Lauderdale", locality_long: "Fort Lauderdale", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Broward County", admin_level_2_long: "Broward County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4170556", owm_city_name: "Rotonda", owm_latitude: "26.88368", owm_longitude: "-82.290092", owm_country: "US", locality_short: "Rotonda West", locality_long: "Rotonda West", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Charlotte County", admin_level_2_long: "Charlotte County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4170625", owm_city_name: "Royal Palm Estates", owm_latitude: "26.68173", owm_longitude: "-80.125038", owm_country: "US", locality_short: "West Palm Beach", locality_long: "West Palm Beach", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Palm Beach County", admin_level_2_long: "Palm Beach County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4170894", owm_city_name: "Saint Augustine", owm_latitude: "29.89469", owm_longitude: "-81.314522", owm_country: "US", locality_short: "St. Augustine", locality_long: "St. Augustine", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "St Johns County", admin_level_2_long: "St. Johns County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4170896", owm_city_name: "Saint Augustine Beach", owm_latitude: "29.850531", owm_longitude: "-81.26535", owm_country: "US", locality_short: "St. Augustine", locality_long: "St. Augustine", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "St Johns County", admin_level_2_long: "St. Johns County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4170908", owm_city_name: "Saint Augustine Shores", owm_latitude: "29.810801", owm_longitude: "-81.310349", owm_country: "US", locality_short: "St. Augustine", locality_long: "St. Augustine", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "St Johns County", admin_level_2_long: "St. Johns County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4171010", owm_city_name: "Saint George", owm_latitude: "28.05641", owm_longitude: "-82.727882", owm_country: "US", locality_short: "Palm Harbor", locality_long: "Palm Harbor", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Pinellas County", admin_level_2_long: "Pinellas County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4171061", owm_city_name: "Saint James City", owm_latitude: "26.49758", owm_longitude: "-82.07843", owm_country: "US", locality_short: "St James City", locality_long: "Saint James City", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Lee County", admin_level_2_long: "Lee County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4171522", owm_city_name: "Saint Pete Beach", owm_latitude: "27.725309", owm_longitude: "-82.741211", owm_country: "US", locality_short: "St Pete Beach", locality_long: "Saint Pete Beach", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Pinellas County", admin_level_2_long: "Pinellas County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4171741", owm_city_name: "Samoset", owm_latitude: "27.469481", owm_longitude: "-82.541489", owm_country: "US", locality_short: "Bradenton", locality_long: "Bradenton", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Manatee County", admin_level_2_long: "Manatee County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4172052", owm_city_name: "Sanibel", owm_latitude: "26.448971", owm_longitude: "-82.022308", owm_country: "US", locality_short: "Sanibel", locality_long: "Sanibel", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Lee County", admin_level_2_long: "Lee County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4172150", owm_city_name: "Sarasota Springs", owm_latitude: "27.308941", owm_longitude: "-82.479538", owm_country: "US", locality_short: "Sarasota", locality_long: "Sarasota", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Sarasota County", admin_level_2_long: "Sarasota County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4172173", owm_city_name: "Satellite Beach", owm_latitude: "28.176121", owm_longitude: "-80.59005", owm_country: "US", locality_short: "Satellite Beach", locality_long: "Satellite Beach", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Brevard County", admin_level_2_long: "Brevard County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4172206", owm_city_name: "Sawgrass", owm_latitude: "30.192739", owm_longitude: "-81.370644", owm_country: "US", locality_short: "Ponte Vedra Beach", locality_long: "Ponte Vedra Beach", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "St Johns County", admin_level_2_long: "St. Johns County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4172294", owm_city_name: "<NAME>", owm_latitude: "25.941481", owm_longitude: "-80.231987", owm_country: "US", locality_short: "Miami Gardens", locality_long: "Miami Gardens", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Miami-Dade County", admin_level_2_long: "Miami-Dade County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() }, { owm_city_id: "4172366", owm_city_name: "Seaside", owm_latitude: "30.32103", owm_longitude: "-86.141609", owm_country: "US", locality_short: "Santa Rosa Beach", locality_long: "Santa Rosa Beach", admin_level_1_short: "FL", admin_level_1_long: "Florida", admin_level_2_short: "Walton County", admin_level_2_long: "Walton County", admin_level_3_short: null, admin_level_3_long: null, admin_level_4_short: null, admin_level_4_long: null, admin_level_5_short: null, admin_level_5_long: null, country_short: "US", country_long: "United States", postal_code: null, created_date: new Date(), modified_date: new Date() } ], { updateOnDuplicate: ["owm_city_name", "owm_latitude", "owm_longitude", "owm_country", "locality_short", "locality_long", "admin_level_1_short", "admin_level_1_long", "admin_level_2_short", "admin_level_2_long", "admin_level_3_short", "admin_level_3_long", "admin_level_4_short", "admin_level_4_long", "admin_level_5_short", "admin_level_5_long", "country_short", "country_long", "postal_code"] }).catch(function (err) { if (err && err.errors) { for (var i = 0; i < err.errors.length; i++) { console.error("× SEED ERROR", err.errors[i].type, err.errors[i].message, err.errors[i].path, err.errors[i].value); } } else if (err && err.message) { console.error("× SEED ERROR", err.message); } }); }, down: function (queryInterface) { return queryInterface.bulkDelete("owm_city_list", null, {}); } };
serban-petrescu/swbo
src/main/java/spet/sbwo/api/service/base/BaseService.java
<reponame>serban-petrescu/swbo package spet.sbwo.api.service.base; import org.apache.cxf.phase.PhaseInterceptorChain; import spet.sbwo.control.ControlError; import spet.sbwo.control.ControlException; import spet.sbwo.data.DatabaseException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; import javax.ws.rs.InternalServerErrorException; import javax.ws.rs.NotFoundException; import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.Response; import java.util.UUID; public abstract class BaseService { public static final String X_CSRF_TOKEN_HEADER = "X-CSRF-TOKEN"; public static final String X_CSRF_TOKEN_HEADER_FETCH = "Fetch"; public static String getOrCreateCsrfToken(HttpSession session) { String token; if (session.getAttribute(X_CSRF_TOKEN_HEADER) != null) { token = (String) session.getAttribute(X_CSRF_TOKEN_HEADER); } else { token = UUID.randomUUID().toString(); session.setAttribute(X_CSRF_TOKEN_HEADER, token); } return token; } public static String currentUsername() { HttpServletRequest request = (HttpServletRequest) PhaseInterceptorChain.getCurrentMessage().get("HTTP.REQUEST"); if (request.getSession(false) != null) { if (request.getUserPrincipal() != null) { return request.getUserPrincipal().getName(); } else { return null; } } else { return null; } } protected WebApplicationException mapException(Exception ex) { if (isNotFoundException(ex)) { return new NotFoundException(); } else { Response entity = Response.status(500).type("application/json").entity(exceptionToEntity(ex)).build(); return new InternalServerErrorException(entity); } } protected boolean isNotFoundException(Exception ex) { return ex instanceof ControlException && ((ControlException) ex).getError() == ControlError.ENTITY_NOT_FOUND; } protected Object exceptionToEntity(Exception e) { if (e instanceof ControlException) { return exceptionToChannel((ControlException) e); } else if (e instanceof DatabaseException) { return exceptionToChannel((DatabaseException) e); } else { return exceptionToChannel(e); } } protected ControlExceptionChannel exceptionToChannel(ControlException e) { ControlExceptionChannel result = new ControlExceptionChannel(); if (e.getError() != null) { result.setError(e.getError().name()); } if (e.getCause() != null) { result.setCause(this.exceptionToChannel(e.getCause())); } if (e.getChannel() != null) { result.setEntity(e.getChannel().getSimpleName()); } return result; } protected DatabaseExceptionChannel exceptionToChannel(DatabaseException e) { DatabaseExceptionChannel result = new DatabaseExceptionChannel(); result.setDetails(e.getDetails()); result.setError(e.getError().name()); return result; } protected ExceptionChannel exceptionToChannel(Exception e) { ExceptionChannel result = new ExceptionChannel(); result.setDetails(e.getMessage()); return result; } }
jiageh08/tea-springboot
bdnav-web/backend-web/src/main/java/com/bdxh/backend/configration/security/userdetail/MyUserDetails.java
package com.bdxh.backend.configration.security.userdetail; import com.bdxh.system.entity.User; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.userdetails.UserDetails; import java.util.Collection; /** * @description: * @author: Kang * @create: 2019-02-28 14:20 **/ public class MyUserDetails implements UserDetails { private String username; private String password; private boolean isAccountNonLocked; private Collection<? extends GrantedAuthority> authorities; private User user; public MyUserDetails(String username, String password, boolean isAccountNonLocked, Collection<? extends GrantedAuthority> authorities, User user) { this.username = username; this.password = password; this.isAccountNonLocked = isAccountNonLocked; this.authorities = authorities; this.user = user; } @Override public String getUsername() { return username; } @Override public String getPassword() { return password; } @Override public boolean isAccountNonExpired() { return true; } @Override public boolean isAccountNonLocked() { return isAccountNonLocked; } @Override public boolean isCredentialsNonExpired() { return true; } @Override public boolean isEnabled() { return true; } @Override public Collection<? extends GrantedAuthority> getAuthorities() { return authorities; } public User getUser(){ return user; } }
dkatashev/adyen-web
packages/lib/src/components/internal/SecuredFields/lib/utilities/logger.js
/** * @internal * Utility class for logging messages/errors * Usage: * logger.log('Log message, always visible'); * * For debug only messages: * window._b$dl && logger.log('Log message only visible on dev env'); * * Or just use a conditional: * ``` * if (window._b$dl) { * logger.log('Log message only visible on dev env'); * } * ``` */ /** * @internal * Logs errors */ export const error = window.console && window.console.error && window.console.error.bind(window.console); /** * @internal * Logs info */ export const info = window.console && window.console.info && window.console.info.bind(window.console); /** * @internal * Logs * NOTE: changed to 'let' from 'const' for the purpose of running unit tests */ export let log = window.console && window.console.log && window.console.log.bind(window.console); // eslint-disable-line /** * @internal * Logs warnings * NOTE: changed to 'let' from 'const' for the purpose of running unit tests */ export let warn = window.console && window.console.warn && window.console.warn.bind(window.console); // eslint-disable-line
infphilo/tophat
src/align_status.cpp
<reponame>infphilo/tophat /* * align_status.cpp * TopHat * * Created by <NAME> on 11/09/2010. * */ #ifdef HAVE_CONFIG_H #include <config.h> #endif #include <cassert> #include <cstdlib> #include <iostream> #include <set> #include <vector> #include "common.h" #include "bwt_map.h" #include "tokenize.h" #include "reads.h" #include "junctions.h" #include "insertions.h" #include "deletions.h" #include "fusions.h" #include "coverage.h" #include "align_status.h" using namespace std; AlignStatus::AlignStatus() { _alignment_score = std::numeric_limits<int>::min(); } /** * Parse the cigar string of a BowtieHit in order to determine the alignment status. */ AlignStatus::AlignStatus(const BowtieHit& bh, const JunctionSet& gtf_junctions, const JunctionSet& junctions, const InsertionSet& insertions, const DeletionSet& deletions, const FusionSet& fusions, const Coverage& coverage) { // it seems like we need to work on this more // daehwan - it doesn't seem to work. const bool recalculate_indel_score = false; const vector<CigarOp>& cigar = bh.cigar(); _alignment_score = bh.alignment_score(); const int read_len = bh.read_len(); const int min_extent = min(read_len / 4, 10); bool recalculate_score = !junctions.empty(); int j = bh.left(); int r = 0; RefID ref_id = bh.ref_id(); for (size_t c = 0 ; c < cigar.size(); ++c) { int opcode = cigar[c].opcode; int length = cigar[c].length; switch(opcode) { case REF_SKIP: case rEF_SKIP: { Junction junc; junc.refid = bh.ref_id(); if (opcode == REF_SKIP) { junc.left = j - 1; junc.right = j + length; j += length; } else { junc.right = j + 1; junc.left = j - length; j -= length; } if (recalculate_score) { junc.antisense = bh.antisense_splice(); if (gtf_junctions.find(junc) == gtf_junctions.end()) { JunctionSet::const_iterator itr = junctions.find(junc); if (itr == junctions.end()) { _alignment_score -= bowtie2_max_penalty; } else { const int left_cov = coverage.get_coverage(ref_id, junc.left + 1); const int right_cov = coverage.get_coverage(ref_id, junc.right - 1); const int avg_cov = (left_cov + right_cov) / 2; int penalty = bowtie2_max_penalty + 2; const int supporting_hits = itr->second.supporting_hits; const int left_extent = itr->second.left_extent; const int right_extent = itr->second.right_extent; float extent_penalty = 0.0f; if (left_extent < min_extent || right_extent < min_extent) extent_penalty = 0.5f; if (supporting_hits >= 5) penalty *= min((float)avg_cov/supporting_hits + extent_penalty, 1.f); // daehwan - check this out // add two points to prefer junction alignments to other that may span one side of split site. // penalty -= 2; if (itr->second.gtf_match) penalty -= bowtie2_max_penalty; int prev_alignment_score = _alignment_score; _alignment_score -= penalty; // daehwan - for debugging purposes if (bh.insert_id() == 325708 && false) { fprintf(stderr, "junc(%d:%d-%d) %d / (%d + %d) = %d => %d\n", junc.refid, junc.left, junc.right, itr->second.supporting_hits, left_cov, right_cov, prev_alignment_score, _alignment_score); fprintf(stderr, "\textent: %d-%d\n", left_extent, right_extent); } } } else { _alignment_score += 2; } } } break; case MATCH: case mATCH: { if (opcode == MATCH) j += length; else j -= length; r += length; } break; case DEL: case dEL: { Deletion deletion; deletion.refid = bh.ref_id(); if (opcode == DEL) { deletion.left = j - 1; deletion.right = j + length; j += length; } else { deletion.right = j + 1; deletion.left = j - length; j -= length; } if (recalculate_score && recalculate_indel_score) { DeletionSet::const_iterator itr = deletions.find(deletion); if (itr != deletions.end()) { const int left_cov = coverage.get_coverage(ref_id, deletion.left + 1); const int right_cov = (length == 1 ? left_cov : coverage.get_coverage(ref_id, deletion.right - 1)); const int avg_cov = (left_cov + right_cov) / 2; const int del_penalty = bowtie2_ref_gap_open + bowtie2_ref_gap_cont * length; int addition = del_penalty; const int supporting_hits = itr->second.supporting_hits; const int left_extent = itr->second.left_extent; const int right_extent = itr->second.right_extent; int penalty = 0; if (left_extent < min_extent || right_extent < min_extent) penalty = del_penalty * 0.5f; if (avg_cov > 0 && supporting_hits >= 5) addition *= min((float)supporting_hits/avg_cov, 1.f); else addition = 0; addition -= penalty; if (addition < 0) addition = 0; int prev_alignment_score = _alignment_score; _alignment_score += addition; _alignment_score = min(0, _alignment_score); // daehwan - for debug purposes if (bh.insert_id() == 325708 && false) { fprintf(stderr, "del(%d:%d-%d) %d / (%d + %d) = %d => %d\n", deletion.refid, deletion.left, deletion.right, supporting_hits, left_cov, right_cov, prev_alignment_score, _alignment_score); fprintf(stderr, "\textent: %d-%d\n", left_extent, right_extent); } } } } break; case INS: case iNS: { if (recalculate_score && recalculate_indel_score) { string seq = bh.seq().substr(r, length); Insertion ins(ref_id, j, seq); InsertionSet::const_iterator itr = insertions.find(ins); if (itr != insertions.end()) { const int supporting_hits = itr->second.supporting_hits; const int left_extent = itr->second.left_extent; const int right_extent = itr->second.right_extent; const int left_cov = coverage.get_coverage(ref_id, j); const int right_cov = coverage.get_coverage(ref_id, j + (opcode == INS ? 1 : -1)); const int avg_cov = (left_cov + right_cov) / 2 - supporting_hits; const int ins_penalty = bowtie2_read_gap_open + bowtie2_read_gap_cont * length; int addition = ins_penalty; int extent_penalty = 0.0f; if (left_extent < min_extent || right_extent < min_extent) extent_penalty = ins_penalty * 0.5f; if (avg_cov > 0 && supporting_hits >= 5) addition *= min((float)supporting_hits/avg_cov, 1.f); else addition = 0; addition -= extent_penalty; if (addition < 0) addition = 0; // int prev_alignment_score = _alignment_score; _alignment_score += addition; _alignment_score = min(0, _alignment_score); /* fprintf(stderr, "ins(%d:%d:%s) %d / (%d - %d) = %d => %d (%d)\n", ref_id, ins.left, seq.c_str(), supporting_hits, avg_cov, supporting_hits, prev_alignment_score, _alignment_score, ins_penalty); fprintf(stderr, "\textent: %d-%d\n", left_extent, right_extent); */ } } r += length; } break; case FUSION_FF: case FUSION_FR: case FUSION_RF: case FUSION_RR: // daehwan - implement this later j = length; ref_id = bh.ref_id2(); break; default: break; } } } /** * Establish an ordering on alignments. * Prefer aligned reads over unaligned reads * Within the space of aligned reads * prefer splice-free reads over splice reads, and * indel-free reads over indel reads. * If a read can either be indel-free or splice-free, * prefer the indel-free alignment */ bool AlignStatus::operator<(const AlignStatus& rhs) const { if (_alignment_score != rhs._alignment_score) return _alignment_score > rhs._alignment_score; return false; } /** * Alignments are only equal if all fields are identical. */ bool AlignStatus::operator==(const AlignStatus& rhs) const { return _alignment_score == rhs._alignment_score; } bool AlignStatus::operator!=(const AlignStatus& rhs) const { return _alignment_score != rhs._alignment_score; }
louisponet/aiida-core
docs/source/topics/processes/include/snippets/launch/launch_submit_dictionary.py
<reponame>louisponet/aiida-core # -*- coding: utf-8 -*- from aiida import orm from aiida.engine import submit ArithmeticAddCalculation = CalculationFactory('arithmetic.add') inputs = { 'x': orm.Int(1), 'y': orm.Int(2) } node = submit(ArithmeticAddCalculation, **inputs)
Codernauti/Sweetie
app/src/main/java/com/codernauti/sweetie/gallery/GalleryInfoActivity.java
<filename>app/src/main/java/com/codernauti/sweetie/gallery/GalleryInfoActivity.java package com.codernauti.sweetie.gallery; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.app.FragmentTransaction; import android.util.Log; import com.codernauti.sweetie.BaseActivity; import com.codernauti.sweetie.R; import com.codernauti.sweetie.actionInfo.ActionInfoContract; import com.codernauti.sweetie.actionInfo.ActionInfoFragment; import com.codernauti.sweetie.actionInfo.ActionInfoPresenter; import com.codernauti.sweetie.firebase.FirebaseActionInfoController; import com.codernauti.sweetie.model.GalleryFB; public class GalleryInfoActivity extends BaseActivity { private static final String TAG = "GalleryInfoActivity"; private static final String GALLERY_UID_KEY = "galleryUid"; private String mGalleryUid; private FirebaseActionInfoController<GalleryFB> mController; private ActionInfoContract.Presenter mPresenter; public static Intent getStartActivityIntent(Context context, String galleryUid) { Intent intent = new Intent(context, GalleryInfoActivity.class); intent.putExtra(GALLERY_UID_KEY, galleryUid); return intent; } @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.action_info_activity); if (savedInstanceState == null) { // first opened savedInstanceState = getIntent().getExtras(); } if (savedInstanceState != null) { mGalleryUid = savedInstanceState.getString(GALLERY_UID_KEY); Log.d(TAG, "GalleryUid = " + mGalleryUid); } else { Log.w(TAG, "No savedInstanceState or intentArgs!"); } ActionInfoFragment view = (ActionInfoFragment) getSupportFragmentManager() .findFragmentById(R.id.action_info_fragment_container); if (view == null) { view = ActionInfoFragment.newInstance(getIntent().getExtras()); FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); transaction.add(R.id.action_info_fragment_container, view); transaction.commit(); } if (mGalleryUid != null) { mController = new FirebaseActionInfoController<>(super.mCoupleUid, mGalleryUid, GalleryFB.class); mPresenter = new ActionInfoPresenter<GalleryFB>(view, mController); } else { Log.w(TAG, "Gallery Uid is null, impossible to instantiate Controller and presenter"); } } @Override protected void onStart() { super.onStart(); mController.attachListener(); } @Override protected void onStop() { super.onStop(); mController.detachListener(); } @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putString(GALLERY_UID_KEY, mGalleryUid); } @Override public boolean onSupportNavigateUp() { super.onBackPressed(); return true; } }
cluco91/JavaEE_Facturacion
SistemaFacturas/src/java/sys/imp/detalleFacturaDaoImp.java
package sys.imp; import org.hibernate.Session; import sys.dao.detalleFacturaDao; import sys.model.Detallefactura; /** * * @author lucodeveloper */ public class detalleFacturaDaoImp implements detalleFacturaDao { @Override public boolean guardarVentaDetalleFactura(Session session, Detallefactura detallefactura) throws Exception { session.save(detallefactura); return true; } }
MarcSkovMadsen/panel-components
setup.py
<filename>setup.py """Needed to be able to build and install the package""" from setuptools import setup setup()
Elhyoz/sitBootcamp
Ejercicios/desestructuracion.js
function f() { return [1, 2]; } let a = f(); console.log("A es " + a);
JackieLJM/FULLSTACK-books-projects-codes
CODEs/fullstack-react-native-book-r3/image-feed/1/components/Card.js
import { ActivityIndicator, Image, StyleSheet, View } from 'react-native'; import PropTypes from 'prop-types'; import React from 'react'; import AuthorRow from './AuthorRow'; export default class Card extends React.Component { static propTypes = { fullname: PropTypes.string.isRequired, image: Image.propTypes.source.isRequired, linkText: PropTypes.string.isRequired, onPressLinkText: PropTypes.func.isRequired, }; state = { loading: true, }; handleLoad = () => { this.setState({ loading: false }); }; render() { const { fullname, image, linkText, onPressLinkText } = this.props; const { loading } = this.state; return ( <View> <AuthorRow fullname={fullname} linkText={linkText} onPressLinkText={onPressLinkText} /> <View style={styles.image}> {loading && ( <ActivityIndicator style={StyleSheet.absoluteFill} size={'large'} /> )} <Image style={StyleSheet.absoluteFill} source={image} onLoad={this.handleLoad} /> </View> </View> ); } } const styles = StyleSheet.create({ image: { aspectRatio: 1, backgroundColor: 'rgba(0,0,0,0.02)', }, });
joegarbett/baleen
baleen-uima/src/main/java/uk/gov/dstl/baleen/uima/BaleenCollectionReader.java
<gh_stars>100-1000 // Dstl (c) Crown Copyright 2017 // Modified by NCA (c) Crown Copyright 2017 package uk.gov.dstl.baleen.uima; import java.io.IOException; import java.io.InputStream; import org.apache.uima.UimaContext; import org.apache.uima.collection.CollectionException; import org.apache.uima.fit.component.JCasCollectionReader_ImplBase; import org.apache.uima.fit.descriptor.ExternalResource; import org.apache.uima.jcas.JCas; import org.apache.uima.resource.ResourceInitializationException; import org.apache.uima.util.Progress; import uk.gov.dstl.baleen.core.history.BaleenHistory; import uk.gov.dstl.baleen.core.metrics.MetricsFactory; import uk.gov.dstl.baleen.core.pipelines.PipelineBuilder; import uk.gov.dstl.baleen.core.pipelines.content.ContentExtractor; import uk.gov.dstl.baleen.uima.utils.UimaUtils; /** * This class provides basic functionality for a collection reader, such as metrics and logging, so * that we don't need to put it into every annotator manually. All collection readers in Baleen * should inherit from this class and use any utility methods it provides as required to ensure we * standardise logging and metrics as much as possible. * * @baleen.javadoc */ public abstract class BaleenCollectionReader extends JCasCollectionReader_ImplBase { private UimaMonitor monitor; private UimaSupport support; /** * Baleen History resource * * @baleen.resource uk.gov.dstl.baleen.core.history.BaleenHistory */ public static final String KEY_HISTORY = PipelineBuilder.BALEEN_HISTORY; /** * Baleen Content Extractor resource * * @baleen.resource uk.gov.dstl.baleen.core.pipelines.content.ContentExtractor */ public static final String KEY_CONTENT_EXTRACTOR = PipelineBuilder.CONTENT_EXTRACTOR; @ExternalResource(key = KEY_HISTORY, mandatory = false) BaleenHistory history; @ExternalResource(key = KEY_CONTENT_EXTRACTOR, mandatory = false) ContentExtractor contentExtractor; @Override public final void initialize(UimaContext context) throws ResourceInitializationException { super.initialize(context); // This will do initialization of resources, // but won't be included in the metrics String pipelineName = UimaUtils.getPipelineName(context); monitor = new UimaMonitor(pipelineName, this.getClass()); support = new UimaSupport( pipelineName, this.getClass(), history, monitor, UimaUtils.isMergeDistinctEntities(context)); monitor.startFunction("initialize"); doInitialize(context); monitor.finishFunction("initialize"); } /** * Called when the collection reader is being initialized. Any required resources, for example, * should be opened at this point. * * @param context The UimaContext for the collection reader */ protected abstract void doInitialize(UimaContext context) throws ResourceInitializationException; @Override public final void getNext(JCas jCas) throws IOException, CollectionException { monitor.startFunction("getNext"); MetricsFactory.getInstance() .getPipelineMetrics(monitor.getPipelineName()) .startDocumentProcess(); doGetNext(jCas); monitor.finishFunction("getNext"); monitor.persistCounts(); } /** * Called when UIMA wants the next document. The passed CAS object should be populated with the * document content, and any initial annotations. * * @param jCas The JCas object to populate */ protected abstract void doGetNext(JCas jCas) throws IOException, CollectionException; @Override public final void close() throws IOException { monitor.startFunction("close"); contentExtractor.destroy(); doClose(); monitor.finishFunction("close"); } /** * Called when the collection reader has finished and is closing down. Any open resources, for * example, should be closed at this point. */ protected abstract void doClose() throws IOException; @Override public final Progress[] getProgress() { monitor.startFunction("getProgress"); Progress[] ret = doGetProgress(); monitor.finishFunction("getProgress"); return ret; } @Override public void destroy() { super.destroy(); try { close(); } catch (IOException e) { getMonitor().warn("Close on destroy", e); } } /** * Called when UIMA wants to know how far we've got with processing the current collection of * documents. Most collection readers shouldn't need (or won't be able) to implement this as how * can we give the progress if we're persistently looking for new data? * * @return An array of progress objects indicating how far we've currently got. */ public Progress[] doGetProgress() { return new Progress[0]; } /** * Override of the UIMA hasNext() method with logic to continuously check for new documents until * one is found. This prevents the collection reader from exiting (unless asked to), and so * creates a persistent collection reader and pipeline. */ @Override public final boolean hasNext() throws IOException, CollectionException { monitor.startFunctionTrace("hasNext"); boolean next = doHasNext(); monitor.finishFunctionTrace("hasNext"); return next; } /** * Called when UIMA is asking whether there is another document to process. Implementations should * return whether there is currently a document available, and not do any waiting for a new * document as this is handled by BaleenCollectionReader. * * @return True if there is another document, false otherwise */ public abstract boolean doHasNext() throws IOException, CollectionException; protected UimaMonitor getMonitor() { return monitor; } protected UimaSupport getSupport() { return support; } /** * Extract the content from the given inputStream and add it to the supplied jCas. * * @param inputStream The InputStream of data to process * @param source The source URI to set * @param jCas The JCas object to add data to * @throws IOException */ protected void extractContent(InputStream inputStream, String source, JCas jCas) throws IOException { contentExtractor.processStream(inputStream, source, jCas); } }
patil215/v8
fuzzer_output/interesting/sample_1554142791035.js
function main() { const v4 = [13.37,13.37,13.37,13.37,13.37]; const v6 = [1337,1337,1337]; const v7 = [v4]; const v8 = {}; const v9 = {getFloat32:v7,push:"CmfGB9PQPJ",delete:"CmfGB9PQPJ",lastMatch:1337,bind:Math,ceil:v4,toString:v4,map:v6,acosh:v6}; let v10 = v6; const v15 = [13.37]; const v17 = [1337,1337,1337,1337]; const v18 = [1337,v15,1337,13.37]; const v19 = {slice:"__lookupSetter__",lastIndexOf:v18,constructor:13.37,unscopables:v18,repeat:v17}; const v20 = {random:Symbol,NEGATIVE_INFINITY:v19,constructor:v15,LN2:v17,repeat:-256}; let v21 = 1337; for (let v26 = 0; v26 < 100; v26++) { const v28 = {length:Symbol}; const v35 = [13.37]; const v37 = [1337,1337]; const v38 = ["function"]; const v39 = {bind:Number,endsWith:v38,tan:Number,reverse:v38,log2:v37,push:3447856264,input:Number,repeat:"function"}; const v40 = {bind:v39,replace:1337,atan:1337,unshift:v38,atanh:"function",delete:13.37,defineProperty:v35}; function v42(v43,v44,v45,v46) { let v50 = 0; const v51 = v50 + 1; v50 = v51; let v57 = 0; let v60 = 13.37; const v61 = new Float64Array(46647); const v63 = [1337]; let v67 = "undefined"; return Math; } const v78 = [1337]; for (let v82 = 0; v82 < 100; v82++) { const v83 = v42(10,Function,1337,v78,Function); } const v84 = 1337 instanceof Function; let v85 = 0; if (v84) { let v88 = 65537; while (v88 < 6) { let v91 = 0; while (v91 < 8) { let v92 = v28; const v93 = v91 + 1; v91 = v93; } const v94 = v88 + 1; v88 = v94; } v85 = v15; } else { const v95 = v40[784010453]; v85 = v95; } let v96 = 13.37; const v101 = [13.37,13.37]; const v103 = [1337,1337,1337]; const v104 = [1337]; const v105 = {isFrozen:v104,ceil:v103,construct:v103,EPSILON:1337,getOwnPropertySymbols:parseFloat,species:10000,fill:v101}; const v106 = {ceil:13.37,is:v101,raw:1337}; let v107 = parseFloat; let v110 = v105; function v112(v113,v114) { 'use strict' return v113; } const v115 = v105[65535]; v10[4294967297] = 1337; const v134 = [v84]; const v135 = 13.37 > Function; let v136 = Function; if (v135) { v136 = Function; } else { const v137 = v106.__proto__; } const v140 = [13.37]; const v143 = "undefined" <= 10; function v148(v149,v150,v151,v152,v153) { for (let v157 = 0; v157 < 3; v157++) { const v159 = 13.37 - v157; const v161 = [13.37,13.37,13.37,13.37]; let v164 = 9007199254740991; const v165 = {lastParen:v157,copyWithin:Math,charAt:v164,repeat:v152,defineProperty:0,leftContext:Math,toString:v161,isView:v159,input:v157}; } return 10; } const v168 = v148("undefined",1337,13.37,Math); let v176 = "undefined"; for (let v183 = 0; v183 < 100; v183++) { const v184 = v148(2147483648,v26,-256,v143); } const v185 = v10[v35]; const v187 = v176.search(Math,v148); const v192 = (10)[Function]; function v194(v195,v196,v197,v198,v199) { const v200 = [1337]; for (const v201 of v200) { const v202 = v201 + 1; const v204 = {}; const v205 = [v204]; v20[v195] = v103; v106.length = 0; delete v200[0]; } return 13.37; } const v207 = v194("undefined",1337,13.37,Math); } } %NeverOptimizeFunction(main); main();
athanor/athanor
src/operators/opAnd.cpp
#include "operators/opAnd.h" #include <algorithm> #include <cassert> #include <unordered_map> #include "operators/flatten.h" #include "operators/previousValueCache.h" #include "operators/simpleOperator.hpp" #include "types/boolVal.h" #include "types/sequenceVal.h" #include "utils/ignoreUnused.h" using namespace std; using OperandsSequenceTrigger = OperatorTrates<OpAnd>::OperandsSequenceTrigger; void OpAnd::reevaluateImpl(SequenceView& operandView) { violation = 0; cachedViolations.clear(); for (size_t i = 0; i < operandView.numberElements(); ++i) { auto& operandChild = operand->view()->getMembers<BoolView>()[i]; UInt operandViolation = operandChild->view()->violation; cachedViolations.insert(i, operandViolation); if (operandViolation > 0) { violatingOperands.insert(i); } violation += operandViolation; } } void OpAnd::updateVarViolationsImpl(const ViolationContext& vioContext, ViolationContainer& vioContainer) { auto* boolVioContextTest = dynamic_cast<const BoolViolationContext*>(&vioContext); bool negated = boolVioContextTest && boolVioContextTest->negated; if (negated) { if (violation == 0) { for (auto& operand : operand->view()->getMembers<BoolView>()) { operand->updateVarViolations(vioContext, vioContainer); } } return; } for (size_t violatingOperandIndex : violatingOperands) { operand->view() .get() .getMembers<BoolView>()[violatingOperandIndex] ->updateVarViolations(violation, vioContainer); } } void OpAnd::copy(OpAnd&) const {} std::ostream& OpAnd::dumpState(std::ostream& os) const { os << "OpAnd: violation=" << violation << endl; vector<UInt> sortedViolatingOperands(violatingOperands.begin(), violatingOperands.end()); sort(sortedViolatingOperands.begin(), sortedViolatingOperands.end()); os << "Violating indices: " << sortedViolatingOperands << endl; return operand->dumpState(os) << ")"; } std::pair<bool, ExprRef<BoolView>> OpAnd::optimiseImpl(ExprRef<BoolView>& self, PathExtension path) { auto boolOpPair = standardOptimise(self, path); boolOpPair.first |= flatten<BoolView>(*(boolOpPair.second)); return boolOpPair; } string OpAnd::getOpName() const { return "OpAnd"; } void OpAnd::debugSanityCheckImpl() const { operand->debugSanityCheck(); auto view = operand->getViewIfDefined(); if (!view) { sanityLargeViolationCheck(violation); return; } auto& operandView = *view; UInt calcViolation = 0; for (auto& member : operandView.getMembers<BoolView>()) { auto memberView = member->getViewIfDefined(); sanityCheck(memberView, "View should not be undefined, it is a bool view."); calcViolation += memberView->violation; } sanityEqualsCheck(calcViolation, violation); ; } template <typename Op> struct OpMaker; template <> struct OpMaker<OpAnd> { static ExprRef<BoolView> make( ExprRef<SequenceView>, const shared_ptr<SequenceDomain>& operandDomain = nullptr); }; ExprRef<BoolView> OpMaker<OpAnd>::make( ExprRef<SequenceView> o, const shared_ptr<SequenceDomain>& operandDomain) { if (operandDomain && lib::get_if<shared_ptr<EmptyDomain>>(&operandDomain->inner)) { auto val = ::make<BoolValue>(); val->violation = 0; val->setConstant(true); return val.asExpr(); } return make_shared<OpAnd>(move(o)); } template struct SimpleUnaryOperator<BoolView, SequenceView, OpAnd>;
DanIverson/OpenVnmrJ
src/vwacq/gsClkLib.h
<reponame>DanIverson/OpenVnmrJ /* * Copyright (C) 2015 University of Oregon * * You may distribute under the terms of either the GNU General Public * License or the Apache License, as specified in the LICENSE file. * * For more information, see the LICENSE file. */ #ifndef INCgsClkLibh #define INCgsClkLibh /* ------------- Make C header file C++ compliant ------------------- */ #ifdef __cplusplus extern "C" { #endif /* test green springs interrupt clock board DIGITAL-48 in 610 carrier */ #define BASE_ADDR 0xffff1000 /* Industial Packs A, B, C, D */ #define IP_A_OFFSET 0x0 #define IP_B_OFFSET 0x100 #define IP_C_OFFSET 0x200 #define IP_D_OFFSET 0x300 /* DIGITAL-48 2 - MC68230 offsets */ #define CLK_1_OFFSET 0x20 #define CLK_2_OFFSET 0x60 /* Timer Control Register */ #define TCR_OFFSET 0x1 /* Timer Interrupt Vector Register */ #define TIVR_OFFSET 0x3 /* Counter Perload Register H-L */ #define CPRH_OFFSET 0x7 #define CPRM_OFFSET 0x9 #define CPRL_OFFSET 0xB /* Timer counter register H-L */ #define CRH_OFFSET 0xF #define CRM_OFFSET 0x11 #define CRL_OFFSET 0x13 /* TIMER_STATUS_REG */ #define TSR_OFFSET 0x15 /* reg address; CLK_REG(TCR_OFFSET,CLK_1_OFFSET,IP_A_OFFSET) */ #define CLK_REG(a, b) ((volatile unsigned char* const) (a + b)) #define ADD_OFFSET(a, b) (BASE_ADDR + a + b) /* Note: internal clock 8MHz, prescaler = 32 -> 250KHz or 4usec resolution */ /* external clock can only 1/8 on internal input clock or 8Mhz/8 = 1Mhz */ /* or a maximum resolution of 1usec */ #define INTERNAL_CLK 0x0 #define EXTERNAL_CLK 0x1 #define INTRP_RELOAD_INTCLK 0xa0 #define INTRP_ROLLOVR_INTCLK 0xb0 #define INTRP_ROLLOVR_EXTCLK 0xb6 #define MAX_CLOCKS 4 typedef struct /* CLOCK Object structure */ { FUNCPTR pIntrHandler; char* clkBaseAddr; int TcrVal; int clkNum; int UserArg; int vmeItrVector; int vmeItrLevel; int clkRes; /* resolution in usec internal=4usec,ext=1usec */ } CLOCK_OBJ; typedef CLOCK_OBJ *CLOCK_ID; /* --------- ANSI/C++ compliant function prototypes --------------- */ #if defined(__STDC__) || defined(__cplusplus) IMPORT CLOCK_ID gsClkCreate(int vec, FUNCPTR IntrHandler, int arg); IMPORT int gsClkStart(CLOCK_ID pClkId, unsigned long count); IMPORT int gsClkStop(CLOCK_ID pClkId); IMPORT int gsClkItrLatency(int clock); IMPORT VOID gsClkReset(CLOCK_ID pClkId); IMPORT VOID gsClkResetZDS(CLOCK_ID pClkId); IMPORT int gsClkDelete (CLOCK_ID); /* --------- NON-ANSI/C++ prototypes ------------ */ #else #endif /* __STDC__ */ #ifdef __cplusplus } #endif #endif /* INCrngBlkLibh */
xwj1024/ajin-mall
mall-sys-app/mall-sys-app-search/src/main/java/ajin/mall/sys/search/service/impl/EsServiceImpl.java
package ajin.mall.sys.search.service.impl; import ajin.mall.common.base.exception.SysException; import ajin.mall.sys.search.es.EsEntity; import ajin.mall.sys.search.es.EsMapping; import ajin.mall.sys.search.service.EsService; import com.alibaba.fastjson.JSON; import org.elasticsearch.action.admin.indices.create.CreateIndexRequest; import org.elasticsearch.action.admin.indices.create.CreateIndexResponse; import org.elasticsearch.action.bulk.BulkRequest; import org.elasticsearch.action.bulk.BulkResponse; import org.elasticsearch.action.delete.DeleteRequest; import org.elasticsearch.action.delete.DeleteResponse; import org.elasticsearch.action.index.IndexRequest; import org.elasticsearch.action.index.IndexResponse; import org.elasticsearch.client.RequestOptions; import org.elasticsearch.client.RestHighLevelClient; import org.elasticsearch.client.indices.AnalyzeRequest; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.rest.RestStatus; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.io.IOException; import java.util.List; /** * @author Ajin * @since 2021-04-14 */ @Service public class EsServiceImpl implements EsService { @Autowired private RestHighLevelClient restHighLevelClient; @Override public void createIndex(String index, EsMapping mapping, int shards, int replicas) throws IOException { CreateIndexRequest request = new CreateIndexRequest(index); // 分词器 AnalyzeRequest.CustomAnalyzerBuilder analyzerBuilder = AnalyzeRequest.buildCustomAnalyzer("ik_max_word"); analyzerBuilder.build(); request.settings(Settings.builder() // 分片数 .put("index.number_of_shards", shards) // 副本数 .put("index.number_of_replicas", replicas)); // 指定mapping request.mapping("_doc", JSON.toJSONString(mapping), XContentType.JSON); CreateIndexResponse response = restHighLevelClient.indices().create(request, RequestOptions.DEFAULT); if (!response.isAcknowledged()) { throw new SysException("索引创建失败"); } } @Override public void insertBatch(String index, List<EsEntity> list) throws IOException { BulkRequest request = new BulkRequest(); list.forEach(item -> request.add(new IndexRequest(index).id(item.getId()) .source(item.getJsonData(), XContentType.JSON))); BulkResponse response = restHighLevelClient.bulk(request, RequestOptions.DEFAULT); if (response.hasFailures()) { throw new SysException(response.buildFailureMessage()); } } @Override public void insertOrUpdate(String index, EsEntity entity) throws IOException { IndexRequest request = new IndexRequest(index); request.id(entity.getId()); if (entity.getJsonData() == null) { request.source("{}", XContentType.JSON); } else { request.source(entity.getJsonData(), XContentType.JSON); } IndexResponse response = restHighLevelClient.index(request, RequestOptions.DEFAULT); if (response.status() != RestStatus.OK || response.status() != RestStatus.CREATED) { throw new SysException("添加或者更新失败"); } } @Override public void delete(String index, String id) throws IOException { DeleteRequest request = new DeleteRequest(index, id); DeleteResponse response = restHighLevelClient.delete(request, RequestOptions.DEFAULT); if (response.status() != RestStatus.OK) { throw new SysException("删除失败"); } } }
applefighting/babygo.github.io
client/node_modules/@cycle/storage/lib/util.js
<reponame>applefighting/babygo.github.io<gh_stars>0 "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var dropRepeats_1 = require("xstream/extra/dropRepeats"); var adapt_1 = require("@cycle/run/lib/adapt"); function getStorage$(request$, type) { if (type === 'local') { return request$.filter(function (req) { return !req.target || req.target === 'local'; }); } else { return request$.filter(function (req) { return req.target === 'session'; }); } } function storageKey(n, request$, type) { if (type === void 0) { type = 'local'; } var storage$ = getStorage$(request$, type); var key = type === "local" ? localStorage.key(n) : sessionStorage.key(n); return storage$ .filter(function (req) { return req.key === key; }) .map(function (req) { return req.key; }) .startWith(key) .compose(dropRepeats_1.default()); } function storageGetItem(key, request$, type) { if (type === void 0) { type = 'local'; } var storage$ = getStorage$(request$, type); var storageObj = type === "local" ? localStorage : sessionStorage; return storage$ .filter(function (req) { return req.key === key; }) .map(function (req) { return req.value; }) .startWith(storageObj.getItem(key)); } function getResponseObj(request$, type) { if (type === void 0) { type = 'local'; } return { // Function returning stream of the nth key. key: function (n) { return adapt_1.adapt(storageKey(n, request$, type)); }, // Function returning stream of item values. getItem: function (key) { return adapt_1.adapt(storageGetItem(key, request$, type)); }, }; } exports.default = getResponseObj;
arez/arez
processor/src/test/fixtures/input/com/example/SubpackageModel.java
<filename>processor/src/test/fixtures/input/com/example/SubpackageModel.java package com.example; import arez.annotations.Action; import arez.annotations.ArezComponent; import arez.annotations.Memoize; import arez.annotations.Observable; @ArezComponent public abstract class SubpackageModel { @Observable public long getTime() { return 0; } @Observable public void setTime( final long time ) { } @Action public void doStuff( final long time ) { } @Memoize public int someValue() { return 0; } }
avinashkpai12/syscop
AppRegistration/src/main/java/com/stackroute/appregistration/service/ApplicationServiceImpl.java
package com.stackroute.appregistration.service; import com.stackroute.appregistration.domain.Application; import com.stackroute.appregistration.domain.User; import com.stackroute.appregistration.exceptions.ApplicationAlreadyExistException; import com.stackroute.appregistration.exceptions.ApplicationDoesNotExistException; import com.stackroute.appregistration.repository.ApplicationRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.Iterator; import java.util.List; /** * ApplicationServiceImpl is a java class that extends the * interface ApplicationService. All the methods defined in the intergace * are implemented in this class * * @author <NAME> */ @Service public class ApplicationServiceImpl implements ApplicationService { private ApplicationRepository applicationRepositoryObj; @Autowired public ApplicationServiceImpl(ApplicationRepository applicationRepositoryObj) { this.applicationRepositoryObj = applicationRepositoryObj; } //Adds new applications(Registration) @Override public User addApplication(User userObj) throws ApplicationAlreadyExistException{ User returnedUser = new User(); if (applicationRepositoryObj.existsById(userObj.getUserName())){ User savedUser = applicationRepositoryObj.findById(userObj.getUserName()).get(); returnedUser.setUserName(userObj.getUserName()); List<Application> appList = savedUser.getApplications(); List<Application> applicationToReturn = new ArrayList<>(); Iterator applicationIterator = appList.iterator(); while(applicationIterator.hasNext()) { Application savedApplicationFromDb = (Application) applicationIterator.next(); applicationToReturn.add(savedApplicationFromDb); } applicationToReturn.add(userObj.getApplications().get(0)); returnedUser.setApplications(applicationToReturn); applicationRepositoryObj.save(returnedUser); } else { returnedUser = applicationRepositoryObj.save(userObj); } return returnedUser; } //To display all the registered applications @Override public User getAllApplications(String userName) throws ApplicationDoesNotExistException { User userObj; if (applicationRepositoryObj.existsById(userName)){ userObj = applicationRepositoryObj.findById(userName).get(); } else { throw new ApplicationDoesNotExistException("User hasn't registered for any application yet!"); } return userObj; } //Update already registered applications @Override public User updateApplications(User userObj) throws ApplicationDoesNotExistException { User savedUser = applicationRepositoryObj.findById(userObj.getUserName()).get(); Application appToBeUpdated = new Application(); List<Application> checkApplications = userObj.getApplications(); Iterator checkApplicationsIterator = checkApplications.iterator(); if (checkApplicationsIterator.hasNext()){ appToBeUpdated = (Application) checkApplicationsIterator.next(); } String appNameToCompare = appToBeUpdated.getApplicationName(); List<Application> applicationList = savedUser.getApplications(); List<Application> updatedListOfApplications = new ArrayList<>(); Iterator applicationIterator = applicationList.iterator(); while (applicationIterator.hasNext()){ Application appToBeComparedWith = (Application) applicationIterator.next(); if (appToBeComparedWith.getApplicationName().equals(appNameToCompare)){ updatedListOfApplications.add(appToBeUpdated); } else{ updatedListOfApplications.add(appToBeComparedWith); } } User updatedUser = new User(userObj.getUserName(),updatedListOfApplications); applicationRepositoryObj.save(updatedUser); return updatedUser; } //Deletes already registered applications @Override public User deleteApplication(User userObj) throws ApplicationDoesNotExistException { User savedUser = applicationRepositoryObj.findById(userObj.getUserName()).get(); Application appToBeDeleted = new Application(); List<Application> checkApplications = userObj.getApplications(); Iterator checkApplicationsIterator = checkApplications.iterator(); if (checkApplicationsIterator.hasNext()){ appToBeDeleted = (Application) checkApplicationsIterator.next(); } String appNameToCompare = appToBeDeleted.getApplicationName(); List<Application> applicationList = savedUser.getApplications(); List<Application> listOfApplicationsAfterDeletion = new ArrayList<>(); Iterator applicationIterator = applicationList.iterator(); while (applicationIterator.hasNext()){ Application appToBeComparedWith = (Application) applicationIterator.next(); if (appToBeComparedWith.getApplicationName().equals(appNameToCompare)){ //Empty Block } else{ listOfApplicationsAfterDeletion.add(appToBeComparedWith); } } User updatedUser = new User(userObj.getUserName(),listOfApplicationsAfterDeletion); applicationRepositoryObj.save(updatedUser); return updatedUser; } }
djeada/Nauka-programowania
src/Python/23_Wyrazenia_regularne/Zad5.py
""" Z ciagu znakow wypisz cyfry. """ import re # Wersja 1 def tylko_cyfry_v1(slowo): return re.sub("[^\d]", "", slowo) # Testy Poprawnosci slowo = "numer 32.19 wyzej niz 31.17" wynik = "32193117" assert tylko_cyfry_v1(slowo) == wynik
uthark/homebrew-core
Formula/wput.rb
<reponame>uthark/homebrew-core class Wput < Formula desc "Tiny, wget-like FTP client for uploading files" homepage "https://wput.sourceforge.io/" url "https://downloads.sourceforge.net/project/wput/wput/0.6.2/wput-0.6.2.tgz" sha256 "229d8bb7d045ca1f54d68de23f1bc8016690dc0027a16586712594fbc7fad8c7" bottle do cellar :any_skip_relocation sha256 "77703d5dfb1bde183ccc207ee5e3f14b1a677acc697806a2b16f00c56cc0595e" => :catalina sha256 "563c5204880172786cbbfc75dafa818e670ac5d1a67fdbe8bea1dd2588587eab" => :mojave sha256 "e01d35805cd00e8f4d9ba1ab989104d66dc4150648a2288f5f49eea5c17b5025" => :high_sierra sha256 "0a8c4296a3e14d8b420f65464293b000dd1bd2e33a802c92e1812f0c267d3f0f" => :sierra sha256 "8e4eeb941d98dc0313b87682b7ae659bbceac59426cf0483c2ae2676cf5b924b" => :el_capitan sha256 "97bc045a03ddd01106304530a453a47693fbd5f3419090310c91a187e1d23931" => :yosemite sha256 "3e9c649d134fff0d79d23a2eb575e440354e938b0f261c5fed53efe9d6f3f8c9" => :mavericks end # The patch is to skip inclusion of malloc.h only on OSX. Upstream: # https://sourceforge.net/p/wput/patches/22/ patch do url "https://raw.githubusercontent.com/Homebrew/formula-patches/85fa66a9/wput/0.6.2.patch" sha256 "a3c47a12344b6f67a5120dd4f838172e2af04f4d97765cc35d22570bcf6ab727" end def install system "./configure", "--disable-debug", "--disable-dependency-tracking", "--prefix=#{prefix}" system "make" ENV.deparallelize system "make", "install" end test do system "#{bin}/wput", "--version" end end
jorgezafra94/talk4free-1
talk4free-backend/api/users/users.create.js
const connection = require("../db_connection").connection; const create = (data, callback) => { let created_at = new Date().toISOString().slice(0, 18); let updated_at = created_at; connection.query( `INSERT INTO users(email, username, created_at, updated_at, active, adm, img) values(?,?,?,?,?,?,?)`, [ data.email, data.username, created_at, updated_at, data.active, data.adm, data.img ], (error, result) => { if (error) return callback(error); return callback(null, result); } ); }; const createUser = (req, res) => { create(req.body, err => { if (err) return res.send(err); return res.send("User created successfully"); }); }; module.exports = { createUser };