public string LoggedInUserNetworkId()
{
string loggedinUser = WindowsIdentity.GetCurrent().Name; // IIS Express
loggedinUser = !string.IsNullOrEmpty(loggedinUser)
&& !loggedinUser.ToLower().Contains("apppool")
? loggedinUser
: HttpContext.Current.User.Identity.Name; // IIS
return
(!string.IsNullOrEmpty("Impersonate".GetValueFromConfig())
? "Impersonate".GetValueFromConfig()
: loggedinUser.Replace("DOMAIN\\", "")).PrettyWord();
}
public static string PrettyWord(this string word) =>
System.Threading.Thread.CurrentThread.CurrentCulture.TextInfo
.ToTitleCase(word.Trim().ToLower());
“No problem can be solved from the same level of consciousness that created it.” Albert Einstein (1879-1955)
Wednesday, 29 May 2019
Tuesday, 28 May 2019
Find Currently Running Query in SQL Server
SELECT
sqltext.TEXT,
req.session_id,
req.status,
req.start_time,
req.command,
req.cpu_time,
req.total_elapsed_time
FROM sys.dm_exec_requests req
CROSS APPLY sys.dm_exec_sql_text(sql_handle) AS sqltext
Saturday, 20 April 2019
Setting up Basic Express Server
-- npm install express
// include express
const express = require('express');
const app = express();
// serve static files in Public folder
app.use(express.static('public'));
// run he server on port 2222
app.listen(2222, () => console.log('Server running on 2222...'));
// include express
const express = require('express');
const app = express();
// serve static files in Public folder
app.use(express.static('public'));
// run he server on port 2222
app.listen(2222, () => console.log('Server running on 2222...'));
Wednesday, 17 April 2019
Call JavaScript function after AJAX UpdatePanel Refresh (Partial PostBack) in ASP.Net
<asp:UpdatePanel runat="server">
<ContentTemplate>
Employee :
<asp:ListBox ID="lstEmployee" runat="server" SelectionMode="Multiple">
<asp:ListItem Text="Nikunj Satasiya" Value="1" />
<asp:ListItem Text="Dev Karathiya" Value="2" />
<asp:ListItem Text="Hiren Dobariya" Value="3" />
<asp:ListItem Text="Vivek Ghadiya" Value="4" />
<asp:ListItem Text="Pratik Pansuriya" Value="5" />
</asp:ListBox>
</ContentTemplate>
</asp:UpdatePanel>
<script type="text/javascript">
window.onload = function () {
DrawEmployeeDDL();
};
//On UpdatePanel Refresh
var prm = Sys.WebForms.PageRequestManager.getInstance();
if (prm != null) {
prm.add_endRequest(function (sender, e) {
if (sender._postBackSettings.panelsToUpdate != null) {
DrawEmployeeDDL();
}
});
};
function DrawEmployeeDDL() {
$('[id*=lstEmployee]').multiselect({
includeSelectAllOption: true
});
};
</script>
<ContentTemplate>
Employee :
<asp:ListBox ID="lstEmployee" runat="server" SelectionMode="Multiple">
<asp:ListItem Text="Nikunj Satasiya" Value="1" />
<asp:ListItem Text="Dev Karathiya" Value="2" />
<asp:ListItem Text="Hiren Dobariya" Value="3" />
<asp:ListItem Text="Vivek Ghadiya" Value="4" />
<asp:ListItem Text="Pratik Pansuriya" Value="5" />
</asp:ListBox>
</ContentTemplate>
</asp:UpdatePanel>
<script type="text/javascript">
window.onload = function () {
DrawEmployeeDDL();
};
//On UpdatePanel Refresh
var prm = Sys.WebForms.PageRequestManager.getInstance();
if (prm != null) {
prm.add_endRequest(function (sender, e) {
if (sender._postBackSettings.panelsToUpdate != null) {
DrawEmployeeDDL();
}
});
};
function DrawEmployeeDDL() {
$('[id*=lstEmployee]').multiselect({
includeSelectAllOption: true
});
};
</script>
Monday, 8 April 2019
React Apollo Boost & GraphQL Template Installer
{
"name": "project-name",
"version": "1.0.0",
"description": "A starter for React-Apollo-GraphQL projects",
"main": "server.js",
"scripts": {
"server": "nodemon server.js",
"client": "cd client && npm start",
"dev":
"concurrently --names \"server,client\" \"npm run server --silent\" \"npm run client --silent\""
},
"author": "",
"license": "ISC",
"dependencies": {
"apollo-server-express": "^1.3.6",
"bcrypt": "^2.0.1",
"body-parser": "^1.18.3",
"concurrently": "^3.5.1",
"cors": "^2.8.4",
"dotenv": "^5.0.1",
"express": "^4.16.3",
"graphql": "^0.13.2",
"graphql-tools": "^3.0.2",
"jsonwebtoken": "^8.2.1",
"mongoose": "^5.1.3"
},
"devDependencies": {
"nodemon": "^1.17.5"
}
}
"name": "project-name",
"version": "1.0.0",
"description": "A starter for React-Apollo-GraphQL projects",
"main": "server.js",
"scripts": {
"server": "nodemon server.js",
"client": "cd client && npm start",
"dev":
"concurrently --names \"server,client\" \"npm run server --silent\" \"npm run client --silent\""
},
"author": "",
"license": "ISC",
"dependencies": {
"apollo-server-express": "^1.3.6",
"bcrypt": "^2.0.1",
"body-parser": "^1.18.3",
"concurrently": "^3.5.1",
"cors": "^2.8.4",
"dotenv": "^5.0.1",
"express": "^4.16.3",
"graphql": "^0.13.2",
"graphql-tools": "^3.0.2",
"jsonwebtoken": "^8.2.1",
"mongoose": "^5.1.3"
},
"devDependencies": {
"nodemon": "^1.17.5"
}
}
Thursday, 4 April 2019
JQuery Datatable add View Edit Delete Column in ASP.NET
"fnDrawCallback": function () {
jQuery(element).find('thead tr th:last-child').replaceWith("<th>View / Edit</th>");
jQuery(element).find('tbody tr').each(function () {
var courseID = $(this).find('td:first-child').html();
var links = "<a href='/view?id={{courseID}}'></a>";
$(this).find("td:last-child:not(:first-child)").replaceWith("<td>" + links.replace(/{{courseID}}/g, courseID) + "</td>");
});
}
CSS to position search and page drop downlist:
.dataTables_filter {
float: left !important;
text-align: left !important;
}
.dataTables_length {
float: right !important;
text-align: right !important;
}
jQuery(element).find('thead tr th:last-child').replaceWith("<th>View / Edit</th>");
jQuery(element).find('tbody tr').each(function () {
var courseID = $(this).find('td:first-child').html();
var links = "<a href='/view?id={{courseID}}'></a>";
$(this).find("td:last-child:not(:first-child)").replaceWith("<td>" + links.replace(/{{courseID}}/g, courseID) + "</td>");
});
}
CSS to position search and page drop downlist:
.dataTables_filter {
float: left !important;
text-align: left !important;
}
.dataTables_length {
float: right !important;
text-align: right !important;
}
Wednesday, 3 April 2019
Git Credential Manager for Windows Popups
- Installed Git Credential Manager for Windows
- Opened the terminal by clicking the Terminal button in SourceTree.
- Issued the commands below:
- git config --global credential.helper manager
- git config --global credential.useHttpPath true
Subscribe to:
Posts (Atom)
Create modal using HTML and CSS
<body> <dialog id = "modal"> <div> <h1>Title</h1> <p>Sample Text</p...
-
<asp:UpdatePanel runat="server"> <ContentTemplate> Employee : <asp:ListBox ID="lstEmployee" r...
-
# Run PowerShell as Administrator Install-Module -Name UniversalDashboard.Community # Check PowerShellGet version Get-Module -Name PowerShel...
-
//convert BASE64 string to Byte{} array function base64ToArrayBuffer(base64) { var binaryString = window.atob(base64); var binar...