我正在开发一个C#应用程序.我需要正确地构建英语句子.我会给它名词动词和对象,我需要构建一个正确的英语短语.例如,我希望做这样的事情:
PhraseBuilder p = new PhraseBuilder ();
p.Subject("Tom");
p.Verb("eat");
p.Object("the apple");
Run Code Online (Sandbox Code Playgroud)
然后使用
p.BuildPhrase()
Run Code Online (Sandbox Code Playgroud)
我需要将此作为输出:
汤姆吃了苹果.
请注意,'s'添加到吃,最后是句号
有没有可以在上面做的图书馆?我需要它有正确的英语和标点符号.
当我的计算机突然崩溃时,我正在视觉工作室2010上课.我重新启动电脑后.我启动Visual Studio,发现该类完全是空的.它在课前包含超过1000行代码.无论如何,我可以恢复该文件?
请帮忙,因为我没有其他副本(我的傻瓜)
我正在研究Iphone应用程序,我需要显示一个大文本.我需要它有一个段落对齐.请参考下面的图片进行说明.
我试图使用UILabel和UITextView但无法找到属性来执行此操作.
谢谢你的帮助.

我正在开发一个ASP.NET/C#网站.
我正在从数据库中读取数据,将其保存在字典中
Dictionary<string, decimal> Results
Run Code Online (Sandbox Code Playgroud)
然后将其绑定到ASP.NET图表
PieChart.Series["Series"].Points.DataBind(Results, "Key", "Value", string.Empty);
Run Code Online (Sandbox Code Playgroud)
我想在单击按钮时更改Point的标签.
protected void Button_Click(object sender, EventArgs e)
{
PieChart.Series["Series"].Points[0].Label = "abc"
}
Run Code Online (Sandbox Code Playgroud)
但是当我点击按钮,发生PostBack并且"结果"字典中保存的数据以及图表丢失时出现问题.
有没有办法,在发生回发时不丢失数据而不必再次从数据库中读取?
感谢您的任何帮助.
我正在开发一个C++应用程序.
我有2个点向量
vector<Point2f> vectorAll;
vector<Point2f> vectorSpecial;
Run Code Online (Sandbox Code Playgroud)
Point2f已定义 typedef Point_<float> Point2f;
vectorAll有1000点而vectorSpecial有10点.
第一步:
我需要根据vectorAll中的顺序对vectorSpecial中的点进行排序.所以像这样:
For each Point in vectorSpecial
Get The Order Of that point in the vectorAll
Insert it in the correct order in a new vector
Run Code Online (Sandbox Code Playgroud)
我可以做一个双循环并保存索引.然后根据索引对点进行排序.然而,当我们有很多点时,这种方法花费的时间太长(例如,vectorAll中的10000个点和vectorSpecial中的1000个点,因此千万次迭代)
有什么更好的方法呢?
第二步:
vectorApecial中的某些点可能在vectorAll中不可用.我需要采取最接近它的点(通过使用通常的距离公式sqrt((x1-x2)^2 + (y1-y2)^2))
这也可以在循环时完成,但如果有人对更好的方法有任何建议,我将不胜感激.
非常感谢您的帮助
我有div class="myDiv".我需要做这个逻辑:鼠标悬停时,我想在div的中间显示一个弹出窗口.
为此,我有以下内容:
$(".myDiv").mouseover(function () {
positionDiv($(this).position().left + $(this).width() / 2, $(this).position().top + $(this).height() / 2);
});
function positionDiv(xPosition ,yPosition ) {
$("#popupWindow").css("left", xPosition + "px");
$("#popupWindow").css("top", yPosition + "px");
$("#popupWindow").show();
}
Run Code Online (Sandbox Code Playgroud)
CSS:
.popupWindow{
position:absolute;
width:313px;
height:383px;
display:none;
}
Run Code Online (Sandbox Code Playgroud)
这将弹出窗口定位在鼠标悬停的div中间.在这一点上,一切都很好.
但是,如果网站放大(使用浏览器缩放功能),则位置将变得混乱.弹出窗口不再出现在中间myDiv.
知道可能是什么问题吗?
编辑:
有关详细信息,如果已创建并缩放,则可以.但是当我将鼠标移动到另一个myDiv并且新的弹出窗口出现在一个奇怪的位置时.Div的左侧和顶部属性搞乱了.
我有这样的div:
<div id="popupDiv1" class="popupDivClass">
<a id="popupDivClose" class="popupCloseClass">x</a>
</div>
Run Code Online (Sandbox Code Playgroud)
当我点击'x'时(我想运行一个jquery函数disablePopup(id);,其中id是相应的popupDiv的id)(我有很多popupDiv,每个都有它自己的X按钮.
为了做到这一点,我实现了以下内容
$(".popupCloseClass").click(function (event) {
var buttonID = $(event.target).attr("id");
var id = $( buttonID).closest("div").attr("id");
disablePopup(id);
});
Run Code Online (Sandbox Code Playgroud)
基本上我得到了popupCloseClass的id,然后我通过最接近的方法得到它的id(相应的popupDiv)的id.然后我调用disablePopup.
但这不起作用.
我甚至尝试使用该var buttonID = $(buttonID).parent().attr("id");方法,但也没有工作.
我也试过了 var id = this.id;
任何帮助是极大的赞赏
谢谢
TLDR版本:
当我调整父级的大小时:

说明:
在Android应用程序中,我有一个父布局,里面有多个相对布局.
<LinearLayout
android:id="@+id/parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal" >
<RelativeLayout
android:id="@+id/child1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@color/transparent">
</RelativeLayout>
<RelativeLayout
android:id="@+id/child2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@color/transparent">
</RelativeLayout>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
这种布局的孩子们有一些文字和图片.我正在做的是以下内容:
当用户点击按钮时,我想折叠父线性布局(动画宽度直到它为0).我已经实现了这个功能:
public static void collapseHorizontally(final View v) {
final int initialWidth = v.getMeasuredWidth();
Animation a = new Animation()
{
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
if(interpolatedTime == 1){
v.setVisibility(View.GONE);
}else{
v.getLayoutParams().width = initialWidth - (int)(initialWidth * interpolatedTime);
v.requestLayout();
}
}
@Override
public boolean willChangeBounds() {
return true;
}
};
// 1dp/ms
long speed …Run Code Online (Sandbox Code Playgroud) net/C#应用程序我有项目列表.
在后面的代码中:我想为我的本地资源分配每个项目的图片.项目名称和图片名称相同.这些图片都在我项目的"图像"文件夹中.
我如何将图片分配给项目的示例:
Item1.PictureUrl = "images/items/" + item1.Name + ".jpg";
Run Code Online (Sandbox Code Playgroud)
我有没有照片的物品.我想为他们分配一张默认图片.
我尝试使用以下方法检查图片是否存在:
foreach(ObjectItem item in ListOfItems)
{
if(File.Exists("images/items/"+item.Name+".jpg"))
item.PictureUrl = "images/items/"+item.Name+".jpg";
else
item.PictureUrl= "images/Default.jpp";
}
Run Code Online (Sandbox Code Playgroud)
但是File.Exists方法总是返回false,即使图片存在也是如此.我也尝试使用'\'而不是'/'但是没有用
我该怎么做?
感谢您的任何帮助
我正在一个网站上工作,我有一个页面,其中包含这样构建的人员列表:
<div class="personsMenu">
<div class="person">
<div class="name">John</div>
<div class="age">18</div>
</div>
<div class="person">
<div class="name">Kate</div>
<div class="age">24</div>
</div>
<div class="person">
<div class="name">Tom</div>
<div class="age">17</div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
我也有一个文本框 <input type="Text" id="filterTextBox"/>
使用jquery我需要执行以下操作:
当用户开始在文本框中键入时,"name"不包含字符的div消失(某种动态过滤器,您只看到名字中包含书写字符的人)
所以逻辑应该是这样的:
当用户在文本框中键入一个字符(或删除一个字符)时,我们遍历所有"person"div,如果"person"中的"name"div包含我们显示的字符,否则我们隐藏它(.show( )和jquery中的.hide())
当然,如果文本框是空的,我们会显示所有内容.
可以这样做吗?
谢谢你的帮助
asp.net ×3
c# ×3
html ×3
jquery ×3
android ×1
c++ ×1
c++11 ×1
css ×1
file-exists ×1
ios ×1
javascript ×1
nlp ×1
objective-c ×1
parent ×1
postback ×1
sorting ×1
uilabel ×1
uitextview ×1
vector ×1
width ×1