This file contains 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 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 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 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 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); | |
} | |
} |
OlderNewer