Sunday, 16 September 2018

Change the Order of Windows app Icon Overally

  • Run “regedit” and locate: "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\ Explorer\ShellIconOverlayIdentifiers\"
  • rename the folders in order you want (trick use 01_, 02_ as prefixes)
  • terminate explorer.exe from task manager and re-run explorer.exe task.
 

JQuery Datatable Useful Tag Attributes

Set page length
data-page-length = "20"

Set default order column
data-order='[[0, "desc"]]'

Compact data-table
class = "display compact"


Sunday, 9 September 2018

Opening Office apps Fails when run from Scheduled Task on Windows Server

When running under user account while the user is logged in, the task runs fine as it has access to the logged in "user desktop-profile". But when task runs under a service account as a job, it fails because the server COM issue which cannot access to "system desktop-profile". To fix the issue, add the following directory:

c:\windows\syswow64\config\systemprofile\desktop 


Monday, 6 August 2018

C# REST Server POST and Get Response

async Task Main()
{
    string outputfile = "output.csv";
  
    File.Delete (outputfile);
  
    var httpWebRequest = (HttpWebRequest)WebRequest.Create(URL);
    httpWebRequest.ContentType = "application/json";
    httpWebRequest.Method = "POST";
  
    using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()))
    {
        string json = new JavaScriptSerializer().Serialize(new
        {
            startDate = "7/1/2018",
            endDate = "6/30/2019",
            codes = new string[] { "value1", "value2" },
            skus= "",
            returnCSV = 1
        });
        streamWriter.Write(json);
    }

    var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
    using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
    {
        using (StreamWriter sw = new StreamWriter(outputfile))
            sw.Write(await streamReader.ReadToEndAsync());
    }
}

Sunday, 5 August 2018

Wednesday, 1 August 2018

Powershell: Quick Search

Measure-Command
{
    Get-AdUser -Filter {
        ExtensionAttribute11 -eq 'NON'
    }
    -SearchBase 'Desired OU,DC=xxxx,DC=xxxx,DC=xxxx,DC=xxxx' # OU and DC parts
    -Properties ExtensionAttribute11 |
        Select name, ExtensionAttribute11, ExtensionAttribute13, Department, ...
}



Friday, 20 July 2018

SQL Update target tables from 2 different databases

begin transaction;

update [destination database].[dbo].[destination table] 
set [destination database].[dbo].[destination table].'destination column' = source.'desired column'
from [source database].[dbo].[source table] source
inner join [destination database].[dbo].[destination table] destnation 
on destination.'column to join' = source.'column to join'

--rollback; 
--commit; 


Analysis Service in Power BI Report Server

 We couldn’t connect to the Analysis Services server. Make sure you’ve entered the connection string correctly... link