凭海临风的IT江湖

  • 首页

  • 关于

  • 标签

  • 分类

  • 归档

  • 站点地图

  • 公益 404

  • 时间轴

  • 搜索

how-to-fix-cannot-change-version-of-project-dynamic-web-module-to-3.1-in-Eclipse

发表于 2019-06-03 | 更新于 2022-08-18 | 分类于 javaweb
本文字数: 846 | 阅读时长 ≈ 1 分钟

1.问题描述

试图转换Dynamic Web Module 发生如下错误:

1
2
Cannot change version of project facet Dynamic Web Module to 3.0 
One or more constraints have not been satisfied
阅读全文 »

hexo建站搭建流程

发表于 2019-05-31 | 更新于 2022-08-18 | 分类于 搭建博客
本文字数: 2.8k | 阅读时长 ≈ 3 分钟
  1. 下载并安装 Visual Studio Code, 官方下载

  2. 下载并安装 Nodejs, 官方下载

    1
    2
    node -v
    npm -v

    npm 镜像源修改为 淘宝NPM镜像

    1
    npm install -g cnpm --registry=https://registry.npm.taobao.org
  3. 下载并安装 Git, 官方下载

    1
    2
    3
    #配置名字和邮箱
    git config --global user.name "test"
    git config --global user.email "test@.com"
  1. 安装 Hexo, 官方文档

    1
    2
    cnpm install -g hexo-cli
    hexo -v

    初始化博客目录

    1
    2
    3
    4
    cd D
    hexo init blog
    cd blog
    cnpm install

    启动服务器,本地预览

    1
    hexo server
阅读全文 »

python创建字典的几种方法

发表于 2019-05-28 | 更新于 2022-08-18 | 分类于 python
本文字数: 1.3k | 阅读时长 ≈ 1 分钟

python创建字典的几种方法

1. 创建空字典

1
2
3
>>> dic = {}
>>> type(dic)
<type 'dict'>

另一种形式:

1
2
temp = dict()
temp['name'] = 'xiaoming'

2. 直接赋值创建

1
2
3
>>> dic = {'spam':1, 'egg':2, 'bar':3}
>>> dic
{'bar': 3, 'egg': 2, 'spam': 1}

3. 通过关键字dict和关键字参数创建

1
2
3
>>> dic = dict(spam = 1, egg = 2, bar =3)
>>> dic
{'bar': 3, 'egg': 2, 'spam': 1}
阅读全文 »

python操作sqlite3

发表于 2019-05-28 | 更新于 2022-08-18 | 分类于 python
本文字数: 6.8k | 阅读时长 ≈ 6 分钟

sqlite3 简介

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
SQLite数据库是一款非常小巧的嵌入式开源数据库软件,也就是说
没有独立的维护进程,所有的维护都来自于程序本身。
在python中,使用sqlite3创建数据库的连接,当我们指定的数据库文件不存在的时候
连接对象会自动创建数据库文件;如果数据库文件已经存在,则连接对象不会再创建
数据库文件,而是直接打开该数据库文件。
连接对象可以是硬盘上面的数据库文件,也可以是建立在内存中的,在内存中的数据库
执行完任何操作后,都不需要提交事务的(commit)

创建在硬盘上面: conn = sqlite3.connect('c:\\test\\test.db')
创建在内存上面: conn = sqlite3.connect('"memory:')

下面我们一硬盘上面创建数据库文件为例来具体说明:
conn = sqlite3.connect('c:\\test\\hongten.db')
其中conn对象是数据库链接对象,而对于数据库链接对象来说,具有以下操作:

commit() --事务提交
rollback() --事务回滚
close() --关闭一个数据库链接
cursor() --创建一个游标

cu = conn.cursor()
这样我们就创建了一个游标对象:cu
在sqlite3中,所有sql语句的执行都要在游标对象的参与下完成
对于游标对象cu,具有以下具体操作:

execute() --执行一条sql语句
executemany() --执行多条sql语句
close() --游标关闭
fetchone() --从结果中取出一条记录
fetchmany() --从结果中取出多条记录
fetchall() --从结果中取出所有记录
scroll() --游标滚动
阅读全文 »

selenium元素操作封装

发表于 2019-05-28 | 更新于 2022-08-18 | 分类于 自动化测试
本文字数: 1.7k | 阅读时长 ≈ 2 分钟

selenium 常用的元素定位操作

Selenium提供了8种定位方式。

  • id
  • name
  • class name
  • tag name
  • link text
  • partial link text
  • xpath
  • css selector

