Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - CharlieJV

Pages: [1] 2 3 ... 6
1
Programs / Re: QBJS - Import code from external .bas files
« on: April 15, 2022, 05:34:06 pm »
First thought: that is very cool.

Sober second thought: what are the security implications ?  For example, what happens if an imported file from some source is maliciously modified?

It would be good to well-document whatever risks, and how to mitigate risks.  (I'm no web guy, so my security hat is very much of the base-level-amateur kind.)

I would only import into my programs source code in my control (i.e. my web domain), but I think I'd be okay with the mechanism for running, sandboxed, a program that is hosted wherever.

2
QB64 Discussion / Re: An introduction; A note on Wiki
« on: April 15, 2022, 02:26:01 pm »
Welcome to the "QB64-forumhood", @dcromley !

3
I know Linux is strict about upper and lower case file names.

I just looked at old thread and it seems the Paint Box or Orbits needs a 2 click system one to start and one to stop. Don't know what 9 is doing.

Yeah, those were annoying but easy to fix.

COMDLG32 is a Windows DLL file.  So I can't see this program working on my computer.

4
I've got QB64 running on Linux, and can't get these to work.

Could it be that these programs were built for Windows ?

5
Just uploaded a new version of that program.  (links in original post don't change.)

Made the color choices two characters wide instead of one.

changed the "f" and "b" label toggles to "foreground" and "background".

got rid of the brush instructions, which I will add to the intro screen instead.

added intro screen (instructions pending) to ask for character width and height of the canvas.

fixed a problem that caused drawing past either left or right edges of canvas to "wrap" the drawing, even though the mouse is way past the edge of the canvas.

Good times.

On my immediate todo: turn on/off the grid, which will require storing the current drawing to re-render the drawing after toggling the grid.

Then get QB64 version working  (I think mouse-input is the only incompatibility.)

At some point: saving the drawing to something (file? browser localstorage? clipboard?) and loading a previously saved drawing.

Lines? Shapes?  Eraser?  Fill ?  Maybe.

ASCII characters that we don't see on our keyboards (well, unless you have a Vic-20/C64 kind of keyboard ...)


6
Programs / ASCII Draw(BAM program in progress, QB64 version to follow)
« on: April 06, 2022, 09:24:54 pm »
Very early stages, throwing out there for those interested.

BASIC Anywhere Machine version:

User guide:
  • Brush style: any character on your keyboard (press a key to set the brush to that character at any time)
  • Brush color (foreground and background): pick a color by clicking on it; "f" is foreground, "b" is background, toggle between "f" and "b" by clicking on it

so mouse clicking on "canvas" to draw, mouse clicking on "f" and "b" to toggle whether a color choice applies to foreground or background, and mouse clicking on color to select it.

key press will set the brush to the matching character.

More later !

7
Programs / Re: Just a silly "Hello World" Marquis
« on: April 05, 2022, 10:02:32 pm »
I find all of this simple stuff fun and wondrous.  Takes me right back to the early 80's.

8
Programs / Just a silly "Hello World" Marquis
« on: April 05, 2022, 03:07:29 pm »
Just a barely tweaked Commodore BASIC program over on Rosetta Code, works in both BASIC Anywhere Machine and QB64.

I was in an old-school BASIC reminiscing mood ...


9
For anybody who wants to do some extra reading on his/her down time:  Google Search for "0.1 0.2 not equal 0.3"

It is pretty interesting stuff that I wish my digital design course (from university many moons ago) had covered.

10
LOL, I thought April Fools day was yesterday!
(SNIP!)

Pff, I don't need a special day to be fooled something silly.  No pride, no fear: bring it on baby!

11
@CharlieJV  you might be in habit of thinking of i as an incremented (by 1) integer index (like for arrays).

No, I am not thinking that.  When I do a For i = 1 to 5, I expect 1,2,3,4,5 to happen.


jack is suggesting a While loop I think to try an get that last loop for i when it isn't an incremented (by 1) integer index but I had same idea tried it and still i a single type + .1 collects gabage and passes exactly 1.000 just like in For loop!

As per the example you had given with .1, my solution to the problem is to multiply everything by 10 so that we are no longer dealing with floating point numbers, and then divide by ten when we want to show the floating point values.

And that works great.


I'm very confused because I don't understand what point either you or Jack are trying to make.  With the samples I gave, I don't see what value a while-wend would provide over a for-next.



12
CharlieJV
maybe use while loops instead

You've lost me there.  How does a while help?

(Aside and unrelated: I don't really see while loops and for loops as always interchangeable, each to me better than the other depending on the job at hand, often times just for the sake of readability.)

Trying to figure out what you mean, but I'm sure I'm way off:
Code: QB64: [Select]
  1. fpa = 10 ' floating-point adjustment
  2. i = -1*fpa
  3. WHILE i <= TO 1*fpa
  4.   print = i/fpa
  5.   i = i + 0.1*fpa
  6.  

13
(SNIP!)
I still say the absolute best solution, when possible, is to just avoid the floating point imperfections entirely.

FOR i = -10 TO 10 'use integers when possible
  iDec = i /10 'only convert to the floating point value when necessary
NEXT

It's why the banks track how many PENNIES are in your account, and not how many dollars.  The results are displayed as dollars, but all the calculations are in pennies.

Yeah, I do believe I am firmly in that camp.

I might just adopt a standard variable and approach for that kind of thing.

like:

Code: QB64: [Select]
  1. fpa = 10 ' floating-point adjustment
  2. FOR i = -1*fpa TO 1*fpa step 0.1*fpa
  3.   print = i/fpa
  4.  
  5. fpa = 100 ' floating-point adjustment
  6. FOR i = -0.1*fpa TO 0.1*fpa step 0.01*fpa
  7.   print i /fpa
  8.  

Maybe.  Time, mood, and pudding o' proof will tell.

14
Personally, here's the general method I use when I have to deal with this type of thing:

Code: QB64: [Select]
  1. For i = -1 To 1 Step 0.1
  2. ...
(snip!)

I don't know if I can ever again trust a loop that involves incrementing by decimal values.

Maybe a knee-jerk reaction, but I find myself wondering, looking at any kind of loop like that, if there is unintentional short-changing of the loop (or an opposite "over-loop"?) by an iteration.

15
(SNIP!)
Code: QB64: [Select]
  1. For i = -1 To 1.0001 Step .1
  2.     Print i, format$("##.#", Str$(i))
  3. Function format$ (template As String, Source As String)
  4.     Dim d, s, n, i, t$
  5.     d = _Dest: s = _Source
  6.     n = _NewImage(80, 80, 0)
  7.     _Dest n: _Source n
  8.     Print Using template; Val(Source)
  9.     For i = 1 To 79
  10.         t$ = t$ + Chr$(Screen(1, i))
  11.     Next
  12.     If Left$(t$, 1) = "%" Then t$ = Mid$(t$, 2)
  13.     format$ = _Trim$(t$)
  14.     _Dest d: _Source s
  15.     _FreeImage n
  16.  

I'm pretty sure I'll be leaning this way going forward:

Code: QB64: [Select]
  1. For i = -10 To 10 Step 1
  2.     rem i / 10 wherever needed

Pages: [1] 2 3 ... 6