Temporary Forum Oddities
#71
When I use the IDE to Export As... Forum codebox (to clipboard) I get prettier code (see below), but still the unaligned text.

Code: (Select All)

TYPE StarType '              definition of a star
    x AS INTEGER '            x coordinate
    y AS INTEGER '            y coordinate
END TYPE

DIM Star(100) AS StarType '  star array      (LOCAL to the main program level)
DIM s AS INTEGER '            generic counter  (LOCAL to the main program level)
DIM ScreenWidth AS INTEGER '  width of screen  (LOCAL to the main program level)
DIM ScreenHeight AS INTEGER ' height of screen (LOCAL to the main program level)

RANDOMIZE TIMER '            seed random number generator
ScreenWidth = 640 '          set screen width
ScreenHeight = 480 '          set screen height

'-----------------------------------------------------------------------------------
' A subroutine using GOSUB and a local array
GOSUB PopulateStars
PRINT UBOUND(Star); "stars created (array LOCAL at main program level using GOSUB)"
'-----------------------------------------------------------------------------------

'-----------------------------------------------------------------------------------
' A subroutine using SUB and an array passed by reference
Populate_Stars Star()
PRINT UBOUND(Star); "stars created (array passed by reference into SUB)"
'-----------------------------------------------------------------------------------

'-----------------------------------------------------------------------------------
' A subroutine using SUB and an array that has been SHARED
Populate__Stars
PRINT UBOUND(Star); "stars created (array SHARED in SUB)"
'-----------------------------------------------------------------------------------

'-----------------------------------------------------------------------------------
' A function using FUNCTION and an array passed by reference
PRINT Populate_and_count_Stars(Star()); "stars created (array passed by reference into FUNCTION)"
'-----------------------------------------------------------------------------------

'-----------------------------------------------------------------------------------
' A function using FUNCTION and an array that has been SHARED
PRINT Populate_and_count_Stars2; "stars created (array SHARED in FUNCTION)"
'-----------------------------------------------------------------------------------

END


'-----------------------------------------------------------------------------------
' Everything LOCAL to the main program level
'-----------------------------------------------------------------------------------
PopulateStars: ' subroutine to populate Star() array

FOR s = 1 TO UBOUND(Star) '                cycle through array
    Star(s).x = INT(RND * ScreenWidth) '  create random star coordinates
    Star(s).y = INT(RND * ScreenHeight)
NEXT s

RETURN '                                  return to next command statement
'-----------------------------------------------------------------------------------

'-----------------------------------------------------------------------------------
' An array passed into a subroutine by reference
'-----------------------------------------------------------------------------------
SUB Populate_Stars (Array() AS StarType)

    ' Any changes in Array() will be passed back to Star()
    ' Star() has been passed 'by reference' into Array()

    SHARED ScreenWidth AS INTEGER '  share the variable from main program level
    SHARED ScreenHeight AS INTEGER ' share the variable from main program level
    DIM s AS INTEGER '              generic counter (LOCAL to this subroutine)

    FOR s = 1 TO UBOUND(Array) '              cycle through array
        Array(s).x = INT(RND * ScreenWidth) ' create random star coordinates
        Array(s).y = INT(RND * ScreenHeight)
    NEXT s

END SUB '                                    return to next command statement
'-----------------------------------------------------------------------------------

'-----------------------------------------------------------------------------------
' A SHARED array from the main program level
'-----------------------------------------------------------------------------------
SUB Populate__Stars ()

    ' Any changes in Star() will be saved when subroutine exits

    SHARED ScreenWidth AS INTEGER '  share the variable from main program level
    SHARED ScreenHeight AS INTEGER ' share the variable from main program level
    SHARED Star() AS StarType '      share the array from the main program level
    DIM s AS INTEGER '              generic counter (LOCAL to this subroutine)

    FOR s = 1 TO UBOUND(Star) '              cycle through array
        Star(s).x = INT(RND * ScreenWidth) ' create random star coordinates
        Star(s).y = INT(RND * ScreenHeight)
    NEXT s

