Skip to content

Instantly share code, notes, and snippets.

System.setProperty("http.proxyHost", "localhost"); System.setProperty("http.proxyPort", "8888");
System.setProperty("https.proxyHost", "localhost"); System.setProperty("https.proxyPort", "8888");
ServicePointManager.Expect100Continue = false;
@iraSenthil
iraSenthil / gist:856709
Created March 5, 2011 20:56
Slider Control
<Slider Name="slider1" Minimum="100" Maximum="100" Value="500" />
@iraSenthil
iraSenthil / gist:877740
Created March 19, 2011 19:36
LinkParser
$WshShell = New-Object -ComObject Wscript.Shell
$items = Get-ChildItem
foreach($file in $items)
{
$shortcut = $WshShell.CreateShortcut($file.FullName)
#::--AHK::D:\Tools\AutoHotKey
"::" + "--" + $file.Name.Replace($file.Extension,"") + "::" + $shortcut.TargetPath
}
@iraSenthil
iraSenthil / gist:877936
Created March 20, 2011 00:13
;Auto type Master Password by sending AutoType command to KeePass
;Auto type Master Password by sending AutoType command to KeePass
;Call method CheckPassword every 2 second
SetTimer, CheckPassword, 2000
CheckPassword:
{
IfWinExist, Password Required
{
IfWinExist Open Database - Senthil.kdbx
@iraSenthil
iraSenthil / gist:882670
Created March 23, 2011 05:29
Use caps lock for Arrow movement
Capslock::
{
Gui, 93:+Owner ; prevent display of taskbar button
Gui, 93:Show, y-99999 NA, Enable nav-hotkeys
KeyWait, Capslock ; wait until the Capslock button is released
Gui, 93:Cancel
Return
}
#IfWinExist, Enable nav-hotkeys
@iraSenthil
iraSenthil / gist:885996
Created March 24, 2011 22:00
throw vs throw ex
static void Main(string[] args)
{
try
{
ParseIntGood();
//ParseIntBad();
}
catch (Exception ex)
{
Console.WriteLine(ex);
@iraSenthil
iraSenthil / gist:897120
Created March 31, 2011 19:56
const vs readonly
//Error
const string MessageTrailer = UTF8Encoding.UTF8.GetString(new byte[] { 0x1c, 0x0d });
//No error
readonly string MessageTrailer = UTF8Encoding.UTF8.GetString(new byte[] { 0x1c, 0x0d });
@iraSenthil
iraSenthil / gist:926418
Created April 18, 2011 22:36
UltraWinGrid ActiiveRow default selection
void LoadGrid(List<ViewModel> viewModels)
{
bindingSource.Clear();
foreach (var model in viewModels)
bindingSource.Add(model);
}
void LoadGrid(List<ViewModel> viewModels)
{
bindingSource.Clear();
@iraSenthil
iraSenthil / gist:930152
Created April 20, 2011 01:35
Each thread has a separate stack
static void Main(string[] args)
{
//Thread has separate call stack
Thread newThread = new Thread(()=> Print(5));
newThread.Start();
Print(3);
Console.ReadLine();
}