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
/// <summary> | |
/// Converts an array list to a string. | |
/// </summary> | |
/// <param name="ar">Array list</param> | |
/// <returns>Comma deliminated string</returns> | |
public static string ArrayListToString(ArrayList ar) | |
{ | |
return ArrayListToString(ar, ','); | |
} | |
/// <summary> |
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
/// <summary> | |
/// Create a hyperlink that is truncated if the text is too long | |
/// </summary> | |
/// <param name="url">Page to link to</param> | |
/// <param name="text">Text to show</param> | |
/// <param name="length">Truncate text at this length</param> | |
/// <returns>An anchor, truncated if appropriate</returns> | |
public static string TruncatedHyperLink(object url, object text, int length) | |
{ | |
if (url == DBNull.Value || text == DBNull.Value) return String.Empty; |
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
public static string UrlEncode(object input) | |
{ | |
string output = string.Empty; | |
if (input != DBNull.Value) | |
{ | |
output = HttpUtility.UrlEncode(input.ToString()); | |
} | |
return output; | |
} |
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
/// <summary> | |
/// Go to the specified week in a given year | |
/// </summary> | |
/// <param name="year">Which year</param> | |
/// <param name="week">Which week in year</param> | |
/// <returns>Date the week falls on</returns> | |
public static DateTime GoToWeek(int year, int week) | |
{ | |
// use the current culture | |
System.Globalization.CultureInfo ci = System.Threading.Thread.CurrentThread.CurrentCulture; |
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 FormatFileSize(long size) | |
{ | |
return FormatFileSize((double)size); | |
} | |
private string FormatFileSize(double size) | |
{ | |
string output = string.Empty; | |
string append = string.Empty; | |
string format = string.Empty; | |
if (size < 1000) |
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
public static string ExtensionFromContentType(string contenttype) | |
{ | |
string output = ".jpg"; | |
switch (contenttype) | |
{ | |
case "image/gif": | |
output = ".gif"; | |
break; | |
case "image/png": | |
output = ".png"; |
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
rem download fastcgi from http://www.iis.net/expand/FastCGI | |
cscript %windir%\system32\inetsrv\fcgiconfig.js -add -section:"PHP" ^ | |
-extension:php -path:"C:\PHP\php-cgi.exe" |
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
$("a.dialog").click( | |
function(e) { | |
e.preventDefault(); | |
var title = this.title; | |
if (!title.length) title = $(this).text(); | |
// create a dialog box and set the iframe to the linked page | |
var dialog = $("<div><iframe /></div>") | |
.find("iframe").attr({ "frameBorder": 0, "width": "100%", "height": "100%", "scrolling": "auto", "src": this.href }).end() | |
.dialog( | |
{ |
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
$("a.thickbox").click( | |
function(e) { | |
e.preventDefault(); | |
var link = this; | |
var $loading = $("<div></div>").dialog({ title: "Loading..." }); | |
$("<img>").attr({ "src": this.href }).css({ "padding": 0 }).load( | |
function() { | |
$loading.dialog("destroy").remove(); | |
var maxWidth = $(window).width() - 20; | |
var maxHeight = $(window).height() - 20; |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"> | |
<title>Site | Page 1</title> | |
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> | |
<script type="text/javascript"> | |
$( function() { | |
$("body").append("<p>Hello from jQuery!</p>"); | |
}); |
OlderNewer