目前我正在使用python内置的应用程序.当我在个人计算机上运行时,它可以正常工作.
但是,当我将它移动到生产服务器时.它不断向我显示如下错误:
我做了一些研究,我得到了最终用户浏览器在服务器仍在忙于发送数据时停止连接的原因.
我想知道它为什么会发生以及阻止它在生产服务器中正常运行的根本原因是什么,而它可以在我的个人计算机上运行.任何建议表示赞赏
Exception happened during processing of request from ('127.0.0.1', 34226)
Traceback (most recent call last):
File "/usr/lib/python2.7/SocketServer.py", line 284, in
_handle_request_noblock
self.process_request(request, client_address)
File "/usr/lib/python2.7/SocketServer.py", line 310, in process_request
self.finish_request(request, client_address)
File "/usr/lib/python2.7/SocketServer.py", line 323, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/lib/python2.7/SocketServer.py", line 641, in __init__
self.finish()
File "/usr/lib/python2.7/SocketServer.py", line 694, in finish
self.wfile.flush()
File "/usr/lib/python2.7/socket.py", line 303, in flush
self._sock.sendall(view[write_offset:write_offset+buffer_size])
error: [Errno 32] Broken pipe
Run Code Online (Sandbox Code Playgroud) 是否有一个函数可以替换c ++中的atoi.我做了一些研究,没有找到任何替代它,唯一的解决方案是使用cstdlib或自己实现它
我知道CompletableFuture设计不能通过中断来控制它的执行,但我想你们中的一些人可能会遇到这个问题.CompletableFutures是组合异步执行的非常好的方法,但考虑到你希望在取消未来时中断或停止底层执行的情况,我们该怎么做?或者我们必须接受任何取消或手动完成CompletableFuture不会影响在那里完成它的线程?
也就是说,在我看来,显然是一项无用的工作需要时间来执行工人.我想知道在这种情况下哪种方法或设计可能有用?
UPDATE
这是一个简单的测试
public class SimpleTest {
@Test
public void testCompletableFuture() throws Exception {
CompletableFuture<Void> cf = CompletableFuture.runAsync(()->longOperation());
bearSleep(1);
//cf.cancel(true);
cf.complete(null);
System.out.println("it should die now already");
bearSleep(7);
}
public static void longOperation(){
System.out.println("started");
bearSleep(5);
System.out.println("completed");
}
private static void bearSleep(long seconds){
try {
TimeUnit.SECONDS.sleep(seconds);
} catch (InterruptedException e) {
System.out.println("OMG!!! Interrupt!!!");
}
}
}
Run Code Online (Sandbox Code Playgroud) 为什么当我想初始化以下向量时 uint8_t
uint8_t *mmac_source1 = { 0x01, 0x80, 0xc2, 0x00, 0x00, 0x01 };
Run Code Online (Sandbox Code Playgroud)
我收到这个错误
Error: scalar object 'mmac_source1' requires one element in initializer
Run Code Online (Sandbox Code Playgroud)
但是当我使用它时:
uint8_t mmac_source1[6] = { 0x01, 0x80, 0xc2, 0x00, 0x00, 0x01 };
Run Code Online (Sandbox Code Playgroud)
它工作正常.
我需要更轻的容器,必须存储到128 unsigned int.它必须添加,编辑和删除快速访问它的每个元素,而不是每次都分配新的内存(我已经知道它将是最大128).
如:
add int 40 at index 4 (1/128 item used)
add int 36 at index 90 (2/128 item used)
edit to value 42 the element at index 4
add int 36 at index 54 (3/128 item used)
remove element with index 90 (2/128 item used)
remove element with index 4 (1/128 item used)
Run Code Online (Sandbox Code Playgroud)
... 等等.因此,每次我只能迭代添加到容器中的实际数量的元素,而不是全部,并检查是否为NULL.
在这个过程中,正如我所说,它不能分配/重新分配新内存,因为我使用的是管理"音频"数据的应用程序,这意味着每次触摸内存时都会出现故障.
哪个容器是合适的候选人?它听起来像一个"索引"队列.
我有登录成功和重定向到页面的奇怪问题.
下面是我的弹簧安全配置.
<http auto-config="true" use-expressions="true">
<intercept-url pattern="/login.hst**" access="anonymous or authenticated" />
<intercept-url pattern="/**/*.hst" access="authenticated" />
<form-login login-page="/login.hst"
authentication-failure-url="/login.hst?error=true"
authentication-success-handler-ref="loginSucessHandler" />
<logout invalidate-session="true" logout-success-url="/home.hst"
logout-url="/logout.hst" />
<remember-me key="jbcpHaverERP" authentication-success-handler-ref="loginSucessHandler"/>
<session-management>
<concurrency-control max-sessions="1" />
</session-management>
</http>
Run Code Online (Sandbox Code Playgroud)
LoginSuessHandler类:
@Service
public class LoginSucessHandler extends
SavedRequestAwareAuthenticationSuccessHandler {
@Override
public void onAuthenticationSuccess(HttpServletRequest request,
HttpServletResponse response, Authentication authentication)
throws ServletException, IOException {
...
super.setUseReferer(true);
super.onAuthenticationSuccess(request, response, authentication);
}
}
Run Code Online (Sandbox Code Playgroud)
现在成功重定向到请求页面的问题.如果我直接引用任何安全网址spring将我重定向到登录页面并成功登录到原始请求的链接.但是,如果用户之前选择了remember-me然后关闭浏览器并且现在请求直接URL,那么这不起作用,他正在进行适当的身份验证,而不是将他重定向到请求的页面重定向到/.我检查了日志和一些弹簧源代码,发现它无法确定目标网址.
我试图设置引用但引用值为null.但有一件奇怪的事我注意到,在spring安全配置中,如果我从remember-me配置中删除authentication-success-handler,那么它可以工作.
<remember-me key="jbcpHaverERP" authentication-success-handler-ref="loginSucessHandler"/>
Run Code Online (Sandbox Code Playgroud)
无法弄清楚问题.是身份验证成功处理程序实现需要不同的表单登录和记住我吗?
当我谷歌这个时,我发现许多地方建议使用该PluralSight工具生成证书,但此工具不再可用.
有没有人知道另一个可以轻松创建和安装证书的工具?
编辑:
新URL中提供的工具:Plural-sight自我证书工具.
我目前正在重写(部分)printf()学校项目的功能.总的来说,我们需要使用几个标志,转换,长度修饰符来重现函数的行为......
我唯一要做的就是让我卡住的是旗帜%C/ %S(或%lc/ %ls).
到目前为止,我收集的wchar_t是一种可以在多个字节上存储字符的类型,以便接受更多字符或符号,因此几乎与所有语言兼容,无论其字母和特殊字符如何.
但是,我无法找到有关wchar机器外观的具体信息,它的实际长度(显然根据包括编译器,操作系统等几个因素而有所不同)或如何实际编写它们.
先感谢您
请注意,我们在允许使用的功能方面受到限制.唯一允许的功能是write(),malloc(),free(),和exit().我们必须能够自己编写任何其他所需的功能.
总结一下,我在这里要问的是如何解释和编写"手动"任何wchar_t字符的一些信息,尽可能少的代码,以便我可以尝试理解整个过程并自己编写代码.
我正在尝试在内部创建一个函数functions.php,用来自多个自定义字段的信息替换自定义帖子标题.在发布帖子之前,我想评估它是否已经创建或者这是一个新帖子; 如果是新帖子,我想从多个字段中获取信息,计算此自定义帖子类型中的帖子总数并创建标题; 如果这只是编辑已经存在的帖子,我想使用该$_POST['post_title']字段内的内容.
function custom_field_value_as_title( $value, $post_id, $field ) {
global $_POST;
// vars
$title = $_POST['post_title'];
$post = get_page_by_title( $title, 'OBJECT', 'mascotas' );
if ( FALSE === get_post_status( $post_id ) ) {
$new_title_ciudad = get_field('ciudad', $post_id);
$new_title_sexo = get_field('sexo', $post_id);
$new_title_especie = get_field('especie' , $post_id);
$registered_year = date("y");
$count_mascotas = wp_count_posts('mascotas');
$next_count = $count_mascotas->publish + 1;
$new_count = sprintf("%04d", $next_count);
$new_title = "$new_title_ciudad"."$new_title_sexo"."$new_title_especie"."$registered_year"."-"."$new_count";
// update post
$my_post = array(
'ID' => $post_id,
'post_title' => $new_title, …Run Code Online (Sandbox Code Playgroud) c ×2
c++ ×2
atoi ×1
broken-pipe ×1
certificate ×1
concurrency ×1
containers ×1
java ×1
php ×1
pointers ×1
printf ×1
python ×1
spring ×1
stl ×1
wchar-t ×1
widechar ×1
wordpress ×1
wpf ×1
x509 ×1