sphaerophoria
sphaerophoria
  • Видео 223
  • Просмотров 236 103
Hello sqlite my old friend
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
Просмотров: 199

Видео

What happens when upload a file
Просмотров 7098 часов назад
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
Просмотров 94815 часов назад
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
Просмотров 72118 часов назад
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
Просмотров 88620 часов назад
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
Просмотров 92823 часа назад
Stream from June 20, 2024 at twitch.tv/sphaerophoria
Async HTTP server in Zig
Просмотров 1 тыс.День назад
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
Просмотров 991День назад
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,7 тыс.День назад
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
Просмотров 834День назад
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,2 тыс.День назад
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
Просмотров 83914 дней назад
Stream from June 11, 2024 at twitch.tv/sphaerophoria 00:00 Intro 07:19 Replace chamber with wasm 01:28:00 Multiple chambers
Using wasm as our scripting engine
Просмотров 81014 дней назад
Stream from June 10, 2024 at twitch.tv/sphaerophoria 00:00 Intro 05:45 Integrating any wasm engine at all 39:00 Wasm string IO test (browser) 49:20 Wasm string IO test (wasmtime) 01:01:30 Using wasmtime from zig
This really complicates our physics engine
Просмотров 98114 дней назад
Stream from June 9, 2024 at twitch.tv/sphaerophoria 00:00 Intro 05:30 Initial test case 18:00 Implement collision 38:25 A bucket o' balls 01:09:35 Reproducible physics 01:36:58 Recording system
First chamber of our wasm based rube goldberg machine
Просмотров 76114 дней назад
Stream from June 8, 2024 at twitch.tv/sphaerophoria 00:00 Intro 03:30 Add chamber to server side simulation 57:07 Physics integration
WASM: The safety of C, the ergonomics of JS
Просмотров 1,4 тыс.14 дней назад
WASM: The safety of C, the ergonomics of JS
Adding collision to our physics engine
Просмотров 97321 день назад
Adding collision to our physics engine
Making the worlds worst physics system
Просмотров 2,3 тыс.21 день назад
Making the worlds worst physics system
String manipulation from wasm is weirdly difficult
Просмотров 1,7 тыс.21 день назад
String manipulation from wasm is weirdly difficult
Writing wasm modules by hand is fun
Просмотров 2,9 тыс.21 день назад
Writing wasm modules by hand is fun
Poorly implementing ieee754 floats from scratch
Просмотров 2,6 тыс.21 день назад
Poorly implementing ieee754 floats from scratch
Synchronizing text view and timeline view in my video editor
Просмотров 1,4 тыс.28 дней назад
Synchronizing text view and timeline view in my video editor
Saving audio files with ffmpeg to debug my video editor
Просмотров 1,1 тыс.28 дней назад
Saving audio files with ffmpeg to debug my video editor
Splitting up long chunks of automatically transcribed text
Просмотров 1,4 тыс.28 дней назад
Splitting up long chunks of automatically transcribed text
Script generation takes a long time...
Просмотров 1,7 тыс.Месяц назад
Script generation takes a long time...
Navigating video with auto-generated text
Просмотров 1,7 тыс.Месяц назад
Navigating video with auto-generated text
Generating subtitles in my zig video editor
Просмотров 2,3 тыс.Месяц назад
Generating subtitles in my zig video editor
Our video editor is actually kinda useable
Просмотров 2,4 тыс.Месяц назад
Our video editor is actually kinda useable
Precise seeking using audio waveform in my zig/rust video editor
Просмотров 1,5 тыс.Месяц назад
Precise seeking using audio waveform in my zig/rust video editor
Rendering audio waveforms in my zig video editor
Просмотров 2,3 тыс.Месяц назад
Rendering audio waveforms in my zig video editor

