小编kma*_*zek的帖子

通过XCC将XQuery xml元素作为外部变量传递给Marklogic

我们有一个相当简单的XQuery和Groovy代码如下.Xquery代码:

declare variable $criteria as element(criteria) external ;

<scopedInterventions>{
$criteria/equals/field
}</scopedInterventions>
Run Code Online (Sandbox Code Playgroud)

这是试图调用它的测试代码

def uri = new URI("xcc://admin:admin@localhost:8001")

def contentSource = ContentSourceFactory.newContentSource(uri)

def request = session.newModuleInvoke("ourQuery.xqy")
def criteria =
"""<criteria>
<equals>
<field>status</field>
<value>draft</value>
</equals>
</criteria>
"""

request.setNewVariable("criteria",ValueType.ELEMENT, criteria);

session.submitRequest(request).asString()
}
Run Code Online (Sandbox Code Playgroud)

我们在执行时遇到此错误:

引起:com.marklogic.xcc.exceptions.XQueryException:XDMP-LEXVAL:xs:QName("element()") - 无效的词汇值"element()"[Session:user = admin,cb = {default} [ ContentSource:user = admin,cb = {none} [provider:address = localhost/127.0.0.1:9001,pool = 1/64]] [客户端:XCC/5.0-3,服务器:XDBC/5.0-3] expr :xs:QName("element()")位于com.marklogic.xcc.impl.handlers.ServerExceptionHandler.handleResponse(ServerExceptionHandler.java:34)的com.marklogic.xcc.impl.handlers.EvalRequestController.serverDialog(EvalRequestController.java) :83)com.marklogic.xcc.impl.handlers.AbstractRequestController.runRequest(AbstractRequestController.java:84)at com.marklogic.xcc.impl.SessionImpl.submitRequestInternal(SessionImpl.java:373)at com.marklogic.xcc. impl.SessionImpl.submitRequest(SessionImpl.java:356)com.zynx.galen.dataaccess.MarkLogicUtilities.executeQueryWithMultipleXMLParameters(MarkLogicUtilities.groovy:52)at com.zynx.galen.repositories.ScopedInterventionService.getScopedInterventionsByCriteria(ScopedInterventionService.groovy:20)... 1 more

任何帮助都会受到高度赞赏.

xquery marklogic

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

如何使用Marshal.getActiveObject()获取已打开两个进程的正在运行的进程的2个实例

目前我的代码使用

SurferApp = Marshal.GetActiveObject("Surfer.Application") as Surfer.Application
Run Code Online (Sandbox Code Playgroud)

为了简单起见,我们可以将Surfer替换为每个人都知道的Word.现在让我说我有两个MS word应用程序正在运行,我想让它们都使用Marshal.GetActiveObject(),我怎样才能获得两个正在运行的实例并将每个实例与一个单独的对象相关联?

c#

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

ASP.NET Core 2.1 UseHttpsRedirection在IIS中不起作用

我将asp.net core 2.1 WebApi部署到IIS10。(IIS充当代理)

我在IIS中添加了SSL证书,并为不安全端口(8081)和安全端口(8082)进行了绑定。

但是,当我访问http:// localhost:8081 / api / values时,浏览器只会返回403 Forbidden,而不会将我重定向到https:// localhost:8082 / api / values

我的启动代码如下:

    public void ConfigureServices(IServiceCollection services)
    {
        services.AddMvc()
           .SetCompatibilityVersion(CompatibilityVersion.Version_2_1);

        services.AddHttpsRedirection(options=>
        {
            options.HttpsPort = 8082;
        });
    }


    public void Configure(IApplicationBuilder app, IHostingEnvironment env)
    {
        //app.UseForwardedHeaders();
        if (env.IsDevelopment())
        {
            app.UseDeveloperExceptionPage();
        }
        else
        {
            app.UseHsts();
        }

        app.UseHttpsRedirection();
        app.UseMvc();
    }
Run Code Online (Sandbox Code Playgroud)

c# iis asp.net-core

8
推荐指数
3
解决办法
3139
查看次数

MSBuild目标和Visual Studio 2012问题

我很难通过Webdeploy使用Visual Studio 2012 UI部署我的第三方非参考程序集.我有一个名为'libraries'的文件夹,其中包含一些程序集.通过我的*.csproj文件中的以下内容,我可以将Build Action设置为' ThirdPartyAssemblies ':

<ItemGroup>
  <AvailableItemName Include="ThirdPartyAssemblies">
    <Visible>false</Visible>
  </AvailableItemName>
</ItemGroup>
<Target Name="AfterBuild">
  <Message Text="Build | Third party assemblies" Importance="high" />
  <Copy DestinationFolder="$(OutputPath)" SourceFiles="@(ThirdPartyAssemblies)" SkipUnchangedFiles="true" />
</Target>
Run Code Online (Sandbox Code Playgroud)

