This blog shares my journey as a software engineer, along with personal reviews and life experiences I’ve gained along the way. “I have not failed. I've just found 10,000 ways that won't work.” — Thomas Edison. If you enjoy my content, please support it by clicking on ads (free for you, big help for me!) or by buying me a coffee on Ko-fi. Thank you!
Tuesday, May 24, 2016
Thursday, May 19, 2016
First NuGet Package Published
Feeling pretty good about my career with my first NuGet Package. I hope this helps out other .NET Developers with CyberSource Transition on June 30, 2016 - https://www.nuget.org/packages/UnofficialCyberSourceByMoojjoo/
Friday, May 06, 2016
Update Incrementer with T-SQL instead of using a cursor
SQL TIP: Auto Increment in an UPDATE statement. - Credit - http://haacked.com/archive/2004/02/28/sql-auto-increment.aspx/
DECLARE @counter int SET @counter = 0 UPDATE #tmp_Users SET @counter = counter = @counter + 1
Friday, April 29, 2016
Thank you XML and NotePad++
Use the XML Tools plugin for Notepad++ and then you can Auto-Indent the code with Ctrl + Alt + Shift + B .For the more point-and-click inclined, you could also go to Plugins --> XML Tools --> Pretty Print. Search "XML TOOLS" from the "Available" option then click in install.Jan 28, 2015
How to indent HTML tags in Notepad++ - Stack Overflow
stackoverflow.com/questions/.../how-to-indent-html-tags-in-notepad
Windows 7 - Change Login Screen
Reference and Credit - http://www.tomshardware.com/forum/52395-63-change-windows-splash-screen-lock-screen
click start type regedit and hit enter
right click on HKEY_LOCAL_MACHINE and select find
type OEMBackground and hit enter
(the path should be Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\Background )
(if it is not there you need to create it*right click on background and select new DWORD name it OEMBackground set it from 0 to 1)
double left click on OEMBackground and change the value from 0 to 1
click start and type %windir%\system32\oobe
in the oobe folder create a folder named info
in that folder create a folder named backgrounds
now rename your picture that you want displayed durning logon/lock screen backgroundDefault.jpg
everything is case sensitive so if you have to copy and paste the names. the picture needs to be under 244kb.
trick to get a picture under the 244kb
right click on the picture and select open with > select paint
press ctrl+w
this will bring up a box under horizontal and vertical select the amount you want to reduce the picture in %
=)
click start type regedit and hit enter
right click on HKEY_LOCAL_MACHINE and select find
type OEMBackground and hit enter
(the path should be Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\Background )
(if it is not there you need to create it*right click on background and select new DWORD name it OEMBackground set it from 0 to 1)
double left click on OEMBackground and change the value from 0 to 1
click start and type %windir%\system32\oobe
in the oobe folder create a folder named info
in that folder create a folder named backgrounds
now rename your picture that you want displayed durning logon/lock screen backgroundDefault.jpg
everything is case sensitive so if you have to copy and paste the names. the picture needs to be under 244kb.
trick to get a picture under the 244kb
right click on the picture and select open with > select paint
press ctrl+w
this will bring up a box under horizontal and vertical select the amount you want to reduce the picture in %
=)
Tuesday, April 19, 2016
Fancybox Modal Window onFocus or $('#ID').onFocus();
How to give focus to a modal window?
Be patient. Add a timer. That did it for me.
This was a 2 day R&D problem. After adding the timeout BAM --- Focus achieved. This really was a tricking thing to figure out, but think about it if the HTML DOM ELEMENT is not there it cannot set focus.
Be patient. Add a timer. That did it for me.
This was a 2 day R&D problem. After adding the timeout BAM --- Focus achieved. This really was a tricking thing to figure out, but think about it if the HTML DOM ELEMENT is not there it cannot set focus.
$(document).ready(function setFocus() { setTimeout(function () { $('#txtEmailAddress').focus(); }, 420); // After 420 ms return false; });
Wednesday, April 13, 2016
BootStrap, JQuery, and JavaScript Validation Oh My... Nice Solution.
You need jQuery library and bootstrap to perform the following code.
Nice Page Header ON TOP
Next is the server control or button either one.
Finally the nice jQuery
Nice Page Header ON TOP
<div id="message"> <div> <div class="alert alert-danger alert-dismissable"> <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button> <span id="alertMsgTxt" style="font-size:1.5em;font-weight:bold" ></span> </div> </div> </div>
Next is the server control or button either one.
<asp:TextBox ID="txtEmailSignup" TextMode="email"
runat="server" CssClass="form-control" title="Email Sign Up SHOE SHOW Sales and News" placeholder="Enter your email address" />
Finally the nice jQuery
<script> $(document).ready(function () { $(document).on('click', '#lnkEmailSubmit', function () { var emailaddress = ''; emailaddress = $('#txtEmailSignup').val(); if(!validateEmail(emailaddress) || emailaddress === ''){ $('.alert').show(); window.scrollTo(0, 0); $('#alertMsgTxt').html('Invalid Email, please click here to try again.'); } }) }); function setFocus() { $('.alert').hide(); document.getElementById("txtEmailSignup").focus(); } function validateEmail($email) { var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/; return emailReg.test( $email ); } </script>
Friday, March 25, 2016
Tuesday, February 16, 2016
ASP.NET Web Forms set default button on page load
In the Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Main_Form.DefaultButton = "lnkLookUpGuestOrders" End Sub
Friday, January 15, 2016
How to CACHE using .NET
Add <?xml .... > script below to the directory you want to CACHE for 365 days - if it is static than why have the client retrieve it, over and over again --- BAD HIT ON SPEED OF SITE. Note for CSS and Scripts it is best practice to have a version number on the file and update the reference.
Example
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<staticContent>
<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="365.00:00:00" />
</staticContent>
</system.webServer>
</configuration>
Always add ?v=x.x and increment when you make changes to the css or js files. If not end-users will get older versions of your CSS or JS and will cause a nightmare and lose potential customers or clients.
Example
<link rel="stylesheet" type="text/css" href="/framework/css/global.min.css?v=2.0" media="screen, print" />
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<staticContent>
<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="365.00:00:00" />
</staticContent>
</system.webServer>
</configuration>
Always add ?v=x.x and increment when you make changes to the css or js files. If not end-users will get older versions of your CSS or JS and will cause a nightmare and lose potential customers or clients.
Wednesday, December 02, 2015
Friday, November 27, 2015
Tuesday, November 17, 2015
SQL Server Queries are spilling out to tempdb
-- How to rid yourself of tempDB spilage if SORT causing issues Create a Temp Table with a CLUSTERED INDEX
IF OBJECT_ID('tempdb..#tempSizes') IS NOT NULL DROP TABLE #tempTable
SELECT DISTINCT
IDENTITY(INT,1,1) AS ID,
Products.Name,
Product_Families.Parent_Family_Name,
INTO #tempTable
FROM Products
LEFT JOIN Product_Families ON Products.Product_Family_ID = Product_Families.Product_Family_ID
WHERE Products.Discontinued = 0
AND Quantity > 0
CREATE CLUSTERED INDEX IX_ID ON #tempSizes(ID)
SELECT * FROM #tempTable
IF OBJECT_ID('tempdb..#tempSizes') IS NOT NULL DROP TABLE #tempTable
SELECT DISTINCT
IDENTITY(INT,1,1) AS ID,
Products.Name,
Product_Families.Parent_Family_Name,
INTO #tempTable
FROM Products
LEFT JOIN Product_Families ON Products.Product_Family_ID = Product_Families.Product_Family_ID
WHERE Products.Discontinued = 0
AND Quantity > 0
CREATE CLUSTERED INDEX IX_ID ON #tempSizes(ID)
SELECT * FROM #tempTable
Thursday, November 12, 2015
Tuesday, November 03, 2015
Friday, October 30, 2015
IIS ApplicationPoolIdentity - Credit - http://stackoverflow.com/users/419/kev
The
ApplicationPoolIdentity
is assigned membership of the Users
group as well as the IIS_IUSRS
group. On first glance this may look somewhat worrying, however the Users
group has somewhat limited NTFS rights.
For example, if you try and create a folder in the
C:\Windows
folder then you'll find that you can't. The ApplicationPoolIdentity
still needs to be able to read files from the windows system folders (otherwise how else would the worker process be able to dynamically load essential DLL's).
With regard to your observations about being able to write to your
c:\dump
folder. If you take a look at the permissions in the Advanced Security Settings, you'll see the following:
See that Special permission being inherited from
c:\
:
That's the reason your site's
ApplicationPoolIdentity
can read and write to that folder. That right is being inherited from the c:\
drive.
In a shared environment where you possibly have several hundred sites, each with their own application pool and Application Pool Identity, you would store the site folders in a folder or volume that has had the
Users
group removed and the permissions set such that only Administrators and the SYSTEM account have access (with inheritance).
You would then individually assign the requisite permissions each
IIS AppPool\[name]
requires on it's site root folder.
You should also ensure that any folders you create where you store potentially sensitive files or data have the
Users
group removed. You should also make sure that any applications that you install don't store sensitive data in their c:\program files\[app name]
folders and that they use the user profile folders instead.
So yes, on first glance it looks like the
ApplicationPoolIdentity
has more rights than it should, but it actually has no more rights than it's group membership dictates.
An
ApplicationPoolIdentity
's group membership can be examined using the SysInternalsProcess Explorer tool. Find the worker process that is running with the Application Pool Identity you're interested in (you will have to add the User Name
column to the list of columns to display:
For example, I have a pool here named
900300
which has an Application Pool Identity of IIS APPPOOL\900300
. Right clicking on properties for the process and selecting the Security tab we see:IIS APPPOOL\900300
is a member of the Users
group.Repost - http://stackoverflow.com/users/419/kev
Wednesday, October 07, 2015
FTP Certificate TLS Encryption fix
- Windows 2008 R2 - IIS 7.5 using FTP
- FileZilla (Protocol=FTP; Encryption=Require explicit FTP over TLS; Logon Type:=Normal; UserName=****; Passwword=****** Currently there are 3 virtual drives and when I connect via FileZilla they all display fine, however when I try to configure a 4th virtual directory it will not display in FileZilla.
I am actually getting a sporadic failure all together after the directory is created:
Command: LIST Error: GnuTLS error -110: The TLS connection was non-properly terminated. Status: Server did not properly shut down TLS connection Error: Transfer connection interrupted: ECONNABORTED - Connection aborted Response: 550 Keyset does not exist Error: Failed to retrieve directory listing
If I delete the Virtual Directory the directories will display again. What is wrong, all the permissions are identical. Is there something with the SSL that has to be configured on the directory? Any assistance would be great.
http://serverfault.com/questions/655968/iis-7-5-ftp-and-virtual-directory/690420#690420
ANSWER - The "550 Keyset does not exist" error message may be caused by the pass-through authentication settings for the virtual directory. If pass-trough authentication is configured to use a 'specific user' rather than the default setting of 'application user' then the 550 error will be returned unless(probably) the 'specific user' is granted permission to access the Machine Keys for certificates.
Granted READ ONLY Access to the C:\ProgramData\Microsoft\Crypto\RSA directory for the particular FTP User Account
Thursday, October 01, 2015
Friday, September 25, 2015
Locking your network password
NEVER EVER have Scheduled TASKs, SERVICES or be logged into another machine when
changing your password. NEVER!!!!!
In other words, always run Services and Scheduled TASKS with a different Active Directory (AD) account. I don't care how long it takes to get an AD admin to create the account never, ever use your own login for another process. I am 15 years into this work and I should know better.
Please do not make this mistake, because you will ALWAYS forget another process is running under your ID. You know, one of those SENIOR Moments.
In other words, always run Services and Scheduled TASKS with a different Active Directory (AD) account. I don't care how long it takes to get an AD admin to create the account never, ever use your own login for another process. I am 15 years into this work and I should know better.
Please do not make this mistake, because you will ALWAYS forget another process is running under your ID. You know, one of those SENIOR Moments.
Subscribe to:
Posts (Atom)