Th30z Code
Th30z Code
  • 40
  • 70 845
Mastering Bitwise Operations: Shifting, Masking, and More!
Learn about Bit shifting, Bit Masking and the various Bitwise operations and don't be afraid of them!
Slides available at: speakerdeck.com/matteobertozzi/mastering-bitwise-operations-shifting-masking-and-more
0:00 Intro
0:07 Binary Representation
0:24 Left Shift
0:36 A Practical Example
1:52 Right Shift
3:00 Tricks
3:30 Bitmaps
4:48 Recap Bitwise Operations
#bits
มุมมอง: 87

วีดีโอ

Java 21: Virtual Threads - A different async/await with Code Examples
มุมมอง 8K8 หลายเดือนก่อน
Java 21 introduces lightweight concurrency with Virtual Threads. Virtual threads are a different approach to asynchronous programming. Instead of having to rewrite everything using async/await keywords. Java will take care of everything. Discover the changes introduced with JDK 21 and learn how Virtual Threads behaves with code examples demonstrating I/O Bound Tasks, CPU Bound Tasks, and Cooper...
Database Clustered vs Non-Clustered Index
มุมมอง 2.7K9 หลายเดือนก่อน
Database Clustered vs Non-Clustered Index, Heap-Organized tables vs Index-Organized tables, RowId tables, pages and fragmentation are some of the topics covered in this video. Learn how a Database works under the hood, and the differences and benefits of the Heap-Organized table vs an Index Organized Table. Understand how a Non-Clustered index is represented depending on the type of the storage...
ULID vs UUID: Which One Should You Use?
มุมมอง 9K10 หลายเดือนก่อน
ULID, UUID v7 (Time-Based IDs) and UUID v4 (Random Ids) offers completely different characteristics. Learn about the data layout and when to prefer one or the other based on your type of database and behaviour you want to obtain. Learn how ULID can cause hotspots in distributed databases, and how UUID v4 can cause fragmentation and increased disk I/O in traditional databases. Slides are availab...
The Hidden Dangers of SQL OFFSET: Pagination Woes Explained
มุมมอง 3.2K10 หลายเดือนก่อน
While SQL OFFSET might seem like a simple solution for pagination, it comes with severe performance, memory, and data integrity issues. As your application and database grow, these problems will become more apparent and can hinder scalability. Keyset pagination offers a more efficient and reliable alternative, providing consistent performance, predictable memory usage, and stable data ordering....
Avoid common Java Mistakes and improve performance
มุมมอง 64810 หลายเดือนก่อน
Want to level up your Java programming skills? In this video, we dive deep into the Java best practices and common mistakes to avoid. Discover the techniques that can improve your code, boost productivity, and unlock your full potential as a Java developer. Learn how to write cleaner, more efficient code while avoiding costly errors that can derail your projects. Whether you're a beginner or an...
STOP doing these beginner mistakes!
มุมมอง 16411 หลายเดือนก่อน
Doesn’t matter if you just started or you use javascript everyday. there will always be things which might surprise you. This video will go through some of the best practices and common mistakes that every javascript/typescript programmer should know. We will start from variable declaration to code and data structures optimisations, we will see the common usage mistakes of provided functions an...
Data Encodings used by Columnar and Time series databases
มุมมอง 34911 หลายเดือนก่อน
A detailed overview about the common data encoding techniques used columnar database, columnar file formats and time series database to reduce the data size and improve performance. Slides available at: speakerdeck.com/matteobertozzi/data-encoding-techniques-used-by-columnar-and-time-series-databases Chapters: 0:00 Intro (Row, Columnar, Hybrid Storage) 1:11 Int Encoding (basics) 1:53 Group VarI...
Unbreakable Messages: RSA + AES Encryption Explained (with Coding Examples)
มุมมอง 53911 หลายเดือนก่อน
In this video we will see how to encrypt, decrypt, and verify a message using Asymmetric Encryption, with code examples in Javascript, Python and Java. We will see why hybrid encryption is commonly employed to overcome the limitation of asymmetric encryption. There will be code examples in Python, Javascript and Java to show how to use APIs to encrypt and decrypt using both RSA-OAEP and AES-256...
Scale Your App to Infinity: Mastering Sharding for Storage and Compute
มุมมอง 533ปีที่แล้ว
Learn about Sharding and unlock the power of horizontal scalability for both Storage and Computation. In this video, we delve into the concept of sharding, a technique that enables partitioning of data and computation for enhanced performance. We explore the three primary sharding strategies - Lookup, Range, and Hash - and dive into their unique characteristics, benefits, and ideal use cases wi...
Database Auto increment vs UUID - Which is Right for You?
มุมมอง 28Kปีที่แล้ว
Database Auto increment vs UUID - Which is Right for You?
Database Indexing: Unveiling The Secrets of Fast Queries, in just 5 Minutes!
มุมมอง 2.5Kปีที่แล้ว
Database Indexing: Unveiling The Secrets of Fast Queries, in just 5 Minutes!
Http Request Chunking
มุมมอง 3.2Kปีที่แล้ว
Http Request Chunking
Discover the Basics of Telemetry - Metrics What You Need to Know!
มุมมอง 545ปีที่แล้ว
Discover the Basics of Telemetry - Metrics What You Need to Know!
Producer/Consumer, The RingBuffer and The Log. (Techniques for building Events Pipelines with ease)
มุมมอง 3.1Kปีที่แล้ว
Producer/Consumer, The RingBuffer and The Log. (Techniques for building Events Pipelines with ease)
Implement AWS Lambda Custom Runtimes (how to run Deno, Rust, C, C++, Java Native Images and more)
มุมมอง 365ปีที่แล้ว
Implement AWS Lambda Custom Runtimes (how to run Deno, Rust, C, C , Java Native Images and more)
Data Structures: Hash Tables - how do they work internally?
มุมมอง 236ปีที่แล้ว
Data Structures: Hash Tables - how do they work internally?
YAJBE - Yet Another JSON Binary Encoding
มุมมอง 644ปีที่แล้ว
YAJBE - Yet Another JSON Binary Encoding

