我已经将一个项目从Eclipse移植到Maven,我需要设置一个环境变量来使我的项目工作.
在Eclipse中,我转到"运行 - >运行配置",在"环境"选项卡下,我将"WSNSHELL_HOME"设置为值"conf".
我怎么能用Maven做到这一点?
非常感谢你!
我试图在窗口调整大小时调整div大小,在环顾四周之后,似乎使用指令是最好的解决方案.
模板:
<div elHeightResize ng-view ng-style="{ height: windowHeight }"></div>
Run Code Online (Sandbox Code Playgroud)
指示:
myApp.directive('elheightresize', ['$window', function($window) {
return {
link: function(scope, elem, attrs) {
scope.onResize = function() {
var header = document.getElementsByTagName('header')[0];
elem.windowHeight = $window.innerHeight - header.clientHeight;
}
scope.onResize();
angular.element($window).bind('resize', function() {
scope.onResize();
})
}
}
}])
Run Code Online (Sandbox Code Playgroud)
虽然我可以登录elem.windowHeight的scope.onResize,它似乎并没有将它应用到ngStyle
我还在忽视什么吗?
编辑:
<div ng-view resize style="height: {{ windowHeight }}px">
这个解决方案似乎有效,仍然对使用ngStyle不起作用的原因感兴趣.
我有一行代码使用:
codebase.Methods.Where(x => x.Body.Scopes.Count > 5);
Run Code Online (Sandbox Code Playgroud)
如何插入多个条件?所以我可以说x => predicate && y => predicate?
谢谢
我正在循环一组模型,并希望每个模型显示一个元素.但是,出于CSS的原因,我必须在到达第四个模型时添加另一个元素(我需要clearfix为布局添加一个Bootstrap 元素才能看起来很好).
<div class="jumbotron">
<ol class="row">
<li *ngFor="#card of deck; #i = index" class="col-xs-3">
<h3>{{ card.name }}</h3>
</li>
</ol>
</div>
Run Code Online (Sandbox Code Playgroud)
怎么说,如果(i + 1) % 4 === 0,然后li加上另一个<li class="clearfix"></li>?
我想知道注册容器本身是否有任何副作用
IContainer container;
ContainerBuilder builder = new ContainerBuilder();
container = builder.Build();
builder.RegisterInstance(container).As<IContainer>();
Run Code Online (Sandbox Code Playgroud)
并使用它像这样
builder.RegisterType<IManagmentServiceImp>().As<ManagmentServiceImp>()
.WithParameter(new ResolvedParameter(
(pi, ctx) => pi.ParameterType == typeof(IContainer) && pi.Name == "Container",
(pi, ctx) => container
));
Run Code Online (Sandbox Code Playgroud)
或者它是否会起作用.
public class Foo
{
private Bar FooBar {get;set;}
private class Bar
{
private string Str {get;set;}
public Bar() {Str = "some value";}
}
}
Run Code Online (Sandbox Code Playgroud)
如果我有类似上面的内容并且我有一个Foo的引用,我怎么能用反射来获得价值Str out Foo的FooBar?我知道没有任何理由可以做这样的事情(或者很少的方式),但我认为必须有办法做到这一点,我无法弄清楚如何实现它.
编辑,因为我在正文中提出的错误问题与标题中的正确问题不同
我从这行代码中得到了上面标题中的错误:
\n\nHttpCookie authCookie = Context.Request.Cookies[cookieName];\nRun Code Online (Sandbox Code Playgroud)\n\n有什么我忘记使用的吗?
\n\n\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0
\n\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Web;\nusing System.Web.Mvc;\nusing System.Web.Security;\nusing System.Security.Principal;\nRun Code Online (Sandbox Code Playgroud)\n 需要一些提供OpaqueToken的帮助.使用Angular 2 beta-12.如果提供者密钥是字符串,它可以正常工作,但在使用OpaqueToken时不起作用.在Child类中,SF未定义.
家长班:
export let SF = new OpaqueToken('sf');
export class A {
testMsg: string = 'hello';
}
@Component({
template: `<child></child>`,
providers: [
provide(SF, {useValue: A}),
provide('justString', {useValue: 'hi'})
]
})
export class App {}
Run Code Online (Sandbox Code Playgroud)
儿童班:
import {Component, Injector, Inject, OpaqueToken} from 'angular2/core'
import {SF, A} from './app'
console.log("******", SF); // undefined
@Component({
selector: 'child',
template: `
$$CHILD Rendered$$ {{a}}
`
})
export class Child {
//constructor(@Inject(SF) private a: A) {} // doesn't work
constructor(@Inject('justString') private a: string) {} …Run Code Online (Sandbox Code Playgroud) 根据我对Angular 2的理解,ViewChildren装饰器允许Component获取其他组件或指令的查询。当我知道组件的特定类型时,我可以在Typescript中使用它,但是QueryList当我只知道组件的接口时,我希望能够得到一个。这样,我可以遍历视图组件。
例如,在组件中,我可能有:
@ViewChildren(Box) shapes: QueryList<Box>;
Run Code Online (Sandbox Code Playgroud)
其中Box是具体的TypeScript类。我想拥有的是:
@ViewChildren(IShape) shapes: QueryList<IShape>;
Run Code Online (Sandbox Code Playgroud)
IShapeBox或其他组件可以实现的接口在哪里。这样,视图可以非常动态,并且我的代码仍然可以工作。有没有建议的方法来解决这个问题?
在处理协变接口时,我有一个完整的wtf时刻.
考虑以下:
class Fruit { }
class Apple : Fruit { }
interface IBasket<out T> { }
class FruitBasket : IBasket<Fruit> { }
class AppleBasket : IBasket<Apple> { }
Run Code Online (Sandbox Code Playgroud)
注意:
AppleBasket 不继承自 FruitBasket.IBasket是协变的.稍后在脚本中,您写道:
FruitBasket fruitBasket = new FruitBasket();
AppleBasket appleBasket = new AppleBasket();
Log(fruitBasket is IBasket<Fruit>);
Log(appleBasket is IBasket<Apple>);
Run Code Online (Sandbox Code Playgroud)
......正如您所期望的那样,输出是:
true
true
Run Code Online (Sandbox Code Playgroud)
但是,请考虑以下代码:
AppleBasket appleBasket = new AppleBasket();
Log(appleBasket is IBasket<Fruit>);
Run Code Online (Sandbox Code Playgroud)
你期望它输出true,对吗?好吧,你错了 - 至少我的编译器是这样的:
false
Run Code Online (Sandbox Code Playgroud)
这很奇怪,但也许它正在执行隐式转换,类似于将inta …
c# ×5
angular ×3
angularjs ×1
asp.net ×1
asp.net-mvc ×1
autofac ×1
casting ×1
covariance ×1
generics ×1
interface ×1
java ×1
maven ×1
reflection ×1
resize ×1
window ×1