目前我正指向我机器上的文件,但我想知道如何将字符串指向我在项目中创建的文件夹.例如,visual studio中文件夹的路径是,
C:\Users\Drian Darley\documents\visual studio 2013\Projects\KinectBVversion1\KinectKickboxingBVversion1\Gesture\jabtwo.xml
Run Code Online (Sandbox Code Playgroud)
我听说过包URI,在这种情况下是否适合或者如何设置?
这就是它当前指向文件的方式,这不是理想的,因为它必须指向本地存储在机器上的文件.
private string gesturefile =
Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\GesturePak\\wave.xml";
Run Code Online (Sandbox Code Playgroud) 我已经设置了一个带有多个编辑文本的警报对话框,但我不确定如何存储在警报对话框中输入的值。
通常我可以按照以下方式做一些事情:
final EditText input = new EditText(this);
alert.setView(input);
Editable value = input.getText();
Run Code Online (Sandbox Code Playgroud)
但是我的 MessageDialog 是一个单独的类,从 SearchResult.java 像这样调用,所以我不知道如何访问 MyMessageDialog.java 中编辑文本的实例:
MyMessageDialog.displayMessage(SearchResult.this, "Sample Info", "Required");
有谁知道如何在此实现中检索编辑文本值?
这是 MyMessageDialog 类,下面是警报对话框的布局:
public class MyMessageDialog {
@SuppressLint("NewApi")
public static AlertDialog displayMessage(Context context, String title, String message){
AlertDialog.Builder builder = new AlertDialog.Builder(context);
LayoutInflater inflater = LayoutInflater.from(context);
builder.setTitle(title);
builder.setMessage(message);
builder.setView(inflater.inflate(R.layout.custom_view, null));
builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
}
});
builder.show();
return builder.create();
}
}
Run Code Online (Sandbox Code Playgroud)
警报对话框布局,custom_view:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout …Run Code Online (Sandbox Code Playgroud) android android-edittext layout-inflater android-alertdialog
我正在大学里学习Java数据结构和算法,我们遇到了二叉搜索树和树横向的主题,但我没有在编程中看到这些主题的目的.我知道它们可以被修改以便你可以控制搜索路径,搜索时间可以改善.我的问题如下:
1.什么时候在程序中使用二叉搜索树?(例子)
2.在实际应用中使用二叉搜索树的一些例子?
我试图转换计算来自我使用MIT AppInventor制作的应用程序,该应用程序使用Java使用Kawa到Android.我面临的问题是Kawa中计算的三角部分正在使用degress.我的问题是如何翻译这个计算到Java并得到相同的输出?
这是我如何计算Kawa,所有变量都是double类型:
Tri 1=atan(Offset Depth/Offset Length)
Mark 1=sqrt(Offset Length^2+Offset Depth^2)
Tri 2=(180-Tri1)/2
Mark 2=Duct Depth/(tan(Tri 2))
Run Code Online (Sandbox Code Playgroud)
然后我尽力将其转换为Java代码,变量也是上面的两倍,深度,长度和管道深度是用户输入值.
tri1 = Math.atan(offsetDepth / offsetLength);
marking1 = Math.sqrt(Math.pow(offsetLength,2) + Math.pow(offsetDepth,2));
tri2 = (180 - tri1) / 2;
marking2 = ductDepth / Math.tan(tri2);
Run Code Online (Sandbox Code Playgroud)
输入和输出的截图如下:

正在使用自定义对话框来接收用户输入,然后使用getter方法将这些值传递给另一个活动.
但是当我将值传递给一个将字符串值输出到CSV文件的方法时shipName,analystName等等,这些值在文件中显示为空," "尽管我在对话框中输入了值.
我在调试菜单的表情窗口看着字符串值调试的问题,shipName和analystName而值表达式窗口从不更新.
我从中收集到输入传递的方法i不正确.
有谁知道为什么输出的值是空的?
这是使用的对话框类:
package ie.gmi.computing;
import android.annotation.SuppressLint;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.renderscript.Sampler;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
public class MyMessageDialog {
private Context context;
private EditText shipText, scientistNameText , scientistEmailText , volumeText , colourText ;
private String shipString, scientistNameString , scientistEmailString , volumeString , colourString ;
public AlertDialog displayMessage(Context context, String title, …Run Code Online (Sandbox Code Playgroud) 我已按照此代码片段将控件模板添加到 UpdateBtn,但收到一条错误消息,指出Triggers在 ControlTemplate 上未找到该属性。这个想法是将故事板绑定到IsEnabled按钮的属性。
Error 5 The attachable property 'Triggers' was not found in type 'ControlTemplate'.
Run Code Online (Sandbox Code Playgroud)
我研究了该错误,看来该属性是ControlTemplate的一部分的一部分,这是一个 WPF 应用程序而不是 Windows。所以不确定为什么 xaml 设计器中会显示错误。
谁能就我在实施过程中出错的地方提出建议?
按钮和关联的 ns 的 XAML 如下:
<Window x:Class="MongoDBApp.Views.MainView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:email_validator="clr-namespace:MongoDBApp.Validator"
Title="Orders Dashbord"
Width="800"
Height="500">
<Grid>
<TabControl>
<TabItem Header="Customer">
<Grid>
<Button x:Name="updateBtn"
Width="75"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Command="{Binding Path=UpdateCommand}"
Content="Update">
<Button.ToolTip>
<ToolTip>
<StackPanel>
<TextBlock>Updates customer record</TextBlock>
</StackPanel>
</ToolTip>
</Button.ToolTip>
<Button.Template>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Trigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_Content" Storyboard.TargetProperty="Content" Duration="00:00:00.8" RepeatBehavior="Forever">
<DiscreteObjectKeyFrame …Run Code Online (Sandbox Code Playgroud) 我已经List<Application>使用 Linq 过滤了该列表中的两个字段并返回结果,现在需要将该列表返回给调用方法。
Linq 过滤的结果是 类型IEnumerable<AnonymousType>,因此我无法返回该结果,因为我的方法返回类型是List<Application>。
我首先尝试的是使用 ToList 方法转换 IEnumerable ,但这会引发编译器错误:
IEnumerable does not contain a definition for ToList()
Run Code Online (Sandbox Code Playgroud)
问题:
如何将 IEnumerable 转换或转换为 List ?
代码:
这是在列表上执行的赋值,以连接两个字段并将其作为列表返回:
var filteredAppList = applicationList.Select(c => new { c.RID, RID_APP_FIELD = c.RID + " " + c.BusinessFriendlyName });
Run Code Online (Sandbox Code Playgroud)
下面是我尝试将 IEnumerable 作为列表返回的方法:
return filteredAppList.ToList<Application>();
Run Code Online (Sandbox Code Playgroud) 我正在从http://jsonplaceholder.typicode.com/users请求一个示例 JSON 数组,并在 ReactJS 项目中使用该数组的名称值创建一个项目列表。
该列表是一个Grommet列表,我使用该.map函数将 Web 服务数据映射到每个列表项。
但是当代码呈现时,而不是使用 Web 服务创建名称列表。它将只创建一个列表项,使得调用.map和rows.push。
题:
如何在 ReactJS 中将 JSON 数组映射到列表?
这是我尝试过的,首先通过 AJAX GET 获取 Web 服务,然后调用 .map 将该数据映射到列表:
loadNameData() {
$.ajax({
url: 'http://jsonplaceholder.typicode.com/users',
dataType: 'json',
success: function(data) {
this.setState({data: data});
}.bind(this),
error: function(xhr, status, err) {
console.error('#GET Error', status, err.toString());
}.bind(this)
});
}
getInitialState(){
return {
data: {
names: []
}
};
}
componentDidMount() {
this.loadAssetData();
}
render() {
let layerNode;
var rows …Run Code Online (Sandbox Code Playgroud) 我使用模型对象列表创建了一个表.然后在单击该行上的按钮时将行数据传递到Ajax帖子.
在Ajax Post .stringify中调用传递的行数据.当我检查Dev Tools中传递的数据的值时,我可以看到它们已被填充:
["66", "jdoe@gmail.com", "2009", "test",…]
0
:
"66"
1
:
"jdoe@gmail.com"
2
:
"2009"
3
:
"test"
Run Code Online (Sandbox Code Playgroud)
但是当我进入从客户端调用的控制器POST操作时.预期的JSON字符串为null/empty.我的想法是,这可能是因为stringify没有与数组中的每个值相关联的属性名称.
题:
如何解析传递给mvc控制器的null json字符串?
以下是实施的要点 -
模型:
public class Status
{
[Key]
public int ID { get; set; }
public string Contact_Email { get; set; }
public string RID { get; set; }
public string Name { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
表和AJAX post方法:
<table id="statusTable" class="table table-hover table-bordered results">
<thead>
<tr>
<th>ID</th>
<th>Email</th>
<th>RID</th>
<th>Name</th>
<th>Update …Run Code Online (Sandbox Code Playgroud) 我在表格上设置了 table-layout: fixed;,但每个单元格内的单词都被分成了新行。
Eg:
Applicatio
n
Instead of:
Application
Run Code Online (Sandbox Code Playgroud)
我确实尝试了按照此处建议white-space: nowrap;添加但无济于事的解决方案
问题: 如何防止固定布局表格单元格中的断字?
表格布局:
<table id="escalation" class="table table-striped table-bordered" cellspacing="0">
<thead>
<tr>
<th style="display:none">ID</th>
<th>RID</th>
<th>Asset Name</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td class="td-limit">102345</td>
<td class="td-limit">Application Testing Break</td>
</tr>
</tbody>
</table>
Run Code Online (Sandbox Code Playgroud)
CSS:
#escalation {
table-layout: fixed;
}
#escalation th {
overflow: auto;
font-size: 10px;
color: #000000;
border-right: 1px solid #7591ac;
}
.td-limit {
overflow: auto;
font-size: 11px;
max-width: 220px;
overflow: hidden;
word-wrap: break-word;
}
Run Code Online (Sandbox Code Playgroud) 我在组件中注册了componentWillReceiveProps事件.正如在文档中所解释的那样,我在生命周期的更新阶段期间在此事件中监听nextProps.
但记录nextProps的值返回undefined - "Chart.js?5478:88 Uncaught TypeError: Cannot read property 'dashboards' of undefined"
如果我赋值,this.props.dashboards我可以看到数据存在.但价值观并不是最新的.这就是我倾听的原因nextProps.dashboards.
题:
为什么componentWillReceiveProps中的nextProps参数返回undefined?
这是Chart.js文件的要点,我在其中监听仪表板和currentDashboard道具的更新:
import React, { Component } from 'react';
import { connect } from 'react-redux';
import Spinning from 'grommet/components/icons/Spinning';
import Heading from 'grommet/components/Heading';
import drawing from '../chartLib/';
class Chart extends Component {
constructor (props) {
super(props);
this.state = {data: [], loading: true};
}
componentWillReceiveProps ({ blockName, subcatName, nextProps }) {
if(nextProps.dashboards) //this check for nextProps.dashboards returns: "Chart.js?5478:88 Uncaught TypeError: Cannot …Run Code Online (Sandbox Code Playgroud) 我已经使用了else..if声明,我的程序来检查,如果某些条件都在验证谋面,但我想我已经在我的发言else..if的布局错误,我似乎无法pinpoint.Can人指出我正确的纠正或给我一些有用的提示,告诉我在这种情况下应该做些什么?谢谢.
void validatePass()
{
FILE *fptr;
char password[MAX+1];
int iChar,iUpper,iLower,iSymbol,iNumber,iTotal,iResult,iCount;
//shows user password guidelines
printf("\n\n\t\tPassword rules: ");
printf("\n\n\t\t 1. Passwords must be at least 9 characters long and less than 15 characters. ");
printf("\n\n\t\t 2. Passwords must have at least 2 numbers in them.");
printf("\n\n\t\t 3. Passwords must have at least 2 uppercase letters and 2 lowercase letters in them.");
printf("\n\n\t\t 4. Passwords must have at least 1 symbol in them (eg ?, $, £, %).");
printf("\n\n\t\t 5. Passwords may …Run Code Online (Sandbox Code Playgroud) android ×3
c# ×3
java ×2
javascript ×2
json ×2
reactjs ×2
wpf ×2
ajax ×1
asp.net-mvc ×1
c ×1
cell ×1
css ×1
csv ×1
getter ×1
gettext ×1
html ×1
ienumerable ×1
if-statement ×1
kawa ×1
linq ×1
list ×1
radians ×1
react-redux ×1
storyboard ×1
syntax ×1
tree ×1
triggers ×1
word-break ×1
xaml ×1