Комментарии

  • @sphaerophoria
    @sphaerophoria 7 часов назад

    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 19 часов назад

    Sweet!!

  • @andrewdunbar828
    @andrewdunbar828 День назад

    What happens when write a comment

    • @sphaerophoria
      @sphaerophoria 21 час назад

      Well now i can't fix it

    • @andrewdunbar828
      @andrewdunbar828 21 час назад

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

    • @sphaerophoria
      @sphaerophoria 20 часов назад

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

  • @andrewdunbar828
    @andrewdunbar828 2 дня назад

    failable is the new fallible

  • @mikehebert5489
    @mikehebert5489 2 дня назад

    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 2 дня назад

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

  • @shackshack1613
    @shackshack1613 3 дня назад

    Cool stuff

  • @cherkim
    @cherkim 4 дня назад

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

    • @sphaerophoria
      @sphaerophoria 4 дня назад

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

    • @cherkim
      @cherkim 4 дня назад

      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 4 дня назад

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

    • @DevvOscar
      @DevvOscar 3 дня назад

      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.. 4 дня назад

    hell yeah

  • @frisketdog
    @frisketdog 5 дней назад

    Thanks!

  • @MrKeebs
    @MrKeebs 5 дней назад

    Thanks!

  • @sphaerophoria
    @sphaerophoria 5 дней назад

    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 6 дней назад

    crazy man. been watching your videos recently. mad respect

  • @mattanimation
    @mattanimation 6 дней назад

    it really is terrible, but that's web dev

  • @n0va010
    @n0va010 7 дней назад

    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 7 дней назад

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

    • @sphaerophoria
      @sphaerophoria 7 дней назад

      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 7 дней назад

      @@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 8 дней назад

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

  • @user-es7up9ic7n
    @user-es7up9ic7n 8 дней назад

    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 8 дней назад

    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 8 дней назад

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

  • @sphaerophoria
    @sphaerophoria 9 дней назад

    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 10 дней назад

    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 10 дней назад

      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 10 дней назад

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

  • @smx75
    @smx75 10 дней назад

    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 10 дней назад

      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 10 дней назад

      Oh I see. Thank you for the explanation.

  • @sarthaksingh6953
    @sarthaksingh6953 10 дней назад

    Bro can you share the github repo of the project

  • @sphaerophoria
    @sphaerophoria 11 дней назад

    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 11 дней назад

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

    • @sphaerophoria
      @sphaerophoria 11 дней назад

      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 11 дней назад

    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 12 дней назад

    whats up whats up whats up

  • @sphaerophoria
    @sphaerophoria 12 дней назад

    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 12 дней назад

    Guru programmer at work! Amazing!

  • @hamzarashid7579
    @hamzarashid7579 12 дней назад

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

  • @thatguyintech
    @thatguyintech 12 дней назад

    i’m so glad i found this channel

  • @blacklistnr1
    @blacklistnr1 13 дней назад

    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 13 дней назад

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

  • @ch1n3du3
    @ch1n3du3 13 дней назад

    I love your videos man, thanks for making them

  • @adammontgomery7980
    @adammontgomery7980 13 дней назад

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

  • @musicuniverse4506
    @musicuniverse4506 13 дней назад

    @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 13 дней назад

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

  • @distortions
    @distortions 13 дней назад

    whats up whats up

  • @creator-link
    @creator-link 14 дней назад

    That was fast, the stream just happened

  • @StolenXMR
    @StolenXMR 14 дней назад

    early

  • @kevinknutson4596
    @kevinknutson4596 14 дней назад

    Neat, Also seems like your chamber1 and chamber2 balls are interacting. Or maybe more accurately both chambers have all 10 balls and are just rendering the 5 each and simulating all of them

  • @beeplove7
    @beeplove7 14 дней назад

    this is super cool

  • @distortions
    @distortions 15 дней назад

    whats up whats up whats up

  • @sphaerophoria
    @sphaerophoria 15 дней назад

    10:50 For the record I considered multiple options here before stream. Asserting struct layout seemed the most promising, but other options (in approximate order) * manual serialization/deserialization functions * flatbuffers/capn' proto for memory efficient but consistent field encoding * Working with a u8 buffer and manually cast chunks of that buffer to different struct fields * Json in, json out * msgpack

  • @blacklistnr1
    @blacklistnr1 15 дней назад

    still laughing at the aspect_ratio_ratio fiasco :))) - uniforms for widths, heights and stride to get intuitive formulas? Preposterous! - aspect_ratio_ratio + symbolic brute-force? This is the way.

  • @billynugget7102
    @billynugget7102 15 дней назад

    Damn i literally had this idea, you beat me to it

  • @TenseiCho
    @TenseiCho 15 дней назад

    I've gotten super lazy and just have AI code everything so I'm interested to see your approach to coding. Looking forward to watching from the very start.

  • @korigamik
    @korigamik 16 дней назад

    pls get back to the video editor friendo 🥰

    • @korigamik
      @korigamik 16 дней назад

      okay i saw the stream, pls continue on wasm chambers pls

  • @shikasd
    @shikasd 16 дней назад

    balls