我正在使用log4net,我将日志文件保存在AppData文件中,用于win XP/Vista等.
这是我的app.config文件到目前为止,我已经指定了名称softphone.log.Hoewver,我不知道如何指定文件的完整路径,因为每个用户将根据其用户名使用不同的路径.
<log4net>
<logger name="default">
<level value="DEBUG"/>
</logger>
<appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender">
<file value="softphone.log"/>
<appendToFile value="true"/>
<rollingStyle value="Size"/>
<maxSizeRollBackup value="10"/>
<maximumFileSize value="1MB"/>
<staticLogFileName value="true"/>
<layout type="log4net.Layout.PatternLayout">
<param name="ConversionPattern" value="%d [%t] %-5p %c %m%n"/>
</layout>
</appender>
</log4net>
Run Code Online (Sandbox Code Playgroud)
在我的源代码中,我可以通过执行以下操作获取路径:
System.Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)
Run Code Online (Sandbox Code Playgroud)
但是,我不能在我的app.config中使用上面的内容,如果我在我的系统上硬编码路径,那么路径将是:
C:\Documents and Settings\John\Application Data
Run Code Online (Sandbox Code Playgroud)
但是,这对每个客户来说都是不同的.那么有没有办法为app.config文件执行此操作?
非常感谢任何建议,
我想在填充 DataGridView 后动态添加一个按钮列。添加按钮列后可见,但是当我尝试循环遍历 DataGridView 行时,每个单元格中的按钮均为空。
var buttonCol = new DataGridViewButtonColumn();
buttonCol.Name = "ButtonColumnName";
buttonCol.HeaderText = "Header";
buttonCol.Text = "Button Text";
dataGridView.Columns.Add(buttonCol);
foreach (DataGridViewRow row in dataGridView.Rows)
{
var button = (Button)row.Cells["ButtonColumnName"].Value;
// button is null here!
}
Run Code Online (Sandbox Code Playgroud) 是否有任何JavaScript库可用于涉及700多个数字的计算?另外,C++中的同样的东西怎么样?
它说,在一本书中
类Name具有姓氏和名字的属性.
地址继承自Name,并具有街道号,街道名称,城市,州,邮政编码的附加属性.
这似乎与其他情况不同
猫继承自动物,而猫则是"动物".
对于良好的对象设计,这是"必须"关系还是强制性的?地址应该继承姓名吗?
更新:因为一些用户要求提供源: alt文本http://img192.imageshack.us/img192/8903/learningrubyp133smaller.png
类型库声明由应用程序或动态链接库 (DLL) 公开的类、接口、常量和过程。类型库通常是程序文件中的资源;它也可以是扩展名为 .tlb 或 .olb 的独立二进制文件。
那么是否有可能某些 DLL 仍然公开接口而没有被声明为 TypeLib。
实际上,我试图从 oleview 打开一个 dll 并显示错误消息“错误加载类型库”。
根据我的理解,如果我们有从 DLL 公开的接口,那么它应该由 oleview 打开,否则它不能有公开的接口或函数。
任何可能我们有dll暴露接口并且仍然无法被Oleview查看的可能性。
在我看来,我有这个:
<TextBlock Text="{Binding Title}"/>
Run Code Online (Sandbox Code Playgroud)
它绑定到我的ViewModel的Title属性,这很简单,效果很好:
private string _title;
public string Title
{
get
{
return _title;
}
set
{
_title = value;
OnPropertyChanged("Title");
}
}
Run Code Online (Sandbox Code Playgroud)
但是,我的ViewModel还具有属性"FormFields",它是一个包含许多其他UserControl的StackPanel:
private StackPanel _formFields;
public StackPanel FormFields
{
get
{
return _formFields;
}
set
{
_formFields = value;
OnPropertyChanged("FormFields");
}
}
Run Code Online (Sandbox Code Playgroud)
如何从我的视图中绑定它?
在ASP.NET中有一个PlaceHolder元素,我正在寻找具有相同功能的东西,例如
PSEUDO代码:
<PlaceHolder Content="{Binding FormFields}"/>
Run Code Online (Sandbox Code Playgroud) 我搜索过,无法找到有关它是什么以及如何计算的信息.
我不知道为什么这个问题被否决了.是不是很清楚和编程有关?或者我应该问:
# Or you can compute the running CRC:
$crc = 0;
$crc = Archive::Zip::computeCRC32( 'abcdef', $crc );
$crc = Archive::Zip::computeCRC32( 'ghijkl', $crc );
Run Code Online (Sandbox Code Playgroud)
这到底发生了什么?
当我在我的CSS中使用它来获得方形子弹时:
li { list-style-type: square; }
Run Code Online (Sandbox Code Playgroud)
它也影响所有编号的列表,因为它们都使用 <li>
上下文位于shareh richhtmlfield控件中.
有没有解决方法或让Microsoft没有正确实现编号列表?
我有一个C++/CLI项目,它使用CWinFormsControl和CWinFormsView在我的MFC视图中创建.NET控件.要做到这一点,我需要#include"afxwinforms.h".
当我在项目上运行代码分析时,我总是得到关于我所包含的一些MFC类的警告.例子:
3>Running Code Analysis...
3>c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\afxwinforms.h(87) : warning: CA1704 : Microsoft.Naming : In method 'CWin32Window::CWin32Window(HWND__*)', correct the spelling of 'Wnd' in parameter name 'hWnd' or remove it entirely if it represents any sort of Hungarian notation.
3>c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\afxwinforms.h(87) : warning: CA1704 : Microsoft.Naming : In method 'CWin32Window::CWin32Window(HWND__*)', correct the spelling of 'h' in parameter name 'hWnd' or remove it entirely if it represents any sort of Hungarian notation.
3>warning: CA1051 : Microsoft.Design : …Run Code Online (Sandbox Code Playgroud) mfc code-analysis c++-cli suppress-warnings visual-studio-2008
假设我有这个代码
<form action="#" method="get">
<p>
<label for="name">Name:</label>
<input type="text" name="name" />
</p>
<p>
<input type="submit" />
</p>
</form>
Run Code Online (Sandbox Code Playgroud)
使用p对元素进行分组是否合乎逻辑?因为我的老师(再次......我知道......:P)告诉我,p应该仅用于段落,而我应该使用div,但正如我所看到的,p被广泛使用,几乎无处不在.
我能想到的最后一种可能性是<br />,我认为这是最糟糕的方式.
那么哪一个最好用
<div><p><br /> 在末尾