Recent posts

#1
Bug Reports / Re: Main website links include...
Last post by MrBcx - May 11, 2025, 05:14:06 PM
Quin,

The line breaks are neither random nor broken. 

I designed those cells to look that way.

#2
Bug Reports / Main website links include lin...
Last post by Quin - May 11, 2025, 04:55:41 PM
MrBcx,
All of the links at the top of the bcxbasiccoders.com homepage have random line breaks in them. For example:
BCX
User messages
instead of
BCX User Messages
Is it possible for this to be fixed, at least for screen readers? Robert might know more about how to do this.
Thanks!
#3
Off-Topic Discussions / Re: AI on a Pentium 2 PC
Last post by MrBcx - May 09, 2025, 08:47:55 AM
I'm sure the team had fun tinkering but I'd bet that their retro
project is unlikely to yield any meaningful new discoveries.

A 1B Llama LLM is a weak model and getting the inferencer to "run"
it, at 1 token per second, is pain on top of pain on top of pain.

#4
Off-Topic Discussions / AI on a Pentium 2 PC
Last post by jbk - May 09, 2025, 05:01:00 AM
"Someone Experimented With a 1997 Processor and Showed That Only 128 MB of Ram Were Needed to Run a Modern AI" https://indiandefencereview.com/someone-experimented-with-a-1997-processor-and-showed-that-only-128-mb-of-ram-were-needed-to-run-a-modern-ai/

this should be an interesting read for MrBcx
#5
Questions & Answers / Re: Using Tix_Now and friends ...
Last post by MrBcx - May 08, 2025, 09:03:31 PM
I'm guessing my edited version below is a bit closer to what you're going for.

I had to change the gui control arrangement because I am not blind and I needed
to see what was being displayed.   ;)

Code that I've added include a trailing comment: ' Added by MrBcx

HTH


$No_Borland
$Noini
$No_LCCWin
$No_VKKeys
Gui "SwatchWndClass", Pixels

Enum
    IDC_START_PAUSE = 101
    IDC_RESET
    IDC_TIME_LABEL
    IDC_TIME_FIELD
    IDT_UPDATE_TIMER = 200
End Enum

Global As Control MainForm, StartPauseButton, ResetButton, TimeLabel, TimeField
Global Running As Bool
Global Elapsed#, Start#
Global tix_started As Bool   ' Added by MrBcx

Sub Formload
    MainForm = Bcx_Form("Swatch", 0, 0, 400, 200)
    StartPauseButton = Bcx_Button("&Start", MainForm, IDC_START_PAUSE, 5, 5, 50, 50)
    ResetButton = Bcx_Button("&Reset", MainForm, IDC_RESET, 5, 100, 50, 50)
    EnableWindow(ResetButton, False)
    TimeLabel = Bcx_Label("Time &elapsed", MainForm, IDC_TIME_LABEL, 100, 5, 230, 30)
    TimeField = Bcx_Input(GetElapsed$(), MainForm, IDC_TIME_FIELD, 100, 35, 230, 40, WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_LEFT | ES_READONLY)
    Center(MainForm)
    Show(MainForm)
    SetFocus(StartPauseButton)
End Sub



