问题:我正在尝试重构此算法以使其更快.什么是速度的第一次重构?
public int GetHowManyFactors(int numberToCheck)
{
// we know 1 is a factor and the numberToCheck
int factorCount = 2;
// start from 2 as we know 1 is a factor, and less than as numberToCheck is a factor
for (int i = 2; i < numberToCheck; i++)
{
if (numberToCheck % i == 0)
factorCount++;
}
return factorCount;
}
Run Code Online (Sandbox Code Playgroud) 我将Git呈现给目前使用Visual Source Safe的10人编程团队.
他们需要在公司内部托管他们的Git服务器.Windows或Linux.目录身份验证是Novell eDirectory.
他们需要一些关于谁可以推送到中央服务器的细粒度安全性.
从:
也许工作流程可能是:
问题:是否有人在公司中成功使用此类工作流程.什么有用?这开始感觉大多数人都使用Git和GitHub等.
[编辑]:请参阅选择源控制系统:VSS之后的逻辑后续步骤 也许Git不适合该团队.
我有一个带有简单web.config的子目录
<configuration>
<system.web>
<!--<authorization>
<allow roles="admin"/>
<deny users="*"/>
</authorization>-->
</system.web>
</configuration>
Run Code Online (Sandbox Code Playgroud)
我喜欢在开发过程中关闭安全性.我喜欢快速部署 - Alt-BH
问题: 我可以使用我的主web.release.config取消评论吗?
使用http://docs.orchardproject.net/Documentation/Deploying-Orchard-to-Windows-Azure我已成功将Orchard部署到Azure中.
每20分钟左右没有活动(app pool recycle?),渲染页面需要几分钟.我在Azure中运行Extra Small实例.Web实例,存储和SQL数据库都在同一个数据中心 - 东南亚.
有一个名为keepalive的模块,它执行常规ping操作.
或http://blog.smarx.com/posts/controlling-application-pool-idle-timeouts-in-windows-azure
同时关闭Debug(!)并完全信任,如此处所述http://docs.orchardproject.net/Documentation/Optimizing-Performance-of-Orchard-with-Shared-Hosting
将尝试设置/预热页面..
ping似乎很重 - 我错过了什么吗?
我使用受信任或SQL登录在下面的代码中得到相同的错误:
VS2010,控制台应用程序.NET4,Win XP.SQL2005完整版.
转移炸弹.TransferData
错误:errorCode = -1073548784 description =执行查询""失败,并显示以下错误:"由于以下错误,检索具有CLSID {19E353EF-DAF4-45D8-9A04-FB7F7798DCA7}的组件的COM类工厂失败:80040154" .可能的故障原因:查询问题,"ResultSet"属性设置不正确,参数设置不正确或连接未正确建立.
这感觉就像安全.任何想法都会很棒!
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SqlServer.Management.Smo;
using Microsoft.SqlServer.Management.Common;
using System.Collections.Specialized;
using System.IO;
using System.Configuration;
namespace GenerateScripts
{
class Program
{
static void Main(string[] args)
{
ServerConnection sourceConnection = new ServerConnection("localhost");
Server sourceServer = new Server(sourceConnection);
//sourceServer.ConnectionContext.LoginSecure = false;
//sourceServer.ConnectionContext.Login = "3tier";
//sourceServer.ConnectionContext.Password = "3tier";
Database sourceDatabase = sourceServer.Databases["3tier"];
// destination
ServerConnection destinationConnection = new ServerConnection("localhost");
Server destinationServer = new Server(destinationConnection);
//destinationServer.ConnectionContext.LoginSecure = false;
//destinationServer.ConnectionContext.Login …Run Code Online (Sandbox Code Playgroud) IEnumerable是否必须使用Yield来延迟?
这是测试代码,它帮助我理解延迟执行和收益.
//immediate execution
public IEnumerable Power(int number, int howManyToShow)
{
var result = new int[howManyToShow];
result[0] = number;
for (int i = 1; i < howManyToShow; i++)
result[i] = result[i - 1] * number;
return result;
}
//deferred but eager
public IEnumerable PowerYieldEager(int number, int howManyToShow)
{
var result = new int[howManyToShow];
result[0] = number;
for (int i = 1; i < howManyToShow; i++)
result[i] = result[i - 1] * number;
foreach (var value in result)
yield return value; …Run Code Online (Sandbox Code Playgroud) 在VS2012.3 .NET4.5和R#中使用MSTEST作为测试运行器.
下面的代码按1,2,3,4的顺序工作.
但是我担心它可能不会总是按此顺序执行,因为MSDNTestInitialize不支持多个属性
问题:是否允许这样做,并且文档是否意味着TestInitialize同一个类中不允许多个属性?
我想保留这个结构,因为许多集成测试继承了TransactedTestBase,但需要设置不同的SQL脚本.
[TestClass]
public class DelegationTest : TransactedTestBase
{
[TestInitialize]
public void Setup()
{
Console.WriteLine("2 Setup");
//var script = "INSERT INTO blah...";
//var sqlConnect = new SqlConnection(dbConnection.ConnectionString);
//sqlConnect.Open();
//var server = new Server(sqlConnect);
//var database = server.Databases[sqlConnect.Database];
//database.ExecuteNonQuery(script);
}
[TestMethod]
public void TestMethod1()
{
Console.WriteLine("3 Test Method");
}
}
[TestClass]
public class TransactedTestBase
{
//protected userEntities userEntities;
//private TransactionScope scope;
//public static SqlDatabase dbConnection;
//private const …Run Code Online (Sandbox Code Playgroud) 我真的想创建一个视图.
我知道你不能在MSSQL2005视图中使用临时表.没有重写sql,有什么明显的我错过了吗?
备份计划是使用存储过程.
干杯
select * into #temp from vwIncidents
SELECT vwIncidents.incidentcode, employeecode, EMPOS.POS_L4_CDA as areaAtTimeOfIncident
into #temp1
FROM vwIncidents
INNER JOIN EMPOS ON vwIncidents.employeecode = EMPOS.DET_NUMBERA
WHERE EMPOS.POS_STARTC < vwIncidents.incidentdate
AND (EMPOS.POS_ENDD > vwIncidents.incidentdate OR EMPOS.POS_ENDD IS NULL)
order by incidentcode
select #temp.*, #temp1.areaAtTimeOfIncident from #temp
left outer join #temp1 on #temp.incidentcode = #temp1.incidentcode
and #temp.employeecode = #temp1.employeecode
order by incidentcode
Run Code Online (Sandbox Code Playgroud) 我想与我的控制台应用程序共享我的VS2010 3.5 Web应用程序设置(同一解决方案中的2个项目).
例如连接字符串,smtp,log4net设置
这看起来很接近:
dynamic model = new ExpandoObject();
model.Data = "asdf";
List<dynamic> listOfx = new List<dynamic>();
for (int i = 0; i < 3; i++) {
dynamic x = new ExpandoObject();
x.ID = i;
x.Name = "test" + i.ToString();
listOfx.Add(x);
}
model.listOfx = listOfx;
Run Code Online (Sandbox Code Playgroud)
当我运行它时,我可以在模型内部看到数据,但不能看到listOfx.
问题:如何在ExpandoObject中获取列表(或IEnumerable)
更新解决方案:

因为我无法在本地窗口看到lifOfx,所以我觉得它不起作用.在这里(通过y)你可以看到它.:-)
c# ×5
.net ×1
.net-4.0 ×1
asp.net ×1
azure ×1
factors ×1
git ×1
math ×1
mstest ×1
orchardcms ×1
performance ×1
sql ×1
sql-server ×1
ssms ×1
unit-testing ×1