common

微信小程序 模块化

旧巷老猫 提交于 2019-11-27 12:55:53
文件作用域 在JavaScript文件中声明的变量和函数只在该文件中有效;不同的文件中可以声明相同名字的变量和函数,不会互相影响。 通过全局函数 getApp() 可以获取全局的应用实例,如果需要全局的数据可以在 App() 中设置,如: // app.js App({ globalData: 1 }) // a.js // The localValue can only be used in file a.js. var localValue = 'a' // Get the app instance. var app = getApp() // Get the global data and change it. app.globalData++ // b.js // You can redefine localValue in file b.js, without interference with the localValue in a.js. var localValue = 'b' // If a.js it run before b.js, now the globalData shoule be 2. console .log(getApp().globalData) 模块化 我们可以将一些公共的代码抽离成为一个单独的js文件,作为一个模块。模块只有通过

API开发之接口安全(二)-----sign校验

夙愿已清 提交于 2019-11-27 12:03:35
上一章 我们说了 sign的生成 那么 我们如何确定这个sign的准确性呢 下来 我们说说 校验sign的那些事 在拿到header里面的内容之后 我们首先需要对其内容的基本参数做一个校验 我们补充下Common类的代码 <?php /** * Created by PhpStorm. * User: Administrator * Date: 2019/8/15 * Time: 15:00 */ namespace app\index\controller; use app\common\lib\execption\ApiException; use think\Controller; class Common extends Controller { public function _initialize(){ $this->checkRequestAuth(); } public function checkRequestAuth(){ $header = request()->header(); ##判断header中基础参数 if(empty($header['sign'])){ throw new ApiException('sign不存在',400); } if(!in_array($header['app_type'],config("app.app_types")

POJ 1458 Common Subsequence

被刻印的时光 ゝ 提交于 2019-11-27 10:41:08
题目A subsequence of a given sequence is the given sequence with some elements (possible none) left out. Given a sequence X = < x1, x2, ..., xm > another sequence Z = < z1, z2, ..., zk > is a subsequence of X if thereexists a strictly increasing sequence < i1, i2, ..., ik > of indices of X such that for all j = 1,2,...,k, x ij = zj. For example, Z = < a, b, f, c > is a subsequence of X = < a, b, c, f, b, c > with index sequence < 1, 2, 4, 6 >. Given two sequences X and Y the problem is to find the length of the maximum-length common subsequence of X and Y. Input The program input is from the std

Dos.Common - 目录、介绍

可紊 提交于 2019-11-27 10:00:57
引言: Dos.Common是一个开发中的常用类库,如HttpHelper、LogHelper、CacheHelper、CookieHelper、MapperHelper等等。与Dos.WeChat、Dos.CMS等集成。 官方网站: http://ITdos.com/Dos/Common/Index.html 开源中国: http://www.oschina.net/p/dos-common GitHub: https://github.com/itdos/Dos.Common NuGet: https://www.nuget.org/packages?q=dos.common 交流QQ群: 60831381 Dos.Common 使用方法 - 目录 HttpHelper.cs - http帮助类 - Dos.Common MsmqHelper.cs - 微软消息队列帮助类 - Dos.Common JsonHelper - Json序列化反序列化类 - Dos.Common LogHelper.cs - 日志帮助类 - Dos.Common Dos.Captcha - Gif动态验证码控件 - Dos.Common 未完待续... 文章链接: http://www.iTdos.com/Dos/Common/Index.html 原创说明:转载 IT大师 原创文章时请保留原文链接

Python多模块文件共享变量

北战南征 提交于 2019-11-27 07:41:01
首先,在python的5文件里,共享变量x存在glovar.py里面,需要在任意模块都能更改,更改后任意模块获取到的值都相同,这就是多模块文件共享一个变量 #5个文件的路径 c:\test\main.py c:\test\show.py c:\test\test.py c:\test\common\__init__.py #空文件 c:\test\common\glovar.py c:\test\common\calc.py #glovar.py x = 1 #show.py from comon import glovar class Show: def showchange(self): if glovar.x!=1: print 'show x change' else: print 'show x=1' #test.py from comon.glovar import x class Test: def testchange(self): if x!=1: print 'test x change' else: print 'test x=1' #calc.py import glovar class Calc: def add(self): glovar.x+=1 #main.py from comon import glovar c = Calc() c.add()

14. Longest Common Prefix

馋奶兔 提交于 2019-11-27 07:39:16
Write a function to find the longest common prefix string amongst an array of strings. If there is no common prefix, return an empty string "" . Example 1: Input: ["flower","flow","flight"] Output: "fl" Example 2: Input: ["dog","racecar","car"] Output: "" Explanation: There is no common prefix among the input strings. Note: All given inputs are in lowercase letters a-z . class Solution(object): def longestCommonPrefix(self, strs): """ :type strs: List[str] :rtype: str """ common= '' if len(strs)==0: return common if len(strs)==1: return strs[0] str0 = strs[0] flag = True for index in range(len

[kylin] 部署kylin服务

落花浮王杯 提交于 2019-11-27 07:04:17
官网: http://kylin.apache.org/ 社区: https://github.com/KylinOLAP/Kylin/issues http://apache-kylin.74782.x6.nabble.com/ 源码: https://github.com/apache/kylin 博客: Apache Kylin的快速数据立方体算法 Apache Kylin (v1.5.0) 发布,全新设计的新一代 Apache基金会宣布Apache Kylin成为顶级项目 逐层(By Level)算法 VS 逐块(By Split) 算法 Kylin正式发布:面向大数据的终极OLAP引擎方案 Apache Kylin在百度地图的实践 京东王晓雨:Apache Kylin在云海的实践 一、工具准备 zookeeper3.4.6 (hadoop、hbase 管理工具) Hadoop.2.7.1 Hbase1.1.4 Kylin1.5.0-HBase1.1.3 Jdk1.7.80 Hive 2.0.0 二、虚拟主机 192.168.200.165 master1 192.168.200.166 master2 192.168.200.167 slave1 192.168.200.168 slave2 三、安装mysql 查看是否安装了 mysql ( master1 )

CF #579 (Div. 3) C.Common Divisors

自闭症网瘾萝莉.ら 提交于 2019-11-27 06:27:26
C.Common Divisors time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output You are given an array 𝑎 consisting of 𝑛 integers. Your task is to say the number of such positive integers 𝑥 such that 𝑥 divides each number from the array. In other words, you have to find the number of common divisors of all elements in the array. For example, if the array 𝑎 will be [2,4,6,2,10], then 1 and 2 divide each number from the array (so the answer for this test is 2). Input The first line of the input contains one integer 𝑛 (1≤𝑛≤4⋅105) — the number of

java调用so文件

寵の児 提交于 2019-11-27 05:31:14
java调用so文件: 先看头文件: 确定类,必须保持一致(包括路径: com_tracker_common_business_jobUserTag_contentTags_service_ContentTagsServiceSS ) 确定需要调用的方法(例如 globalInitFull ,返回值为boolean): /* DO NOT EDIT THIS FILE - it is machine generated */ #include "jni.h" /* Header for class com_tracker_common_business_jobUserTag_contentTags_service_ContentTagsServiceSS */ #ifndef _Included_com_tracker_common_business_jobUserTag_contentTags_service_ContentTagsServiceSS #define _Included_com_tracker_common_business_jobUserTag_contentTags_service_ContentTagsServiceSS #ifdef __cplusplus extern "C" { #endif /* * Class: com_tracker_common