function remove_duplicates(objectsArray) {
var usedObjects = {};
for (var i=objectsArray.length - 1;i>=0;i--) {
var so = JSON.stringify(objectsArray[i]);
if (usedObjects[so]) {
objectsArray.splice(i, 1);
} else {
usedObjects[so] = true;
}
}
return objectsArray;
}
Friday, October 30, 2015
Remove duplicate objects in an array of object in JavaScript
Monday, September 28, 2015
telrik kendo grid edit command event javascript
command: [{ name: "edit", text: "edit", click: myFunction }, "destroy"],
function myFunction(e) {
alert("deleted pressed!");
}
function myFunction(e) {
alert("deleted pressed!");
}
Start Task Scheduler
To Run Task Scheduler using the Windows interface
- Click the Start button.
- Click Control Panel .
- Click System and Maintenance .
- Click Administrative Tools .
- Double-click Task Scheduler .
To Run Task Scheduler from the Command Line
- Open a command prompt. To open a command prompt, click Start , click All Programs , click Accessories , and then click Command Prompt .
- At the command prompt, type Taskschd.msc .
SQL alter table modify column
ALTER TABLE Persons
ALTER COLUMN DateOfBirth year
ALTER COLUMN DateOfBirth year
Thursday, September 24, 2015
asp.net create menu from datatable
public static string CrateMenuFromDT(DataTable dt)
{
string retstring = "";
DataRow[] drparentMain = dt.Select("ParentID =0 OR ParentID is null");
foreach (DataRow dr in drparentMain)
{
string strmenuselect = Convert.ToString(dr["selected"]) == "0" ? "menu_nonselected" : "menu_selected";
string strsubmenu = "";
DataRow[] drparentMenu = dt.Select("ParentID =" + Convert.ToString(dr["MenuID"]));
foreach (DataRow pdr in drparentMenu)
{
if (strsubmenu == "")
strsubmenu = " <div class='submenu_straight'><ul><li><a href='" + Convert.ToString(pdr["navigateurl"]) + "' class='parent'><p>" + Convert.ToString(pdr["Text"]) + "</p></a></li>";
else
strsubmenu = strsubmenu + "<li><a href='" + Convert.ToString(pdr["navigateurl"]) + "' class='parent'><p>" + Convert.ToString(pdr["Text"]) + "</p></a></li>";
}
if (strsubmenu != "")
strsubmenu = strsubmenu + "</ul></div>";
if (retstring == "")
retstring = "<li class='" + strmenuselect + "'><p><a href='" + Convert.ToString(dr["navigateurl"]) + "'>" + Convert.ToString(dr["Text"]) + "</a></p>" + strsubmenu + "</li>";
else
retstring = retstring + "<li class='" + strmenuselect + "'><p><a href='" + Convert.ToString(dr["navigateurl"]) + "'>" + Convert.ToString(dr["Text"]) + "</a></p>" + strsubmenu + "</li>";
}
return retstring;
}
{
string retstring = "";
DataRow[] drparentMain = dt.Select("ParentID =0 OR ParentID is null");
foreach (DataRow dr in drparentMain)
{
string strmenuselect = Convert.ToString(dr["selected"]) == "0" ? "menu_nonselected" : "menu_selected";
string strsubmenu = "";
DataRow[] drparentMenu = dt.Select("ParentID =" + Convert.ToString(dr["MenuID"]));
foreach (DataRow pdr in drparentMenu)
{
if (strsubmenu == "")
strsubmenu = " <div class='submenu_straight'><ul><li><a href='" + Convert.ToString(pdr["navigateurl"]) + "' class='parent'><p>" + Convert.ToString(pdr["Text"]) + "</p></a></li>";
else
strsubmenu = strsubmenu + "<li><a href='" + Convert.ToString(pdr["navigateurl"]) + "' class='parent'><p>" + Convert.ToString(pdr["Text"]) + "</p></a></li>";
}
if (strsubmenu != "")
strsubmenu = strsubmenu + "</ul></div>";
if (retstring == "")
retstring = "<li class='" + strmenuselect + "'><p><a href='" + Convert.ToString(dr["navigateurl"]) + "'>" + Convert.ToString(dr["Text"]) + "</a></p>" + strsubmenu + "</li>";
else
retstring = retstring + "<li class='" + strmenuselect + "'><p><a href='" + Convert.ToString(dr["navigateurl"]) + "'>" + Convert.ToString(dr["Text"]) + "</a></p>" + strsubmenu + "</li>";
}
return retstring;
}
asp.net show user zone date
public static string ShowUserZoneDate(DateTime Dbdate, double zone)
{
if (Dbdate != null)
{
TimeSpan tms = new TimeSpan(0, Convert.ToInt32(zone * 60), 0);
return Dbdate.Add(tms).ToString();
}
else
return "";
}
public static string ShowUserZoneDate(string IDbdate, double zone)
{
if (!string.IsNullOrEmpty(IDbdate))
{
DateTime Dbdate = Convert.ToDateTime(IDbdate);
TimeSpan tms = new TimeSpan(0, Convert.ToInt32(zone * 60), 0);
return Dbdate.Add(tms).ToString();
}
else
return "";
}
{
if (Dbdate != null)
{
TimeSpan tms = new TimeSpan(0, Convert.ToInt32(zone * 60), 0);
return Dbdate.Add(tms).ToString();
}
else
return "";
}
public static string ShowUserZoneDate(string IDbdate, double zone)
{
if (!string.IsNullOrEmpty(IDbdate))
{
DateTime Dbdate = Convert.ToDateTime(IDbdate);
TimeSpan tms = new TimeSpan(0, Convert.ToInt32(zone * 60), 0);
return Dbdate.Add(tms).ToString();
}
else
return "";
}
asp.net create file from base 64
public static bool CreateFileFromBase64(string fileName, string Base64Data)
{
try
{
FileStream fs = new FileStream(fileName, FileMode.OpenOrCreate);
byte[] data = Convert.FromBase64String(Base64Data);
fs.Write(data, 0, data.Length);
fs.Close();
return true;
}
catch (Exception ex)
{
return false;
}
}
{
try
{
FileStream fs = new FileStream(fileName, FileMode.OpenOrCreate);
byte[] data = Convert.FromBase64String(Base64Data);
fs.Write(data, 0, data.Length);
fs.Close();
return true;
}
catch (Exception ex)
{
return false;
}
}
Subscribe to:
Posts (Atom)