问题列表 - 第28091页

企业库日志记录未从ASP.NET登录到事件日志

我花了一天时间尝试使Ent Lib Logging工作并将任何内容记录到数据库或事件日志中.我有一个具有相同Ent Lib配置的Web应用程序和控制台应用程序,但只有控制台应用程序能够登录到事件日志.我尝试了所有权限,但我不知道我在做什么 - 哪些服务应该有什么.这是行不通的!

我读过这样的文章 http://imar.spaanjaars.com/275/logging-errors-to-the-event-log-in-aspnet-applications ,我想尝试给ASPNET帐户这些权限.我使用Windows 7,我找不到ASPNET用户帐户.那它在哪里?

这是从Ent Lib实用程序自动生成的配置文件,它仅适用于App.config,而不适用于web.config

<loggingConfiguration name="Logging Application Block" tracingEnabled="true"
    defaultCategory="General" logWarningsWhenNoCategoriesMatch="true"
    revertImpersonation="false">
    <listeners>
      <add source="Logger" formatter="Text Formatter" log="Application"
        machineName="" listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.FormattedEventLogTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
        traceOutputOptions="None" filter="All" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FormattedEventLogTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
        name="Formatted EventLog TraceListener" />
    </listeners>
    <formatters>
      <add template="Timestamp: {timestamp}&#xD;&#xA;Message: {message}&#xD;&#xA;Category: {category}&#xD;&#xA;Priority: {priority}&#xD;&#xA;EventId: {eventid}&#xD;&#xA;Severity: {severity}&#xD;&#xA;Title:{title}&#xD;&#xA;Machine: {machine}&#xD;&#xA;Application Domain: {appDomain}&#xD;&#xA;Process Id: {processId}&#xD;&#xA;Process Name: {processName}&#xD;&#xA;Win32 Thread Id: {win32ThreadId}&#xD;&#xA;Thread Name: {threadName}&#xD;&#xA;Extended Properties: {dictionary({key} - {value}&#xD;&#xA;)}"
        type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
        name="Text Formatter" />
    </formatters>
    <categorySources>
      <add …
Run Code Online (Sandbox Code Playgroud)

.net asp.net logging enterprise-library

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

如何在c#中滚动我自己的索引?

我需要一种更快的方法来创建索引文件.应用程序生成要编制索引的项目对.我目前将生成的每一对添加到已排序的字典中,然后将其写入磁盘文件.这种方法很有效,直到添加的项目数超过一百万,此时它会减慢到不可接受的程度.可以有多达300万个数据项被索引.我更喜欢避免使用数据库,因为我不想显着增加部署包的大小,现在不到一兆字节的一半.我尝试了Access,但它甚至比排序的字典慢 - 如果它有一个有效的批量加载实用程序然后可能工作,但我找不到这样的Access工具.

有没有更好的方法来推广我自己的索引?

c# indexing

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

PyQt:更改 QTableView 中复选框的对齐方式

我有一个QTableView带复选框,但复选框左对齐,我需要将其居中对齐。我试过这个,但“检查”功能有问题:

def drawCheck(self, painter, option, rect, state):
    textMargin = QtGui.QApplication.style().pixelMetric(QtGui.QStyle.PM_FocusFrameHMargin) + 1
    checkRect = QtGui.QStyle.alignedRect(option.direction, QtCore.Qt.AlignCenter, 
                 check(option, option.rect, QtCore.Qt.Checked).size(),
                QtCore.QRect(option.rect.x() + textMargin, option.rect.y(),
                option.rect.width() - (textMargin * 2), option.rect.height()))                           
    QtGui.QItemDelegate.drawCheck(self, painter, checkRect, state)
Run Code Online (Sandbox Code Playgroud)

什么是“检查”功能?如何在 PyQt 中重新实现 C++ 示例?

python checkbox pyqt alignment qtreeview

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

使用Boost进行单元测试时,您最喜欢/推荐的项目结构和文件结构是什么?

到目前为止我还没有使用过单元测试,我打算采用这个程序.TDD给我留下了深刻的印象,当然也想尝试一下 - 我几乎可以肯定它是要走的路.

