genweiwu / blog Goto Github PK
View Code? Open in Web Editor NEW个人技术能力提升
License: MIT License
个人技术能力提升
License: MIT License
绑定事件,类似onerror
要写成on-error
js写法
<video onpause="doc.videoPause(this)" onplay="doc.videoPlay(this)" onclick="doc.videoClick(this)" onerror="doc.videoError()"
src="" width="100%" preload='auto' controls style="max-height: 600px;">
</video>
angular2写法
<video on-pause="videoPause(this)" on-play="videoPlay(this)" on-click="videoClick(this)" on-error="videoError()"
src="" width="100%" preload='auto' controls style="max-height: 600px;">
</video>
现在要用一个a.js,但是a.js中调用了common.js中的公共方法。如何一起迁移到angular2项目中?
一开始的方法是:
在component.ts中
import 'assets/common.js';
import 'assets/a.js';
但是发现a.js无法调用到common.js中的方法
在component.ts中
//import 'assets/common.js';
import 'assets/a.js';
在index.html中通过script标签引入 common.js。
目前看来是可行的。
import 'ztree';
引入ztree
报错,发现它会去下面的路径下查找。
[D:\iRTT_new\code\request_service\angular\node_modules\ztree]
[D:\iRTT_new\code\request_service\angular\src\ztree]
直接import的效果是:
直接去node_moudle下面去找同名的文件夹,或者直接去src目录下查找
直接在component.ts中加入
import 'assets/3rd/zTree/js/jquery.ztree.all.js';
下面的方法无法正常返回希望的值
test(): boolean {
this.service.getData(result => {
console.log("return true");
return true;
});
console.log("return false");
return false;
}
想实现类似在jQuery.ready方法中调用一个函数的能力。
一开始使用 ngAfterViewChecked
,发现ngAfterViewChecked
函数会一直被触发。
当前改用ngAfterViewInit
来实现的。
org.apache.tomcat.util.http.fileupload.FileUploadBase$FileSizeLimitExceededException
https://github.com/oldmanpushcart/greys-anatomy/wiki/greys-pdf
实现一个类似左侧树,右侧页面的页面,右侧页面是一个iframe;
通过点击左侧的不同按钮,右侧展示不同页面。
比如先点击按钮1,右侧展示iframe为333.html
再点击按钮2,右侧展示iframe为444.html
再点击按钮3,右侧展示iframe为555.html
这个时候,你点击回退按钮,会发现iframe页面回到444.html
再点击回退,iframe页面回退到333.html
(这些是浏览器自动记录历史自动支持的)
但是,你想做到回退的时候,左侧按钮也定位到对应按钮,却不好实现?
你会发现,点击回退按钮,虽然iframe内容会改变,但是iframe的src根本不会改变。
虽然onload事件仍然会触发,但是js中读取src也是不变的
当前参考的实现是,既然没法去有效监听iframe的src的改变,那么就在每个iframe的页面中,加载一个js方法去做这个动作。参考下方演示中控制台打印的内容!
@HostListener('window:resize')
resizeFunction(){
//...
}
经过测试,改变页面上的元素如div的大小,不会触发。只在改变窗口大小时会触发。
This demo uses data from TheMovieDB (TMDB) to demonstrate using Ranklib learning to rank models with Elasticsearch.
This demo requires
elasticsearch
and requests
librarieselasticsearch_xpack
libraries if xpack support is necessaryUsing the LTR plugin with xpack requires configuring appropriate roles. These
can be setup automatically by prepare_xpack.py
which takes a username and
will prompt for a password. After this is run settings.cfg
must be edited to
uncomment the ESUser and ESPassword properties.
python prepare_xpack.py <xpack admin username>
The first time you run this demo, fetch RankLib.jar (used to train model) and tmdb.json (the dataset used)
python prepare.py
Start a supported version of Elasticsearch and follow the instructions to install the learning to rank plugin.
This script will create a 'tmdb' index with default/simple mappings. You can edit this file to play with mappings.
python indexMlTmdb.py
If you're actually going to build a learning to rank system, read past this section. But to sum up, the full Movie demo can be run by
python train.py
Then you can search using
python search.py Rambo
and search results can be printed to the console.
More on how all this actually works below:
A "feature" in ES LTR corresponds to an Elasticsearch query. The score yielded by the query is used to train and evaluate the model. For example, if you feel that a TF*IDF title score corresponds to higher relevance, then that's a feature you'd want to train on! Other features might include how old a movie is, the number of keywords in a query, or whatever else you suspect might correlate to your user's sense of relevance.
If you examine loadFeatures.py you'll see how we create features. We first initialize the default feature store (PUT /_ltr
). We create a feature set (POST /_ltr/_featureset/movie_features
). Now we have a place to create features for both logging & use by our models!
In the demo features 1...n json are mustache templates that correspond to the features. In this case, the features are identified by ordinal (feature 1 is in 1.json). They are uploaded to Elasticsearch Learning to Rank with these ordinals as the feature name. In eachFeature
, you'll see a loop where we access each mustache template an the file system and return a JSON body for adding the feature to Elasticsearch.
For traditional Ranklib models, the ordinal is the only way features are identified. Other models use feature names which make developing, logging, and managing features more maintainable.
The first part of the training data is the judgment list. We've provided one in sample_judgments.txt.
What's a judgment list? A judgment list tells us how relevant a document is for a search query. In other words, a three-tuple of
<grade>,<docId>,<keywords>
Quality comes in the form of grades. For example if movie "First Blood" is considered extremely relevant for the query Rambo, we give it a grade of 4 ('exactly relevant'). The movie Bambi would receive a '0'. Instead of the notional CSV format above, Ranklib and other learning to rank systems use a format from LibSVM, shown below:
# qid:1: rambo
#
#
# grade (0-4) queryid # docId title
4 qid:1 # 7555 Rambo
You'll notice we bastardize this syntax to add comments identifying the keywords associated with each query id, and append metadata to each line. Code provided in judgments.py handles this syntax.
You saw above how we created features, the next step is to log features for each judgment 3-tuple. This code is in collectFeatures.py. Logging features can be done in several different contexts. Of course, in a production system, you may wish to log features as users search. In other contexts, you may have a hand-created judgment list (as we do) and wish to simply ask Elasticsearch Learning to Rank for feature values for query/document pairs.
Is collectFeatures.py, you'll see an sltr
query is included. This query points to a featureSet, not a model. So it does not influence the score. We filter down to needed document ids for each keyword and allow this sltr
query to run.
You'll also notice an ext
component in the request. This search extension is part of the Elasticsearch Learning to Rank plugin and allows you to configure feature logging. You'll noticed it refers to the query name of sltr
, allowing it to pluck out the sltr
query and perform logging associated with the feature set.
Once features are gathered, the judgment list is fleshed out with feature value, the ordinals below corresponding to the features in our 1..n.json files.
4 qid:1 1:12.318446 2:9.8376875 # 7555 rambo
With training data in place, it's time to ask RankLib to train a model, and output to a test file. RankLib supports linear models, ListNet, and several tree-based models such as LambdaMART. In train.py you'll notice how RankLib is called with command line arguments. Models test_N
are created in our feature store for each type of RankLib model. In the saveModel
function, you can see how the model is uploaded to our "movie_features" feature set.
See what sort of search results you get! In search.py
you'll see we execute the sltr
query referring to a test_N
model in the rescore phase. By default test_6
is used (corresponding to LambdaMART), but you can change the used model at the command line.
Search with default LambdaMART:
python search.py rambo
Try a different model:
python search.py rambo test_8
比如
Logger log = LogFactory.getLoger(A.class)
同时A在com.njust.test
包下,
那么配置name时应该配置哪个呢?
chrome安装DevTools显示vue.js not detected
需要勾选扩展程序的允许访问文件网址
package com.njust.test.json;
import java.util.HashMap;
import org.junit.Assert;
import org.junit.Test;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
public class JsonTest
{
@Test
public void test01()
{
//由于不允许直接put null,所以模拟下
String nullValue = new HashMap<String, String>().get("aa");
ObjectMapper mapper = new ObjectMapper();
ObjectNode objectNode = mapper.createObjectNode();
objectNode.put("name", "111");
objectNode.put("age", nullValue);
//name
String name = objectNode.get("name").asText();
Assert.assertEquals(name, "111");
//age
String age = objectNode.get("age").asText(); //得到字符串:"null"
Assert.assertEquals(objectNode.has("age"), true);
Assert.assertNotNull(age);
Assert.assertEquals(age, "null");
String age2 = objectNode.path("age").asText(); //得到字符串:"null"
Assert.assertEquals(age2, "null");
String age3 = objectNode.path("age").asText(null); //得到null
Assert.assertNull(age3);
//country
Assert.assertEquals(objectNode.has("country"), false);
String country = objectNode.path("country").asText(); //得到空字符串:""
Assert.assertNotNull(country);
Assert.assertEquals(country, "");
String country2 = objectNode.path("country").asText(null); //得到null
Assert.assertNull(country2);
}
}
function test() {
function hello() {
}
return hello;
}
var t1 = test();
var t2 = test();
console.log(t1 === t2); //false
例如,我在index.html中引入了ztreeStyle.css,我在自己的component.css中写了css想覆盖他的样式,
但是实际上没生效。
在index.html中引入另一个css文件,在这个css文件进行样式覆盖。
但是对一个的缺点就是,无法针对单个组件进行样式调整。
ERROR in D:/daveCode/adc-demo222/node_modules/st-angular-ui/core/a11y/focus-trap.ts (36,35): Property 'first' does not exist on type 'EventEmitter<any>'.
ERROR in D:/daveCode/adc-demo222/node_modules/st-angular-ui/core/a11y/focus-trap.ts (46,35): Property 'first' does not exist on type 'EventEmitter<any>'.
ERROR in D:/daveCode/adc-demo222/node_modules/st-angular-ui/icon/icon.ts (154,67): Property 'first' does not exist on type 'Observable<SVGElement>'.
D:\daveCode\adc-demo222>npm list rxjs
[email protected] D:\daveCode\adc-demo222
+-- @angular/[email protected]
| `-- [email protected]
`-- [email protected]
查找当前文件夹下的xml文件,找出内容包含table-name的行的内容
grep "table-name" . -r --include *.xml
for f in *.zip; do
dir=${f%.zip}
unzip -d "./$dir" "./$f"
done
预留
https://docs.docker.com/get-started/
镜像
是一个软件包,包括了软件本身以及软件运行所需的环境
容器
则是由镜像
启动的,即启动一个镜像得到一个容器,就是一个镜像
的实例
docker ps
用来查看当前机器上的容器
~/.docker/config.json
"proxies":
{
"default":
{
"httpProxy": "http://127.0.0.1:3001",
"httpsProxy": "http://127.0.0.1:3001",
"noProxy": "*.test.example.com,.example2.com"
}
}
{
"registry-mirrors":["https://registry.docker-cn.com"]
}
systemctl daemon-reload
systemctl restart docker
/etc/docker/daemon.json
{
"insecure-registries": [
"test.docker.jiankunking.io:5000",
"hub.docker.jiankunking.io:5000"
]
}
具体如下:
test.js中的方法
function hello() {
console.log("Hello world!");
}
function hello222() {
console.log("Hello world222222!");
}
在angular的component.ts中如何调用hello方法呢?
export function hello() {
console.log("Hello world!");
}
export function hello222() {
console.log("Hello world222222!");
}
import { hello,hello222 } from './test';
hello();
hello222();
参考这里的解决方法
export var vvv = function () {
console.log("vvv is here!");
}
export var vvv222 = "this is a varible";
I have write some code like this:
<h1 *ngIf="hello('hhh')">我在这里</h1>
but I found that hello
method is being called many times.
this can be a trouble when hello
called method from server,which will make the page being blocked 😭
*.car ==> *.jar
for file in *.car; do
echo "$(basename "$file" .car).jar"
done
预留
http://www.nanjing.gov.cn/xxgk/czgl/rxnjfxygb/201703/t20170315_4398239.html
可以自助打印,身份证+人脸识别
必须周一到周五 9点到5点(周六银行上班也无法打印)
echo $(date +%Y%m%d%H%M)
仅供参考
2、
OsgiBundleResourcePatternResolver
今天遇到一个奇怪的问题,使用@input()描述了一个变量param
,但是 ngOnChanges(changes: SimpleChanges)
方法一直没法触发。
后来发现param
的结构类似
param = {id:xxx}
如果只是修改id的属性,比如从
param= {id:111}
修改成
param= {id:222}
是无法触发的。
后来发现,每次修改属性id前,都重新初始化 param={}
,再来设置他的属性,就能正常触发了。
ngOnChanges的检测只检测了对象是不是之前的对象,而没有去检测同一个对象,但是内容修改了的情况。
学些下单向和双向的一些区别
预留
https://www.cnblogs.com/yugen/archive/2010/07/25/1784763.html
注意:
-- 不可以同时指定用户和表
EXP SONIC/SONIC BUFFER=64000 FILE=C:\SONIC.DMP OWNER=SONIC TABLES=(SONIC)
-- bash中要注意加引号
EXP SONIC/SONIC BUFFER=64000 FILE=C:\SONIC.DMP TABLES="(SONIC) "
可以通过
window.parent.location
获取url请求信息,进而推测出对应的页面
参考:https://blog.csdn.net/qq_27093465/article/details/73229016
类中的使用
方法中的使用
比如自定义的content-type
是application/xxx
import java.io.IOException;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import org.springframework.http.HttpInputMessage;
import org.springframework.http.HttpOutputMessage;
import org.springframework.http.MediaType;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.HttpMessageNotReadableException;
import org.springframework.http.converter.HttpMessageNotWritableException;
import com.fasterxml.jackson.databind.ObjectMapper;
public class CustomerMessageConverter implements HttpMessageConverter
{
private MediaType supportedMediaType = MediaType.valueOf("application/xxx");
private ObjectMapper mapper = new ObjectMapper();
@Override
public boolean canRead(Class clazz, MediaType mediaType)
{
return supportedMediaType.includes(mediaType);
}
@Override
public boolean canWrite(Class clazz, MediaType mediaType)
{
return supportedMediaType.includes(mediaType);
}
@Override
public List<MediaType> getSupportedMediaTypes()
{
return Collections.singletonList(supportedMediaType);
}
@Override
public Object read(Class clazz, HttpInputMessage inputMessage)
throws IOException, HttpMessageNotReadableException
{
return mapper.readValue(inputMessage.getBody(), clazz);
}
@Override
public void write(Object o, MediaType contentType, HttpOutputMessage outputMessage)
throws IOException, HttpMessageNotWritableException
{
mapper.writeValue(outputMessage.getBody(), o);
}
}
@SpringBootApplication
public class Application
{
public static void main(String[] args)
{
SpringApplication.run(Application.class, args);
}
@Bean
public HttpMessageConverter customMessageConverter()
{
return new UeeMessageConverter();
}
}
sql查询时,exists or exists
SQL Queries using EXISTS and OR operator
😺 windows上请使用exe版本安装,而不是zip解压版
修改cntlm
安装目录下的cntlm.ini
,调整为自己需要的内容;
对于password
,如果不想使用明文密码,可以先不设置;
如:
Username dave
Domain china
Password password
cntml- H
进行初始化此时会提示输入密码。
复制PassLM
等信息到cntml.ini
文件中对应位置。
C:\Program Files (x86)\Cntlm>cntlm.exe -H
"tty" option detected in CYGWIN environment variable.
CYGWIN=tty is no longer supported. Please remove it from your
CYGWIN environment variable and use a terminal emulator like mintty,
xterm, or rxvt.
cygwin warning:
MS-DOS style path detected: C:\Program Files (x86)\Cntlm\cntlm.ini
Preferred POSIX equivalent is: /Cntlm/cntlm.ini
CYGWIN environment variable option "nodosfilewarning" turns off this warning.
Consult the user's guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
Password:
PassLM EE692D19A51BD430C9F8858E73320BF6
PassNT A5D204104F5B09FEDCCFD9BFBC9C7251
PassNTLMv2 EB49E277191F47C788FDA722E6DB20ED # Only for user 'dave', domain 'china'
如何配置文件路径不对,尝试指定路径
cntlm.exe -c cntlm.ini -H
Proxy 10.0.0.42:8080
Auth NTLM
C:\Program Files (x86)\Cntlm>net start cntlm
Cntlm Authentication Proxy 服务正在启动 .
Cntlm Authentication Proxy 服务已经启动成功。
C:\Program Files (x86)\Cntlm>net stop cntlm
Cntlm Authentication Proxy 服务正在停止.
Cntlm Authentication Proxy 服务已成功停止。
.spec.ts
问题打开vscode的工程的.vscode
下的settings.json
文件,
设置如下:
"files.exclude": {
"**/*.spec.ts": true
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.