Welcome, Guest |
You have to register before you can post on our site.
|
Forum Statistics |
» Members: 483
» Latest member: aplus
» Forum threads: 2,800
» Forum posts: 26,409
Full Statistics
|
|
|
Metacommand |
Posted by: eoredson - 07-27-2024, 04:16 AM - Forum: Help Me!
- Replies (7)
|
|
Hi,
I have an issue with a metacommand:
$Checking:off
does not allow a line number:
100 $Checking:off
Could some QB64PE editor add the possibility of a line number?
Thanks, Erik.
btw: actually none of the metacommands do.
except for $Dynamic $Static and $Include which require Rem..
|
|
|
For what it’s worth: Programming Clarity |
Posted by: PhilOfPerth - 07-26-2024, 01:34 AM - Forum: General Discussion
- Replies (11)
|
|
As someone close to the bottom of the “programming chain”, I just want to make a few comments on what makes programmes understandable, at least for me. I know some members won’t agree with some of these things, and some seem pretty obvious, but I find they help me to understand someone else’s programming.
Comments: A few words at the end of, or before, a line that introduces new elements or features can be a great help, not only to other readers, but to the author when editing or reviewing later. They don’t greatly increase the programme size, and are not included in the compiled programme, so why not use them?.
Variable Names: These should give an indication of what they represent. An abbreviated form, maybe with vowels removed, is often ok, but a full word is even better: “TopScore” is clearer than “TpScr”, and won’t be confused with say a “TopOfScreen”, but either one is better than “scmx%”. Some names will necessarily be a bit obscure, especially with advanced trig or system items, so may need a comment to give some indication of their purpose, when first introduced.
Labels: When a new section of a unit starts – whether in the Main or a Sub or Function – it helps if that section is spaced out, and given a meaningful label, telling the reader what the section does, e.g. “CheckBoundary:”. Although spaces are not allowed in labels, CapitalLetters or Under_Scores can be used instead.
Subs and Functions: should have a meaningful name that describes their purpose, and if necessary a comment explaining this.
Programme Names: These should give enough information to tell readers what they can expect to find in the programme. An Introductory page or paragraph that can be seen on opening can also be useful.
Many writers do these things as a matter of course, but occasionally they become so involved in making the programme smaller, or work or run faster, that these are overlooked, leaving readers like me mystified about the purpose of that section, or of the whole programme !
|
|
|
Determine a value is INTEGER |
Posted by: TerryRitchie - 07-25-2024, 07:40 PM - Forum: Help Me!
- Replies (17)
|
|
Let's save I have a value:
Value! = 10.3
and I want to determine if it's an integer.
IF Value! = INT(Value!) THEN
' Value! is an INTEGER
END IF
Is this the best way to determine that a number is an integer?
I ask because while perusing other programming language sites I ran across people taking about how this method should NOT be used because of floating point anomalies. They suggest using things like InstanceOf, a combination of ABS and .Floor, and other methods. I realize these examples are commands used with other languages.
Could any "floating point anomalies" with QB64 affect the method I have shown above?
|
|
|
Screen Resizing |
Posted by: ahenry3068 - 07-25-2024, 06:46 PM - Forum: Help Me!
- Replies (11)
|
|
I have a very specific thing I'm trying to accomplish.
I am creating an Cross Platform Audio Book manager for SD-Cards with the primary platform being David Murray's "Commander X16" platform. This is a "New"/"Retro" 8-bit computer recently in production.
I am well on the way on the Commander X16 side of things and I wouldn't come here for help with that.
I also want a version of the Audio Book Manager to run on Windows & Linux. I want the look and feel between the two platforms to be as close as possible.
Due to hardware limitations my Text Screens on the X16 are going to be 40 cols x 30 rows. I need to replicate that under QB64PE.
The closest I have got is SCREEN 0, then WIDTH 40, 43 and VIEW PRINT 1 TO 30. This is getting me very close but with 13 blank lines at the bottom of the Window.
If I Enable $RESIZE:ON I can manually resize the Window and cut off these lines from view.
WHAT I WANT TO DO: Have the Window automatically resize itself with no further resizing allowed by the User. This will give me exactly the screen I need for the correct look and feel. I've been combing the DOCS and example code and I really can't figure out how to do this. It should work under both Windows & Linux.
|
|
|
BASIC is 60 years old |
Posted by: bert22306 - 07-24-2024, 09:31 AM - Forum: General Discussion
- Replies (12)
|
|
From ZDNet:
https://www.msn.com/en-us/news/technolog...1ccb&ei=79
In their day though, BASIC and DTSS democratized access to computing power. It allowed developers to run programs concurrently on a central machine -- a radical concept at the time. ...
Two young men, Paul Allen, and Bill Gates, proposed to the maker of the first PC, Ed Roberts' Altair 8800, that they port BASIC to his computer. He agreed, and shortly thereafter, they founded Micro-Soft. You know it better as Microsoft. ...
Then, when IBM came out with its first PC, Gates and Allen were ready to take advantage of this new platform. As IBM President of Entry Systems, Don Estridge, said, "Microsoft BASIC had hundreds of thousands of users around the world. How are you going to argue with that?" ...
BASIC would still have its fans. Long before Microsoft developers dreamed of .NET or C#, Microsoft kept producing other popular BASIC variants, such as QBasic, GW-BASIC, and Visual Basic. A few non-Microsoft BASIC versions, such as QuickBASIC, also kept chugging along. ...
Still, BASIC isn't dead. Microsoft open-sourced GW-BASIC in 2020. Other BASIC variants are still with us as well, such as the Windows-specific Small Visual Basic; and the open-source SmallBASIC and QB Phoenix Edition. In fact, hidden inside Microsoft Office, Visual Basic for Applications (VBA) remains the Office worker's power tool set. ...
But, never forget that BASIC helped early users engage with computers in a fundamentally new way. The story of BASIC is not just about a programming language. It's about making technology accessible and comprehensible, transforming passive users into active creators. You may never write a line of BASIC, or you may hate the language, but we all live with its influence to this day.
|
|
|
Repeating mouse check |
Posted by: PhilOfPerth - 07-24-2024, 03:50 AM - Forum: Help Me!
- Replies (4)
|
|
I need to check my mouse-click positions several times, but seem to be stuck with its first location each time.
This is a simplified version of what I'm using; What am I doing wrong? (pardon the GoTo's)
Code: (Select All) GetFirst: ' to find first mouse position
Locate 20, 30: Print "Choose first location"
m% = _MouseInput ' prepare mouse
If _MouseButton(1) Then ' get left-mouse
MX = _MouseX: MY = _MouseY ' get horiz and vert position
Print MX, MY
GoTo GetSecond ' and go to GetSecond
Else GoTo GetFirst ' if left-mouse not pressed go back and try again
End If
GetSecond: ' to find second mouse position
While _MouseButton(1): Wend ' wait for left-mouse to restore
Print "Choose second location"
'm% = _MouseInput ' prepare mouse (is this needed again?)
If _MouseButton(1) Then ' get left-mouse again
MX = _MouseX: MY = _MouseY ' get new horiz and vert position
Print MX, MY
Sleep
Else GoTo GetSecond ' if left-mouse not pressed go back and try again
End If
Sleep
|
|
|
Joysticks on a Mac, _DEVICEINPUT() |
Posted by: NakedApe - 07-23-2024, 10:40 PM - Forum: Help Me!
- Replies (4)
|
|
Does anybody know if _DEVICE$ and _DEVICEINPUT() work on MacOS? I was just noodling around with a cheap joystick I got, but any reference to _DEVICEINPUT(3) causes an Illegal Function error. Also the stick doesn't show up as connected under _DEVICE$. I was using a few of Terry's (@TerryRitchie) joystick and device demo programs to get started.
This mashup below sorta works - it gets some input from the stick, but only when the stick is moved from the zero, zero position - when action is detected generically. Without using _DEVICEINPUT(3) I can't get actual live input. What's a guy to do? Thanks.
Code: (Select All)
CONST JOYSTICK = 3 ' joystick controller id (may need to change to match your joystick id)
DIM DeviceCount AS INTEGER ' number of controller devices (used to activate)
DIM Threshold AS SINGLE ' amount of deflection needed to activate movement
DIM Xaxis AS SINGLE ' value of joystick x axis (horizontal)
DIM Yaxis AS SINGLE ' value of joystick y axis (vertical)
DIM x AS SINGLE ' x location of circle
DIM y AS SINGLE ' y location of circle
DIM Speed AS INTEGER ' axis speed multiplier
DeviceCount = _DEVICES ' activate controller statements
Threshold = .05 ' set axis threshold
Speed = 10 ' set axis speed multiplier
x = 319 ' center circle
y = 239
SCREEN _NEWIMAGE(640, 480, 32) ' graphics screen
DO ' begin controller loop
_LIMIT 60 ' 60 frames per second
CLS ' clear screen
LOCATE 2, 16 ' position cursor
PRINT "Use joystick handle to move circle. Esc to exit." ' display instructions
DeviceInput = _DEVICEINPUT ' get any controller interaction
IF DeviceInput THEN ' was a controller interacted with?
WHILE _DEVICEINPUT(DeviceInput): WEND ' yes, get the latest controller information
'WHILE _DEVICEINPUT(JOYSTICK): WEND ' THIS CAUSES INSTANT CRASH reference joystick 1 and get latest update
Xaxis = _AXIS(1) ' get current horizontal value
Yaxis = _AXIS(2) ' get current vertical value
IF ABS(Xaxis) >= Threshold THEN x = x + Xaxis * Speed ' move circle horizontally if threshold met
IF ABS(Yaxis) >= Threshold THEN y = y + Yaxis * Speed ' move circle vertically if threshold met
IF x < 0 THEN x = x + 639 ELSE IF x > 639 THEN x = x - 639 ' keep horizontal movement on screen
IF y < 0 THEN y = y + 479 ELSE IF y > 479 THEN y = y - 479 ' keep vertical movement on screen
CIRCLE (x, y), 30 ' draw the circle
_DISPLAY ' update screen with changes
END IF
LOOP UNTIL _KEYDOWN(27) ' leave when ESC pressed
SYSTEM '
|
|
|
CrowdStrike issue also with Linux |
Posted by: bert22306 - 07-23-2024, 04:17 AM - Forum: General Discussion
- Replies (9)
|
|
Who knew? This from Tom's Hardware:
https://www.msn.com/en-us/money/other/cr...df07&ei=28
CrowdStrike issues go beyond Windows: company's security software has reportedly been causing Linux kernel panics since at least April
Story by Christopher Harper • 7h
But as it turns out, the problem isn't just isolated to modern Windows operating systems. Linux users have been reporting kernel panics and crashes related to the same software since as early as April of this year, per a report from The Register.
So, how is this issue cross-platform? Chances are the specific issue that caused chaos over the last few days is not— after all, we would've seen it cripple Windows machines much sooner if that were the case. However, what this does demonstrate is that CrowdStrike has apparently been lax with its Falcon Sensor Security software for quite a while now. .....
Linux users who have been impacted reportedly include those using Red Hat Enterprise Linux, Debian Linux (and Debian is the basis for the more-widespread Ubuntu), and Rocky Linux. All of the issues in question are impacting the underlying Linux kernel (universal across Linux distributions), though, seemingly crashing any Linux distributions using kernel versions 5.14.0-42713.1 and newer.
Linux users do seem to have more recourse for issues like this— including switching to an eBPF "User Mode"— but it speaks to the severity of CrowdStrike's kernel software development issues if the company is managing to cripple Linux and Windows operating systems.
It also shows that there were warning signs for this past global outage, and that systems should have been in place at CrowdStrike some time ago to test these enterprise and government-targeted updates vigorously enough to prevent these kernel-level crashes. After all, most impacted users in these strictly-controlled environments likely don't have the administrative access or knowledge required to fix these problems once they occur. In other words, much-improved QA testing would seem to be mandatory for CrowdStrike's continued long-term success.
|
|
|
|