event log
by HHBL on Jun.30, 2010, under 开发技术
#using <System.dll>
using namespace System;
using namespace System::Diagnostics;
using namespace System::Threading;
int main()
{
// Create the source, if it does not already exist.
if ( !EventLog::SourceExists( "MySource" ) )
{
//An event log source should not be created and immediately used.
//There is a latency time to enable the source, it should be created
//prior to executing the application that uses the source.
//Execute this sample a second time to use the new source.
EventLog::CreateEventSource( "MySource", "MyNewLog" );
Console::WriteLine( "CreatingEventSource" );
// The source is created. Exit the application to allow it to be registered.
return 0;
}
// Create an EventLog instance and assign its source.
EventLog^ myLog = gcnew EventLog;
myLog->Source = "MySource";
// Write an informational entry to the event log.
myLog->WriteEntry( "Writing to event log." );
}
上面代码摘自MSDN: http://msdn.microsoft.com/en-us/library/system.diagnostics.eventlog.aspx
前两天需要使用一个event log来记录访问日志和警告信息,于是在网上找了下,但只找到了.net版的,于是那就.net吧
由于项目中只有这个模块需要使用.net,于是把这个模块做成一个了lib,提供了log(char*) 接口
具体实现就是把main函数换换 具体就不列出来了
这个有一点要注意到是CreateEventSource函数,相当于打开文件,调用一次后这个source就使用了对应的log文件,后面除非重启了才会改变。
7月不空虚哦
by HHBL on Jun.25, 2010, under 日志
好吧 记录下最近感兴趣的小玩意
呃….
1. 魔方
话说我之前玩的难道真的才被人转了几圈 ,转多了就转不回来了
呃…不小心看到隔壁一个贱人在玩4阶的…哥玩了下才知道智商下降的很厉害
2. python
呃…话说一年前听说的,还玩了下,最近空虚的紧,学学新东西换换血
再不学点新东西就成木乃伊了
3. 炒股
话说这是有钱人的游戏,之前还差点被我姐的话诱惑进去了,还给了我 一个户头
不过我最多也就在虚拟的平台玩过…不曾经历惊心动魄
最近某人一番话又让我燃起了对钞票游戏的欲火
4. 看书
话说很久很久没完整地看过一本书了
端午在家无聊得很泡在新华书店
该更新下技术了,还有巩固基础知识(设计模式、php、linux内核、云云…还有经济学的也貌似蛮有意思的)
5. Power Shell
话说是上回装WIN7的时候发现附件里多了个Power Shell
看了下入门指南…自称很强大..用了下可以支持linux下的一些命令确实有点惊喜
后来神奇的发现公司XP也有装
于是今天收到个小任务,批量把子目录下的AVI文件的文件名从xxx0.avi转成 xxx1.avi
竟然..竟然~~一句话就搞定了! 下面来见识下吧
cd “\\172.16.15.27\ssMedia\”
get-childItem *\*.avi | rename-item -newname { $_.name -replace ’0.AVI’,’1.AVI’ }
好吧,下次要处理类似的任务可以毫不犹豫的选择power shell了!
Hello world!
by HHBL on Jun.20, 2010, under 日志
Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!