- 博客(287)
- 资源 (1)
- 收藏
- 关注
原创 How to use SOAP API call SF
(1)Download WSDL filesSet up → API → API WSDL page → Generate Enterprise WSDLThis will take several minutes to create a page. right-click the page and save as wsdl.jsp.xml file on your local laptop.(2)Download SOAP UI OpenSource from Downl...
2021-11-14 10:09:07 851 1
原创 Rails 上传CSV数据
def upload(file_name) csv = IO.read(file_name).split("\n") csv[1..-1].map do |x| data = x.split(',') sid = data[0].gsub(/"/, '') puts sid current_term = data[1].gsub(/"/, '').chop number_of_payments = data[2].gsub(/"/, '').cho...
2021-10-18 18:26:29 186
原创 Rails sanitize
TheSanitizeHelpermodule provides a set of methods for scrubbing text of undesired HTML elements.These helper methods extend Action View making them callable within your template files.s
2021-10-18 18:21:38 196
原创 psql 数据表导入导出
$ createdb old_cms$ psql old_cms$ pg_restore --verbose --clean --no-acl --no-owner -h localhost -U aaa -d old_cms ~/Downloads/old_cms.dump# select * from pg_tables;# select * from "BlogPost";# select count(*) from "BlogPost";# \d "BlogPost";# se..
2021-07-27 06:30:33 774
原创 postgresql error /tmp/.s.PGSQL.5432
psql: error: could not connect to server: could not connect to server: No such file or directoryIs the server running locally and acceptingconnections on Unix domain socket "/tmp/.s.PGSQL.5432"?通过升级postgresql的方法解决了这个问题:brew postgresql-upgrad...
2020-08-12 12:31:51 2913
原创 keycloak 获取 access token validate token
import requests as reqimport jsonreqJson = { "client_id":"jwt-service", "client_secret": "qaaaaa-468a-4ba6-b71a-21672d1376be", "username": "aaa@aaa.com", "password": "123123", "grant_type": "password"}tokenUrl = 'http://localhost.
2020-08-09 10:40:20 1673
原创 Salesforce Rest API 查询数据
官方文档:https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/using_resources_working_with_records.htm如何生成access token? 其中client id 和 client secret可以在connected app里找到,username和password为Salesforce里一个user的用户名和 密码 + security token...
2020-08-04 10:25:10 1443
原创 Salesforce Rest API 更新数据
官方文档https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_update_fields.htm如何生成access token,其中client id 和 client secret可以在connected app里找到,username和password为Salesforce里一个user的用户名和密码,import requests as reqimport jsontest.
2020-08-04 09:58:04 618 1
原创 BeautifulSoup解析本地文件
import requestsfrom bs4 import BeautifulSoupapex_class = ''apex_trigger = ''custome_object = ''profile = ''others = ''path = '/Users/aaa/Downloads/aaa.htm'htmlfile = open(path, 'r')htmlhandle = htmlfile.read()soup = BeautifulSoup(htmlhan...
2020-07-28 10:36:45 1167
原创 What is next
Retire deprecated micro app projects. (Repo, Codeship, S3) Improve our code structure, how do we layout/split our components and services? https://indepth.dev/lean-angular-components/ Improve our mock API server. ...
2020-06-09 07:39:41 207
原创 Google Social Login with Keycloak
0. Expose your local web server to the internethttps://dashboard.ngrok.com/get-startedMy Keycloak is running on my local laptop localhost:8080. After publishing it to the internet. we could use ht...
2020-03-07 18:25:07 935
原创 openssl 加密输出变成一行
用openssl加密的时候,如果加密后的内容过长,超过64字符就会自动换成两行echo 'LVku2fpWSFFHHHctRdmkByLaj6BQeXzpMrcEYiv3KgGyVLbF2m43VGf-OWAKZ5pYiW6' | openssl enc -e -aes-128-cbc -a -salt -pass pass:qaz123wsxU2FsdGVkX19LbK7c46K...
2019-11-04 05:10:39 720
原创 ansible解密已经加密的文件
mac用户可以通过brew命令安装:brew install ansible首先把密码存在一个固定的文件里,比如~/.vault_pass.txt,方便使用。如果一个配置文件variables.yml的内容已经用ansible加密了,如何解密:ansible-vault decrypt --vault-password-file ~/.vault_pass.txt v...
2019-11-01 06:11:29 506
原创 mac 安装 配置 maven
下载的网址https://maven.apache.org/download.cgi$ curl -O https://www-eu.apache.org/dist/maven/maven-3/3.6.2/binaries/apache-maven-3.6.2-bin.tar.gz$ tar -xvf apache-maven-3.6.2-bin.tar.gz$ sudo mv...
2019-10-17 08:49:32 196
原创 Intellij IDEA配置Maven 使用本地Nexus
打开Intellij,点击左上角从下来菜单里进入Preferences。配置maven地址上图中settings.xml配置如下:<?xml version="1.0" encoding="UTF-8"?><settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmln...
2019-10-17 07:01:36 2120
原创 Rails Rspec 单元测试 验证接口 返回格式 所有字段
如何在单元测试中测试接口返回的字段?如果我们有一个api的entity为 employment.rb# frozen_string_literal: truemodule API::Entities::BorrowerEntities class Employment < API::Entity param :in_type_id, safe_path: %i[p...
2019-10-16 06:05:56 237
原创 rails hirefire-resource gem
https://help.hirefire.io/article/54-job-queue-ruby-rackhttps://github.com/hirefire/hirefire-resourceThis library provides middleware which you can add to your stack, exposing an HTTP GET end...
2019-10-15 09:42:20 126
原创 Keycloak 导入多个领域文件 import multiple realms
官方文档https://www.keycloak.org/docs/7.0/server_admin/#admin-console-export-importIf more than one realm file needs to be imported, a comma separated list of file names can be specified.This is more...
2019-10-14 09:58:48 696
原创 docker 常用命令
先介绍一个网站:https://hub.docker.com/在这个网站里可以搜索所有相关的docker image下载某个版本的docker镜像:$ docker pull jboss/keycloak:3.3.0.Final如果直接下载最新版本,不需要加版本号$ docker pull jboss/keycloak查看所有的docker contai...
2019-10-11 11:48:27 188
原创 salesforce local env 配置 本地环境
IDESalesforce Extension Pack + VS Code (Highly Recommended)This is the current Salesforce Official IDE providing full support for both traditional Sandbox (which is what we are doing in Harmone...
2019-10-11 11:04:21 337
原创 docker 可视化工具 kitematic
https://kitematic.com/docs/mac 的下载地址是:https://docs.docker.com/docker-for-mac/install/
2019-10-11 10:52:36 373
原创 keycloak docker compose 导入 realm
如果需要提前将已有keycloak的realm导出并通过docker-compose导入,用下图的方式导出,将导出的文件命名为realms.json新建文件夹并创建文件: docker-compose.ymlversion: "3"services: keycloak: image: jboss/keycloak:7.0.0 ports: ...
2019-10-11 10:27:41 758
原创 Using Redis as a Login Session Store Rails
用到的gem有:gem 'activerecord-session_store', '~> 0.1.0'gem 'redis', '~> 3.3.3'gem 'redis-namespace', '~> 1.6.0'gem 'redis-rack-cache'gem 'redis-rails', '~> 4.0.0'config/initiali...
2019-09-25 09:41:29 226
原创 解决 Rails 默认搜索带default_scope的问题: unscope 用法
假设有一个model为book.rb, 里面有一个默认的搜索条件:default_scope { where(display: true) }也就是说如果直接写查询语句的话,默认是只能搜索到display 为true的book,如果默认查询所有的book呢,这里就用到unscopeunscoped_book= Book.unscoped.find(book_id)参考:...
2019-09-25 06:09:48 612
原创 angular 获取键盘输入的值
注意不要用event.keyCode,https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEventjs代码resetBankAccountNumber(id) { this.setBankAccountValidity('ownBankAccount', true, id); } isInput...
2019-09-19 05:43:17 1321
原创 mac安装 jupyter notebook
https://jupyter.org/install.html安装:pip install jupyterlab启动:jupyter notebook如果想用来测试http请求,需要安装requestspip install requests接下来测试一下get、post请求Get access token from KeyCloakimp...
2019-09-06 15:01:29 637
原创 OpenSSL Cipher 加密解密 Ruby on Rails
最近在做OpenSSL::Cipher.new的优化:application_controller.rb def decrypter(data) key = ENV['ENCRYPTION_KEY'] iv = ENV['ENCRYPTION_IV'] decipher = OpenSSL::Cipher.new('des3') decipher.dec...
2019-08-12 09:05:34 1133
原创 如何用serverless创建aws-lambda
https://serverless.com/framework/docs/providers/aws/guide/quick-start/安装serverless$npm install -g serverless$mkdir serverless-demo$cd serverless-demo/$serverless create -t aws-nodejs从aw...
2019-08-07 07:36:59 985
原创 python操作postgreSQL数据库
Recommended solution: https://docs.aws.amazon.com/lambda/latest/dg/vpc-rds.htmlCoded a python script (as attached) for insert the biller details to the dev db, it works well per my testing on the de...
2019-08-03 11:54:49 518
原创 grafana设置 cloudwatch 监控 aws efs
Using AWS CloudWatch in Grafanahttps://grafana.com/docs/features/datasources/cloudwatch/http://IP:3000/datasources在这个页面可以查看之前设置过的所有数据源点击“Add data source”可以添加一个新的数据源, 注意类型选择 CloudWatchAcce...
2019-06-30 18:12:02 2483
原创 安装Prometheus和Grafana
(一) 安装prometheus install$ wget https://github.com/prometheus/prometheus/releases/download/v2.4.3/prometheus-2.4.3.linux-amd64.tar.gz$ tar zxvf prometheus-2.4.3.linux-amd64.tar.gz$ cd prometheus-...
2019-06-28 18:26:26 571
原创 java导出csv
在java中如何导出csv文件 public void doGet(HttpServletRequest request, HttpServletResponse response){ response.setContentType("text/csv"); response.setHeader("Content-Disposition", "attachment; f...
2018-10-06 15:04:05 786
原创 mysql binlog的格式
MySQL binlog的格式有三种:基于SQL语句的复制(statement-based replication, SBR)基于行的复制(row-based replication, RBR)混合模式复制(mixed-based replication, MBR)相应地,binlog的格式也有三种:STATEMENT,ROW,MIXED。它主要用于mysql的复制技术。idb基本上都是供的基于行...
2018-04-12 15:10:39 499
原创 memcached内存分类机制
内存分配机制mc内存分配机制简介memcached默认情况下采用了名为Slab Allocator的机制分配、管理内存,Slab Allocator的基本原理是按照预先规定的大小,将分配的内存分割成特定长度的块,以完全解决内存碎片问题。先来解释一下与Slab Allocator存储有关的几个术语:Page:分配给Slab的内存空间,默认是1MB。分配给Slab之后根据slab的大小切分成chunk...
2018-04-12 15:08:48 235
原创 Java生产者和消费者
synchronizedThis version is the fewest lines of code, largely because the synchronization mechanism used is built into the language and runtime. But the programmer has to remember to avoid a couple of...
2018-04-12 15:05:45 262
原创 一致性哈希原理及应用浅析
背景现实场景单个节点的容量达到上限,无法继续单点增加内存,如何解决?单个节点支撑的QPS达到上限,如何解决?初步方案 增加N个缓存节点,为了保证缓存数据的均匀,一般情况会采用对key值hash,然后取模的方式,然后根据结果,确认数据落到哪台节点上:如下:hash(key)%N很好,这个的确解决了上面的问题,实现了初步的分布式存储,数据均匀分散到了各个节点上,流量请求也均匀的分散到了各个节点。方...
2018-04-12 15:03:06 355
原创 Java线程状态
Java中的线程的生命周期大体可分为5种状态。新建(NEW):新创建了一个线程对象。可运行(RUNNABLE):线程对象创建后,其他线程(比如main线程)调用了该对象的start()方法。该状态的线程位于可运行线程池中,等待被线程调度选中,获取cpu 的使用权 。运行(RUNNING):可运行状态(runnable)的线程获得了cpu 时间片(timeslice) ,执行程序代码。阻塞(BLOC...
2018-04-12 14:58:42 208
原创 Java多线程中断机制
thread中的三个方法:interrupt()、interrupted()、isInterrupted()1、interrupt()public void interrupt() { if (this != Thread.currentThread()) checkAccess(); synchronized (blockerLock) { Interruptible...
2018-04-12 14:56:29 344
原创 java阻塞队列
JDK7提供了7个阻塞队列。分别是ArrayBlockingQueue :一个由数组结构组成的有界阻塞队列。LinkedBlockingQueue :一个由链表结构组成的有界阻塞队列。PriorityBlockingQueue :一个支持优先级排序的无界阻塞队列。DelayQueue:一个使用优先级队列实现的无界阻塞队列。SynchronousQueue:一个不存储元素的阻塞队列。LinkedTr...
2018-04-12 14:53:10 312
原创 java常见知识点
深度方面:基础: 1、事务4个特征介绍;acid2、排序算法;3、简单描述2、3个设计模式4、乱码问题如何解,utf8和gbk编码本质区别是什么?5、一致性hash算法描述?6、冥等操作用于那些场景?(如何防止重复提交)7、序列化思路有那些?8、数据加密协议有那些?9、http协议有那些部分组成?10、字符流和字节流的区别?java:1、JUC库包括那些核心类?详细讲解其中几个。 参考: 2、多...
2018-04-12 14:49:57 340
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人