我正在使用HERE Places API.
首先,我正在进行搜索.
例如此查询:
https://places.cit.api.here.com/places/v1/discover/search?q=Test&at=35.6111,-97.5467&r=500&size=1&app_id=DemoAppId01082013GAL&app_code=AJKnXv84fjrb0KIHawS0Tg&show_refs=pvid&pretty
Run Code Online (Sandbox Code Playgroud)
根据这个文档(链接)如果我添加show_refs=pvid到查询字符串,结果我将获得外部id,我可以用来查询lookup端点.
但结果我得到了下一个回复:
{
"results": {
"next": "https://places.cit.api.here.com/places/v1/discover/search;context=Zmxvdy1pZD1hY2ExNzk3NC0zYzg3LTU5NzQtYmZkMC04YjAzMDZlYWIzMWJfMTUwNjA3NjMzMTYyMl83NDY3XzM4NTAmb2Zmc2V0PTEmc2l6ZT0x?at=35.6111%2C-97.5467&q=Test&app_id=DemoAppId01082013GAL&app_code=AJKnXv84fjrb0KIHawS0Tg",
"items": [
{
"position": [
35.60369,
-97.51761
],
"distance": 2756,
"title": "Southwest Test & Balance",
"averageRating": 0,
"category": {
"id": "business-services",
"title": "Business & Services",
"href": "https://places.cit.api.here.com/places/v1/categories/places/business-services?app_id=DemoAppId01082013GAL&app_code=AJKnXv84fjrb0KIHawS0Tg",
"type": "urn:nlp-types:category",
"system": "places"
},
"icon": "https://download.vcdn.cit.data.here.com/p/d/places2_stg/icons/categories/02.icon",
"vicinity": "200 NW 132nd St<br/>Oklahoma City, OK 73114",
"having": [],
"type": "urn:nlp-types:place",
"href": "https://places.cit.api.here.com/places/v1/places/8403fv6k-d1b2fde0616e0326e321a54b88cd9f53;context=Zmxvdy1pZD1hY2ExNzk3NC0zYzg3LTU5NzQtYmZkMC04YjAzMDZlYWIzMWJfMTUwNjA3NjMzMTYyMl83NDY3XzM4NTAmcmFuaz0w?app_id=DemoAppId01082013GAL&app_code=AJKnXv84fjrb0KIHawS0Tg",
"id": "8403fv6k-d1b2fde0616e0326e321a54b88cd9f53",
"authoritative": true
}
]
},
"search": {
"context": { …Run Code Online (Sandbox Code Playgroud) 我有实体Request和模型RequestModel
public class RequestModel : BaseModel
{
public IEnumerable <int> Recipients { get; set; }
}
public class Request : IIdent
{
public virtual ICollection <RequestComment> Comments { get; set; }
}
public class RequestComment : IIdent
{
[ForeignKey("User")]
public int? UserId { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
我想创建映射 Recipients
CreateMap<Request, RequestModel>()
.ForMember(d => d.Recipients, o => o.MapFrom(s => s.Comments.Select(x => x.UserId )))
Run Code Online (Sandbox Code Playgroud)
但我得到了例外:
AutoMapper.AutoMapperMappingException 被捕获 _HResult=-2146233088 HResult=-2146233088 IsTransient=false 消息= 映射类型:请求 -> IEnumerable
1 AttManager.Data.Request -> System.Collections.Generic.IEnumerable1[[System.Int32, …
我有界面:
export interface IFieldValue {
name: string;
value: string;
}
Run Code Online (Sandbox Code Playgroud)
我有一个实现它的类:
class Person implements IFieldValue{
name: string;
value: string;
constructor (name: string, value: string) {
this.name = name;
this.value = value;
}
}
Run Code Online (Sandbox Code Playgroud)
看完这篇文章后,我一直在考虑重构:
class Person implements IFieldValue{
constructor(public name: string, public value: string) {
}
}
Run Code Online (Sandbox Code Playgroud)
问题:在第一课中,我有一些字段,默认情况下应该是private.在第二个样本中,我只能将它们设置为public.这一切是正确的还是我对TypeScript中默认Access修饰符的理解?
我有搜索控件,可以在其中添加文本框、选择和按钮。
<div class="col-md-10">
<div class="row">
<div id="Search_Widget_tr3" class="input-group col-md-12">
<input type="text" class="form-control" placeholder="enter title" id="homeSearchInput"/>
<div class="input-group-btn clearfix">
<select class="selectpicker" multiple title='Platforms' data-container="body" data-count-selected-text="Platforms" data-selected-text-format="count>0" data-style="btn btn-default" data-allOptionIsSelected="false">
<option value="All">All Platforms</option>
<option value="Mobile Phone;Tablet;Windows Phone;PlayStation Certified Device;Windows 8 App;PlayStation Mobile">Mobile App/Tablet</option>
<option value="Nintendo DS;Nintendo DSi;Nintendo 3DS">Nintendo DS/DSi/3DS</option>
<option value="PlayStation 3">PlayStation 3</option>
<option value="PlayStation 4">PlayStation 4</option>
<option value="PSP;PS Vita">PlayStation Vita/PSP</option>
<option value="Wii">Wii</option>
<option value="Wii U">Wii U</option>
<option value="Linux;Macintosh;PC DVD;PC DVD-ROM;Windows CE;Windows PC;Windows 8 App">Windows/Mac</option>
<option value="Xbox 360">Xbox 360</option>
<option value="Xbox One">Xbox …Run Code Online (Sandbox Code Playgroud) 非常简单的例子:https : //jsfiddle.net/x6z6w0n8/8/
如何在不创建重复项的情况下在初始化步骤中设置选定的值?
来自异地的样品效果很好。https://jsbin.com/yupinelefa/edit?html,js,console
正如我注意到的,在例外他们不初始化选择,他们只是使用 event onInitialized。但是当我初始化(设置选项)以在onInitialized事件中选择时,没有任何改变,我也有 2 个选择。
一般来说 - 我bootstrap-multiselect在页面上。OnInitialization 我想在其中设置选定的值。我有下一个代码作为示例:
<select id="example-onInitialized" multiple="multiple" class="multiple">
<option value="1">Option 1</option>
<option value="2">Option 2</option>
<option value="3">Option 3</option>
<option value="4">Option 4</option>
<option value="5">Option 5</option>
<option value="6">Option 6</option>
</select>
$('.multiselect').multiselect({
onInitialized: function(select, container) {
$(select).multiselect('select', 2); // I want to select item with value '2'
}
});
Run Code Online (Sandbox Code Playgroud)
但是这个脚本创建了一个额外的选择。因此,我有一个选择值为“2”的选择和一个空选择。对我来说,似乎每次调用.multiselect()都会创建新的选择。这样对吗?谢谢。
我有一个带静态方法的集线器,它向当前所有用户广播通知.
public class NotificationHub : Hub
{
private static string connString = ConfigurationManager.ConnectionStrings["DefaultConnection"].ToString();
[HubMethodName("sendNotifications")]
public static void SendNotifications()
{
IHubContext context = GlobalHost.ConnectionManager.GetHubContext<NotificationHub>();
context.Clients.All.updateNotifications();
}
}
Run Code Online (Sandbox Code Playgroud)
我需要从前端javascript中获取一些文本框输入,例如10038,这是userID并将其发送到服务器类,例如
public class NotificationRepository
{
private readonly string _connString = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString;
public IEnumerable<Notifications> GetNotifications(int userID)
{
var notifications = new List<Notifications>();
using (var connection = new SqlConnection(_connString))
{
connection.Open();
using (var command = new SqlCommand(String.Format(@"SELECT [ID], [UserID], [Message] FROM [dbo].[Notification] WHERE [UserID] = {0}", userID), connection))
{
command.Notification = null;
var dependency = new …Run Code Online (Sandbox Code Playgroud) 我想使用掩码和自动完成功能为 dateTime 进行输入。
我已经在存在问题的地方创建了小型演示。
看起来自动完成认为掩码是文本......只有当我完成输入时,我才能从自动完成中看到一些值(如果它存在于自动完成列表中)。
有什么解决办法吗?
<input name="field1" id="field1" class="inputmask" data-inputmask="'mask': 'h:s t\\m','placeholder': 'hh:mm xm', 'hourFormat': '12', 'alias': 'datetime'"/>
function generateTime(){
var times = [];
Array(24).join(',').split(',').forEach(function (_, index) {
var hour = index;
if (hour < 10) {
hour = '0' + hour;
}
times.push(moment(hour + ':00', 'HH:mm').format('hh:mm a'));
times.push(moment(hour + ':30', 'HH:mm').format('hh:mm a'));
});
return times;
}
$('.inputmask').inputmask();
$('.inputmask').autocomplete({
source: generateTime()
});
Run Code Online (Sandbox Code Playgroud)
更新:
也许是解决方案的一些起点:如果我添加属性“'autoUnmask' : true自动完成”将仅适用于“小时” - 第一个符号直到掩码中的“:”。
我需要从数组中的第二项开始.为了保存正确的上下文,我需要使用forEach而不是简单的for循环.
我已经完成了下一步:
private convertToRanges(arr: []): any[] {
const inputArr = arr.slice(),
if (inputArr.length > 1) {
let lastIndex = 0;
inputArr.shift();
inputArr.forEach(item => {
...
});
}
...
}
Run Code Online (Sandbox Code Playgroud)
我复制并删除副本中的第一项.
还有另一种方法从第二个项目开始,并确保上下文?
在 app.config 中,我有带有自定义元素的自定义部分。
<BOBConfigurationGroup>
<BOBConfigurationSection>
<emails test="test1@test.com, test2@test.com"></emails>
</BOBConfigurationSection>
</BOBConfigurationGroup>
Run Code Online (Sandbox Code Playgroud)
对于电子邮件元素,我有自定义类型:
public class EmailAddressConfigurationElement : ConfigurationElement, IEmailConfigurationElement
{
[ConfigurationProperty("test")]
public string[] Test
{
get { return base["test"].ToString().Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); }
set { base["test"] = value.JoinStrings(); }
}
}
Run Code Online (Sandbox Code Playgroud)
但是当我运行我的 webApp 时,出现错误:
无法解析属性“test”的值。错误是:无法找到支持类型为“String[]”的属性“test”的字符串转换的转换器。
有没有办法在 getter 中拆分字符串?
我可以获取字符串值,然后在需要数组时“手动”拆分它,但在某些情况下我可以忘记它,所以最好从一开始就接收数组。
JoinStrings - 是我的自定义扩展方法
public static string JoinStrings(this IEnumerable<string> strings, string separator = ", ")
{
return string.Join(separator, strings.Where(s => !string.IsNullOrEmpty(s)));
}
Run Code Online (Sandbox Code Playgroud) 我正在使用EP plus和c#应用程序构建对excel功能的导出。我目前收到错误消息。
'表范围与表tblAllocations29冲突'
在下面的代码逻辑中,我正在遍历一个包含键和集合作为值的数据结构。
我遍历每个键,然后再次遍历属于该键的每个集合。
我基本上需要为每个集合打印表格信息及其总数。
在当前情况下,尝试打印三个数组时出现错误第一个数组有17条记录第二个数组有29条记录第三个数组有6条记录
我记下了调试时创建的范围
范围是
A1 G18
A20 G50
A51 G58
Run Code Online (Sandbox Code Playgroud)
控制者
[HttpGet]
[SkipTokenAuthorization]
public HttpResponseMessage DownloadFundAllocationDetails(int id, DateTime date)
{
var ms = GetStrategy(id);
DateTime d = new DateTime(date.Year, date.Month, 1).AddMonths(1).AddDays(-1);
if (ms.FIRM_ID != null)
{
var firm = GetService<FIRM>().Get(ms.FIRM_ID.Value);
IEnumerable<FIRMWIDE_MANAGER_ALLOCATION> allocationsGroup = null;
var allocationsGrouped = GetAllocationsGrouped(EntityType.Firm, firm.ID, d);
string fileName = string.Format("{0} as of {1}.xlsx", "test", date.ToString("MMM, yyyy"));
byte[] fileContents;
var newFile = new FileInfo(fileName);
using (var package = new OfficeOpenXml.ExcelPackage(newFile))
{
FundAllocationsPrinter.Print(package, …Run Code Online (Sandbox Code Playgroud) c# ×4
javascript ×3
jquery ×3
arrays ×2
typescript ×2
api ×1
asp.net ×1
autocomplete ×1
automapper ×1
config ×1
css ×1
epplus ×1
excel ×1
here-api ×1
html ×1
jquery-ui ×1
loops ×1
mapping ×1
parsing ×1
signalr ×1
signalr-hub ×1
string ×1