sphaerophoria
sphaerophoria
  • 227
  • 244 977
Our chambers are finally connected
Stream from July 2, 2024 at twitch.tv/sphaerophoria
Pre-stream available at patreon.com/sphaerophoria
00:00 Intro
02:20 1 simulation, many chambers
43:20 Balls should only be in 1 chamber at a time
48:00 Moving balls between chambers
มุมมอง: 4

วีดีโอ

zig on the client, wasm on the server, what am i doing
มุมมอง 1.1K4 ชั่วโมงที่ผ่านมา
Stream from June 29, 2024 at twitch.tv/sphaerophoria June 29 pre stream available at patreon.com/sphaerophoria 00:00 Intro 06:10 Compile simulation to wasm 46:50 Interfacing with the browser
Who needs malloc anyways?
มุมมอง 2.4K7 ชั่วโมงที่ผ่านมา
Stream from June 28, 2024 at twitch.tv/sphaerophoria Pre-stream content available on patreon at patreon.com/sphaerophoria 00:00 Intro 07:22 Implement bump allocator 01:02:15 Only allocate on module init 01:27:20 Update other modules
Shoving too much data into an sqlite database
มุมมอง 9549 ชั่วโมงที่ผ่านมา
Stream from June 27, 2024 at twitch.tv/sphaerophoria 00:00 Intro 02:45 Add uploaded modules to DB 57:08 Load chambers from database on init
Hello sqlite my old friend
มุมมอง 1.1K12 ชั่วโมงที่ผ่านมา
Stream from June 26, 2024 at twitch.tv/sphaerophoria 00:00 Intro 03:25 Get sqlite up and running 15:50 Add users to the DB 01:28:45 Add session ids to the database 01:40:15 Always hit DB for user and session data
What happens when upload a file
มุมมอง 1K14 ชั่วโมงที่ผ่านมา
Stream from June 25, 2024 at twitch.tv/sphaerophoria 00:00 Intro 04:15 A dummy upload page 11:40 Receive the data 01:39:15 Do something with the data
We finally implemented login with twitch account
มุมมอง 1K21 ชั่วโมงที่ผ่านมา
Stream from June 22, 2024 at twitch.tv/sphaerophoria 00:00 Intro 04:00 Dummy login page 15:20 Redirect and cookies 57:00 Fetch ID token from twitch 01:23:30 Libcurl http client 01:45:35 Extracting result from JWT
Async event signaling in zig
มุมมอง 778วันที่ผ่านมา
Stream from June 21, 2024 at twitch.tv/sphaerophoria 00:00 Intro 06:40 Http connection reference counting 38:15 Http connection wait state 47:20 Wake http connection up on event
Validating json web tokens in zig w/ openssl
มุมมอง 955วันที่ผ่านมา
Stream from June 20, 2024 at twitch.tv/sphaerophoria 00:00 Intro 15:00 Parse the monstrosity 01:17:50 Signature verification 01:49:00 Reduce hard coding
OpenID connect melted my brain
มุมมอง 967วันที่ผ่านมา
Stream from June 20, 2024 at twitch.tv/sphaerophoria
Async HTTP server in Zig
มุมมอง 1.2Kวันที่ผ่านมา
Stream from June 18, 2024 at twitch.tv/sphaerophoria 00:00 Intro 06:06 HTTP event handler stub 21:10 HTTP request parsing 59:40 Send a response 01:18:00 Simple interactive website
Async TCP with epoll in zig
มุมมอง 1K14 วันที่ผ่านมา
Stream from June 17, 2024 at twitch.tv/sphaerophoria 00:00 Intro 04:55 Prove async send is necessary 17:00 Async TCP send setup 35:00 Event loop refactor to support multiple items per fd 01:28:15 Async TCP send again
Who needs async when you have epoll
มุมมอง 1.8K14 วันที่ผ่านมา
Stream from June 16, 2024 at twitch.tv/sphaerophoria 00:00 Intro 05:30 Demo failure case 09:00 Epoll tcp echo server 58:15 Event loop abstraction
Trying Zig to C bindings generator on real library
มุมมอง 84914 วันที่ผ่านมา
Stream from June 14, 2024 at twitch.tv/sphaerophoria 00:00 Intro 10:00 Fix pointer type resolution 43:45 Fix missing function exports 01:20:50 Figure out which structs need bindings
Using Zig's AST to auto generate C bindings
มุมมอง 1.2K14 วันที่ผ่านมา
Stream from June 13, 2024 at twitch.tv/sphaerophoria 00:00 Intro 07:40 Parsing our first line 57:15 Extracting a function 01:38:15 Extracting a nested function
Sharing structs between zig and wasm
มุมมอง 84914 วันที่ผ่านมา
Sharing structs between zig and wasm
Using wasm as our scripting engine
มุมมอง 81621 วันที่ผ่านมา
Using wasm as our scripting engine
This really complicates our physics engine
มุมมอง 99021 วันที่ผ่านมา
This really complicates our physics engine
First chamber of our wasm based rube goldberg machine
มุมมอง 77321 วันที่ผ่านมา
First chamber of our wasm based rube goldberg machine
WASM: The safety of C, the ergonomics of JS
มุมมอง 1.4K21 วันที่ผ่านมา
WASM: The safety of C, the ergonomics of JS
Adding collision to our physics engine
มุมมอง 99921 วันที่ผ่านมา
Adding collision to our physics engine
Making the worlds worst physics system
มุมมอง 2.4K21 วันที่ผ่านมา
Making the worlds worst physics system
String manipulation from wasm is weirdly difficult
มุมมอง 1.7K28 วันที่ผ่านมา
String manipulation from wasm is weirdly difficult
Writing wasm modules by hand is fun
มุมมอง 3Kหลายเดือนก่อน
Writing wasm modules by hand is fun
Poorly implementing ieee754 floats from scratch
มุมมอง 2.6Kหลายเดือนก่อน
Poorly implementing ieee754 floats from scratch
Synchronizing text view and timeline view in my video editor
มุมมอง 1.4Kหลายเดือนก่อน
Synchronizing text view and timeline view in my video editor
Saving audio files with ffmpeg to debug my video editor
มุมมอง 1.1Kหลายเดือนก่อน
Saving audio files with ffmpeg to debug my video editor
Splitting up long chunks of automatically transcribed text
มุมมอง 1.4Kหลายเดือนก่อน
Splitting up long chunks of automatically transcribed text
Script generation takes a long time...
มุมมอง 1.7Kหลายเดือนก่อน
Script generation takes a long time...
Navigating video with auto-generated text
มุมมอง 1.7Kหลายเดือนก่อน
Navigating video with auto-generated text

