我已经厌倦了向我的队友解释使用DVCS而不是CVCS的好处.他们中的一些人害怕学习曲线,他们中的一些人认为没有理由,因为对他们来说:"这是同样的事情".就个人而言,我对TFS及其问题感到厌倦.每当我需要处理一些小的"修复"时,我必须在主开发分支上工作并将我的东西搁置进去,导致与TFS分支,因此与Git相比非常痛苦.我每次从以太网切换到wifi时都必须重新连接我的VPN客户端,这种情况发生了很多.
所以我开始思考也许我可以在本地使用Git并在我的本地仓库中做任何我想做的事情,并且到时候将其推送到TFS.我知道这是可能的,但最好的方法是什么?我可以只git init使用当前的repo并将整个.git文件夹放入忽略的列表中,这样TFS就不会检查它或者只是这样做不够简单吗?
直到Visual Studio的官方更新,这将支持git和tfs,我必须使用一些hacks来做我想要的.
事实上,UserControl缺少Window中的属性'SizeToContent'.
所以问题是:
在UserControl上模拟SizeToContent = WidthAndHeight行为的最简单正确的方法是什么?
UPD ...是的,我知道如果在你放置用户控件的容器中没有定义高度和宽度,它会自动获得.
但是当你将一个定义大小的userControl放入另一个没有大小的userControl时,它就不起作用,并且它们总是进入容器内部.
在这种情况下,你的第二个控件将占用它可以获得的所有空间.
_data is a byte[] array of Attachment data.
When I'm doing this:
var ms = new MemoryStream(_data.Length);
ms.Write(_data,0,_data.Length);
mailMessage.Attachments.Add(new Attachment(ms, attachment.Name));
Run Code Online (Sandbox Code Playgroud)
Attachment comes empty. Actually outlook shows the filesize but it's incorrect.
Well, I thought there is a problem in my _data. Then I decided to try this approach:
var ms = new MemoryStream(_data.Length);
ms.Write(_data,0,_data.Length);
fs = new FileStream(@"c:\Temp\"+attachment.Name,FileMode.CreateNew);
fs.Write(ms.GetBuffer(), 0, ms.GetBuffer().Length);
fs.Flush();
fs.Close();
mailMessage.Attachments.Add(new Attachment(@"c:\Temp\" + attachment.Name));
Run Code Online (Sandbox Code Playgroud)
And that works. What's wrong with the first one?
好吧,我需要将DateTime.Now绑定到TextBlock,我使用了:
Text="{Binding Source={x:Static System:DateTime.Now},StringFormat='HH:mm:ss tt'}"
Run Code Online (Sandbox Code Playgroud)
现在,如何强制更新?它是控制加载的时间,不会更新它...
如果我有类似这样的类名的元素:
.ses_0 .ses_1 .ses_2 .ses_3
Run Code Online (Sandbox Code Playgroud)
如何选择所有元素并在其中添加一些片段?像这样的东西:
var sessions = $('*[class*=ses_]');
for (var i = 0; i < sessions.length; i++)
{
sessions [i].prepend("<img src='/Content/img/caticon"+i+".png' />");
}
Run Code Online (Sandbox Code Playgroud)
那当然不行.
编辑:啊......该死的似乎我不仅需要获得以.ses_开头的那些类,还要获得其中的 <a>元素.我怎样才能做到这一点?
基本上有效的东西$(".ses_0 a"),只需要让所有的课程以ses_开头
我很迷惑.如果我ng-app每页只能使用一次,我如何在不同的.js文件中使用位于不同模块中的指令.看:
<script src='mainModule.js'/>
<script src='secondModule.js'/>
<body ng-app='mainModule'>
<my-thingy/>
<div>
<other-thingy/>
</div>
</body>
mainModule.js:
angular.module("mainModule",[]).directive("myThingy",function(){ ... })
secondModule.js:
angular.module("secondModule",[]).directive("otherThingy",function(){ ... })
Run Code Online (Sandbox Code Playgroud)
那么,我现在如何指向页面上的secondModule,而不是从mainModule.js引用它
函数我正在监视,接收对象作为参数.我需要声明函数是使用对象的某些属性调用的.
例如:我的SUT有:
function kaboom() {
fn({
foo: 'foo',
bar: 'bar',
zap: function() { ... },
dap: true
});
}
Run Code Online (Sandbox Code Playgroud)
在我的测试中,我可以这样做:
fnStub = sinon.stub();
kaboom();
expect(fnStub).to.have.been.called;
Run Code Online (Sandbox Code Playgroud)
这是有效的(很高兴知道fn被称为).现在我需要确保已将正确的对象传递给函数.我只关心 foo和bar属性,即我必须为参数的特定属性设置匹配.怎么样?
upd:sinon.match()似乎适用于简单对象.我们提高吧,不是吗?
如果我想将zap函数包含在断言中怎么办?我该如何工作?
我有一个表单,并且启用了不显眼的验证.默认情况下,在提交方法中,客户端验证会被触发,并且(如果您有任何错误)表单如下所示:

甚至在将任何数据发送到服务器之前就会进行验证.
现在,如果要使用$ .ajax方法,则此行为不起作用.客户端验证不起作用.您必须手动检查javascript中的所有字段,失去DataAnnotations的所有优点.
有没有更好的解决方案?我可以使用jquery的submit(),但我猜它没有像$ .ajax这样的回调.
你们帮帮我吗?我找到了如何保存和检索简单对象以将其用作应用程序设置.
NSUserDefaults.StandardUserDefaults.SetString("testUser","username");
NSUserDefaults.StandardUserDefaults.Init(); //Although it's strange that you have to call this method to actually save your stuff
Run Code Online (Sandbox Code Playgroud)
然后你可以像这样检索它:
var username = NSUserDefaults.StandardUserDefaults.StringForKey("username");
Run Code Online (Sandbox Code Playgroud)
现在,如果我需要保存多个用户名(我想要多少)怎么办?如果我需要使用密码或密码保存多个用户名怎么办?
c# ×3
javascript ×2
jquery ×2
wpf ×2
angularjs ×1
binding ×1
email ×1
git ×1
ios ×1
monodevelop ×1
sinon ×1
sinon-chai ×1
tfs ×1
unit-testing ×1
validation ×1
vim ×1
xamarin.ios ×1