这8种定位方式在Python selenium中所对应的方法为:

  • find_element_by_id()

  • find_element_by_name()

  • find_element_by_class_name()

  • find_element_by_tag_name()

  • find_element_by_link_text()

  • find_element_by_partial_link_text()

  • find_element_by_xpath()

  • find_element_by_css_selector()

阅读全文 »

使用selenium访问爱奇艺网站

发表于 2019-05-28 | 更新于 2022-08-18 | 分类于 自动化测试
本文字数: 1.3k | 阅读时长 ≈ 1 分钟

使用selenium访问爱奇艺网站

selenium 是一种常用的自动化测试工具。它支持各种浏览器,包括 Chrome,Safari,Firefox 等主流界面式浏览器,如果你在这些浏览器里面安装一个 Selenium 的插件,还可以通过录制,快速生成脚本。

selenium 支持多种主流的开发语言,比如Ruby,java,python,javascript。

环境搭建

python3.7.3

运行 pip install selenium 就可以直接下载最新的selenium版本

准备

浏览器:chrome 70.0.3538.77

操作系统:win7

selenium版本: 3.14.1

chromedriver: https://npm.taobao.org/mirrors/chromedriver/70.0.3538.97/

使用selenium 打开和关闭浏览器

1
2
3
4
from selenium import webdriver
driver = webdriver.Chrome()
driver.get("http://www.iqiyi.com/")
driver.quit()
阅读全文 »

Hello World

发表于 2019-05-28 | 更新于 2022-08-18
本文字数: 357 | 阅读时长 ≈ 1 分钟

Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.

Quick Start

Create a new post

1
$ hexo new "My New Post"

More info: Writing

Run server

1
$ hexo server

More info: Server

Generate static files

1
$ hexo generate

More info: Generating

Deploy to remote sites

1
$ hexo deploy

More info: Deployment

copy maven dependencies to a folder

发表于 2016-09-30 | 更新于 2022-08-18 | 分类于 java
本文字数: 1.4k | 阅读时长 ≈ 1 分钟

copy maven dependencies to a folder

background

一个简单的需求,当你的同事需要调试代码的时候,他并不想建立maven环境,这时候依赖的jar包 该如何导出呢?

no code say nothing

这时候你需要的是maven-dependency-plugin。

添加依赖配置

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
<plugins>
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<!-- copy-dependency plugin -->
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<versionRange>[1.0.0,)</versionRange>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/alternateLocation</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>

此处的<outputDirectory> 指定了你导出jar包的路径.

执行命令 mvn dependency:copy-dependencies

查看项目多了一个/alternateLocation目录,并且依赖的jar包都下载到这个目录下了。

how to use nginx on windows

发表于 2016-09-27 | 更新于 2022-08-18 | 分类于 nginx
本文字数: 947 | 阅读时长 ≈ 1 分钟

how to use nginx on windows

1. Download nginx lastest release from here.

2. unzip to your local driver. eg: c:/apps/nginx

3. start nginx

1
2
cd c:/apps/nginx
start nginx

4. monitoring nginx process

1
2
3
4
5
tasklist /fi "imagename eq nginx.exe"
Image Name PID Session Name Session# Mem Usage
========================= ======== ================ =========== ============
nginx.exe 11700 Console 1 10,696 K
nginx.exe 1160 Console 1 11,180 K

notice
一个是主进程(main process),另一个是工作进程(work process).如果启动失败,请查看错误日志logs\error.log

5. visit http://localhost:8080

6. configuration file nginx.conf