END SUB '                                    return to the next command statement
'-----------------------------------------------------------------------------------

'-----------------------------------------------------------------------------------
' An array passed into a function by reference
'-----------------------------------------------------------------------------------
FUNCTION Populate_and_count_Stars (Array() AS StarType)

    ' Any changes in Array() will be passed back to Star()
    ' Star() has been passed 'by reference' into Array()

    SHARED ScreenWidth AS INTEGER '  share the variable from main program level
    SHARED ScreenHeight AS INTEGER ' share the variable from main program level
    DIM s AS INTEGER '              generic counter (LOCAL to this subroutine)

    FOR s = 1 TO UBOUND(Array) '              cycle through array
        Array(s).x = INT(RND * ScreenWidth) '  create random star coordinates
        Array(s).y = INT(RND * ScreenHeight)
    NEXT s
    Populate_and_count_Stars = UBOUND(Array) ' return size of the array passed in

END FUNCTION '                                return to the next command statement
'-----------------------------------------------------------------------------------

'-----------------------------------------------------------------------------------
' A SHARED array from the main program level
'-----------------------------------------------------------------------------------
FUNCTION Populate_and_count_Stars2 ()

    ' Any changes in Star() will be saved when function exits

    SHARED ScreenWidth AS INTEGER '  share the variable from main program level
    SHARED ScreenHeight AS INTEGER ' share the variable from main program level
    SHARED Star() AS StarType '      share the array from the main program level
    DIM s AS INTEGER '              generic counter (LOCAL to this subroutine)

    FOR s = 1 TO UBOUND(Star) '                cycle through array
        Star(s).x = INT(RND * ScreenWidth) '  create random star coordinates
        Star(s).y = INT(RND * ScreenHeight)
    NEXT s
    Populate_and_count_Stars2 = UBOUND(Star) ' return size of the array passed in

END FUNCTION '                                return to the next command statement
'-----------------------------------------------------------------------------------
Software and cathedrals are much the same — first we build them, then we pray.
QB64 Tutorial
Reply
#72
"But there is no syntax highlighting? I like the syntax highlighting."

Yeah me too! If those lined up before, they are likely to get that fixed again.

But then what would qb = export be good for? Something about copy/paste to Wiki or other WP's?
b = b + ...
Reply
#73
(06-22-2023, 03:39 PM)bplus Wrote: "But there is no syntax highlighting? I like the syntax highlighting."

Yeah me too! If those lined up before, they are likely to get that fixed again.

But then what would qb = export be good for? Something about copy/paste to Wiki or other WP's?

If you export the code from the IDE to clipboard you get the result I posted above. All highlighting and hyperlinks work perfectly. Just that nagging slight misalignment.
Software and cathedrals are much the same — first we build them, then we pray.
QB64 Tutorial
Reply
#74
I vote for one tag that does it all! Smile  

Man I am ready to vote for something LOL
b = b + ...
Reply
#75
(06-22-2023, 03:44 PM)bplus Wrote: I vote for one tag that does it all! Smile  

Man I am ready to vote for something LOL
Well the nicest is exporting from the IDE as a code box. It preserves the colors perfectly and allows users to click on keywords to take them straight to the Wiki. A very nice addition to the IDE. I like all the new Export features.
Software and cathedrals are much the same — first we build them, then we pray.
QB64 Tutorial
Reply
#76
(06-22-2023, 03:25 PM)TerryRitchie Wrote:
(06-22-2023, 03:18 PM)bplus Wrote:
(06-22-2023, 02:37 PM)RhoSigma Wrote: Hi Terry, indeed this seems to happen with the [ q b ] code tag and as I noticed somtimes it even get worse after editing/updating a post containing such codeboxes, but couldn't find out a cause for that to give @grymmjack a hint where to look for a fix.

However, you know and used already the IDE code export facility in your tutorial. Since v3.8.0 you can also export into a [ q b = e x p o r t ] forum codebox which preserves all spacing and links keywords to the Wiki pages as usual. The only "disadvantage" is that this type of codebox does not have line numbers.

