小编Ali*_*Ali的帖子

CSV Helper,读取字段数据中带双引号的文件

我需要一些帮助,用 C# 中的 CSV Helper 进行 CSV 解析

我的示例文件是

"SKU","Title","URL","BP","SP","NumberOf","Wid1","Wid2","Wid3"
"Big Corp","CRM updates","test","0","0","0","0","0","0"
"Big Corp 1","CRM "test" updates","test","0","0","0","0","0","0"
Run Code Online (Sandbox Code Playgroud)

我的配置是

using (TextReader reader = File.OpenText(location))
            {
                using (var csv = new CsvReader(reader, System.Globalization.CultureInfo.CurrentCulture))
                {
                    csv.Configuration.RegisterClassMap<ProductMap>();
                    List<Product> records = csv.GetRecords<Product>().ToList();
                    return records;
                }
            }
Run Code Online (Sandbox Code Playgroud)

我在最后一行中收到错误,其中 1 个字段中有双引号。如果我想转义/删除双引号,我需要做什么设置?

我还尝试替换映射文件中的双引号,但双引号显示在错误的位置。双引号位于“测试”一词上,但在数据中它们显示在“更新”一词上。

在此输入图像描述

进而

在此输入图像描述

我可以在映射文件中用空字符串替换双引号,但是还有其他解决方案吗?

c# double-quotes csvhelper

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

内容搜索,重建索引错误

我是Sitecore的新手,并且有一项任务是使用SiteCore 7 API构建搜索.在搜索结果查询执行时收到以下错误.

System.ArgumentNullException: Value cannot be null. Parameter name:
fieldNameTranslator
Run Code Online (Sandbox Code Playgroud)

从以下行引发的错误

IQueryable<SearchResultItem> results = context.GetQueryable<SearchResultItem>();
Run Code Online (Sandbox Code Playgroud)

堆栈说

Sitecore.ContentSearch.Linq.Solr.SolrIndexParameters..ctor(IIndexValueFormatter valueFormatter, IFieldQueryTranslatorMap`1 fieldQueryTranslators, FieldNameTranslator fieldNameTranslator, IExecutionContext[] executionContexts) +284
Run Code Online (Sandbox Code Playgroud)

我已登录到内容管理系统,在索引管理器中我正在尝试重建sitecore_web_index的索引,但是我收到以下错误

Job started: Index_Update_IndexName=sitecore_web_index|#Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Sitecore.Exceptions.ProviderConfigurationException: Solr operations unavailable. Please check your global.asax,
Run Code Online (Sandbox Code Playgroud)

c# lucene solr sitecore sitecore7

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

反应从firebase读取,得到错误

我正在尝试从Firebase集合中获取数据,但出现错误,有人可以帮忙吗?我收到此错误

错误:找不到来自react-redux的上下文。如果您使用的是react-redux v6 v3。需要react-redux-firebase版本。请查看v3迁移指南:

这是我的代码。

import React, { Component } from 'react'
import Notifications from './Notifications';
import ProjectList from '../projects/ProjectList';
import {connect} from 'react-redux';
import {firestoreConnect} from 'react-redux-firebase';
import {compose} from 'redux';
import { firebaseConnect, isLoaded, isEmpty } from 'react-redux-firebase'

class Dashboard extends Component {
render() {

return (
  <div className="dashboard container">
    <div className="row">
        <div className="col s12 m6"><ProjectList projects={this.props.projects}></ProjectList></div>
        <div className="col s12 m5 offset-m1"><Notifications></Notifications></div>
    </div>
  </div>
)
}
}
const mapStateToProps = (state) =>
{
  console.log(state);
 return ({projects:state.projectReducer.projects}) …
Run Code Online (Sandbox Code Playgroud)

firebase reactjs

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

Sitecore Index Rebuild,删除现有索引文件

我正在使用Sitecore 7搜索,我在代码中重建索引,我已经为此创建了一个代理,工作正常,索引重建需要15秒,我注意到索引重建时我无法搜索任何内容,搜索给了我0结果,我认为重建索引时会从索引文件夹中删除索引文件,是吗?如何在不删除现有索引文件的情况下重建索引?

lucene indexing sitecore sitecore7

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

Azure Webjob 按计划运行选项缺失

我正在尝试从 Visual studio 2015 控制台应用程序发布 Azure webjob,在 azure webjob 运行模式下缺少“按计划运行”选项,我还安装了 VS 2017,但仍然缺少选项。

我需要安装其他东西吗?我还安装了 Nuget 包“Microsoft.Web.WebJobs.Publish”,但没有成功。

azure azure-webjobs visual-studio-2015

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

Javascript显示货币而不四舍五入

我在 javascript 中显示货币值,我想用每个值显示 $,我也想用 ,(逗号)表示千位,但我不想四舍五入小数点后的数字,而且我也没有固定的限制许多数字将在小数点后。

它是为 en-AU

例如

45000 -> 45,000 美元

3.6987 -> 3.6987 美元

3 -> 3 美元

4.00 -> 4.00 美元

是否有任何内置的 JavaScript 方法或库可以帮助实现这一目标?

javascript currency

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