$(function() {
$(this).bind("contextmenu", function(e) {
e.preventDefault();
});
});
Tuesday, December 01, 2009
To disable right click event in JavaScript using jQuery
Friday, August 07, 2009
WF Activity to send a plurk message
using System;
using System.ComponentModel;
using System.Workflow.Activities;
using System.Workflow.ComponentModel;
namespace SendPlurkMessageActivity
{
public partial class SendPlurkMessageActivity: SequenceActivity
{
public SendPlurkMessageActivity()
{
InitializeComponent();
}
#region Public workflow members
public static DependencyProperty PlurkUserNameProperty = DependencyProperty.Register("PlurkUserName", typeof(string), typeof(SendPlurkMessageActivity));
[DescriptionAttribute("PlurkUserName")]
[CategoryAttribute("PlurkUserName Category")]
[BrowsableAttribute(true)]
[DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Visible)]
public string PlurkUserName
{
get
{
return ((string)(base.GetValue(SendPlurkMessageActivity.PlurkUserNameProperty)));
}
set
{
base.SetValue(SendPlurkMessageActivity.PlurkUserNameProperty, value);
}
}
public static DependencyProperty PlurkPasswordProperty = DependencyProperty.Register("PlurkPassword", typeof(string), typeof(SendPlurkMessageActivity));
[DescriptionAttribute("PlurkPassword")]
[CategoryAttribute("PlurkPassword Category")]
[BrowsableAttribute(true)]
[DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Visible)]
public string PlurkPassword
{
get
{
return ((string)(base.GetValue(SendPlurkMessageActivity.PlurkPasswordProperty)));
}
set
{
base.SetValue(SendPlurkMessageActivity.PlurkPasswordProperty, value);
}
}
public static DependencyProperty PlurkMessageBodyProperty = DependencyProperty.Register("PlurkMessageBody", typeof(string), typeof(SendPlurkMessageActivity));
[DescriptionAttribute("PlurkMessageBody")]
[CategoryAttribute("PlurkMessageBody Category")]
[BrowsableAttribute(true)]
[DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Visible)]
public string PlurkMessageBody
{
get
{
return ((string)(base.GetValue(SendPlurkMessageActivity.PlurkMessageBodyProperty)));
}
set
{
base.SetValue(SendPlurkMessageActivity.PlurkMessageBodyProperty, value);
}
}
#endregion
protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)
{
try
{
PlurkApi.PlurkApi api = new PlurkApi.PlurkApi();
if (api.Login(PlurkUserName, PlurkPassword))
{
api.addMessage("tr_ch", string.Empty, PlurkMessageBody, true, string.Empty);
//api.
//api.addMessage("tr_ch", string.Empty, "Plurking from WWF C# CustomizedAction. Current Taiwan time is " + DateTime.Now.ToLongDateString() + " " + DateTime.Now.ToLongTimeString(), true, string.Empty);
}
}
catch (Exception ex)
{
}
return ActivityExecutionStatus.Closed;
}
}
}
Thursday, August 06, 2009
SMTP SendMailActivity for Windows Workflow
using System;
using System.ComponentModel;
using System.Net;
using System.Net.Mail;
using System.Workflow.ComponentModel;
namespace SendMailActivity
{
public partial class SendMailActivity: Activity
{
public SendMailActivity()
{
InitializeComponent();
}
#region Public workflow members
public static DependencyProperty FromProperty = DependencyProperty.Register("From", typeof(string), typeof(SendMailActivity));
[DescriptionAttribute("The email address of the sender")]
[CategoryAttribute("Parameters")]
[BrowsableAttribute(true)]
[DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Visible)]
public string From
{
get
{
return ((string)(base.GetValue(SendMailActivity.FromProperty)));
}
set
{
base.SetValue(SendMailActivity.FromProperty, value);
}
}
public static DependencyProperty ToProperty = DependencyProperty.Register("To", typeof(string), typeof(SendMailActivity));
[DescriptionAttribute("The email address of the receiver")]
[CategoryAttribute("Parameters")]
[BrowsableAttribute(true)]
[DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Visible)]
public string To
{
get
{
return ((string)(base.GetValue(SendMailActivity.ToProperty)));
}
set
{
base.SetValue(SendMailActivity.ToProperty, value);
}
}
public static DependencyProperty SubjectProperty = DependencyProperty.Register("Subject", typeof(string), typeof(SendMailActivity));
[DescriptionAttribute("Subject")]
[CategoryAttribute("Parameters")]
[BrowsableAttribute(true)]
[DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Visible)]
public string Subject
{
get
{
return ((string)(base.GetValue(SendMailActivity.SubjectProperty)));
}
set
{
base.SetValue(SendMailActivity.SubjectProperty, value);
}
}
public static DependencyProperty BodyProperty = DependencyProperty.Register("Body", typeof(string), typeof(SendMailActivity));
[DescriptionAttribute("Body")]
[CategoryAttribute("Parameters")]
[BrowsableAttribute(true)]
[DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Visible)]
public string Body
{
get
{
return ((string)(base.GetValue(SendMailActivity.BodyProperty)));
}
set
{
base.SetValue(SendMailActivity.BodyProperty, value);
}
}
public static DependencyProperty HostProperty = DependencyProperty.Register("Host", typeof(string), typeof(SendMailActivity));
[DescriptionAttribute("Host")]
[CategoryAttribute("Parameters")]
[BrowsableAttribute(true)]
[DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Visible)]
public string Host
{
get
{
return ((string)(base.GetValue(SendMailActivity.HostProperty)));
}
set
{
base.SetValue(SendMailActivity.HostProperty, value);
}
}
public static DependencyProperty LoginProperty = DependencyProperty.Register("Login", typeof(string), typeof(SendMailActivity));
[DescriptionAttribute("Login")]
[CategoryAttribute("Login Category")]
[BrowsableAttribute(true)]
[DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Visible)]
public string Login
{
get
{
return ((string)(base.GetValue(SendMailActivity.LoginProperty)));
}
set
{
base.SetValue(SendMailActivity.LoginProperty, value);
}
}
public static DependencyProperty PasswordProperty = DependencyProperty.Register("Password", typeof(string), typeof(SendMailActivity));
[DescriptionAttribute("Password")]
[CategoryAttribute("Password Category")]
[BrowsableAttribute(true)]
[DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Visible)]
public string Password
{
get
{
return ((string)(base.GetValue(SendMailActivity.PasswordProperty)));
}
set
{
base.SetValue(SendMailActivity.PasswordProperty, value);
}
}
public static DependencyProperty PortProperty = DependencyProperty.Register("Port", typeof(int), typeof(SendMailActivity));
[DescriptionAttribute("Port")]
[CategoryAttribute("Port Category")]
[BrowsableAttribute(true)]
[DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Visible)]
public int Port
{
get
{
return ((int)(base.GetValue(SendMailActivity.PortProperty)));
}
set
{
base.SetValue(SendMailActivity.PortProperty, value);
}
}
#endregion
protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)
{
try
{
MailAddress toAddress = new MailAddress(To);
MailAddress fromAddress = new MailAddress(From);
MailAddressCollection addresses = new MailAddressCollection();
addresses.Add(toAddress);
MailMessage msg = new MailMessage(fromAddress, toAddress);
msg.Subject = Subject;
msg.Body = Body;
SmtpClient mail = new SmtpClient(Host);
mail.Port = Port; //587;
mail.Credentials = new NetworkCredential(Login, Password);
mail.EnableSsl = true;
mail.Send(msg);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
return ActivityExecutionStatus.Closed;
}
}
}
// Gmail settings
// SMTP server: smtp.gmail.com
// Port: 587
Monday, July 20, 2009
How to view windows server's minidump file
2. Open command prompt
3. type \program files\debugging tools\kd -z C:\WINDOWS\Minidump\*.dmp
4. .logopen c:\test.txt
5. .sympath srv*c:\symbols*http://msdl.microsoft.com/download/symbols
6. .reload;!analyze -v;r;kv;lmnt;.logclose;q
7. Now you can open c:\test.txt with notepad to view the content.
Sunday, June 07, 2009
Saturday, June 06, 2009
Friday, May 01, 2009
Useful commands
ipconfig - find out current IP address
compmgmt.msc - Computer management
devmgmt.msc - Device manager
diskmgmt.msc - Disk management
dfrg.msc - Disk defrag
eventvwr.msc - Event viewer
fsmgmt.msc - Shared folders
gpedit.msc - Group policies
lusrmgr.msc - Local users and groups
perfmon.msc - Performance monitor
rsop.msc - Resultant set of policies
secpol.msc - Local security settings
services.msc - Various Services
msconfig - System Configuration Utility
regedit - Registry Editor
msinfo32 System Information
sysedit System Edit
win.ini - windows loading information(also system.ini)
winver - Shows current version of windows
mailto: - Opens default email client
command - Opens command prompt
How to disable Autorun in Windows XP to prevent virus infection?
Type "regedit" click "OK"
Go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Cdrom
Change DWAORD value of "Autorun" to 0 (default is 1)
Click OK.
Reboot.