问题列表 - 第23167页

WPF - 设置相对于主窗口的对话窗口位置?

我只是创建自己的AboutBox,我使用Window.ShowDialog()调用它

如何让它相对于主窗口定位,即从顶部开始20px并居中.

谢谢.

wpf position window

20
推荐指数
1
解决办法
3万
查看次数

当TryXxxx方法返回false时,out参数的标准行为是什么?

假设具有以下签名的方法

bool TryXxxx(object something, out int toReturn)
Run Code Online (Sandbox Code Playgroud)

toReturn如果TryXxxx返回false,它可以接受什么?

在这种情况下,toReturn如果TryXxxx失败,它永远不应该被使用吗?

如果toReturn是一个nulable类型,那么返回null是有意义的.但是int不可空,我不想强​​迫它.

如果失败时toReturn总是某个值,那么TryXxxx我们就有可能认为2个值可以表示相同的位置.如果将'default'值作为有效响应TryXxxx返回(返回true时),我可以看到这可能导致混淆.

从实现点来看,如果看起来像toReturn[ny]值是最简单的,但有什么更重要的考虑吗?

c# standards exception conventions

5
推荐指数
1
解决办法
199
查看次数

什么是补丁?

这是我无法回答的面试问题之一......是否与网络发展有关?

  • 什么是补丁?

我的面试问题是

  • 你将如何开始新的补丁?

asp.net

1
推荐指数
1
解决办法
211
查看次数

如何在php中调用任何其他网站的网址

如何在php中调用任何其他网站的网址.

php

30
推荐指数
4
解决办法
14万
查看次数

跟踪不在MVC中的OnResultExecuted()中工作

我正在尝试从ASP.NET MVC应用程序输出到Trace.axd.我在OnActionExecuting(),OnActionExecuted(),OnResultExecuting()和OnResultExecuted()中都有跟踪,除了OnResultExecuted()之外,它们都输出到Trace.axd.

为了完整性,这里是我的代码(与OnActionX()完全相同):

    protected override void OnResultExecuting(ResultExecutingContext filterContext)
    {
        resultStartTime = DateTime.Now;
        filterContext.HttpContext.Trace.Warn("OnResultExecuting: " + actionStartTime);
        base.OnResultExecuting(filterContext);
    }

    protected override void OnResultExecuted(ResultExecutedContext filterContext)
    {
        DateTime resultEndTime = DateTime.Now;
        filterContext.HttpContext.Trace.Warn("OnResultExecuted: " + resultEndTime);
        filterContext.HttpContext.Trace.Warn("OnResultExecuted - OnResultExecuting: " + (resultEndTime - resultStartTime).TotalSeconds);
        base.OnResultExecuted(filterContext);
    }
Run Code Online (Sandbox Code Playgroud)

我正在使用ELMAH,但我已禁用它,我仍然遇到问题.

asp.net-mvc trace action-filter

0
推荐指数
1
解决办法
885
查看次数

如何在GWT模块中包含外部jar?

我想org.apache.commons.validator.GenericValidator在我的GWT Web应用程序的视图类中使用该类.我已经读过,我必须明确告诉我打算使用这个外部库.我想在我的App.gwt.xml工作中添加下一行.

<inherits name='org.apache.commons.validator.GenericValidator'/>

我收到下一个错误:

    Loading inherited module 'org.apache.commons.validator.GenericValidator'
       [ERROR] Unable to find 'org/apache/commons/validator/GenericValidator.gwt.xml' on your classpath; could be a typo, or maybe you forgot to include a classpath entry for source?
    [ERROR] Line 13: Unexpected exception while processing element 'inherits'
    com.google.gwt.core.ext.UnableToCompleteException: (see previous log entries)
at com.google.gwt.dev.cfg.ModuleDefLoader.nestedLoad(ModuleDefLoader.java:239)
    at com.google.gwt.dev.cfg.ModuleDefSchema$BodySchema.__inherits_begin(ModuleDefSchema.java:354)
    at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.google.gwt.dev.util.xml.HandlerMethod.invokeBegin(HandlerMethod.java:223)
    at com.google.gwt.dev.util.xml.ReflectiveParser$Impl.startElement(ReflectiveParser.java:270)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:501)
    at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:179)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1339)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2747)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:807)
    at …
Run Code Online (Sandbox Code Playgroud)

gwt

3
推荐指数
1
解决办法
6515
查看次数

Firefox条件评论CSS

我正试图定位一个按钮.我希望它在页面上的"GåVidere"按钮上方,它可以在Safari和Chrome中使用,但不适用于IE或FF.