Boost看起来是一个不错的选择,主要是因为它正在被维护.话虽如此,我应该如何实现一个工作和优雅的文件结构和项目结构?我在Win XP中使用VS 2005.我一直在谷歌搜索这个并且比开明更困惑.

c++ tdd boost unit-testing visual-studio

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

为什么这个HTML不起作用?

我在段落中有一个span文本块.在这个跨度块中,我有两个段落.在webkit上,浏览器正确呈现第一段,但在最后两段上失败回到浏览器默认设置.为什么?

<style type="text/css">

span.post-content {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 16px;
}

</style>

<p><span class="post-content"> Some text here <p/> From here text loses style and adopts browser default <p/> same here </span></p>
Run Code Online (Sandbox Code Playgroud)

这适用于所有浏览器,除了基于Webkit的浏览器:chrome和safari.

html css webkit

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

jQuery getScript和Google Maps API错误消息

我在加载google maps api时遇到了问题.

我用一个初始化地图的函数得到了我自己的对象,谷歌地图api通过jquery.getscript加载.但我总是在回调函数中收到错误消息:

var MyGMap = {
    GMapScriptURL: "http://maps.google.com/maps?file=api&v=2&async=2&key=",
    Map: null,
    Geocoder: null,
    InitiazlizeMaps: function () {
        if (GBrowserIsCompatible()) {
            this.Map = new GMap2(document.getElementById("map_canvas"));
            this.Map.setCenter(new GLatLng(37.4419, -122.1419), 13);
            this.Geocoder = new GClientGeocoder();
        }
    }
}

$(function(){
    var CurrentKey = "MY_KEY";

    $.getScript(MyGMap.GMapScriptURL + CurrentKey, function () {
        MyGMap.InitiazlizeMaps();
        // throws GMap2 is undefined

    });
});
Run Code Online (Sandbox Code Playgroud)

怎么了?为什么这不运行?

jquery google-maps

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

使用JavaScript设置隐藏的表单字段值,但请求仍为空

我尝试使用onclick事件设置一些隐藏的表单字段值.好吧,在我做了这样的事情之后:

document.getElementById('hidden_field').value = 123;
Run Code Online (Sandbox Code Playgroud)

我可以输入以下内容,使用firebug控制台输出值:

alert(document.getElementById('hidden_field').value);
Run Code Online (Sandbox Code Playgroud)

所以价值肯定是设定的.但是现在当我提交表单时,隐藏的字段值仍然是空的.

你知道什么是错的吗?

javascript forms

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

隐藏我的网站是用ASP.NET构建的

我在ASP.NET 3.5和C#中开发了一个Web应用程序.当我部署应用程序时,人们可以看到我正在使用ASP.NET的迹象.我如何做到这一点,以便任何看到我的网站的人都不会看到我使用的是ASP.NET?

.net html c# asp.net

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

C++ new&delete和函数

这对我来说有点不清楚......所以,如果我有一个功能:

char *test(int ran){
    char *ret = new char[ran];
    // process...
    return ret;
}
Run Code Online (Sandbox Code Playgroud)

然后多次调用它:

for(int i = 0; i < 100000000; i++){
   char *str = test(rand()%10000000+10000000);
   // process...

   // delete[] str; // do i have to delete it here?
}
Run Code Online (Sandbox Code Playgroud)

所以问题是,我必须delete[]为每次new[]通话使用吗?

c++ new-operator delete-operator

3
推荐指数
2
解决办法
2983
查看次数

.NET中的串口通信

我使用C#从串口接收数据,但存在一些问题.我是新手,所以我需要一些帮助.

  1. 首先,我想知道哪些函数是事件驱动的:

    ReadExisting()
    Read()
    Readbyte() 
    Readchar()
    ReadLine()
    Readto()
    
  2. 如何从该端口的输入流中获取所需的数据?

    我有静态大小的协议.我是否可以使用特殊字符来指定协议数据的限制,哪个适用于此?

  3. 我该如何处理这个异常:

    C#SerialPort System.ObjectDisposedException,安全句柄已在System.DLL中关闭

c# serial-port

4
推荐指数
2
解决办法
3876
查看次数