Alex Sokolek
Member
- Joined
- Apr 5, 2024
- Messages
- 44
- Thread Author
-
- #1
Hi. I am still unable to properly post code on your site. The indentation get ignored. I tried backticks (```), tildas (~~~) and backticks with c++ (```c++).
I use Visual Studio 2022 Community Edition, but I don't think that matters. When I post, I use Chrome, and I manually type the backticks, then paste the code. Any ideas? Thank you.
I use Visual Studio 2022 Community Edition, but I don't think that matters. When I post, I use Chrome, and I manually type the backticks, then paste the code. Any ideas? Thank you.
Solution
Hello, I'm sorry to hear that you're experiencing difficulties with posting your code. The issue you're encountering is a common one and can be easily rectified. Let's try to solve this step by step:
- Make sure you are using the right syntax: To insert code, you'll want to utilize markdown syntax. Enclosing your code in triple backticks (
) should function correctly as long as there are no spaces between them. You can specify the language like (c++), but not all forums support this. - Ensuring correct indentation: Online forums use HTML/XML-based systems which don't maintain 'white-space' characters like tabs and multiple spaces. You might need to wrap your code in and tags to maintain the indentations.
- Replace tabs with...
- Joined
- Mar 14, 2023
- Messages
- 100,334
Hello, I'm sorry to hear that you're experiencing difficulties with posting your code. The issue you're encountering is a common one and can be easily rectified. Let's try to solve this step by step:
- Make sure you are using the right syntax: To insert code, you'll want to utilize markdown syntax. Enclosing your code in triple backticks (
) should function correctly as long as there are no spaces between them. You can specify the language like (c++), but not all forums support this. - Ensuring correct indentation: Online forums use HTML/XML-based systems which don't maintain 'white-space' characters like tabs and multiple spaces. You might need to wrap your code in and tags to maintain the indentations.
- Replace tabs with spaces: In Visual Studio, you can replace tabs with spaces which can help keep code formatting intact. Go to Tools -> Options -> Text Editor -> All Languages -> Tabs, and check "Insert spaces". This will replace your tabs with the equivalent spaces next time you tab, preserving the indentation when you copy-paste.
- Use a code snippet manager: There are plugins that can convert your code into an HTML snippet which can then be pasted into the post editor. GistBox Clipper is one such extension for Chrome.
- Use paste services: As a final resort, if the forum does not handle code well, services like Pastebin or GitHub Gist allow you to paste your code, which is then saved with a unique URL you can share. If these steps aren't helpful, kindly let provide us with the exact error or issue you're encountering for further assistance. Happy coding!
Alex Sokolek
Member
- Joined
- Apr 5, 2024
- Messages
- 44
- Thread Author
-
- #3
This is a test. I am trying with spaces instead of tabs, and wrapping with pre and /pre tags.
```
<pre>
BOOL swap;
tagFileNode* TempNode;
int i, j, diff = 0;
for (j = _NodeCount / 2; j > 0; j /= 2)
{
swap = true;
while (swap)
{
swap = false;
for (i = 0; i + j < _NodeCount; ++i)
{
switch (SortMode)
{
case 0: // By FileHash, then by FileName
diff = HashCompare(_NodeList->FileHash->c_str(), _NodeList[i + j]->FileHash->c_str());
if (diff == 0) diff = FileCompare(_NodeList->FileName->c_str(), _NodeList[i + j]->FileName->c_str());
break;
case 1: // By FileName alone
diff = FileCompare(_NodeList->FileName->c_str(), _NodeList[i + j]->FileName->c_str());
break;
case 2: // By FileDate, then by FileTime, then by FileName
diff = DateCompare(_NodeList->FileDate->c_str(), _NodeList[i + j]->FileDate->c_str());
if (diff == 0) diff = TimeCompare(_NodeList->FileTime->c_str(), _NodeList[i + j]->FileTime->c_str());
if (diff == 0) diff = FileCompare(_NodeList->FileName->c_str(), _NodeList[i + j]->FileName->c_str());
break;
case 3: // By FileSize, then by FileName
diff = SizeCompare(_NodeList->FileSize->c_str(), _NodeList[i + j]->FileSize->c_str());
if (diff == 0) diff = FileCompare(_NodeList->FileName->c_str(), _NodeList[i + j]->FileName->c_str());
break;
}
if (diff > 0)
{
swap = true;
TempNode = _NodeList;
_NodeList = _NodeList[i + j];
_NodeList[i + j] = TempNode;
}
}
}
}
<\pre>
```
```
<pre>
BOOL swap;
tagFileNode* TempNode;
int i, j, diff = 0;
for (j = _NodeCount / 2; j > 0; j /= 2)
{
swap = true;
while (swap)
{
swap = false;
for (i = 0; i + j < _NodeCount; ++i)
{
switch (SortMode)
{
case 0: // By FileHash, then by FileName
diff = HashCompare(_NodeList->FileHash->c_str(), _NodeList[i + j]->FileHash->c_str());
if (diff == 0) diff = FileCompare(_NodeList->FileName->c_str(), _NodeList[i + j]->FileName->c_str());
break;
case 1: // By FileName alone
diff = FileCompare(_NodeList->FileName->c_str(), _NodeList[i + j]->FileName->c_str());
break;
case 2: // By FileDate, then by FileTime, then by FileName
diff = DateCompare(_NodeList->FileDate->c_str(), _NodeList[i + j]->FileDate->c_str());
if (diff == 0) diff = TimeCompare(_NodeList->FileTime->c_str(), _NodeList[i + j]->FileTime->c_str());
if (diff == 0) diff = FileCompare(_NodeList->FileName->c_str(), _NodeList[i + j]->FileName->c_str());
break;
case 3: // By FileSize, then by FileName
diff = SizeCompare(_NodeList->FileSize->c_str(), _NodeList[i + j]->FileSize->c_str());
if (diff == 0) diff = FileCompare(_NodeList->FileName->c_str(), _NodeList[i + j]->FileName->c_str());
break;
}
if (diff > 0)
{
swap = true;
TempNode = _NodeList;
_NodeList = _NodeList[i + j];
_NodeList[i + j] = TempNode;
}
}
}
}
<\pre>
```
Alex Sokolek
Member
- Joined
- Apr 5, 2024
- Messages
- 44
- Thread Author
-
- #4
Sorry, it still does not work. (I am using the backtick that is below the tilda (~) key. Please help, as I would like to be able to post code.
Alex Sokolek
Member
- Joined
- Apr 5, 2024
- Messages
- 44
- Thread Author
-
- #5
I tried to install GistBox Clipper. Norton 360 popped up AND REPORTED MALWARE, SPECIFICALLY Heur.ADVML.B in AutoUpdater.exe.
Needless to say, I am pissed. Norton blocked the activity, but I still should not have to worry. Please review this event and report back to me. Thank you.
Needless to say, I am pissed. Norton blocked the activity, but I still should not have to worry. Please review this event and report back to me. Thank you.
Alex Sokolek
Member
- Joined
- Apr 5, 2024
- Messages
- 44
- Thread Author
-
- #6
This is a test. This time I am replacing tabs with "... " and I believe it will work.
void HashedFiles::SortAndCheck(int SortMode)
{
... // Shell Sort
... BOOL swap;
... tagFileNode* TempNode;
... int i, j, diff = 0;
... for (j = _NodeCount / 2; j > 0; j /= 2)
... {
... ... swap = true;
... ... while (swap)
... ... {
... ... ... swap = false;
... ... ... for (i = 0; i + j < _NodeCount; ++i)
... ... ... {
... ... ... ... switch (SortMode)
... ... ... ... {
... ... ... ... case 0: // By FileHash, then by FileName
... ... ... ... ... diff = HashCompare(_NodeList->FileHash->c_str(), _NodeList[i + j]->FileHash->c_str());
... ... ... ... ... if (diff == 0) diff = FileCompare(_NodeList->FileName->c_str(), _NodeList[i + j]->FileName->c_str());
... ... ... ... ... break;
... ... ... ... case 1: // By FileName alone
... ... ... ... ... diff = FileCompare(_NodeList->FileName->c_str(), _NodeList[i + j]->FileName->c_str());
... ... ... ... ... break;
... ... ... ... case 2: // By FileDate, then by FileTime, then by FileName
... ... ... ... ... diff = DateCompare(_NodeList->FileDate->c_str(), _NodeList[i + j]->FileDate->c_str());
... ... ... ... ... if (diff == 0) diff = TimeCompare(_NodeList->FileTime->c_str(), _NodeList[i + j]->FileTime->c_str());
... ... ... ... ... if (diff == 0) diff = FileCompare(_NodeList->FileName->c_str(), _NodeList[i + j]->FileName->c_str());
... ... ... ... ... break;
... ... ... ... case 3: // By FileSize, then by FileName
... ... ... ... ... diff = SizeCompare(_NodeList->FileSize->c_str(), _NodeList[i + j]->FileSize->c_str());
... ... ... ... ... if (diff == 0) diff = FileCompare(_NodeList->FileName->c_str(), _NodeList[i + j]->FileName->c_str());
... ... ... ... ... break;
... ... ... ... }
... ... ... ... if (diff > 0)
... ... ... ... {
... ... ... ... ... swap = true;
... ... ... ... ... TempNode = _NodeList;
... ... ... ... ... _NodeList = _NodeList[i + j];
... ... ... ... ... _NodeList[i + j] = TempNode;
... ... ... ... }
... ... ... }
... ... }
... }
}
Its not clean, but it is workable. Thanks.
void HashedFiles::SortAndCheck(int SortMode)
{
... // Shell Sort
... BOOL swap;
... tagFileNode* TempNode;
... int i, j, diff = 0;
... for (j = _NodeCount / 2; j > 0; j /= 2)
... {
... ... swap = true;
... ... while (swap)
... ... {
... ... ... swap = false;
... ... ... for (i = 0; i + j < _NodeCount; ++i)
... ... ... {
... ... ... ... switch (SortMode)
... ... ... ... {
... ... ... ... case 0: // By FileHash, then by FileName
... ... ... ... ... diff = HashCompare(_NodeList->FileHash->c_str(), _NodeList[i + j]->FileHash->c_str());
... ... ... ... ... if (diff == 0) diff = FileCompare(_NodeList->FileName->c_str(), _NodeList[i + j]->FileName->c_str());
... ... ... ... ... break;
... ... ... ... case 1: // By FileName alone
... ... ... ... ... diff = FileCompare(_NodeList->FileName->c_str(), _NodeList[i + j]->FileName->c_str());
... ... ... ... ... break;
... ... ... ... case 2: // By FileDate, then by FileTime, then by FileName
... ... ... ... ... diff = DateCompare(_NodeList->FileDate->c_str(), _NodeList[i + j]->FileDate->c_str());
... ... ... ... ... if (diff == 0) diff = TimeCompare(_NodeList->FileTime->c_str(), _NodeList[i + j]->FileTime->c_str());
... ... ... ... ... if (diff == 0) diff = FileCompare(_NodeList->FileName->c_str(), _NodeList[i + j]->FileName->c_str());
... ... ... ... ... break;
... ... ... ... case 3: // By FileSize, then by FileName
... ... ... ... ... diff = SizeCompare(_NodeList->FileSize->c_str(), _NodeList[i + j]->FileSize->c_str());
... ... ... ... ... if (diff == 0) diff = FileCompare(_NodeList->FileName->c_str(), _NodeList[i + j]->FileName->c_str());
... ... ... ... ... break;
... ... ... ... }
... ... ... ... if (diff > 0)
... ... ... ... {
... ... ... ... ... swap = true;
... ... ... ... ... TempNode = _NodeList;
... ... ... ... ... _NodeList = _NodeList[i + j];
... ... ... ... ... _NodeList[i + j] = TempNode;
... ... ... ... }
... ... ... }
... ... }
... }
}
Its not clean, but it is workable. Thanks.
Alex Sokolek
Member
- Joined
- Apr 5, 2024
- Messages
- 44
- Thread Author
-
- #7
Hi. After a lot of experimentation and posting, I have tried everything you suggested. I used triple grave accents (```) to bracket my code. I tried replacing tabs with spaces. I tried GistBox. (GistBox is apparently generating a Norton 360 alert.) Nothing works, my white space at the beginning of each line still gets deleted. Also, the same thing applies to LeftSquareBracket i RightSquareBracket, when used as an array index - the site interprets that as a code to switch to italics, and I don't think I should have to switch to pointer addition paradigms to make my point.
Using triple grave accents to bracket a section of quotes works well on StackOverflow. It should work the same in WindowsForum.
Please have someone look at this. Fixing the problem would go a long way towards making your site better. Thanks.
Using triple grave accents to bracket a section of quotes works well on StackOverflow. It should work the same in WindowsForum.
Please have someone look at this. Fixing the problem would go a long way towards making your site better. Thanks.
- Joined
- Jul 22, 2005
- Messages
- 9,243
To format your text as code, type [ code ]your code here[ /code ] without the spaces inside the brackets.Hi. I am still unable to properly post code on your site. The indentation get ignored. I tried backticks (```), tildas (~~~) and backticks with c++ (```c++).
I use Visual Studio 2022 Community Edition, but I don't think that matters. When I post, I use Chrome, and I manually type the backticks, then paste the code. Any ideas? Thank you.
Alex Sokolek
Member
- Joined
- Apr 5, 2024
- Messages
- 44
- Thread Author
-
- #10
This is a test.
Code:
void HashedFiles::SortAndCheck(int SortMode)
{
// Shell Sort
BOOL swap;
tagFileNode* TempNode;
int i, j, diff = 0;
for (j = _NodeCount / 2; j > 0; j /= 2)
{
swap = true;
while (swap)
{
swap = false;
for (i = 0; i + j < _NodeCount; ++i)
{
switch (SortMode)
{
case 0: // By FileHash, then by FileName
diff = HashCompare(_NodeList[i]->FileHash->c_str(), _NodeList[i + j]->FileHash->c_str());
if (diff == 0) diff = FileCompare(_NodeList[i]->FileName->c_str(), _NodeList[i + j]->FileName->c_str());
break;
case 1: // By FileName alone
diff = FileCompare(_NodeList[i]->FileName->c_str(), _NodeList[i + j]->FileName->c_str());
break;
case 2: // By FileDate, then by FileTime, then by FileName
diff = DateCompare(_NodeList[i]->FileDate->c_str(), _NodeList[i + j]->FileDate->c_str());
if (diff == 0) diff = TimeCompare(_NodeList[i]->FileTime->c_str(), _NodeList[i + j]->FileTime->c_str());
if (diff == 0) diff = FileCompare(_NodeList[i]->FileName->c_str(), _NodeList[i + j]->FileName->c_str());
break;
case 3: // By FileSize, then by FileName
diff = SizeCompare(_NodeList[i]->FileSize->c_str(), _NodeList[i + j]->FileSize->c_str());
if (diff == 0) diff = FileCompare(_NodeList[i]->FileName->c_str(), _NodeList[i + j]->FileName->c_str());
break;
}
if (diff > 0)
{
swap = true;
TempNode = _NodeList[i];
_NodeList[i] = _NodeList[i + j];
_NodeList[i + j] = TempNode;
}
}
}
}
// Scan for duplicate hashes and mark them.
if (SortMode == 0)
{
for (i = 1; i < _NodeCount; ++i)
{
if (_NodeList[i]->FileHash->compare(_NodeList[i - 1]->FileHash->c_str()) == 0)
_NodeList[i]->Duplicate = true; else _NodeList[i]->Duplicate = false;
}
}
}
Alex Sokolek
Member
- Joined
- Apr 5, 2024
- Messages
- 44
- Thread Author
-
- #11
It worked! Thank you very much.
Alex Sokolek
Member
- Joined
- Apr 5, 2024
- Messages
- 44
- Thread Author
-
- #12
p.s. I did not even have to change tabs to spaces, and I did not need to escape the italics command problem i was having with square brackets.
I suggest that the ChatGPT data base be updated to suggest [ code ] and [ /code ] instead of three grave accents.
I suggest that the ChatGPT data base be updated to suggest [ code ] and [ /code ] instead of three grave accents.
- Joined
- Jul 22, 2005
- Messages
- 9,243
It sadly knows very little about even on the website is on. It basically is just API calls to GPT-4. Its possible it could be enhanced down the road!p.s. I did not even have to change tabs to spaces, and I did not need to escape the italics command problem i was having with square brackets.
I suggest that the ChatGPT data base be updated to suggest [ code ] and [ /code ] instead of three grave accents.
- Joined
- Mar 14, 2023
- Messages
- 100,334
It sounds like you're testing ways to post code properly in the forums. Using
If you want to test these again or need help refining your posting method, let me know!
[PRE] tags is a valid approach, but it might not render as expected depending on forum formatting rules. Here's how you can properly post code snippets to ensure readability and styling:Recommended Method for Posting Code:
- Use BBCode for Proper Syntax Highlighting:
- Wrap your code with `
Code:
` tags for forums like XenForo. - Example: ``` [CODE=cpp] BOOL swap; tagFileNode* TempNode; for (int i = 0; i < NodeCount; ++i) { // Your code here }Code:2. **Using PRE Tags (As You’re Doing)**: - Ensure proper formatting by avoiding extra backslashes or unnecessary nesting. - Example: [code] void exampleFunction { cout code] [CODE] 3. **Avoid Mixing Markdown with BBCode**: - The backticks (```) you’re using signal Markdown syntax, but many forums, especially XenForo, don’t interpret Markdown natively. 4. **Indentation**: - If spaces work better than tabs due to formatting quirks, stick with them. But a consistent 4-space indentation often works universally. --- ### Corrected Version of Your Code: Here’s how your code could look using BBCode for structured formatting:C++:BOOL swap; tagFileNode* TempNode; int i, j, diff = 0; for (j = _NodeCount / 2; j > 0; j /= 2) { swap = true; while (swap) { swap = false; for (i = 0; i + j < _NodeCount; ++i) { switch (SortMode) { case 0: // By FileHash, then by FileName diff = HashCompare(_NodeList[i]->FileHash->c_str, _NodeList[i + j]->FileHash->c_str; if (diff == 0) diff = FileCompare(_NodeList[i]->FileName->c_str, _NodeList[i + j]->FileName->c_str; break; case 1: // By FileName alone diff = FileCompare(_NodeList[i]->FileName->c_str, _NodeList[i + j]->FileName->c_str; break; case 2: // By FileDate, then by FileTime, then by FileName diff = DateCompare(_NodeList[i]->FileDate->c_str, _NodeList[i + j]->FileDate->c_str; if (diff == 0) diff = TimeCompare(_NodeList[i]->FileTime->c_str, _NodeList[i + j]->FileTime->c_str; if (diff == 0) diff = FileCompare(_NodeList[i]->FileName->c_str, _NodeList[i + j]->FileName->c_str; break; case 3: // By FileSize, then by FileName diff = SizeCompare(_NodeList[i]->FileSize->c_str, _NodeList[i + j]->FileSize->c_str; if (diff == 0) diff = FileCompare(_NodeList[i]->FileName->c_str, _NodeList[i + j]->FileName->c_str; break; } if (diff > 0) { swap = true; TempNode = _NodeList[i]; _NodeList[i] = _NodeList[i + j]; _NodeList[i + j] = TempNode; } } } }
- Wrap your code with `
Tips:
- If your forum supports syntax highlighting, always specify the language in the
[CODE=language]tag (likecppfor C++ in this case). - Avoid escaping tags (
); simply close tags normally ().
If you want to test these again or need help refining your posting method, let me know!
Similar threads
- Replies
- 3
- Views
- 4K