我开发了一个1280 X 1024像素的winform应用程序.....当使用相同的屏幕分辨率时,它显示...但我将屏幕分辨率更改为800 X 600像素,它显示屏幕,屏幕上有关闭按钮.如何解决这个问题...基本上使用特定的屏幕分辨率构建应用程序是否有任何限制.
提前致谢....
我是objective-c中的mapkit新手.我可以在mapview中添加自定义注释.
我需要放置自定义标注视图,如下图所示
.
但我没有得到如何设计这样的标注视图.
我知道我需要在视图中为注释方法添加callout.
- (MKAnnotationView *)mapView:(MKMapView *)map viewForAnnotation:(id <MKAnnotation>)annotation
{
static NSString *AnnotationViewID = @"annotationViewID";
MKAnnotationView *annotationView = (MKAnnotationView *)[mapview dequeueReusableAnnotationViewWithIdentifier:AnnotationViewID];
if (annotationView == nil)
{
annotationView = [[[MKAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:AnnotationViewID] autorelease];
}
annotationView.image = [UIImage imageNamed:@"blue_without_pin.png"];
annotationView.annotation = annotation;
return annotationView;
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试创建一个用于登录的Api控制器,应该在使用my CustomerController(Api)访问数据之前使用.
问题是当我尝试访问我的Login方法时遇到404错误AccountController.我正在尝试POST,AccountController如下面的截图所示.
有趣的是,CustomerController通过指向我的浏览器,我可以毫无问题地访问我的(Api)http://localhost:62655/api/customer/cvr/88888888.我是否错过了POST请求的约定或其他内容?
我的WebApi路由配置是:
public static class WebApiConfig
{
public static void Register(HttpConfiguration config)
{
config.MapHttpAttributeRoutes();
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{action}/{id}",
defaults: new { id = RouteParameter.Optional }
);
}
}
Run Code Online (Sandbox Code Playgroud)
并添加到我的Global.asax中:
WebApiConfig.Register(GlobalConfiguration.Configuration);
Run Code Online (Sandbox Code Playgroud)
我的AccountController和CustomerController看起来像这样(文件合并为了简洁):
public class AccountController : ApiController
{
public UserManager<ApplicationUser> UserManager { get; private set; }
private IAuthenticationManager AuthenticationManager
{
get
{
return HttpContext.Current.GetOwinContext().Authentication;
}
}
public AccountController(UserManager<ApplicationUser> userManager)
{
UserManager = userManager;
}
public async Task<HttpResponseMessage> …Run Code Online (Sandbox Code Playgroud) 我有一个受[Authorize]属性保护的控制器.
这非常好(如果我没有登录,我会被发回登录),但是我希望为这个属性添加一些角色,我已经读过它可能做的事情[Authorize(Roles = "Customer"],但当我这样做时,我立即发送回到我的应用程序的登录页面?
此Roles覆盖不适用于新的ASP.NET标识吗?在我的用户创建中,我通过以下代码将用户添加到:
var user = new ApplicationUser {UserName = model.Username};
var result = UserManager.Create(user, model.Password);
if (result.Succeeded)
{
UserManager.AddToRole(user.Id, "Customer");
SignIn(user, false);
return RedirectToAction("Done");
}
Run Code Online (Sandbox Code Playgroud)
并且根据数据库,用户处于此角色.为什么这不起作用?我错过了配置还是某种?
Serilog允许创建一个上下文感知记录器:
Log.ForContext<T>()
我想用SimpleInjector注册Serilog,这T是消费者的类型,即它注入的是哪个类.
例如
public class Car
{
public Car(ILogger logger) <= would be injected using Log.ForContext<Car>()
{
}
}
Run Code Online (Sandbox Code Playgroud)
我可以看到这已经完成了AutoFac.
通过SimpleInjector文档,有一个非常有希望的重载RegisterConditional()(使用Func<TypeFactoryContext, Type>参数).
c.RegisterConditional(typeof (ILogger),
x => Log.ForContext(x.Consumer.ImplementationType), <= won't compile as expecting a Type
Lifestyle.Scoped,
x => true);
Run Code Online (Sandbox Code Playgroud)
但是,我不想告诉SimpleInjector 要构建哪个 Type,而是如何构建一个.
作为Flash的初学者,我的任务是创建一个应该从0%到98%的假进度条.
现在,我有一个进度线,它上面有一个完整的白色补间,从左到右表示虚假下载.见图.

当补间运行时,我希望增加百分比,使其匹配并停止98% - 是否可以这样做?如何?
我的文档在AS3中,但还没有动作脚本,所以现在没关系.我主要做时间表.
谢谢!
我正在寻找一个java库,它可以CSS使用HTML基于其ID /类属性的文档内联外部文件.
我找到了jStyleParser,但我不确定这是否适合我.我似乎无法理解它是否可以完成CSS从HTML 中内联元素的工作.文档和示例不是我所期望的.
是否有人可以回答这个问题,或者是否存在另一个图书馆?
谢谢
为什么java.util.Iterator界面有方法remove()?
当然,有时候这种方法是必要的,所有人都习惯了它的存在.但实际上迭代器的主要和唯一目的只是提供访问容器元素.当有人想为这个界面创建自己的实现,并且不能或不想以任何理由提供删除元素的能力时,他就被迫抛出UnsupportedOperationException.扔掉那个异常通常表明一个没有深思熟虑的架构或设计中的一些缺陷.
我真的不明白这样决定的原因.我想这将更正确地分离特定的子接口以支持可选方法:
任何合理的版本为什么remove()是一部分Iterator?这个直接违反单一责任原则的例子不是SOLID吗?
我有一个方法的查询:
private readonly IEntityReader<Customer> _reader;
public async Task<IEnumerable<Customer>> HandleAsync(GetCustomer query)
{
var result = _reader.Query()
.Include(customer => customer.Organization)
.Where(customer => customer.Name == query.Name);
return await result.ToListAsync();
}
Run Code Online (Sandbox Code Playgroud)
哪个具有此单元测试:
[Fact]
public async Task HandleGetCustomer_ReturnsCustomer_WhenNameMatches()
{
// Arrange
var customers = new List<Customer>()
{
new Customer
{
Id = new Guid("d4e749ba-6874-40f4-9134-6c9cc1bc95fe"),
Name = "John Doe",
Age = 18,
Organization = new Organization
{
Id = new Guid("b2ba06c9-5c00-4634-b6f7-80167ea8c3f1"),
Name = "TheCompany",
Number = 42
}
},
new Customer
{
Id = new Guid("0679ceb5-3d4f-41f3-a1b0-b167e1ac6d7e"), …Run Code Online (Sandbox Code Playgroud) 我有一个6块的网格.当点击每个块时,块膨胀并覆盖容纳块的容器.
第一个框(左上角)看起来不错,但是其他框架没有错觉这个块长到容器的宽度和高度,因为它从它们的左上角位置开始.
理想情况下,盒子2和5应该从它们的中心扩展,盒子1,3,4和6应该从它们的远角扩展.这可能吗?怎么样?
我创建了一个显示我的问题的JSFiddle.但是重现的代码在这里:
JQuery的
$(".service-block").on("click", "a", function (e) {
e.preventDefault();
var block = $(this);
var blockOffset = block.offset();
var blockBackgroundColor = block.css("backgroundColor");
var container = $(".service-grid");
var containerOffset = container.offset();
// Create the popup and append it to the container
var popout = $("<div class='service-block-popup'>Test</div>");
popout.css({
"backgroundColor": blockBackgroundColor,
"position": "absolute",
"top": blockOffset.top,
"left": blockOffset.left
}).appendTo(container)
// Now animate the properties
.animate({
"height": container.height() + "px",
"width": container.width() + "px",
"top": containerOffset.top,
"left": containerOffset.left
}, 1500, …Run Code Online (Sandbox Code Playgroud) c# ×5
asp.net-mvc ×2
css ×2
html ×2
java ×2
.net ×1
flash ×1
iphone ×1
iterator ×1
jquery ×1
jstyleparser ×1
mkmapview ×1
moq ×1
objective-c ×1
oop ×1
parsing ×1
progress-bar ×1
serilog ×1
unit-testing ×1
winforms ×1