Author Topic: Steve's Video Tutorials  (Read 20934 times)

0 Members and 1 Guest are viewing this topic.

Offline Cobalt

  • QB64 Developer
  • Forum Resident
  • Posts: 878
  • At 60 I become highly radioactive!
    • View Profile
Re: Steve's Video Tutorials
« Reply #30 on: September 24, 2019, 01:17:29 pm »
Hey Steve, what screen capture software are you using for your tutorials?
Granted after becoming radioactive I only have a half-life!

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: Steve's Video Tutorials
« Reply #31 on: September 24, 2019, 01:30:03 pm »
Hi Steve. Video quality is perfect. Could you show me in some next tutorials show us this themes?

 How to use MEM to do the same as the following loop?

Dim A(1000) as integer
Dim B(1000) as long

For Object = 1 to 1000
For P = 1 to 1000
if a(object) = b(p) then ...
Next
Next

It is about how (in a fundamental way) to speed up the comparison of huge amounts of information in the field.  I suppose it will certainly not be easy at all via MEM, especially if I use a TYPE field. Next step for fast speed is i know, is not using FOR... NEXT, but DO... LOOP. Another thing - How is memory organized when using TYPE? Is it in the order in which the individual array elements are defined? This would extremely speed up many of my programs.

I still didn't understand the oversizing of two-dimensional arrays via _PRESERVE. What about _MEM for two-dimensional arrays? Is the first value stored, then the second for one index, or is the first part of the array (Lbound, 1 to Ubound, 1) and then second (Lbound, 2 to Ubound, 2) stored?


Thank you.

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Steve's Video Tutorials
« Reply #32 on: September 24, 2019, 02:05:05 pm »
Hi Steve. Video quality is perfect. Could you show me in some next tutorials show us this themes?

 How to use MEM to do the same as the following loop?

Dim A(1000) as integer
Dim B(1000) as long

For Object = 1 to 1000
For P = 1 to 1000
if a(object) = b(p) then ...
Next
Next

It is about how (in a fundamental way) to speed up the comparison of huge amounts of information in the field.  I suppose it will certainly not be easy at all via MEM, especially if I use a TYPE field. Next step for fast speed is i know, is not using FOR... NEXT, but DO... LOOP. Another thing - How is memory organized when using TYPE? Is it in the order in which the individual array elements are defined? This would extremely speed up many of my programs.

I still didn't understand the oversizing of two-dimensional arrays via _PRESERVE. What about _MEM for two-dimensional arrays? Is the first value stored, then the second for one index, or is the first part of the array (Lbound, 1 to Ubound, 1) and then second (Lbound, 2 to Ubound, 2) stored?


Thank you.

Simple solution here:

Dim A(1000) as integer
Dim B(1000) as long
DIM M AS _MEM, M1 AS _MEM
M = _MEM(A()): M1 = _MEM(B())

For Object = 0 to 1000
    For P = 0 to 1000
        ‘if a(object) = b(p) then ...
         IF _MEMGET(M, M.OFFSET + Object * M.ELEMENTSIZE, INTEGER) = _MEMGET(M1, M1.OFFSET + P * M1.ELEMENTSIZE, LONG) THEN...
    Next
Next

(I’m writing the on my iPad, so I hope you can decipher that statement as it is, but if you need me to break it down and explain what each segment is doing, just let me know and I’ll expand on the illustration/details when I get home later this afternoon.)

As for multi-dimensional arrays, I’ll definitely wait to get to those until I’m at a PC where typing/explaining is a lot easier for me.  They’re not the simplest to sort out, not without a few pieces of example code to go with them to help illustrate what we’re dealing with.  ;)
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline Dimster

  • Forum Resident
  • Posts: 500
    • View Profile
Re: Steve's Video Tutorials
« Reply #33 on: September 24, 2019, 02:06:25 pm »
Very helpful Cobalt - thanks.

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: Steve's Video Tutorials
« Reply #34 on: September 24, 2019, 02:12:50 pm »
Oh so!  Thank you Steve. As i see to this code, so ELEMENTSIZE can be used also for arrays created with TYPE without worrying about how many bytes in memory a particular element occupies?

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Steve's Video Tutorials
« Reply #35 on: September 24, 2019, 04:03:34 pm »
Oh so!  Thank you Steve. As i see to this code, so ELEMENTSIZE can be used also for arrays created with TYPE without worrying about how many bytes in memory a particular element occupies?

