build

设计模式—建造者模式(Builder)

空扰寡人 提交于 2020-03-28 10:52:02
title: 设计模式—建造者模式 建造者模式(Builder)是一步一步创建一个复杂的对象,它允许用户只通过指定复杂对象的类型和内容就可以构建它们,用户不需要知道内部的具体构建细节。建造者模式属于对象创建型模式。我们获得一个对象的时候不是直接new这个对象出来,而是对其建造者进行属性设置,然后建造者在根据设置建造出各个对象出来。建造者模式又可以称为生成器模式。 模式结构 一个标准的建造者模式包含如下角色: Builder:抽象建造者 ConcreteBuilder:具体建造者 Director:指挥者 Product:产品角色 源码导读 建造者模式使用比较简单,场景也比较清晰。protobuf中protobuf对应的java类就是使用建造者模式来创建对象的。 public static PersonEntity.Person create() { PersonEntity.Person person = PersonEntity.Person.newBuilder() .setId(1) .setName("Pushy") .setEmail("1437876073@qq.com") .build(); System.out.println(person); return person;} 一般建造者模式结合 链式编程 来使用,代码上更加美观。 spring security

go生成隐藏cmd窗口exe

元气小坏坏 提交于 2020-03-28 03:50:57
用cs veil 生成木马的时候,将go的源码进行二次改动,而后进行编译,很顺利,过了各种杀软UAC成功回连。 但是build生成的木马,运行的时候,cmd窗口就杵在那儿,这肯定是不行的。 刚开始,觉得是veil没有输出了 "守护进程"的代码,于是找了半天go daemon的代码,效果不是很理想。 想了想,veil不至于藏代码,那么可能是用c exe生成了go exe的子进程。 转头一想,veil是python的开源的,不管它做了啥,看看就好了。打开veil的源码看看。 Veil/tools/evasion/evasion_common/outfile.py中 205行,编译的命令和我的简单的编译命令"go build xxx.go"长得不太像。 正文 go build ldflags 设定编译参数 参数用法 https://golang.org/cmd/link/ go build -ldflags "-s -w -H=windowsgui" -s 省略符号表和调试信息 -w Omit the DWARF symbol table 省略DWARF符号表 -H windowsgui 不打印信息到console (On Windows, -H windowsgui writes a "GUI binary" instead of a "console binary.")

解决Ansible安装依赖问题

允我心安 提交于 2020-03-26 11:14:39
由于每台机器的环境都不尽相同,存在某些机器的yum源太小或者所带软件版本太低或缺失等问题,所以在安装软件时也可能会产生不同的依赖报错。下面我就以安装ansible时自身遇到过的依赖问题解决方法作介绍,只介绍解决依赖部分内容,安装ansible详细过程另请自行百度。 一、 使用ansible --version Ansible并未安装完成,存在依赖问题。 附报错内容: ERROR! Unexpected Exception, this is probably a bug: (cryptography 1.3.1 (/usr/lib64/python2.7/site-packages), Requirement.parse('cryptography>=1.5')) the full traceback was: Traceback (most recent call last): File "/usr/bin/ansible", line 97, in <module> mycli = getattr( import ("ansible.cli.%s" % sub, fromlist=[myclass]), myclass) File "/usr/lib/python2.7/site-packages/ansible/cli/ init .py", line 38, in

Android中的Ninja简介

血红的双手。 提交于 2020-03-26 09:41:00
copy from : https://note.qidong.name/2017/08/android-ninja/ 如果说Makefile是一个DSL,那么Ninja就是一种配置文件。 本文简单介绍Android中的 Ninja 。 Makefile与Ninja的对比 二者最核心的区别,在于设计哲学。 Makefile是设计来给人手写的,而 Ninja 设计出来是给其它程序生成的。 如果说Makefile是C语言,那么 Ninja 就是汇编语言。 如果说Makefile是一个DSL,那么Ninja就是一种配置文件。 Makefile支持分支、循环等流程控制,而 Ninja 只支持一些固定形式的配置。 二者的相同点是,都是为了控制编译流程而设计。 所以,他们的核心功能,都是指定目标,以及目标之间的依赖关系,自动计算执行顺序。 与Makefile相比,由于 Ninja 仅仅专注于核心的功能,所以有轻巧、速度快的优点。 Makefile默认文件名为 Makefile 或 makefile ,也常用 .make 或 .mk 作为文件后缀。 Ninja 的默认文件名是 build.ninja ,其它文件也以 .ninja 为后缀。 执行Makefile的程序,默认是 GNU make ,也有一些其它的实现。 Ninja 的执行程序,就是 ninja 命令。 在Android项目中,

Xcode 生成静态库相关设置:

