豪翔天下

Change My World by Program

0%

salesforce后台配置

  • Lightning Experience就是新版的系统,classic就是老版本,新功能以后都只会出现在Lightning Experience中

常用需求操作方式

导出数据

  • Setup -> Data -> Data Export -> Export Now -> Start Export,大概等个5到10分钟就能在页面下载了

添加navigation菜单到首页

  • Setup -> App Manager ,然后选择自己的首页的app,一般是Force.com,进入编辑页面就能看到Choose the Tabs设置了

跟踪对象或字段的历史修改

  • 首先需要再对象的Details设置里面打开Track Field History

  • 由于每个对象最多只能设置20个追踪字段,所以默认没有打开,针对单独的字段得单独打开,在Object Manage -> Your Object -> Fields & Relationships

    -> Set History Tracking,选中想要追踪的字段保存即可

  • jsforce sdk可以这样查询history

    • 返回的结果中,ParentId才是原始对象的Id,FIeld则是更改的字段
1
2
3
4
5
6
7
// 注意如果是标准对象,那么直接加History即可,例如AccountHistory,如果是自定义对象__c,那么需要将__c替换为__History
conn.sobject('MyCustomObject__History').find({
ParentId: "xxxxxxxxx",
Field: "xxx",
OldValue: "",
NewValue: "",
})

将自定义的对象添加为tab

增加密码过期时间

  • 默认是3个月过期,可以在这里修改Setup -> Security -> Password -> User passwords expire in
  • 注意每次修改密码后security token会变更,会发到邮箱里面,如果想再次重置,可以点击头像-> settings->Reset My Security Token

Sandbox

  • Sandbox的价格表,没错,是按照原始数据的价格来按百分比收费的,怪不得很多用户都只是partial copy,得自己想办法去将生产数据同步到sandbox中去。
  • 如果不用salesforce自己的Refresh方式,那么想要同步production到sandbox,要么借助第三方的收费工具,要么就自己去同步了,自己同步是个体力活,你必须得找到不同对象之间的关系,新插入的数据和之前的ID肯定是不一样的,整个migration程序都得维护这些ID的映射,相当麻烦
  • 注意手动刷新sandbox后,相当于删除旧的创建新的,在旧的sandbox环境里面新建的用户会消失的,新的sandbox的users总是和production的一样,只不过email添加了一个后缀.sandboxname

Apps

  • AppExchange(App Store)里面的app氛围APP、Component、Consultant

Connected App

  • New Connected App 菜单在Apps -> App Manager里面,而不是在Apps -> App Manager -> Connected Apps -> Manage Connected Apps里面

  • App ManagerManage Connected Apps里面如果有相同的app,那么可能这两个菜单点进去会是不同的设置

  • 在设置里面可以设置哪些profile能访问这个app,需要注意的是,即使选择的认证方法是POST的,如果你选择了所有人都能访问app(All users may self-authorize),那么它仍然不会去使用POST认证,会直接用GET去访问app,所以即使我们要所有人都能访问也要选择只允许选择的人(Admin approved users are pre-authorized),你可以选择所有的profile都行(在app最右边下拉Manage菜单中设置,不是View也不是edit)。注意修改后可能出现You don't have permissions to view application with namespace 错误,只需要在manage菜单的下面Profiles那里选择Manage Profiles,把System Administrator打开即可

  • app要允许oauth才能将认证token传到第三方或者自己的callback api

  • 如果要作为tab显示在顶部菜单栏,需要

    • 将connected app的canvas打开,并设置canvas app url

    • 创建visualforce page,里面需要包含这个app,创建一个canvas来包含connected app,例如

      1
      2
      3
      <apex:page standardController="Account">
      <apex:canvasApp applicationName="Connected APP的API名称" width="100%" height="5400px" maxHeight="infinite" />
      </apex:page>
    • 然后在Setup里面搜索Tabs,在visualforce里面选择它,最后再在首页的tabs里面添加即可

  • 创建了带Oauth的app后就能获取到其client_id和client_secret了(也叫Consumer Key和Consumer Secret)

Object & Fields

  • 对象的Record Types只是用于前端可以根据某个值来展示不同的表单,例如根据role来确定admin和user能设置哪些字段
  • __c结尾表示custom__r结尾表示relationship
阅读全文 »

项目配置

  • 默认端口为3000,如果要修改可以在src/main.ts中进行修改
1
2
3
# 项目初始化
npm i -g @nestjs/cli
nest new project-name

.env/dotenv配置文件支持

1
2
3
4
5
6
7
8
npm i --save @nestjs/config

// 然后在app.module.ts中引入即可
@Module({
imports: [ConfigModule.forRoot()], // 如果想要所有modules都能使用可以设置{isGlobal: true}参数
})

