From a792bd8488f5408011f94d6a2c0ee2929f6593ed Mon Sep 17 00:00:00 2001 From: Igor Goldobin Date: Sat, 23 Mar 2024 11:25:34 +1000 Subject: [PATCH 1/2] =?UTF-8?q?Create=20Rule=20=E2=80=9Chave-a-resetdefaul?= =?UTF-8?q?t-function-to-handle-messed-up-user-settings/rule=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../rule.md | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 rules/have-a-resetdefault-function-to-handle-messed-up-user-settings/rule.md diff --git a/rules/have-a-resetdefault-function-to-handle-messed-up-user-settings/rule.md b/rules/have-a-resetdefault-function-to-handle-messed-up-user-settings/rule.md new file mode 100644 index 00000000000..2cf979ea197 --- /dev/null +++ b/rules/have-a-resetdefault-function-to-handle-messed-up-user-settings/rule.md @@ -0,0 +1,42 @@ +--- +type: rule +title: Do you have a ResetDefault() function to handle messed up user settings? +uri: have-a-resetdefault-function-to-handle-messed-up-user-settings +authors: + - title: Adam Cogan + url: https://ssw.com.au/people/adam-cogan/ +created: 2014-03-14T00:22:00.000Z +guid: 6696b1b2-dcd7-475a-990e-b5d610f0a122 +--- +In our development life cycle, developers always have different Settings to the user's settings. Because of this, debug settings won't always work on the remote machine. + +In order to have settings.config, we also have a defaults.config. This is good because this gives a chance for the user to roll back bad settings without reinstalling the application. The application can also roll back the settings it automatically. Below is the code that what we do. + +VB.NET + +```vb +Public Sub RuneXtremeEmail(ByVal state As Object) + + If Environment.MachineName <> Configuration.MachineName Then + + resetSettings() + + Else +End +``` + +We have a program called [SSW Code Auditor](https://ssw.com.au/ssw/CodeAuditor/) to check for this rule. + +We have a program called [SSW .NET Toolkit](https://ssw.com.au/ssw/NETToolkit/) that implements this rule. + +*Note: in Access we do like this* + +```vb +Private Sub Form_Load() + + If Nz(DLookup("CurrentComputerName", "ControlLocal", "ID=1"), "") <> CurrentComputerName + Then + Me.ctlCurrentComputerName.Value = CurrentComputerName + Else ... +``` + From c853759f19d5f8479874534fdc7855ffa9e5d4c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tiago=20Ara=C3=BAjo=20=5BSSW=5D?= Date: Mon, 25 Mar 2024 15:38:06 -0300 Subject: [PATCH 2/2] Update rule.md --- .../rule.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/rules/have-a-resetdefault-function-to-handle-messed-up-user-settings/rule.md b/rules/have-a-resetdefault-function-to-handle-messed-up-user-settings/rule.md index 2cf979ea197..782dff7b1a1 100644 --- a/rules/have-a-resetdefault-function-to-handle-messed-up-user-settings/rule.md +++ b/rules/have-a-resetdefault-function-to-handle-messed-up-user-settings/rule.md @@ -8,10 +8,12 @@ authors: created: 2014-03-14T00:22:00.000Z guid: 6696b1b2-dcd7-475a-990e-b5d610f0a122 --- -In our development life cycle, developers always have different Settings to the user's settings. Because of this, debug settings won't always work on the remote machine. +In development life cycle, developers always have different settings to the user's settings. Because of this, debug settings won't always work on the remote machine. In order to have settings.config, we also have a defaults.config. This is good because this gives a chance for the user to roll back bad settings without reinstalling the application. The application can also roll back the settings it automatically. Below is the code that what we do. - + + + VB.NET ```vb @@ -39,4 +41,3 @@ Private Sub Form_Load() Me.ctlCurrentComputerName.Value = CurrentComputerName Else ... ``` -