我有一个程序集版本文件(SolutionAssemblyVersion.cs),它保存在TFS的trunk中.我更新此文件并在构建期间检入.当我在TFS中使用CI构建时,它基本上会触发另一个构建作为检查的结果.有没有办法排除某些用户触发构建?
我见过Martin Woodward的TFS Top Tip#16 - 限制你构建的帖子,但我希望不必为它创建一个文件夹.
如何在此循环中获取XML元素的位置?
For Each objNode In objDoc.SelectNodes("//books/book")
???
Next
Run Code Online (Sandbox Code Playgroud)
我想要的输出就像是
1 2 3 4 ....
我正在尝试编写一个分区方法,它接受2个参数.
public static decimal Divide(decimal divisor, decimal dividend)
{
return dividend / divisor;
}
Run Code Online (Sandbox Code Playgroud)
现在,如果除数为0,我们得到的不能除以零错误,这是可以的.
我想做的是检查除数是否为0,如果是,将其转换为1.有没有办法在我的方法中有很多if语句?我认为很多if()都会变得混乱.我在数学上知道不应该这样做,但我有其他功能.
例如:
if(divisor == 0)
{
divisor = 1;
}
return dividend / divisor;
Run Code Online (Sandbox Code Playgroud)
可以在没有if()声明的情况下完成吗?
我只做过没有关系的数据库,但现在我需要做一些更严肃和正确的事情。
这是我的 SQL (SQLite) 架构:
CREATE TABLE Post (
Postnr INTEGER NOT NULL PRIMARY KEY,
Bynavn VARCHAR(50) NOT NULL
);
CREATE TABLE Kunde (
CPR INTEGER NOT NULL PRIMARY KEY,
Navn VARCHAR(50) NOT NULL,
Tlf INTEGER NOT NULL,
Adresse VARCHAR(50) NOT NULL,
Postnr INTEGER NOT NULL
CONSTRAINT fk_postnr_post REFERENCES Post(Postnr)
);
CREATE TABLE Varegruppe (
VGnr INTEGER PRIMARY KEY,
Typenavn VARCHAR(50) NOT …Run Code Online (Sandbox Code Playgroud) 我的搜索引擎使用以下函数来计算相关性.
private static int calculateScore(String result, String searchStr, int modifier)
{
String[] resultWords = result.split(" ");
String[] searchWords = searchStr.split(" ");
int score = 0;
for (String searchWord : searchWords)
{
for (String resultWord : resultWords)
{
if (resultWord.equals(searchWord))
score += 10;
else if (resultWord.startsWith(searchWord))
score += 4;
else if (resultWord.endsWith(searchWord))
score += 3;
else if (resultWord.contains(searchWord))
score += 1;
}
}
return score;
}
Run Code Online (Sandbox Code Playgroud)
没有什么花哨的,而且我也没有足够的时间去做任何花哨的事情,但是我是否有任何简单的改进可以使功能更好地提升相关的东西,并保持不相关的东西?无需评论速度优化,这只是函数的"功能部分":)
谢谢.
我有一个Windows程序,里面有两个2个窗口:
hwnd (main interface)
hwnd2 (toplevel window, no parent, created by hwnd)
Run Code Online (Sandbox Code Playgroud)
当我双击hwnd时,我需要hwnd2弹出并显示一些数据,所以我使用这个函数将hwnd2带到顶部:
BringWindowToTop(hwnd2);
Run Code Online (Sandbox Code Playgroud)
hwnd2被带到了顶峰,但有一点奇怪.当我再次点击hwnd2时,hwnd(主界面)会自动再次弹出.我试图使用以下函数来解决这个问题,但它们没有工作.
SetWindowPos(hwnd, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
//doesn't work
BringWindowToTop(hwnd2); //This is the function brings hwnd2 to top
SetForegroundWindow(hwnd2); //doesn't work
SetWindowPos(hwnd2, HWND_TOP, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
//doesn't work
SetWindowPos(hwnd2, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
// hwnd2 "always" on top, not what I want
SetActiveWindow(hwnd2); // doesn't work too (for replying to Magnus Skog, thanks)
SwitchToThisWindow(hwnd2, TRUE);// …Run Code Online (Sandbox Code Playgroud) 好吧问题是我有这个枚举,但我不希望组合框显示枚举的值.这是枚举:
public enum Mode
{
[Description("Display active only")]
Active,
[Description("Display selected only")]
Selected,
[Description("Display active and selected")]
ActiveAndSelected
}
Run Code Online (Sandbox Code Playgroud)
因此,在ComboBox中,而不是显示Active,Selected或ActiveAndSelected,我想为枚举的每个值显示DescriptionProperty.我有一个名为GetDescription()的扩展方法用于枚举:
public static string GetDescription(this Enum enumObj)
{
FieldInfo fieldInfo =
enumObj.GetType().GetField(enumObj.ToString());
object[] attribArray = fieldInfo.GetCustomAttributes(false);
if (attribArray.Length == 0)
{
return enumObj.ToString();
}
else
{
DescriptionAttribute attrib =
attribArray[0] as DescriptionAttribute;
return attrib.Description;
}
}
Run Code Online (Sandbox Code Playgroud)
那么有没有办法可以将枚举绑定到ComboBox并使用GetDescription扩展方法显示它的内容?
谢谢!
我想在Struts2中使用json.但是,当我将动作返回类型设置为"json"时,我得到"没有为类型'json'定义的结果类型,其名称为'success'." Bellow是struts.xml文件.
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<constant name="struts.custom.i18n.resources" value="resource"/>
<package extends="struts-default" name="test">
<action name="inputHandler" class="inputHandlerAction">
<result name="input">/index.jsp</result>
<result>/result.jsp</result>
</action>
<action name="setLangHandler" class="com.sesoft.test.setLanguageHandler">
<result>/index.jsp</result>
</action>
<action name="Handler" class="com.sesoft.test.Handler">
<result>/test2.jsp</result>
</action>
</package>
<package name="example" extends="json-default">
<action name="ajaxHandler" class="com.sesoft.test.AjaxHandler">
<result name="success" type="json" />
</action>
</package>
</struts>
Run Code Online (Sandbox Code Playgroud)
在我添加json Action之前,所有其他操作都运行良好.但是在我添加json Action之后,服务器无法执行错误代码503.
libs我已将"jsonplugin-0.33.jar"添加到lib目录中.
在这里工作(一家拥有12人Windows开发团队的数十亿美元的制造公司),我们即将为所有新应用程序转到一个主数据库,并将其分解为我们通常拥有的数据库的模式.之前.还有一些常见的模式,包括员工目录和分支目录等等...
我仍然不确定我对这一举动的感受,但我们即将在几个小时内召开会议,讨论利弊,最佳做法,陷阱等......所以我正在寻找你对此的看法......好吗?这不好吗?从现在起一年后我们会遇到什么问题?
欢迎任何想法,提示或建议.谢谢
编辑 在回答对这个问题的评论时,我们正在使用SQL Server 2005,我们实际上正在讨论将同一个实例上的单独数据库移动到单个数据库中.驱动问题是数据库中完全缺乏参照完整性,因为我们的大多数应用程序需要访问 公共数据,例如员工记录或分支信息.
更新 有几个人要求我用我们会议的结果更新这个问题,所以在这里.我们来回讨论了这样做的优点和缺点(我甚至用投影仪向他们展示了这个问题),当我们完成时,我们几乎涵盖了这里所包含的优点和缺点.我们大约有一半的人认为我们可以用合适的资源和承诺来完成它,大约一半人认为我们做不到(或者它不会很好).我们决定利用微软的时间来获取他们的想法和平台特定的建议.在我们与他们交谈之后,我一定会更新这个问题和我的博客.感谢所有帮助和有用的答案.
我想在某个事件被触发后循环(模拟拔出并重新插入)USB设备(调制解调器).我在codeproject上找到了一个示例:
这允许我通过其非易失性串口识别+弹出设备,但我需要它来回收,而不仅仅是弹出.
我读过这个:
我不明白.
其他USB相关帖子中已经提到过:
这与我的问题无关.
c# ×2
api ×1
c++ ×1
combobox ×1
data-binding ×1
database ×1
enums ×1
foreach ×1
foreign-keys ×1
java ×1
json ×1
math ×1
peripherals ×1
primary-key ×1
puzzle ×1
selectnodes ×1
sql ×1
stack ×1
struts2 ×1
team-build ×1
tfs ×1
usb ×1
vb.net ×1
visual-c++ ×1
winapi ×1
wpf ×1