Here's an example of how _MEM works with User Defined Types.  See if it makes sense to you:
Code: [Select]
TYPE Any_Type
    X AS INTEGER
    Y AS INTEGER
    Junk AS STRING * 25
END TYPE

DIM array(100) AS Any_Type 'an array of our user type
DIM M AS _MEM 'a mem block
M = _MEM(array()) 'pointed to the array()

_MEMPUT M, M.OFFSET, 1001 AS INTEGER 'start at M.offset for byte 0
_MEMPUT M, M.OFFSET + 2, 9876 AS INTEGER '2 bytes over is where our integer is located
_MEMPUT M, M.OFFSET + 4, "Hello World" 'and 2 bytes over from there is where the string info starts at

PRINT array(0).X, array(0).Y, array(0).Junk

_MEMPUT M, M.OFFSET + M.ELEMENTSIZE, 5000 AS INTEGER 'array(1); same elements
_MEMPUT M, M.OFFSET + M.ELEMENTSIZE + 2, 1234 AS INTEGER
_MEMPUT M, M.OFFSET + M.ELEMENTSIZE + 4, "Goodbye World"
PRINT array(1).X, array(1).Y, array(1).Junk

temp$ = MKI$(7777) + MKI$(3333) + "What the what???" 'array(2) -- ALL AT ONCE
_MEMPUT M, M.OFFSET + M.ELEMENTSIZE * 2, temp$ 'notice how M.ElementSize helps us position ourselves to the start of the array element we're looking for?
PRINT array(2).X, array(2).Y, array(2).Junk

_MEMPUT M, M.OFFSET + M.ELEMENTSIZE * 3, "00" '256 written in ASCII characters, then 512 written in ASCII characters
_MEMPUT M, M.OFFSET + M.ELEMENTSIZE * 3 + 4, "Numeric values written as Strings?"
PRINT array(3).X, array(3).Y, array(3).Junk
PRINT array(4).X, array(4).Y, array(4).Junk 'notice how we put values into array element 3 AND 4 with the last print statement?  It was too large to fit in the STRING * 25 which I'd defined, so it carried over and corrupted the next array index.

If you notice, QB64 doesn't give a hoot about what we put into memory with _MEMPUT.  (The last example should make that perfectly clear, I'd think.)  When it comes to TYPEs, all it basically tracks for us is the size of the type, and where the elements start at.  It's up to you to know your offsets and define them somehow for use in your programs (look at my QBDbase routines and you can see where they do that so we can use _MEM with whatever type a user has).  When you _MEMGET or _MEMPUT, you specify what type of variable you expect to get and put into that position in memory, but there's no real requirement forcing you to only put/get a certain type.

Compare it to the following:

OPEN "temp.txt" for BINARY AS #1
a$ = chr$(1)+chr$(2)
PUT #1, 1, a$

DIM b as _UNSIGNED _BYTE
Get #1, 1, b
PRINT b
GET #1, 2, b
PRINT b

You put a string in your file, but then read it as 2 bytes... 

You could also read that value as an integer, if you wanted: GET #1, 1, x%

Once it's in the file, your file doesn't care what the information is you stored.  It just stores the information you put into it, where you decided to put it.  _MEM works the exact same way. 

Sometimes, you just have to manually track some of that information for yourself (espcially with user types).  ;)



And in case the auto-format screws things up, this line should look like so:

_MEMPUT M, M.OFFSET + M.ELEMENTSIZE * 3, "00" '256 written in ASCII characters, then 512 written in ASCII characters