Ah good an example of qb = export to test!
Code: (Select All)

_Title "test my 3 for 1 function" ' b+ 2023-06-22
For i = 1 To 12
    Print FillNumberStr$(i, "0", 1234), FillNumberStr$(i, " ", 1234), FillNumberStr$(i, "_", 1234)
Next
Print "Result make sure places is greater or equal to longest number to display"
Print "In the 1234 example that would be 4 digits for places"

Function TS$ (nn) '                                        this comment started on column 60
    TS$ = Right$("0000" + LTrim$(Str$(nn)), 4)
End Function
Function TS1$ (nn1) '                                      this comment started on column 60
    TS1$ = Right$("00" + LTrim$(Str$(nn1)), 2)
End Function
Function TS2$ (nn2) '                                      this comment started on column 60
    TS2$ = Right$("000" + LTrim$(Str$(nn2)), 3)
End Function

'  replace above Functions with a generic string filler 2023-06-22
Function FillNumberStr$ (places As Integer, char$, number As Long)
    '                                                      make sure places is >= to longest (in digits)
    '                                                      number to display, char$ might work oddly
    '                                                      with more than 1 alphanumeric.
    FillNumberStr$ = Right$(String$(places, char$) + _Trim$(Str$(number)), places)
End Function

Looks like that worked, all my comments line up on column 60.
But there is no syntax highlighting? I like the syntax highlighting.

You've actually to do the export from the IDE, it inserts BBCode for coloring and wiki links. Just open a [ q b = e x p o r t] tag and then inserting plain code will just show plain code.

Code: (Select All)
_TITLE "test my 3 for 1 function" ' b+ 2023-06-22
FOR i = 1 TO 12
    PRINT FillNumberStr$(i, "0", 1234), FillNumberStr$(i, " ", 1234), FillNumberStr$(i, "_", 1234)
NEXT
PRINT "Result make sure places is greater or equal to longest number to display"
PRINT "In the 1234 example that would be 4 digits for places"

FUNCTION TS$ (nn) '                                        this comment started on column 60
TS$ = RIGHT$("0000" + LTRIM$(STR$(nn)), 4)
END FUNCTION
FUNCTION TS1$ (nn1) '                                      this comment started on column 60
TS1$ = RIGHT$("00" + LTRIM$(STR$(nn1)), 2)
END FUNCTION
FUNCTION TS2$ (nn2) '                                      this comment started on column 60
TS2$ = RIGHT$("000" + LTRIM$(STR$(nn2)), 3)
END FUNCTION

'  replace above Functions with a generic string filler 2023-06-22
FUNCTION FillNumberStr$ (places AS INTEGER, char$, number AS LONG)
'                                                      make sure places is >= to longest (in digits)
'                                                      number to display, char$ might work oddly
'                                                      with more than 1 alphanumeric.
FillNumberStr$ = RIGHT$(STRING$(places, char$) + _TRIM$(STR$(number)), places)
END FUNCTION
Reply
#77
(06-22-2023, 03:41 PM)TerryRitchie Wrote: Just that nagging slight misalignment.

That's interresting, that would imply it's already missaligned by the code formatter in the IDE as I only insert bbcode on what the IDE gives me, but you're sure it's well aligned right before you export it?
Huh
Reply
#78
Ah so one tag can do it all Smile  my first export:

Code: (Select All)
_Title "test my 3 for 1 function" ' b+ 2023-06-22
For i = 1 To 12
    Print FillNumberStr$(i, "0", 1234), FillNumberStr$(i, " ", 1234), FillNumberStr$(i, "_", 1234)
Next
Print "Result make sure places is greater or equal to longest number to display"
Print "In the 1234 example that would be 4 digits for places"

Function TS$ (nn) '                                        this comment started on column 60
    TS$ = Right$("0000" + LTrim$(Str$(nn)), 4)
End Function
Function TS1$ (nn1) '                                      this comment started on column 60
    TS1$ = Right$("00" + LTrim$(Str$(nn1)), 2)
