有没有办法让.NET Windows窗体上的标签可以突出显示,以允许复制文本.我试图使用一个看起来像标签的文本框来做到这一点,但这会导致闪烁的光标.
我.on()用来将点击事件附加到页面上动态显示的多个元素.我遇到的问题是,当我.on在页面上添加一个容器并想要将click事件附加到容器中的多个元素时,后者会覆盖前一个元素.
<div id="container">
<!-- elements here appear dynamically -->
<div id="id1"></div>
<div id="id1"></div>
</div>
<script>
$('#container').on("click", "#id1", function(){});
$('#container').on("click", "#id2", function(){});
</script>
Run Code Online (Sandbox Code Playgroud)
在上面的示例中,只有id2的click事件有效.
有没有解决的办法?
谢谢,Ev.
任何人都可以告诉我FB API的工作原理.它看起来是一个基本问题,但我真的很困惑.
问题:我有onlogin().当我单击登录按钮时,我希望它能够调用此功能.但是在我粘贴的代码中:我看到首先打印警报测试,然后调用FB.api.
因此,看起来首先调用onlogin,然后调用FB API ...有一种方法我只能调用此函数一次.
<body>
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({appId: 'XXX', status: true, cookie: true, xfbml: true});
};
(function() {
var e = document.createElement('script'); e.async = true;
e.src = document.location.protocol +
'//connect.facebook.net/en_US/all.js';
document.getElementById('fb-root').appendChild(e);
}());
function checkFacebookLogin() {
FB.api('/me', function(response) {
alert("Name: "+ response.name + "\nFirst name: "+ response.first_name + "ID: "+response.id);
});
alert('test');
}
</script>
<p id="fb_login_button_1"><fb:login-button onlogin="checkFacebookLogin();" size="medium" scope="user_about_me">Sign in using Facebook</fb:login-button></p>
</body>v
Run Code Online (Sandbox Code Playgroud)
我的主要问题是该函数应该只调用一次....但它被调用两次.
html javascript facebook facebook-graph-api facebook-javascript-sdk
使用java的createTempFile方法创建临时文件然后将其重命名并将其保存为永久文件是安全的吗?或者java或系统以某种方式跟踪其临时文件并在某些时候删除它们?
顺便说一句,这与Mac OS X有关.
我正在使用Grails Spring-Security插件开发Grails(版本1.3.3)Web应用程序,Spring-Security-Core-1.0.1(反过来,它使用spring-security-3.0.2.RELEASE).
我想为控制器中的操作提供基于Spring-Security注释的访问控制.
我已经能够使用以下注释成功进行基本身份验证:
@Secured("hasAnyRole('ROLE_USER')")
def list = {
...
}
Run Code Online (Sandbox Code Playgroud)
这样做 - 只向具有ROLE_USER角色的人提供对列表操作/视图的访问.
但是,允许执行某些控制器操作的角色集可能会随时间而变化,并且是系统整体状态的函数.也就是说,允许执行给定操作的角色集可能由服务或域对象方法返回.
我可以做这样的事情的一种方法是使用Spring-Security的"基于表达式的访问控制"(@Pre和@Post注释),类似于Spring Security Documentation中的示例:
@PreAuthorize("hasPermission(#contact, 'admin')")
public void deletePermission(Contact contact, Sid recipient, Permission permission);
Run Code Online (Sandbox Code Playgroud)
在用于访问控制决策的该示例中,可以使用#contact语法访问发送到该方法的对象(例如,联系人).
但是,我无法获得@PreAuthorize(或@RolesAllowed)注释来处理Grails控制器操作.如果我用@PreAuthorize(而不是@Secured,如上所述)注释列表操作,我会收到以下错误:
元素FIELD上不允许使用注释@ org.springframework.security.access.prepost.PreAuthorize
这并不奇怪 - 该操作是Groovy闭包(具有可执行代码的字段),而不是方法.但是,我也尝试使用从闭包中调用的方法的注释,如:
def list = {
testMethod()
....
}
@PreAuthorize("hasRole('ROLE_USER')")
public boolean testMethod(){
println "testMethod succeess"
return true;
}
Run Code Online (Sandbox Code Playgroud)
虽然这不会引发任何错误,但它似乎也没有提供任何访问控制.(无论用户是否具有ROLE_USER,都会打印"testMethod success").
所以,我尝试了一些不同的东西(并阅读了文档),但是还没有能够找到一种使用Grails控制器动作使用@PreAuthorize注释的好方法.这可能吗?在Grails应用程序中是否有更好的方法来使用Spring-Security-Annotations来提供访问控制,这是系统状态的一个功能?
我正在关注Grails in Action中的示例.我有一个问题,了解该addTo*()功能的工作原理.
我有一个简单的域:User,Post,Tag具有以下关系:
当我运行以下代码(第一种情况)时:
1. def user = new User(userId: 'joe', password: 'secret').save()
2. def tagGroovy = new Tag(name: 'groovy')
3. def tagGrails = new Tag(name: 'grails')
4. user.addToTags(tagGroovy)
5. user.addToTags(tagGrails)
6.
7. def groovyPost = new Post(content: 'A groovy post')
8. user.addToPosts(groovyPost)
9. groovyPost.addToTags(tagGroovy)
10.
11. User.get(1).tags.each {println it.id + " " + it.name}
12. User.get(1).posts.each {println it.id + " " + it.content + " " + it.dateCreated}
Run Code Online (Sandbox Code Playgroud)
我明白了:
null grails
null groovy …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用FontAwesome制作带有无线电收集的星级评级表,为此我实际上需要更改simple_form生成的collection_radio_button输入的标签类,但找不到任何明显的解决方案.
到目前为止我使用:
form_for @user do |f|
f.collection_radio_buttons :rating, [[1, 'Bad'] ,[2, 'Ok'], [3, 'Great']],
:first, :last, { item_wrapper_tag: false }
end
Run Code Online (Sandbox Code Playgroud)
哪个产生:
<input id="review_rating_1" name="review[rating]" type="radio" value="1" />
<label class="collection_radio_buttons" for="review_rating_1">Bad</label>
<input id="review_rating_2" name="review[rating]" type="radio" value="2" />
<label class="collection_radio_buttons" for="review_rating_2">Ok</label>
<input id="review_rating_3" name="user[options]" type="radio" value="3" />
<label class="collection_radio_buttons" for="review_rating_3">Great</label>
Run Code Online (Sandbox Code Playgroud)
但我希望标签有一个额外的类,如:
<input id="review_rating_3" name="user[options]" type="radio" value="3" />
<label class="collection_radio_buttons icon-star" for="review_rating_3">Great</label>
Run Code Online (Sandbox Code Playgroud)
更新:此类在静态定义:https://github.com/plataformatec/simple_form/blob/master/lib/simple_form/tags.rb#L43
我正在寻找有关使用Visual Studio 2010编译Qt 4.7的任何教程或信息.
我最近在Visual Studio 2010上使用Qt 4.7.1库遇到了一个错误,并且发现了重新编译Qt with 2010的信息可能会解决它.编辑:这解决了这个问题.
参考:http://www.qtforum.org/article/34406/heap-corruption-caused-by-calling-selectedindexes-method-of-qitemselectionmodel-class.html
经过一段时间的研究,我成功地使用以下方法在VS2010中编译Qt:
编译:
与VS2010集成:
希望这有助于其他人......
进一步的参考:
http://www.holoborodko.com/pavel/2011/02/01/how-to-compile-qt-4-7-with-visual-studio-2010/ http://blog.paulnettleship.com/2010/ 11/11/troubleshooting-visual-studio-2010-and-qt-4-7-integration/ http://dcsoft.wordpress.com/2010/01/30/how-to-setup-qt-4-5-视觉工作室集成/
注意:重新编译VS2010上面遇到的修复bug.
使用Panel或HtmlContainerControl需要在ASP.NET中创建服务器端容器之间的开销是否有任何差异.
HtmlContainerControl Container = new HtmlGenericControl("div");
Run Code Online (Sandbox Code Playgroud)
要么
Panel Container = new Panel();
Run Code Online (Sandbox Code Playgroud)
此外,它在不同浏览器中的呈现方式有何不同?我注意到Panel似乎在我使用的所有浏览器中呈现为div.
我正在尝试生成符合RFC 3339的日期字符串(即'2008-03-19T00:00:00.0000000-04:00')但是我似乎遇到了偏移无效的问题.我使用以下内容:
private string GetDate(DateTime DateTime)
{
DateTime UtcDateTime = TimeZoneInfo.ConvertTimeToUtc(DateTime);
return XmlConvert.ToString(UtcDateTime, XmlDateTimeSerializationMode.Utc);
}
Run Code Online (Sandbox Code Playgroud)
但这会给我一个像"1977-02-03T05:00:00Z"这样的值
我也尝试使用特定的格式,如
utcDateTime.ToString("yyyy-MM-dd'T'HH:mm:ss.fffK", DateTimeFormatInfo.InvariantInfo);
Run Code Online (Sandbox Code Playgroud)
但结果相同.
请参阅此现有参考:如何解析DateTime并将其转换为RFC 3339日期时间格式?
c# ×3
.net ×2
grails ×2
html ×2
asp.net ×1
compilation ×1
datetime ×1
facebook ×1
file ×1
flush ×1
grails-orm ×1
io ×1
java ×1
javascript ×1
jquery ×1
onclick ×1
panel ×1
propagation ×1
qt ×1
rfc3339 ×1
ruby ×1
simple-form ×1
temp ×1
windows ×1
winforms ×1