<script type='text/javascript' src='swfobject.js'></script>
<div id='mediaspace'>
This video requires Javascript and Flash</div>
<script type='text/javascript'>
var player = null;
function playerReady(thePlayer) {
player = document.getElementsByName('ply')[0];
addListeners();
}
function stateMonitor(obj) {
if (obj.newstate == 'COMPLETED') {
// load a new page
window.location = 'http://www.google.com';
}
};
function addListeners() {
if (player) { player.addModelListener("STATE", "stateMonitor"); }
else { setTimeout("addListeners()", 100); }
}
// var s1 = new SWFObject('player-viral.swf', 'ply', '470', '320', '9', '#ffffff');
// s1.addParam('allowfullscreen', 'false');
// s1.addParam('allowscriptaccess', 'always');
// s1.addParam('flashvars', 'file=http://www.youtube.com/v/SXg1qpUiY7Y&autostart=true');
// s1.write('mediaspace');
</script>
<object id="thePlayer" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" name="ply" width="400" height="315">
<param name="movie" value="player-viral.swf" />
<param name="allowfullscreen" value="true" />
<param name="allowscriptaccess" value="always" />
<param name="flashvars" value="file=video.flv&image=preview.jpg" />
<embed
type="application/x-shockwave-flash"
id="player2"
name="player2"
src="player-viral.swf"
width="400"
height="315"
allowscriptaccess="always"
allowfullscreen="true"
flashvars="file=<%= VideoPath %>&image=preview.jpg&autostart=true"
/>
</object>
http://www.warriorforum.com/programming-talk/35546-redirect-another-url-after-embedded-youtube-video-ends-possible.html
redirect page after embedded youtube video ends
Etiketler: embed video , jw player
enable remote connection on sql server 2008
http://www.linglom.com/2009/03/28/enable-remote-connection-on-sql-server-2008-express/
the trick is to enable tcp/ip protocol:
- On the left window, expand SQL Server Network Configuration -> Protocols for SQLEXPRESS. You see that TCP/IP protocol status is disabled.
- Right-click on TCP/IP and select Enable to enable the protocol.
Etiketler: enable remote connection , sql server 2008
extension methods in linq
public static class MyExtensions
{
public static IEnumerable
this IEnumerable
Func
{
var results = new List
foreach (var s in source)
if (filter(s))
results.Add(s);
return results;
}
}
private double? GetConvertedPrice(RealEstate realEstate)
{
return realEstate.Price * exchangeRates[realEstate.PriceCurrencyId.Value - 1].Value;
}
var realEstates = _db.RealEstates.SelectWhere(re =>
(re.CategoryId == null || catId == null || re.CategoryId == catId)
&& (re.TypeId == null || typeId == null || re.TypeId == typeId)
&& (re.CityId == null || cityId == null || re.CityId == cityId)
&& (re.DistrictId == null || districtId == null || re.DistrictId == districtId)
&& (re.Price == null || priceMin == null || GetConvertedPrice(re) >= priceMin)
&& (re.Price == null || priceMax == null || GetConvertedPrice(re) <= priceMax)
);
http://msdn.microsoft.com/en-us/library/bb383977.aspx
Etiketler: extension methods in linq , linq
jquery reference problem
Etiketler: jquery , js , reference , scriptreference
sort a generic list
public struct SlideObject : IComparable
{
public int Id { get; set; }
public string Title { get; set; }
public string NavUrl { get; set; }
public string ImgUrl { get; set; }
public DateTime AddDate { get; set; }
public static Comparison
//public static Comparison
//{
// return so1.AddDate.CompareTo(so2.AddDate);
//};
#region IComparable
public int CompareTo(SlideObject other)
{
return AddDate.CompareTo(other.AddDate);
}
#endregion
}
http://dotnetslackers.com/community/blogs/simoneb/archive/2007/06/20/How-to-sort-a-generic-List_3C00_T_3E00_.aspx
http://www.codeproject.com/KB/linq/Article.aspx?aid=27834
Etiketler: generic list sorting
export data to excel in asp.net
Page Language="C#" AutoEventWireup="true" EnableEventValidation="false"
public override void VerifyRenderingInServerForm(Control control) {
/* Confirms that an HtmlForm control is rendered for the specified ASP.NET
server control at run time. */
}
//Export to Excel from a GridView
protected void ExportToExcel() {
Response.Clear();
Response.Buffer = true;
Response.ContentType = "application/vnd.ms-excel";
Response.AddHeader("content-disposition", "attachment;filename=MyFiles.xls");
// for turkish support
Response.ContentEncoding = Encoding.GetEncoding("ISO-8859-9");
Response.Charset = "ISO-8859-9";
this.EnableViewState = false;
System.IO.StringWriter sw = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htw = new System.Web.UI.HtmlTextWriter(sw);
gvFiles.RenderControl(htw);
Response.Write(sw.ToString());
Response.End();
}
http://blogs.msdn.com/erikaehrli/archive/2009/01/30/how-to-export-data-to-excel-from-an-asp-net-application-avoid-the-file-format-differ-prompt.aspx
Etiketler: export to excel
regular expression samples
\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)* email address abc@defg.com
^{3,50}$ at least 3 characters a25
(\d{3} ?)?\d{3} \d{2} \d{2} phone (212) 212 12 12
(\d{4}) 4-digit number 2010
^(\d{1,3}(\,\d{3})*|(\d+))(\.\d{1,2})?$ price 123,456.78
(?=.*\d) must contain at least one numeric character
(?=.*[a-z]) must contain one lowercase character
(?=.*[A-Z]) must contain one uppercase character
.{8,10} From 8 to 10 characters in length
\s allows a space
Etiketler: regular expression
add timer to jquery coda slider
add this code row to coda-slider.js file:
var cycleTimer = setInterval(function (){$scroll.trigger('next')}, 5000);
Etiketler: jquery , jquery slider
failed to retrieve directory listing
solution : c:\windows\system32\inetsrv\inetpub.exe is the file you need to add to your exceptions in Windows Server 2008.
IIS 7.0, FTP 7, and Firewalls
FTP on Windows 2008 Server - Firewall Solution