我有一个在ASP.NET文本框控件上使用jQuery UI DatePicker的应用程序.
控件正在按预期工作,但我注意到当您从服务器调用回发(通过提交按钮)时,输入的值会在应用程序中丢失.
想知道你们是否都经历过这个?您需要采取哪些措施来防止这种情况发生?
<asp:TextBox runat="server" ID="txtCallsMadeFrom" class="field" EnableViewState="true">
var callsMadeFromId = '#<%=txtCallsMadeFrom.ClientID %>';
jQuery(callsMadeFromId).datepicker({ showOn: "button", buttonImage: "../images/calendar.gif", altFormat: 'dd/mm/yy', buttonImageOnly: true, onSelect: function () { } });
Run Code Online (Sandbox Code Playgroud) 我的spring-security.xml有两个问题
当我有多个角色时,access="ROLE_ADMIN,ROLE_EMPLOYEE"
我得到了例外:
Caused by: java.lang.IllegalArgumentException: Failed to parse expression 'ROLE_ADMIN,ROLE_EMPLOYEE'
但如果我有一个角色:access="ROLE_ADMIN"它会正常工作
如果我直接登陆/Management/main/admin我不会被规则重定向:security:form-login login-page="/Management/auth/login/",这意味着我可以在没有角色管理员的情况下进入应用程序.
这是我的spring-security.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"
xmlns:lang="http://www.springframework.org/schema/lang"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:sec="http://www.springframework.org/schema/security"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-3.0.xsd">
<sec:global-method-security secured-annotations="enabled" jsr250-annotations="enabled" />
<sec:http auto-config="true" use-expressions="true"
access-denied-page="/Management/auth/denied">
<sec:intercept-url pattern="/Management/auth/login" filters="none" access="permitAll"/>
<sec:intercept-url pattern="/Management/main/admin" filters="none" access="ROLE_ADMIN,ROLE_EMPLOYEE" />
<sec:intercept-url pattern="/Management/api/affiliates/**" filters="none" access="ROLE_ADMIN,ROLE_EMPLOYEE" />
<sec:form-login login-page="/Management/auth/login/"
authentication-success-handler-ref="loginAuthenticationSuccessHandler"
authentication-failure-url="/Management/auth/login?error=true"
login-processing-url="/Management/auth/j_spring_security_check"
default-target-url="/Management/auth/login?error=false" />
<sec:logout invalidate-session="true"
logout-success-url="/Management/auth/login/" logout-url="/Management/auth/logout" />
</sec:http>
<sec:authentication-manager>
<sec:authentication-provider
user-service-ref="customUserDetailsService">
<sec:password-encoder ref="passwordEncoder" …Run Code Online (Sandbox Code Playgroud) 我正在使用一个简单的基于单元测试的测试运行器来测试我的Django应用程序.
我的应用程序本身配置为使用settings.py中的基本记录器:
logging.basicConfig(level=logging.DEBUG)
Run Code Online (Sandbox Code Playgroud)
在我的应用程序代码中使用:
logger = logging.getLogger(__name__)
logger.setLevel(getattr(settings, 'LOG_LEVEL', logging.DEBUG))
Run Code Online (Sandbox Code Playgroud)
但是,在运行单元测试时,我想禁用日志记录,以免它使我的测试结果输出混乱.是否有一种简单的方法可以以全局方式关闭日志记录,以便特定于应用程序的记录器在运行测试时不会将内容写入控制台?
以下脚本未向浏览器输出错误消息.相反,它会导致HTTP Error 500响应.
<?php
error_reporting(E_ALL);
ini_set('display_errors', 'On');
phpinfo();
echo "test" asdf // This should error
?>
Run Code Online (Sandbox Code Playgroud)
想法?这是ubuntu上基本的php5/apache2安装.httpd.conf是空白的,没有.htaccess文件.
error.log文件显示错误消息:
语法错误,意外的T_STRING,期待','或';'
哪个是对的.
我试图在导航栏中的不同项目点击更新maint div内容时尝试更新单个div的内容,而不是尝试在我的网站上创建大量不同的页面.我试图用Javascript找到一个简单的例子:
<script type="text/javascript">
function ReplaceContentInContainer(id,content) {
var container = document.getElementById(id);
container.innerHTML = content;
}
</script>
<div id="example1div" style="border-style:solid; padding:10px; text-align:center;">
I will be replaced when you click.
</div>
<a href="javascript:ReplaceContentInContainer('example1div', '<img src='2.jpg'>' )">
Click me to replace the content in the container.
</a>
Run Code Online (Sandbox Code Playgroud)
当我只尝试更新文本时这很好用,但是当我在那里放一个img标签时,正如你所看到的,它停止工作.
要么1)我试图这样做的问题是什么?或2)有什么更好/更容易的方法呢?
我不是坚持使用Javascript.jQuery也可以工作,只要它简单或容易.我想创建一个函数,让我传入任何我想要更新的HTML并将其插入div标签并取出"旧"HTML.
我需要在imap_search()命令中使用OR语句.
我发现此库中不支持条件OR. Imap_search错误报告链接必须有一种方法可以使用条件OR搜索电子邮件,我该怎么做呢?我不知道我从哪里开始.
我希望能做什么:
$boxes = imap_search($connection,'SINCE "08-Mar-2011" AND (BODY "bobby" OR BODY "robert" OR BODY "bob"');
Run Code Online (Sandbox Code Playgroud) 如果我在构造函数中写return语句怎么办?它符合标准吗?
struct A
{
A() { return; }
};
Run Code Online (Sandbox Code Playgroud)
上面的代码编译正常,在ideone上没有任何错误.但是以下代码不会:
struct A
{
A() { return 100; }
};
Run Code Online (Sandbox Code Playgroud)
它在ideone上给出了这个错误:
错误:从构造函数返回一个值
我理解从构造函数返回值根本没有意义,因为它没有明确提到返回类型,并且我们毕竟不能存储返回的值.但我很想知道:
void吗?当我跑:
ruby -I test test/unit/job_test.rb
Run Code Online (Sandbox Code Playgroud)
从应用程序根目录,我收到以下错误:
.../app/models/name_position.rb:9:in `<class:NamePosition>':
uninitialized constant NamePosition::PositionManager (NameError)
from .../app/models/name_position.rb:1:in `<top (required)>'
from .../app/models/ac_buyer.rb:1:in `<top (required)>'
...
Run Code Online (Sandbox Code Playgroud)
这是相关代码:
# app/models/ac_buyer.rb
class AcBuyer < NamePosition
end
# app/models/name_position.rb
class NamePosition < ActiveRecord::Base
...
include PositionManager
end
# lib/position_manager.rb
module PositionManager
...
end
Run Code Online (Sandbox Code Playgroud)
看起来在运行测试时,lib目录中的文件不会自动加载.
有什么建议 ?
在OpenGL着色语言(GLSL)中讨论凹凸贴图,镜面高光和这些东西
我有:
现在,我如何计算每个顶点的Binormal和Tangent?我的意思是,计算Binormals的公式是什么,我必须根据这些信息使用什么?和切线相关?
无论如何我都会构建TBN矩阵,所以如果你知道根据这些信息直接构造矩阵的公式会很好!
哦,是的,如果需要,我也有纹理坐标.正如我所说的GLSL,我认为,每个顶点解决方案都是不错的,它不需要一次访问多个顶点信息.
----更新-----
我找到了这个解决方案
vec3 tangent;
vec3 binormal;
vec3 c1 = cross(a_normal, vec3(0.0, 0.0, 1.0));
vec3 c2 = cross(a_normal, vec3(0.0, 1.0, 0.0));
if (length(c1)>length(c2))
{
tangent = c1;
}
else
{
tangent = c2;
}
tangent = normalize(tangent);
binormal = cross(v_nglNormal, tangent);
binormal = normalize(binormal);
但我不知道它是否100%正确.
jquery ×2
php ×2
unit-testing ×2
3d ×1
apache2 ×1
asp.net ×1
c++ ×1
constructor ×1
django ×1
email ×1
frameworks ×1
glsl ×1
html ×1
http ×1
httpd.conf ×1
ide ×1
imap ×1
java ×1
javascript ×1
jquery-ui ×1
logging ×1
math ×1
opengl ×1
python ×1
return ×1
return-type ×1
return-value ×1
testing ×1