这很好用; 当我构建时,程序集被复制到bin文件夹的根目录:-)现在我遇到了一个问题:我无法通过Webdeploy将这些文件发布到服务器上.我尝试了很多东西,看起来我找不到适合这个任务的MSBuild目标...使用Visual Studio 2010我可以使用:

<Target Name="MyTargetName">
  <Message Text="Deploy | Third party assemblies" Importance="high" />
  <Copy DestinationFolder="$(OutputPath)" SourceFiles="@(ThirdPartyAssemblies)" SkipUnchangedFiles="true" />
</Target>
<PropertyGroup>
  <OnAfterCopyAllFilesToSingleFolderForPackage>
    MyTargetName
  </OnAfterCopyAllFilesToSingleFolderForPackage>
</PropertyGroup>
Run Code Online (Sandbox Code Playgroud)

问题是; 该OnAfterCopyAllFilesToSingleFolderForPackage目标不再被称为: - /

在深入研究之后C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\Web\Microsoft.Web.Publishing.targets' file, I've also tried 'OnAfterCopyAllFilesToSingleFolderForMsdeploy,我却无法让它发挥作用.

任何人都可以告诉我我可以使用哪些目标将这些程序集复制到Package文件夹/带有Webdeploy的服务器?

为什么Visual Studio 2012没有将完整的bin文件夹复制到Package文件夹?

msbuild msbuild-task webdeploy msbuild-target visual-studio-2012

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

如何防止截止时间计时器调用已删除类中的函数?

我在一段现实代码中遇到问题,其中属于被删除类的函数被a调用boost::asio::deadline_timer,偶尔会导致分段错误.

我遇到的问题是删除deadline_timer是从同一个io_service上的另一个计时器运行的.删除第一个deadline_timer将触发对要运行的函数的最后一次调用,并出现boost::asio::error::operation_aborted错误.但是,这只能io_service在删除完成后在(相同)上进行调度,但到那时对象已被删除,因此不再有效.

所以我的问题是:我怎样才能防止这种情况发生?

以下是具有相同故障的简化示例:

//============================================================================
// Name        : aTimeToKill.cpp
// Author      : Pelle
// Description : Delete an object using a timer, from a timer
//============================================================================

#include <iostream>
#include <boost/function.hpp>
#include <boost/bind.hpp>
#include <boost/asio.hpp>
#include <boost/thread.hpp>

using namespace std;
using namespace boost;

struct TimeBomb
{
    bool m_active;
    asio::deadline_timer m_runTimer;

    TimeBomb(boost::asio::io_service& ioService)
    : m_active(true)
    , m_runTimer(ioService)
    {
        cout << "Bomb placed @"<< hex << (int)this << endl;
        m_runTimer.expires_from_now(boost::posix_time::millisec(1000));
        m_runTimer.async_wait(boost::bind(&TimeBomb::executeStepFunction, this, _1));
    }

    ~TimeBomb() …
Run Code Online (Sandbox Code Playgroud)

c++ boost-asio

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

MVVM数据网格绑定

我正在为我的项目使用MVVM,并且我正在尝试使用DataGrid将数据库中的表绑定.但是当我运行我的应用程序时,datagrid是空的.

MainWindow.xaml.cs:

 public MainWindow(){
        InitializeComponent(); 
        DataContext = new LecturerListViewModel()
    }
Run Code Online (Sandbox Code Playgroud)

MainWindow.xaml:

 <DataGrid AutoGenerateColumns="False" ItemsSource="{Binding Source=Lecturers}" >
            <DataGrid.Columns>
                <DataGridTextColumn Header="Name" Binding="{Binding Name}"/>
                <DataGridTextColumn Header="Surname" Binding="{Binding Surname}"/>
                <DataGridTextColumn Header="Phone" Binding="{Binding Phone_Number}" />
            </DataGrid.Columns>
 </DataGrid>
Run Code Online (Sandbox Code Playgroud)

LecturerListViewModel.cs:

public class LecturerListViewModel : ViewModelBase<LecturerListViewModel> 
{

    public ObservableCollection<Lecturer> Lecturers;
    private readonly DataAccess _dataAccess = new DataAccess();

    public LecturerListViewModel()
    {
        Lecturers = GetAllLecturers();
    }
Run Code Online (Sandbox Code Playgroud)

和ViewModelBase实现INotifyPropertyChanged.

Lecturer.cs

public class Lecturer
{
    public Lecturer(){}

    public int Id_Lecturer { get; set; }
    public string Name { get; set; }
    public string …
Run Code Online (Sandbox Code Playgroud)

c# wpf binding datagrid mvvm

7
推荐指数
3
解决办法
3万
查看次数

WPF MVVM ComboBox标签选择

我有一个ComboBox,它有一个声明的ComboBox.Items列表(换句话说,不是通过ItemsSource动态绑定).我使用ComboBoxItem.Content作为显示名称,使用ComboBoxItem.Tag作为相应的Id,如下所示.

如何获取所选项目的标签而不是内容?我试过了SelectedItemValuePath="Tag",但那不起作用.