process.env.TEST // 使用
阅读全文 »

安装和使用

1
npm install web3 --save
  • web3下面的api是分部在不同的命名空间的
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// 可以全局用
var Web3 = require('web3');
var web3 = new Web3(Web3.givenProvider || 'ws://some.local-or-remote.node:8546');
const web3 = new Web3(new Web3.providers.WebsocketProvider('WSS_ENDPOINT', {
reconnect: { // 断开重连选项
auto: true,
delay: 5000, // ms
maxAttempts: 5,
onTimeout: false
}
}));
var eth = web3.eth

// 也可以单独用某一个命名空间的
var Eth = require('web3-eth');
var eth = new Eth(Eth.givenProvider || 'ws://some.local-or-remote.node:8546');

// 可以自定义headers
import {HttpHeader} from "web3-core-helpers";
const headers: HttpHeader[] = [{ name: 'token', value: token }];
web3 = new Web3(new Web3.providers.HttpProvider(rpcUrl || '', { headers }));
阅读全文 »

安装配置

  • Cargo是它的包管理工具,类似于npm,可以在这里搜索包crates.io
  • 安装完成后cargo, rustc, rustup工具会在~/.cargo/bin中,可以讲他们加入到环境变量中
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh	# 安装rust及对应的工具链

cargo new my_project --bin # 新建项目,如果是二进制程序就--bin,如果是创建库就--lib
cargo install --locked --path . # 根据Cargo.lock安装,相当于npm install

cargo build # 编译
cargo build --release # 进行一些优化进行编译,相当于npm run production
./target/debug/my_project # 运行编译后的二进制文件
cargo run #

# 如果出现error E0554 may not be used on the stable release channel的错误,需要使用nightly模式来安装与性能了
rustup install nightly
cargo +nightly run ...
cargo +nightly install ...
rustup install nightly-2022-03-22 # 安装指定版本的nightly
cargo +nightly-2022-03-22 run ... # 使用指定版本的nightly
  • Cargo.toml:类似于package.json文件
1
2
3
4
5
6
[package]
name = "my_project"
version = "0.0.0.0"

[dependencies] # 这里可以添加依赖项
dotenv = "0.15.0"
阅读全文 »

  • 能够非常方便地编写、测试并部署智能合约到以太坊
  • 内置了Hardhat Network,不用部署到真是的以太坊网络也能进行测试

安装配置

1
2
3
4
5
6
7
npm install -g hardhat
npx hardhat # 直接初始化项目,会生成一个hardhat.config.js配置文件,选最长的那个最全面了

# 也可以在现有项目中初始化
npm install --save hardhat
npm install --save-dev @nomiclabs/hardhat-ethers ethers @nomiclabs/hardhat-waffle ethereum-waffle chai # 安装一些测试需要用到的依赖
npx hardhat # 初始化hardhat项目,可以选择只生成配置文件
阅读全文 »

Go Ethereum

  • 对于RPC端口,如果实在得暴露到公网,其实也没啥,注意不要在network里面创建账户,即使有也要把私钥放到其他地方物理隔离,当然换端口以及防火墙也是基本操作。也可以在nginx层添加一个HTTP basic Auth认证。网上很多黑客一直在扫30303和8545端口

安装配置

1
2
3
4
5
6
7
8
9
10
11
# macos
brew tap ethereum/ethereum
brew install ethereum

# ubuntu
sudo apt-get update
sudo apt-get install software-properties-common
sudo add-apt-repository -y ppa:ethereum/ethereum
sudo apt-get update
sudo apt-get install -y ethereum
curl -LSs https://raw.githubusercontent.com/gochain/web3/master/install.sh | sh # 安装web3 CLI

常用命令

  • 直接在节点上创建的账号会生成一个json文件存储在data/keystore
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
geth --datadir ./data account list	# 列出当前所有的account
geth --datadir ./data console # 进入console

# console控制台命令
personal.newAccount('password') # 创建账号
personal.unlockAccount('0x111') # 解锁账号d

eth.accounts # 获取当前节点所有的账户信息
eth.getBalance(eth.accounts[0]) # 获取某个账户的balance
user1 = eth.accounts[1] # 在当前console为账户设置别名

admin.nodeInfo # 获取当前节点信息
admin.peers # 获取peer节点信息
net.peerCount # 获取节点数量
eth.blockNumber # 查看当前区块数量
eth.getBlock(eth.blockNumber - 1) # 获取指定块的详情,包括hash、difficulty, totalDifficulty(直到当前区块的所有difficulty的和)
eth.getTransactionCount('0x0000000') # 获取指定账户的transaction nonce值
eth.pendingTransactions # 获取当前所有pending的transaction
eth.coinbase # 获取当前的矿工