#cartUpdate {
    position:absolute;
    width:160px;
    height:30px;
    left:580px;
    bottom:50px;
}
Run Code Online (Sandbox Code Playgroud)

    {capture assign="cartUpdate"}

        <div id="cartUpdate"><!--<input type="submit" class="submit" value="{tn _update}" />-->
        <button type="submit" class="submit" id="oppdatersubmit" name="saveFields" title="Oppdater" value="">&nbsp;</button> </div>
    {/capture}
    {assign var="cartUpdate" value=$cartUpdate|@str_split:10000}
    {php}$GLOBALS['cartUpdate'] = $this->get_template_vars('cartUpdate'); $this->assign_by_ref('GLOBALS', $GLOBALS);{/php}

    {form action="controller=order action=update" method="POST" enctype="multipart/form-data" handle=$form id="cartItems"}

CONTENT


{/form}
Run Code Online (Sandbox Code Playgroud)

可以在www.euroworker.no/order上看到(首先在篮子里放一些东西(Kjøp和Handlevogn)

编辑:刚刚注意到我的后端编辑器已停止更新.tpl文件..可能与它有关,根据FTP上的内容,几个小时没有更新.只有一件事......

谢谢.

css firefox

2
推荐指数
1
解决办法
3991
查看次数

如何在代码中告诉我们是否从testmethod .net测试运行

有没有办法知道何时从运行测试方法调用代码?

bool MyMethod()
{
    if ( /* are we running a test? */ )
    {
        return true; // otherwise this will fail from the automated build script
    }
    else
    {
        // run the proper code
    } 
}
Run Code Online (Sandbox Code Playgroud)

请饶恕我"这是一个非常糟糕的主意"评论:)

.net c# testing

5
推荐指数
1
解决办法
3176
查看次数

后加载:检查图像是否在浏览器缓存中

简短版本问题: 是否有navigator.mozIsLocallyAvailable等效功能适用于所有浏览器,或替代?

长版:)

嗨,这是我的情况:我想为asp.net MVC实现一个HtmlHelper扩展,它可以轻松处理图像后加载(使用jQuery).

所以我使用"alt"属性中指定的源渲染具有空图像源的页面.我在"window.onload"事件之后插入图像源,效果很好.

我做了这样的事情:

$(window).bind('load', function() {
    var plImages = $(".postLoad");
    plImages.each(function() {
        $(this).attr("src", $(this).attr("alt"));
    });
});
Run Code Online (Sandbox Code Playgroud)

问题是:第一次加载后,缓存后加载的图像.但是如果页面加载需要10秒钟,则在此10秒后将显示缓存的后载图像.

所以我想在"document.ready"事件中指定图像源,如果图像被缓存以立即显示它们.

我找到了这个函数:navigator.mozIsLocallyAvailable可以检查图像是否在缓存中.这是我用jquery做的:

//specify cached image sources on dom ready
$(document).ready(function() {
    var plImages = $(".postLoad");
    plImages.each(function() {
        var source = $(this).attr("alt")
        var disponible = navigator.mozIsLocallyAvailable(source, true);
        if (disponible)
            $(this).attr("src", source);
    });
});

//specify uncached image sources after page loading
$(window).bind('load', function() {
        var plImages = $(".postLoad");
        plImages.each(function() {
        if ($(this).attr("src") == "")
            $(this).attr("src", $(this).attr("alt"));
    });
});
Run Code Online (Sandbox Code Playgroud)

它适用于Mozilla的DOM,但它不适用于任何其他DOM.我试过navigator.isLocallyAvailable:相同的结果.

还有其他选择吗?

javascript jquery caching lazy-loading

27
推荐指数
3
解决办法
2万
查看次数

django ManyToMany通过帮助

我有关于人际关系的问题.

我希望用户有友谊.因此,用户可以是另一个用户的朋友.我假设我需要通过友谊表使用ManyToManyField.但我无法让它发挥作用.有任何想法吗?

这是我的模特.

class User(models.Model):
    username = models.CharField(max_length=999)
    password = models.CharField(max_length=999)
    created_on = models.DateField(auto_now = False, auto_now_add = True)
    updated_on = models.DateField(auto_now = True, auto_now_add = False)
    friends = models.ManyToManyField('self')
    pendingFriends = models.ManyToManyField('self', through='PendingFriendship', symmetrical=False, related_name='friend_requested')

class PendingFriendship(models.Model):
    user = models.ForeignKey('User', related_name='user')
    requested_friend = models.ForeignKey('User', related_name='requested_friend')
    created_on = models.DateField(auto_now = False, auto_now_add = True)
    updated_on = models.DateField(auto_now = True, auto_now_add = False)
Run Code Online (Sandbox Code Playgroud)

谢谢

django many-to-many model

6
推荐指数
1
解决办法
4392
查看次数