- 博客(75)
- 收藏
- 关注
原创 Django + cloudfoundry + pcf
1、项目根目录下必须要有这三个文件2、文件内容分别为:2.1、Procfile// 端口必须写8080web: python3 manage.py runserver 0.0.0.0:80802.2、requirement.txt (写自己的包和版本)--index-url https://mirrors.aliyun.com/pypi/simple/pillow == 9.0.1Django == 4.0.3djangorestframework == 3.1
2022-03-25 21:30:51
1123
原创 macbook pro (M1) + install brew + brew install cloudfoundry
当前 (2022-03-25), macbook pro 用 brew 直接安装 cf 会出现如下error :cf-cli:cf-cli: The x86_64 architecture is required for this software.Error: An unsatisfied requirement failed this build.解决办法:// 安装 homebrewarch -x86_64 /bin/bash -c "$(curl -fsSL https://ra.
2022-03-25 21:13:54
3418
原创 bug: mac curl 命令 报错 bad key length
.zshrc 文件 添加一行:export CURL_SSL_BACKEND="secure-transport"然后 source ~/.zshrc 就可以了
2022-03-09 17:58:42
234
原创 angular: 部分语法格式
ng-templage ngFor<ng-template ngFor let-item [ngForOf]="items" let-i="index" [ngForTrackBy]="trackByFn">包含disable的表单,获取全部值from.getRawValue()ngSwitchCase<ng-container [ngSwitch]="switch_expression"> <div ...
2022-03-04 14:55:45
273
原创 python: 开发一个小app的几个问题
1、解决 "from utils.xx import xx " 的方案2、dev与打包后读写路径问题文件目录如下utils 文件夹作为一个package,必须包含一个 __init__.py 文件如何解决在main.py中from utils.tools import myPrint ?在main.py 最前面写上# -*- coding: utf-8 -*-import sysimport ossys.path.append(os.path.dirname..
2022-02-27 17:48:19
513
转载 JSEncrypt: 非对称加密 RSA
1、修改源码,搜索:"t.prototype.getPublicKey = function(", 在后面接着加3个函数(t.prototype.encryptLong = function(data) { const text = this.encode2Unicode(data); const akey = this.key; const maxLength = ((akey.n.bitLength() + 7) >> 3) - 11; try { const
2022-01-25 09:48:13
444
原创 load more ,滚动加载
dataAll = []data = []loadDataOpt = { pageNo: 0, hasMore: false, pageSize: 15, isLoading: false};getScreenBottomLastItemData(): number { const $list = document.querySelectorAll('.item'); const $last = $list[$list.length - 1]; const toBo.
2022-01-25 09:28:07
1030
原创 crypto-js : 加密与解密
function encrypt(param) { // method: 'AES', 'DES' // mode: 'CBC', 'ECB' const {key, text, method, mode} = param; const keyHex = CryptoJS.enc.Utf8.parse(key); if (!CryptoJS[method]) { throw new Error(`...
2022-01-13 15:19:47
665
原创 gulp: 简单指南
1、全局安装npm i--global gulp-cli2、项目中安装npm i --save-dev gulp gulp-uglify3、项目根目录新建 gulpfile.js4、执行任务cd 项目文件夹gulp task-name (eg: gulp min-js)
2022-01-11 11:10:03
198
原创 [js] : js 设置 style 的 important
const $div = document.getElementById('xxx');$div.style.setProperty('height', '100px', 'important');其他方法参见:CSSStyleDeclaration.getPropertyPriority() - Web API 接口参考 | MDNhttps://developer.mozilla.org/zh-CN/docs/Web/API/CSSStyleDeclaration/getProper
2021-12-29 16:52:01
1658
原创 angular : 自定义组件双向绑定 [(ngModel)]
NG_VALUE_ACCESSOR用于为表单控件提供ControlValueAccessorinterface ControlValueAccessor { writeValue(obj: any): void registerOnChange(fn: any): void registerOnTouched(fn: any): void setDisabledState(isDisabled: boolean)?: void}
2021-12-26 16:16:24
1738
原创 [macos - git commit] wasm code commit Allocation failed - process out of memory
1、把nodejs 从 v14.x 升级到 v15.x2、重装项目下的node_modules(据说是macbook pro m1 芯片 Xnodejs 14.x的问题 )
2021-12-22 17:49:37
604
1
原创 [解决方案] 二进制生成pdf文件,打开窗口预览文件,并设置文件名
主要难点是:URL.createObjectURL() 生成的url访问文件,文件名是随机的。(待解决)
2021-12-15 15:00:19
419
原创 [解决方案] 二进制生成pdf文件,打开窗口预览文件,并设置文件名
主要难点是:URL.createObjectURL() 生成的url访问文件,文件名是随机的。(待解决)
2021-12-15 14:58:20
620
1
原创 [解决方案-css] : 不管有几个child,都均分parent的宽度;如果只有一个,就100%
<div class="parent"> <span> 1 </span> <span> 2 </span></div><div class="parent"> <span> 1 </span></div>.parent { display: flex;}.parent > * { flex-grow: 1;}...
2021-12-07 14:38:13
466
原创 getBoundingClientRect 与 滚动加载
getBoundingClientRect用bottom举例, 获取到的数据是元素底部相对于屏幕上边的距离const client = $dom.getBoundingClientRect();1、如果元素位于屏幕上面的不可见区域,client.bottom 会是负数2、如果元素位于屏幕下面不可见区域,client.bottom > window.innerHeight假如有个滚动加载的需求:1、元素需要滚动加载,那么首先已经加载的部分最后一条记录的client....
2021-12-02 11:14:43
673
原创 angular: 动态切换主题方案之一
1、angular.json "styles": [ "src/styles.scss", { "input": "src/styles/theme.dark.scss", "bundleName": "dark", "inject": false }, { .
2021-12-01 21:27:45
1154
原创 rxjs: BehaviorSubject 与 ReplaySubject 对比
????不同点1、参数不同BehaviorSubject 的参数是 初始值ReplaySubject 的参数是缓存的值的个数2、缓存的数量不同BehaviorSubject 只能缓存最新的一个数据ReplaySubject 缓存个数自定义???? 相同点都有缓存功能示例代码: let r = new ReplaySubject(2); let b = new BehaviorSubject(100); r.next(1);
2021-11-30 16:53:13
486
原创 scss: 遍历 对象数组
$sizeList: ( (sizeName: 'xs', offset: 81.681), (sizeName: 'small', offset: 175.929), (sizeName: 'medium', offset: 257.610), (sizeName: 'large', offset: 534.0707) ); @for $i from 1 through length($sizeList) { $ite...
2021-11-30 11:01:20
1102
原创 [bugfix] windows个性化设置缩放,table的border异常
有bug的写法❌table { border-collapse: collapse;}table tr td { border-bottom: 1px solid #000;}无bug写法✅table { border-collapse: separate; border-spacing: 0;}table tr td { border-bottom: 1px solid #00...
2021-11-30 09:20:35
167
原创 rxjs: combineLatest, BehaviorSubject
combineLatest:假如 r3 一直没有 next,那么 console 就一直不会打印。BehaviorSubject会把最新的值存起来,订阅的时候会立即收到存起来的那个最新的值。声明的时候可以有个初始值。
2021-11-28 20:11:43
150
原创 ng-zorro 的 th[nzWidth]逻辑链
th.directive.ts:tr.directive.tstable.component.ts
2021-11-28 19:22:16
175
原创 rxjs: Subject 作为 subscribe的 参数
const aa = new Subject(); const sub2 = new Subject(); aa.subscribe(sub2); sub2.subscribe((data) => { console.log(data); }); aa.next(1); // sub2的订阅会收到aa.next的1;
2021-11-27 23:43:26
474
原创 rxjs: ReplaySubject, switchMap, merge,mergeMap
ReplaySubject记录 Observable 执行中的历史值并将其回放给新的订阅者。var subject = new Rx.ReplaySubject(3);参数 表示缓存几个历史数据假如参数是5, 也就是缓存5个值,订阅的时候可以收到过去发出的5个值。官方文档:概览 | RxJS 中文文档...
2021-11-27 22:26:25
611
原创 angular : @ContentChildren
@ContentChildren(MyColorDirective,{descendants:true})ListOfColor:QueryList<MyColorDirective>;
2021-11-27 17:39:14
589
原创 python: 从文件夹下所有文件中(包括子子子文件夹),找到包含关键字的文件
import osimport re def findKey(filePath, fileReg, key): for filepath,dirnames,filenames in os.walk(filePath): for filename in filenames: try: _path = os.path.join(filepath,filename) if re.search(fileReg, _path) != None: .
2021-11-27 00:28:28
1075
原创 angular: <ng-template ngFor>
<ng-template ngFor let-item [ngForOf]="items" let-i="index" [ngForTrackBy]="trackByFn"></ng-template>
2021-11-26 14:43:44
947
原创 python: 把 html中的 “40px” 转换为 “2.5em”
import redef px_2_em(matched): value = matched.group(0) n= int(value[0:-2]) / 16 return str(n) + 'em'# replace: {n}px / 16 -> {x}emdef replace(string): regexp = r'[0-9]+px' result = re.sub( regexp, px_2_em , string) return resultdef..
2021-11-25 14:56:24
554
原创 typescript:感叹号的用法
let date: string | null = new Date();function destory() { this.date= null;}function toNumber() { // 报错,因为data可能为null this.data.getTime(); // 这种写法,编译会增加代码 this.data?.getTime(); // "!" : 告诉编译器,data不可能为null或者undefined // .
2021-11-24 21:14:11
872
原创 [bug] html里面的文本的空格不见了
>场景有一段文本通过i8n translate后显示,比如:‘今天是个好日子 ’渲染后‘子’后面的空格没有占位,期望占位。解决:设置 white-space
2021-11-24 15:50:26
703
原创 python: 读取文件夹下的所有svg文件生成html以便预览
import osdef getImages(filePath): result = {} for filepath,dirnames,filenames in os.walk(filePath): key = filepath.replace('.', '') if key not in result.keys(): result[key] = [] for filename in filenames: image_path = os.path.
2021-11-23 11:12:43
1366
原创 error TS2339: Property ‘flat‘ does not exist on type ‘(number | number[])[ ]‘
let arr :any[]= [1,2,[3, 4]];arr.flat();angular 10 +tyescript配置如下:"target": "es2015","lib": ["es2015","dom","esnext"],为啥报错啊?
2021-10-29 17:16:14
616
原创 Typescript: “is“ 的用途
function isStr(p): p is string{ return typeof p === 'string';}function isStr2(p): boolean{ return typeof p === 'string';}// 上述两个function 编译后的结果一样// 区别如下:function str2Uppercase(param) { console.log(param); // param: any if (isStr(pa.
2021-10-26 17:39:30
1144
原创 Angular: /@angular/core (v12.2.4)- part 2
EmbeddedViewRefErrorHandlerEventEmitterInjectionTokenInjector...
2021-10-21 11:25:09
241
原创 Angular: /@angular/core (v12.2.4)- part 1
1、为组件、视图、变更检测、渲染以及事件处理定义基础方法。2、定义装饰器。(关于"装饰器"的知识,有空补个demo)3、定义依赖注入、国际化以及调试等各种基础架构。@angular/core@angular/core/global@angular/color/testingApplicationModule?class ApplicationInitStatus一个反应 APP_INITIALIZER function 运行状态的类。注:下面的内...
2021-10-20 18:11:22
938
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人