我的网站有H1风格:
.centercol h1 {
color: #006bb6;
font-weight: normal;
font-size: 18px;
padding:3px 3px 3px 6px;
border-left:3px solid #c6c1b8;
background:#f2efe9;
display:block;
}
Run Code Online (Sandbox Code Playgroud)
背景颜色跨越centercol的整个宽度,500px ......
如何使H1只跨越H1文本的宽度?
这个难题在NDC 2010上发布.有视频链接,但它们都被打破了.我不明白这个程序的行为; 为什么会挂?
class Woot
{
private static float PI;
private static bool initialized = doInitialize();
private static bool doInitialize()
{
if (!initialized)
{
var thread = new Thread(() => { PI = 3.14f; });
thread.Start();
thread.Join(); // here
}
return true;
}
public static void Main(string[] args)
{
Console.WriteLine(PI);
}
}
Run Code Online (Sandbox Code Playgroud)
这个程序的输出是什么?是吗:
- 3.14
- 0
- 引发异常
- 以上都不是
我有一个组件,我想触发路由级别操作,以便我可以转换到不同的路由.
App = Ember.Application.create();
App.Router.map(function() {
});
App.IndexRoute = Ember.Route.extend({
actions: {
complete: function() {
// This never happens :(
console.log('Triggered complete!');
}
}
});
App.MyAreaComponent = Ember.Component.extend({
actions: {
clickMyButton: function() {
console.log('Triggering complete action.');
// Attempting to trigger App.IndexRoute.actions.complete here
this.sendAction('complete');
}
}
});
Run Code Online (Sandbox Code Playgroud)
我想要完成的是当MyAreaComponent的'clickMyButton'动作被触发时,它将触发IndexRoute的'完整'动作.
我已经设置了一个jsbin来演示我的问题:
http://emberjs.jsbin.com/wivuyike/1/edit
如果控制器未实现与其操作对象中的操作同名的方法,则该操作将被发送到路由器,其中当前活动的叶路由将有机会处理该操作.
所以考虑到这一点,我希望组件说"让我们检查一下我的控制器,看看它是否有一个叫'完全'的动作.不是吗?好吧,让我们检查一下我的路线(IndexRoute),看它是否有一个叫'完成'的动作"是的?好的,触发它!"
我唯一能想到的是,由于组件的设置方式,IndexRoute未设置为组件的路径,因此动作冒泡只会在控制器处停止.
我不确定从哪里开始.我是否需要做一些特别的事情才能让我的组件知道我的IndexRoute?
我试图根据JQuery $ .get请求的结果确定函数的返回值:
function checkResults(value) {
$.get("checkDuplicates.php", {
value: value
}, function(data) {
if(data == "0") {
//I want the "checkResults" function to return true if this is true
} else {
//I want the "checkResults" function to return false otherwise
}
});
}
Run Code Online (Sandbox Code Playgroud)
有没有简单的方法来做到这一点?
在SharePoint中,当我需要在用户没有权限时执行操作时,我使用:
SPSecurity.RunWithElevatedPrivileges(delegate()
{
// DO SOMETHING WITH PRIVILEGES
});
Run Code Online (Sandbox Code Playgroud)
但现在我需要使用提升的权限执行JavaScript:
var context = new SP.ClientContext.get_current();
context.executeQueryAsync(); // NEED PRIVILEGES TO WORK
Run Code Online (Sandbox Code Playgroud)
这可能吗?