我有以下html,
http://jsfiddle.net/2bWfL/168/
<head>
<title>My Page</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.0/jquery.mobile-1.3.0.min.css" />
<script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.3.0/jquery.mobile-1.3.0.min.js"></script>
</head>
<body>
<div data-role="page">
<div data-role="header">
<h1>My Title</h1>
</div><!-- /header -->
<div data-role="content">
<ul data-role="listview">
<li>
<a href="#">
<img width="80" height"80" src="http://www.gravatar.com/avatar/7efa2e4098f60c15d230436ca99d7250?s=32&d=identicon&r=PG" />
<h3>New Latest One</h3>
<p>$12,000</p>
<input type="text" style="width:75px"/>
</a>
</li>
</ul>
</div><!-- /content -->
</div><!-- /page -->
<style>
.ui-input-text{
width: 75px;
}
</style>
</body>
Run Code Online (Sandbox Code Playgroud)
但是图像不是垂直居中的.如何让它成为中心?
我正在使用window.devicePixelRatio,它可以在Andriod和Iphone上运行,但在IE 10 Windows Mobile中不起作用.任何替代?
我有以下Split功能,
ALTER FUNCTION [dbo].[Split](@String varchar(8000), @Delimiter char(1))
returns @temptable TABLE (items varchar(8000))
as
begin
set @String = RTRIM(LTRIM(@String))
declare @idx int
declare @slice varchar(8000)
select @idx = 1
if len(@String)<1 or @String is null return
while @idx!= 0
begin
set @idx = charindex(@Delimiter,@String)
if @idx!=0
set @slice = left(@String,@idx - 1)
else
set @slice = @String
if(len(@slice)>0)
insert into @temptable(Items) values(@slice)
set @String = right(@String,len(@String) - @idx)
if len(@String) = 0 break
end
return
end
Run Code Online (Sandbox Code Playgroud)
我写的时候
SELECT Items …Run Code Online (Sandbox Code Playgroud) 我正在使用RazorEngine.我有一些动态模板,我将在运行时与视图模型绑定.我的要求是在沙箱中运行代码.因此,只允许绑定.RazorEngine允许我在任意app-domain中运行代码,
using (var service = new IsolatedTemplateService(() => appDomain))
{
return service.Parse(newTemplate, model, null, null);
}
Run Code Online (Sandbox Code Playgroud)
如果我使用以下权限运行app-domain,那么它可以工作,
var permissionSet = new PermissionSet(PermissionState.Unrestricted);
Run Code Online (Sandbox Code Playgroud)
但如果我使用这些权限运行它,
var permissionSet = new PermissionSet(PermissionState.None);
permissionSet.AddPermission(new SecurityPermission(PermissionState.Unrestricted));
permissionSet.AddPermission(new ReflectionPermission(PermissionState.Unrestricted));
Run Code Online (Sandbox Code Playgroud)
我会得到,
[SecurityException: Request failed.]
System.AppDomain.CreateInstance(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +0
RazorEngine.Templating.IsolatedTemplateService..ctor(Language language, Encoding encoding, IAppDomainFactory appDomainFactory) +408
RazorEngine.Templating.IsolatedTemplateService..ctor(Language language, Encoding encoding, Func`1 appDomainFactory) +73
RazorEngine.Templating.IsolatedTemplateService..ctor(Func`1 appDomainFactory) +41
Run Code Online (Sandbox Code Playgroud)
我需要授予特殊许可吗?
我的后台进程是批量更新/插入数据.我需要在临时表中存储一些数据供以后使用.我有5个临时表.如果我使用临时表(CREATE TABLE #T),则需要2-3秒,但如果我使用表变量(DECLARE @T TABLE)则需要超过90秒.这是一个示例临时表,
CREATE TABLE #TempAttributes
(
AID int
,PID int
,ATypeValue nvarchar(MAX)
,ATypeKey nvarchar(MAX)
,PLanguageID int
);
Run Code Online (Sandbox Code Playgroud)
为什么表变量很慢?
我有5到6个项目.项目A和B通过链接文件使用相同的文件.现在,如果我在Razor中使用这个类,我会得到的,
The call is ambiguous between the following methods or properties:
Run Code Online (Sandbox Code Playgroud)
因为Razor视图引用了bin中的所有dll.它引用了项目A和B中的同一个类.如何在编译期间告诉Razor使用项目A而不是项目B?
我有以下方法,
public Task SaveFileContentsAsync(string filePath, Stream stream)
{
using (var fileStream = new FileStream(filePath, FileMode.Create))
{
return stream.CopyToAsync(fileStream);
}
}
Run Code Online (Sandbox Code Playgroud)
此方法只是将流保存到磁盘中.我跟这个方法打电话的时候HttpPostedFileBase.InputStream,
Exception Details: System.ObjectDisposedException: Cannot access a closed file.
[ObjectDisposedException: Cannot access a closed file.]
System.IO.__Error.FileNotOpen() +57
System.IO.FileStream.Write(Byte[] array, Int32 offset, Int32 count) +10549618
System.IO.Stream.<BeginWriteInternal>b__11(Object param0) +59
System.Threading.Tasks.Task`1.InnerInvoke() +3132781
System.Threading.Tasks.Task.Execute() +45
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +93
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +52
System.IO.Stream.EndWrite(IAsyncResult asyncResult) +85
System.IO.FileStream.EndWrite(IAsyncResult asyncResult) +24
System.IO.Stream.<BeginEndWriteAsync>b__17(Stream stream, IAsyncResult asyncResult) +24
System.Threading.Tasks.FromAsyncTrimPromise`1.Complete(TInstance thisRef, Func`3 endMethod, IAsyncResult asyncResult, Boolean requiresSynchronization) +44
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task …Run Code Online (Sandbox Code Playgroud) 我有以下C#方法来获取当前的unix纪元时间戳,
public static long GetCurrentUnixTimestampSeconds()
{
var unixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
return (long)(DateTime.UtcNow - unixEpoch).TotalSeconds;
}
Run Code Online (Sandbox Code Playgroud)
我在SQL Server中需要相同的东西.可能吗?
我的elmah日志显示此错误.每次请求都不会发生这种情况.它间歇性地发生.MVC 5.2,Web API 2.2,ASP.NET Identity 2和Azure网站是我的环境.更新:这是我的Startup.cs,
OAuthOptions = new OAuthAuthorizationServerOptions()
{
AllowInsecureHttp = true,
TokenEndpointPath = new PathString("/token"),
AccessTokenExpireTimeSpan = TimeSpan.FromMinutes(settings.AccessTokenExpireTimeSpanInMinutes),
Provider = new MyAuthorizationServerProvider(),
RefreshTokenProvider = new MyRefreshTokenProvider()
};
// Web API configuration and services
// Configure Web API to use only bearer token authentication.
GlobalConfiguration.Configuration.SuppressDefaultHostAuthentication();
GlobalConfiguration.Configuration.Filters.Add(new HostAuthenticationFilter(OAuthOptions.AuthenticationType));
app.UseOAuthAuthorizationServer(OAuthOptions);
app.UseOAuthBearerAuthentication(OAuthBearerOptions);
GlobalConfiguration.Configuration.SuppressDefaultHostAuthentication();
GlobalConfiguration.Configuration.Filters.Add(new HostAuthenticationFilter(OAuthOptions.AuthenticationType));
Run Code Online (Sandbox Code Playgroud)
检查此否OWIN身份验证管理器与请求关联但无法正常工作
System.InvalidOperationException: No OWIN authentication manager is associated with the request.
at System.Web.Http.HostAuthenticationFilter.GetAuthenticationManagerOrThrow(HttpRequestMessage request)
at System.Web.Http.HostAuthenticationFilter.<AuthenticateAsync>d__0.MoveNext()
--- End of stack trace from previous location …Run Code Online (Sandbox Code Playgroud) 正如https://www.visualstudio.com/en-us/docs/tfvc/share-your-code-in-tfvc-xcode所建议的那样,我使用git-tf将现有代码放到TFVC中.但我的道路很深.在办理登机手续时,我得到了,
git-tf: TF205022: The following path contains more than the allowed 259 characters:
/Users/VeryLongPath
Run Code Online (Sandbox Code Playgroud) asp.net-mvc ×3
c# ×3
sql ×3
sql-server ×2
.net ×1
asp.net ×1
async-await ×1
azure ×1
c#-4.0 ×1
c#-5.0 ×1
css3 ×1
html5 ×1
javascript ×1
jquery ×1
listview ×1
owin ×1
razor ×1
razorengine ×1
t-sql ×1
tfs ×1
tfvc ×1
xcode ×1