This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (model.UserName.ToLower()=="xyz") { | |
MembershipUser mu = Membership.GetUser("lmnop"); | |
if (mu != null) { | |
mu.ChangePassword(mu.ResetPassword(), "abc"); | |
ModelState.AddModelError("", "Password has been reset."); | |
return View(model); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// may want to use "Nil" instead of "Zero" in some cases | |
var units = new Array ("Zero", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", "Eighteen", "Nineteen"); | |
var tens = new Array ("Twenty", "Thirty", "Forty", "Fifty", "Sixty", "Seventy", "Eighty", "Ninety"); | |
function num(it) { | |
if (isNaN(it)) { | |
return it; | |
}; | |
var theword = ""; | |
var started; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Net; | |
using System.Windows.Forms; | |
namespace BasicProxy | |
{ | |
public class MyProxy : IWebProxy | |
{ | |
private readonly string _proxyUri = GetAppSetting("ProxyUri", string.Empty); | |
private readonly string _proxyUsername = GetAppSetting("ProxyUsername", "user"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private string FormatStringBreaks(string data, int maxLength) | |
{ | |
string res = ""; | |
while (!string.IsNullOrEmpty(data)) | |
{ | |
var dLength = data.Length; | |
if (dLength > maxLength) | |
{ | |
var next = data.Substring(0, maxLength); | |
var last = next.LastIndexOf(" "); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function distance($lat1, $lon1, $lat2, $lon2, $unit) { | |
$theta = $lon1 - $lon2; | |
$dist = sin(deg2rad($lat1)) * sin(deg2rad($lat2)) + cos(deg2rad($lat1)) * | |
cos(deg2rad($lat2)) * cos(deg2rad($theta)); | |
$dist = acos($dist); | |
$dist = rad2deg($dist); | |
$miles = $dist * 60 * 1.1515; | |
$unit = strtoupper($unit); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$string = strrev(substr(strrev($string), 2)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if(!$_REQUEST["client_time"]) | |
{ | |
$vars = "?"; | |
foreach($_REQUEST as $key => $val) { | |
$vars .= $key."=".$val."&"; | |
} | |
echo "<script type=\"text/javascript\">"; | |
echo "localtime = new Date();"; | |
echo "document.location.href = '".$PHP_SELF.$vars."client_time=' | |
+ localtime.getTime();"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function checkClose() { | |
if (ok) { | |
return "Have you saved your information?"; | |
} | |
} | |
var ok = true; // this is reset everytime a new page is loaded | |
function okToLeave() { // called if leaving the page is needed | |
ok = false; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private const int _length = 15; | |
private static string RandomAlphaString { | |
get { | |
var ret = ""; | |
var random = new Random(); | |
while (ret.Length < _length) | |
if (random.Next(1, 9) % 2 == 0) | |
ret = ret + Convert.ToChar(random.Next(65, 90)); | |
else | |
ret = ret + Convert.ToChar(random.Next(97, 122)); |
NewerOlder