我使用System.Speech在C#中编写了一个用于语音识别的应用程序,它可以在Windows 7上正常工作.但是我创建了可以在Windows 2003(x86)上运行的相同应用程序.
我的编程环境:Windows 7 x64 Pro Visual Studio 2008
为了在我的编程环境中开发这个应用程序,我安装了:
1.Microsoft语音平台 - 服务器运行时(版本10.1)(x86)
2.Microsoft语音平台 - 软件开发套件(SDK)(版本10.1)(x86)
3.Microsoft语音平台 - 服务器运行时语言(版本10.1)
(此处为en-GB安装了SR)
在我的程序而不是System.Speech中,我使用了Microsoft.Speech.Recognition;
从SDK文档中粘贴此代码:
using Microsoft.Speech.Recognition;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
// Create a new SpeechRecognitionEngine instance.
sre = new SpeechRecognitionEngine();
// Create a simple …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用WCF客户端连接到基于Java的Web服务
证书我已经提供(自签名)在SOAPUI中完美地工作.
这是我的设置:
但是,我在使用WCF客户端时遇到问题.
我的app.config
<bindings>
<customBinding>
<binding name="Example_TestBinding">
<security defaultAlgorithmSuite="TripleDesRsa15"
authenticationMode="MutualCertificate"
requireDerivedKeys="false"
includeTimestamp="false"
messageProtectionOrder="SignBeforeEncrypt"
messageSecurityVersion="WSSecurity10WSTrust13WSSecureConversation13WSSecurityPolicy12BasicSecurityProfile10"
requireSignatureConfirmation="false">
<localClientSettings detectReplays="true"/>
<localServiceSettings detectReplays="true"/>
</security>
<textMessageEncoding messageVersion="Soap11"/>
<httpsTransport authenticationScheme="Basic" manualAddressing="false" maxReceivedMessageSize="524288000" transferMode="Buffered"/>
</binding>
</customBinding>
</bindings>
<client>
<endpoint
address="https://blabla.hana.ondemand.com/Example_Test"
binding="customBinding"
bindingConfiguration="Example_TestBinding"
contract="WebServiceTest.Example_Test"
name="Example_Test"
/>
</client>
Run Code Online (Sandbox Code Playgroud)
使用Keystore Explorer我从JKS导出两个证书:
网络服务电话:
var client = new Example_TestClient();
client.ClientCredentials.UserName.UserName = "user";
client.ClientCredentials.UserName.Password = "pass";
X509Certificate2 certClient = new X509Certificate2(certClientPath, certClientPassword);
client.ClientCredentials.ClientCertificate.Certificate = certClient;
X509Certificate2 certService= new X509Certificate2(certServicePath);
client.ClientCredentials.ServiceCertificate.DefaultCertificate = certService;
var response = client.Example_Test(requestObj);
Run Code Online (Sandbox Code Playgroud)
请求完全到达服务器,但似乎WCF不理解响应,因为我得到此异常:
"The …Run Code Online (Sandbox Code Playgroud) 我在我的应用层中定义了这个映射:
public IList<ProfessionDTO> GetAllProfessions()
{
IList<Profession> professions = _professionRepository.GetAll();
Mapper.CreateMap<Profession, ProfessionDTO>();
Mapper.CreateMap<IList<Profession>, IList<ProfessionDTO>>();
IList<ProfessionDTO> professionsDto = Mapper.Map<IList<Profession>, IList<ProfessionDTO>>(professions);
return professionsDto;
}
Run Code Online (Sandbox Code Playgroud)
Proffesion实体
public class Profession
{
private int _id;
private string _name;
private Profession(){} // required by nHibernate
public Profession(int id, string name)
{
ParameterValidator.NotNull(id, "id is required.");
ParameterValidator.NotNull(name, "name is required.");
_id = id;
_name = name;
}
public string Name
{
get { return _name; }
}
public int Id
{
get { return _id; }
}
} …Run Code Online (Sandbox Code Playgroud) 在我的大多数项目中,我使用nHibernate + Fluent映射,最近我开始使用Dapper来查看是否可以将读取操作移动到它.
我遵循DDD方法,所以我的域实体没有任何公共设置器.例如:
public class User
{
private int _id;
private string _name;
private IList<Car> _carList;
protected User(){} // Fluent Mapping
public User(string id, string name)
{
// validation
// ...
_id = id;
_name = name;
}
public int Id{ get {return _id;} }
public string Name { get {return _name;} }
public IList<Car> CarList { get {return _carList;}}
}
public class Car
{
private int _id;
private string _brand;
protected Car(){} // Fluent Mapping
public Car(string id, …Run Code Online (Sandbox Code Playgroud) c# orm domain-driven-design dapper fluent-nhibernate-mapping
我在 Mono 3.2.8(Ubuntu 14.04 + Apache2.4.7 + mod_mono)上运行 ASP.NET MVC 3 站点。我注意到有两个进程占用了所有 CPU。运行 htop:

我也不断地在我的日志中得到这个条目:
WARNING: WebConfigurationManager's LRUcache evictions count reached its max size
Cache Size: 100 (overridable via MONO_ASPNET_WEBCONFIG_CACHESIZE)
------------
[Fri Jun 05 06:49:53.446031 2015] [mpm_prefork:notice] [pid 21501] AH00171: Graceful restart requested, doing restart
mod-mono-server received a shutdown message
mod-mono-server received a shutdown message
mod-mono-server received a shutdown message
mod-mono-server received a shutdown message
mod-mono-server received a shutdown message
Run Code Online (Sandbox Code Playgroud)
知道是什么原因造成的吗?
我有这张桌子:
table1
+------+----------+-----------+----------+
| id | org1 | org2 | org3 |
+------+----------+-----------+----------+
| 1 | HR | (NULL) | Staff |
+------+----------+-----------+----------+
| 2 | (NULL) | IT | Dev |
+------+----------+-----------+----------+
| 3 | (NULL) | (NULL) | Finance |
+------+----------+-----------+----------+
Run Code Online (Sandbox Code Playgroud)
我想将所有值都移到左边,所以最终结果是:
table1
+------+----------+-----------+----------+
| id | org1 | org2 | org3 |
+------+----------+-----------+----------+
| 1 | HR | Staff | (NULL) |
+------+----------+-----------+----------+
| 2 | IT | Dev | (NULL) |
+------+----------+-----------+----------+
| 3 | Finance …Run Code Online (Sandbox Code Playgroud) 这类似于我之前的问题: 从 Dropbox 上的公共共享文件夹下载图像
我有这段代码(简化版),需要从公共共享文件夹和所有子文件夹下载所有图像。
using Dropbox.Api;
using Dropbox.Api.Files;
...
// AccessToken - get it from app console
// FolderToDownload - https://www.dropbox.com/sh/{unicorn_string}?dl=0
using (var dbx = new DropboxClient(_dropboxSettings.AccessToken))
{
var sharedLink = new SharedLink(_dropboxSettings.FolderToDownload);
var sharedFiles = await dbx.Files.ListFolderAsync(path: "", sharedLink: sharedLink);
// var sharedFiles = await dbx.Files.ListFolderAsync(path: "", sharedLink: sharedLink, recursive: true);
// "recursive: true" throws: Error in call to API function "files/list_folder": Recursive list folder is not supported for shared link.
foreach (var entry in sharedFiles.Entries)
{
if …Run Code Online (Sandbox Code Playgroud) 我正在将 Azure Functions v3 从 迁移Newtonsoft.Json到System.Text.Json并尝试让camelCase 在全球范围内工作。
对于这些:
我能够在JsonSerializerOptions全局范围内显式传递或设置它(SignalR),但我无法为IAsyncCollector.
这是我的代码:
[FunctionName(nameof(SampleFunction))]
public async Task Run(
[ServiceBusTrigger(ServiceBusQueue.QueueA)] string json,
[ServiceBus(ServiceBusQueue.QueueB)] IAsyncCollector<Delivery> queueB,
[ServiceBus(ServiceBusQueue.QueueC)] IAsyncCollector<Driver> queueC,
ExecutionContext context)
{
// ... do some work
await queueB.AddAsync(objectB).ConfigureAwait(false);
// ... do some more work
await queueC.AddAsync(objectC).ConfigureAwait(false);
}
Run Code Online (Sandbox Code Playgroud)
objectB最终objectC乘坐服务巴士而不是骆驼箱。作为解决方法,我在接收函数上将属性名称设置为不区分大小写。
PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
PropertyNameCaseInsensitive = true
Run Code Online (Sandbox Code Playgroud)
知道如何使用IAsyncCollector驼峰案例进行序列化吗?
c# serialization azureservicebus azure-functions system.text.json
我有这段代码在标题中抛出错误:
using (var audioInput = AudioConfig.FromStreamInput(new PullAudioInputStream(new BinaryAudioStreamReader(new BinaryReader(File.OpenRead(audioFile))), AudioStreamFormat.GetCompressedFormat(AudioStreamContainerFormat.MP3))))
using (var recognizer = new SpeechRecognizer(config, sourceLanguageConfig, audioInput))
Run Code Online (Sandbox Code Playgroud)
audioFile是带有要转录的音频的 mp3 文件的路径。
我已经安装了适用于 Windows 的最新 GStreamer gstreamer-1.0-msvc-x86_64-1.17.2.msi并将其添加到用户的路径中并设置GSTREAMER_ROOT_X86。那没有用。
处理压缩音频是使用 GStreamer 实现的。出于许可原因,GStreamer 二进制文件未编译并与语音 SDK 链接。开发者需要安装多个依赖项和插件,请参阅在 Windows 上安装。Gstreamer 二进制文件需要位于系统路径中,以便语音 SDK 可以在运行时加载 gstreamer 二进制文件。如果语音 SDK 能够在运行时找到 libgstreamer-1.0-0.dll,则意味着 gstreamer 二进制文件位于系统路径中。
它说它将寻找libgstreamer-1.0-0.dll,它不再包含在最新版本(1.17.2)中,所以我回到gstreamer-1.0-x86-1.14.1,它确实有所需的 dll,但仍然得到同样的错误。
从 Visual Studio 2019 控制台,我可以调用该文件夹中包含的 exe 文件,因此我知道 PATH 设置正确。
有人知道缺少什么吗?
c# speech-recognition speech-to-text azure-cognitive-services
我一直在使用 SimpleInjector,并尝试正确注册所有命令处理程序。
这是我的代码:
public interface ICommand {}
public interface ICommandDispatcher
{
void Execute(ICommand command);
}
public class CommandDispatcher : ICommandDispatcher
{
private readonly Container container;
public CommandDispatcher(Container container)
{
this.container = container;
}
public void Execute(ICommand command)
{
var handlerType = typeof(ICommandHandler<>).MakeGenericType(command.GetType());
dynamic handler = container.GetInstance(handlerType);
handler.Handle((dynamic)command);
}
}
public interface ICommandHandler<in TParameter> where TParameter : ICommand
{
void Handle(TParameter command);
}
Run Code Online (Sandbox Code Playgroud)
public class UserCommandsHandler : ICommandHandler<CreateUser>
{
public void Handle(CreateUser message)
{
var user = new User(message.Email); …Run Code Online (Sandbox Code Playgroud) c# ×7
.net ×1
apache ×1
asp.net-mvc ×1
automapper ×1
c#-4.0 ×1
cqrs ×1
dapper ×1
dropbox ×1
dropbox-api ×1
dropbox-sdk ×1
dto ×1
ilist ×1
mod-mono ×1
mono ×1
mysql ×1
orm ×1
sdk ×1
soap ×1
sql ×1
wcf ×1
web-services ×1