git命令遇到索引错误Invalid data in index
idea中使用git命令更新代码,提交时报错Invalid data in index。 解决方法,删除.git/index后,运行git reset。
mv .git/index .git/index_old
git reset
git ls-files
参考
在maven中使用Jetty插件运行应用
在pom.xml中配置jetty 插件
Jetty是一个轻量级的war应用容器, 可以本地开发、测试时替换tomcat运行java web 应用, 更新方案快捷。
Jetty支持作为maven插件来运行,在pom.xml中的build/plugins部分配置插件后就可以直接启动了, 不需要下载。
<project>
...
<build>
<plugins>
...
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.4.48.v20220622</version>
<configuration>
<webApp>
<contextPath>/myapp</contextPath>
</webApp>
<httpConnector>
<port>8080</port>
</httpConnector>
</configuration>
</plugin>
</plugins>
</build>
</project>
timeout 问题处理
今天在idea上通过maven启动jetty开发服务器时,遇到报错timeout scanning annotations,启动失败。 通过设置参数来解决。
- 第一种是在idea的参数中配置, 给应用的JVM参数加上
-Dorg.eclipse.jetty.annotations.maxWait=300 - 另外可以在pom.xml中给jetty插件进行配置
<configuration>
<systemProperties>
<systemProperty>
<name>org.eclipse.jetty.annotations.maxWait</name>
<value>300</value>
</systemProperty>
</systemProperties>
...
</configuration>
Git子模板submodule的删除操作
git submodule子模块的删除操作
git submodule deinit {module_name}
git rm --cached {module_name}
git commit -am "removed submodule"
clone带子模板的git仓库
# 先clone仓库
git clone http://xxx
# 初始化子模块, 创建文件夹
git submodule init
# 拉取子模块代码
git submodule update
或者一条命令搞定
git submodule update --init --recursive
添加子模块
git submodule add http://xxxx sub_path
git commit -m "add submodule"
在python使用win32com库来读取excel
在python语言读取excel的有多种库可以实现。这里在windows下通过pywin32调用Microsoft Excel软件的COM对象接口来实现,使用的API与VBA类似。
安装pywin32库
python下安装库首选使用pip。如果使用virtualenv的话,也可以先为工程一个新的virtualenv, 再在virtualenv环境中安装。
python -m pip install pywin32
打开Excel文件,读取单元格内容
读取excel的流程, 肯定是先打开一个文件, 创建workbook对象, 再从workbook中获取worksheet对象,worksheet即sheet页,然后读取worksheet中的单元格内容。
import win32com.client
# 连接excel应用,不显示窗口
xl_app = win32com.client.DispatchEx('Excel.Application')
xl_app.DisplayAlerts = False
xl_app.Visible = False
# 打开文件
workbook = xl_app.Workbooks.Open('some.xlsx')
worksheet = workbook.Worksheets('Sheet1')
#打印单元格内容
print(worksheet.Range('A1'))
#关闭
workbook.Close(False)
xl_app.Quit()
获取单元格属性
cell = worksheet.Range('A1')
# 坐标
print(cell.Address)
# 是否为合并单元格
if cell.MergeCells:
print(cell.MergeArea, cell.MergeArea.Columns.Count, cell.MergeArea.Rows.Count)
# 对齐方式
print(cell.HorizontalAlignment)
# 字体
print(cell.Font.Bold, cell.Font.Size)
# 背景色
print(cell.Interior.ColorIndex)
Microsoft VBA 参考
Excel中API中使用还是得看官方文档,请访问 https://learn.microsoft.com/en-us/office/vba/api/excel.range(object)
新建了gist.99steps.cn分享代码片段
很多时候分享代码不需要写很多文字或者专门写个博客, 只需要简单的代码片段与文件即可。基于如上,搞了个简单的页面,类似github的gist, 分享一点点小功能的代码、外加简单的说明。
功能基于django, 很早之前搭建的,放着没有使用,现在重新启动。
使用poetry来管理python依赖
开发python时通常会使用virtualenv来创建独立的依赖环境,而使用pip来安装依赖包,依赖包版本写在文件requirements.txt中。工具poetry可以同时完成virtualenv与pip的工具,为每一个项目单独创建virtualenv环境, 而且像npm管理nodejs的依赖包版本与安装依赖包一样, poetry会安装依赖,将项目信息与依赖包写入pyproject.toml文件中, 是python开发好助手。
安装 peotry
官网 https://python-poetry.org/, 安装要求Python3.8+
curl -sSL https://install.python-poetry.org | python3 -
poetry --version
python3 -m poetry --version
初始化项目
- 新建项目文件夹
poetry new poetry-demo - 在已有项目文件夹下初始化
poetry init
安装依赖
- 新增一个依赖包
poetry add requests - 安装依赖包
poetry install
运行
poetry run python app.py
Create web app with Python sanic
sanic 是一个轻量、快速的python web框架,提供与Flask 类似的API, 创建restful API接口超轻松。
简单示例
from sanic import Sanic
from sanic.response import text
app = Sanic("MyHelloWorldApp")
@app.get("/")
async def hello_world(request):
return text("Hello, world.")
if __name__ == '__main__':
app.run(debug=True, access_log=True)
搭建Hugo开发环境
使用Hugo来搭建静态内容超级简单了。 参考 https://gohugo.io/getting-started/quick-start/
快速起步
下载hugo软件包,解压到本地之后就可以开始了。命令如下
hugo new site quickstart
cd quickstart
git init
git submodule add https://github.com/theNewDynamic/gohugo-theme-ananke.git themes/ananke
echo "theme = 'ananke'" >> hugo.toml
hugo server
新建内容,比如POST。 新生成的md的头部meta中draft字段的值为true, 当编写完成后要发布时改为false。
hugo new posts/my-first-post.md
构建发布,生成的静态内容位于public目录下,可以用于部署在nginx下。
hugo
Contents About Flex Actionscript
Flash 中使用的格式有swf、swc、swz. ActionScript3 对标ECScript 3, 已在2022年停止支持; 编译后生成abc 字节码,在avm2 虚拟机中运行。
参考资料
Apache Royale https://github.com/apache/royale-compiler
框架 Cairngorm https://sourceforge.net/adobe/cairngorm/wiki/GettingStartedWithCairngorm/ https://baike.baidu.com/item/Cairngorm/6331423
mozilla Tamarin项目已停止支持, 项目主页已经打不开了
tarmarin-redux https://hg.mozilla.org/tamarin-redux https://www-archive.mozilla.org/projects/tamarin/
https://github.com/adobe https://github.com/adobe/aio-theme
harman airsdk https://airsdk.harman.com/ https://leaningtech.com/cheerpx-for-flash/
https://wiki.mozilla.org/Tamarin MMgc is the Tamarin garbage collector.
haXe is a compiler that can target Tamarin. Implemented in OCaml. http://haxe.org/
Haxe 强类型编程语言, 可编译为其它支持的类型, 有自己的虚拟机 https://github.com/HaxeFoundation/haxe
adobe 下载页 https://helpx.adobe.com/air/archived-docs-download.html
swf反编译工具 https://github.com/jindrapetrik/jpexs-decompiler/wiki https://www.flash-decompiler.com/
debug/console https://www.softpedia.com/get/Programming/Debuggers-Decompilers-Dissasemblers/Alcon.shtml
FlexUnit FlexMonkey
vscode插件 https://github.com/BowlerHatLLC/vscode-as3mxml
flex 转换js https://github.com/Next2D/player https://github.com/apache/royale-asjs
flash player
flash cn https://www.flash.cn/
https://github.com/ruffle-rs/ruffle A Flash Player emulator written in Rust
lightspark https://github.com/lightspark/lightspark
ECMA https://www.ecma-international.org/publications-and-standards/standards/ecma-335/
https://tamarin.sourceforge.net/
avmshell https://blog.csdn.net/isaaq/article/details/83221963
actionscript 3 reference docs https://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/DisplayObject.html