我怕爱的太早我们不能终老 提交于 2020-03-26 06:31:05
Xcode 生成静态库相关设置: #Build Setting 1. Architectures ------- Architectures -----> $(ARCHS_STANDARD) --- Armv7, Arm64 ------- Build Active Architecture Only --> NO 若选项设为YES,在其编译时只生成当前机器的框架。 将其设置为NO后,发现用模拟器编译后生成的framework同时包含x86_64和i386架构。 2. Build Option: ----- Enable Bitcode ----> YES Bitcode是苹果在Xcode7及以后推出的新功能。用于代码的二次编译,针对CPU进行优化,编译工作由苹果AppStore后台来完成。针对iOS是可选项,默认打开。watchOS 和 tvOS 是必选项。所以需要库工程的 Apply LLVM 8.0 - Custom Compiler Flags 此选项并加上-fembed-bitcode参数,重新编译 ----- Other C Flags ----> -fembed-bitcode ----- Other C++ Flags ----> -fembed-bitcode 3. Deployment: ----- Strip Debug Symbols During Copy

Flutter: avoid build() method of previous route being called when navigate to next route

偶尔善良 提交于 2020-03-26 03:02:52
问题 My flutter app is showing a splash screen ( statefulWidget ) as a first route. This route is showing an animation while, on the background, calling an API to get some data. Once the data has been received and the animation is complete, it navigates to the second route. All works fine, except that, when calling the Navigator to navigate to the second route, the second route is shown, but i can see again the response from the API on the first route, that is being called. It turns out that, when

Unable to install .ipa from apple configurator 2 and xcode

依然范特西╮ 提交于 2020-03-26 02:09:00
问题 This is my first app to try to distribute, a beginner here. Please help me I have created an app with Expo React Native and wanted to distribute it to my friends for testing. I generate the .ipa file with the command below. expo build:ios Expo request for my credentials and some other details when I run the command above and I leave everything to the expo to handle the documents. With the generated .ipa file above, I use Apple Configurator 2 to install my app, simply “add”>“apps”>“Choose from

lintcode :Segmemt Tree Build II

微笑、不失礼 提交于 2020-03-24 07:01:39
题目 Segmemt Tree Build II The structure of Segment Tree is a binary tree which each node has two attributes start and end denote an segment / interval. start and end are both integers, they should be assigned in following rules: The root's start and end is given by build method. The left child of node A has start=A.left, end=(A.left + A.right) / 2 . The right child of node A has start=(A.left + A.right) / 2 + 1, end=A.right . if start equals to end , there will be no children for this node. Implement a build method with a given array, so that we can create a corresponding segment tree with

azkaban编译以及安装(调度系统)

余生长醉 提交于 2020-03-23 11:03:36
编译源码 下载azkaban源码 git clone https://github.com/azkaban/azkaban.git jdk要求是1.8以上版本 export JAVA_HOME=/home/work/app/presto-admin/package/jdk1.8.0_74 export PATH=$JAVA_HOME/bin:$PATH 编译 # Build Azkaban ./gradlew build # Clean the build ./gradlew clean # Build and install distributions ./gradlew installDist # Run tests ./gradlew test # Build without running tests ./gradlew build -x tes 安装 安装包路径 ls azkaban/azkaban-solo-server/build/distributions azkaban-solo-server-3.33.0-25-g3318803.tar.gz azkaban-solo-server-3.33.0-25-g3318803.zip 解压 tar -zxvf azkaban-solo-server-3.33.0-25-g3318803.tar.gz 采用默认数据库启动

eclipse到Android Studio的项目迁移

杀马特。学长 韩版系。学妹 提交于 2020-03-23 10:43:37
一直以来。公司开发都是用eclipse。可是随着我们应用不断成长。项目结构越来越庞大。项目间依赖关系变得非常复杂。用eclipse管理显得非常吃力,常常一个同事更改依赖项目之后,别人在更新。都会出现故障。由于这些事情浪费非常多时间。 终于决定迁移到Android Studio。 可是迁移的过程中还是遇到了非常多问题,通过这篇博客,把迁移过程中遇到的问题。以及每一个问题的解决方式,记录一下。也希望能帮助到有相同需求的同学。 这里就不具体介绍从eclipse导入到Android Studio的过程了。 1.乱码 用eclipse开发时编码用的是GBK,而android studio中使用的是UTF-8,所以在build的时候,项目中的温度符号,以及一些中文凝视就会出现乱码。 解决方式 统一编码,我们把编码都改成UTF-8. Android studio通过例如以下方式改项目和文件的编码: File -> Other Settings -> Default Settings -> 搜索File Encodings ->改三个地方的编码(IDE Encoding,Project Encoding,Default encoding for properties files) 2. 反复图片 我们有一个Library是从主项目中抽取出来的。抽取的过程中非常多图片从主项目中copy出来之后