草庐IT

or-assignment

全部标签

Android13 Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE

最近把以前的11的代码移植到13上碰到的问题,记录一下:TargetingS+(version31andabove)requiresthatoneofFLAG_IMMUTABLEorFLAG_MUTABLEbespecifiedwhencreatingaPendingIntent.StronglyconsiderusingFLAG_IMMUTABLE,onlyuseFLAG_MUTABLEifsomefunctionalitydependsonthePendingIntentbeingmutable,e.g.ifitneedstobeusedwithinlinerepliesorbubbles

inheritance - 转到 : can assign struct to an interface, 但不是上层结构

以下Go代码:packagemainimport"fmt"typePolygonstruct{sidesintareaint}typeRectanglestruct{Polygonfooint}typeShaperinterface{getSides()int}func(rRectangle)getSides()int{return0}funcmain(){varshapeShaper=new(Rectangle)varpoly*Polygon=new(Rectangle)}导致此错误:cannotusenew(Rectangle)(type*Rectangle)astype*Poly

inheritance - 转到 : can assign struct to an interface, 但不是上层结构

以下Go代码:packagemainimport"fmt"typePolygonstruct{sidesintareaint}typeRectanglestruct{Polygonfooint}typeShaperinterface{getSides()int}func(rRectangle)getSides()int{return0}funcmain(){varshapeShaper=new(Rectangle)varpoly*Polygon=new(Rectangle)}导致此错误:cannotusenew(Rectangle)(type*Rectangle)astype*Poly

OSError: [WinError 127] 找不到指定的程序。 Error loading “..... ***.dll“ or one of its dependencies.

离线安装pytorchGPU版本报错背景:  利用命令condainstall--offline安装离线torch包后,然后进入自己创建的虚拟环境(condaactivate),输入python后importtorch时报错。报错信息:Traceback(mostrecentcalllast):File"",line1,inFile"C:\Apps\Anaconda\install\envs\chenxin\Lib\site-packages\torch\__init__.py",line137,inraiseerrOSError:[WinError127]找不到指定的程序。Errorload

Uncaught (in promise) SyntaxError: Expected property name or ‘}‘ in JSON at position 2 单引号替换为双引号

**Uncaught(inpromise)SyntaxError:Expectedpropertynameor‘}’inJSONatposition2解决方法:单引号替换为双引号**如下形式(错误格式):[{‘ID’:‘6792921’,‘Datatime’:‘2023/3/3022:00:00’},{‘ID’:‘6792981’,‘Datatime’:‘2023/3/3023:00:00’}]JSON.parse(str)报错解决方法:单引号替换为双引号如下格式(正确格式):[{“name”:“张三”},{“name”:“李四”}]单引号替换为双引号str.replace(/'/g,'"')

flutter 搭建环境报错 Windows Version (Unable to confirm if installed Windows version is 10 or greater)

解决方法:先查看是否为最新版本flutter-version  (不是最新版本建议官网下载最新版本)下载地址:FlutterSDKarchive|Flutterhttps://docs.flutter.dev/release/archive#windows再切换flutter的版本黑窗口输入flutterchannelmaster flutter切换为master(英文翻译为大师)版本这里可能会报错,网络连接Github超时,建议多试几次,我是晚上才成功的最后再检查是否报错

python install错误:error: Microsoft Visual C++ 14.0 or greater is required. Get it with “Microsoft C++

当我们通过“pipinstallxxx”安装一些包含C++代码的包时,通常会发生安装失败并报错“error:MicrosoftVisualC++14.0orgreaterisrequired.Getitwith“MicrosoftC++BuildTools”:https://visualstudio.microsoft.com/visual-cpp-build-tools/”的情况,这里给出两种解决方法:Method1:直接通过链接“https://visualstudio.microsoft.com/visual-cpp-build-tools/”安装VisualStudio。优点是简单粗暴

mysql - 零到多 : Cannot add or update a child row: a foreign key constraint fails

我是Go和Gorm的新手。我想解析API响应并存储两个表。对于每个“reports”表,可以有“personal_details”的零对多表。但是,gorm在应用外键约束时报错,因为有时API响应中没有PersonalDetail的记录。我遵循了gorm文档并尝试了多对多关系,但我认为它不适用于零对多关系db.Model(&Report{}).AddForeignKey("personal_detail_id","personal_details(id)","RESTRICT","RESTRICT")typeReportstruct{gorm.ModelPersonalDetailPe

mysql - 零到多 : Cannot add or update a child row: a foreign key constraint fails

我是Go和Gorm的新手。我想解析API响应并存储两个表。对于每个“reports”表,可以有“personal_details”的零对多表。但是,gorm在应用外键约束时报错,因为有时API响应中没有PersonalDetail的记录。我遵循了gorm文档并尝试了多对多关系,但我认为它不适用于零对多关系db.Model(&Report{}).AddForeignKey("personal_detail_id","personal_details(id)","RESTRICT","RESTRICT")typeReportstruct{gorm.ModelPersonalDetailPe

【debug】ImportError:libcudart.so.11.0:cannot open share object file:No such file or directory

问题报错:ImportError:libcudart.so.11.0:cannotopenshareobjectfile:Nosuchfileordirectory 非root用户解决方案找到存在libcudart.so.11.0的位置,比如在/usr/local/cuda-11.X/lib64/位置下找到了该文件,则在命令框中添加路径即可,注意,一次有效,关闭该命令框之后再打开失效,若要一直有效,可以把这句加在bashrc里。exportLD_LIBRARY_PATH=/usr/local/cuda-11.X/lib64/:$LD_LIBRARY_PATH整理不易,欢迎一键三连!!!