如何在 powershell 中找到 Windows 10 上的 Microsoft Edge 版本?
我搜索了 SOFTWARE\Classes 和 SOFTWARE\Microsoft 子项,但找不到与“spartan”或“edge”相关的任何内容。鉴于 Edge 还很新,所以真的没有太多
众所周知,HotSpot 中有 Serial、CMS、G1 等七个 GC。我很困惑的是,它们同时全部工作还是只有部分工作?他们是如何配合的...
如何在.NET中获取启动应用程序? Windows 10、11
如何在.NET中获取启动应用程序? 当前用户 LocalMachine SOFTWARE\Microsoft\Windows\CurrentVersion\Run 我从这里获得了启动应用程序,但没有得到预期的结果,因为我有 19 个启动...
我正在尝试创建一个快捷方式,该快捷方式仅在用户选中复选框时才会创建。 我试图创建一个属性 我正在尝试创建一个快捷方式,只有当用户选中复选框时才会创建该快捷方式。 我尝试创建一个属性 <Property Id ="INSTALLDESKTOPSHORTCUT" Secure="yes" /> 然后我创建了一个复选框,它将更改此属性的值。 <Control Id="InstallShortcutCheckbox" Type="CheckBox" X="20" Y="140" Width="200" Height="17" Property="INSTALLDESKTOPSHORTCUT" CheckBoxValue="1" Text="Do you want to create a start menu shortcut?" /> 然后我添加了快捷方式标签 <Component Id="DesktopShortcut" Condition="INSTALLDESKTOPSHORTCUT"> <CreateFolder/> <RegistryKey Root="HKCU" Key="Software\Secops Solutions, Inc\Agent\Install" > <RegistryValue Name="DTSC" Value="1" Type="integer" KeyPath="yes"/> </RegistryKey> <Shortcut Id="DesktopShortcut" Directory="DesktopFolder" Name="Life Balance" WorkingDirectory="INSTALLFOLDER" Icon="icon" Target="DesktopFile"/> </Component> 我还尝试使用广告快捷方式,其中我使用了两个组件,它们都有不同的条件,例如 if Condition = "INSTALLDESKTOPSHORTCUT" 还有另一个 Condition = "NOT INSTALLDESKTOPSHORTCUT" 但这也不起作用。 所以我一直在尝试解决这个问题,我在 orca 编辑器中看到了快捷方式,但它仍然没有创建快捷方式。 我解决了问题。 <Component Id="DesktopShortcut" Condition="INSTALLDESKTOPSHORTCUT"> <CreateFolder/> <RegistryKey Root="HKCU" Key="Software\Secops Solutions, Inc\Agent\Install" > <RegistryValue Name="DTSC" Value="1" Type="integer" KeyPath="yes"/> </RegistryKey> <Shortcut Id="DesktopShortcut" Directory="DesktopFolder" Name="Life Balance" WorkingDirectory="INSTALLFOLDER" Icon="icon" Target="DesktopFile"/> </Component> 在这段代码中我必须更改目标如下 <Component Id="DesktopShortcut" Condition="INSTALLDESKTOPSHORTCUT"> <CreateFolder/> <RegistryKey Root="HKCU" Key="Software\Secops Solutions, Inc\Agent\Install" > <RegistryValue Name="DTSC" Value="1" Type="integer" KeyPath="yes"/> </RegistryKey> <Shortcut Id="DesktopShortcut" Directory="DesktopFolder" Name="Life Balance" WorkingDirectory="INSTALLFOLDER" Icon="icon" Target="[#DesktopFile]"/> </Component> 在此只需将目标更改为 Target=[#DesktopFile] 这是文件的 id。
错误 2911:无法删除文件夹 C:\Config.Msi\
我有一个创建桌面快捷方式的安装: 我的安装会创建桌面快捷方式: <Shortcut Id="SC.Desktop" Directory="DesktopFolder" Name="!(bind.Property.ProductName)" WorkingDirectory="INSTALLDIR" Target="[INSTALLDIR]testfile.txt" /> <RegistryValue Root="HKCU" Key="Software\[Manufacturer]\[ProductName]" Type="integer" Name="DesktopIcon" Value="1" KeyPath="yes" /> 安装后一切正常,详细日志中没有错误。 在卸载时,我在详细日志中收到错误: DEBUG: Error 2911: Could not remove the folder C:\Config.Msi\. 如何解决这个问题? 这不是真正的错误消息。这只是 Windows 安装程序在自言自语。类似的文件和文件夹通常会在重新启动时清理。
#include C中的DBU(Linux)程序在C中发送带有目的地的信号。代码如下: #include <stdio.h> #include <stdlib.h> #include <dbus/dbus.h> #include <unistd.h> /** * Connect to the DBUS bus and send a broadcast signal */ void sendsignal(DBusConnection* conn, char* sigvalue) { DBusMessage* msg; DBusMessageIter args; DBusError err; int ret; dbus_uint32_t serial = 0; printf("Sending signal with value %s\n", sigvalue); // create a signal & check for errors msg = dbus_message_new_signal("/test/signal/Object", // object name of the signal "test.signal.Type", // interface name of the signal "Test"); // name of the signal if (NULL == msg) { fprintf(stderr, "Message Null\n"); exit(1); } // set the destination of the signal dbus_message_set_destination(msg, "it.smartsecurity.dbus"); // append arguments onto signal dbus_message_iter_init_append(msg, &args); if (!dbus_message_iter_append_basic(&args, DBUS_TYPE_STRING, &sigvalue)) { fprintf(stderr, "Out Of Memory!\n"); exit(1); } // send the message and flush the connection if (!dbus_connection_send(conn, msg, &serial)) { fprintf(stderr, "Out Of Memory!\n"); exit(1); } dbus_connection_flush(conn); printf("Signal Sent\n"); // free the message and close the connection dbus_message_unref(msg); //dbus_connection_close(conn); } int main(int argc, char **argv) { DBusMessage* msg; DBusMessageIter args; DBusConnection* conn; DBusError err; int ret; // initialise the error value dbus_error_init(&err); // connect to the DBUS system bus, and check for errors conn = dbus_bus_get(DBUS_BUS_SYSTEM, &err); if (dbus_error_is_set(&err)) { fprintf(stderr, "Connection Error (%s)\n", err.message); dbus_error_free(&err); } if (NULL == conn) { exit(1); } // register our name on the bus, and check for errors ret = dbus_bus_request_name(conn, "it.smartsecurity.dbus", DBUS_NAME_FLAG_REPLACE_EXISTING , &err); if (dbus_error_is_set(&err)) { fprintf(stderr, "Name Error (%s)\n", err.message); dbus_error_free(&err); } if (DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER != ret) { exit(1); } do { sendsignal(conn, "CIAO"); sleep(1); } while (1); // dbus_connection_close(conn); return 0; } 然后用ZBUS板条箱写了Followng代码: use futures_util::stream::StreamExt; use zbus::{zvariant::OwnedObjectPath, proxy, Connection}; use zbus::zvariant::Value; #[proxy( default_service = "it.smartsecurity.dbus", default_path = "/test/signal/Object", interface = "test.signal.Type", )] trait Systemd1Manager { // Defines signature for D-Bus signal named `Test` #[zbus(signal)] fn test(&self, unit: String) -> zbus::Result<()>; // si deve chiamare come il segnale } async fn watch_systemd_jobs() -> zbus::Result<()> { let connection = Connection::system().await?; // `Systemd1ManagerProxy` is generated from `Systemd1Manager` trait let systemd_proxy = Systemd1ManagerProxy::builder(&connection) .destination("it.smartsecurity.dbus")? .path("/test/signal/Object")? .interface("test.signal.Type")? .build().await?; // Method `receive_job_new` is generated from `job_new` signal let mut new_jobs_stream = systemd_proxy.receive_test().await?; while let Some(msg) = new_jobs_stream.next().await { //dbg!(&msg); // struct `JobNewArgs` is generated from `job_new` signal function arguments let args = msg.args(); dbg!(&args); println!("====================="); // stampa il nome del servizio e il suo valore let x = msg.message().header(); let y = x.member(); if y.is_some() { println!("Header: {}", y.unwrap()); } dbg!(&y); let unit = args.unwrap().unit; println!("Param: {}", unit); } panic!("Stream ended unexpectedly"); } #[tokio::main] async fn main() { watch_systemd_jobs().await.unwrap(); } 我的问题是,此生锈代码不会捕获信号,我不明白我在做什么。 当您将总线消息发送到特定目的地时,它们不再是广播(与您的代码注释相反) - 仅将其发送到该目的地。接收此类信号。 在您的代码中,总线名称由发件人而不是接收器声明,因此发件人实际上将信号发送给本身。
我正在使用 Beautiful Soup 4 来抓取页面。有一段我不想要的文本: 我正在使用 Beautiful Soup 4 来抓取页面。有一段文字我不想要: <p class="MsoNormal" style="text-align: center"><b> <span lang="EN-US" style="font-family: Arial; color: blue"> <font size="4">1 </font></span> <span lang="AR-SA" dir="RTL" style="font-family: Arial; color: blue"> <font size="4">ـ</font></span><span lang="EN-US" style="font-family: Arial; color: blue"><font size="4"> сүрә фатиһә</font></span></b></p> 它的独特之处在于它有一个标签。我已经使用 findall() 来获取所有 标签。所以现在我有一个 for 循环,例如: for el in doc.findall('p'): if el.hasChildTag('b'): break; 不幸的是bs4没有“hasChildTag”功能 也应该可以使用CSS选择器。 http://www.crummy.com/software/BeautifulSoup/bs4/doc/#css-selectors soup.select("p b") for elem in soup.findAll('p'): if elem.findChildren('b'): continue #skip the elem with "b", and continue with the loop #do stuff with the elem
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 不在受保护区域中,则会显示它们。