    <ComboBox Visibility="{Binding Path=ShowOutpatientFields, Converter=   
        {StaticResource   
            boolTovisConverter}}" Grid.Row="5" Grid.Column="2" Margin="0,2,0,2"  
        Text="{Binding Path=NewCase.ServiceType, ValidatesOnDataErrors=true,  
        NotifyOnValidationError=true}" SelectedValuePath="Tag">
          <ComboBox.Items>
             <ComboBoxItem Content="Hospice" Tag="33" />
             <ComboBoxItem Content="Hospital Outpatient" Tag="36" />
             <ComboBoxItem Content="Hospital Inpatient Extension" Tag="128" />
             <ComboBoxItem Content="Maternity" Tag="52" />
          </ComboBox.Items>
    </ComboBox>
Run Code Online (Sandbox Code Playgroud)

c# wpf combobox mvvm

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

未知的项目类型GUID

我最近接管了乌克兰一家商店的Silverlight应用程序,并在打开csproj文件时遇到了问题.我检查了mztools在线编码器,以及谷歌搜索每个,但无法识别其中两个:

88A30576-7583-4F75-8136-5EFD2C14ADFF
4C25E9B5-9FA6-436c-8E19-B395D2A65FAF

我目前正在使用Visual Studio 2010 Express,如果这是相关的.
任何有关他们是什么或如何找出的见解将不胜感激.提前致谢!

c# silverlight visual-studio-2010

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

连接超时已过期.在登录后阶段过去了超时时间

在我的应用程序中,查询工作正常.对于单个选择查询,我收到以下错误.

System.Data.EntityException:基础提供程序在Open上失败.---> System.Data.SqlClient.SqlException:连接超时已过期.在登录后阶段过去了超时时间.在等待服务器完成登录过程并响应时,连接可能已超时; 或者在尝试创建多个活动连接时可能会超时.尝试连接到此服务器所花费的时间是 - [Pre-Login] initialization = 0; 握手= 13914; [登录]初始化= 0; 认证= 0; [登录后]完成= 1062; ---> System.ComponentModel.Win32Exception:等待操作超时

我已经运行了sqlprofiler来检测死锁,但没有找到.

我正在通过实体框架运行简单查询

任何帮助,将不胜感激

.net c# sql-server entity-framework

7
推荐指数
2
解决办法
2万
查看次数

将Autofac与SignalR一起使用时的范围错误

我正在尝试HttpContextBase在我的SignalR集线器中注入一个:

public class EventHub : Hub, IDisconnect
{
    private readonly HttpContextBase _httpContextBase;

    public EventHub(HttpContextBase httpContextBase)
    {
        _httpContextBase = httpContextBase;
    }

    [...]
}
Run Code Online (Sandbox Code Playgroud)

注册码如下所示:

private static void InitAutofac()
{
    var builder = new ContainerBuilder();

    var assembly = typeof (MvcApplication).Assembly;

    builder.RegisterControllers(assembly).PropertiesAutowired();
    builder.RegisterModule(new AutofacWebTypesModule());
    builder.RegisterFilterProvider();

    builder.RegisterAssemblyTypes(assembly)
        .Where(InterfaceBasedInjectedClasses())
        .AsImplementedInterfaces()
        .InstancePerLifetimeScope();

    builder.RegisterAssemblyTypes(assembly)
        .Where(InterfaceLessInjectedClasses())
        .InstancePerLifetimeScope();

    builder.RegisterType<SurvivalContainer>().InstancePerLifetimeScope();

    builder.RegisterType<EventHub>().InstancePerLifetimeScope();

    var container = builder.Build();

    DependencyResolver.SetResolver(new AutofacDependencyResolver(container));


    GlobalHost.DependencyResolver = new SignalR.Autofac.AutofacDependencyResolver(container);

    RouteTable.Routes.MapHubs();
}
Run Code Online (Sandbox Code Playgroud)

而我得到的错误是:

[DependencyResolutionException:从请求实例的作用域中看不到具有匹配'httpRequest'的标记的作用域.这通常表示注册为每HTTP请求的组件正被SingleInstance()组件(或类似场景)重新请求.在Web集成下,始终从DependencyResolver.Current或ILifetimeScopeProvider.RequestLifetime请求依赖项,从不从容器本身请求]

堆栈跟踪:

Autofac.Core.Lifetime.MatchingScopeLifetime.FindScope(ISharingLifetimeScope mostNestedVisibleScope) +160
Autofac.Core.Resolving.InstanceLookup..ctor(IComponentRegistration registration, IResolveOperation context, ISharingLifetimeScope mostNestedVisibleScope, IEnumerable`1 parameters) +57 …
Run Code Online (Sandbox Code Playgroud)

c# dependency-injection autofac asp.net-mvc-3 signalr

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