问题列表 - 第39470页

如何将最新的TFS变更集编号插入到aspx页面中?

当我们使用SVN时,我们总是在页面的页脚打印:"修订版XXXX".我一直在寻找,但我无法弄清楚如何用TFS做同样的事情.谁能提供一些指示?

如果这很重要:我们正在使用ASP.NET MVC.不过,我猜它没关系.

asp.net msbuild asp.net-mvc tfsbuild tfs2010

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

iPad中心活动指标

我正在编写一个iPad应用程序,当在webview中加载页面时,该应用程序具有UIWebView和活动指示器.我认为这是一个愚蠢的问题,但我怎样才能确保活动指标始终居中?如果我有垂直,它居中,但如果我水平转动iPad,活动指示器现在位于左下象限而不是中心.

提前致谢!

webview uiactivityindicatorview ipad

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

C ++中的sqlt问题

为什么这里有错误?

#include <iostream>
#include <math.h>
#include <vector>
#include <ostream>

using namespace std;

struct Point {
    int x,y;
};

int distance (const Point& a,const Point& b){
    int k= sqrt(((a.x-b.x)*(a.x-b.x))+((a.y-b.y)*(a.y-b.y)));
}

int main(){
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

构建输出:

1>------ Build started: Project: distance, Configuration: Debug Win32 ------
1>  distance.cpp
1>d:\...\distance.cpp(13): error C2668: 'sqrt' : ambiguous call to overloaded function
1>          c:\...\vc\include\math.h(589): could be 'long double sqrt(long double)'
1>          c:\...\vc\include\math.h(541): or       'float sqrt(float)'
1>          c:\...\vc\include\math.h(127): or       'double sqrt(double)'
1>          while trying to match the …
Run Code Online (Sandbox Code Playgroud)

c++

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

保存到xml文档

我正在" 试图 "弄清楚如何创建Windows Phone 7应用程序,我想用以下函数更新/保存xml文件:

        XDocument xmlDoc = XDocument.Load("myApp.xml");

        xmlDoc.Element("ocd").Add(new XElement("vDetails", new XElement("itemName", this.tb_Name.Text),
            new XElement("Date", System.DateTime.Now.ToString()), new XElement("itemValue", "")));

        xmlDoc.Save("data.xml");
Run Code Online (Sandbox Code Playgroud)

但是xmlDoc.Save行给出了错误:"System.Xml.Linq.XDocument.Save(System.Xml.XmlWriter)"的最佳重载方法匹配具有一些无效参数.

我需要做些什么才能纠正这个问题?

c# linq linq-to-xml windows-phone-7

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

挂钩一些Emacs事件以改进org-mode/MobileOrg集成

我最近开始使用MobileOrg(通过Dropbox)在我离开计算机时能够管理我的组织模式TODO列表.

它通常很棒,但来回同步有几个步骤,所以我想通过自动执行PC端的步骤来尝试简化它.

无论如何,这是我想做的两件事:

  1. org-mobile-push保存完成后,每次保存文件时运行.我使用emacs的唯一方法是org-mode,所以这应该没问题.
  2. org-mobile-pull在emacs启动时运行.
  3. 运行org-mobile-pull周期,比如每隔一小时左右.

谢谢.

emacs org-mode

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

为Razor调整自定义Html助手(它使用HtmlTextWriter,因此返回void)

问题

我为WebFormViewEngine视图编写了一个非常漂亮的菜单Html帮助器.这个引擎允许你的助手返回void,仍然可以使用:

@Html.Theseus
Run Code Online (Sandbox Code Playgroud)

这对我的助手很有用,因为它可以使用HtmlTextWriter渲染菜单,直接渲染到输出流.

但是,在Razor视图中,Html助手应该返回一个值(通常是MvcHtmlString),这是添加到输出中的值.差异小,后果大.

有一种解决方法,正如GvS指出的那样(参见ASP.NET MVC 2到MVC 3:Razor中的自定义Html助手)如下:

如果帮助程序返回void,请执行以下操作:

@{Html.Theseus;}
Run Code Online (Sandbox Code Playgroud)

(基本上,您只是调用方法,而不是渲染到视图中).

虽然仍然很整洁,但这与@ Html.seus不完全相同.所以...

我的代码很复杂,但效果很好,所以不愿意进行主要编辑,即用另一个编写器替换HtmlTextWriter.一段代码如下:

writer.AddAttribute(HtmlTextWriterAttribute.Href, n.Url);
writer.AddAttribute(HtmlTextWriterAttribute.Title, n.Description);
writer.RenderBeginTag(HtmlTextWriterTag.A);
writer.WriteEncodedText(n.Title);
writer.RenderEndTag();

// Recursion, if any
// Snip off the recursion at this level if specified by depth
// Use a negative value for depth if you want to render the entire sitemap from the starting node

    if ((currentDepth < depth) || (depth < 0))
    {
         if (hasChildNodes)
         {
              // Recursive building starts here

              // Open new ul …
Run Code Online (Sandbox Code Playgroud)

asp.net-mvc html-helper razor

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

Eclipse CDT移动文件和重命名文件重构?

Eclipse CDT中是否有办法执行以下自动重构?

  1. 移动文件:将源/头文件移动到另一个项目文件夹,并使每个相对于移动文件的#include指令自动更新
  2. 重命名文件:重命名源/头文件,并使相对于重命名文件的每个#include指令自动更新

如果CDT中没有这样的功能,是否有另一种Linux工具可以轻松让我这样做?

非常感谢你.

c++ refactoring file eclipse-cdt

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

重新抛出不正确的堆栈跟踪

我用"throw;"重新抛出异常,但堆栈跟踪不正确:

static void Main(string[] args) {
    try {
        try {
            throw new Exception("Test"); //Line 12
        }
        catch (Exception ex) {
            throw; //Line 15
        }
    }
    catch (Exception ex) {
        System.Diagnostics.Debug.Write(ex.ToString());
    }
    Console.ReadKey();
}
Run Code Online (Sandbox Code Playgroud)

正确的堆栈跟踪应该是:

System.Exception: Test
   at ConsoleApplication1.Program.Main(String[] args) in Program.cs:Line 12
Run Code Online (Sandbox Code Playgroud)

但我得到:

System.Exception: Test
   at ConsoleApplication1.Program.Main(String[] args) in Program.cs:Line 15
Run Code Online (Sandbox Code Playgroud)

但第15行是"抛出"的位置.我用.NET 3.5进行了测试.

c# stack-trace throw rethrow

37
推荐指数
7
解决办法
5636
查看次数

如何使用XML添加JSON支持?

如何将JSON支持添加到dispatch-servlet.xml(XML工作没有问题)?
评论文本只是失败的尝试......

<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/mvc"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns:beans="http://www.springframework.org/schema/beans"
   xmlns:context="http://www.springframework.org/schema/context"
   xmlns:oxm="http://www.springframework.org/schema/oxm"
   xsi:schemaLocation="
       http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
       http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
       http://www.springframework.org/schema/oxm http://www.springframework.org/schema/oxm/spring-oxm-3.0.xsd">


    <context:annotation-config/>
    <context:component-scan base-package="com.example"/>

    <oxm:jaxb2-marshaller id="marshaller" contextPath="com.example.domain"/>

    <beans:bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
        <beans:property name="messageConverters">
            <beans:list>
                <beans:bean class="org.springframework.http.converter.xml.MarshallingHttpMessageConverter">
                    <beans:constructor-arg ref="marshaller"/>
                </beans:bean>
<!--                <beans:bean class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter">
                <beans:constructor-arg ref="marshaller"/>
                </beans:bean> -->
            </beans:list>
        </beans:property>
    </beans:bean>

    <beans:bean class="org.springframework.web.servlet.view.BeanNameViewResolver"/>

    <beans:bean name="note" class="org.springframework.web.servlet.view.xml.MarshallingView">
        <beans:constructor-arg ref="marshaller"/>
    </beans:bean>   
<!--    <beans:bean name="note" class="org.springframework.web.servlet.view.json.MappingJacksonJsonView">
    <beans:constructor-arg ref="marshaller"/>
</beans:bean> -->   

    <!-- InternalResourceViewResolver should be the last sice it always returns/resolves a view -->
    <beans:bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <beans:property name="viewClass" …
Run Code Online (Sandbox Code Playgroud)

java xml spring json spring-mvc

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

是一系列[array addObject:[[NSNumber alloc] initWithBool:someVariable]?]创建的内存泄漏;

我是否通过以下方式创建多个内存泄漏:

NSMutableArray *array=[[NSMutableArray alloc] init];
[array addObject:[[NSNumber alloc] initWithBool:boolVariable1]];
[array addObject:[[NSNumber alloc] initWithBool:boolVariable2]];
[array addObject:[[NSNumber alloc] initWithInt:intVariable]];
[array addObject:[[NSNumber alloc] initWithFloat:floatVariable]];
[array writeToFile:[self dataFilePath] atomically:YES];
[array release];
Run Code Online (Sandbox Code Playgroud)

使用起来更好:

[array addObject:[NSNumber numberWithInt:intVariable]];
Run Code Online (Sandbox Code Playgroud)

memory-leaks objective-c nsnumber alloc

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