Begin Events
    Select Case Cbmsg
        Case WM_SETFOCUS
        Global As HWND hPrevFocus, hFocusedCtrl
        If hPrevFocus Then
            SetFocus(hPrevFocus)
            hPrevFocus = 0
        End If
        Exit Function
        Case WM_KILLFOCUS
        hFocusedCtrl = GetFocus()
        Exit Function
        Case WM_ACTIVATEAPP
        If Cbwparam = 0 Then
            hFocusedCtrl = GetFocus()
        Else
            If hFocusedCtrl Then
                hPrevFocus = hFocusedCtrl
                SetFocus(hFocusedCtrl)
                hFocusedCtrl = NULL
            End If
        End If
        Exit Function
        Case WM_QUIT, WM_CLOSE
        PostQuitMessage(0)
        Exit Function

        Case WM_COMMAND
        Select Case Cbctl
            Case IDC_START_PAUSE
            If Running Then
                Elapsed# = Elapsed# + (Tix_Now - Start#)
                KillTimer(MainForm, IDT_UPDATE_TIMER)
                SetWindowText(StartPauseButton, "&Resume")
            Else
                If tix_started = False Then      ' Added by MrBcx
                    Tix_Start                    ' Added by MrBcx
                    tix_started = True           ' Added by MrBcx
                End If                           ' Added by MrBcx

                Start# = Tix_Now
                SetWindowText(StartPauseButton, "&Pause")
                SetTimer(MainForm, IDT_UPDATE_TIMER, 1000, NULL)
            End If
            Running = Not Running
            EnableWindow(ResetButton, True)


            Case IDC_RESET
            Elapsed# = 0
            KillTimer(MainForm, IDT_UPDATE_TIMER)     ' Added by MrBcx
            EnableWindow(ResetButton, False)          ' Added by MrBcx
            SetWindowText(StartPauseButton, "&Start")
            SetWindowText(TimeField, "")              ' Added by MrBcx
            UpdateWindow(TimeField)                   ' Added by MrBcx
            SetFocus(StartPauseButton)
            Running = False
        End Select

        Case WM_TIMER
        If Running Then
            'MrBcx says --  Do not change Elapsed# here!
            SetWindowText(TimeField, GetElapsed$())
        End If

    End Select
End Events


Function GetElapsed$()
    Local Total#, Seconds, Minutes, Hours, Days, Res$
    If Running Then
        Total# = Elapsed# + (Tix_Now - Start#)
    Else
        Total# = Elapsed#
    End If
    If Total# < 1000 Then Function = "0 seconds"
    Seconds = Total# / 1000
    Minutes = Seconds / 60
    Seconds = Seconds % 60
    Hours = Minutes / 60
    Minutes = Minutes % 60
    Days = Hours / 24
    Hours = Hours % 24
    Days = Round(Days, 2)
    If Days > 0 Then Res$ += Str$(Days, 1) + " " + Iif$(Days = 1, "day", "days") + ", "
    If Hours > 0 Then Res$ += Str$(Hours , 1) + " " + Iif$(Hours = 1, "hour", "hours") + ", "
    If Minutes > 0 Then Res$ += Str$(Minutes, 1) + " " + Iif$(Minutes = 1, "minute", "minutes") + ", "
    If Seconds > 0 Then Res$ += Str$(Seconds, 1) + " " + Iif$(Seconds = 1, "second", "seconds") + ", "
    Function = Left$(Res$, Len(Res$) - 2)
End Function

#6
Questions & Answers / Using Tix_Now and friends as a...
Last post by Quin - May 08, 2025, 07:50:52 PM
I have this little GUI stopwatch program I was hoping to publish to the user contributions section once its done. It almost fully works, accept when trying to resume from a paused state, the timer resets. My brain is telling me this should be stupid simple, but all 4 people from my house are going to 4 different places, two of them being in two different countries, from the 6th to the 10th, so I'm more than a little scatterbrained to say the least and not doing my best coding between airport runs, packing and dealing with emotional family members.
$No_Borland
$Noini
$No_LCCWin
$No_VKKeys
Gui "SwatchWndClass", Pixels

Enum
    IDC_START_PAUSE = 101
    IDC_RESET
    IDC_TIME_LABEL
    IDC_TIME_FIELD
    IDT_UPDATE_TIMER = 200
End Enum

Global As Control MainForm, StartPauseButton, ResetButton, TimeLabel, TimeField
Global Running As Bool
Global Elapsed#, Start#

Sub Formload
    MainForm = Bcx_Form("Swatch")
    StartPauseButton = Bcx_Button("&Start", MainForm, IDC_START_PAUSE, 5, 5, 50, 50)
    ResetButton = Bcx_Button("&Reset", MainForm, IDC_RESET, 5, 100, 50, 50)
    EnableWindow(ResetButton, False)
    TimeLabel = Bcx_Label("Time &elapsed", MainForm, IDC_TIME_LABEL, 200, 5, 30, 5)
    TimeField = Bcx_Input(GetElapsed$(), MainForm, IDC_TIME_FIELD, 200, 15, 200, 40, WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_LEFT | ES_READONLY)
    Center(MainForm)
    Show(MainForm)
    SetFocus(StartPauseButton)
