====== Stephen's Wiki ======
Welcome to Stephen's wiki. There is lots of really great content here - you just have to search for it.
====== Stephen's Blog (sort of) ======
This is a collection of random stuff I want to record for future reference. Probably not much use to anyone else.
===== .NET Logging Levels =====
Trace = 0, Debug = 1, Information = 2, Warning = 3, Error = 4, Critical = 5, and None = 6.
===== Running with Rubix =====
Rubix and I did approximately 1,547 runs and covered 16,347kms together. First run was 2015-08-24, last was around 2024-07-24.
===== Restart Garmin Forerunner 235 =====
Hold down the ☀️ button for ages. Watch will power off. Press it again to power on. Settings etc. are not lost.
===== Set Environment Variable in Unit Test =====
Create a ''something.runsettings'' file and put it in the solution directory:
true
Getting Visual Studio to use the file is a bit tricky. Try Test -> Configure Test Settings. You may need the 'Select Solution Wide runsettings File'. Eventually the file itself should appear in the menu.
To test, debug and stop at a breakpoint. Run ''Environment.GetEnvironmentVariables()'' in the Immediate Window.
===== Direct Object Creation with Ninject =====
This will only work inside an ASP.NET project.
using System.Web.Mvc;
private ILog _log;
private ILog Log => _log ?? (_log = (ILog)DependencyResolver.Current.GetService(typeof(ILog)));
===== Azure Virtual Machine Windows Activation Problems =====
Running this worked on my Azure Dev VM:
ForEach-Object { Invoke-Expression "$env:windir\system32\cscript.exe $env:windir\system32\slmgr.vbs /ato" ; start-sleep 5 }
More details at [[https://docs.microsoft.com/en-gb/azure/virtual-machines/troubleshooting/troubleshoot-activation-problems?WT.mc_id=Portal-Microsoft_Azure_Support|Troubleshoot Azure Windows virtual machine activation problems]].
===== Log all TypeScript functions =====
Search: ''(public|private)( static)?\s*([\w]+)\(.*?\)(:\s*[\w<>]+)?\s*\{''
Replace: ''$0 console.log('Module: $3');''
===== Stupid Roslyn Error =====
Could not find a part of the path 'C:\Dev\BucketsOfFunds\BucketsOfFunds.Web\bin\roslyn\csc.exe'.
Run this in the Package Manager Console:
Update-Package Microsoft.CodeDom.Providers.DotNetCompilerPlatform -r
===== Use PowerShellGet behind a corporate proxy =====
notepad $PROFILE
Add this to the top:
[system.net.webrequest]::defaultwebproxy = new-object system.net.webproxy('http://10.104.66.70:80')
# To use your current Windows account to log on to the proxy:
[system.net.webrequest]::defaultwebproxy.credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials
# To use a different Windows account:
$Username="domain\username"
$Password="password"
[system.net.webrequest]::defaultwebproxy.credentials = New-Object System.Net.NetworkCredential($Username, $Password)
[system.net.webrequest]::defaultwebproxy.BypassProxyOnLocal = $true
Restart your PowerShell session. Fix up the repository source:
Register-PSRepository -Default
Check you have a repository:
Get-PSRepository
Should get ''https://www.powershellgallery.com/api/v2''.
===== Add the IIS Development certificate to the Trusted Root Certificates =====
- Open MMC.
- Add the Certificates snap-in for 'Computer account'.
- Console Root > Certificates (Local Computer) > Personal > Certificates.
- localhost (IIS Express Development Certificate) > Right click > Copy.
- Console Root > Certificates (Local Computer) > Trusted Root Certification Authorities > Certificates.
- Actions (right panel) > More Actions > Paste
===== Kill Chrome instances from automated testing =====
(Get-WmiObject Win32_Process -Filter "name = 'Chrome.exe'" | Where-Object { $_.CommandLine.Contains("--enable-automation") }).Terminate()
And if you want to get rid of the Chrome driver as well (which is always a good idea):
(Get-WmiObject Win32_Process -Filter "name = 'Chrome.exe'" | Where-Object { $_.CommandLine.Contains("--enable-automation") }).Terminate(); (Get-WmiObject Win32_Process -Filter "name = 'chromedriver.exe'").Terminate();
===== Faking DateTime.Now() =====
using (ShimsContext.Create())
{
System.Fakes.ShimDateTime.NowGet = () => new DateTime(2019, 03, 31);
...
}
===== Chrome Dev Tools - Show only bad network requests =====
Copy and paste the below into the filter.
''-is:running -status-code:200 -status-code:302 -status-code:204 -status-code:304 -status-code:307''
===== Unit testing - test a method on a property is executed =====
Requires the [[https://github.com/moq/moq4|Moq]] [[https://www.nuget.org/packages/Moq|NuGet package]].
[TestMethod]
public void MealViewModel_Banana_EatMethodIsCalled_DrinkIsNot()
{
IUtensil spoon = new Spoon();
var mockBanana = new Mock();
var test = new MealViewModel();
testMeal.Banana = mockBanana.Object;
// Calling Eat() on the meal should also call Eat() on the banana.
testMeal.Eat(spoon);
mockBanana.Verify(banana => banana.Eat (It.IsAny()), Times.Once, "Banana should be eaten with a utensil.");
mockBanana.Verify(banana => banana.Drink(It.IsAny()), Times.Never, "Banana should not be drunk.");
// Not sure if an interface will work here -------^^^^^^^^
}
===== Visual Studio can't open CSHTML files =====
{{ :visual_studio_cant_open_cshtml_files.png |}}
Fix it thusly:
- Close Visual Studio.
- Delete everything in ''%LocalAppData%\Microsoft\VisualStudio\14.0\ComponentModelCache''
- Open Visual Studio.
===== Append randomness to start of a filename =====
Get-ChildItem *.mp3 | ForEach-Object{Rename-Item $_ -NewName "$(Get-Random) $($_.Name).mp3"}
===== Why did Windows wake from sleep? =====
Run this and find out:
powercfg -lastwake
===== HTML Sanitation =====
Add the 'AntiXSS' (Microsoft) package from NuGet.
var input = "fjkdlsjf klds Test HubAdmin";
var output = Microsoft.Security.Application.Sanitizer.GetSafeHtmlFragment(input);
// fjkdlsjf klds Test HubAdmin
===== Setting up a Database User =====
- [SQL Server Management] Right click the **server**, Properties.
- [SQL Server Management, Server Properties] Security -> Server Authentication -> SQL Server and Windows Authentication mode
- [SQL Server Management, Server Properties] Ok
- [SQL Server Management] Right click (Server) -> Security -> Logins, New Login...
- [SQL Server Management, Login - New] General -> Fill in details.
- [SQL Server Management, Login - New] Server Roles -> public only.
- [SQL Server Management, Login - New] Ok
- [SQL Server Management] Right click (Server) -> Databases -> (Database) -> Security -> Users, New User...
- [SQL Server Management, Database User - New] General -> Fill in details.
- [SQL Server Management, Database User - New] Membership -> Fill in details.
- [SQL Server Management, Database User - New] Ok.
===== Reading Event Logs with PowerShell =====
# Logs that contain 'Sequence contains'.
Get-EventLog Application -Source M.pad -newest 20 -message "*Sequence contains*" | Format-Table -autosize -wrap
# Logs that do not contain 'FromCommonAuditItem'.
Get-EventLog Application -Source M.pad -newest 2000 | Where { $_.Message -notmatch 'FromCommonAuditItem' } | Format-Table -autosize -wrap
===== Unit Testing Private Methods =====
Ignoring the argument as to whether a private method //should// be unit tested...
using Microsoft.VisualStudio.TestTools.UnitTesting;
public class Banana {
private int _count;
private static int Add(int n1, int n2) {
return n1 + n2;
}
private int Inc() {
_count = Add(_count, 2);
return _count;
}
}
class Program {
static void Main(string[] args) {
PrivateType bananaTest1 = new PrivateType(typeof(Banana));
int result1 = (int)bananaTest1.InvokeStatic("Add", 12, 34);
PrivateObject bananaTest2 = new PrivateObject(new Banana());
int result2 = (int)bananaTest2.Invoke("Inc");
}
}
===== Enable external web requests (Win8) =====
- Open 'Windows Firewall' (with Advanced Security)
- Add an Inbound Rule
- Local port 80 (and 443 if HTTPS is required).
===== When HTTPS requests always return 404s =====
- [IIS Manager] Select the //Default Web Site//.
- [IIS Manager] On the right, under Actions, Edit site, select //Bindings...//
- [IIS Manager, Site Bindings] There should be two entries, http & https. Select //https//, select //Edit...//
- [IIS Manager, Edit Site Binding] SSL certificate should be selected (e.g. PKS1684.corp.ps.co.nz).
===== Poor Man's Dependency Injection =====
Chris used an abstract base class. The following should be adapted for an interface, if possible.
/*
*/
public abstract class DefinitionService
{
public abstract List GetAllCategories();
// ...
public static DefinitionService Current
{
get
{
var activeServiceName = WebConfigurationManager.AppSettings["DefinitionService"];
if (string.IsNullOrWhiteSpace(activeServiceName))
throw new ConfigurationErrorsException("Definition Service type not specified or blank");
var serviceType = typeof(DefinitionService).Assembly.GetType(activeServiceName);
if (serviceType == null || !typeof(DefinitionService).IsAssignableFrom(serviceType))
throw new ConfigurationErrorsException("Definition Service type does not exist or does not inherit from DefinitionService");
var defaultConstructor = serviceType.GetConstructor(Type.EmptyTypes);
if (defaultConstructor == null)
throw new ConfigurationErrorsException("Definition Service type does not have an empty constructor");
return (DefinitionService)defaultConstructor.Invoke(null);
}
}
}
===== How to view LINQ Generated SQL statements =====
((System.Data.Objects.ObjectQuery)myQuery).ToTraceString()
Or, if you want an extension method:
public static class IQueryableExtensions
{
public static string ToTraceString(this IQueryable t)
{
ObjectQuery oqt = t as ObjectQuery;
return oqt == null ? string.Empty : oqt.ToTraceString();
}
}
===== Windows Azure Regional Response Times =====
^ Region ^ Free ^^ Standard ^^
^ ^ Mean ^ StdDev ^ Mean ^ StdDev ^
| West US | 160.03 | 23.97 | 155.72 | 12.17 |
| East Asia | 163.13 | 22.12 | 159.67 | 13.76 |
| North Central US | 205.12 | 11.56 | 207.13 | 15.07 |
| East US | 212.42 | 9.47 | 213.05 | 12.15 |
| North Europe | 293.83 | 16.72 | 287.96 | 14.76 |
| West Europe | 307.37 | 45.31 | 296.47 | 11.05 |
[[http://azurespeedtest.azurewebsites.net/|Azure Speed Test]]
Just use **Australia East**.
===== Unget Files from TFS =====
- [Visual Studio] Open Source Control Explorer.
- [Visual Studio - Source Control Explorer] Right click the branch or folder to be ungetted.
- [Visual Studio - Source Control Explorer] Select 'Get Specific Version...'
- [Visual Studio - Get dialogue] Type: Changeset.
- [Visual Studio - Get dialogue] Changeset: 1.
- [Visual Studio - Get dialogue] Click Get. Bye bye local files and the branch / folder is updated correctly in the Source Control Explorer.
===== Caches along a trail =====
- Open this page in a **new** browser window.
- Setup a [[http://www.geocaching.com/my/lists.aspx|list]] for the results.
- Create a new or reuse an existing [[http://www.geocaching.com/my/userroutes.aspx|route]].
- Create a run-once pocket query based on the route.
- Sort the results by favourites and open each in separate browser tab.
- Send each one to c:geo.
- Bookmark the first one and add it to the list.
- Bookmark all the rest.
- Go back to the [[http://www.geocaching.com/my/lists.aspx|lists]] and create a pocket query based on it.
- Check lots of boxes and Use the "Uncheck the day of the week after the query runs" option.
- Go to [[http://www.geocaching.com/pocket/default.aspx|pocket queries]] and delete it.
- Wait for email.
- Upload attached GPX file to phone.
- Import caches into Locus.
- Use [[http://umap.openstreetmap.fr/en/|uMap]] (Twitter log in).
- Create new map and upload GPX file.
To print:
- Open uMap page in Firefox.
- F11 to full screen.
- Ctrl + PrnScn (or whatever it is).
- Open Paint.NET, paste & print.
- Untick 'Fit picture to frame'.
===== How to enable Service Tracing =====
- [Visual Studio] Tools -> WCF Service Configuration Editor
- [Microsoft Service Configuration Editor] File -> Open -> Config File...
- [Microsoft Service Configuration Editor] (Open the Web.config file)
- [Microsoft Service Configuration Editor] Diagnostics (not a subnode)
- [Microsoft Service Configuration Editor] Click Enable MessageLogging
- [Microsoft Service Configuration Editor] Click Enable Tracing
- [Microsoft Service Configuration Editor] File -> Save
- [] Rerun app and reproduce error or whatever.
- [Windows Explorer] Open directory with Web.config in it.
- [Windows Explorer] Double click Web_messages.svclog and Web_tracelog.svclog.
===== MVC Date binding =====
[DataType(DataType.Date)]
[DisplayName("Start date")]
[DisplayFormat(DataFormatString = "{0:dd/MM/yyyy}", ApplyFormatInEditMode = true)]
[Date(ErrorMessage = "Please enter a start date")]
public DateTime StartDate { get; set; }
===== Get a connection string using a GUI =====
- Minimise all windows.
- On the desktop, create a new file and name it 'test.udl'.
- Double click it.
- Select Provider and connection settings and play with them until they work.
- Click ok.
- Open 'test.udl' in a text editor. There is your connection string.
===== Delete a TFS Workspace that does not exist =====
Visual Studio can sometimes get a bit confused about which TFS workspaces exist and which don't. Sort it out with the Visual Studio Command Prompt.
Figure out what workspaces really exist:
tf workspaces /collection:sourcecontrol.company.co.nz\DefaultCollection
Well and truly delete the motherfucker:
tf workspace /delete workspacename
If ''tf'' starts complaining about "Unable to determine the source control server", try running the first command again (it seems to magically fix shit up or something):
tf workspaces /collection:sourcecontrol.company.co.nz\DefaultCollection
===== Rob Connery's JavaScript Inferno =====
^ Library ^ Conceptual Density ^ Googles/Hour ^ Scaling Pain¹ ^ Rob's Choice ^
| Knockout | Fairly Low | 6 - 8 | 20, 25, 50, 90 | 80% of the time |
| Backbone | High | 25 - 30 | 50, 30, 20, 20 | |
| Angular | Medium/ High | 10 - 20 | 10, 20, 70, 90 | Simple JS App |
| Ember | Extreme | *² | 90, 25, 20, 10 | Big JS App |
¹ Simple, Moderate, Advanced, Enterprise\\
² Gave up googling, api changes often, lots of out-of-date info on web.
===== Conditional Attributes in Razor =====
Note that Razor is quite fussy about the format of the ''style=display:none'' bit. No spaces.
A less nice method that also works is:
===== ASP.NET MVC Security Check List =====
See [[asp_net_mvc_security_check_list|ASP.NET MVC Security Check List]].
===== Problem Steps Recorder =====
On Windows 7 and above:
- Start button.
- Type ''Steps'' or ''PSR''.
- Click 'Record steps to reproduce a problem'.
- Be amazed.
===== Updating NuGet VS2010 WinXP =====
- Download ''NuGet.Tools.vsix'' (look for it at [[http://nuget.org|nuget.org]])
- Uninstall NuGet from within Visual Studio.
- Close Visual Studio.
- Run the ''NuGet.Tools.vsix'' file to install the new version.
===== Log Parser Examples =====
Search the application event log on the local machine:
LogParser.exe -i:evt -rtp:-1 "SELECT TOP 100 * FROM Application WHERE SourceName like '%Reporting%'" > d:\Temp\Output.txt
Search the standard three event logs on the local machine:
LogParser.exe -i:evt -rtp:-1 "SELECT TOP 100 * FROM System, Application, Security WHERE SourceName like '%Reporting%'" > d:\Temp\Output.txt
Search the application event log on a remote machine (may take a while):
LogParser.exe -i:evt -rtp:-1 "SELECT TOP 100 * FROM \\MachineName\Application WHERE SourceName like '%Reporting%'" > d:\Temp\Output.txt
The ''-rtp:-1'' option suppresses the "Press a key..." prompt.
===== Batch Convert Image Format =====
In a Powershell console:
Get-Item *.jpg | ForEach-Object { magick convert $_ "$($_.basename).png" }
This also works:
Get-ChildItem 'C:\External Drives\Primary Media 2\My Pictures\Fractals\FA (Dual Monitor Wallpaper)' | Foreach { magick convert $_.FullName -resize 3840x1080! -quality 99 $_.Name }
For canvas prints through pixelpaint.co.nz, use **8E** series images and convert to JPEG, < 15MB. Copy images from ''C:\External Drives\Primary Media 2\My Pictures\Fractals\8E (Printing)'' to a temp directory. Run this:
Get-ChildItem | Foreach { magick convert $_.FullName -quality 98 "$($_.basename).jpg" }
For any that are still bigger than 15MB, decrease quality and / or size (''-resize 80%%'').
===== Firefox Command Line Parameters =====
| -ProfileManager | Starts Firefox with the Firefox Profile Manager. |
| -P "Profile Name" | Starts Firefox using the specified profile. |
| -safe-mode | Starts Firefox in "Safe Mode" - useful when extensions go awry. |
| -no-remote | Permits multiple instances of Firefox using separate profiles. |
===== Enabling NTLM Authentication (Single Sign-On) in Firefox =====
- Open Firefox and type ''about:config'' in the address bar.
- In the //Filter// field enter ''network.automatic-ntlm-auth.trusted-uris''.
- Set the value to a comma separated list of sites:http://intranet.company.com,http://email.company.lan
===== Binding a Drop Down to a Value That Might Not Exist =====
How do I fix the following error:
‘dropdownlist1′ has a SelectedValue which is invalid because it does not exist in the list of items
- Remove the //SelectValue// binding in the drop down:SelectedValue='<%# Bind("LocationId") %>'
- In the code behind, add the following to the PreRender of the FormView:Protected Sub EmployeeDetailsFormView_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles EmployeeDetailsFormView.PreRender
If EmployeeDetailsFormView.CurrentMode = FormViewMode.Edit Then
Dim Location_DropDownList As DropDownList = CType(EmployeeDetailsFormView.FindControl("Location_DropDownList"), DropDownList)
Dim rowView As DataRowView = CType(EmployeeDetailsFormView.DataItem, DataRowView)
If IsNothing(rowView) Then Return ' Or perhaps throw an exception.
Dim locationId As String = rowView("LocationId").ToString()
If Not IsNothing(Location_DropDownList.Items.FindByValue(locationId)) Then
Location_DropDownList.SelectedValue = locationId
Else
' TODO: Set the value to whatever it should be if there is no match.
Location_DropDownList.SelectedValue = "0"
End If
End If
End Sub
- Then add the following the ItemUpdating of the FormView:Protected Sub EmployeeDetailsFormView_ItemUpdating(ByVal sender As Object, ByVal e As FormViewUpdateEventArgs) Handles EmployeeDetailsFormView.ItemUpdating
Dim Location_DropDownList As DropDownList = CType(EmployeeDetailsFormView.FindControl("Location_DropDownList"), DropDownList)
e.NewValues("LocationId") = Location_DropDownList.SelectedValue
End Sub
===== Breaking Excel VBA Project Passwords =====
- Open the Excel file in a Hex Editor (XVI32 will do nicely).
- Search for the text string "DPB=".
- Change it to "DPx=".
- Save and close.
- Open in Excel.
- Open VBA project (Alt + F11) - ignore errors.
- Right click the project and select //Foo Properties...//
- Change the password and save.
===== Running Unit Tests with Code Coverage =====
==== Create the Test Settings ====
- In Visual Studio, from the main menu, select //Test// → //Edit Test Settings// → //Local (Local.testsettings)//.
- [Test Settings] Select the //Save As// button.
- [Save As] Enter 'CodeCoverage.testsettings' and select //OK//.
- [Test Settings] Select //Data and Diagnostics//.
- [Test Settings] Enable //Code Coverage//.
- [Test Settings] Double-click //Code Coverage//.
- [Code Coverage Detail] Select the assembly or assemblies that you wish to have code coverage for. Normally this would be the non-test assemblies.
- [Code Coverage Detail] Select OK.
- [Test Settings] Select //Apply// and then //Close//.
- [Save Dialog] Select //Yes//.
- Done. Test settings should be checked into source control.
==== Running Unit Test with Code Coverage ====
- In Visual Studio, from the main menu, select //Test// → //Select Active Test Settings// → //Local (CodeCoverage.testsettings)//.
- Change the build configuration to **Debug**.
- From the main menu, select //Build// → //Configuration Manager...//.
- [Configuration Manager] Set the //Active Solution Configuration// to **Debug**.
- [Configuration Manager] Select //Close//.
- If the target is signed, temporarily remove it.
- Open the project properties.
- Select the //Signing// tab.
- Uncheck the //Sign the assembly// check box.
- Save the project.
- Run the unit tests.
- Turn the Code Coverage Colouring on and off in the Code Coverage Results window.
===== Converting a Web Site Project to a Web Application Project =====
...and maintaining version history.
- [SubVersion] Export the trunk to a temp directory.
* ''C:\Temp\SuperApp\trunk''
- [Text Editor] In the temp solution, open the solution file.
* ''C:\Temp\SuperApp\trunk\SuperApp.sln''
- [Text Editor] Find the section that has Web Site Project. It will look something like:Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "SuperApp.Web", "SuperApp.Web", "{C92B633A-C441-4FB6-904B-EEA604BAAF15}"
ProjectSection(WebsiteProperties) = preProject
...
ProjectReferences = "{0A231AD6-AF0C-45C1-B441-2AB97BC40975}|SuperApp.DataAccess.dll;{96DC8217-C24D-4851-B4C2-92FBE60727CC}|SuperApp.Business.dll;"
...
EndProjectSection
EndProject
- [Text Editor] Note down any project references for later. In the example above, the Web Site Project references ''SuperApp.DataAccess.dll'' and ''SuperApp.Business.dll''.
- [Text Editor] Delete the entire Web Site Project (from ''Project'' to ''EndProject'' inclusive) and save.
- [Windows Explorer] In the temp solution, delete the entire Web Site Project directory
* ''C:\Temp\SuperApp\trunk\SuperApp.Web''
- [Visual Studio] Open the temp solution.
- [Visual Studio] Create a new ASP.NET Empty Web Application in the old Web Site Project directory. **Make sure it is the correct language (VB or C#)!** The language of new ASP.NET Empty Web Application **must** match the existing Web Site Project.
* C:\Temp\SuperApp\trunk\SuperApp.Web
- [Visual Studio] Save and close.
- [SubVersion] Copy and rename to a branch.
* ''C:\Dev\SuperApp\trunk'' -> ''C:\Dev\SuperApp\branches\Converting to Web App''
- [Text Editor] In the branch solution, open the solution file.
* ''C:\Temp\SuperApp\branches\Converting to Web App\SuperApp.sln''
- [Text Editor] Remove the Web Site Project and save.
- [Windows Explorer] Copy from the temp solution to the branch solution:
* (C#) ''C:\Temp\SuperApp\trunk\SuperApp.Web\Properties'' -> ''C:\Temp\SuperApp\branches\Converting to Web App\SuperApp.Web''
* (VB) ''C:\Temp\SuperApp\trunk\SuperApp.Web\My Project'' -> ''C:\Temp\SuperApp\branches\Converting to Web App\SuperApp.Web''
* ''C:\Temp\SuperApp\trunk\SuperApp.Web\SuperApp.Web.csproj'' -> ''C:\Temp\SuperApp\branches\Converting to Web App\SuperApp.Web''
* ''C:\Temp\SuperApp\trunk\SuperApp.Web\Web.Debug.config'' -> ''C:\Temp\SuperApp\branches\Converting to Web App\SuperApp.Web''
* ''C:\Temp\SuperApp\trunk\SuperApp.Web\Web.Release.config'' -> ''C:\Temp\SuperApp\branches\Converting to Web App\SuperApp.Web''
- [Text Editor] The Web.config in the branch solution probably does not need to be changed, but open both and check just in case.
* ''C:\Dev\SuperApp\branches\Converting to Web App\SuperApp.Web\Web.config''
* ''C:\Temp\SuperApp\trunk\SuperApp.Web\Web.config''
- [Visual Studio] Open the branch solution.
- [Visual Studio] In the Solution Explorer, turn on Show All files.
- [Visual Studio] In the Web App project, include all the file and directories except the Bin and Obj directories.
- [Visual Studio] Right click the Web App project and select Manage NuGet Packages.
- [Visual Studio, Manage NuGet Packages dialog] If there is a message about restoring NuGet packages, do it.
- [Visual Studio] Add the project references noted down in step 4.
- [Visual Studio] Right click each ''ASPX'' file and select Convert To Web Application.
- [Visual Studio] Set the Web App project as the start up project, and set the appropriate start page.
- [Visual Studio] Cross fingers and run it.
===== Click To Reveal Row =====
|
...
|
...
Private _alternateRow As Boolean
Protected ReadOnly Property AlternatingGridRowClass() As String
Get
_alternateRow = Not _alternateRow
Return If(_alternateRow, "GridAlternatingRow", "GridRow")
End Get
End Property
===== Debug Update Parameters =====
Protected Sub Foo_ObjectDataSource_Updating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.ObjectDataSourceMethodEventArgs) _
Handles Foo_ObjectDataSource.Updating
Dim iod As IOrderedDictionary = e.InputParameters
For Each de As DictionaryEntry In iod
System.Diagnostics.debug.print(de.Key & "=" & de.Value)
Next
End Sub
===== XhtmlConformance Breaks UpdatePanel =====
ASP.NET's UpdatePanel will not work if xhtmlConformance mode is set to Legacy in the ''Web.config'' file:
Take it out of the ''Web.config'' file - it almost certainly does not need to be in there.
===== Set Up VLC Remote =====
With **administrator** privileges, edit the ''C:\Program Files (x86)\VideoLAN\VLC\lua\http\.hosts'' file, and set it to:
::/0
0.0.0.0/0
This will probably need to be done every time a new version of VLC is installed.
===== Netcetera Internal Server Error =====
{{::netcetera_internal_server_error.png|}}
Probably caused by the ''Web.config'' file. Remove the following, if they exist:
Removing these from the ''Web.config'' doesn't seem to matter, but if it does, try adding the relevant DLL files and see if that fixes the problem.