ความคิดเห็น

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

    you have explained it very well thank u

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

    Excellent explanation and visualization on an actual problem, not just printing "Hello World" lines. Thank you!

  • @AxioMATlC
    @AxioMATlC 20 วันที่ผ่านมา

    For a primary key, neither ULID or UUID is preferable vs an integer for the sake of inefficient storage which will take up precious memory if you want to keep your indices all in memory (you do). a global ID is great for generating IDs without communicating to the database to get an auto incrementing ID, or for using it as a external ID that cannot be exploited/guessable by users. You should have an int/bigint primary key and additionally/optionally a UUID or ULID depending on your use-case

  • @juhairahamed5342
    @juhairahamed5342 29 วันที่ผ่านมา

    Good Explanation

  • @manojBadam
    @manojBadam หลายเดือนก่อน

    Very good explanation

  • @awksedgreep
    @awksedgreep หลายเดือนก่อน

    If you have a tiny 3nf database that will never grow bigger than say 1G then UUID is slower, but fine. If you think your database will ever grow in size stick with auto inc.

  • @ddavid8888888
    @ddavid8888888 หลายเดือนก่อน

    There are disadvantages for this method too… not showing makes this video harmful for devs who can’t think about the cases this is not useful

    • @th30z-code
      @th30z-code หลายเดือนก่อน

      I tried to cover the main advantages and disadvantages from both the Database and the UI point of view. but if you have further points that you want people to know, feel free to add your notes

  • @syntheticfox_
    @syntheticfox_ หลายเดือนก่อน

    When choosing between server vs client side ID generation largely depends on security requirements of your application. For any external facing API, you will need to generate IDs on the server in order to keep the integrity of the data healthy. UUIDs can be generated on client or server.

  • @si4745
    @si4745 2 หลายเดือนก่อน

    Dude your channel is a gem, absolute goldmine

    • @th30z-code
      @th30z-code 2 หลายเดือนก่อน

      Glad you enjoy it!

  • @jakobfreij9245
    @jakobfreij9245 2 หลายเดือนก่อน

    video you thank

  • @Lijn3s
    @Lijn3s 2 หลายเดือนก่อน

    Thanks for sharing, helped me a lot.

  • @sohilgoud130
    @sohilgoud130 2 หลายเดือนก่อน

    This is great!!, thanks for the video.

  • @arfiya225
    @arfiya225 2 หลายเดือนก่อน

    NaN

  • @theboringdev
    @theboringdev 2 หลายเดือนก่อน

    I wish your video will reach more viewers.

  • @kiranmajji473
    @kiranmajji473 2 หลายเดือนก่อน

    But these crypto.getRandomValues() are not compatible in every browser could you suggest us any other which is compatible in every browser

  • @user-jq4li8kj8o
    @user-jq4li8kj8o 2 หลายเดือนก่อน

    Great video, thanks!

  • @drumforhim
    @drumforhim 2 หลายเดือนก่อน

    Very well presented. Thanks!

  • @abdelrahmandwedar
    @abdelrahmandwedar 3 หลายเดือนก่อน

    At the moment 1:21 I thought then random-based IDs would be more suitable for databases that's frequently being used for sharding like MongoDB, while time-based IDs would be more suitable for most of other databases with b-tree data structure.

  • @varshard0
    @varshard0 3 หลายเดือนก่อน

    Thank you for the video

  • @piotrbeda6887
    @piotrbeda6887 4 หลายเดือนก่อน

    Best explanation of indexes on YT I've ever seen

    • @th30z-code
      @th30z-code 3 หลายเดือนก่อน

      Thank you, I really appreciate!

  • @user-wn5td2zb7o
    @user-wn5td2zb7o 4 หลายเดือนก่อน

    amazing video, thank you very much.

  • @Anbu_Sampath
    @Anbu_Sampath 4 หลายเดือนก่อน

    Nice examples.

  • @Anshika-hv9jx
    @Anshika-hv9jx 5 หลายเดือนก่อน

    where we add this code , in thr frontend or in the API?

    • @th30z-code
      @th30z-code 5 หลายเดือนก่อน

      The video is more about the frontend sending large data and dividing it up in chunks. but the same may apply on the backend side where a service has to send large data to another service.

  • @vikingthedude
    @vikingthedude 5 หลายเดือนก่อน

    This is good stuff. I hope to see more backend/architecteture/system design content like this. This reminds me of Hussein Nasser. I love it

    • @th30z-code
      @th30z-code 5 หลายเดือนก่อน

      Thank you! really appreciated.

  • @arcstur
    @arcstur 5 หลายเดือนก่อน

    Incredibly high quality. Thanks for your work!

    • @th30z-code
      @th30z-code 5 หลายเดือนก่อน

      Thank you! i'm glad you enjoyed it

  • @aguswidi9316
    @aguswidi9316 5 หลายเดือนก่อน

    Finally I use this. Awesome

  • @Asingh42
    @Asingh42 6 หลายเดือนก่อน

    Now spring boot 3.2 supports virtual threads make a video on it how to use @Async with it

  • @kennedydre8074
    @kennedydre8074 7 หลายเดือนก่อน

    Great video! Thank you for the amazing explanation, I have a question. How can I use uuidv7 or ulid in my typescript project?

    • @th30z-code
      @th30z-code 7 หลายเดือนก่อน

      You can use 3rd party libraries that provides already simple functions to generate the uuidv7/ulid. github.com/LiosK/uuidv7 github.com/kripod/uuidv7 github.com/aarondcohen/id128 github.com/ulid/javascript

  • @rajughorai7483
    @rajughorai7483 7 หลายเดือนก่อน

    🎯 Key Takeaways for quick navigation: 00:00 🧱 Both UUID and ULID are 128-bit data blocks, but ULID's 48-bit timestamp field allows for lexicographical sorting and time-based locality. 00:28 🔄 ULID is not directly compatible with UUIDs; however, UUID version 7 shares similar properties with ULID. 00:57 🗃️ Random-based IDs like UUID v4 are beneficial for distributed databases due to good data distribution across nodes, but can lead to fragmentation in single-machine databases. 01:23 ⏳ Time-based IDs like ULID improve disk I/O and cache efficiency in single-machine databases, but may create hotspots in distributed systems. 02:18 🔢 ULID uses Crockford's base32 for a more compact string encoding, maintaining lexicographical order, and is suitable for generating offline IDs in multi-machine environments.

  • @Aceptron
    @Aceptron 7 หลายเดือนก่อน

    Great explanation! Concise, yet covered great questions. Loved it! ❤

    • @th30z-code
      @th30z-code 7 หลายเดือนก่อน

      Glad you liked it! thanks for watching!

  • @AK-vx4dy
    @AK-vx4dy 8 หลายเดือนก่อน

    Quick and good explanation! Good job !

    • @th30z-code
      @th30z-code 8 หลายเดือนก่อน

      Thank you!

  • @yeshengwei79
    @yeshengwei79 8 หลายเดือนก่อน

    Very informative! Well done👍

    • @th30z-code
      @th30z-code 8 หลายเดือนก่อน

      Thanks! I'm glad you enjoyed it

  • @SuperShahidAkhtar
    @SuperShahidAkhtar 8 หลายเดือนก่อน

    Thanks for examples

    • @th30z-code
      @th30z-code 8 หลายเดือนก่อน

      Thanks for checking them out! I hope they were helpful.

  • @tomaszn9201
    @tomaszn9201 8 หลายเดือนก่อน

    UUIDS are hundreds, thousands time slower to query (big tables) than integers.

  • @dariuszlenartowicz
    @dariuszlenartowicz 8 หลายเดือนก่อน

    Using blindly the same big type id for all datasets (tables) is a big misunderstanding. In our company we reduced our databases in half migrating to appropriate I'd types.

  • @PunyaLyceum
    @PunyaLyceum 9 หลายเดือนก่อน

    thanks for code. it help me learn about OTP.

    • @th30z-code
      @th30z-code 9 หลายเดือนก่อน

      Great! I'm glad it was helpful

  • @user-mp9um5qj3u
    @user-mp9um5qj3u 9 หลายเดือนก่อน

    Hi, Theo. Are you a java developer? I like your videos alot. Currently I am learning spring framework and backend stuff and your videos are very helpful.

    • @th30z-code
      @th30z-code 9 หลายเดือนก่อน

      Hi, Thank you! I'm glad the video were helpful. Where I currently work Java is the main language, along with javascript/typescript and Python, but in my free time I still prefer toying with C, Go and Rust. If you have any suggestions to improve the videos or you have any specific topic that you are interested in, let me know and if I have the knowledge I'll try to cover it.

  • @user-mp9um5qj3u
    @user-mp9um5qj3u 9 หลายเดือนก่อน

    I am new to programming and learning spring and i am falling in love with database design. I am a newbie in this field. Your videos are very helpful❤🎉🎉🎉. Hope to see more database and backend related stuff.

    • @th30z-code
      @th30z-code 9 หลายเดือนก่อน

      Hi! I'm glad the content was helpful. There will surely be more videos on database and backend stuff. If you have any specific topic that you are interested in, let me know and if I have the knowledge I'll try to cover it.

  • @chrishabgood8900
    @chrishabgood8900 9 หลายเดือนก่อน

    The problem with uuid is it’s not sequential.

    • @th30z-code
      @th30z-code 9 หลายเดือนก่อน

      It's not a problem it's a characteristic of UUID v4. If you need an ID that can be generated offline (similar to UUIDs) but with some sequentiality ULID, UUID v7 or Snowflake ids are what you looking for. Checkout this video that talks about the different behaviour, from a storage point of view, of the two type of IDs th-cam.com/video/2MbFDR7qt5U/w-d-xo.html.

  • @lattelover7186
    @lattelover7186 10 หลายเดือนก่อน

    I have questions: 1. How does Keyset pagination help with dynamic data filtering tuple WHERE new_categories IN ("politic", "sports") or new_title LIKE "something%" or EXISTS subquery. 2. How it solve the backward direction. Let's say last seen news_id is 51 and we need to get previous data with id 41-50.

    • @th30z-code
      @th30z-code 10 หลายเดือนก่อน

      Hi, thanks for watching! 1. You can have any data filtering in your query. The pagination query must contains the filter AND the key condition (filter-cond AND key-cond). In the example of news feed is quite common have something like: WHERE topic = 123 AND (date, id) < (prev_date, prev_id) 2. backward direction is a "limitation" of the keyset pagination. If you use infinite scrolling you don't need a query to go back, since you already have all the previous data locally. If you start from a specific position the only way to go back is to do the query but with the reverse sort order, which means that you have to keep two indexes for both directions.

    • @lattelover7186
      @lattelover7186 10 หลายเดือนก่อน

      @@th30z-code 1. When using data table/grid in frontend we usually deal with arbitrary sorting. Can the pagination still handle that kind of sorting well. 2. You are right, we already have all the prev data locally. Make sense. Thank you so much

    • @th30z-code
      @th30z-code 10 หลายเดือนก่อน

      Arbitrary sorting does not play well with databases. unless there is a specific index for the sort order, It's a lot of memory and cpu usage. so every time a request comes in there is a full table scan and a sort operation. It's ok for 10 apps with few users that access the table/grid sporadically, but if you have a bit of traffic it is better to fetch all the main columns you see in the table and sort them locally. If you have large fields (e.g. blobs, or something hidden with an expander) you can fetch them on demand using the key of the row. Fetching everything should cost less than asking the db to sort everytime. In terms of data should not be that much (e.g. 32bytes per column, 10 columns 10k rows are 3MB)

  • @th30z-code
    @th30z-code 10 หลายเดือนก่อน

    If you are interested in ULID vs UUID from a storage point of view check out this video: th-cam.com/video/2MbFDR7qt5U/w-d-xo.html

  • @th30z-code
    @th30z-code 10 หลายเดือนก่อน

    Check this video about ULID vs UUID: th-cam.com/video/2MbFDR7qt5U/w-d-xo.html

  • @mofo78536
    @mofo78536 10 หลายเดือนก่อน

    Would be nice for a quick rundown on ULID vs UUIDv7 and practical considerations between it (e.g. can it be converted between both?)

    • @th30z-code
      @th30z-code 10 หลายเดือนก่อน

      From a data block point of view ULID and UUIDv7 are almost the same thing, since they are both 48bit timestamp + "random data". But the 6bit for version and variant of the UUID format makes them incompatible. The conversion from ULID to UUID will result in losing information. Truncating those 6bits and replacing them with v7 and the variant should not be a problem, but in the worst case it may generate collisions. Converting from UUIDv7 to ULID is not a problem since there is no data loss. From a textual representation point of view, the ULID has the advantage to be shorter. Unfortunately there is no standard support for that, but with few lines of code you can also encode the UUID to Base32 and the Base32 to UUID assuming you are interested in converting them (e.g. if you are using type UUID "type" that your language provides). I hope I have answered your question. Thanks for watching!

    • @mofo78536
      @mofo78536 10 หลายเดือนก่อน

      @@th30z-code yeah I wonder if the difference of 6 bits would make a difference in practical application as of course the length would effect how likely a birthday collision may occur in a distributed system. I am also checking with the spec writer if it would make sense to also standardise on an optional extended ULID that would include a checksum as there may be a chance that people may be writing these IDs down on paper as well. Was looking at Crockford bade32 checksum char which adds 4 more symbols, but his use of = in checksum chars would be hard to use in a url... So might be better if it was appended with a _ to the original ULID string but where the extra characters are the CRC-8 or something easily implemented check instead.

    • @th30z-code
      @th30z-code 10 หลายเดือนก่อน

      In practices you can ignore the probability to generate a collision with both UUID/ULID. I've seen many systems in production blindly trusting the random implementation (but don't use javascript Math.random(), or any pseudo-random generator for your implementation). But yeah, from a numeric point of view, the missing 6bit makes a difference: with ULID the probability of collision in a given millisecond is 1 out of 1208925819614629174706176 (2^80). with UUIDv7 the probability of collision in a given millisecond is 1 out of 18889465931478580854784 (2^74). but it's still a really really low probability. To me, as for all the error handling logic, the question is: Is my code putting a life at risk or not. if not, you can trust the implementation and don't bother about the collision probability. If your ULID/UUID are generated from an enumerable number of machines, you can switch to a different ID generation strategy and remove completely the problem of collisions and even reducing the length of your IDs. Check out the Twitter Snowflake IDs: th-cam.com/users/shortseHr2EIRcYZY

  • @keyurshah6298
    @keyurshah6298 10 หลายเดือนก่อน

    This short explained it to me much better than a 10 minute video could have ever

  • @adrianbool4568
    @adrianbool4568 11 หลายเดือนก่อน

    Very nicely presented video; but I feel the conclusions section let it down. I'd never use a client supplied "random" value as a key in my database. Doing so opens the system to a whole bunch of attacks. You're expecting an ID from the client that, by pure chance, can't practically collide with an existing value but then what happens to your system when someone is intentionally injecting into your system values that already exist? The Snowflake ID was obviously defined to allow for a server generated ID without most of the downsides you list in the conclusion section for Server Generated IDs. (e.g. Relying on a single generation source.)

    • @th30z-code
      @th30z-code 11 หลายเดือนก่อน

      Yeah, sorry you are not the first one reporting the confusion between "client side" and "server side" even if quoted. what I meant was more like IDs generated and passed to the storage/service (client side) vs IDs generated by a single source which is probably the storage itself (server side). so things like Snowflake Ids to me are "client side" since they are not coordinate or created by a central point, but yeah on the comparison I left them a bit out and assumed the larger IDs. you are also right that is not that simple as passing the ID and use that directly, but it's easier to explain the concept of coordinated vs uncoordinated operations without having to go through all the security stuff. For example when you work with mobile apps, and you have to work offline you always have things like (user_id, device_id, uuid) which means that an attacker must have the device session to be able to play with the uids directly. thanks for the feedback!

  • @DomskiPlays
    @DomskiPlays 11 หลายเดือนก่อน

    Finally I had this question for years

    • @th30z-code
      @th30z-code 11 หลายเดือนก่อน

      I'm glad it was useful!

  • @heunsigjo7484
    @heunsigjo7484 11 หลายเดือนก่อน

    This is a superb video. It's easy to miss these points even if we've used Javascript a lot. It makes me review my past code again. Thank you so much.

    • @th30z-code
      @th30z-code 11 หลายเดือนก่อน

      Thank you! I'm glad it was useful

  • @LettersAndNumbers300
    @LettersAndNumbers300 11 หลายเดือนก่อน

    Are dbms’s smart enough to use the timestamp in v7 to sort / filter quickly? Mainly interested in SQL server but also open to graph DBs.

    • @th30z-code
      @th30z-code 11 หลายเดือนก่อน

      Even if the database doesn't know about the type (UUIDv7), the layout of the UUIDv7 (the timestamp in the beginning) is made specifically to make the IDs sort by timestamp, and you can leverage btree indexes. so, you can make an efficient between, less-than, greater-than query even if the uuid is stored as binary or text (hex retain the numeric order) '01893bdf-37a3-0000-0000-000000000000' < '01893be0-8c25-0000-0000-00000000000' If the database implementation is aware about the UUIDv7 type, and gives you the ability to filter only by timestamp. it can just look at the first 48bit, and discarding the rest. the sort order given by the uuid layout is already correct.

    • @LettersAndNumbers300
      @LettersAndNumbers300 11 หลายเดือนก่อน

      @@th30z-code awesome, thanks

  • @casiowatch125
    @casiowatch125 11 หลายเดือนก่อน

    Awesome stuff thanks

    • @th30z-code
      @th30z-code 11 หลายเดือนก่อน

      Glad you enjoyed it!