ความคิดเห็น

  • @lucasa8710
    @lucasa8710 3 ชั่วโมงที่ผ่านมา

    I'm loving your videos man

  • @andrewdunbar828
    @andrewdunbar828 22 ชั่วโมงที่ผ่านมา

    are the stack devs really so full?

  • @EthanFrei
    @EthanFrei วันที่ผ่านมา

    I really enjoyed watching the epiphanies you encountered and was amazed at the speed at which you pick up the language. I think watching you figuring out the neat parts of the language was more satisfying then learning it myself, because you have a deeper understanding of the implications of the language features.

  • @ViaConDias
    @ViaConDias 2 วันที่ผ่านมา

    Love your video's but I have stopped watching them because the constant moving maze above your head really triggers my Asperger and ADHD to a point where I can't follow along or I have to concentrate so hard that I tire out on these long videos. I wonder if you would consider removing it?

    • @Lualt
      @Lualt 2 วันที่ผ่านมา

      if you watch in fullscreen on a computer you can put maybe a small notepad over it, or move the youtube window to the side so the part with the maze and stufd goes offscreen

    • @rochbouchayer9120
      @rochbouchayer9120 42 นาทีที่ผ่านมา

      I'm forced to hide it with my fingers on mobile 😅

  • @Kknewkles
    @Kknewkles 2 วันที่ผ่านมา

    Mind giving me the skinny on the "Zig on the client" part? Are you somehow transforming Zig to JS, or to whatever JS is being transformed(compiled/interpreted, whatever) when Firefox is executing that?...

    • @sphaerophoria
      @sphaerophoria 2 วันที่ผ่านมา

      It's being compiled to webassembly, but that doesn't make as good of a title

    • @sphaerophoria
      @sphaerophoria 2 วันที่ผ่านมา

      To clarify further, "wasm on the client, wasm on the server" doesn't really capture the mental model of the project. It isn't entirely clickbait we're writing a server that loads user submitted webassembly modules. Server is mostly written in zig, we want to run some of the server side code that we've written in the browser. So from our perspective we don't care what language the wasm modules we consume are written in, but we do care that our zig code can run on both the client and server. The wasm there is an implementation detail

    • @Kknewkles
      @Kknewkles 2 วันที่ผ่านมา

      @@sphaerophoria aha, that's what I was hoping for, and if I understand correctly, that's what's going on... you can essentially execute non-JS in Firefox. Warms my heart :D

  • @vk-hm6te
    @vk-hm6te 2 วันที่ผ่านมา

    what’s up what’s up

  • @danesonance
    @danesonance 2 วันที่ผ่านมา

    What libraries are being used in your terminal? Especially for the file handling?

    • @sphaerophoria
      @sphaerophoria 2 วันที่ผ่านมา

      ranger file manager is what i use for directory navigation. I have it bound to ctrl-o to cd to whatever directory I exit in. Other than that it's just tmux and nvim

  • @aogposton
    @aogposton 3 วันที่ผ่านมา

    dead beef is a funny address... you got my clickthrough just based on that.

    • @0xCAFEF00D
      @0xCAFEF00D 2 วันที่ผ่านมา

      Sometimes when people read that as your username they seem subtly offended.

    • @chri-k
      @chri-k วันที่ผ่านมา

      @@0xCAFEF00Di've not seen 0xcafef00d anywhere somehow i wonder how many words like that there actually are

  • @beeplove7
    @beeplove7 4 วันที่ผ่านมา

    What is this thumbnail. LOL

    • @sphaerophoria
      @sphaerophoria 4 วันที่ผ่านมา

      Sqlite is hungry for yummy data

    • @wondays654
      @wondays654 4 วันที่ผ่านมา

      I like it

  • @rocketsketch
    @rocketsketch 5 วันที่ผ่านมา

    Thank you and a wonderful zig series

  • @sphaerophoria
    @sphaerophoria 5 วันที่ผ่านมา

    02:12:55 Using last_insert_rowid() is a mistake I think. In some cases there is no row inserted and it doesn't return something sane. This resulted in us saying "hey I have this session ID and it belongs to this user", but the user was invalid, which made the join invalid, etc. I've adjusted off screen to use the RETURNING clause in sqlite and parse the id out of it

  • @albinekb
    @albinekb 5 วันที่ผ่านมา

    Sweet!!

  • @andrewdunbar828
    @andrewdunbar828 6 วันที่ผ่านมา

    What happens when write a comment

    • @sphaerophoria
      @sphaerophoria 5 วันที่ผ่านมา

      Well now i can't fix it

    • @andrewdunbar828
      @andrewdunbar828 5 วันที่ผ่านมา

      @@sphaerophoria I think YT only lets the biggest channels edit that stuff )-:

    • @sphaerophoria
      @sphaerophoria 5 วันที่ผ่านมา

      Oh sorry, I can re-title the video no problem but then the comment wouldn't make sense anymore

    • @andrewdunbar828
      @andrewdunbar828 5 วันที่ผ่านมา

      @@sphaerophoria You are a man of honour!

  • @andrewdunbar828
    @andrewdunbar828 7 วันที่ผ่านมา

    failable is the new fallible

  • @mikehebert5489
    @mikehebert5489 7 วันที่ผ่านมา

    Seconding a comment I saw on an earlier video-I would absolutely love to watch a 20 minute summary of your projects, either as a single final summary or as intermittent updates. Your projects are really awesome to see! The 2 hour long videos are challenging to keep up with, though.

    • @sphaerophoria
      @sphaerophoria 7 วันที่ผ่านมา

      I did look into it, but I struggled to find a cut that I liked. Maybe some day I'll try again

  • @shackshack1613
    @shackshack1613 8 วันที่ผ่านมา

    Cool stuff

  • @cherkim
    @cherkim 9 วันที่ผ่านมา

    This is perhaps the most complex way to integrate OAuth nowadays. I love it.

    • @sphaerophoria
      @sphaerophoria 9 วันที่ผ่านมา

      What am I missing? I'm actually trying to just do the minimal amount that follows spec

    • @cherkim
      @cherkim 9 วันที่ผ่านมา

      No, your implementation is correct. I just mean the overhead of doing it in zig, while there are multiple existing JavaScript packages. Don’t get me wrong, I know why you are doing it this way (because you want to) and I respect it.

    • @sphaerophoria
      @sphaerophoria 9 วันที่ผ่านมา

      Oh i see, no libraries allowed! That's cheating!

    • @DevvOscar
      @DevvOscar 8 วันที่ผ่านมา

      Haha somebody has to build the library right. Maybe he can even package it into a library for Zig so other people can use it.

  • @proton..
    @proton.. 9 วันที่ผ่านมา

    hell yeah

  • @frisketdog
    @frisketdog 10 วันที่ผ่านมา

    Thanks!

  • @MrKeebs
    @MrKeebs 10 วันที่ผ่านมา

    Thanks!

  • @sphaerophoria
    @sphaerophoria 10 วันที่ผ่านมา

    01:38:15 It's actually possible to fix this by just inverting the dependency order. E.g. instead of HttpConnection owning something that gives it responses to write, have a specific connection own an HttpConnection and forward polls to it. See github.com/sphaerophoria/ball-machine/blob/dcc4ec5b03435d00b190dfbfbff2be55195419eb/src/http_test.zig#L8 as an example (WIP commit, will probably get garbage collected at some point)

  • @levelupwithamanjaiswal
    @levelupwithamanjaiswal 11 วันที่ผ่านมา

    crazy man. been watching your videos recently. mad respect

  • @mattanimation
    @mattanimation 11 วันที่ผ่านมา

    it really is terrible, but that's web dev

  • @happens_lol
    @happens_lol 12 วันที่ผ่านมา

    I've implemented OpenID in work settings like 4-5 times and I'm still just as confused as you are to be honest

  • @distortions
    @distortions 12 วันที่ผ่านมา

    only one whats up, the whats up are decreasing per video

    • @sphaerophoria
      @sphaerophoria 12 วันที่ผ่านมา

      I think it's because my I frames are pretty far apart and recordings only start on the next . So I don't know when the recording _actually_ starts relative to when I click the button. I actually say "yoooo, 3x what's up" or "3x yo, 3x what's up" every time

    • @Jeanpierrec19
      @Jeanpierrec19 12 วันที่ผ่านมา

      @@sphaerophoria Maybe you could start recording and then just wait a bit. Maybe someone could build an editor, that has a transcription, that would allow you to cut it right at the first whatsup. JK btw...

  • @ak00ma1
    @ak00ma1 13 วันที่ผ่านมา

    This channel is a blessing for learning more than just the basics of zig. Youre a legend @sphaerophoria

  • @user-es7up9ic7n
    @user-es7up9ic7n 13 วันที่ผ่านมา

    Hello, I like your videos and I learn by watching you program and explain things, I love your content. I wanted to ask you a favor, which is to zoom in on the code, there is a lot of empty space and I don't see the code close enough... You can take a look at how a guy does it with content similar to yours, called "tsoding", if it's not a bother, put the code in the largest terminal, that is, zoom in. Thank you! Sorry if I wrote something wrong, English is not my first language and I translated it with the translator. Thank you so much!

  • @vk-hm6te
    @vk-hm6te 13 วันที่ผ่านมา

    i haven't watched the streams in entirety so might have missed it, but i'm curious why you're not using websockets for this? the epoll implementation would still be a cool learning experience, but the protocol itself would be better suited for the task than HTTP (as i understand it). love the series (and your videos in general) btw, keep it up :)

  • @ryantaylor6470
    @ryantaylor6470 13 วันที่ผ่านมา

    Great video! happy to find someone doing interesting things in Zig

  • @sphaerophoria
    @sphaerophoria 14 วันที่ผ่านมา

    I had a couple post-stream realizations... 1. We can give callback data directly to an epoll instance if the handler has a stable memory location. We can create a item pool that is basically a std.ArrayList with a list of IDs that can be reused and that simplifies a lot of the code 2. It makes a lot more sense to just register a single handler that handles both input and output for a given socket. Again this simplifies a lot because we no longer need the double indirection of file descriptor -> list of callbacks. This also means that each individual callback does not need a specific id 3. If we return a value from our epoll callback that says "I am finished, please delete me", that simplifies a lot of stuff as well. We can just buffer all deletions until we aren't iterating anymore which is pretty nice 4. Epoll links to files are automatically closed if the file descriptor is closed, we don't actually have to unregister connections if we're careful Latest and greatest at github.com/sphaerophoria/ball-machine/blob/526a78fe5aa027e366c6897002313b7438e665db/src/event_loop.zig (note may disappear after some future git gcs, but by that point there should be something in master)

  • @armaandhanji2112
    @armaandhanji2112 15 วันที่ผ่านมา

    Amazing video, currently watching still. I'm pretty new to this stuff but I think node.js uses libuv which is a library that uses epoll/an event loop. When there isn't any work left to do, the loop ends and the node process exits. My question is...when you start a web server, does it add a file descriptor to the list of fds and that fd stays there indefinitely until you close it when doing ctrl-c or something in the terminal? In other words, how does a web server keep the event loop indefinitely running?

    • @sphaerophoria
      @sphaerophoria 15 วันที่ผ่านมา

      It's probably easier to explain if we think about it without the event loop first. A typical server will look like (pseudo code) socket = make_socket(); listen(socket); while (true) { connection = accept(socket); read_or_write_connection(connection); } So we have one socket that sits there listening, and over time new connections come in when people connect to the socket The event loop case isn't any different, except for instead of doing connection = accept(socket) in the main loop, we set up a function callback that accepts the connection and shoves the new connection into our list of events to handle Specific event loops may end up handling this differently. You could shove a wants_shutdown bool in the while condition, you could wait until there is nothing left to poll, and have someone explicitly deregister the socket that is accepting new connections, i'm sure there are other options but I don't want to think about them :P

  • @rocketsketch
    @rocketsketch 15 วันที่ผ่านมา

    Thank you for such consistency in creating this quality content. Though new to zig, these are super helpful.

  • @smx75
    @smx75 15 วันที่ผ่านมา

    01:25:35 Is ``` var connection = try self.server.accept(); var echoer = TcpEchoer.init(self.alloc, connection) catch |e| { connection.stream.close(); return e; }; ``` equivalent to ``` var connection = try self.server.accept(); errdefer connection.stream.close(); var echoer = try TcpEchoer.init(self.alloc, connection); ``` or am I misunderstanding `errdefer`? On a side note, `errdefer ` can capture error. Might be useful for lazy catch all error logging.

    • @sphaerophoria
      @sphaerophoria 15 วันที่ผ่านมา

      It's a super subtle difference. I am trying to hand off ownership of the connection to the TcpEchoer. In TcpEchoer.deinit I close the connection, but also do some other stuff. Say we fail to register with the event loop at line 30, if we did the errdefer you're speaking of, we would close the connection once through echoer.deinit at line 25, then again at the errdefer that would be inserted at line 20. I'm actually not sure if double closing is a problem, but double freeing definitely is so I have the habit of ensuring cleanup is only issued one time per object

    • @smx75
      @smx75 15 วันที่ผ่านมา

      Oh I see. Thank you for the explanation.

  • @sarthaksingh6953
    @sarthaksingh6953 15 วันที่ผ่านมา

    Bro can you share the github repo of the project

  • @sphaerophoria
    @sphaerophoria 16 วันที่ผ่านมา

    WIP commit (that may end up deleted in the future) that really slims down the interface and fixes some of the uglyness around the registration stuff github.com/sphaerophoria/ball-machine/commit/fb995b3db2ae66eccde001dd25577479346e157e

  • @bart2019
    @bart2019 16 วันที่ผ่านมา

    Spending more than an hour learning how to traverse a tree in Zig. 🙄

    • @sphaerophoria
      @sphaerophoria 16 วันที่ผ่านมา

      What a rude and reductive comment, just a reminder that you get to choose if you want to be an ass hole or not I don't think in any part of this video we were struggling with "walking a tree" or with the fact that we were doing it in zig. The time comes from trying to find the data we care about, understand it's representation, and do what we want to do with it. There was a 20 min segment around 55:00 where we had to adjust our walking logic to account for a change in expectations about the tree layout, but I don't think that's an unreasonable amount of time to spend on something. Even if we were spending a lot of time on something, and you're wayyyyy smarter and could do it faster, there's no reason to try to make others feel bad about learning

  • @minma02262
    @minma02262 16 วันที่ผ่านมา

    There is a lot of good knowledge here. Zig to wasm, rust to zig, zig to rust, zig to C. But all of it is 2 hours plus 😢😢😢.

  • @distortions
    @distortions 17 วันที่ผ่านมา

    whats up whats up whats up

  • @sphaerophoria
    @sphaerophoria 17 วันที่ผ่านมา

    I played with an alternative method today and it worked really well. * Copy paste structs from zig to C header, mark structs as extern in zig * Write C bindings API by hand * Write a comptime function that asserts that structs are the same. Struct size, field offsets, struct alignment, etc. * Write a comptime function that asserts that all exported functions have parameters and return types that match according to previous bullet * Use the zig types in the bindings impl file

  • @bobby9568
    @bobby9568 17 วันที่ผ่านมา

    Guru programmer at work! Amazing!

  • @hamzarashid7579
    @hamzarashid7579 17 วันที่ผ่านมา

    You know you could also run :LspRestart to restart the language server.

  • @thatguyintech
    @thatguyintech 17 วันที่ผ่านมา

    i’m so glad i found this channel

  • @blacklistnr1
    @blacklistnr1 18 วันที่ผ่านมา

    so crazy that that zig searches for dependency loops with DFS(basically a stack) but doesn't tell you either the stack or the duplicated value when it reports errors

  • @CrossbowBeta
    @CrossbowBeta 18 วันที่ผ่านมา

    I remember zig having -femit-h at one time.

  • @ch1n3du3
    @ch1n3du3 18 วันที่ผ่านมา

    I love your videos man, thanks for making them

  • @adammontgomery7980
    @adammontgomery7980 18 วันที่ผ่านมา

    I can't read anything when you scroll around so fast like you do. Just FYI

  • @musicuniverse4506
    @musicuniverse4506 18 วันที่ผ่านมา

    @sphaerophoria There is a great talk done by a core maintainer on Zig exactly about the memory layout optimizations for the compiler. I highly recommend it. Andrew Kelley - Practical DOD. Its on Vimeo, I don't think youtube lets me link it

    • @sphaerophoria
      @sphaerophoria 18 วันที่ผ่านมา

      That was a great watch!

  • @sphaerophoria
    @sphaerophoria 18 วันที่ผ่านมา

    Significant code cleanup (wip branch, git garbage collection may delete in the far future): github.com/sphaerophoria/ball-machine/commit/2ae83498847120d120952917a78e14231307dfcd

  • @distortions
    @distortions 18 วันที่ผ่านมา

    whats up whats up

  • @creator-link
    @creator-link 19 วันที่ผ่านมา

    That was fast, the stream just happened