初步上手Flask 完成一个提交页面
最近需要通过网络收集一些资料,又不想用腾讯文档这些臃肿的东西,就自己写了一个Web服务来收集信息 python用来写服务端非常简单 其实前端核心也就是这句话 1fetch("/add?add=" + value) 和服务端的这句话 123456@app.route('/add')def add(): add = request.args.get('add') print("Add: ",add) save(add) return "成功" 以下是全部代码 1234567891011121314151617181920212223242526272829from flask import Flask, requestapp = Flask(__name__) def save(t): with open("sayings.txt","a",encoding='utf8') as f: ...
四元数使物体始终保持竖直向上
在Unity中利用刚体RigidBody使物体运动是非常容易的事,但是有时有时不希望物体倒下,这就要复杂一些,因为Unity使用四元数Quaternion来表示旋转。 但其实四元数也不算难 先上代码,将这段代码放在Update()函数中 123456789101112var dst_quaternion = transform.rotation;var angle = Mathf.Acos(dst_quaternion.w);//arccosif(dst_quaternion.y < 0){ angle = -angle;}var sin_value = Mathf.Sin(angle);dst_quaternion.z = 0;dst_quaternion.y = sin_value;dst_quaternion.x = 0;transform.rotation=dst_quaternion;//apply the transform 解释 四元数的一种几何解释是如果物体围绕一个轴...
适用于Blazor_Webassembly的Github-action配置文件
Github-action实在是太好用了,最近在搞Blazor Webassembly,去网上抄袭了一圈,得到了以下config 1234567891011121314151617181920212223242526272829name: .NETon: push: branches: [ "master" ] pull_request: branches: [ "master" ]permissions: contents: writejobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: Setup .NET uses: actions/setup-dotnet@v3 with: dotnet-version: 7.x.x - name: Publish with dotnet run: dotnet publish...
用给定的数字组成最大的3的倍数
题目 给定一个数组,里面有若干个0-9的数字, 可能会重复出现,找出用这些数组成的最大的3的倍数 1int result = solution(int[]...
适用于React的Github-Action配置文件
最近想给react配置一个自动构建,在网上查(chao)阅(xi)了许多资料,作为一个缝合怪,终于是把yml文件配置好了 12345678910111213141516171819202122232425262728293031323334353637# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejsname: Node.js CIon: push: branches: [ "master" ] pull_request: branches: [...
Flutter局部跳转
flutter局部跳转的思路其实很简单,只需要在一个控件外创建一个根路由,仿照安卓的命名,我给这个路由起名叫Fragment 123456789101112131415161718class Fragment extends StatelessWidget { final Widget child; final String root; const Fragment({required this.child, this.root = "/", super.key}); @override Widget build(BuildContext context) { return Navigator( initialRoute: root, onGenerateRoute: (RouteSettings settings) { WidgetBuilder builder; builder = (context) => child; ...