End Function
Function TS2$ (nn2) '                                      this comment started on column 60
    TS2$ = Right$("000" + LTrim$(Str$(nn2)), 3)
End Function

'  replace above Functions with a generic string filler 2023-06-22
Function FillNumberStr$ (places As Integer, char$, number As Long)
    '                                                      make sure places is >= to longest (in digits)
    '                                                      number to display, char$ might work oddly
    '                                                      with more than 1 alphanumeric.
    FillNumberStr$ = Right$(String$(places, char$) + _Trim$(Str$(number)), places)
End Function

Oh it has the tags built into the clipboard copy!

Except no line numbers, so now it's a rule with an exception Smile
b = b + ...
Reply
#79
(06-22-2023, 05:01 PM)RhoSigma Wrote:
(06-22-2023, 03:41 PM)TerryRitchie Wrote: Just that nagging slight misalignment.

That's interresting, that would imply it's already missaligned by the code formatter in the IDE as I only insert bbcode on what the IDE gives me, but you're sure it's well aligned right before you export it?
Huh
Yes, everything is aligned.
Software and cathedrals are much the same — first we build them, then we pray.
QB64 Tutorial
Reply
#80
(06-17-2023, 01:46 PM)grymmjack Wrote: How do you like Manjaro? I've heard good things about it and tried it way way back when it first came out in a VM but never gave it too much love.

This is one of the best distros IMHO. It was my first one with KDE Plasma last year. Heart

Indeed, it seems to be the best with KDE but I don't want to sound opinionated. I also have it installed as daily driver with MATE (old GNOME).

It's really not as bad as some people say but it's their fault they have weird configurations, build "dream" desktop and gaming systems with components that don't really match and dedicated to breaking stuff instead of actually using the system. The ongoing things about AMD, NVIDIA, some "nvme" disk drives being incompatible etc. could happen with any distro. Manjaro isn't any different. However because it's based on Arch Linux, it might unsettle someone used to Debian- or Ubuntu-base and isn't called to updating the system as much. I'd say Manjaro could be safely updated once a week. On something closer to Arch, the urge is to do it everyday or every few days but that could get tiresome and it could require a very good system backup/rollback.

If you're that worried about apps not starting "suddenly" after update, then Manjaro (not only Garuda which programmers seem to have broken off Manjaro) could be installed with "btrfs" file system instead of the unofficial standard "ext4". I wouldn't be able to tell you a lot about that. I tried Garuda MATE for a short time but didn't check out how the system snapshot thing worked. For that one installing with "btrfs" and with at least 30GB "root" partition size is a terminal requirement. OTOH could install Manjaro on a slightly smaller partition like I have at least ten times successfully.

Install with GNOME D.E. only if you have a fast, modern computer, not a budget laptop with 4GB RAM like me. Otherwise it will be slow; I couldn't tolerate both GNOME Software and Pamac for installing any software. XFCE is OK too. Those two desktop environments and KDE are the "officially" supported flavors of Manjaro. I said I have MATE but that came from "community" effort and therefore that will suffer progress which is later than the other three. It could be had with Cinnamon, which is Linux Mint's desktop environment, and looks pretty good (like Ubuntu Cinnamon) but it was also too slow on my computer to be tolerable.

Could install applications in Flatpak format but that could eat a lot of memory on the SSD. There are also AppImages for Audacity, Firefox, Inkscape, Libreoffice etc. but less of those than Flatpaks. One good thing about AppImages is that you could just erase it if you don't like it and not have to worry about "residue" of libraries and other junk needed by the program. The only "residue" would be the configuration of the program for the regular user, usually in "/home/(user)/.config". Flatpaks might be the same way but uninstalling "everything" might mean taking down a few modules separately and you have to know which ones. From Ubuntu there's this thing called Snaps that I don't want to go into detail into because they are advertising it as even better than the other two ways described here to provide applications.

I cannot have a virtual machine on my computer, whether or not I have enough memory.
Reply




Users browsing this thread: 30 Guest(s)