web3 account extract --keyfile data/keystore/UTC--2022-03-16T02-29-14.506737237Z--XXXXXXXX --password XXXXXXXX # 获取在当前网络上创建的账户的私钥

txpool.status # 查看当前pending和queued的transaction的状态
txpool.content.queued
txpool.inspect.queued # 查看queued的transaction的gas price
阅读全文 »

安装配置

1
2
3
apt install ffmpeg -y 

ffmpeg -version # 查看当前版本

常用命令

1
2
3
4
5
6
7
8
9
10
11
12
13
14
# 转换视频格式
ffmpeg -i video.mp4 video.avi

# 提取视频的音频
ffmpeg -i input.mp4 -vn output.mp3

# 移除视频中的音频
ffmpeg -i input.mp4 -an output.mp4

# 从视频截取任意一帧图片
ffmpeg -i test.asf -y -f image2 -ss 00:01:00 -vframes 1 test1.jpg

# 去除视频水印,简单地模糊一下,其中x和y是左上角的像素坐标,w表示宽度,h表示高度
ffmpeg -i 1.flv -filter_complex "delogo=x=1017:y=21:w=246:h=44" 2.flv
阅读全文 »

  • 基本上是我现在开发新旧项目的必备工具了
  • railly.dev: 自定义tailwindcss变量的网站

安装配置

基础

配置文件tailwind.config.js

  • 如果项目之前已经有大量的存在的css,为了防止冲突可以使用prefix去防止覆盖,对于负数的属性,prefix仍然需要写在最前面,例如tw--mt-10
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
module.exports = {
important: false, // 是否在所有生成的样式加上!important,不推荐这么做
prefix: 'tw-', // 添加一个前缀,
purge: [ // 指定需要从哪些文件中查找我们需要使用的class(这样可以只编译出我们有使用的class)
'../views/site/*.php'
],
darkMode: false, // or 'media' or 'class',默认选项
theme: {
fontFamily: { // 直接替换默认字体
'sans': 'Roboto, sans-serif',
'serif': 'Roboto, sans-serif',
'mono': 'Roboto, sans-serif',
'display': 'Roboto, sans-serif',
'body': 'Roboto, sans-serif'
},
extend: { // 可以添加一些自定义的样式,或者覆盖之前的样式,在官方文档每一个样式页面下面多有个性化的说明
backgroundImage: {
'my-bg': "url('/')" // 甚至可以这样定义一个背景图片类
main: 'linear-gradient(225deg, #BD7AE3 0%, #8461C9 100%)'
},
boxShadow: {
'md-all': '4px 4px 6px -1px rgba(0, 0, 0, 0.1), -2px 2px 4px -1px rgba(0, 0, 0, 0.06)' // 四周阴影
},
color: {
'mine': '#7383bf', // 这样使用bg-mine, text-mine
},
height: {
'full-vw': '100vw'
},
minWidth: {
'36': '9rem'
},
spacing: {
80: '20rem',
'38': '9.5rem',
'120': '30rem',
'128': '32rem',
'144': '36rem',
'160': '40rem',
172: 44rem,
'192': '48rem',
'232': '58rem',
240: '60rem',
272: '68rem',
280: '70rem',
288: '72rem',
'320': '80rem',
},
width: {
232: '58rem'
},
zIndex: {
'-10': '-10',
}
},
},
variants: {
extend: {
borderRadius: ['hover'] // 给rounded添加hover效果
},
},
plugins: [],
corePlugins: {
preflight: false, // 添加这个配置可以让tailwind不覆盖默认的基础元素的样式,例如html、body、h1等https://tailwindcss.com/docs/preflight
}
}
阅读全文 »

安装与配置

常用命令

1
2
3
4
5
yii serve 0.0.0.0 --port=8888	# 指定端口,指定host

# 缓存,缓存的文件在frontend/runtime/cache和backend/runtime/cache下面
yii cache # li
yii cache/flush-schema db # 清除db缓存

常用配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# index.php
defined('YII_DEBUG') or define('YII_DEBUG', true); # 打开debug模式

# common/config/main-local.php
'db' => [ # 数据库配置
'class' => 'yii\db\Connection',
'dsn' => 'mysql:host=localhost;dbname=password',
'username' => 'username',
'password' => 'password',
'charset' => 'utf8',
'enableSchemaCache' => true,
'schemaCacheDuration' => 86400,
'schemaCache' => 'cache',
]

// backend/config/main-local.php
$config = [
'components' => [
'request' => [
'enableCsrfValidation' => false, // 可以全局关闭csrf验证
]
]
]
阅读全文 »