reference config

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
error_log  logs/error.log;
http {
include mime.types;
default_type application/octet-stream;
server {
listen 8080;
server_name localhost;
location / {
root html;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
...
}

7. the command list of nginx:

1
2
3
4
nginx -s stop   快速退出
nginx -s quit 优雅退出
nginx -s reload 更换配置,启动新的工作进程,优雅的关闭以往的工作进程
nginx -s reopen 重新打开日志文件

how git changing author info

发表于 2016-09-22 | 更新于 2022-08-18 | 分类于 git
本文字数: 1.1k | 阅读时长 ≈ 1 分钟

how git changing author info

背景

  1. gitlab中的统计视图是根据用户的信息统计工作量
  2. 迁移git repo中经常会遇到用户和邮箱不一致的情况

解决思路

那么如何修改已经推送到远程的author信息呢?

github 官方提供的建议如何变更用户信息

同时也有类似的项托管在github上,git-tips-blame-someone-else

思路基本一致,就是替换提交记录、分支、标签里的author信息。

方案

1.打开终端或命令行(git bash)

2.创建一个你项目的全新裸库

1
2
git clone --bare https://github.com/user/repo.git
cd repo.git

3.复制粘贴脚本,并根据你的信息修改下面的变量:

1
2
3
OLD_EMAIL
CORRECT_NAME
CORRECT_EMAIL

脚本replace.sh

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/sh

git filter-branch --env-filter '

OLD_EMAIL="your-old-email@example.com"
CORRECT_NAME="Your Correct Name"
CORRECT_EMAIL="your-correct-email@example.com"

if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
export GIT_COMMITTER_NAME="$CORRECT_NAME"
export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL"
fi
if [ "$GIT_AUTHOR_EMAIL" = "$OLD_EMAIL" ]
then
export GIT_AUTHOR_NAME="$CORRECT_NAME"
export GIT_AUTHOR_EMAIL="$CORRECT_EMAIL"
fi
' --tag-name-filter cat -- --branches --tags

4.执行这个脚本

sh replace.sh

5.察看Git历史有没有错误

git log

6.强制推送到远程

git push --force --tags origin 'refs/heads/*'

7.清除repo.git仓库

1
2
cd ..
rm -rf repo.git
1…12131415
Jeff Sui

Jeff Sui

146 日志
35 分类
166 标签
RSS
GitHub E-Mail
  • 20201
  • 2to31
  • Boolean1
  • Centos2
  • Exception1
  • GIL1
  • GitGutter1
  • Tkinter1
  • TypeScript2
  • XML2
  • __all__1
  • _thread1
  • app1
  • argparse2
  • array1
  • atexit1
  • bisect1
  • calendar1
  • centos1
  • checkbox1
  • cmath1
  • cmd1
  • code1
  • collections.abc1
  • concurrent1
  • context-manager-types1
  • cookies1
  • copy1
  • coroutines1
  • csv1
  • cygwin1
  • dataclasses1
  • dbm1
  • dict1
  • dictionary1
  • difflib1
  • dis1
  • django4
  • docker3
  • doctest1
  • dom1
  • eclipse1
  • enum1
  • es61
  • esp323
  • esptool1
  • ffmpeg1
  • filecmp1
  • fileinput1
  • fractions1
  • functools1
  • futures1
  • gc1
  • generator1
  • git4
  • gitcafe1
  • github1
  • glob1
  • heapq1
  • hexo2
  • html.parser1
  • http2
  • http.server1
  • ios1
  • iterator1
  • itertools1
  • java3
  • javascript6
  • javaweb2
  • jdk1
  • jira1
  • json1
  • juypter1
  • keyword1
  • linecache1
  • linux2
  • lite-server1
  • m3u81
  • maven4
  • micorpython1
  • micropython2
  • minidom1
  • modulefinder1
  • mongodb1
  • mybatis1
  • mysql1
  • nbextension1
  • nginx1
  • nodejs1
  • oop1
  • operator1
  • os1
  • os.path1
  • others1
  • photo1
  • pickle1
  • pprint1
  • pwd1
  • python94
  • python31
  • queue1
  • re1
  • readline1
  • registry2
  • registry-ui2
  • reprlib1
  • sax1
  • sched1
  • select1
  • selectors1
  • selenium3
  • shutil1
  • socket1
  • sort1
  • spring1
  • sqlite32
  • ssm1
  • standar_library1
  • standard_library78
  • statistics1
  • string1
  • sublime1
  • tempfile1
  • this1
  • thread1
  • timeit1
  • turtle2
  • types1
  • uPycraft1
  • unittest1
  • urllib.robotparser1
  • uuid1
  • uv1
  • venv1
  • vscode1
  • weakref1
  • web test2
  • webbrowser1
  • webrepl1
  • windows3
  • xml2
  • 二维码1
  • 办公1
  • 博客3
  • 坑1
  • 字典1
  • 异步1
  • 循环1
  • 感悟1
  • 持续集成1
  • 搭建1
  • 搭建博客1
  • 文章1
  • 杂记3
  • 版本管理2
  • 短网址1
  • 禅道1
  • 笔记1
  • 约束1
  • 网易音乐1
  • 美化1
  • 自动化测试1
  • 软件工程1
  • 逆向工程1
  • 闭包1
  • 项目管理2
© 2015 – 2025 Jeff Sui | 811k | 12:18
由 Hexo 强力驱动 v3.9.0
|
主题 – NexT.Gemini v7.1.1
|
0%