End Sub

Begin Events
    Select Case Cbmsg
        Case WM_SETFOCUS
        Global As HWND hPrevFocus, hFocusedCtrl
        If hPrevFocus Then
            SetFocus(hPrevFocus)
            hPrevFocus = 0
        End If
        Exit Function
        Case WM_KILLFOCUS
        hFocusedCtrl = GetFocus()
        Exit Function
        Case WM_ACTIVATEAPP
        If Cbwparam = 0 Then
            hFocusedCtrl = GetFocus()
        Else
            If hFocusedCtrl Then
                hPrevFocus = hFocusedCtrl
                SetFocus(hFocusedCtrl)
                hFocusedCtrl = NULL
            End If
        End If
        Exit Function
        Case WM_QUIT, WM_CLOSE
        PostQuitMessage(0)
        Exit Function
        Case WM_COMMAND
        Select Case Cbctl
            Case IDC_START_PAUSE
            If Running Then
                Elapsed# = Elapsed# + (Tix_Now - Start#)
                KillTimer(MainForm, IDT_UPDATE_TIMER)
                SetWindowText(StartPauseButton, "&Resume")
            Else
                Tix_Start
                Start# = Tix_Now
                SetWindowText(StartPauseButton, "&Pause")
                SetTimer(MainForm, IDT_UPDATE_TIMER, 1000, NULL)
            End If
            Running = Not Running
            EnableWindow(ResetButton, True)
            Case IDC_RESET
            Elapsed# = 0
            EnableWindow(ResetButton, False)
            SetWindowText(StartPauseButton, "&Start")
            SetFocus(StartPauseButton)
        End Select
        Case WM_TIMER
        If Running Then
            Elapsed# = Tix_Now
            SetWindowText(TimeField, GetElapsed$())
        End If
    End Select
End Events

Function GetElapsed$()
    Local Total#, Seconds, Minutes, Hours, Days, Res$
    If Running Then
        Total# = Elapsed# + (Tix_Now - Start#)
    Else
        Total# = Elapsed#
    End If
    If Total# < 1000 Then Function = "0 seconds"
    Seconds = Total# / 1000
    Minutes = Seconds / 60
    Seconds = Seconds % 60
    Hours = Minutes / 60
    Minutes = Minutes % 60
    Days = Hours / 24
    Hours = Hours % 24
    Days = Round(Days, 2)
    If Days > 0 Then Res$ += Str$(Days, 1) + " " + Iif$(Days = 1, "day", "days") + ", "
    If Hours > 0 Then Res$ += Str$(Hours , 1) + " " + Iif$(Hours = 1, "hour", "hours") + ", "
    If Minutes > 0 Then Res$ += Str$(Minutes, 1) + " " + Iif$(Minutes = 1, "minute", "minutes") + ", "
    If Seconds > 0 Then Res$ += Str$(Seconds, 1) + " " + Iif$(Seconds = 1, "second", "seconds") + ", "
    Function = Left$(Res$, Len(Res$) - 2)
End Function
#7
Bug Reports / Re: Some small typos and error...
Last post by Quin - May 08, 2025, 07:42:38 PM
Quote from: MrBcx on May 08, 2025, 01:24:03 PM
Quote from: Quin on May 08, 2025, 07:21:28 AM... Meanwhile, on the Pelles forums, I'm told Pelle is done with my suggestions after the table headers provided by another forum member looked ugly to him. Completely his prerogative, of course, PellesC is his baby and he is free to choose how his docs look, ...


