-
Notifications
You must be signed in to change notification settings - Fork 174
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrating Rule “have-a-resetdefault-function-to-handle-messed-up-user…
…-settings/rule” (#8224) * Create Rule “have-a-resetdefault-function-to-handle-messed-up-user-settings/rule” * Update rule.md --------- Co-authored-by: Tiago Araújo [SSW] <[email protected]>
- Loading branch information
Showing
1 changed file
with
43 additions
and
0 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
rules/have-a-resetdefault-function-to-handle-messed-up-user-settings/rule.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
--- | ||
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 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. | ||
|
||
<!--endintro--> | ||
|
||
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 ... | ||
``` |