我怀疑在发布此帖后我会感到非常愚蠢,但这里有.我有两个主要问题:
1)什么是适用于注册ID的正则表达式?目前我有以下内容,但我无法找到任何文档来支持这是否足够:
'/^[a-z0-9_-]{40,255}$/i'
Run Code Online (Sandbox Code Playgroud)
2)regID包含" - "是否"有效"?我知道android不能担心每种语言 - 在这种情况下是mysql - 用于评论等等,但这让我措手不及.到目前为止,我总是在我的消毒剂中标记出来,因为有可能被用于sql注入.
我只是在两个服务器之间创建一个简单的测试.基本上,如果用户已经过身份验证,我希望能够在应用程序之间传递它们.我改变了键来隐藏它们
我有三个问题:
successpage.aspx
我应该检查什么时?web.config
设置是否正确?我的代码:
if (authenticated == true)
{
//FormsAuthentication.SetAuthCookie(userName, false);
bool IsPersistent = true;
DateTime expirationDate = new DateTime();
if (IsPersistent)
expirationDate = DateTime.Now.AddYears(1);
else
expirationDate = DateTime.Now.AddMinutes(300);
FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(
1,
userAuthName,
DateTime.Now,
expirationDate,
IsPersistent,
userAuthName,
FormsAuthentication.FormsCookiePath);
string eth = FormsAuthentication.Encrypt(ticket);
HttpCookie cookie = new HttpCookie(FormsAuthentication.FormsCookieName, eth);
if (IsPersistent)
cookie.Expires = ticket.Expiration;
cookie.Domain = ".myDomain.com";
Response.SetCookie(cookie);
Response.Cookies.Add(cookie);
Response.Redirect("successpage.aspx");
}
Run Code Online (Sandbox Code Playgroud)
我的配置:
<authentication mode="Forms">
<forms loginUrl="~/Default.aspx" timeout="2880" name=".AUTHCOOKIE" domain="myDomain.com" cookieless="UseCookies" enableCrossAppRedirects="true"/>
</authentication> …
Run Code Online (Sandbox Code Playgroud) 使用httpCompression我重新认识到IIS将MVC中的静态文件理解为动态内容,因此即使勾选" 启用静态内容压缩 ",但不勾选" 启用动态内容压缩 ",IIS也会返回没有压缩的文件.css
和.js
文件:
GET /MVCX/Content/Site.css HTTP/1.1
Host: localhost
Connection: keep-alive
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.121 Safari/535.2
Accept: text/css,*/*;
Referer: http://localhost/mvcx/
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-GB,en-US;q=0.8,en;q=0.6
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
HTTP/1.1 200 OK
Content-Type: text/css
Last-Modified: Mon, 05 Dec 2011 12:42:37 GMT
Accept-Ranges: bytes
ETag: "c79895e4bb3cc1:0"
Server: Microsoft-IIS/7.5
X-Powered-By: ASP.NET
Date: Mon, 05 Dec 2011 12:44:43 GMT
Content-Length: 1005
Run Code Online (Sandbox Code Playgroud)
但是,如果我勾选" 启用动态内容压缩 ",文件将被压缩:
GET /MVCX/Content/Site.css HTTP/1.1
Host: localhost
Connection: keep-alive
User-Agent: Mozilla/5.0 (Windows …
Run Code Online (Sandbox Code Playgroud) 我正在尝试编写这个简单的测试:
var fixture = new Fixture().Customize(new AutoMoqCustomization());
var postProcessingAction = fixture.Freeze<Mock<IPostProcessingAction>>();
var postProcessor = fixture.Freeze<PostProcessor>();
postProcessor.Process("", "");
postProcessingAction.Verify(action => action.Do());
Run Code Online (Sandbox Code Playgroud)
该Verify
检查失败.
postProcessor.Process的代码是
public void Process(string resultFilePath, string jobId)
{
IPostProcessingAction postProcessingAction =
postProcessingActionReader
.CreatePostProcessingActionFromJobResultXml(resultFilePath);
postProcessingAction.Do();
}
Run Code Online (Sandbox Code Playgroud)
postProcessingActionReader
是通过构造函数初始化的接口字段.
我期待测试通过,但它失败,事实证明IPostProessingAction
从CreatePostProcessingActionFromJobResultXml
方法返回的实例与返回的实例不同fixture.Freeze<>
.
我的期望是,在冻结这个Mock对象后,它会IPostProcessingAction
在所需的每个地方注入接口的底层模拟,并使所有模拟方法返回IPostProcessingAction
返回同一个对象.
我对mock方法的返回值的期望不正确吗?有没有办法改变这种行为,以便模拟方法返回相同的冻结实例?
我们在当天的第一次报告请求中遇到启动时间较慢,或者在未知的时间段内没有报告请求.在SQL Reporting Server 2005安装中,我们将设置应用程序池以避免回收Reporting Services应用程序.
但是,我的客户端在Windows Server 2008上以纯模式安装了SQL Reporting Server 2008.我找不到IIS安装.我已经检查了SQL Reporting Service配置设置,帮助文件和论坛,并且没有在Native安装上找到此问题的解决方案.
如何以纯模式安装时,如何控制Reporting Services应用程序的回收?
我想知道是否有人明确知道LINQ to SQL是否具有生成包含该ISNULL
函数的TSQL代码的能力?
我知道??
在查询中使用coalesce operator():
from o in Table
where (o.Field ?? 0) > 0
select o
Run Code Online (Sandbox Code Playgroud)
将导致LINQ to SQL发出COALESCE
函数:
SELECT [t0].[Field]
FROM [Table] AS [t0]
WHERE (COALESCE([t0].[Field],0)) > 0
Run Code Online (Sandbox Code Playgroud)
并且,?:
在查询中使用条件运算符():
from o in Table
where (o.Field == null ? 0 : o.Field) > 0
select o
Run Code Online (Sandbox Code Playgroud)
将导致TSQL包含一个CASE
语句:
SELECT [t0].[Field]
FROM [Table] AS [t0]
WHERE (
(CASE
WHEN [t0].[Field] IS NULL THEN 0
ELSE [t0].[Amount]
END)) > 0
Run Code Online (Sandbox Code Playgroud)
但是,可以强制LINQ to …
一些背景:我在SSMS 2012中遇到了这个内存异常,因为它与Red Gate的SQLPrompt一起发布(这个例外在同一台笔记本电脑上的SSMS 2008R2中从未发生).
我最初每天都遇到这些异常(SSMS2012和SQLPrompt),这迫使我关闭并重新打开SSMS(以及我正在处理的所有事情).几个月前,我偶然发现了一个支持线程,指出可能的附加组件是原因所以我卸载了我唯一的附加组件(SQL Prompt,但没有卸载开发人员的其他软件包)并且花了很多个月没有一个例外减去System.OutOfMemoryException异常.
一旦SP1在2012年发布,我就应用它并重新安装SQL Prompt(最新版本),看看问题是否已经解决,并且在开发时间的7小时内,我再次受到了臭名昭着的System.OutOfMemoryException的欢迎.
通过所有这些,我一直在打开Red Gate的门票,并在他们看到异常时提交调试日志,但由于内存异常没有明确列出SQLPrompt,他们不会将问题上报给开发团队.在此特定异常之前,SQL Prompt在SSMS 2012 IDE(Visual Studio 2010)中抛出了许多异常(下面列出了一些异常).我相信内存异常是SQL Prompt如何管理缓存数据并占用SSMS可用内存的问题的症状,最终会导致异常.
我已经学会了如何推迟这个问题以及如何重现它,它与两个变量直接相关:
我连接到越快的异常的实例越多,这导致SQL Prompt缓存每个实例的所有对象信息.一旦引发内存异常,情况就会降低,直到SSMS完全崩溃(除非我先关闭它).
我所追求的是如何收集更多/更好的信息,以提交给红门以纠正这个问题.这是我需要你帮助的地方.
笔记本电脑:HP Elite书籍8440 RAM:6GB
当前操作系统:Win 7 Enterprise Ed Sp1
以下是SQL Prompt引起的一些异常:
System.ArgumentOutOfRangeException "Specified argument was out of the range of valid values."
Microsoft.VisualStudio.Text.Implementation.BinaryStringRebuilder.GetLineNumberFromPosition(N/A,N/A)
Microsoft.VisualStudio.Text.Implementation.TextSnapshot.GetLineFromPosition(Microsoft.VisualStudio.Text.Implementation.TextSnapshot,N/A)
Microsoft.VisualStudio.Editor.Implementation.VsTextBufferAdapter.GetLineIndexOfPosition(N/A,System.Int32,System.Int32&,System.Int32&)
RedGate.SQLPrompt.CommonVS.Editor.VSScriptProvider.PositionFromIndex(RedGate.SQLPrompt.CommonVS.Editor.VSScriptProvider,System.Int32)
RedGate.SqlPrompt.Metadata.Script.ScriptProviderBase.GetText(RedGate.SQLPrompt.CommonVS.Editor.VSScriptProvider,System.Int32,System.Int32)
RedGate.SqlPrompt.Engine.NewEngine.SqlPromptEngine.GetCandidates(RedGate.SqlPrompt.Engine.NewEngine.SqlPromptEngine,System.Int32)
RedGate.SqlPrompt.Engine.PromptEngineEmulator.get_GetSuggestions(RedGate.SqlPrompt.Engine.PromptEngineEmulator)
RedGate.SqlPrompt.Engine.AutoCompleter.m_FilterChanged(RedGate.SqlPrompt.Engine.AutoCompleter,RedGate.SqlPrompt.Engine.PromptEngineEmulator,System.EventArgs)
RedGate.SqlPrompt.Engine.PromptEngineEmulator.OnFilterChanged(RedGate.SqlPrompt.Engine.PromptEngineEmulator)
RedGate.SqlPrompt.Engine.PromptEngineEmulator.set_Index(RedGate.SqlPrompt.Engine.PromptEngineEmulator,System.Int32)
RedGate.SqlPrompt.Engine.PromptEngineEmulator.set_CaretPosition(RedGate.SqlPrompt.Engine.PromptEngineEmulator,N/A)
RedGate.SQLPrompt.CommonUI.Editor.EditorWindowBase.SetEngineCaretPosition(RedGate.SQLPrompt.SSMSUI.SSMSEditorWindow,N/A)
RedGate.SQLPrompt.CommonUI.Editor.EditorWindowBase.UpdateUIPrompts(RedGate.SQLPrompt.SSMSUI.SSMSEditorWindow)
RedGate.SQLPrompt.CommonVS.Editor.VSEditorWindow.OnTextViewCommandExec(RedGate.SQLPrompt.SSMSUI.SSMSEditorWindow,RedGate.SQLPrompt.CommonVS.Editor.TextViewMonitor,RedGate.SQLPrompt.CommonVS.Editor.CommandExecEventArgs)
RedGate.SQLPrompt.CommonVS.Editor.TextViewMonitor.AfterCommandExecute(RedGate.SQLPrompt.CommonVS.Editor.TextViewMonitor,RedGate.SQLPrompt.CommonVS.Editor.CommandExecEventArgs)
RedGate.SQLPrompt.CommonVS.Editor.TextViewMonitor..(RedGate.SQLPrompt.CommonVS.Editor.TextViewMonitor.)
RedGate.SQLPrompt.CommonUI.Utils.ErrorDialog.Do(System.Action)
RedGate.SQLPrompt.CommonVS.Editor.TextViewMonitor.(RedGate.SQLPrompt.CommonVS.Editor.TextViewMonitor,System.Guid&,System.Uint32,System.Uint32,System.IntPtr,System.IntPtr)
RedGate.SQLPrompt.CommonVS.Editor.TextViewMonitor..(RedGate.SQLPrompt.CommonVS.Editor.TextViewMonitor.,System.Guid&,System.Uint32,System.Uint32,System.IntPtr,System.IntPtr)
Microsoft.VisualStudio.Editor.Implementation.CommandChainNode.Exec(N/A,N/A,N/A,N/A,N/A,N/A)
System.ArgumentException 00:05:14.7510000 "The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))"
#mMc.#JQub.#OQub(#mMc.#JQub,N/A,System.Uint32,#mMc.#k3ub&)
#mMc.#JQub.#z26.#8Di(#mMc.#JQub.#z26) …
Run Code Online (Sandbox Code Playgroud) 背景:
我试图使用nHibernate时遇到映射失败.该应用程序由几个程序集组成.其中一个程序集是一个有用的例程库,另一个是使用该库的应用程序代码.库程序集将自身添加到nHibernate配置中,但由于它不了解其他程序集,因此不会添加它们.我的xml映射文件位于应用程序程序集中.我认为它没有找到它,因为它没有查看应用程序集.
问题: 您是否可以映射到任意程序集中的类而不将其添加到配置中?
如果没有,您可以在运行时添加映射吗?
谢谢
ps我确实确保映射文件被标记为嵌入式资源
更新 - 2009年4月3日
我更改了底层库以允许在初始化时添加程序集.这似乎很有效.
这会加载Twitter Feed并显示最后一条推文.
有没有办法在这个函数中包含和检索所有转推?
$(document).ready(function() {
var url = "http://twitter.com/status/user_timeline/mytwittername.json?count=3&callback=?";
var lastClass = "";
$.getJSON(url,
function(data){
$.each(data, function(i, item) {
// check for last tweet
if (i == (data.length - 1)) {
lastClass = "class='last'"
}
$("#twitter-content ul").append("<li " + lastClass + ">" + item.text.linkify().atify() + " <span class='created_at'>[" + relative_time(item.created_at) + " via " + item.source + "]</span></li>");
});
});
$("#sidebar ul li:last-child").addClass("last");
});
Run Code Online (Sandbox Code Playgroud) 我正在关注如何在.NET中创建Provider框架的这篇伟大文章
基本上,本文大致解释了如何最终得到如下配置文件:
<configuration>
<configSections>
<section name="data" type="DataProviderConfigurationSection" />
</configSections>
<data defaultProvider="MyDataProvider">
<providers>
<add name="MydataProvider" type="MyDataProvider" />
</providers>
</data>
</configuration>
Run Code Online (Sandbox Code Playgroud)
凡<add/>
元素允许你定义一个供应商.
但是,我想知道如何add
使用自定义属性扩展条目.
例如:
<providers>
<add name="MydataProvider" type="MyDataProvider" myProperty="myValue" myProperty2="myValue2" ... />
</providers>
Run Code Online (Sandbox Code Playgroud)
任何帮助将不胜感激.
c# ×2
android ×1
android-c2dm ×1
asp.net ×1
asp.net-mvc ×1
autofixture ×1
cookies ×1
iis-7 ×1
iis-7.5 ×1
json ×1
linq-to-sql ×1
moq ×1
nhibernate ×1
php ×1
provider ×1
redgate ×1
regex ×1
sql ×1
ssms ×1
ssms-2012 ×1
ssrs-2008 ×1
twitter ×1