In defense of Pelle, and speaking from personal experience, being interested in coding does not dispose one to an interest in technical writing (documentation).  25 years ago, I was the chief, cook, and bottle washer for the infant BCX project.  I wrote the first codes, revision log, help files, and setup and administered the first websites and forums.  Plus, I had a full time job, a career, and a family to support.  Soon after, I started incorporating codes from BCX users, maintained the revision log, and watched BCX mature.  Oh yeah, and testing -- lots of testing.  All those things required a lot of time and effort.  Until one walks in the shoes of others ... 

I was never more grateful than when Robert volunteered to take over the maintenance of BCX Help.  To this day, we all benefit from Robert's generosity.  The fact that Robert has, and continues to provide updates that benefit sight impaired BCX users is an extremely rare gift indeed.

I fully agree, and my intention wasn't to speak negatively about Pelle as a project maintainer, or anything of the sort. I was simply highlighting that Robert's incredible dedication and skill are rare to come by, and that's why BCX has my favorite help file out of any product :)
As a documentation maintainer for a large C++ project NVGT, I know the pain.
#8
User Contributions / Re: A Better Random Number Gen...
Last post by MrBcx - May 08, 2025, 04:37:31 PM
Thanks Robert.  Using RND_S() as a seed is clever beyond words.

I also enjoyed learning about Cloudflare's use of Lava Lamps.
#9
User Contributions / Re: A Better Random Number Gen...
Last post by Robert - May 08, 2025, 04:06:27 PM
To generate a cryptographically secure seed for your BCX RANDOMIZE function, you don't need a wall of LavaLamps


MrBcx's CryptoSeed will protect you from any attacker trying to figure out your key and decrypt your data.

DIM AS DOUBLE Random
DIM AS DOUBLE TheSeed
DIM AS INTEGER i, j
TheSeed = CryptoSeed()

PUSHCOLORS

CLS
COLOR 2, 0 : LOCATE 12, 25, 0
INPUT "Hit [Enter] to see a sample", i : COLOR 7, 0
CLS
RANDOMIZE(TheSeed)
FOR i = 1 TO 23
  FOR j = 1 TO 70 STEP 20
    Random = RND
    LOCATE i, j, 0
    COLOR MOD(i, 4.0) + 10, 0
    PRINT Random
  NEXT
NEXT
LOCATE i, j
COLOR 7, j

FUNCTION CryptoSeed AS DOUBLE

  STATIC AS HCRYPTPROV hProv
  STATIC AS INTEGER isInit
  DIM AS UINT n
  DIM AS INTEGER ok

  IF isInit = 0 THEN
    ok = CryptAcquireContext(&hProv, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT)
    IF ok = FALSE  THEN FUNCTION = -1
    isInit = 1
  END IF

  ' Cast &n to BYTE* so it works with CryptGenRandom
  ok = CryptGenRandom(hProv, SIZEOF(n), (BYTE*)&n)
  IF ok = FALSE THEN FUNCTION = -1

  FUNCTION = CAST(DOUBLE, n / 4294967296.0)
END FUNCTION

POPCOLORS

PAUSE
#10
Bug Reports / Re: Some small typos and error...
Last post by MrBcx - May 08, 2025, 01:24:03 PM
Quote from: Quin on May 08, 2025, 07:21:28 AM... Meanwhile, on the Pelles forums, I'm told Pelle is done with my suggestions after the table headers provided by another forum member looked ugly to him. Completely his prerogative, of course, PellesC is his baby and he is free to choose how his docs look, ...


In defense of Pelle, and speaking from personal experience, being interested in coding does not dispose one to an interest in technical writing (documentation).  25 years ago, I was the chief, cook, and bottle washer for the infant BCX project.  I wrote the first codes, revision log, help files, and setup and administered the first websites and forums.  Plus, I had a full time job, a career, and a family to support.  Soon after, I started incorporating codes from BCX users, maintained the revision log, and watched BCX mature.  Oh yeah, and testing -- lots of testing.  All those things required a lot of time and effort.  Until one walks in the shoes of others ... 

I was never more grateful than when Robert volunteered to take over the maintenance of BCX Help.  To this day, we all benefit from Robert's generosity.  The fact that Robert has, and continues to provide updates that benefit sight impaired BCX users is an extremely rare gift indeed.