(That's CHR$(1) + "0" + CHR$(2) + "0", in case all else fails to format it properly.)
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: Steve's Video Tutorials
« Reply #36 on: September 24, 2019, 04:59:52 pm »
It is clear to me. Thank you, Steve.

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Steve's Video Tutorials
« Reply #37 on: September 25, 2019, 11:40:21 am »
Hey Steve, what screen capture software are you using for your tutorials?

OBS Studio -- free, open source, and does all I'd ever want it to do -- and more!  You can even configure it to do live broadcasts, if you want to be one of the internet sensations who uses live streams.. 

https://obsproject.com/

Simple enough that it didn't take me 5 minutes after installing, before I had it recording from my screen and camera, and without having to search a wiki or documentation to sort it out.  I'm certain it can do a lot more than what I've did with it so far, but my needs are rather simple (record what my screen shows, or what my camera shows), and I figure I can learn more as I go.  All software has a learning curve, but good software at least lets you do the very basics without needing to read a manual to get started.

One thing which I've found it doesn't do (or at least which I can't do with it yet), is video editing after the recording.  If I stop a recording and then start after a small pause to let the dog outside, or such, it starts a new recording rather than appending to the end of the first one, so I have to then use a different piece of video editing software to merge those two mini-recordings into a single one before sharing.

Everything I saw recommended to use Blender as a video editing tool, but....   I can't even figure out how the BLEEP to load an existing video file into it to start with!!  It's going to take some serious research into the software commands/set up to sort out WTH I'm doing with it.   It's nowhere near as user friendly (from my experience), as OBS Studio is.  For now, I'm just using VSCD Video Editor to splice segments together and such -- it doesn't seem to be that powerful of a tool, takes a long time to do its thing, but at least I can get it started, loading, and working!  In time, I'll probably need to swap it out with something more powerful, but it works for my needs at the moment.  ;)
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline Cobalt

  • QB64 Developer
  • Forum Resident
  • Posts: 878
  • At 60 I become highly radioactive!
    • View Profile
Re: Steve's Video Tutorials
« Reply #38 on: September 25, 2019, 01:19:28 pm »
Everything I saw recommended to use Blender as a video editing tool, but....   I can't even figure out how the BLEEP to load an existing video file into it to start with!!  It's going to take some serious research into the software commands/set up to sort out WTH I'm doing with it.   It's nowhere near as user friendly (from my experience), as OBS Studio is.  For now, I'm just using VSCD Video Editor to splice segments together and such -- it doesn't seem to be that powerful of a tool, takes a long time to do its thing, but at least I can get it started, loading, and working!  In time, I'll probably need to swap it out with something more powerful, but it works for my needs at the moment.  ;)

I may have an advantage there, as I have some knowledge of Blender. However you are correct, its video editing abilities have a severe learning curve. Blender Video Sequence Editor(VSE) should be considered more of a Movie editing software, I mean meant more for actual movie style videos. For simply splicing videos or fixing audio you will want a much simpler software. I use AVS Video Converter which has a very simple editor, though I don't think its free. Had my copy so long I can't remember, probably pulled it from google or some search engine as a bit torrent. But it allows splicing multiple videos together, adjusting audio levels, simple transition FX. Of course my version is old enough to run on VISTA so it might be more advanced on newer OSs.

Camera came today, see if I can get it to work with my antiquated hardware.

Unfortunately that OBS Studio doesn't like VISTA, but I was able to find an old one I thought I lost called Active Presenter, again works with VISTA. It has very basic editing although I think it is limited to a single video file source too, it does allow pausing and resuming without making separate files though.
Granted after becoming radioactive I only have a half-life!

Offline Qwerkey

  • Forum Resident
  • Posts: 755
    • View Profile
Re: Steve's Video Tutorials
« Reply #39 on: September 28, 2019, 04:53:24 am »
Steve, You-Tube, so here I-Tube (sorry that the performance is ghastly but it seemed a good idea: it's the sentiment that counts).
* Mem_Talks_WMV V9.wmv (Filesize: 1.74 MB, Downloads: 227)
« Last Edit: September 28, 2019, 12:26:18 pm by Qwerkey »

Offline Dimster

  • Forum Resident
  • Posts: 500
    • View Profile
Re: Steve's Video Tutorials
« Reply #40 on: September 28, 2019, 11:32:48 am »
That Bob Hope rendition broke all my heavy plastic wine glasses. But have to admit, Qwerkey does carry a tune better than me.

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Steve's Video Tutorials
« Reply #41 on: September 28, 2019, 11:56:46 am »
Steve, You_Tube, so here I-Tube (sorry that the performance is ghastly but it seemed a good idea: it's the sentiment that counts).

Nice to meet you Qwerkey!  You're more than welcome.  I'm happy that folks are following along and  (hopefully) learning something from these things.  The next lesson is going to be "Finding the proper OFFSET of your memory/array.)", and I hope to get it up sometime in the next few days or so for everyone to enjoy.  ;)
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline cohearn4

  • Newbie
  • Posts: 1
    • View Profile
Re: Steve's Video Tutorials
« Reply #42 on: September 28, 2019, 05:18:47 pm »
Steve,

Thanks for your _MEM tutorials. The font size is good and clear.  I just signed up so I could post, but I have been following you for a long time.  Your explanations have helped me learn a tremendous amount with QB64. Again thanks.

Charles

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Steve's Video Tutorials
« Reply #43 on: September 29, 2019, 12:07:09 am »
I'm starting work on Tutorial #3: Finding our Offsets right now, so I expect I'll probably start uploading the video to youtube tonight, and I'll share it tomorrow.  For those who might be interested, or want a little study guide of what the tutorial will contain, here's basically what I expect this lesson will cover for us:

Code: QB64: [Select]
  1. _TITLE "Locating Offsets of Memory."
  2. 'PART 1: Direct Variable Offsets
  3. 'Declarations:
  4.  
  5. 'Pointing m at the various variables and putting information into them.
  6.  
  7.  
  8.  
  9.  
  10. 'Printing the variables.
  11.  
  12.  
  13.  
  14.  
  15.  
  16. 'Simple enough, right?
  17.  
  18. 'PART 2: The same, with basic arrays starting at BASE 0
  19. 'Declarations:
  20. REDIM B(10) AS _BYTE, I(10) AS INTEGER, L(10) AS LONG, I64(10) AS _INTEGER64
  21. 'm is still our mem block as defined above
  22.  
  23. 'Pointing m at the first element in the various arrays and putting information into them.
  24.  
  25.  
  26.  
  27. 'Printing those first elements
  28.  
  29.  
  30.  
  31. 'Pointing m at specific (non-first) elements in those arrays, and putting information into them.
  32.  
  33.  
  34.  
  35. 'Printing those specific elements to make certain we put them where we thought we did.
  36.  
  37.  
  38.  
  39. 'Still, nothing complex to this point.  Right?
  40.  
  41.  
  42. 'PART 3: Getting the offset values for oddly indexed arrays.
  43. REDIM B(3 TO 10) AS _BYTE, I(-4 TO 10) AS INTEGER, L(-8 TO -5) AS LONG, I64(10 TO 100) AS _INTEGER64
  44. 'and m is still our mem block.
  45.  
  46.  
  47.  
  48. 'Pointing m at the first element of these arrays.
  49.  
  50.  
  51.  
  52. 'Printing the results for testing.
  53.  
  54.  
  55.  
  56.  
  57. 'Pointing m at a specific element of these arrays.
  58.  
  59.  
  60.  
  61.  
  62. 'Printing the results for testing.
  63.  
  64.  
  65.  
  66.  
  67. 'Things are getting a little more complex at this point.  Depending on time, I might end the
  68. 'tuturial with just this amount of information covered, so folks can make certain they follow
  69. 'along this far with no issues.
  70.  
  71. 'Next up will be finding the offset for BASE 0 multi-dimensional arrays, such as:
  72. REDIM MB(10, 10) AS _BYTE, MI(10, 10) AS INTEGER, ML(10, 10) AS LONG, MI64(10, 10) AS _INTEGER64
  73. 'and m is still our memblock for these tutorials, of course...
  74.  
  75. 'Honestly, I expect this will be a good spot to stop, so look forward for an explaination of
  76. 'multi-dimensional offsets (and screen image offsets as well, while we're at it), in Tutorial
  77. '4: Beyond the First Dimension!
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Steve's Video Tutorials
« Reply #44 on: September 29, 2019, 05:47:19 am »
Tutorial #3 is up and available, and I have to admit: it’s much longer than I’d anticipated it would be.  A few typos and mistakes extended things, and I got myself side-tracked and covered a bit more than intended in this lesson.  I’d seriously considered editing out a bunch of it, but then decided not to, as even the mistakes and such can help show folks what to expect when things go wrong with using _MEM.  (And some of the mistakes ARE purposeful, just for illustration purposes, but some of the others were just careless goofs which left me scratching my head and pondering, “Why the BLEEP didn’t that work as intended?”)

This tutorial is about 90 minutes long (I SHOT A MOVIE!!), so either watch it in segments, or else be certain to have plenty of popcorn and soda ready before sitting to watch it in a single go.

Quick Link to it is here:
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!