file-move 相关问题


简单的Unity角色控制器问题

我正在制作 2D 平台游戏,为了使角色移动,我使用这个 无效更新() { move = Input.GetAxis("水平"); rb.velocity = new Vector2(move * speed, rb.velocity.y); } 但当我...


具有多个值的JS var

有件事我无法理解: 我有一个打开同一页面的功能,但具有不同的内容,具体取决于菜单中单击的按钮: 有件事我无法理解: 我有一个打开同一页面的功能<div id="page">但具有不同的内容,具体取决于菜单中单击的按钮: <nav> <button onclick="openPage(1)">PAGE 1</button> <button onclick="openPage(2)">PAGE 2</button> <button onclick="openPage(3)">PAGE 3</button> </nav> 然后是函数: function openPage(p){ var move=0; // define a var for USER action if(p==1){ document.getElementById('page').innerHTML = text_1; // content preloaded } else if(p==2){ document.getElementById('page').innerHTML = text_2; } else if(p==3){ document.getElementById('page').innerHTML = text_3; } // then on the top of the page (absolute + z-index) I add a HTML object: document.getElementById('page').innerHTML += '<aside id="pictures">content</aside>'; // what I'm now trying to do is to remove this object once USER move its mouse on it document.getElementById('pictures').addEventListener("mousemove",function(event) { setTimeout(function(){ move+=1; // increase the val each second },1e3) console.log('move'+p+' = '+move) // control value if(move>100){ document.getElementById('pictures').style.display = "none"; // OK, it works move=0; // reinit the var } }); } 现在惊喜: 第 1 页的控制台 move1 = 0 move1 = 1 ... move1 = 99 move1 = 100 // 'pictures' disappears 第 2 页的控制台 move1 = 41 move2 = 0 ... move1 = 58 move1 = 17 ... move1 = 100 // 'pictures' disappears move2 = 59 第 3 页的控制台 move1 = 15 move2 = 88 move3 = 0 ... move1 = 37 move2 = 100 // 'pictures' disappears move3 = 12 ... 我的 var 'move' 同时获得 3 个值...这怎么可能? 您的问题的原因是您每次调用 openPage 函数时都会添加一个事件侦听器。这意味着,如果您单击多个按钮,每个按钮都会有自己的事件侦听器附加到 #pictures 元素。现在,当触发 mousemove 事件时,所有这些侦听器将同时执行,导致 move 变量每秒递增多次。 解决此问题的方法是在添加新事件侦听器之前先删除现有的事件侦听器。 let handler; // to hold the event listener function const pictureEl = document.getElementById('pictures'); function openPage(p){ // Remove existing event listener if (handler) { // <-- Check here pictureEl.removeEventListener("mousemove", handler); } handler = function(event) { // ...Rest } }; // Add new event listener pictureEl.addEventListener("mousemove", handler); // ...rest 找到了另一种(最简单的?)方法: var move=0; // placed out of functions function openPage(p){ .... (same as previous) getElementById('pictures').addEventListener("mousemove",outPicts); // change } // put mousemove event in another function: function outPicts(p){ setTimeout(function(){ move+=1; },1e3) console.log('move = '+move) if(move>100){ document.getElementById('pictures').style.display = "none"; // then remove event getElementById('pictures').removeEventListener("mousemove",outPicts); move=0; // reinit the var } } 按预期工作


DolphinDB中move函数结果的问题

x=3 9 5 1 4 9; 索引 = (第二(08:20:00)+1..4) 加入 08:21:01 加入 08:21:02 x = 索引.indexedSeries(x) 移动(x,3s) 为什么 move 函数对于时间戳 8:21:01 和 8:21:02 返回 1,不是吗


PHP8 从函数返回 ZipArchive getStream 使得包含的 zip 存档被关闭

私有函数 getFilePointer($file) { $pathInfo = 路径信息($file); $zip = new ZipArchive(); if (($res = $zip->open($file)) !== true) { 抛出新的例外...


如何使用 std::move_iterator 从向量中删除元素?

这是一个 Josephus 排列问题,它是通过使用 std::move() 解决的,但现在我必须切换到使用 std::move_iterator (通过使用 std::make_move_iterator()) 但是,这不能编译:


获取世博会资产

访问世博会资产的正确方法是什么? 我试过这个: 等待 Asset.loadAsync(require('file:///assets/data/catalog.json')); 错误: 无法解析“file:///assets/data/catalog.json”...


当 T1 在 C++ 多线程中运行/执行其任务时,我可以将所有权从线程 T1 移至 T2吗

当 T1 执行 func_1() 时,我可以使用 std::move() 将所有权从线程 T1 移动到 T2 我不确定这是否是正确的方法?有人说我们不应该在...


使用 move-item 递归移动包含具有特定文本的文件的文件夹时出现访问被拒绝错误

我对此摸不着头脑,还没有找到任何可以让它发挥作用的东西。 我有一个具有 root1\yyyy\mm\dd\hh\uniqueid 结构的文件夹树,需要将 uniqueid 子文件夹移动到


使用“file:”包含本地 NPM 包时删除对等依赖项

如何对使用 package.json 中的 file: 模式安装的本地 NPM 包进行 NPM 重复数据删除对等依赖项?使用 npm 安装软件包时,对等依赖项会正确删除重复数据


编写一个程序,该程序本质上将代码文件复制到数组中,并将缩进保存到数组中以写出到单独的文件中

私有静态 StringTokenizer readFile(String inputFilename) 抛出 FileNotFoundException { 文件 file = new File(inputFilename); 扫描仪扫描仪=新扫描仪(文件); 字符串


通过更少的 Java API 调用来映射 Google 云端硬盘内容的有效方法

大家好,我有一个代码,用于列出共享驱动器中存在的文件(以便稍后下载并创建相同的文件夹路径) 目前我做这样的事情: 哈希映射 大家好,我有一个代码,用于列出共享驱动器中存在的文件(以便稍后下载并创建相同的文件夹路径) 目前我正在做这样的事情: HashMap<String, Strin> foldersPathToID = new HashMap<>(); //searching all folders first saving their IDs searchAllFoldersRecursive(folderName.trim(), driveId, foldersPathToID); //then listing files in all folders HashMap<String, List<File>> pathFile = new HashMap<>(); for (Entry<String, String> pathFolder : foldersPathToID.entrySet()) { List<File> result = search(Type.FILE, pathFolder.getValue()); if (result.size() > 0) { String targetPathFolder = pathFolder.getKey().trim(); pathFile.putIfAbsent(targetPathFolder, new ArrayList<>()); for (File file : result) { pathFile.get(targetPathFolder).add(file); } } } 递归方法在哪里: private static void searchAllFoldersRecursive(String nameFold, String id, HashMap<String, String> map) throws IOException, RefreshTokenException { map.putIfAbsent(nameFold, id); List<File> result; result = search(Type.FOLDER, id); // dig deeper if (result.size() > 0) { for (File folder : result) { searchAllFoldersRecursive(nameFold + java.io.File.separator + normalizeName(folder.getName()), folder.getId(), map); } } } 搜索功能是: private static List<com.google.api.services.drive.model.File> search(Type type, String folderId) throws IOException, RefreshTokenException { String nextPageToken = "go"; List<File> driveFolders = new ArrayList<>(); com.google.api.services.drive.Drive.Files.List request = service.files() .list() .setQ("'" + folderId + "' in parents and mimeType" + (type == Type.FOLDER ? "=" : "!=") + "'application/vnd.google-apps.folder' and trashed = false") .setPageSize(100).setFields("nextPageToken, files(id, name)"); while (nextPageToken != null && nextPageToken.length() > 0) { try { FileList result = request.execute(); driveFolders.addAll(result.getFiles()); nextPageToken = result.getNextPageToken(); request.setPageToken(nextPageToken); return driveFolders; } catch (TokenResponseException tokenError) { if (tokenError.getDetails().getError().equalsIgnoreCase("invalid_grant")) { log.err("Token no more valid removing it Please retry"); java.io.File cred = new java.io.File("./tokens/StoredCredential"); if (cred.exists()) { cred.delete(); } throw new RefreshTokenException("Creds invalid will retry re allow for the token"); } log.err("Error while geting response with token for folder id : " + folderId, tokenError); nextPageToken = null; } catch (Exception e) { log.err("Error while reading folder id : " + folderId, e); nextPageToken = null; } } return new ArrayList<>(); } 我确信有一种方法可以通过很少的 api 调用(甚至可能是一个调用?)对每个文件(使用文件夹树路径)进行正确的映射,因为在我的版本中,我花了很多时间进行调用 service.files().list().setQ("'" + folderId+ "' in parents and mimeType" + (type == Type.FOLDER ? "=" : "!=") + "'application/vnd.google-apps.folder' and trashed = false").setPageSize(100).setFields("nextPageToken, files(id, name)"); 每个子文件夹至少一次......并且递归搜索所有内容需要很长时间。最后,映射比下载本身花费的时间更多...... 我搜索了文档,也在此处搜索,但没有找到任何内容来列出具有一个库的所有驱动器调用任何想法? 我想使用专用的 java API 来获取共享 GoogleDrive 中的所有文件及其相对路径,但调用次数尽可能少。 提前感谢您的时间和答复 我建议您使用高效的数据结构和逻辑来构建文件夹树并将文件映射到其路径,如下所示 private static void mapDriveContent(String driveId) throws IOException { // HashMap to store folder ID to path mapping HashMap<String, String> idToPath = new HashMap<>(); // HashMap to store files based on their paths HashMap<String, List<File>> pathToFile = new HashMap<>(); // Fetch all files and folders in the drive List<File> allFiles = fetchAllFiles(driveId); // Build folder path mapping and organize files for (File file : allFiles) { String parentId = (file.getParents() != null && !file.getParents().isEmpty()) ? file.getParents().get(0) : null; String path = buildPath(file, parentId, idToPath); if (file.getMimeType().equals("application/vnd.google-apps.folder")) { idToPath.put(file.getId(), path); } else { pathToFile.computeIfAbsent(path, k -> new ArrayList<>()).add(file); } } // Now, pathToFile contains the mapping of paths to files // Your logic to handle these files goes here } private static List<File> fetchAllFiles(String driveId) throws IOException { // Implement fetching all files and folders here // Make sure to handle pagination if necessary // ... } private static String buildPath(File file, String parentId, HashMap<String, String> idToPath) { // Build the file path based on its parent ID and the idToPath mapping // ... }


如何在SikuliX(Java)中单击当前鼠标位置?

这是我尝试过的: 屏幕 screenWithCalendarField = new Screen(); 比赛日历 = new Match(); 尝试{ 日历 = screenWithCalendarField.find(new File("D:\Sikuli\CalendarField.png").


如何获取当前正在执行的启动器的版本?

我目前的尝试是: 文件执行目录 = new File("").getCanonicalFile(); ApplicationInfo信息 = ApplicationRegistry.getApplicationInfoByDir(executionDir); 返回 info.getVersion(); 它...


Flutter 中可以使用什么包来代替 open_file?

我在 Flutter 中有一个项目,我正在使用 open_file 包。我已将 Flutter 生成的 Android apk 上传到 AppSweep,它返回以下问题:Insecure file location is retr...


在操作中检测到不可序列化的值(redux-toolkit)

在store中action的payload中,我使用File类型存储下载的文件,然后该文件将在saga中通过验证 const form = new FormData(); if (私钥 &&


makefile 中的命令前面有反斜杠

在makefile中的命令前添加反斜杠有什么作用? 例如 本例中的 m 命令: # LaTeX Makefile 文件=报告 全部:$(FILE).pdf .PHONY:干净 干净的: m *.aux...


使用 expo go 从资产文件夹中读取文件

尝试使用 React Native expo go 从资产文件夹中读取文件 从“expo-asset”导入{资产}; 从“expo-file-system”导入*作为文件系统; ... const getFiles = asy...


如何使用 ag 又名 the_silver_search 仅搜索目录?

我喜欢只搜索目录,选项 ag --list-file-types 对此没有帮助。坚持使用 ag 的原因是可以选择带有 --path-to-ignore 的文件,其中包含 pat...


使用 Notepad++ RUN 启动任何浏览器

shortcuts.xml 文件看起来正确。可能是文件位置?我将一个项目复制并粘贴到程序中。我应该导入它吗? 文件位置为 file:///C:/Users/user/Desktop/


使用 kubernetes python 客户端将文件从 pod 复制到主机

我需要使用 kubernetes python 客户端将文件从 pod 复制到主机。它类似于 kubectl cp pod:file file。 我正在测试以下代码:https://github.com/prafull01/Kuberne...


如何在自定义 Angular 嵌套菜单组件上放置子菜单

我创建了一个 Stackblitz (https://stackblitz.com/edit/stackblitz-starters-xxbp1t?file=src%2Fmain.ts) 来演示我的多嵌套菜单的问题,但基本问题是当一个用户


使用makefile将.bin转换为.img

我正在写一个简单的引导加载程序, 我正在使用这个 make file 命令将 main.bin 转换为 main_floppy.img cp -f 构建/main.bin 构建/main_floppy.img 但我不断收到此错误 nasm src/...


Stripe Card On File功能及流程

我正在使用 Stripe,想要实现“卡文件”功能。所以它会是这样的。 用户使用 Stripe Elements 在 UI 上输入信用卡 卡已保存,然后我们每次都会收取费用...


Azure 能否发布管道任务内联 Powershell 连接到 MongoDB load(file) 方法

一直在使用 MDBC powershell 模块连接到 Azure cosmosDB 中的 MongoDB 实例。需要加载带有代码的 .js 文件来更新集合。 示例:(mikesSuperHappyJS.js) var colle...


如何在 Spring boot 的全局异常处理程序中处理 MaxUploadSizeExceededException

我正在我的一项 REST 服务中上传多部分文件数据,并且我使用“spring.servlet.multipart.max-file-size=10MB”属性在 application.properties 中定义了文件大小限制。 ...


Tinylog 中的滚动文件会覆盖每次应用程序启动时的日志文件

我在Kotlin 2.6.2版本中使用tinylog。 这是我的tinylog.properties 文件: writer2 = 滚动文件 writer2.level = 信息 writer2.file = #{tinylog.directory}/log_{日期:yyyy-MM-dd}.{动态:


如何使用 Isabelle 验证带有数组参数的 C 函数

我正在使用 Isabelle 来验证 C 程序。在验证过程中,我使用c-parser install-C-file加载代码,但是出现了以下问题: 尝试导致指针衰减


Laravel9 response()->stream() 使用 fwrite() 得到空结果

我需要将大量数据导出为 CSV 字符串。 所以我尝试将 fopen('php://stdout', w) 与 fwrite($file, $data) 一起使用。 但 Laravel response()->stream() 不会返回任何内容,也不会出现错误。 我...


如何使用Expo FileSystem.uploadAsync显示上传进度

我有一段代码如下,它利用 expo 文件系统将一个简单的文件上传为二进制文件,一切正常。 从“expo-file-system”导入*作为文件系统; const res = 等待 FileSy...


将三个 ts 线生成两个具有共享 x 轴的堆叠图

我有三个时间序列变量。其中两个包含在我的文件 roes.cvs 中,并使用以下代码绘制在一张图中: 鱼子 <- read.csv(file="roes.csv", header=TRUE, sep=",&q...


我正在使用从文件读取数据的数组创建一个选择

运行 getGrades() 方法时,它不断返回 B+。我不知道出了什么问题,我需要帮助。我将分享代码 尝试 { 扫描仪输入 = new Scanner(new FileInputStream(new File(&q...


当布局更改或数据更改时,如何确保我的 ReactJS Bumbeishvili D3-Org-Chart 正确更新?

我已经在 CodeSandbox 上复制并简化了我的问题,可以在此处查看:https://codesandbox.io/p/sandbox/d3-org-chart-react-function-org-chart-gvfz4l?file=%2Fsrc %2F组件%2F数据...


存档 Xcode 项目时出错:Sandbox: mkdir(23381) Deny(1) file-write-create

我目前正在尝试存档我的 xcode 项目,但收到此错误: 沙箱:mkdir(23381)拒绝(1)文件写入创建 有谁知道这个错误是什么意思?我没有使用 swift 或任何...


在生产中,django {% static 'file/path' %} 命令在 Herokuapp 上查找文件路径,而它应该通过 Cloudinary 查找

静态文件在生产中不起作用。 问题领域总结 经过严格审查和同行比较后,Cloudinary 和 Django settings.py 和模板设置正确。 检查


在 Power Automate 中,是否可以使用 XPath 表达式从 DOCX“document.xml”文件获取表格单元格的完整内容?

使用 https://www.tachytelic.net/2021/05/power-automate-extract-text-from-word-docx-file/ 上的优秀指南,我可以设置 Power Automate 流程来提取来自 DOCX 文件的文本内容...


Windows 10 上使用 Maven 和 Jetty 的 Java 应用程序:HTTP 错误:503 访问 / 时出现问题。原因:服务不可用

我正在尝试使用 mvn -Dluke.confdir=file://C:\ecoconfig\ecomodules-calculation.conf jetty:run 从命令提示符在 Windows 10 上运行大约九年历史的 Java 应用程序,它给出


使用 createPortal 渲染且状态由父级控制的 React 组件不会在状态更改时重新渲染

我的问题在此实例中得到了解释:https://stackblitz.com/edit/stackblitz-starters-qcvjsz?file=src%2FApp.tsx 基本上,我将选项列表传递给单选按钮列表,其中包含状态...


git克隆:警告:本地克隆中忽略--深度;使用 file:// 代替

我们在本地网络的共享文件夹上有一个远程存储库。我尝试制作一个浅克隆: git克隆--深度1 //gitrepos-pc/git/foo/ 它给了我这个警告,并制作了一个完整的克隆:


如何使用xslt将xml中的文本转换为html中的超链接

如何使用 xslt 将 xml 中的文本转换为 html 中的超链接。 我的 Xml 代码是 C:\测试\CaptureF15165617TC001_05_06_1516_57_11.png 如何使用 xslt 将 xml 中的文本转换为 html 中的超链接。 我的Xml代码是 <Steps> <Filepath>C:\Test\Capture\050615165617TC001_05_06_1516_57_11.png</Filepath> </Steps> 将其转换为 html,我的 xslt 代码如下 <td width='15%'> <xsl:element name="a"> <xsl:attribute name="href"> <xsl:value-of select="./Filepath"/> </xsl:attribute> <xsl:value-of select="./Filepath"/> </xsl:element> </td> 现在这段代码在html中写入文件的整个路径,但我只想在html中写入“文件”以及指向文件位置的超链接。 我当前生成的html代码如下 C:\Test\Capture\050615165617TC001_05_06_1516_57_11.png <td width="15%"><a href="C:\Test\Capture\050615165617TC001_05_06_1516_57_11.png">C:\Test\Capture\050615165617TC001_05_06_1516_57_11.png</a></td> 我想要的是 <td width="15%"><a href="C:\Test\Capture\050615165617TC001_05_06_1516_57_11.png">File</a></td> 任何人都可以帮助我需要在 xslt 中进行哪些更改。 你告诉它具有价值: <xsl:element name="a"> <xsl:attribute name="href"> <xsl:value-of select="./Filepath"/> </xsl:attribute> <xsl:value-of select="./Filepath"/> <!--This is the link text --> </xsl:element> 所以将其更改为: <xsl:element name="a"> <xsl:attribute name="href"> <xsl:value-of select="./Filepath"/> </xsl:attribute> File </xsl:element> 或者简短地说: <a href="{Filepath}">File</a> <Steps> <Filepath>C:\Test\Capture\050615165617TC001_05_06_1516_57_11.png</Filepath> </Steps>


当我使用[input type =“file”]选择文件时,在html中,那么它存储在我们本地的哪里

我需要从一个本地驱动器获取文件,然后粘贴到另一个本地驱动器中。条件:我不应该通过浏览文件夹来执行此操作,我应该在 UI(网站)本身中执行此操作。我用了 ...


QWebEngineView:html 文件中的 href 不起作用

我有一个 test.html 文件,例如: 我有一个 test.html 文件,例如: <!DOCTYPE html> <html> <head> </head> <body> <a style="padding-right:5px" target="_blank" href="data/">Datadir</a> </body> </html> 包含 test.html 的目录如下: test.html data\ a.txt b.txt 我使用“file:///remote/us01home19/ktc/public_html/testLocalHref/test.html”并在firefox和chrome中单击Datadir,结果如下: 和: 我写了一个pyside2代码来做同样的事情,代码如下: from PySide2 import QtCore, QtWidgets, QtWebEngineWidgets import os import sys class CustomWebEnginePage(QtWebEngineWidgets.QWebEnginePage): # Store second window. external_window = None def acceptNavigationRequest(self, url, _type, isMainFrame): print(url, _type, isMainFrame) if _type == QtWebEngineWidgets.QWebEnginePage.NavigationTypeLinkClicked: if not self.external_window: self.external_window = QtWebEngineWidgets.QWebEngineView() self.external_window.setUrl(url) self.external_window.show() return False return super().acceptNavigationRequest(url, _type, isMainFrame) class MainWindow(QtWidgets.QMainWindow): def __init__(self, *args, **kwargs): super(MainWindow, self).__init__(*args, **kwargs) self.browser = QtWebEngineWidgets.QWebEngineView() self.browser.setPage(CustomWebEnginePage(self)) # self.browser.setUrl(QtCore.QUrl("https://code.visualstudio.com")) self.browser.setUrl(QtCore.QUrl("file:///remote/us01home19/ktc/public_html/testLocalHref/test.html")) # self.browser.setUrl(QtCore.QUrl("file:///remote/tw_rnd1/ktc/prog/python/pyside2/WebEngine/data/aaa.ava.summary.html")) #self.browser.setUrl(QtCore.QUrl("file:///remote/tw_rnd1/ktc/prog/python/pyside2/WebEngine/data/aaa_ava_corners/C_1")) self.setCentralWidget(self.browser) if __name__ == '__main__': app = QtWidgets.QApplication(sys.argv) window = MainWindow() window.show() sys.exit(app.exec_()) 但是执行代码,我得到的结果如下: 但是点击Datadir,没有任何反应,甚至QWebEnginePage.acceptNavigationRequest也没有触发。有没有办法让 QWebEngine 的行为像 Firefox 和 Chrome 一样? 我尝试在 QWebEnginePage.acceptNavigationRequest 函数中添加打印消息来捕获点击 dataDir 信息,但似乎没有任何响应。 python版本:python-3.9.0, 操作系统版本:“CentOS Linux 7”, Qt 版本:“Qt_5.15” python 和 Qt 是自定义构建 我发现问题来自htmltarget =“_blank”在QWebEnginePage中不起作用,它可以通过在QtWebEngineWidgets中实现类函数createWindow来避免,例如: class CustomWebEnginePage(QtWebEngineWidgets.QWebEnginePage): # Store second window. external_window = None def acceptNavigationRequest(self, url, _type, isMainFrame): print(url, _type, isMainFrame) if _type == QtWebEngineWidgets.QWebEnginePage.NavigationTypeLinkClicked: if not self.external_window: self.external_window = QtWebEngineWidgets.QWebEngineView() self.external_window.setUrl(url) self.external_window.show() return False return super().acceptNavigationRequest(url, _type, isMainFrame) def createWindow(self, t): return self;enter code here


在这个curl api中将不记名授权令牌放在哪里

我正在使用 imageqrcode (https://imageqrcode.com/apidocumentation) 的新 api 功能来动态生成图像 QR 码,使用 php: 我正在使用 imageqrcode (https://imageqrcode.com/apidocumentation) 的新 api 功能来动态生成图像 QR 码,使用 php: <?php $api_key = 'xxxxxxxxxx'; //secret // instantiate data values $data = array( 'apikey' => $api_key, 'qrtype' => 'v1', 'color' => '000000', 'text' => 'https://wikipedia.com', ); // connect to api $url = 'https://app.imageqrcode.com/api/create/url'; $ch = curl_init($url); // Attach image file $imageFilePath = 'test1.jpg'; $imageFile = new CURLFile($imageFilePath, 'image/jpeg', 'file'); $data['file'] = $imageFile; curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); curl_close($ch); // Handle the response $result = json_decode($response, true); if ($result && isset($result['downloadURL'])) { // Successful request $download_url = $result['downloadURL']; echo "Download URL: $download_url"; } else { // Handle errors echo "Error: " . print_r($result, true); } ?> 在文档中显示有变量“serialkey”: 图片二维码API文档 API文档 生效日期:2023年11月15日 图像二维码 API 是一项接受 HTTPS 请求以生成图像或 gif 二维码的服务,主要由开发人员使用。 图像二维码 - URL JSON 请求(POST):https://app.imageqrcode.com/api/create/url apikey //你的apikey 序列号//你的序列号 qrtype //字符串,最少 2 个字符,最多 2 个字符v1 或 v2,v1 适用于 QR 类型 1,v2 适用于类型 2 color //数字,最小 6 位,最大 6 位,例如000000 为黑色 text //url,最少 15 个字符,最多 80 个字符https://yourwebsite.com file //图像文件 (jpg/jpeg/png),最大 1 MB 文件大小 现在没有信息将该序列密钥作为标准承载授权令牌放在哪里???如果没有此信息,我无法连接到 api 我尝试在没有不记名令牌的情况下连接它,因为我认为它可以匿名连接到 api,但也不起作用,我现在很困惑,因为我仍在学习 PHP 和 Laravel 看起来 serialkey 不是不记名令牌,而是一个应该与其他参数(如 apikey、qrtype、color、text 和 )一起包含在 POST 数据中的参数file。您可以在 PHP 代码的 serialkey 数组中包含 $data。 $data = array( 'apikey' => $api_key, 'serialkey' => 'your_serial_key', // Add this line 'qrtype' => 'v1', 'color' => '000000', 'text' => 'https://wikipedia.com', );


使用 InertiaJs 和 Laravel 从数据库中删除用户

我在从数据库中删除记录时遇到问题。我正在使用 InertiaJS 和 Laravel。 组件代码 以下是链接/按钮代码: 我在从数据库中删除记录时遇到问题。我正在使用 InertiaJS 和 Laravel。 组件代码 以下是链接/按钮代码: <Link class="trash" @click="submit(result.ChildID)"> Move to Trash </Link> 注意: ChildID 是数据库中子记录的 id。 现在:当用户单击此链接时,将调用一个方法,如下所示。 methods: { submit: function (ChildID) { alert(ChildID) if (confirm("Are you sure you want to delete this child?")) { this.$inertia.delete('destroy/ChildID'); } }, }, 路线代码 Route::delete('destroy/{childID}',[childrenController::class,'destroy']); 控制器代码 public function destroy(children $childID){ $childID->delete(); return redirect()->route('View_Child_Profile'); } 现在,当我点击删除按钮时,我收到以下错误: 试试这个。我认为你犯了错误“this.$inertia.delete('destroy/ChildID');” methods: { submit: function (ChildID) { alert(ChildID) if (confirm("Are you sure you want to delete this child?")) { this.$inertia.delete(`destroy/${ChildID}`); // or this.$inertia.delete('destroy/'+ChildID); } }, }, 这是我处理删除过程的方式。 前视+惯性: import { Link } from '@inertiajs/inertia-vue3'; 在模板中: <Link method="delete" :href="route('admin.insta_feeds.destroy',id)">Delete</Link> 后端 Laravel: 路线: Route::resource('insta_feeds', InstaFeedsController::class); 控制器功能: public function destroy(InstaFeed $insta_feed) { if(isset($insta_feed->image_path)){ Storage::delete($insta_feed->image_path); } $insta_feed->delete(); return Redirect::route('admin.insta_feeds.index'); }


为什么NLog不每天归档

NLog 存档每天都不起作用。但它每分钟都有效 NLog版本5.0.7 这是我的配置 NLog 每天存档不起作用。但它每分钟都有效 NLog版本5.0.7 这是我的配置 <target name="Httpfile" layout="${longdate} ${uppercase:${level}} correlationId-${activityid} - ${message} ${exception:format=tostring}" xsi:type="File" fileName="${logFullName}-http-api-${shortdate}.log" archiveFileName="${logFullNameArchive}-archive-Http-api-${shortdate}-{#####}.zip" archiveEvery="Day" concurrentWrites="true" keepFileOpen="false" archiveNumbering="DateAndSequence" maxArchiveFiles="30" maxArchiveDays="7" enableArchiveFileCompression="true" /> 使用 archiveEvery="Minute" 效果很好 不支持在NLog FileTarget中混合静态和动态归档逻辑。 使用静态归档逻辑时,不应在 ${shortdate} 和 fileName="..." 中使用 archiveFileName="..."。 像enableArchiveFileCompression="true"这样的一些功能仅受静态归档逻辑支持: <target name="Httpfile" layout="${longdate} ${uppercase:${level}} correlationId-${activityid} - ${message} ${exception:format=tostring}" xsi:type="File" fileName="${logFullName}-http-api.log" archiveFileName="${logFullNameArchive}-archive-Http-api-{#####}.zip" archiveNumbering="DateAndSequence" archiveDateFormat="yyyyMMdd" archiveEvery="Day" concurrentWrites="true" keepFileOpen="false" maxArchiveFiles="30" maxArchiveDays="7" enableArchiveFileCompression="true" /> 另请参阅:https://github.com/NLog/NLog/wiki/FileTarget-Archive-Examples


如何在不重新加载页面的情况下发送带有文件的表单?

我尝试在ajax中发送表单而不重新加载页面,但我看到,文件上的链接不存在...... 我有下一个表格: 我尝试在ajax中发送表单而不重新加载页面,但我看到,文件上的链接不存在... 我有下一个表格: <form id="settings" method="POST" enctype="multipart/form-data"> ... <input type="file" id="logo" style="display:none;" name="logo" accept="image/png, image/jpeg, image/gif"> <button type="submit" id="send" class="btn btn-primary">save</button> </form> Ajax 脚本: $('#settings').submit(function(e){ e.preventDefault(); var form = $(this).serialize(); alert(form); // file is not attached... $.ajax({ url : '/settings', type : 'POST', crossDomain : false, data : form, contentType : 'multipart/form-data', dataType : 'json', progressData: false, cache : false, success : function(r){ alert (111); } }).fail(function(){ console.log('Error occured!'); }); }); 在服务器端,我收到错误: org.apache.tomcat.util.http.fileupload.FileUploadException:请求被拒绝,因为未找到多部分边界 我尝试不序列化表单,而是写了 data : form -> data : new FormData(this) 此选项会导致错误“非法调用”。如何在不重新加载页面的情况下发送带有文件的表单? 要使用 AJAX 发送带有文件的表单而不重新加载页面,您需要使用 FormData 来正确处理文件上传。 <form id="settings" method="POST" enctype="multipart/form-data"> <!-- Other form fields --> <input type="file" id="logo" name="logo" accept="image/png, image/jpeg, image/gif"> <button type="submit" id="send" class="btn btn-primary">Save</button> </form> $(document).ready(function() { $('#settings').submit(function(e){ e.preventDefault(); var formData = new FormData(this); $.ajax({ url: '/settings', type: 'POST', data: formData, contentType: false, processData: false, cache: false, success: function(response){ alert('Form submitted successfully!'); // Handle the response from the server }, error: function(){ console.log('Error occurred!'); } }); }); });


在PHP中打印文件修改时间ISO-8601格式[重复]

我试图回显文件的上次更新时间并将其显示为 ISO-8601 时间戳格式。我尝试了一些命令,但它们没有获得正确的上次修改日期。 我试过: 我正在尝试 echo 文件的上次更新时间并将其显示为 ISO-8601 时间戳格式。我尝试了一些命令,但它们没有获得正确的上次修改日期。 我尝试过: <?php echo date("c"); ?> 但它只获取当前服务器时间,就像2024-01-11T11:39:33+02:00一样,它总是在变化。与date('c', time())相同。 以下两个似乎得到以下日期:1970-01-01T02:00:00+02:00: $lastmod = date('Y-m-dTH:i:s+00:00'); echo date('c', $timestamp) 和 $lastmod = date('Y-m-d\TH:i:s'); $tzd = date('Z'); $lastmod .= ($tzd < 0)? "-".gmdate('H:i', -$tzd) : "+".gmdate('H:i', $tzd); echo date('c', $timestamp) 我想要最后修改的 PHP/HTML 文件日期(时间戳);如果是两天前编辑的,则会显示日期等 您可以使用 PHP 中的 filemtime 函数来获取 ISO-8601 格式的文件的最后修改时间: $filename = 'path/to/your/file.php'; // Replace with your file path if (file_exists($filename)) { $lastModified = filemtime($filename); echo date('c', $lastModified); } else { echo "The file does not exist."; }


单击行中的图标时,如何防止离子复选框被选中?

我正在使用 Ionmic 7 和 React 18。我有一个可以检查或编辑的简单项目列表。 选择商品 我正在使用 Ionmic 7 和 React 18。我有一个可以检查或编辑的简单项目列表。 <IonList> <IonLabel> <strong>Select Items</strong> </IonLabel> {items.map((item) => ( <IonItem key={item}> <IonCheckbox slot="start" name="selectedItems" value={item} /> <IonLabel>{item}</IonLabel> <IonIcon icon={pencilOutline} slot="end" onClick={onEditHandler(item)} style={{ marginLeft: '10px' }} /> </IonItem> ))} </IonList> 问题是当我单击“编辑”图标(铅笔)时,复选框被选中,并且我的编辑处理程序未被调用。演示在这里 - https://stackblitz.com/edit/an5yjh-i9tnnh?file=src%2FApp.tsx,src%2Fcomponents%2FFormWithChceckboxes.tsx。我想将其添加到处理程序中 e.stopPropagation(); 会阻止选中复选框,并且该过程可以继续,但显然不是。 您可以通过向编辑图标添加 z 索引以将其放置在 IonItem 上方来解决该问题,如下所示: <IonIcon icon={pencilOutline} slot="end" onClick={onEditHandler(item)} style={{ marginLeft: '10px', zIndex:10 }} /> 我建议您使用语法正确的 HTML,通过使用 button 来触发操作 😉 <IonButton fill="clear" onClick={() => onEditHandler(item)}> <IonIcon slot="icon-only" icon={pencilOutline}></IonIcon> </IonButton> 这样你就不需要与冒泡效果作斗争了。 https://stackblitz.com/edit/an5yjh-b5wpv5?file=src%2Fcomponents%2FFormWithChceckboxes.tsx


Struts 2 与 Apache Shiro 集成时如何显示结果页面

使用: struts2 2.5.10, 春天 4.x, struts2-spring-插件2.5.10, 希罗1.4.0, Shiro-Spring 1.4.0。 网络.xml: 使用: struts2 2.5.10, 春季 4.x, struts2-spring-插件2.5.10, 四郎1.4.0, shiro-spring 1.4.0. web.xml: <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" version="3.1"> <display-name>Archetype Created Web Application</display-name> <context-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:beans.xml</param-value> </context-param> <filter> <filter-name>shiroFilter</filter-name> <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class> <init-param> <param-name>targetFilterLifecycle</param-name> <param-value>true</param-value> </init-param> </filter> <filter> <filter-name>struts2</filter-name> <filter-class>org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter</filter-class> </filter> <!-- shiro filter mapping has to be first --> <filter-mapping> <filter-name>shiroFilter</filter-name> <url-pattern>/*</url-pattern> <dispatcher>REQUEST</dispatcher> <dispatcher>FORWARD</dispatcher> <dispatcher>INCLUDE</dispatcher> <dispatcher>ERROR</dispatcher> </filter-mapping> <filter-mapping> <filter-name>struts2</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> </web-app> beanx.xml: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd "> <bean name="loginAction" class="example.shiro.action.LoginAction" > </bean> <bean id="shiroFilter" class="org.apache.shiro.spring.web.ShiroFilterFactoryBean"> <property name="securityManager" ref="securityManager" /> <property name="loginUrl" value="/login.jsp" /> <property name="filterChainDefinitions"> <value> /login.jsp = authc /logout = logout /* = authc </value> </property> </bean> <bean id="iniRealm" class="org.apache.shiro.realm.text.IniRealm"> <property name="resourcePath" value="classpath:shiro.ini" /> </bean> <bean id="securityManager" class="org.apache.shiro.web.mgt.DefaultWebSecurityManager"> <property name="realm" ref="iniRealm" /> </bean> <bean id="lifecycleBeanPostProcessor" class="org.apache.shiro.spring.LifecycleBeanPostProcessor"/> </beans> struts.xml: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd"> <struts> <constant name="struts.devMode" value="true" /> <package name="default" extends="struts-default"> <action name="list" class="loginAction" method="list"> <result name="success">/success.jsp</result> <result name="error">error.jsp</result> </action> </package> </struts> index.jsp: <body> <s:action name="list" /> </body> login.jsp 看起来像: <form name="loginform" action="" method="post"> <table align="left" border="0" cellspacing="0" cellpadding="3"> <tr> <td>Username:</td> <td><input type="text" name="username" maxlength="30"></td> </tr> <tr> <td>Password:</td> <td><input type="password" name="password" maxlength="30"></td> </tr> <tr> <td colspan="2" align="left"><input type="checkbox" name="rememberMe"><font size="2">Remember Me</font></td> </tr> <tr> <td colspan="2" align="right"><input type="submit" name="submit" value="Login"></td> </tr> </table> </form> LoginAction.list(): public String list() { Subject currentUser = SecurityUtils.getSubject(); if(currentUser.isAuthenticated()) {System.out.println("user : "+currentUser.getPrincipal()); System.out.println("You are authenticated!"); } else { System.out.println("Hey hacker, hands up!"); } return "success"; } shiro.ini: [users] root=123,admin guest=456,guest frank=789,roleA,roleB # role name=permission1,permission2,..,permissionN [roles] admin=* roleA=lightsaber:* roleB=winnebago:drive:eagle5 index.jsp、login.jsp、success.jsp放在webapp下 我想要的是:输入LoginAction.list()需要进行身份验证,如果登录成功,则运行LoginAction.list()并返回"success"然后显示定义为Struts操作结果的success.jsp。 现在登录成功后可以执行LoginAction.list(),但是success.jsp不显示,浏览器是空白页面。 为什么? 我找到了原因:我在index.jsp中使用了<s:action name="list" />,但是struts文档说如果我们想用<s:action>看到结果页面,那么我们必须将其属性executeResult设置为true,即就像<s:action name="list" executeResult="true"/>。 在我看来,这有点奇怪,这个属性默认应该是 true。 有一个示例,您应该如何使用 Shiro applicationContext.xml 进行配置: <property name="filterChainDefinitions"> <value> # some example chain definitions: /admin/** = authc, roles[admin] /** = authc # more URL-to-FilterChain definitions here </value> </property> 以 /admin/ 开头的 URL 通过角色 admin 进行保护,任何其他 URL 均不受保护。如果 Struts 操作和结果 JSP 不在受保护区域中,则会显示它们。


内置布尔到可见性转换器无法编译

我正在尝试使用自动 IReference 到可见性转换将可见性绑定到 ToggleButton::IsChecked 我正在尝试使用自动 IReference 到可见性转换将可见性绑定到 ToggleButton::IsChecked <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center"> <CheckBox x:Name="myButton" Content="Click Me" /> <TextBlock Text="Hello" Visibility="{x:Bind myButton.IsChecked, Mode=OneWay}"/> </StackPanel> 在空白项目中这是可行的。在我现有的项目中,如果我提供自己的转换器,它就会工作,但如果我尝试使用自动转换,我会得到: error C3779: 'winrt::impl::consume_Windows_Foundation_IReference< winrt::Windows::Foundation::IReference<bool>,T>::Value': a function that returns 'auto' cannot be used before it is defined with [ T=bool ] (compiling source file Generated Files\XamlTypeInfo.g.cpp) 如果针对 c++17 进行编译,错误就会消失。我正在为 c++20 编译 https://github.com/microsoft/microsoft-ui-xaml/issues/9214


如何在React Prime DataTable中添加超链接?

我有一个数据表,我正在使用 React prime 库, 我的要求是在一个特定列中添加一个链接。 我有一个数据表,我正在使用 React prime 库, 我的要求是在一个特定列中添加一个链接。 <DataTable paginator rows={tableRowPage} value={products} tableStyle={{ minWidth: "30rem" }} ><Column key={field} field={field} header={header} style={{ width: "25%" }} /> </DataTable> 我需要特定单元格中的超链接 我在数据表中遇到了同样的问题,不幸的是,根据我的研究,他们似乎不提供对此的支持。 但是,我已经设法通过这种方式解决了这个问题: 数据表添加链接逻辑: <Column field="code" header="Code" body={(rowData) => { return ( <div sx={{ display: "flex", justifyContent: "space-between", alignItems: "center", }} > <div style={{ color: "#3F00FF", textDecoration: "underline", cursor: "pointer", "&:hover": { color: "#23297A", }, }} onClick={() => window.open("www.google.com", "_blank").focus()} > {rowData.code} </div> </div> ); }} ></Column>; 我已经使用 Prime React Column 组件中的 body 渲染了数据。我应用 CSS 将其设置为链接样式,并添加了 onClick 事件以进行重定向。您可以根据您的要求修改逻辑。 完整代码链接:https://codesandbox.io/s/primereact-demo-forked-kqtdvs?file=/src/App.jsx 如果您还有任何疑问,请告诉我。


© www.soinside.com 2019 - 2024. All rights reserved.