by kad1r
1. March 2010 10:58
public class AlexaData
{
public DataTable pro(string domain)
{
DataTable tablo = new DataTable();
string url = "http://alexa.com/xml/dad?url=" + domain;
XmlDocument doc = new XmlDocument();
doc.Load(url);
string owner = "", popularity = "";
DataRow r = tablo.NewRow();
if (doc.SelectSingleNode("//OWNER") != null)
{
owner = doc.SelectSingleNode("//OWNER").Attributes[0].InnerText;
tablo.Columns.Add("OWNER");
r[0] = owner;
}
if (doc.SelectSingleNode("//POPULARITY") != null)
{
popularity = doc.SelectSingleNode("//POPULARITY").Attributes[1].InnerText;
tablo.Columns.Add("POPULARITY");
r[1] = popularity;
}
tablo.Rows.Add(r);
return tablo;
}
}
by kad1r
9. February 2010 10:18
This is really useful snipet for getting Mac address.
But first you need to add reference to System.Management.
public string GetMACAddress()
{
ManagementClass mc = new ManagementClass("Win32_NetworkAdapterConfiguration");
ManagementObjectCollection moc = mc.GetInstances();
string MACAddress = String.Empty;
foreach (ManagementObject mo in moc)
{
if (MACAddress == String.Empty)
{
if ((bool)mo["IPEnabled"] == true) MACAddress = mo["MacAddress"].ToString();
}
mo.Dispose();
}
MACAddress = MACAddress.Replace(":", "");
return MACAddress;
}
by kad1r
4. February 2010 18:24
Here is the little code for install .Net Framework silently. The user can't see the install window.
start /wait dotnetfx.path /q:a /c:"install.exe /q"
by kad1r
4. February 2010 16:58
If you want to redirect your page after some seconds you need to write downside code between head tags.
<meta http-equiv="refresh" content="5;url=/default.aspx" />
by kad1r
21. January 2010 18:07
This code refresh your webpage every 60 sec.
<meta http-equiv="refresh" content="10" />
by kad1r
19. January 2010 14:05
If you have an image which has transparent IE 6.0 and early users see with the white background color. IF you want to fix it here is the JavaScript code.
for(var i=0; i<document.images.length; i++){
var img = document.images[i]
var imgName = img.src.toUpperCase()
if(imgName.substring(imgName.length-3, imgName.length) == "PNG"){
var imgID = (img.id) ? "id='" + img.id + "' " : ""
var imgClass = (img.className) ? "class='" + img.className + "' " : ""
var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
var imgStyle = "display:inline-block;" + img.style.cssText
var strNewHTML = "<span " + imgID + imgClass + imgTitle
+ " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
+ "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
+ "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>"
img.outerHTML = strNewHTML
i = i-1
}