great demonstration of a simple implementation of circular buffer. those structure are really useful with Arduino and other microcontroller. I usually reserve a node as an indicator for "overflow/datalost" that might be important to log (or turn on a warning light). I just recreate the node after sending/emptying the buffer and start at 0 instead of -1.
Hey Josh, I'm a young Unix admin with an extremely weak background in computer science so most of your videos go over my head, but I really appreciate the depth you provide in your videos. Just wanted to say thanks your work is appreciated.
Thank You a lot! You did great job explaining! Its a bit overkill for me still, but you explain it very well! I probably will watch video 10 times until I get everything :)
There are several flaws in this implementation of the algorithm which are 'solved' by you using nil values. The first problem is in the Insert method. The first value inserted increases _lastInsert_ index by 1. At this point _nextRead_ is 0 and thus equal to _lastInsert_ which is now also 0. This executes the code that increases the _nextRead_ index by 1. The second problem lies in the Emit method. When in the loop the last character is read, the loop breaks but the _nextRead_ index is not increased. So the _nextRead_ is still pointing to the previous position. As said both problems are obfuscated by the fact you use nil values.
Great tutorial, I got here from the blog post.Please can I know the software you are using to draw over the code editor. I have an xpen device but endup switching on different screens. Also some implementation block the insert/read when its full/empty. My guess is that data loss is ok for your use case.
Exactly! My goal/design trade-off here is to intentionally allow for overflow, prioritizing newest data. The drawing you're seeing is a screen annotating tool, Presentify.
insert method is wrong i think..the if lastInsert == nextRead will be true after first insert. If the nextRead is 0 on init then after insert first insert lastInsert is 0 then the statement is true and you will move the nextRead to 1 and so one and so one. Solution would be to check if the last value of ring buffer N-1 is null or not if is null that mean you yet didn't fill the whole ring buffer else if there is value already then it make sense for the nextRead to move
great demonstration of a simple implementation of circular buffer. those structure are really useful with Arduino and other microcontroller. I usually reserve a node as an indicator for "overflow/datalost" that might be important to log (or turn on a warning light). I just recreate the node after sending/emptying the buffer and start at 0 instead of -1.
Great idea regarding the overflow indicator 👍🏻
Hey Josh, I'm a young Unix admin with an extremely weak background in computer science so most of your videos go over my head, but I really appreciate the depth you provide in your videos. Just wanted to say thanks your work is appreciated.
Keep at it, learning comp sci stuff with a Unix admin background will set you up well!
Thank You a lot! You did great job explaining! Its a bit overkill for me still, but you explain it very well! I probably will watch video 10 times until I get everything :)
Really good video! Like it! Expecting more good quality ones.👍
great explained
There are several flaws in this implementation of the algorithm which are 'solved' by you using nil values.
The first problem is in the Insert method. The first value inserted increases _lastInsert_ index by 1. At this point _nextRead_ is 0 and thus equal to _lastInsert_ which is now also 0. This executes the code that increases the _nextRead_ index by 1.
The second problem lies in the Emit method. When in the loop the last character is read, the loop breaks but the _nextRead_ index is not increased. So the _nextRead_ is still pointing to the previous position.
As said both problems are obfuscated by the fact you use nil values.
Your videos are great! Thank you!
Thanks for watching!
Hey John, the blog seems to be down.
Great tutorial, I got here from the blog post.Please can I know the software you are using to draw over the code editor. I have an xpen device but endup switching on different screens. Also some implementation block the insert/read when its full/empty. My guess is that data loss is ok for your use case.
Exactly! My goal/design trade-off here is to intentionally allow for overflow, prioritizing newest data.
The drawing you're seeing is a screen annotating tool, Presentify.
insert method is wrong i think..the if lastInsert == nextRead will be true after first insert. If the nextRead is 0 on init then after insert first insert lastInsert is 0 then the statement is true and you will move the nextRead to 1 and so one and so one. Solution would be to check if the last value of ring buffer N-1 is null or not if is null that mean you yet didn't fill the whole ring buffer else if there is value already then it make sense for the nextRead to move
what is your zsh/iterm theme?
Bro my eyes... make this in a darker background fgs