Migrating a legacy ASP site to SQL Server, had a prob whereby lots of code that previously used RecordSet.AddNew() with RecordSet.Update(), and then immeditately retrieved the inserted ID from the RecordSet, suddenly failed to get the inserted ID.
The solution was to set the RecordSet CursorType to adOpenKeyset (constant value 1)
DaddyCode Team Blog
C# , ASP.NET, MVC, SQL, Sharepoint, JQuery and nowt else from a Web Developer in Leeds
16 Feb 2015
10 Feb 2015
Edit Web.Config from File Explorer in Windows 7 / 8 / 2012 - Read Only for Administrator
Don't you hate that UAC thing whereby you can't edit your site's web.config file directly from File Explorer? It lets you open it in notepad and then won't let you save. Even though you're an Administrator! ANNOYING!
It's because of the default Access Control List on the Inetpub folder. When you edit any file under that folder, Windows busts you down to User level permissions, even though your user is a member of the Administrators group.
A quick fix is to grant full access permissions over Inetpub to your explicit user account. Run this in an elevated (Run As Administrator) command prompt (Note you don't need to type your actual username in here, the environment variables will be interpolated for you automatically):
icacls %systemdrive%\inetpub /grant %userdomain%\%username%:(OI)(CI)(F) /grant %userdomain%\%username%:F
It's because of the default Access Control List on the Inetpub folder. When you edit any file under that folder, Windows busts you down to User level permissions, even though your user is a member of the Administrators group.
A quick fix is to grant full access permissions over Inetpub to your explicit user account. Run this in an elevated (Run As Administrator) command prompt (Note you don't need to type your actual username in here, the environment variables will be interpolated for you automatically):
icacls %systemdrive%\inetpub /grant %userdomain%\%username%:(OI)(CI)(F) /grant %userdomain%\%username%:F
27 Nov 2014
Lenovo ThinkPad T410 Fingerprint Reader stopped working after update
Did a long-put-off update on my Thinkpad with all its recommended Lenovo drivers from the ThinkVantage tool. All dandy, apart from the fingerprint reader stopped working. It used to have a little green light on to show it was ready, now it was off in sleep mode.
Simple solution: Go to Device Manager > Biometric Devices > TouchChip Fingerprint Coprocessor > Properties > Power Management and untick the "Allow the computer to turn off this device" option.
Simple solution: Go to Device Manager > Biometric Devices > TouchChip Fingerprint Coprocessor > Properties > Power Management and untick the "Allow the computer to turn off this device" option.
18 Nov 2014
Remote Desktop connection failed
Couldn't connect via RDC via an RD Gateway. Tried all sorts but in the end tried going into Device Manager, showing all hidden devices, and removed all the ISATAP virtual tunneling adapters that various Virtual Machines had added. It worked!
22 Oct 2014
Installation Ended Prematurely - MVC Hotfix MS14-059
Just had a scary moment when a production MVC application went down due to MS Updates removing the MVC 3.0.0.0 dll and replacing it with MVC 3.0.0.1.
Although we located the MS Hotfix (MS14-059), the installer gave us a worrying "Installer Ended Prematurely" error.
The solution was simple - the server needed a reboot to allow it to install some pending updates before the Hotfix could be run.
Although we located the MS Hotfix (MS14-059), the installer gave us a worrying "Installer Ended Prematurely" error.
The solution was simple - the server needed a reboot to allow it to install some pending updates before the Hotfix could be run.
21 Oct 2014
VBScript / Classic ASP value equivalency crib sheet
DBNULL VALUE
Equivalent to: NULL
ZERO VALUE
Equivalent to: FALSE
STRING NUMBER VALUE (e.g "0")
Equivalent to: NUMBER VALUE (but STRING ZERO is not FALSE!)
EMPTY VALUE / UNDEFINED VALUE / UNPROVIDED REQUEST VALUE
Equivalent to: FALSE (but not NULL!)
EMPTY STRING ("")
Not equivalent to FALSE, EMPTY, ZERO or NULL!
NOTE: If you compare NULL with anything, it just returns NULL, not TRUE/FALSE
NOTE: While 0 is equivalent to FALSE, 1 is NOT equivalent to TRUE
19 Sept 2014
A simple script for scheduled Access DB backups
Here's a simple wee backup script to save as a VBS file (e.g. backup.vbs) and then run from Windows Task Scheduler.
Saves a copy with a datestamp in the filename e.g. Data_2014-09-07.mdb
Saves a copy with a datestamp in the filename e.g. Data_2014-09-07.mdb
Dim oldfilePath
Dim newfilePath
oldfilePath = "C:\LivePath\Data.mdb"
newfilePath = "D:\Data_Backups\Data_"
newfilePath = newfilePath & datepart("yyyy", date()) & "-"
newfilePath = newfilePath & Right("0" & DatePart("m",Date), 2) & "-"
newfilePath = newfilePath & Right("0" & DatePart("d",Date), 2) & ".mdb"
Dim fso : Set fso = CreateObject("Scripting.FileSystemObject")
fso.CopyFile oldfilePath, newfilePath, true
Set fso = Nothing
25 Aug 2014
Adding a Clear Filter / Clear Search Button to DataTables
I wanted a generic way to add a "clear filter" button to the text filter on all the DataTables on a site.
One way would be to change the input type of the filter to "search" - then HTML5 browsers will automatically show a clear widget. However, you'd have to press return after clicking it, so I wanted a one-click solution.
Here's what I came up with. It works with DataTables 1.9.
One way would be to change the input type of the filter to "search" - then HTML5 browsers will automatically show a clear widget. However, you'd have to press return after clicking it, so I wanted a one-click solution.
Here's what I came up with. It works with DataTables 1.9.
// Setup DataTable Defaults
$.extend( $.fn.dataTable.defaults, {
fnInitComplete: function(oSettings, json) {
// Add "Clear Filter" button to Filter
var btnClear = $('<button class="btnClearDataTableFilter">CLEAR</button>');
btnClear.appendTo($('#' + oSettings.sTableId).parents('.dataTables_wrapper').find('.dataTables_filter'));
$('#' + oSettings.sTableId + '_wrapper .btnClearDataTableFilter').click(function () {
$('#' + oSettings.sTableId).dataTable().fnFilter('');
});
}
});
16 May 2014
A ValueInjecter Injection that ignores null values
Want to use ValueInjecter but don't want to copy null values into your model?
Usage:
public class NoNullsInjection : ConventionInjection
{
protected override bool Match(ConventionInfo c)
{
return c.SourceProp.Name == c.TargetProp.Name
&& c.SourceProp.Value != null;
}
}
Usage:
target.InjectFrom(new NoNullsInjection(), source);
15 Apr 2014
Access MDB activity causes Visual Studio 2012 "File Modified Outside Environment" warning
I've found a way to stop this when it starts. Close VS2012 and delete your Visual Studio solution's (hidden) SUO file, which you will find with the SLN file.
Subscribe to:
Posts (Atom)
If I helped you out today, you can buy me a beer below. Cheers!