Wednesday

to debug javascript (errors :) ) in internet explorer

you can use debugger; directive to step into default javascript debugger (visual studio 2005)
or you can create debugger window and paste variables there:
var dbgwin;
dbgwin=window.open("", "Debug", "left=0,top=0,width=300,height=700,scrollbars=yes," +"status=yes,resizable=yes");
function log(msg){
dbgwin.document.write("<br>"+msg);
}

log('Started');


more...

Read userprofile environment variable containing userprofile path in dot.NET

Environment.GetEnvironmentVariable("USERPROFILE")
more...

.etl file extension is used by standart windows performance monitoring

It's binary file
Run :tracerpt.exe your.etl from command line and your file will be processed to readable csv file and text summary.
or tracert.exe /? to view help information:


>tracerpt /?
Microsoft TraceRpt.Exe (5.1.2600.2180)
Microsoft Corporation. All rights reserved.

Tracerpt processes binary Event Trace Session log files or real-time streams from instrumented Event Trace providers and creates a report or
a text (CSV) file describing the events generated.

Usage:
tracerpt { <filename [filename ...]> | -rt <session_name [session_name ...]> } [options]

Parameters:
<filename [filename ...]> Event Trace log file to process.

Options:
-? Displays context sensitive help.
-o [filename] Text (CSV) output file. Default is dumpfile.csv.
-summary [filename] Summary report text file (CSV) file. Default is summary.txt.
-report [filename] Text output report file. Default is workload.txt.
-rt <session_name [session_name ...]> Real-time Event Trace Session data source.
-config <filename> Settings file containing command options.
-y Answer yes to all questions without prompting.

Examples:
tracerpt logfile1.etl logfile2.etl -o -report
tracerpt logfile.etl -o logdmp.csv -summary logdmp.txt -report logrpt.txt
tracerpt -rt EVENT_SESSION_1 EVENT_SESSION_2 -o logfile.csv



more...

Monday

C# Query string .net Parsing.

Instead for splitting string with & and = you can use HttpUtility class to split query string into NameValueCollection:
Private responseHash As NameValueCollection = New NameValueCollection()
responseHash = HttpUtility.ParseQueryString(ServerRersponse)
'than use it as usual
responseHash("MErrMsg")

Read query string parameters from javascript

Read query string parameters from javascript.
Here is script demonstrating it:
var qsParm = new Array();
function qs() {
var query = window.location.search.substring(1);
var parms = query.split('&');
for (var i=0; i<parms.length; i++) {
var pos = parms[i].indexOf('=');
if (pos > 0) {
var key = parms[i].substring(0,pos);
var val = parms[i].substring(pos+1);
qsParm[key] = val;
}
}
}

Sunday

Post to your blog at blogger.com from gVIM.

Tested on windows only.
Requirements:
1.python installed.
2. Google Data APIs - gdata-python-client
can be downloaded from here : http://gdata-python-client.googlecode.com/files/gdata.py-1.0.10.latest.zip

Installation :
1.Install python
2.Download gdata-python-client unpack and run "setup.py install"
3.download bg01.zip unpack bg.py and place in any folder mentioned in %PATH%
4. add this line to your _vmrc file :
nnoremap <Leader>blog :! bg.py --f %:p --u my@email.com --p inline<cr>
where my@email.com is your email registered on blogger.com

--p inline - means that password will be asked on every posting to blog , you can specify it in this line if you want.
Than script will not be asking every time.
nnoremap <Leader>blog :! bg.py --f %:p --u my@email.com --p mypassword<cr>

Using:
When you want to post current file to blog : just hit '\blog' enter password and new blog entry will be created.
I added post here how to create blog with syntax-highlighted source code.
Please leave a word or bug :) or questions,concerns,comments,jockes here

more...

Wednesday

How to blog source code from gVim

you have to :
1.add
let html_use_css = 1
to your _vimrc

2.add these style (depends on your current color scheme) to blog template


<style type="text/css">
<!--
.Statement { color: #a0ffa0; }
.Comment { color: #507080; }
.StorageClass { color: #a0a0ff; background-color: #103040; }
.Type { color: #a0a0ff; }
.Conditional { color: #a0ffa0; background-color: #103040; }
.Constant { color: #00cdcd; background-color: #103040; }
.pre { font-family: monospace; color: #e0eee0; background-color: #103040; }
.code { font-family: monospace; color: #e0eee0; background-color: #103040; }
-->
</style>



3.Use :TOhtml command for create html file from selected part of source code.
4.Install script from here and Use \blog command calling python script to post file on your blog.

How to create custom event in System.Web.UI.UserControl (C#):

How to create custom event in System.Web.UI.UserControl (C#):


//0.define delegate:
public delegate void ToolBarClick(string command);

//1. in control declare instance:
public ToolBarClick Click;

//and raiser:
protected void rpt_ToolBarAction_ItemCommand(object source, RepeaterCommandEventArgs e){
if (Click!=null){
Click(e.CommandArgument.ToString());
}
}

//2. On page add handler:
protected void Page_Load(object sender, EventArgs e)
{
ToolBar1.Click = new ToolBarClick(ToolBar_Click);

//and event function:
protected void ToolBar_Click(string s)
{

test smtp server with powershell

Send-MailMessage -SMTPServer smtp.domain.com -To [email protected] -From [email protected] -Subject "This is a test email" -Body ...